Bug 1634040 - Add test for discardBrowser removing potentially stale tab attributes. r=Gijs
authorDão Gottwald <dao@mozilla.com>
Wed, 29 Apr 2020 14:39:17 +0000
changeset 526670 8b824b3ef27f990b75987ff5429ce029444f0ce2
parent 526669 5142b1244ac27bfd58035fb041754d91a01e3111
child 526671 d96ffe342c9ed444717c412c77ed0a96f511f589
push id37361
push usermalexandru@mozilla.com
push dateWed, 29 Apr 2020 21:55:39 +0000
treeherdermozilla-central@bc0932b38478 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1634040
milestone77.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 1634040 - Add test for discardBrowser removing potentially stale tab attributes. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D73052
browser/components/sessionstore/test/browser_1284886_suspend_tab.js
--- a/browser/components/sessionstore/test/browser_1284886_suspend_tab.js
+++ b/browser/components/sessionstore/test/browser_1284886_suspend_tab.js
@@ -5,20 +5,37 @@ add_task(async function test() {
   await SpecialPowers.pushPrefEnv({
     set: [["dom.require_user_interaction_for_beforeunload", false]],
   });
 
   let url = "about:robots";
   let tab0 = gBrowser.tabs[0];
   let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
 
+  const staleAttributes = [
+    "activemedia-blocked",
+    "busy",
+    "pendingicon",
+    "progress",
+    "soundplaying",
+  ];
+  for (let attr of staleAttributes) {
+    tab0.toggleAttribute(attr, true);
+  }
   gBrowser.discardBrowser(tab0);
   ok(!tab0.linkedPanel, "tab0 is suspended");
+  for (let attr of staleAttributes) {
+    ok(
+      !tab0.hasAttribute(attr),
+      `discarding browser removes "${attr}" tab attribute`
+    );
+  }
 
   await BrowserTestUtils.switchTab(gBrowser, tab0);
+  ok(tab0.linkedPanel, "selecting tab unsuspends it");
 
   // Test that active tab is not able to be suspended.
   gBrowser.discardBrowser(tab0);
   ok(tab0.linkedPanel, "active tab is not able to be suspended");
 
   // Test that tab that is closing is not able to be suspended.
   gBrowser._beginRemoveTab(tab1);
   gBrowser.discardBrowser(tab1);