Bug 1531838 - Reliably wait for click-to-play popup notification in private windows. r=johannh
☠☠ backed out by 917d4b516ba9 ☠ ☠
authorNihanth Subramanya <nhnt11@gmail.com>
Tue, 09 Apr 2019 14:14:43 +0000
changeset 468566 1badfbad01fb4ec5278cd0dbde44f165665491e9
parent 468565 f54fe4e4822f7a1587e655de17487540a2e86544
child 468567 5c20b75a9e32bbd62d1709eb42d3323ddfbe1d28
push id35843
push usernbeleuzu@mozilla.com
push dateTue, 09 Apr 2019 22:08:13 +0000
treeherdermozilla-central@a31032a16330 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1531838
milestone68.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 1531838 - Reliably wait for click-to-play popup notification in private windows. r=johannh Differential Revision: https://phabricator.services.mozilla.com/D26700
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
@@ -105,17 +105,19 @@ add_task(async function test2a() {
   });
 });
 
 add_task(async function test2c() {
   let topicObserved = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
   await createPrivateWindow(gHttpTestRoot + "plugin_test.html");
   await topicObserved;
 
-  let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
+  let popupNotification = await TestUtils.waitForCondition(() => {
+    return gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
+  }, "Waiting for click-to-play-plugins notification in the private window");
   ok(popupNotification, "Test 2c, Should have a click-to-play notification");
 
   await ContentTask.spawn(gPrivateBrowser, null, function() {
     let plugin = content.document.getElementById("test");
     let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
     ok(objLoadingContent.activated, "Test 2c, Plugin should be activated");
   });
 
@@ -167,17 +169,19 @@ add_task(async function test3a() {
   });
 });
 
 add_task(async function test3c() {
   let topicObserved = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
   await createPrivateWindow(gHttpTestRoot + "plugin_test.html");
   await topicObserved;
 
-  let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
+  let popupNotification = await TestUtils.waitForCondition(() => {
+    return gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
+  }, "Waiting for click-to-play-plugins notification in the private window");
   ok(popupNotification, "Test 3c, Should have a click-to-play notification");
 
   // Check the button status
   let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
                                                    "Shown");
   popupNotification.reshow();
   await promiseShown;
   is(gPrivateWindow.PopupNotifications.panel.firstElementChild.secondaryButton.hidden, true,