Bug 930970 - Migrate based on pref. r=Unfocused, r=jaws, a=bajaj
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1286,25 +1286,65 @@ BrowserGlue.prototype = {
notifyBox.PRIORITY_CRITICAL_MEDIUM,
buttons);
notification.persistence = -1; // Until user closes it
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 14;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul#";
+
+ let wasCustomizedAndOnAustralis = Services.prefs.prefHasUserValue("browser.uiCustomization.state");
let currentUIVersion = 0;
try {
currentUIVersion = Services.prefs.getIntPref("browser.migration.version");
} catch(ex) {}
- if (currentUIVersion >= UI_VERSION)
+ if (!wasCustomizedAndOnAustralis && currentUIVersion >= UI_VERSION)
return;
this._rdf = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
this._dataSource = this._rdf.GetDataSource("rdf:local-store");
+
+ // No version check for this as this code should run until we have Australis everywhere:
+ if (wasCustomizedAndOnAustralis) {
+ // This profile's been on australis! If it's missing the back/fwd button
+ // or go/stop/reload button, then put them back:
+ let currentsetResource = this._rdf.GetResource("currentset");
+ let toolbarResource = this._rdf.GetResource(BROWSER_DOCURL + "nav-bar");
+ let currentset = this._getPersist(toolbarResource, currentsetResource);
+ let oldCurrentset = currentset;
+ if (currentset) {
+ if (currentset.indexOf("unified-back-forward-button") == -1) {
+ currentset = currentset.replace("urlbar-container",
+ "unified-back-forward-button,urlbar-container");
+ }
+ if (currentset.indexOf("reload-button") == -1) {
+ currentset = currentset.replace("urlbar-container", "urlbar-container,reload-button");
+ }
+ if (currentset.indexOf("stop-button") == -1) {
+ currentset = currentset.replace("reload-button", "reload-button,stop-button");
+ }
+ }
+ Services.prefs.clearUserPref("browser.uiCustomization.state");
+
+ if (oldCurrentset != currentset) {
+ this._setPersist(toolbarResource, currentsetResource, currentset);
+ }
+ // If we don't have anything else to do, we can bail here:
+ if (currentUIVersion >= UI_VERSION) {
+ if (this._dirty) {
+ this._dataSource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();
+ }
+ delete this._rdf;
+ delete this._dataSource;
+ return;
+ }
+ }
+
+
this._dirty = false;
if (currentUIVersion < 2) {
// This code adds the customizable bookmarks button.
let currentsetResource = this._rdf.GetResource("currentset");
let toolbarResource = this._rdf.GetResource(BROWSER_DOCURL + "nav-bar");
let currentset = this._getPersist(toolbarResource, currentsetResource);
// Need to migrate only if toolbar is customized and the element is not found.