Bug 638465 - Do not ignore inital documents. r=tbsaunde, a=lsblakk
authorAlexander Surkov <surkov.alexander@gmail.com>
Wed, 02 Apr 2014 15:36:48 -0400
changeset 192083 a470c97f3668cd621a7fa753597b06109909b18d
parent 192082 8ca89a9ca5bed6705c595296d712bb88674dfc4c
child 192084 00962671d272c5ec92f5f5aa7eb8a78a686ae34a
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde, lsblakk
bugs638465
milestone30.0a2
Bug 638465 - Do not ignore inital documents. r=tbsaunde, a=lsblakk
accessible/src/base/DocManager.cpp
accessible/tests/mochitest/relations/test_embeds.xul
--- a/accessible/src/base/DocManager.cpp
+++ b/accessible/src/base/DocManager.cpp
@@ -266,21 +266,16 @@ DocManager::HandleEvent(nsIDOMEvent* aEv
     // accessible and all its sub document accessible are shutdown as result of
     // processing.
 
 #ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eDocDestroy))
       logging::DocDestroy("received 'pagehide' event", document);
 #endif
 
-    // Ignore 'pagehide' on temporary documents since we ignore them entirely in
-    // accessibility.
-    if (document->IsInitialDocument())
-      return NS_OK;
-
     // Shutdown this one and sub document accessibles.
 
     // We're allowed to not remove listeners when accessible document is
     // shutdown since we don't keep strong reference on chrome event target and
     // listeners are removed automatically when chrome event target goes away.
     DocAccessible* docAccessible = GetExistingDocAccessible(document);
     if (docAccessible)
       docAccessible->Shutdown();
@@ -365,20 +360,18 @@ DocManager::RemoveListeners(nsIDocument*
 
   elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("DOMContentLoaded"),
                                  TrustedEventsAtCapture());
 }
 
 DocAccessible*
 DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
 {
-  // Ignore temporary, hiding, resource documents and documents without
-  // docshell.
-  if (aDocument->IsInitialDocument() ||
-      !aDocument->IsVisibleConsideringAncestors() ||
+  // Ignore hiding, resource documents and documents without docshell.
+  if (!aDocument->IsVisibleConsideringAncestors() ||
       aDocument->IsResourceDoc() || !aDocument->IsActive())
     return nullptr;
 
   // Ignore documents without presshell and not having root frame.
   nsIPresShell* presShell = aDocument->GetShell();
   if (!presShell || presShell->IsDestroying())
     return nullptr;
 
--- a/accessible/tests/mochitest/relations/test_embeds.xul
+++ b/accessible/tests/mochitest/relations/test_embeds.xul
@@ -47,25 +47,43 @@
       }
 
       this.getID = function loadURI_getID()
       {
         return "load uri " + aURI;
       }
     }
 
+    function browserReorderChecker()
+    {
+      this.type = EVENT_REORDER;
+
+      this.match = function browserReorderChecker_match(aEvent)
+      {
+        // Reorder event might be duped because of temporary document creation.
+        if (aEvent.accessible == getAccessible(currentBrowser())) {
+          this.cnt++;
+          return this.cnt != 2;
+        }
+
+        return false;
+      }
+
+      this.cnt = 0;
+    }
+
     function loadOneTab(aURI)
     {
       this.invoke = function loadOneTab_invoke()
       {
         tabBrowser().loadOneTab(aURI, null, null, null, false);
       }
 
       this.eventSeq = [
-        new invokerChecker(EVENT_REORDER, currentBrowser)
+        new browserReorderChecker()
       ];
 
       this.finalCheck = function loadURI_finalCheck()
       {
         testRelation(browserDocument(), RELATION_EMBEDS,
                      getAccessible(currentTabDocument()));
       }