summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/palemoon/installer/windows/nsis/shared.nsh6
-rw-r--r--browser/components/migration/FirefoxProfileMigrator.js2
-rw-r--r--browser/components/migration/MigrationUtils.jsm1
-rw-r--r--toolkit/components/xulstore/XULStore.js18
-rw-r--r--toolkit/jetpack/modules/system/Startup.js1
-rw-r--r--toolkit/jetpack/moz.build13
-rw-r--r--toolkit/jetpack/sdk/clipboard.js1
-rw-r--r--toolkit/jetpack/sdk/context-menu.js1
-rw-r--r--toolkit/jetpack/sdk/places/bookmarks.js1
-rw-r--r--toolkit/jetpack/sdk/places/events.js1
-rw-r--r--toolkit/jetpack/sdk/places/favicon.js1
-rw-r--r--toolkit/jetpack/sdk/places/history.js1
-rw-r--r--toolkit/jetpack/sdk/places/host/host-bookmarks.js1
-rw-r--r--toolkit/jetpack/sdk/places/host/host-query.js1
-rw-r--r--toolkit/jetpack/sdk/places/host/host-tags.js1
-rw-r--r--toolkit/jetpack/sdk/places/utils.js1
-rw-r--r--toolkit/jetpack/sdk/selection.js1
-rw-r--r--toolkit/jetpack/sdk/system/xul-app.jsm1
-rw-r--r--toolkit/jetpack/sdk/ui.js3
-rw-r--r--toolkit/jetpack/sdk/ui/button/action.js1
-rw-r--r--toolkit/jetpack/sdk/ui/button/toggle.js1
-rw-r--r--toolkit/jetpack/sdk/ui/button/view.js47
-rw-r--r--toolkit/jetpack/sdk/ui/button/view/events.js1
-rw-r--r--toolkit/jetpack/sdk/ui/buttons.js198
-rw-r--r--toolkit/jetpack/sdk/ui/state.js1
-rw-r--r--toolkit/jetpack/sdk/ui/state/events.js1
-rw-r--r--toolkit/modules/ResetProfile.jsm6
-rw-r--r--toolkit/xre/ProfileReset.cpp12
-rw-r--r--toolkit/xre/ProfileReset.h1
-rw-r--r--toolkit/xre/nsAppRunner.cpp101
30 files changed, 372 insertions, 54 deletions
diff --git a/application/palemoon/installer/windows/nsis/shared.nsh b/application/palemoon/installer/windows/nsis/shared.nsh
index 29136f47a..294e3e6fc 100644
--- a/application/palemoon/installer/windows/nsis/shared.nsh
+++ b/application/palemoon/installer/windows/nsis/shared.nsh
@@ -390,7 +390,7 @@
!macroend
!define SetHandlers "!insertmacro SetHandlers"
-; Adds the HKLM\Software\Clients\StartMenuInternet\FIREFOX.EXE registry
+; Adds the HKLM\Software\Clients\StartMenuInternet\PALEMOON.EXE registry
; entries (does not use SHCTX).
;
; The values for StartMenuInternet are only valid under HKLM and there can only
@@ -770,11 +770,11 @@
!macro RemoveDeprecatedKeys
StrCpy $0 "SOFTWARE\Classes"
; Remove support for launching gopher urls from the shell during install or
- ; update if the DefaultIcon is from firefox.exe.
+ ; update if the DefaultIcon is from palemoon.exe.
${RegCleanAppHandler} "gopher"
; Remove support for launching chrome urls from the shell during install or
- ; update if the DefaultIcon is from firefox.exe (Bug 301073).
+ ; update if the DefaultIcon is from palemoon.exe (Bug 301073).
${RegCleanAppHandler} "chrome"
; Remove protocol handler registry keys added by the MS shim
diff --git a/browser/components/migration/FirefoxProfileMigrator.js b/browser/components/migration/FirefoxProfileMigrator.js
index 60ffcf627..2714cdbcd 100644
--- a/browser/components/migration/FirefoxProfileMigrator.js
+++ b/browser/components/migration/FirefoxProfileMigrator.js
@@ -7,7 +7,7 @@
"use strict";
/*
- * Migrates from a Firefox profile in a lossy manner in order to clean up a
+ * Migrates from a Basilisk profile in a lossy manner in order to clean up a
* user's profile. Data is only migrated where the benefits outweigh the
* potential problems caused by importing undesired/invalid configurations
* from the source profile.
diff --git a/browser/components/migration/MigrationUtils.jsm b/browser/components/migration/MigrationUtils.jsm
index 104efe005..e133ec520 100644
--- a/browser/components/migration/MigrationUtils.jsm
+++ b/browser/components/migration/MigrationUtils.jsm
@@ -726,6 +726,7 @@ this.MigrationUtils = Object.freeze({
"Internet Explorer": "ie",
"Microsoft Edge": "edge",
"Safari": "safari",
+ "Basilisk": "firefox",
"Firefox": "firefox",
"Nightly": "firefox",
"Google Chrome": "chrome", // Windows, Linux
diff --git a/toolkit/components/xulstore/XULStore.js b/toolkit/components/xulstore/XULStore.js
index c2721327c..8b5bc1313 100644
--- a/toolkit/components/xulstore/XULStore.js
+++ b/toolkit/components/xulstore/XULStore.js
@@ -63,11 +63,21 @@ XULStore.prototype = {
load: function () {
Services.obs.addObserver(this, "profile-before-change", true);
- this._storeFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
+ let profileType = "ProfD";
+ try {
+ this._storeFile = Services.dirsvc.get(profileType, Ci.nsIFile);
+ } catch (ex) {
+ try {
+ profileType = "ProfDS";
+ this._storeFile = Services.dirsvc.get(profileType, Ci.nsIFile);
+ } catch (ex) {
+ throw new Error("Can't find profile directory.");
+ }
+ }
this._storeFile.append(STOREDB_FILENAME);
if (!this._storeFile.exists()) {
- this.import();
+ this.import(profileType);
} else {
this.readFile();
}
@@ -90,8 +100,8 @@ XULStore.prototype = {
Services.console.logStringMessage("XULStore: " + message);
},
- import: function() {
- let localStoreFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
+ import(profileType) {
+ let localStoreFile = Services.dirsvc.get(profileType || "ProfD", Ci.nsIFile);
localStoreFile.append("localstore.rdf");
if (!localStoreFile.exists()) {
diff --git a/toolkit/jetpack/modules/system/Startup.js b/toolkit/jetpack/modules/system/Startup.js
index b9e5d88b3..89eeac3bc 100644
--- a/toolkit/jetpack/modules/system/Startup.js
+++ b/toolkit/jetpack/modules/system/Startup.js
@@ -15,6 +15,7 @@ const appStartupSrv = Cc["@mozilla.org/toolkit/app-startup;1"]
.getService(Ci.nsIAppStartup);
const NAME2TOPIC = {
+ 'Palemoon': 'sessionstore-windows-restored',
'Firefox': 'sessionstore-windows-restored',
'Fennec': 'sessionstore-windows-restored',
'SeaMonkey': 'sessionstore-windows-restored',
diff --git a/toolkit/jetpack/moz.build b/toolkit/jetpack/moz.build
index 2024e6a7c..ad11e90a3 100644
--- a/toolkit/jetpack/moz.build
+++ b/toolkit/jetpack/moz.build
@@ -85,10 +85,18 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != "gonk":
'sdk/ui/toolbar.js',
]
+ if CONFIG['MC_PALEMOON']:
+ EXTRA_JS_MODULES.commonjs.sdk.ui += [
+ 'sdk/ui/buttons.js',
+ ]
+
EXTRA_JS_MODULES.commonjs.sdk.ui.button += [
'sdk/ui/button/action.js',
'sdk/ui/button/contract.js',
'sdk/ui/button/toggle.js',
+ ]
+
+ EXTRA_PP_JS_MODULES.commonjs.sdk.ui.button += [
'sdk/ui/button/view.js',
]
@@ -211,11 +219,14 @@ EXTRA_JS_MODULES.commonjs.sdk += [
'sdk/tabs.js',
'sdk/test.js',
'sdk/timers.js',
- 'sdk/ui.js',
'sdk/url.js',
'sdk/windows.js',
]
+EXTRA_PP_JS_MODULES.commonjs.sdk += [
+ 'sdk/ui.js',
+]
+
EXTRA_JS_MODULES.commonjs.sdk.addon += [
'sdk/addon/bootstrap.js',
'sdk/addon/events.js',
diff --git a/toolkit/jetpack/sdk/clipboard.js b/toolkit/jetpack/sdk/clipboard.js
index 048d5f2f1..c6b3c46fe 100644
--- a/toolkit/jetpack/sdk/clipboard.js
+++ b/toolkit/jetpack/sdk/clipboard.js
@@ -8,6 +8,7 @@ module.metadata = {
"stability": "stable",
"engines": {
// TODO Fennec Support 789757
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*",
"Thunderbird": "*"
diff --git a/toolkit/jetpack/sdk/context-menu.js b/toolkit/jetpack/sdk/context-menu.js
index 004c642d4..e00f41d79 100644
--- a/toolkit/jetpack/sdk/context-menu.js
+++ b/toolkit/jetpack/sdk/context-menu.js
@@ -7,6 +7,7 @@ module.metadata = {
"stability": "stable",
"engines": {
// TODO Fennec support Bug 788334
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/bookmarks.js b/toolkit/jetpack/sdk/places/bookmarks.js
index c4f9528f1..e8fdae4f4 100644
--- a/toolkit/jetpack/sdk/places/bookmarks.js
+++ b/toolkit/jetpack/sdk/places/bookmarks.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "unstable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/events.js b/toolkit/jetpack/sdk/places/events.js
index a3f95ee03..c5e728039 100644
--- a/toolkit/jetpack/sdk/places/events.js
+++ b/toolkit/jetpack/sdk/places/events.js
@@ -7,6 +7,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
"SeaMonkey": '*'
}
diff --git a/toolkit/jetpack/sdk/places/favicon.js b/toolkit/jetpack/sdk/places/favicon.js
index 05b057db1..7a74aa517 100644
--- a/toolkit/jetpack/sdk/places/favicon.js
+++ b/toolkit/jetpack/sdk/places/favicon.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "unstable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/history.js b/toolkit/jetpack/sdk/places/history.js
index b243b024c..f7fc3ed57 100644
--- a/toolkit/jetpack/sdk/places/history.js
+++ b/toolkit/jetpack/sdk/places/history.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "unstable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/host/host-bookmarks.js b/toolkit/jetpack/sdk/places/host/host-bookmarks.js
index 3245c4070..f6dec4069 100644
--- a/toolkit/jetpack/sdk/places/host/host-bookmarks.js
+++ b/toolkit/jetpack/sdk/places/host/host-bookmarks.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/host/host-query.js b/toolkit/jetpack/sdk/places/host/host-query.js
index f2dbd6550..a2cd4cd35 100644
--- a/toolkit/jetpack/sdk/places/host/host-query.js
+++ b/toolkit/jetpack/sdk/places/host/host-query.js
@@ -6,6 +6,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/host/host-tags.js b/toolkit/jetpack/sdk/places/host/host-tags.js
index 929a5d5af..b94342549 100644
--- a/toolkit/jetpack/sdk/places/host/host-tags.js
+++ b/toolkit/jetpack/sdk/places/host/host-tags.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/utils.js b/toolkit/jetpack/sdk/places/utils.js
index 44366d2aa..fe928c4ea 100644
--- a/toolkit/jetpack/sdk/places/utils.js
+++ b/toolkit/jetpack/sdk/places/utils.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/selection.js b/toolkit/jetpack/sdk/selection.js
index 8682e8c6d..e393aae06 100644
--- a/toolkit/jetpack/sdk/selection.js
+++ b/toolkit/jetpack/sdk/selection.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "stable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/system/xul-app.jsm b/toolkit/jetpack/sdk/system/xul-app.jsm
index 90681bb1b..ed760c3a4 100644
--- a/toolkit/jetpack/sdk/system/xul-app.jsm
+++ b/toolkit/jetpack/sdk/system/xul-app.jsm
@@ -41,6 +41,7 @@ var platformVersion = exports.platformVersion = appInfo.platformVersion;
// GUID.
var ids = exports.ids = {
+ Palemoon: "{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}",
Firefox: "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
Mozilla: "{86c18b42-e466-45a9-ae7a-9b95ba6f5640}",
SeaMonkey: "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}",
diff --git a/toolkit/jetpack/sdk/ui.js b/toolkit/jetpack/sdk/ui.js
index 7f9110b26..d1ff7ceb8 100644
--- a/toolkit/jetpack/sdk/ui.js
+++ b/toolkit/jetpack/sdk/ui.js
@@ -6,12 +6,15 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
exports.ActionButton = require('./ui/button/action').ActionButton;
exports.ToggleButton = require('./ui/button/toggle').ToggleButton;
+#ifndef MC_PALEMOON
exports.Sidebar = require('./ui/sidebar').Sidebar;
exports.Frame = require('./ui/frame').Frame;
exports.Toolbar = require('./ui/toolbar').Toolbar;
+#endif
diff --git a/toolkit/jetpack/sdk/ui/button/action.js b/toolkit/jetpack/sdk/ui/button/action.js
index dfb092d0c..5355705be 100644
--- a/toolkit/jetpack/sdk/ui/button/action.js
+++ b/toolkit/jetpack/sdk/ui/button/action.js
@@ -6,6 +6,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
diff --git a/toolkit/jetpack/sdk/ui/button/toggle.js b/toolkit/jetpack/sdk/ui/button/toggle.js
index a226b3212..d8a3d1758 100644
--- a/toolkit/jetpack/sdk/ui/button/toggle.js
+++ b/toolkit/jetpack/sdk/ui/button/toggle.js
@@ -6,6 +6,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
diff --git a/toolkit/jetpack/sdk/ui/button/view.js b/toolkit/jetpack/sdk/ui/button/view.js
index 63b7aea31..552aab2f7 100644
--- a/toolkit/jetpack/sdk/ui/button/view.js
+++ b/toolkit/jetpack/sdk/ui/button/view.js
@@ -6,6 +6,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
@@ -19,14 +20,19 @@ const { isObject, isNil } = require('../../lang/type');
const { getMostRecentBrowserWindow } = require('../../window/utils');
const { ignoreWindow } = require('../../private-browsing/utils');
+#ifdef MC_PALEMOON
+const { buttons } = require('../buttons');
+#else
const { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {});
const { AREA_PANEL, AREA_NAVBAR } = CustomizableUI;
+#endif
const { events: viewEvents } = require('./view/events');
const XUL_NS = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';
const views = new Map();
+#ifndef MC_PALEMOON
const customizedWindows = new WeakMap();
const buttonListener = {
@@ -64,19 +70,25 @@ CustomizableUI.addListener(buttonListener);
require('../../system/unload').when( _ =>
CustomizableUI.removeListener(buttonListener)
);
+#endif
function getNode(id, window) {
return !views.has(id) || ignoreWindow(window)
? null
+#ifdef MC_PALEMOON
+ : buttons.getNode(id, window);
+#else
: CustomizableUI.getWidget(id).forWindow(window).node
+#endif
};
+#ifndef MC_PALEMOON
function isInToolbar(id) {
let placement = CustomizableUI.getPlacementOfWidget(id);
return placement && CustomizableUI.getAreaType(placement.area) === 'toolbar';
}
-
+#endif
function getImage(icon, isInToolbar, pixelRatio) {
let targetSize = (isInToolbar ? 18 : 32) * pixelRatio;
@@ -109,7 +121,11 @@ function getImage(icon, isInToolbar, pixelRatio) {
}
function nodeFor(id, window=getMostRecentBrowserWindow()) {
+#ifdef MC_PALEMOON
+ return getNode(id, window);
+#else
return customizedWindows.has(window) ? null : getNode(id, window);
+#endif
};
exports.nodeFor = nodeFor;
@@ -119,14 +135,23 @@ function create(options) {
if (views.has(id))
throw new Error('The ID "' + id + '" seems already used.');
+#ifdef MC_PALEMOON
+ buttons.createButton({
+#else
CustomizableUI.createWidget({
+#endif
id: id,
+#ifdef MC_PALEMOON
+
+ onBuild: function(document, _id) {
+#else
type: 'custom',
removable: true,
defaultArea: AREA_NAVBAR,
allowedAreas: [ AREA_PANEL, AREA_NAVBAR ],
onBuild: function(document) {
+#endif
let window = document.defaultView;
let node = document.createElementNS(XUL_NS, 'toolbarbutton');
@@ -136,16 +161,28 @@ function create(options) {
if (ignoreWindow(window))
node.style.display = 'none';
+#ifdef MC_PALEMOON
+ node.setAttribute('id', _id);
+#else
node.setAttribute('id', this.id);
+#endif
node.setAttribute('class', 'toolbarbutton-1 chromeclass-toolbar-additional badged-button');
+#ifndef MC_PALEMOON
node.setAttribute('type', type);
+#endif
node.setAttribute('label', label);
node.setAttribute('tooltiptext', label);
node.setAttribute('image', image);
+#ifdef MC_PALEMOON
+ node.setAttribute('pmkit-button', 'true');
+#else
node.setAttribute('constrain-size', 'true');
+#endif
views.set(id, {
+#ifndef MC_PALEMOON
area: this.currentArea,
+#endif
icon: icon,
label: label
});
@@ -171,7 +208,11 @@ function dispose(id) {
if (!views.has(id)) return;
views.delete(id);
+#ifdef MC_PALEMOON
+ buttons.destroyButton(id);
+#else
CustomizableUI.destroyWidget(id);
+#endif
}
exports.dispose = dispose;
@@ -179,8 +220,12 @@ function setIcon(id, window, icon) {
let node = getNode(id, window);
if (node) {
+#ifdef MC_PALEMOON
+ let image = getImage(icon, true, window.devicePixelRatio);
+#else
icon = customizedWindows.has(window) ? views.get(id).icon : icon;
let image = getImage(icon, isInToolbar(id), window.devicePixelRatio);
+#endif
node.setAttribute('image', image);
}
diff --git a/toolkit/jetpack/sdk/ui/button/view/events.js b/toolkit/jetpack/sdk/ui/button/view/events.js
index 98909656a..34d14be3a 100644
--- a/toolkit/jetpack/sdk/ui/button/view/events.js
+++ b/toolkit/jetpack/sdk/ui/button/view/events.js
@@ -7,6 +7,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
'SeaMonkey': '*',
'Thunderbird': '*'
diff --git a/toolkit/jetpack/sdk/ui/buttons.js b/toolkit/jetpack/sdk/ui/buttons.js
new file mode 100644
index 000000000..66e0fd742
--- /dev/null
+++ b/toolkit/jetpack/sdk/ui/buttons.js
@@ -0,0 +1,198 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ * PMkit shim for 'sdk/ui/button', (c) JustOff, 2017 */
+"use strict";
+
+module.metadata = {
+ "stability": "experimental",
+ "engines": {
+ "Palemoon": "> 27"
+ }
+};
+
+const { Ci, Cc } = require('chrome');
+const prefs = require('../preferences/service');
+
+const buttonsList = new Map();
+const LOCATION_PREF_ROOT = "extensions.sdk-button-location.";
+
+let gWindowListener;
+
+function getLocation(id) {
+ let toolbarId = "nav-bar", nextItemId = "";
+ let location = prefs.get(LOCATION_PREF_ROOT + id);
+ if (location && location.indexOf(",") !== -1) {
+ [toolbarId, nextItemId] = location.split(",");
+ }
+ return [toolbarId, nextItemId];
+}
+
+function saveLocation(id, toolbarId, nextItemId) {
+ let _toolbarId = toolbarId || "";
+ let _nextItemId = nextItemId || "";
+ prefs.set(LOCATION_PREF_ROOT + id, [_toolbarId, _nextItemId].join(","));
+}
+
+// Insert button into window
+function insertButton(aWindow, id, onBuild) {
+ // Build button and save reference to it
+ let doc = aWindow.document;
+ let b = onBuild(doc, id);
+ aWindow[id] = b;
+
+ // Add to the customization palette
+ let toolbox = doc.getElementById("navigator-toolbox");
+ toolbox.palette.appendChild(b);
+
+ // Retrieve button location from preferences
+ let [toolbarId, nextItemId] = getLocation(id);
+ let toolbar = toolbarId != "" && doc.getElementById(toolbarId);
+
+ if (toolbar) {
+ let nextItem = doc.getElementById(nextItemId);
+ // If nextItem not in toolbar then retrieve it by reading currentset attribute
+ if (!(nextItem && nextItem.parentNode && nextItem.parentNode.id == toolbarId)) {
+ nextItem = null;
+ let currentSet = toolbar.getAttribute("currentset");
+ let ids = (currentSet == "__empty") ? [] : currentSet.split(",");
+ let idx = ids.indexOf(id);
+ if (idx != -1) {
+ for (let i = idx; i < ids.length; i++) {
+ nextItem = doc.getElementById(ids[i]);
+ if (nextItem)
+ break;
+ }
+ }
+ }
+ // Finally insert button in the right toolbar and in the right position
+ toolbar.insertItem(id, nextItem, null, false);
+ }
+}
+
+// Remove button from window
+function removeButton(aWindow, id) {
+ let b = aWindow[id];
+ b.parentNode.removeChild(b);
+ delete aWindow[id];
+}
+
+// Save locations of buttons after customization
+function afterCustomize(e) {
+ for (let [id] of buttonsList) {
+ let toolbox = e.target;
+ let b = toolbox.parentNode.querySelector("#" + id);
+ let toolbarId = null, nextItemId = null;
+ if (b) {
+ let parent = b.parentNode;
+ let nextItem = b.nextSibling;
+ if (parent && parent.localName == "toolbar") {
+ toolbarId = parent.id;
+ nextItemId = nextItem && nextItem.id;
+ }
+ }
+ saveLocation(id, toolbarId, nextItemId);
+ }
+}
+
+// Global window observer
+function browserWindowObserver(handlers) {
+ this.handlers = handlers;
+}
+
+browserWindowObserver.prototype = {
+ observe: function(aSubject, aTopic, aData) {
+ if (aTopic == "domwindowopened") {
+ aSubject.QueryInterface(Ci.nsIDOMWindow).addEventListener("load", this, false);
+ } else if (aTopic == "domwindowclosed") {
+ if (aSubject.document.documentElement.getAttribute("windowtype") == "navigator:browser") {
+ this.handlers.onShutdown(aSubject);
+ }
+ }
+ },
+
+ handleEvent: function(aEvent) {
+ let aWindow = aEvent.currentTarget;
+ aWindow.removeEventListener(aEvent.type, this, false);
+
+ if (aWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser") {
+ this.handlers.onStartup(aWindow);
+ }
+ }
+};
+
+// Run on every window startup
+function browserWindowStartup(aWindow) {
+ for (let [id, onBuild] of buttonsList) {
+ insertButton(aWindow, id, onBuild);
+ }
+ aWindow.addEventListener("aftercustomization", afterCustomize, false);
+};
+
+// Run on every window shutdown
+function browserWindowShutdown(aWindow) {
+ for (let [id, onBuild] of buttonsList) {
+ removeButton(aWindow, id);
+ }
+ aWindow.removeEventListener("aftercustomization", afterCustomize, false);
+}
+
+// Main object
+const buttons = {
+ createButton: function(aProperties) {
+ // If no buttons were inserted yet, setup global window observer
+ if (buttonsList.size == 0) {
+ let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci.nsIWindowWatcher);
+ gWindowListener = new browserWindowObserver({
+ onStartup: browserWindowStartup,
+ onShutdown: browserWindowShutdown
+ });
+ ww.registerNotification(gWindowListener);
+ }
+
+ // Add button to list
+ buttonsList.set(aProperties.id, aProperties.onBuild);
+
+ // Inster button to all open windows
+ let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
+ let winenu = wm.getEnumerator("navigator:browser");
+ while (winenu.hasMoreElements()) {
+ let win = winenu.getNext();
+ insertButton(win, aProperties.id, aProperties.onBuild);
+ // When first button inserted, add afterCustomize listener
+ if (buttonsList.size == 1) {
+ win.addEventListener("aftercustomization", afterCustomize, false);
+ }
+ }
+ },
+
+ destroyButton: function(id) {
+ // Remove button from list
+ buttonsList.delete(id);
+
+ // If no more buttons exist, remove global window observer
+ if (buttonsList.size == 0) {
+ let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci.nsIWindowWatcher);
+ ww.unregisterNotification(gWindowListener);
+ gWindowListener = null;
+ }
+
+ // Remove button from all open windows
+ let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
+ let winenu = wm.getEnumerator("navigator:browser");
+ while (winenu.hasMoreElements()) {
+ let win = winenu.getNext();
+ removeButton(win, id);
+ // If no more buttons exist, remove afterCustomize listener
+ if (buttonsList.size == 0) {
+ win.removeEventListener("aftercustomization", afterCustomize, false);
+ }
+ }
+ },
+
+ getNode: function(id, window) {
+ return window[id];
+ }
+};
+
+exports.buttons = buttons;
diff --git a/toolkit/jetpack/sdk/ui/state.js b/toolkit/jetpack/sdk/ui/state.js
index 152ce696d..c90d4283d 100644
--- a/toolkit/jetpack/sdk/ui/state.js
+++ b/toolkit/jetpack/sdk/ui/state.js
@@ -8,6 +8,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
'SeaMonkey': '*',
'Thunderbird': '*'
diff --git a/toolkit/jetpack/sdk/ui/state/events.js b/toolkit/jetpack/sdk/ui/state/events.js
index 98909656a..34d14be3a 100644
--- a/toolkit/jetpack/sdk/ui/state/events.js
+++ b/toolkit/jetpack/sdk/ui/state/events.js
@@ -7,6 +7,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
'SeaMonkey': '*',
'Thunderbird': '*'
diff --git a/toolkit/modules/ResetProfile.jsm b/toolkit/modules/ResetProfile.jsm
index fe0d1cfe8..c1839af4f 100644
--- a/toolkit/modules/ResetProfile.jsm
+++ b/toolkit/modules/ResetProfile.jsm
@@ -11,7 +11,11 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
-const MOZ_APP_NAME = AppConstants.MOZ_APP_NAME;
+// For Basilisk and Pale Moon
+// Hard-code MOZ_APP_NAME to firefox because of hard-coded type in migrator.
+const MOZ_APP_NAME = (((AppConstants.MOZ_APP_NAME == "basilisk")
+ || (AppConstants.MOZ_APP_NAME == "palemoon"))
+ ? "firefox" : AppConstants.MOZ_APP_NAME);
const MOZ_BUILD_APP = AppConstants.MOZ_BUILD_APP;
this.ResetProfile = {
diff --git a/toolkit/xre/ProfileReset.cpp b/toolkit/xre/ProfileReset.cpp
index aef2d7746..c9e2ef8d4 100644
--- a/toolkit/xre/ProfileReset.cpp
+++ b/toolkit/xre/ProfileReset.cpp
@@ -31,13 +31,19 @@ static const char kProfileProperties[] =
* Creates a new profile with a timestamp in the name to use for profile reset.
*/
nsresult
-CreateResetProfile(nsIToolkitProfileService* aProfileSvc, nsIToolkitProfile* *aNewProfile)
+CreateResetProfile(nsIToolkitProfileService* aProfileSvc, const nsACString& aOldProfileName, nsIToolkitProfile* *aNewProfile)
{
MOZ_ASSERT(aProfileSvc, "NULL profile service");
nsCOMPtr<nsIToolkitProfile> newProfile;
- // Make the new profile "default-" + the time in seconds since epoch for uniqueness.
- nsAutoCString newProfileName("default-");
+ // Make the new profile the old profile (or "default-") + the time in seconds since epoch for uniqueness.
+ nsAutoCString newProfileName;
+ if (!aOldProfileName.IsEmpty()) {
+ newProfileName.Assign(aOldProfileName);
+ newProfileName.Append("-");
+ } else {
+ newProfileName.Assign("default-");
+ }
newProfileName.Append(nsPrintfCString("%lld", PR_Now() / 1000));
nsresult rv = aProfileSvc->CreateProfile(nullptr, // choose a default dir for us
newProfileName,
diff --git a/toolkit/xre/ProfileReset.h b/toolkit/xre/ProfileReset.h
index 7b5efbc4e..a164fe075 100644
--- a/toolkit/xre/ProfileReset.h
+++ b/toolkit/xre/ProfileReset.h
@@ -11,6 +11,7 @@ static bool gProfileResetCleanupCompleted = false;
static const char kResetProgressURL[] = "chrome://global/content/resetProfileProgress.xul";
nsresult CreateResetProfile(nsIToolkitProfileService* aProfileSvc,
+ const nsACString& aOldProfileName,
nsIToolkitProfile* *aNewProfile);
nsresult ProfileResetCleanup(nsIToolkitProfile* aOldProfile);
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
index 530e4a353..776044d72 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -1357,7 +1357,9 @@ DumpHelp()
" -v or --version Print %s version.\n"
" -P <profile> Start with <profile>.\n"
" --profile <path> Start with profile at <path>.\n"
+#ifdef MC_BASILISK
" --migration Start with migration wizard.\n"
+#endif
" --ProfileManager Start with ProfileManager.\n"
" --no-remote Do not accept or send remote commands;\n"
" implies --new-instance.\n"
@@ -1886,17 +1888,20 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc,
}
/**
- * Set the currently running profile as the default/selected one.
+ * Get the currently running profile using its root directory.
*
+ * @param aProfileSvc The profile service
* @param aCurrentProfileRoot The root directory of the current profile.
- * @return an error if aCurrentProfileRoot is not found or the profile could not
- * be set as the default.
+ * @param aProfile Out-param that returns the profile object.
+ * @return an error if aCurrentProfileRoot is not found
*/
static nsresult
-SetCurrentProfileAsDefault(nsIToolkitProfileService* aProfileSvc,
- nsIFile* aCurrentProfileRoot)
+GetCurrentProfile(nsIToolkitProfileService* aProfileSvc,
+ nsIFile* aCurrentProfileRoot,
+ nsIToolkitProfile** aProfile)
{
NS_ENSURE_ARG_POINTER(aProfileSvc);
+ NS_ENSURE_ARG_POINTER(aProfile);
nsCOMPtr<nsISimpleEnumerator> profiles;
nsresult rv = aProfileSvc->GetProfiles(getter_AddRefs(profiles));
@@ -1912,7 +1917,8 @@ SetCurrentProfileAsDefault(nsIToolkitProfileService* aProfileSvc,
profile->GetRootDir(getter_AddRefs(profileRoot));
profileRoot->Equals(aCurrentProfileRoot, &foundMatchingProfile);
if (foundMatchingProfile) {
- return aProfileSvc->SetSelectedProfile(profile);
+ profile.forget(aProfile);
+ return NS_OK;
}
rv = profiles->GetNext(getter_AddRefs(supports));
}
@@ -2000,7 +2006,7 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
if (gDoProfileReset) {
// If we're resetting a profile, create a new one and use it to startup.
nsCOMPtr<nsIToolkitProfile> newProfile;
- rv = CreateResetProfile(aProfileSvc, getter_AddRefs(newProfile));
+ rv = CreateResetProfile(aProfileSvc, gResetOldProfileName, getter_AddRefs(newProfile));
if (NS_SUCCEEDED(rv)) {
rv = newProfile->GetRootDir(getter_AddRefs(lf));
NS_ENSURE_SUCCESS(rv, rv);
@@ -2146,20 +2152,20 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
return ProfileLockedDialog(profile, unlocker, aNative, &tempProfileLock);
}
- nsCOMPtr<nsIToolkitProfile> newProfile;
- rv = CreateResetProfile(aProfileSvc, getter_AddRefs(newProfile));
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to create a profile to reset to.");
- gDoProfileReset = false;
- } else {
- nsresult gotName = profile->GetName(gResetOldProfileName);
- if (NS_SUCCEEDED(gotName)) {
- profile = newProfile;
- } else {
- NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
- gResetOldProfileName.Truncate(0);
+ nsresult gotName = profile->GetName(gResetOldProfileName);
+ if (NS_SUCCEEDED(gotName)) {
+ nsCOMPtr<nsIToolkitProfile> newProfile;
+ rv = CreateResetProfile(aProfileSvc, gResetOldProfileName, getter_AddRefs(newProfile));
+ if (NS_FAILED(rv)) {
+ NS_WARNING("Failed to create a profile to reset to.");
gDoProfileReset = false;
+ } else {
+ profile = newProfile;
}
+ } else {
+ NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
+ gResetOldProfileName.Truncate(0);
+ gDoProfileReset = false;
}
}
@@ -2254,20 +2260,22 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
return ProfileLockedDialog(profile, unlocker, aNative, &tempProfileLock);
}
- nsCOMPtr<nsIToolkitProfile> newProfile;
- rv = CreateResetProfile(aProfileSvc, getter_AddRefs(newProfile));
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to create a profile to reset to.");
- gDoProfileReset = false;
- } else {
- nsresult gotName = profile->GetName(gResetOldProfileName);
- if (NS_SUCCEEDED(gotName)) {
- profile = newProfile;
- } else {
- NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
- gResetOldProfileName.Truncate(0);
+ nsresult gotName = profile->GetName(gResetOldProfileName);
+ if (NS_SUCCEEDED(gotName)) {
+ nsCOMPtr<nsIToolkitProfile> newProfile;
+ rv = CreateResetProfile(aProfileSvc, gResetOldProfileName, getter_AddRefs(newProfile));
+ if (NS_FAILED(rv)) {
+ NS_WARNING("Failed to create a profile to reset to.");
gDoProfileReset = false;
}
+ else {
+ profile = newProfile;
+ }
+ }
+ else {
+ NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
+ gResetOldProfileName.Truncate(0);
+ gDoProfileReset = false;
}
}
@@ -3739,7 +3747,12 @@ XREMain::XRE_mainRun()
if (gDoProfileReset) {
// Automatically migrate from the current application if we just
// reset the profile.
- aKey = MOZ_APP_NAME;
+ // For Basilisk and Pale Moon:
+ // Hard-code MOZ_APP_NAME to firefox because of hard-coded type in migrator.
+ aKey = (((MOZ_APP_NAME == "basilisk")
+ || (MOZ_APP_NAME == "palemoon"))
+ ? "firefox" : MOZ_APP_NAME);
+
}
pm->Migrate(&mDirProvider, aKey, gResetOldProfileName);
}
@@ -3749,15 +3762,23 @@ XREMain::XRE_mainRun()
nsresult backupCreated = ProfileResetCleanup(profileBeingReset);
if (NS_FAILED(backupCreated)) NS_WARNING("Could not cleanup the profile that was reset");
- // Set the new profile as the default after we're done cleaning up the old profile,
- // iff that profile was already the default
- if (profileWasSelected) {
- // this is actually "broken" - see bug 1122124
- rv = SetCurrentProfileAsDefault(mProfileSvc, mProfD);
- if (NS_FAILED(rv)) NS_WARNING("Could not set current profile as the default");
+ nsCOMPtr<nsIToolkitProfile> newProfile;
+ rv = GetCurrentProfile(mProfileSvc, mProfD, getter_AddRefs(newProfile));
+ if (NS_SUCCEEDED(rv)) {
+ newProfile->SetName(gResetOldProfileName);
+ mProfileName.Assign(gResetOldProfileName);
+ // Set the new profile as the default after we're done cleaning up the old profile,
+ // iff that profile was already the default
+ if (profileWasSelected) {
+ rv = mProfileSvc->SetDefaultProfile(newProfile);
+ if (NS_FAILED(rv)) NS_WARNING("Could not set current profile as the default");
+ }
+ } else {
+ NS_WARNING("Could not find current profile to set as default / change name.");
}
- // Need to write out the fact that the profile has been removed and potentially
- // that the selected/default profile changed.
+
+ // Need to write out the fact that the profile has been removed, the new profile
+ // renamed, and potentially that the selected/default profile changed.
mProfileSvc->Flush();
}
}