From 334243ebf677ef666af4c72364f788c0fbfa17a2 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 22 Feb 2017 17:00:30 +0100 Subject: [PATCH] Backed out changeset 0ec5aae7453f (bug 1340450) for test failures in own test --- .../preferences/in-content/privacy.js | 2 - .../components/sessionstore/SessionStore.jsm | 36 +-------- .../components/sessionstore/test/browser.ini | 2 - .../test/browser_disable_containers.js | 76 ------------------- .../ContextualIdentityService.jsm | 7 -- 5 files changed, 1 insertion(+), 122 deletions(-) delete mode 100644 browser/components/sessionstore/test/browser_disable_containers.js diff --git a/browser/components/preferences/in-content/privacy.js b/browser/components/preferences/in-content/privacy.js index 7a9d5b6f6dd5..6d557b80eae6 100644 --- a/browser/components/preferences/in-content/privacy.js +++ b/browser/components/preferences/in-content/privacy.js @@ -85,7 +85,6 @@ var gPrivacyPane = { let count = ContextualIdentityService.countContainerTabs(); if (count == 0) { - ContextualIdentityService.disableContainers(); Services.prefs.setBoolPref("privacy.userContext.enabled", false); return; } @@ -106,7 +105,6 @@ var gPrivacyPane = { okButton, cancelButton, null, null, {}); if (rv == 0) { ContextualIdentityService.closeContainerTabs(); - ContextualIdentityService.disableContainers(); Services.prefs.setBoolPref("privacy.userContext.enabled", false); return; } diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm index 75a50ab72683..4581eec3d2e0 100644 --- a/browser/components/sessionstore/SessionStore.jsm +++ b/browser/components/sessionstore/SessionStore.jsm @@ -45,7 +45,7 @@ const OBSERVING = [ "quit-application-granted", "browser-lastwindow-close-granted", "quit-application", "browser:purge-session-history", "browser:purge-domain-data", - "idle-daily", "clear-origin-attributes-data" + "idle-daily", ]; // XUL Window properties to (re)store @@ -748,13 +748,6 @@ var SessionStoreInternal = { this.onIdleDaily(); this._notifyOfClosedObjectsChange(); break; - case "clear-origin-attributes-data": - let userContextId = 0; - try { - userContextId = JSON.parse(aData).userContextId; - } catch(e) {} - if (userContextId) - this._forgetTabsWithUserContextId(userContextId); } }, @@ -2589,33 +2582,6 @@ var SessionStoreInternal = { return undefined; }, - // This method deletes all the closedTabs matching userContextId. - _forgetTabsWithUserContextId(userContextId) { - let windowsEnum = Services.wm.getEnumerator("navigator:browser"); - while (windowsEnum.hasMoreElements()) { - let window = windowsEnum.getNext(); - let windowState = this._windows[window.__SSi]; - if (windowState) { - // In order to remove the tabs in the correct order, we store the - // indexes, into an array, then we revert the array and remove closed - // data from the last one going backward. - let indexes = []; - windowState._closedTabs.forEach((closedTab, index) => { - if (closedTab.state.userContextId == userContextId) { - indexes.push(index); - } - }); - - for (let index of indexes.reverse()) { - this.removeClosedTabData(windowState._closedTabs, index); - } - } - } - - // Notify of changes to closed objects. - this._notifyOfClosedObjectsChange(); - }, - /** * Restores the session state stored in LastSession. This will attempt * to merge data into the current session. If a window was opened at startup diff --git a/browser/components/sessionstore/test/browser.ini b/browser/components/sessionstore/test/browser.ini index 8ac1ffec7c1a..4566f3a0c605 100644 --- a/browser/components/sessionstore/test/browser.ini +++ b/browser/components/sessionstore/test/browser.ini @@ -243,5 +243,3 @@ skip-if = !e10s # GroupedSHistory is e10s-only [browser_closed_objects_changed_notifications_tabs.js] [browser_closed_objects_changed_notifications_windows.js] - -[browser_disable_containers.js] diff --git a/browser/components/sessionstore/test/browser_disable_containers.js b/browser/components/sessionstore/test/browser_disable_containers.js deleted file mode 100644 index 41881bbd0a27..000000000000 --- a/browser/components/sessionstore/test/browser_disable_containers.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; - -/** - * This test is to see if tabs can be reopened when containers are disabled. - */ - -async function openAndCloseTab(window, userContextId, url) { - let tab = window.gBrowser.addTab(url, { userContextId }); - await promiseBrowserLoaded(tab.linkedBrowser, true, url); - await TabStateFlusher.flush(tab.linkedBrowser); - await promiseRemoveTab(tab); -} - -async function openTab(window, userContextId, url) { - let tab = window.gBrowser.addTab(url, { userContextId }); - await promiseBrowserLoaded(tab.linkedBrowser, true, url); - await TabStateFlusher.flush(tab.linkedBrowser); -} - -async function openWindow(url) { - let win = await promiseNewWindowLoaded(); - let flags = Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY; - win.gBrowser.selectedBrowser.loadURIWithFlags(url, flags); - await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, url); - return win; -} - -add_task(function* test_undoCloseById() { - // Clear the lists of closed windows and tabs. - forgetClosedWindows(); - while (SessionStore.getClosedTabCount(window)) { - SessionStore.forgetClosedTab(window, 0); - } - - // Open a new window. - let win = yield openWindow("about:robots"); - - // Open and close a tab. - yield openAndCloseTab(win, 0, "about:mozilla"); - is(SessionStore.lastClosedObjectType, "tab", "The last closed object is a tab"); - - // Open and close a container tab. - yield openAndCloseTab(win, 3, "about:about"); - is(SessionStore.lastClosedObjectType, "tab", "The last closed object is a tab"); - - // Restore the last closed tab. - let tab = SessionStore.undoCloseTab(win, 0); - yield promiseBrowserLoaded(tab.linkedBrowser); - is(tab.linkedBrowser.currentURI.spec, "about:about", "The expected tab was re-opened"); - is(tab.getAttribute("usercontextid"), 3, "Expected the tab userContextId to match"); - - // Open a few container tabs. - yield openTab(win, 1, "about:config"); - yield openTab(win, 1, "about:preferences"); - yield openTab(win, 2, "about:support"); - - // Let's simulate the disabling of containers. - ContextualIdentityService.closeContainerTabs(); - ContextualIdentityService.disableContainers(); - TabStateFlusher.flushWindow(win); - - // Let's check we don't have container tab opened. - for (let i = 0; i < win.gBrowser.tabContainer.childNodes.length; ++i) { - let tab = win.gBrowser.tabContainer.childNodes[i]; - ok(!tab.hasAttribute("usercontextid"), "No userContextId for this tab"); - } - - // Restore the last closed tab (we don't want the container tabs). - tab = SessionStore.undoCloseTab(win, 0); - yield promiseBrowserLoaded(tab.linkedBrowser); - is(tab.linkedBrowser.currentURI.spec, "about:mozilla", "The expected tab was re-opened"); - ok(!tab.hasAttribute("usercontextid"), "No userContextId for this tab"); - - // Close the window again. - yield BrowserTestUtils.closeWindow(win); -}); diff --git a/toolkit/components/contextualidentity/ContextualIdentityService.jsm b/toolkit/components/contextualidentity/ContextualIdentityService.jsm index dd7a6d8d98d9..6bd4081326d8 100644 --- a/toolkit/components/contextualidentity/ContextualIdentityService.jsm +++ b/toolkit/components/contextualidentity/ContextualIdentityService.jsm @@ -298,13 +298,6 @@ _ContextualIdentityService.prototype = { }, userContextId); }, - disableContainers() { - for (let identity of this._identities) { - Services.obs.notifyObservers(null, "clear-origin-attributes-data", - JSON.stringify({ userContextId: identity.userContextId })); - } - }, - _forEachContainerTab(callback, userContextId = 0) { let windowList = Services.wm.getEnumerator("navigator:browser"); while (windowList.hasMoreElements()) {