diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-09-27 09:05:25 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-09-27 09:05:25 +0200 |
commit | fbaab39c94a047f2a0b0bfbe6cf24a790cd7e8b5 (patch) | |
tree | 7b0e57d393cb08a895973cab2d2072cb2b93a77f /application/palemoon/components | |
parent | 580084e9e1d0355c96a54a9641df6c1fee894948 (diff) | |
parent | e3508f55bed8a463d298021633dbc7d079c9d764 (diff) | |
download | UXP-fbaab39c94a047f2a0b0bfbe6cf24a790cd7e8b5.tar UXP-fbaab39c94a047f2a0b0bfbe6cf24a790cd7e8b5.tar.gz UXP-fbaab39c94a047f2a0b0bfbe6cf24a790cd7e8b5.tar.lz UXP-fbaab39c94a047f2a0b0bfbe6cf24a790cd7e8b5.tar.xz UXP-fbaab39c94a047f2a0b0bfbe6cf24a790cd7e8b5.zip |
Merge branch 'master' into Basilisk-release
Diffstat (limited to 'application/palemoon/components')
8 files changed, 87 insertions, 60 deletions
diff --git a/application/palemoon/components/preferences/advanced.js b/application/palemoon/components/preferences/advanced.js index 0803496fe..aab58b386 100644 --- a/application/palemoon/components/preferences/advanced.js +++ b/application/palemoon/components/preferences/advanced.js @@ -455,7 +455,7 @@ var gAdvancedPane = { var list = document.getElementById("offlineAppsList"); var item = list.selectedItem; var origin = item.getAttribute("origin"); - var principal = BrowserUtils.principalFromOrigin(origin); + var principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin); var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); @@ -474,7 +474,7 @@ var gAdvancedPane = { // get the permission var pm = Components.classes["@mozilla.org/permissionmanager;1"] .getService(Components.interfaces.nsIPermissionManager); - var perm = pm.getPermissionObject(principal, "offline-app"); + var perm = pm.getPermissionObject(principal, "offline-app", true); if (perm) { // clear offline cache entries try { diff --git a/application/palemoon/components/preferences/jar.mn b/application/palemoon/components/preferences/jar.mn index 2e2949306..47909ddc9 100644 --- a/application/palemoon/components/preferences/jar.mn +++ b/application/palemoon/components/preferences/jar.mn @@ -24,6 +24,7 @@ browser.jar: content/browser/preferences/languages.js * content/browser/preferences/main.xul content/browser/preferences/main.js + content/browser/preferences/newtaburl.js content/browser/preferences/permissions.xul * content/browser/preferences/permissions.js * content/browser/preferences/preferences.xul diff --git a/application/palemoon/components/preferences/main.xul b/application/palemoon/components/preferences/main.xul index 7634056eb..bb51947b0 100644 --- a/application/palemoon/components/preferences/main.xul +++ b/application/palemoon/components/preferences/main.xul @@ -96,6 +96,7 @@ type="autocomplete" autocompletesearch="history" onsyncfrompreference="return gMainPane.syncFromHomePref();" onsynctopreference="return gMainPane.syncToHomePref(this.value);" + oninput="gNewtabUrl.writeNewtabUrl(null, this.value);" placeholder="&abouthome.pageTitle;" preference="browser.startup.homepage"/> </hbox> @@ -103,15 +104,15 @@ <button label="" accesskey="&useCurrentPage.accesskey;" label1="&useCurrentPage.label;" label2="&useMultiple.label;" - oncommand="gMainPane.setHomePageToCurrent();" + oncommand="gMainPane.setHomePageToCurrent(); gNewtabUrl.writeNewtabUrl();" id="useCurrent" preference="pref.browser.homepage.disable_button.current_page"/> <button label="&chooseBookmark.label;" accesskey="&chooseBookmark.accesskey;" - oncommand="gMainPane.setHomePageToBookmark();" + oncommand="gMainPane.setHomePageToBookmark(); gNewtabUrl.writeNewtabUrl();" id="useBookmark" preference="pref.browser.homepage.disable_button.bookmark_page"/> <button label="&restoreDefault.label;" accesskey="&restoreDefault.accesskey;" - oncommand="gMainPane.restoreDefaultHomePage();" + oncommand="gMainPane.restoreDefaultHomePage(); gNewtabUrl.writeNewtabUrl();" id="restoreDefaultHomePage" preference="pref.browser.homepage.disable_button.restore_default"/> </hbox> diff --git a/application/palemoon/components/preferences/newtaburl.js b/application/palemoon/components/preferences/newtaburl.js new file mode 100644 index 000000000..ac0eec1c5 --- /dev/null +++ b/application/palemoon/components/preferences/newtaburl.js @@ -0,0 +1,68 @@ +/* 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/. */
+
+var gNewtabUrl = {
+ /**
+ * Writes browser.newtab.url with the appropriate value.
+ * If the choice is "my home page", get and sanitize
+ * the browser home page URL to make it suitable for newtab use.
+ *
+ * Called from prefwindow ondialogaccept in preferences.xul,
+ * newtabPage oncommand in tabs.xul, browserHomePage oninput,
+ * useCurrent, useBookmark and restoreDefaultHomePage oncommand
+ * in main.xul to consider instantApply.
+ */
+ writeNewtabUrl: function(newtabUrlChoice, browserHomepageUrl) {
+ try {
+ if (newtabUrlChoice) {
+ if (Services.prefs.getBoolPref("browser.preferences.instantApply")) {
+ newtabUrlChoice = parseInt(newtabUrlChoice);
+ } else {
+ return;
+ }
+ } else {
+ newtabUrlChoice = Services.prefs.getIntPref("browser.newtab.choice");
+ }
+ if (browserHomepageUrl || browserHomepageUrl == "") {
+ if (Services.prefs.getBoolPref("browser.preferences.instantApply")) {
+ if (browserHomepageUrl == "") {
+ browserHomepageUrl = "about:home";
+ }
+ } else {
+ return;
+ }
+ } else {
+ browserHomepageUrl = Services.prefs.getComplexValue("browser.startup.homepage",
+ Components.interfaces.nsIPrefLocalizedString).data;
+ }
+ let newtabUrlPref = Services.prefs.getCharPref("browser.newtab.url");
+ switch (newtabUrlChoice) {
+ case 1:
+ newtabUrlPref = "about:logopage";
+ break;
+ case 2:
+ newtabUrlPref = Services.prefs.getDefaultBranch("browser.")
+ .getComplexValue("startup.homepage",
+ Components.interfaces.nsIPrefLocalizedString).data;
+ break;
+ case 3:
+ // If url is a pipe-delimited set of pages, just take the first one.
+ let newtabUrlSanitizedPref=browserHomepageUrl.split("|")[0];
+ // XXX: do we need extra sanitation here, e.g. for invalid URLs?
+ Services.prefs.setCharPref("browser.newtab.myhome", newtabUrlSanitizedPref);
+ newtabUrlPref = newtabUrlSanitizedPref;
+ break;
+ case 4:
+ newtabUrlPref = "about:newtab";
+ break;
+ default:
+ // In case of any other value it's a custom URL, consider instantApply.
+ if (this.newtabPageCustom) {
+ newtabUrlPref = this.newtabPageCustom;
+ }
+ }
+ Services.prefs.setCharPref("browser.newtab.url",newtabUrlPref);
+ } catch(e) { console.error(e); }
+ }
+};
diff --git a/application/palemoon/components/preferences/preferences.xul b/application/palemoon/components/preferences/preferences.xul index 2f00b960a..a1d9c8cf7 100644 --- a/application/palemoon/components/preferences/preferences.xul +++ b/application/palemoon/components/preferences/preferences.xul @@ -56,10 +56,10 @@ #endif #endif onunload="if (typeof gSecurityPane != 'undefined') gSecurityPane.syncAddonSecurityLevel();" - ondialogaccept="if (typeof gTabsPane != 'undefined') gTabsPane.writeNewtabUrl(); - return true;"> + ondialogaccept="gNewtabUrl.writeNewtabUrl();"> <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/> + <script type="application/javascript" src="chrome://browser/content/preferences/newtaburl.js"/> <stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/> <stringbundle id="bundlePreferences" diff --git a/application/palemoon/components/preferences/tabs.js b/application/palemoon/components/preferences/tabs.js index f0ad8490c..17084a770 100644 --- a/application/palemoon/components/preferences/tabs.js +++ b/application/palemoon/components/preferences/tabs.js @@ -85,11 +85,14 @@ var gTabsPane = { let newtabUrlPref = document.getElementById("browser.newtab.url"); let newtabUrlSanitizedPref = document.getElementById("browser.newtab.myhome"); let newtabUrlChoice = document.getElementById("browser.newtab.choice"); + let defaultStartupHomepage = Services.prefs.getDefaultBranch("browser.") + .getComplexValue("startup.homepage", + Components.interfaces.nsIPrefLocalizedString).data; switch (newtabUrlPref.value) { case "about:logopage": newtabUrlChoice.value = 1; break; - case "http://start.palemoon.org/": + case defaultStartupHomepage: newtabUrlChoice.value = 2; break; case newtabUrlSanitizedPref.value: @@ -104,54 +107,5 @@ var gTabsPane = { // We need this to consider instantApply. this.newtabPageCustom = newtabUrlPref.value; } - }, - - /** - * Writes browser.newtab.url with the appropriate value. - * if the choice is "my home page", get and sanitize the browser home page - * URL to make it suitable for newtab use. - * - * Called from prefwindow's ondialogaccept handler and - * from browser.newtab.choice's oncommand to consider instantApply. - */ - writeNewtabUrl: function(newtabUrlChoice) { - try { - if (newtabUrlChoice) { - if (Services.prefs.getBoolPref("browser.preferences.instantApply")) { - newtabUrlChoice = parseInt(newtabUrlChoice); - } else { - return; - } - } else { - newtabUrlChoice = Services.prefs.getIntPref("browser.newtab.choice"); - } - let browserHomepageUrl = Services.prefs.getComplexValue("browser.startup.homepage", - Components.interfaces.nsIPrefLocalizedString).data; - let newtabUrlPref = Services.prefs.getCharPref("browser.newtab.url"); - switch (newtabUrlChoice) { - case 1: - newtabUrlPref = "about:logopage"; - break; - case 2: - newtabUrlPref = "http://start.palemoon.org/"; - break; - case 3: - // If url is a pipe-delimited set of pages, just take the first one. - let newtabUrlSanitizedPref=browserHomepageUrl.split("|")[0]; - // XXX: do we need extra sanitation here, e.g. for invalid URLs? - Services.prefs.setCharPref("browser.newtab.myhome", newtabUrlSanitizedPref); - newtabUrlPref = newtabUrlSanitizedPref; - break; - case 4: - newtabUrlPref = "about:newtab"; - break; - default: - // In case of any other value it's a custom URL, consider instantApply. - if (this.newtabPageCustom) { - newtabUrlPref = this.newtabPageCustom; - } - } - Services.prefs.setCharPref("browser.newtab.url",newtabUrlPref); - } catch(e) { console.error(e); } } }; diff --git a/application/palemoon/components/preferences/tabs.xul b/application/palemoon/components/preferences/tabs.xul index f5b44b776..64529d60d 100644 --- a/application/palemoon/components/preferences/tabs.xul +++ b/application/palemoon/components/preferences/tabs.xul @@ -85,7 +85,7 @@ <menulist id="newtabPage" preference="browser.newtab.choice" - oncommand="gTabsPane.writeNewtabUrl(event.target.value);"> + oncommand="gNewtabUrl.writeNewtabUrl(event.target.value);"> <menupopup> <menuitem label="&newtabPage.custom.label;" value="0" id="newtabPageCustom" hidden="true" /> <menuitem label="&newtabPage.blank.label;" value="1" /> diff --git a/application/palemoon/components/sessionstore/SessionStore.jsm b/application/palemoon/components/sessionstore/SessionStore.jsm index c5e55321c..e19a578f4 100644 --- a/application/palemoon/components/sessionstore/SessionStore.jsm +++ b/application/palemoon/components/sessionstore/SessionStore.jsm @@ -2739,7 +2739,9 @@ var SessionStoreInternal = { for (var t = 0; t < newTabCount; t++) { tabs.push(t < openTabCount ? tabbrowser.tabs[t] : - tabbrowser.addTab("about:blank", {skipAnimation: true})); + tabbrowser.addTab("about:blank", + {skipAnimation: true, + skipBackgroundNotify: true})); // when resuming at startup: add additionally requested pages to the end if (!aOverwriteTabs && root._firstTabs) { tabbrowser.moveTabTo(tabs[t], t); @@ -4684,7 +4686,8 @@ var TabAttributes = { // 'image' should not be accessed directly but handled by using the // gBrowser.getIcon()/setIcon() methods. // 'pending' is used internal by sessionstore and managed accordingly. - _skipAttrs: new Set(["image", "pending"]), + // 'skipbackgroundnotify' is used internal by tabbrowser.xml. + _skipAttrs: new Set(["image", "pending", "skipbackgroundnotify"]), persist: function (name) { if (this._attrs.has(name) || this._skipAttrs.has(name)) { |