Bug 1274687 - change test to use ContentTask.spawn r=ehsan
authorJames Andreou <jandreou@mozilla.com>
Wed, 01 Jun 2016 12:26:43 -0700
changeset 300010 f9c82b044f90bf8a1e141c290b0e206ed99a8b53
parent 300009 6dc6de0341fa0af17e0d5c33d236b800b5419fcd
child 300011 dc171b5fafc0742057f24d66dd76818f95c86656
push id30305
push usercbook@mozilla.com
push dateThu, 02 Jun 2016 09:56:32 +0000
treeherdermozilla-central@34a8be4346a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1274687
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1274687 - change test to use ContentTask.spawn r=ehsan
browser/base/content/test/plugins/browser_private_clicktoplay.js
--- a/browser/base/content/test/plugins/browser_private_clicktoplay.js
+++ b/browser/base/content/test/plugins/browser_private_clicktoplay.js
@@ -13,21 +13,24 @@ var gPrivateBrowser = null;
 
 function pageLoad(aEvent) {
   // The plugin events are async dispatched and can come after the load event
   // This just allows the events to fire before we then go on to test the states
   executeSoon(gNextTest);
   gNextTest = null;
 }
 
-function prepareTest(nextTest, url, window) {
+function prepareTest(nextTest, url, browser) {
   gNextTest = nextTest;
-  if (!window)
-    window = gTestBrowser.contentWindow;
-  window.location = url;
+  if (!browser)
+    browser = gTestBrowser;
+
+  ContentTask.spawn(browser, url, function(url){
+    content.location = url;
+  });
 }
 
 function finishTest() {
   clearAllPluginPermissions();
   gTestBrowser.removeEventListener("load", pageLoad, true);
   gBrowser.removeCurrentTab();
   if (gPrivateWindow) {
     gPrivateWindow.close();
@@ -38,17 +41,17 @@ function finishTest() {
 
 function createPrivateWindow(nextTest, url) {
   gPrivateWindow = OpenBrowserWindow({private: true});
   ok(!!gPrivateWindow, "should have created a private window.");
   whenDelayedStartupFinished(gPrivateWindow, function() {
     gPrivateBrowser = gPrivateWindow.getBrowser().selectedBrowser;
     gPrivateBrowser.addEventListener("load", pageLoad, true);
     gNextTest = function() {
-      prepareTest(nextTest, url, gPrivateBrowser.contentWindow);
+      prepareTest(nextTest, url, gPrivateBrowser);
     };
   });
 }
 
 function whenDelayedStartupFinished(aWindow, aCallback) {
   Services.obs.addObserver(function observer(aSubject, aTopic) {
     if (aWindow == aSubject) {
       Services.obs.removeObserver(observer, aTopic);
@@ -187,17 +190,17 @@ function test3c() {
     // Check the button status
     let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
                                                      "Shown");
     popupNotification.reshow();
     promiseShown.then(() => {
       let buttonContainer = gPrivateWindow.PopupNotifications.panel.firstChild._buttonContainer;
       ok(buttonContainer.hidden, "Test 3c, Activated plugin in a private window should not have visible buttons");
 
-      prepareTest(test3d, gHttpTestRoot + "plugin_two_types.html", gPrivateBrowser.contentWindow);
+      prepareTest(test3d, gHttpTestRoot + "plugin_two_types.html", gPrivateBrowser);
     });
   });
 }
 
 function test3d() {
   let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
   ok(popupNotification, "Test 3d, Should have a click-to-play notification");