Bug 1531838 - Reliably wait for click-to-play popup notification in private windows. r=johannh
☠☠ backed out by 236d2bc601b0 ☠ ☠
authorNihanth Subramanya <nhnt11@gmail.com>
Wed, 10 Apr 2019 22:11:39 +0000
changeset 469107 3e538caf5af2417e46ba5232e2c9ab51f6b69c6c
parent 469106 ae727251b8026d80fe223511c8bbeff92b7820cc
child 469108 24d7fb7fd3afbc15a4018d926fa091f1c5ad4fc6
push id35856
push usercsabou@mozilla.com
push dateFri, 12 Apr 2019 03:19:48 +0000
treeherdermozilla-central@940684cd1065 [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,