Bug 902530 - Fix contentDocument usage from test wrapper function. r=jaws, a=test-only
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Mon, 12 Aug 2013 22:51:09 +0200
changeset 153807 dedabe1cc3d02e1d877b9084dc30f1c5d0a23da9
parent 153806 c64dc2dbb477c22605451a1959e6d8da1038a1cc
child 153808 4202492ea7d488a18341f5c83a35e16386341b77
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, test-only
bugs902530
milestone25.0a2
Bug 902530 - Fix contentDocument usage from test wrapper function. r=jaws, a=test-only
browser/base/content/test/browser_CTP_data_urls.js
browser/base/content/test/browser_pluginnotification.js
--- a/browser/base/content/test/browser_CTP_data_urls.js
+++ b/browser/base/content/test/browser_CTP_data_urls.js
@@ -95,18 +95,18 @@ function prepareTest(nextTest, url) {
   gTestBrowser.contentWindow.location = url;
 }
 
 // Due to layout being async, "PluginBindAttached" may trigger later.
 // This wraps a function to force a layout flush, thus triggering it,
 // and schedules the function execution so they're definitely executed
 // afterwards.
 function runAfterPluginBindingAttached(func) {
-  let doc = gTestBrowser.contentDocument;
   return function() {
+    let doc = gTestBrowser.contentDocument;
     let elems = doc.getElementsByTagName('embed');
     if (elems.length < 1) {
       elems = doc.getElementsByTagName('object');
     }
     elems[0].clientTop;
     executeSoon(func);
   };
 }
--- a/browser/base/content/test/browser_pluginnotification.js
+++ b/browser/base/content/test/browser_pluginnotification.js
@@ -94,18 +94,18 @@ function prepareTest(nextTest, url) {
   gTestBrowser.contentWindow.location = url;
 }
 
 // Due to layout being async, "PluginBindAttached" may trigger later.
 // This wraps a function to force a layout flush, thus triggering it,
 // and schedules the function execution so they're definitely executed
 // afterwards.
 function runAfterPluginBindingAttached(func) {
-  let doc = gTestBrowser.contentDocument;
   return function() {
+    let doc = gTestBrowser.contentDocument;
     let elems = doc.getElementsByTagName('embed');
     if (elems.length < 1) {
       elems = doc.getElementsByTagName('object');
     }
     elems[0].clientTop;
     executeSoon(func);
   };
 }
@@ -235,17 +235,17 @@ function test8() {
 
 // Tests 9 & 10 removed
 
 // Tests that the going back will reshow the notification for click-to-play plugins (part 1/4)
 function test11a() {
   var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
   ok(popupNotification, "Test 11a, Should have a click-to-play notification");
 
-  prepareTest(runAfterPluginBindingAttached(test11b), "about:blank");
+  prepareTest(test11b, "about:blank");
 }
 
 // Tests that the going back will reshow the notification for click-to-play plugins (part 2/4)
 function test11b() {
   var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
   ok(!popupNotification, "Test 11b, Should not have a click-to-play notification");
 
   Services.obs.addObserver(test11c, "PopupNotifications-updateNotShowing", false);
@@ -514,17 +514,17 @@ function test19e() {
   ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed, "Test 19e, Doorhanger should start out dismissed");
 
   EventUtils.synthesizeMouse(plugin, 50, 50, {}, gTestBrowser.contentWindow);
   let condition = function() !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed;
   waitForCondition(condition, test19f, "Test 19e, Waited too long for plugin to activate");
 }
 
 function test19f() {
-  prepareTest(runAfterPluginBindingAttached(test20a), gTestRoot + "plugin_hidden_to_visible.html");
+  prepareTest(test20a, gTestRoot + "plugin_hidden_to_visible.html");
 }
 
 // Tests that a plugin in a div that goes from style="display: none" to
 // "display: block" can be clicked to activate.
 function test20a() {
   var clickToPlayNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
   ok(!clickToPlayNotification, "Test 20a, Should not have a click-to-play notification");
   var doc = gTestBrowser.contentDocument;