Bug 1526355 - part2 : modify test to ensure we would get blocked event again when navigating from the bfcache. r=daleharvey
authorAlastor Wu <alwu@mozilla.com>
Mon, 04 Mar 2019 10:58:45 +0000
changeset 520124 9adad198b9b4b54b5813cf8a367ab0db41c36635
parent 520123 6e3eb5df50ff8607f0f60e8f7f8b9ed573f74fa4
child 520125 1c4fb23363e0fca41931986561ff580c129eaa6e
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaleharvey
bugs1526355
milestone67.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 1526355 - part2 : modify test to ensure we would get blocked event again when navigating from the bfcache. r=daleharvey Differential Revision: https://phabricator.services.mozilla.com/D21583
browser/base/content/test/permissions/browser_autoplay_blocked.js
--- a/browser/base/content/test/permissions/browser_autoplay_blocked.js
+++ b/browser/base/content/test/permissions/browser_autoplay_blocked.js
@@ -124,16 +124,40 @@ add_task(async function testGloballyBloc
 });
 
 add_task(async function testBFCache() {
   Services.prefs.setIntPref(AUTOPLAY_PREF, Ci.nsIAutoplay.BLOCKED);
 
   await BrowserTestUtils.withNewTab("about:home", async function(browser) {
     await BrowserTestUtils.loadURI(browser, AUTOPLAY_PAGE);
     await blockedIconShown(browser);
+
+    gBrowser.goBack();
+    await TestUtils.waitForCondition(() => {
+      return BrowserTestUtils.is_hidden(autoplayBlockedIcon());
+    });
+
+    // Not sure why using `gBrowser.goForward()` doesn't trigger document's
+    // visibility changes in some debug build on try server, which makes us not
+    // to receive the blocked event.
+    await ContentTask.spawn(browser, null, () => {
+      content.history.forward();
+    });
+    await blockedIconShown(browser);
+  });
+
+  Services.perms.removeAll();
+});
+
+add_task(async function testChangingBlockingSettingDuringNavigation() {
+  Services.prefs.setIntPref(AUTOPLAY_PREF, Ci.nsIAutoplay.BLOCKED);
+
+  await BrowserTestUtils.withNewTab("about:home", async function(browser) {
+    await BrowserTestUtils.loadURI(browser, AUTOPLAY_PAGE);
+    await blockedIconShown(browser);
     Services.prefs.setIntPref(AUTOPLAY_PREF, Ci.nsIAutoplay.ALLOWED);
 
     gBrowser.goBack();
     await TestUtils.waitForCondition(() => {
       return BrowserTestUtils.is_hidden(autoplayBlockedIcon());
     });
 
     gBrowser.goForward();