1 : /* ***** BEGIN LICENSE BLOCK *****
2 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 : *
4 : * The contents of this file are subject to the Mozilla Public License Version
5 : * 1.1 (the "License"); you may not use this file except in compliance with
6 : * the License. You may obtain a copy of the License at
7 : * http://www.mozilla.org/MPL/
8 : *
9 : * Software distributed under the License is distributed on an "AS IS" basis,
10 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 : * for the specific language governing rights and limitations under the
12 : * License.
13 : *
14 : * The Original Code is mozilla.org code.
15 : *
16 : * The Initial Developer of the Original Code is
17 : * Mozilla Foundation.
18 : * Portions created by the Initial Developer are Copyright (C) 2010
19 : * the Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s):
22 : * Alexander Surkov <surkov.alexander@gmail.com> (original author)
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either the GNU General Public License Version 2 or later (the "GPL"), or
26 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : #ifndef nsAccDocManager_h_
39 : #define nsAccDocManager_h_
40 :
41 : #include "nsIDocument.h"
42 : #include "nsIDOMEventListener.h"
43 : #include "nsRefPtrHashtable.h"
44 : #include "nsIWebProgress.h"
45 : #include "nsIWebProgressListener.h"
46 : #include "nsWeakReference.h"
47 :
48 : class nsAccessible;
49 : class nsDocAccessible;
50 :
51 : //#define DEBUG_ACCDOCMGR
52 :
53 : /**
54 : * Manage the document accessible life cycle.
55 : */
56 : class nsAccDocManager : public nsIWebProgressListener,
57 : public nsIDOMEventListener,
58 : public nsSupportsWeakReference
59 : {
60 : public:
61 0 : virtual ~nsAccDocManager() { };
62 :
63 : NS_DECL_ISUPPORTS
64 : NS_DECL_NSIWEBPROGRESSLISTENER
65 : NS_DECL_NSIDOMEVENTLISTENER
66 :
67 : /**
68 : * Return document accessible for the given DOM node.
69 : */
70 : nsDocAccessible *GetDocAccessible(nsIDocument *aDocument);
71 :
72 : /**
73 : * Search through all document accessibles for an accessible with the given
74 : * unique id.
75 : */
76 : nsAccessible* FindAccessibleInCache(nsINode* aNode) const;
77 :
78 : /**
79 : * Return document accessible from the cache. Convenient method for testing.
80 : */
81 0 : inline nsDocAccessible* GetDocAccessibleFromCache(nsIDocument* aDocument) const
82 : {
83 0 : return mDocAccessibleCache.GetWeak(aDocument);
84 : }
85 :
86 : /**
87 : * Called by document accessible when it gets shutdown.
88 : */
89 0 : inline void NotifyOfDocumentShutdown(nsIDocument* aDocument)
90 : {
91 0 : mDocAccessibleCache.Remove(aDocument);
92 0 : }
93 :
94 : #ifdef DEBUG
95 : bool IsProcessingRefreshDriverNotification() const;
96 : #endif
97 :
98 : protected:
99 0 : nsAccDocManager() { };
100 :
101 : /**
102 : * Initialize the manager.
103 : */
104 : bool Init();
105 :
106 : /**
107 : * Shutdown the manager.
108 : */
109 : void Shutdown();
110 :
111 : private:
112 : nsAccDocManager(const nsAccDocManager&);
113 : nsAccDocManager& operator =(const nsAccDocManager&);
114 :
115 : private:
116 : /**
117 : * Create an accessible document if it was't created and fire accessibility
118 : * events if needed.
119 : *
120 : * @param aDocument [in] loaded DOM document
121 : * @param aLoadEventType [in] specifies the event type to fire load event,
122 : * if 0 then no event is fired
123 : */
124 : void HandleDOMDocumentLoad(nsIDocument *aDocument,
125 : PRUint32 aLoadEventType);
126 :
127 : /**
128 : * Add 'pagehide' and 'DOMContentLoaded' event listeners.
129 : */
130 : void AddListeners(nsIDocument *aDocument, bool aAddPageShowListener);
131 :
132 : /**
133 : * Create document or root accessible.
134 : */
135 : nsDocAccessible *CreateDocOrRootAccessible(nsIDocument *aDocument);
136 :
137 : typedef nsRefPtrHashtable<nsPtrHashKey<const nsIDocument>, nsDocAccessible>
138 : nsDocAccessibleHashtable;
139 :
140 : /**
141 : * Get first entry of the document accessible from cache.
142 : */
143 : static PLDHashOperator
144 : GetFirstEntryInDocCache(const nsIDocument* aKey,
145 : nsDocAccessible* aDocAccessible,
146 : void* aUserArg);
147 :
148 : /**
149 : * Clear the cache and shutdown the document accessibles.
150 : */
151 : void ClearDocCache();
152 :
153 : struct nsSearchAccessibleInCacheArg
154 : {
155 : nsAccessible *mAccessible;
156 : nsINode* mNode;
157 : };
158 :
159 : static PLDHashOperator
160 : SearchAccessibleInDocCache(const nsIDocument* aKey,
161 : nsDocAccessible* aDocAccessible,
162 : void* aUserArg);
163 :
164 : #ifdef DEBUG
165 : static PLDHashOperator
166 : SearchIfDocIsRefreshing(const nsIDocument* aKey,
167 : nsDocAccessible* aDocAccessible, void* aUserArg);
168 : #endif
169 :
170 : nsDocAccessibleHashtable mDocAccessibleCache;
171 : };
172 :
173 : /**
174 : * nsAccDocManager debugging macros.
175 : */
176 : #ifdef DEBUG_ACCDOCMGR
177 :
178 : #include "nsTraceRefcntImpl.h"
179 :
180 : // Enable these to log accessible document loading, creation or destruction.
181 : #define DEBUG_ACCDOCMGR_DOCLOAD
182 : #define DEBUG_ACCDOCMGR_DOCCREATE
183 : #define DEBUG_ACCDOCMGR_DOCDESTROY
184 :
185 : // Common macros, do not use directly.
186 : #define NS_LOG_ACCDOC_ADDRESS(aDocument, aDocAcc) \
187 : printf("DOM id: %p, acc id: %p", aDocument, aDocAcc);
188 :
189 : #define NS_LOG_ACCDOC_URI(aDocument) \
190 : nsIURI *uri = aDocument->GetDocumentURI(); \
191 : nsCAutoString spec; \
192 : uri->GetSpec(spec); \
193 : printf("uri: %s", spec);
194 :
195 : #define NS_LOG_ACCDOC_TYPE(aDocument) \
196 : if (aDocument->IsActive()) { \
197 : bool isContent = nsCoreUtils::IsContentDocument(aDocument); \
198 : printf("%s document", (isContent ? "content" : "chrome")); \
199 : } else { \
200 : printf("document type: [failed]"); \
201 : }
202 :
203 : #define NS_LOG_ACCDOC_DOCSHELLTREE(aDocument) \
204 : if (aDocument->IsActive()) { \
205 : nsCOMPtr<nsISupports> container = aDocument->GetContainer(); \
206 : nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container)); \
207 : nsCOMPtr<nsIDocShellTreeItem> parentTreeItem; \
208 : treeItem->GetParent(getter_AddRefs(parentTreeItem)); \
209 : nsCOMPtr<nsIDocShellTreeItem> rootTreeItem; \
210 : treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem)); \
211 : printf("docshell hierarchy, parent: %p, root: %p, is tab document: %s;", \
212 : parentTreeItem, rootTreeItem, \
213 : (nsCoreUtils::IsTabDocument(aDocument) ? "yes" : "no")); \
214 : }
215 :
216 : #define NS_LOG_ACCDOC_SHELLSTATE(aDocument) \
217 : nsCAutoString docShellBusy; \
218 : nsCOMPtr<nsISupports> container = aDocument->GetContainer(); \
219 : if (container) { \
220 : nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container); \
221 : PRUint32 busyFlags = nsIDocShell::BUSY_FLAGS_NONE; \
222 : docShell->GetBusyFlags(&busyFlags); \
223 : if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE) \
224 : docShellBusy.AppendLiteral("'none'"); \
225 : if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY) \
226 : docShellBusy.AppendLiteral("'busy'"); \
227 : if (busyFlags & nsIDocShell::BUSY_FLAGS_BEFORE_PAGE_LOAD) \
228 : docShellBusy.AppendLiteral(", 'before page load'"); \
229 : if (busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING) \
230 : docShellBusy.AppendLiteral(", 'page loading'"); \
231 : } \
232 : else { \
233 : docShellBusy.AppendLiteral("[failed]"); \
234 : } \
235 : printf("docshell busy: %s", docShellBusy.get());
236 :
237 : #define NS_LOG_ACCDOC_DOCSTATES(aDocument) \
238 : const char *docState = 0; \
239 : nsIDocument::ReadyState docStateFlag = aDocument->GetReadyStateEnum(); \
240 : switch (docStateFlag) { \
241 : case nsIDocument::READYSTATE_UNINITIALIZED: \
242 : docState = "uninitialized"; \
243 : break; \
244 : case nsIDocument::READYSTATE_LOADING: \
245 : docState = "loading"; \
246 : break; \
247 : case nsIDocument::READYSTATE_INTERACTIVE: \
248 : docState = "interactive"; \
249 : break; \
250 : case nsIDocument::READYSTATE_COMPLETE: \
251 : docState = "complete"; \
252 : break; \
253 : } \
254 : printf("doc state: %s", docState); \
255 : printf(", %sinitial", aDocument->IsInitialDocument() ? "" : "not "); \
256 : printf(", %sshowing", aDocument->IsShowing() ? "" : "not "); \
257 : printf(", %svisible", aDocument->IsVisible() ? "" : "not "); \
258 : printf(", %sactive", aDocument->IsActive() ? "" : "not ");
259 :
260 : #define NS_LOG_ACCDOC_DOCPRESSHELL(aDocument) \
261 : nsIPresShell *ps = aDocument->GetShell(); \
262 : printf("presshell: %p", ps); \
263 : nsIScrollableFrame *sf = ps ? \
264 : ps->GetRootScrollFrameAsScrollableExternal() : nsnull; \
265 : printf(", root scroll frame: %p", sf);
266 :
267 : #define NS_LOG_ACCDOC_DOCLOADGROUP(aDocument) \
268 : nsCOMPtr<nsILoadGroup> loadGroup = aDocument->GetDocumentLoadGroup(); \
269 : printf("load group: %p", loadGroup);
270 :
271 : #define NS_LOG_ACCDOC_DOCPARENT(aDocument) \
272 : nsIDocument *parentDoc = aDocument->GetParentDocument(); \
273 : printf("parent id: %p", parentDoc); \
274 : if (parentDoc) { \
275 : printf("\n parent "); \
276 : NS_LOG_ACCDOC_URI(parentDoc) \
277 : printf("\n"); \
278 : }
279 :
280 : #define NS_LOG_ACCDOC_SHELLLOADTYPE(aDocShell) \
281 : { \
282 : printf("load type: "); \
283 : PRUint32 loadType; \
284 : docShell->GetLoadType(&loadType); \
285 : switch (loadType) { \
286 : case LOAD_NORMAL: \
287 : printf("normal; "); \
288 : break; \
289 : case LOAD_NORMAL_REPLACE: \
290 : printf("normal replace; "); \
291 : break; \
292 : case LOAD_NORMAL_EXTERNAL: \
293 : printf("normal external; "); \
294 : break; \
295 : case LOAD_HISTORY: \
296 : printf("history; "); \
297 : break; \
298 : case LOAD_NORMAL_BYPASS_CACHE: \
299 : printf("normal bypass cache; "); \
300 : break; \
301 : case LOAD_NORMAL_BYPASS_PROXY: \
302 : printf("normal bypass proxy; "); \
303 : break; \
304 : case LOAD_NORMAL_BYPASS_PROXY_AND_CACHE: \
305 : printf("normal bypass proxy and cache; "); \
306 : break; \
307 : case LOAD_RELOAD_NORMAL: \
308 : printf("reload normal; "); \
309 : break; \
310 : case LOAD_RELOAD_BYPASS_CACHE: \
311 : printf("reload bypass cache; "); \
312 : break; \
313 : case LOAD_RELOAD_BYPASS_PROXY: \
314 : printf("reload bypass proxy; "); \
315 : break; \
316 : case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE: \
317 : printf("reload bypass proxy and cache; "); \
318 : break; \
319 : case LOAD_LINK: \
320 : printf("link; "); \
321 : break; \
322 : case LOAD_REFRESH: \
323 : printf("refresh; "); \
324 : break; \
325 : case LOAD_RELOAD_CHARSET_CHANGE: \
326 : printf("reload charset change; "); \
327 : break; \
328 : case LOAD_BYPASS_HISTORY: \
329 : printf("bypass history; "); \
330 : break; \
331 : case LOAD_STOP_CONTENT: \
332 : printf("stop content; "); \
333 : break; \
334 : case LOAD_STOP_CONTENT_AND_REPLACE: \
335 : printf("stop content and replace; "); \
336 : break; \
337 : case LOAD_PUSHSTATE: \
338 : printf("load pushstate; "); \
339 : break; \
340 : case LOAD_ERROR_PAGE: \
341 : printf("error page;"); \
342 : break; \
343 : default: \
344 : printf("unknown"); \
345 : } \
346 : }
347 :
348 : #define NS_LOG_ACCDOC_DOCINFO_BEGIN \
349 : printf(" {\n");
350 : #define NS_LOG_ACCDOC_DOCINFO_BODY(aDocument, aDocAcc) \
351 : { \
352 : printf(" "); \
353 : NS_LOG_ACCDOC_ADDRESS(aDocument, aDocAcc) \
354 : printf("\n "); \
355 : if (aDocument) { \
356 : NS_LOG_ACCDOC_URI(aDocument) \
357 : printf("\n "); \
358 : NS_LOG_ACCDOC_SHELLSTATE(aDocument) \
359 : printf("; "); \
360 : NS_LOG_ACCDOC_TYPE(aDocument) \
361 : printf("\n "); \
362 : NS_LOG_ACCDOC_DOCSHELLTREE(aDocument) \
363 : printf("\n "); \
364 : NS_LOG_ACCDOC_DOCSTATES(aDocument) \
365 : printf("\n "); \
366 : NS_LOG_ACCDOC_DOCPRESSHELL(aDocument) \
367 : printf("\n "); \
368 : NS_LOG_ACCDOC_DOCLOADGROUP(aDocument) \
369 : printf(", "); \
370 : NS_LOG_ACCDOC_DOCPARENT(aDocument) \
371 : printf("\n"); \
372 : } \
373 : }
374 : #define NS_LOG_ACCDOC_DOCINFO_END \
375 : printf(" }\n");
376 :
377 : #define NS_LOG_ACCDOC_DOCINFO(aDocument, aDocAcc) \
378 : NS_LOG_ACCDOC_DOCINFO_BEGIN \
379 : NS_LOG_ACCDOC_DOCINFO_BODY(aDocument, aDocAcc) \
380 : NS_LOG_ACCDOC_DOCINFO_END
381 :
382 : #define NS_GET_ACCDOC_EVENTTYPE(aEvent) \
383 : nsCAutoString strEventType; \
384 : PRUint32 type = aEvent->GetEventType(); \
385 : if (type == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED) { \
386 : strEventType.AssignLiteral("load stopped"); \
387 : } else if (type == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE) { \
388 : strEventType.AssignLiteral("load complete"); \
389 : } else if (type == nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD) { \
390 : strEventType.AssignLiteral("reload"); \
391 : } else if (type == nsIAccessibleEvent::EVENT_STATE_CHANGE) { \
392 : AccStateChangeEvent* event = downcast_accEvent(aEvent); \
393 : if (event->GetState() == states::BUSY) { \
394 : strEventType.AssignLiteral("busy "); \
395 : if (event->IsStateEnabled()) \
396 : strEventType.AppendLiteral("true"); \
397 : else \
398 : strEventType.AppendLiteral("false"); \
399 : } \
400 : }
401 :
402 : #define NS_LOG_ACCDOC_ACCADDRESS(aName, aAcc) \
403 : { \
404 : nsINode* node = aAcc->GetNode(); \
405 : nsIDocument* doc = aAcc->GetDocumentNode(); \
406 : nsDocAccessible *docacc = GetAccService()->GetDocAccessibleFromCache(doc); \
407 : printf(" " aName " accessible: %p, node: %p\n", aAcc, node); \
408 : printf(" docacc for " aName " accessible: %p, node: %p\n", docacc, doc); \
409 : printf(" "); \
410 : NS_LOG_ACCDOC_URI(doc) \
411 : printf("\n"); \
412 : }
413 :
414 : #define NS_LOG_ACCDOC_MSG(aMsg) \
415 : printf("\n" aMsg "\n"); \
416 :
417 : #define NS_LOG_ACCDOC_TEXT(aMsg) \
418 : printf(" " aMsg "\n");
419 :
420 : #define NS_LOG_ACCDOC_STACK \
421 : printf(" stack: \n"); \
422 : nsTraceRefcntImpl::WalkTheStack(stdout);
423 :
424 : // Accessible document loading macros.
425 : #ifdef DEBUG_ACCDOCMGR_DOCLOAD
426 :
427 : #define NS_LOG_ACCDOCLOAD_REQUEST(aRequest) \
428 : if (aRequest) { \
429 : nsCAutoString name; \
430 : aRequest->GetName(name); \
431 : printf(" request spec: %s\n", name.get()); \
432 : PRUint32 loadFlags = 0; \
433 : aRequest->GetLoadFlags(&loadFlags); \
434 : printf(" request load flags: %x; ", loadFlags); \
435 : if (loadFlags & nsIChannel::LOAD_DOCUMENT_URI) \
436 : printf("document uri; "); \
437 : if (loadFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI) \
438 : printf("retargeted document uri; "); \
439 : if (loadFlags & nsIChannel::LOAD_REPLACE) \
440 : printf("replace; "); \
441 : if (loadFlags & nsIChannel::LOAD_INITIAL_DOCUMENT_URI) \
442 : printf("initial document uri; "); \
443 : if (loadFlags & nsIChannel::LOAD_TARGETED) \
444 : printf("targeted; "); \
445 : if (loadFlags & nsIChannel::LOAD_CALL_CONTENT_SNIFFERS) \
446 : printf("call content sniffers; "); \
447 : if (loadFlags & nsIChannel::LOAD_CLASSIFY_URI) \
448 : printf("classify uri; "); \
449 : } else { \
450 : printf(" no request"); \
451 : }
452 :
453 : #define NS_LOG_ACCDOCLOAD(aMsg, aWebProgress, aRequest, aStateFlags) \
454 : { \
455 : NS_LOG_ACCDOC_MSG("A11Y DOCLOAD: " aMsg); \
456 : \
457 : nsCOMPtr<nsIDOMWindow> DOMWindow; \
458 : aWebProgress->GetDOMWindow(getter_AddRefs(DOMWindow)); \
459 : if (DOMWindow) { \
460 : nsCOMPtr<nsIDOMDocument> DOMDocument; \
461 : DOMWindow->GetDocument(getter_AddRefs(DOMDocument)); \
462 : if (DOMDocument) { \
463 : nsCOMPtr<nsIDocument> document(do_QueryInterface(DOMDocument)); \
464 : nsDocAccessible *docAcc = \
465 : GetAccService()->GetDocAccessibleFromCache(document); \
466 : NS_LOG_ACCDOC_DOCINFO(document, docAcc) \
467 : \
468 : printf(" {\n"); \
469 : nsCOMPtr<nsIWebNavigation> webNav(do_GetInterface(DOMWindow)); \
470 : nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(webNav)); \
471 : printf(" "); \
472 : NS_LOG_ACCDOC_SHELLLOADTYPE(docShell) \
473 : printf("\n"); \
474 : NS_LOG_ACCDOCLOAD_REQUEST(aRequest) \
475 : printf("\n"); \
476 : printf(" state flags: %x", aStateFlags); \
477 : bool isDocLoading; \
478 : aWebProgress->GetIsLoadingDocument(&isDocLoading); \
479 : printf(", document is %sloading\n", (isDocLoading ? "" : "not ")); \
480 : printf(" }\n"); \
481 : } \
482 : } \
483 : }
484 :
485 : #define NS_LOG_ACCDOCLOAD2(aMsg, aDocument) \
486 : { \
487 : NS_LOG_ACCDOC_MSG("A11Y DOCLOAD: " aMsg); \
488 : nsDocAccessible *docAcc = \
489 : GetAccService()->GetDocAccessibleFromCache(aDocument); \
490 : NS_LOG_ACCDOC_DOCINFO(aDocument, docAcc) \
491 : }
492 :
493 : #define NS_LOG_ACCDOCLOAD_FIREEVENT(aEvent) \
494 : { \
495 : NS_GET_ACCDOC_EVENTTYPE(aEvent) \
496 : if (!strEventType.IsEmpty()) \
497 : printf(" fire: %s\n", strEventType.get()); \
498 : }
499 :
500 : #define NS_LOG_ACCDOCLOAD_HANDLEEVENT(aEvent) \
501 : { \
502 : NS_GET_ACCDOC_EVENTTYPE(aEvent) \
503 : nsCOMPtr<nsIDocument> doc(do_QueryInterface(aEvent->GetNode())); \
504 : if (doc && !strEventType.IsEmpty()) { \
505 : printf("\nA11Y DOCEVENT: handled '%s' event ", strEventType.get()); \
506 : nsDocAccessible *docAcc = aEvent->GetDocAccessible(); \
507 : NS_LOG_ACCDOC_DOCINFO(doc, docAcc) \
508 : printf("\n"); \
509 : } \
510 : }
511 :
512 : #define NS_LOG_ACCDOCLOAD_TEXT(aMsg) \
513 : NS_LOG_ACCDOC_TEXT(aMsg)
514 :
515 : #endif // DEBUG_ACCDOCMGR_DOCLOAD
516 :
517 : // Accessible document creation macros.
518 : #ifdef DEBUG_ACCDOCMGR_DOCCREATE
519 : #define NS_LOG_ACCDOCCREATE_FOR(aMsg, aDocument, aDocAcc) \
520 : NS_LOG_ACCDOC_MSG("A11Y DOCCREATE: " aMsg); \
521 : NS_LOG_ACCDOC_DOCINFO(aDocument, aDocAcc)
522 :
523 : #define NS_LOG_ACCDOCCREATE(aMsg, aDocument) \
524 : { \
525 : nsDocAccessible *docAcc = \
526 : GetAccService()->GetDocAccessibleFromCache(aDocument); \
527 : NS_LOG_ACCDOCCREATE_FOR(aMsg, aDocument, docAcc) \
528 : }
529 :
530 : #define NS_LOG_ACCDOCCREATE_ACCADDRESS(aName, aAcc) \
531 : NS_LOG_ACCDOC_ACCADDRESS(aName, aAcc)
532 :
533 : #define NS_LOG_ACCDOCCREATE_TEXT(aMsg) \
534 : NS_LOG_ACCDOC_TEXT(aMsg)
535 :
536 : #define NS_LOG_ACCDOCCREATE_STACK \
537 : NS_LOG_ACCDOC_STACK
538 :
539 : #endif // DEBUG_ACCDOCMGR_DOCCREATE
540 :
541 : // Accessible document destruction macros.
542 : #ifdef DEBUG_ACCDOCMGR_DOCDESTROY
543 : #define NS_LOG_ACCDOCDESTROY_FOR(aMsg, aDocument, aDocAcc) \
544 : NS_LOG_ACCDOC_MSG("A11Y DOCDESTROY: " aMsg); \
545 : NS_LOG_ACCDOC_DOCINFO(aDocument, aDocAcc)
546 :
547 : #define NS_LOG_ACCDOCDESTROY(aMsg, aDocument) \
548 : { \
549 : nsDocAccessible* docAcc = \
550 : GetAccService()->GetDocAccessibleFromCache(aDocument); \
551 : NS_LOG_ACCDOCDESTROY_FOR(aMsg, aDocument, docAcc) \
552 : }
553 :
554 : #define NS_LOG_ACCDOCDESTROY_ACCADDRESS(aName, aAcc) \
555 : NS_LOG_ACCDOC_ACCADDRESS(aName, aAcc)
556 :
557 : #define NS_LOG_ACCDOCDESTROY_MSG(aMsg) \
558 : NS_LOG_ACCDOC_MSG(aMsg)
559 :
560 : #define NS_LOG_ACCDOCDESTROY_TEXT(aMsg) \
561 : NS_LOG_ACCDOC_TEXT(aMsg)
562 :
563 : #endif // DEBUG_ACCDOCMGR_DOCDESTROY
564 :
565 : #endif // DEBUG_ACCDOCMGR
566 :
567 : #ifndef DEBUG_ACCDOCMGR_DOCLOAD
568 : #define NS_LOG_ACCDOCLOAD(aMsg, aWebProgress, aRequest, aStateFlags)
569 : #define NS_LOG_ACCDOCLOAD2(aMsg, aDocument)
570 : #define NS_LOG_ACCDOCLOAD_EVENT(aMsg, aEvent)
571 : #define NS_LOG_ACCDOCLOAD_FIREEVENT(aEvent)
572 : #define NS_LOG_ACCDOCLOAD_HANDLEEVENT(aEvent)
573 : #define NS_LOG_ACCDOCLOAD_TEXT(aMsg)
574 : #endif
575 :
576 : #ifndef DEBUG_ACCDOCMGR_DOCCREATE
577 : #define NS_LOG_ACCDOCCREATE_FOR(aMsg, aDocument, aDocAcc)
578 : #define NS_LOG_ACCDOCCREATE(aMsg, aDocument)
579 : #define NS_LOG_ACCDOCCREATE_ACCADDRESS(aName, aAcc)
580 : #define NS_LOG_ACCDOCCREATE_TEXT(aMsg)
581 : #define NS_LOG_ACCDOCCREATE_STACK
582 : #endif
583 :
584 : #ifndef DEBUG_ACCDOCMGR_DOCDESTROY
585 : #define NS_LOG_ACCDOCDESTROY_FOR(aMsg, aDocument, aDocAcc)
586 : #define NS_LOG_ACCDOCDESTROY(aMsg, aDocument)
587 : #define NS_LOG_ACCDOCDESTROY_MSG(aMsg)
588 : #define NS_LOG_ACCDOCDESTROY_ACCADDRESS(aName, aAcc)
589 : #define NS_LOG_ACCDOCDESTROY_TEXT(aMsg)
590 : #endif
591 :
592 : #endif // nsAccDocManager_h_
|