Bug 766546 - Ignore the iframe's load event and continue when the whole page has loaded. r=avih
authorTim Taubert <ttaubert@mozilla.com>
Wed, 24 Jul 2013 17:58:05 +0200
changeset 139876 bf3c83a7aed05e9ca91802e16a0045a848535372
parent 139875 ff8930432f20864827c27c399b1678e8313529cd
child 139877 ff3b2131de1289d1609dc69f14a569c839205815
push idunknown
push userunknown
push dateunknown
reviewersavih
bugs766546
milestone25.0a1
Bug 766546 - Ignore the iframe's load event and continue when the whole page has loaded. r=avih
browser/base/content/test/Makefile.in
browser/base/content/test/browser_bug561636.js
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -118,16 +118,17 @@ MOCHITEST_BROWSER_FILES = \
                  browser_bug537474.js \
                  browser_bug550565.js \
                  browser_bug553455.js \
                  browser_bug555224.js \
                  browser_bug555767.js \
                  browser_bug556061.js \
                  browser_bug559991.js \
                  browser_bug561623.js \
+                 browser_bug561636.js \
                  browser_bug562649.js \
                  browser_bug563588.js \
                  browser_bug565575.js \
                  browser_bug567306.js \
                  browser_bug575561.js \
                  browser_bug575830.js \
                  browser_bug577121.js \
                  browser_bug578534.js \
@@ -347,22 +348,15 @@ MOCHITEST_BROWSER_FILES += \
 		browser_bug462289.js \
 		$(NULL)
 else
 MOCHITEST_BROWSER_FILES += \
 		browser_bug565667.js \
 		$(NULL)
 endif
 
-ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-# Bug 766546.
-MOCHITEST_BROWSER_FILES += \
-  browser_bug561636.js \
-  $(NULL)
-endif
-
 ifdef MOZ_DATA_REPORTING
 MOCHITEST_BROWSER_FILES += \
   browser_datareporting_notification.js \
   $(NULL)
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/base/content/test/browser_bug561636.js
+++ b/browser/base/content/test/browser_bug561636.js
@@ -369,23 +369,25 @@ function()
 
       nextTest();
     });
   };
 
   Services.obs.addObserver(gObserver, "invalidformsubmit", false);
 
   tab.linkedBrowser.addEventListener("load", function(e) {
-    let browser = e.currentTarget;
-    browser.removeEventListener("load", arguments.callee, true);
+    // Ignore load events from the iframe.
+    if (tab.linkedBrowser.contentDocument == e.target) {
+      let browser = e.currentTarget;
+      browser.removeEventListener("load", arguments.callee, true);
 
-    isnot(gBrowser.selectedTab.linkedBrowser, browser,
-          "This tab should have been loaded in background");
-    Services.console.logStringMessage("About to click #s on URI: " + browser.contentDocument.location.href);
-    browser.contentDocument.getElementById('s').click();
+      isnot(gBrowser.selectedTab.linkedBrowser, browser,
+            "This tab should have been loaded in background");
+      browser.contentDocument.getElementById('s').click();
+    }
   }, true);
 
   tab.linkedBrowser.loadURI(uri);
 },
 
 /**
  * In this test, we check that the author defined error message is shown.
  */