From 5a63b841160bbe3df88af5747addfde84183c7d6 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Tue, 28 May 2013 11:01:54 +0200 Subject: [PATCH 1/2] Bug 876313 - [New Tab Page] Unpinning a site doesn't update pref; r=jaws --- browser/base/content/test/newtab/Makefile.in | 1 + .../test/newtab/browser_newtab_bug876313.js | 24 +++++++++++++++++++ toolkit/modules/NewTabUtils.jsm | 1 + 3 files changed, 26 insertions(+) create mode 100644 browser/base/content/test/newtab/browser_newtab_bug876313.js diff --git a/browser/base/content/test/newtab/Makefile.in b/browser/base/content/test/newtab/Makefile.in index c3410e26b19..e7216012d2c 100644 --- a/browser/base/content/test/newtab/Makefile.in +++ b/browser/base/content/test/newtab/Makefile.in @@ -30,6 +30,7 @@ _BROWSER_FILES = \ browser_newtab_bug735987.js \ browser_newtab_bug752841.js \ browser_newtab_bug765628.js \ + browser_newtab_bug876313.js \ browser_newtab_perwindow_private_browsing.js \ head.js \ $(NULL) diff --git a/browser/base/content/test/newtab/browser_newtab_bug876313.js b/browser/base/content/test/newtab/browser_newtab_bug876313.js new file mode 100644 index 00000000000..ed9e8fbb346 --- /dev/null +++ b/browser/base/content/test/newtab/browser_newtab_bug876313.js @@ -0,0 +1,24 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/* + * This test makes sure that the changes made by unpinning + * a site are actually written to NewTabUtils' storage. + */ +function runTests() { + // Second cell is pinned with page #99. + yield setLinks("0,1,2,3,4,5,6,7,8"); + setPinnedLinks(",99"); + + yield addNewTabPageTab(); + checkGrid("0,99p,1,2,3,4,5,6,7"); + + // Unpin the second cell's site. + yield unpinCell(1); + checkGrid("0,1,2,3,4,5,6,7,8"); + + // Clear the pinned cache to force NewTabUtils to read the pref again. + NewTabUtils.pinnedLinks.resetCache(); + NewTabUtils.allPages.update(); + checkGrid("0,1,2,3,4,5,6,7,8"); +} diff --git a/toolkit/modules/NewTabUtils.jsm b/toolkit/modules/NewTabUtils.jsm index 4cc3d184abf..d75e0e36bb8 100644 --- a/toolkit/modules/NewTabUtils.jsm +++ b/toolkit/modules/NewTabUtils.jsm @@ -415,6 +415,7 @@ let PinnedLinks = { while (i >= 0 && links[i] == null) i--; links.splice(i +1); + this.save(); }, /** From 7f0306022a4de0b157310d2db9e28d827f83d7a6 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Tue, 28 May 2013 11:02:13 +0200 Subject: [PATCH 2/2] Bug 874452 - Remove Firefox 8 preference migration code; r=yoric --- .../components/sessionstore/src/SessionStore.jsm | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/browser/components/sessionstore/src/SessionStore.jsm b/browser/components/sessionstore/src/SessionStore.jsm index 13c28f601a9..39139eff71a 100644 --- a/browser/components/sessionstore/src/SessionStore.jsm +++ b/browser/components/sessionstore/src/SessionStore.jsm @@ -356,9 +356,6 @@ let SessionStoreInternal = { this._initPrefs(); - // Do pref migration before we store any values and start observing changes - this._migratePrefs(); - this._disabledForMultiProcess = this._prefBranch.getBoolPref("tabs.remote"); // this pref is only read at startup, so no need to observe it @@ -551,19 +548,6 @@ let SessionStoreInternal = { } }, - _migratePrefs: function ssi_migratePrefs() { - // Added For Firefox 8 - // max_concurrent_tabs is going away. We're going to hard code a max value - // (MAX_CONCURRENT_TAB_RESTORES) and start using a boolean pref restore_on_demand. - if (this._prefBranch.prefHasUserValue("sessionstore.max_concurrent_tabs") && - !this._prefBranch.prefHasUserValue("sessionstore.restore_on_demand")) { - let maxConcurrentTabs = - this._prefBranch.getIntPref("sessionstore.max_concurrent_tabs"); - this._prefBranch.setBoolPref("sessionstore.restore_on_demand", maxConcurrentTabs == 0); - this._prefBranch.clearUserPref("sessionstore.max_concurrent_tabs"); - } - }, - /** * Handle notifications */