diff options
Diffstat (limited to 'application/palemoon/components')
16 files changed, 62 insertions, 168 deletions
diff --git a/application/palemoon/components/BrowserComponents.manifest b/application/palemoon/components/BrowserComponents.manifest index b7f054eab..0ff14d066 100644 --- a/application/palemoon/components/BrowserComponents.manifest +++ b/application/palemoon/components/BrowserComponents.manifest @@ -10,7 +10,6 @@ contract @mozilla.org/network/protocol/about;1?what=palemoon {8cc51368-6aa0-43e8 contract @mozilla.org/network/protocol/about;1?what=permissions {8cc51368-6aa0-43e8-b762-bde9b9fd828c} contract @mozilla.org/network/protocol/about;1?what=privatebrowsing {8cc51368-6aa0-43e8-b762-bde9b9fd828c} contract @mozilla.org/network/protocol/about;1?what=rights {8cc51368-6aa0-43e8-b762-bde9b9fd828c} -contract @mozilla.org/network/protocol/about;1?what=robots {8cc51368-6aa0-43e8-b762-bde9b9fd828c} contract @mozilla.org/network/protocol/about;1?what=sessionrestore {8cc51368-6aa0-43e8-b762-bde9b9fd828c} #ifdef MOZ_SERVICES_SYNC contract @mozilla.org/network/protocol/about;1?what=sync-progress {8cc51368-6aa0-43e8-b762-bde9b9fd828c} diff --git a/application/palemoon/components/distribution.js b/application/palemoon/components/distribution.js index d3300604e..121e55b1b 100644 --- a/application/palemoon/components/distribution.js +++ b/application/palemoon/components/distribution.js @@ -38,13 +38,7 @@ DistributionCustomizer.prototype = { }, get _locale() { - let locale; - try { - locale = this._prefs.getCharPref("general.useragent.locale"); - } - catch (e) { - locale = "en-US"; - } + let locale = this._prefs.getCharPref("general.useragent.locale", "en-US"); this.__defineGetter__("_locale", function() locale); return this._locale; }, @@ -221,11 +215,7 @@ DistributionCustomizer.prototype = { this._ini.getString("Global", "id") + ".bookmarksProcessed"; } - let bmProcessed = false; - try { - bmProcessed = this._prefs.getBoolPref(bmProcessedPref); - } - catch (e) {} + let bmProcessed = this._prefs.getBoolPref(bmProcessedPref, false); if (!bmProcessed) { if (sections["BookmarksMenu"]) diff --git a/application/palemoon/components/feeds/FeedWriter.js b/application/palemoon/components/feeds/FeedWriter.js index d704835bb..facde5815 100644 --- a/application/palemoon/components/feeds/FeedWriter.js +++ b/application/palemoon/components/feeds/FeedWriter.js @@ -18,12 +18,7 @@ function LOG(str) { var prefB = Cc["@mozilla.org/preferences-service;1"]. getService(Ci.nsIPrefBranch); - var shouldLog = false; - try { - shouldLog = prefB.getBoolPref("feeds.log"); - } - catch (ex) { - } + var shouldLog = prefB.getBoolPref("feeds.log", false); if (shouldLog) dump("*** Feeds: " + str + "\n"); @@ -874,11 +869,7 @@ FeedWriter.prototype = { Cc["@mozilla.org/preferences-service;1"]. getService(Ci.nsIPrefBranch); - var handler = "bookmarks"; - try { - handler = prefs.getCharPref(getPrefReaderForType(feedType)); - } - catch (ex) { } + var handler = prefs.getCharPref(getPrefReaderForType(feedType), "bookmarks"); switch (handler) { case "web": { @@ -1076,11 +1067,7 @@ FeedWriter.prototype = { .addEventListener("command", this, false); // first-run ui - var showFirstRunUI = true; - try { - showFirstRunUI = prefs.getBoolPref(PREF_SHOW_FIRST_RUN_UI); - } - catch (ex) { } + var showFirstRunUI = prefs.getBoolPref(PREF_SHOW_FIRST_RUN_UI, true); if (showFirstRunUI) { var textfeedinfo1, textfeedinfo2; switch (feedType) { diff --git a/application/palemoon/components/feeds/WebContentConverter.js b/application/palemoon/components/feeds/WebContentConverter.js index 41679b028..42e2edee0 100644 --- a/application/palemoon/components/feeds/WebContentConverter.js +++ b/application/palemoon/components/feeds/WebContentConverter.js @@ -436,13 +436,8 @@ WebContentConverterRegistrar.prototype = { // check if it is in the black list var pb = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); - var allowed; - try { - allowed = pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "." + aProtocol); - } - catch (e) { - allowed = pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "-default"); - } + var allowed = pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "." + aProtocol, + pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "-default")); if (!allowed) { // XXX this should be a "security exception" according to spec throw("Not allowed to register a protocol handler for " + aProtocol); diff --git a/application/palemoon/components/fuel/fuelApplication.js b/application/palemoon/components/fuel/fuelApplication.js index 017813143..bc3a091ea 100644 --- a/application/palemoon/components/fuel/fuelApplication.js +++ b/application/palemoon/components/fuel/fuelApplication.js @@ -6,6 +6,8 @@ const Ci = Components.interfaces; const Cc = Components.classes; Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", + "resource://gre/modules/Deprecated.jsm"); const APPLICATION_CID = Components.ID("fe74cf80-aa2d-11db-abbd-0800200c9a66"); const APPLICATION_CONTRACTID = "@mozilla.org/fuel/application;1"; @@ -734,6 +736,8 @@ var ApplicationFactory = { //================================================= // Application constructor function Application() { + Deprecated.warning("FUEL is deprecated, you should use the standard Toolkit API instead.", + "https://github.com/MoonchildProductions/UXP/issues/1083"); this.initToolkitHelpers(); } diff --git a/application/palemoon/components/newtab/grid.js b/application/palemoon/components/newtab/grid.js index db3d319c3..e63ea54a6 100644 --- a/application/palemoon/components/newtab/grid.js +++ b/application/palemoon/components/newtab/grid.js @@ -130,13 +130,9 @@ var gGrid = { // Create sites. let numLinks = Math.min(links.length, cells.length); - let hasHistoryTiles = false; for (let i = 0; i < numLinks; i++) { if (links[i]) { this.createSite(links[i], cells[i]); - if (links[i].type == "history") { - hasHistoryTiles = true; - } } } diff --git a/application/palemoon/components/newtab/page.js b/application/palemoon/components/newtab/page.js index 7117d4527..34387fd44 100644 --- a/application/palemoon/components/newtab/page.js +++ b/application/palemoon/components/newtab/page.js @@ -47,11 +47,6 @@ var gPage = { let enabled = gAllPages.enabled; this._updateAttributes(enabled); - // Update thumbnails to the new enhanced setting - if (aData == "browser.newtabpage.enhanced") { - this.update(); - } - // Initialize the whole page if we haven't done that, yet. if (enabled) { this._init(); @@ -166,16 +161,6 @@ var gPage = { */ _handleUnloadEvent: function Page_handleUnloadEvent() { gAllPages.unregister(this); - // compute page life-span and send telemetry probe: using milli-seconds will leave - // many low buckets empty. Instead we use half-second precision to make low end - // of histogram linear and not lose the change in user attention - let delta = Math.round((Date.now() - this._firstVisibleTime) / 500); - if (this._suggestedTilePresent) { - Services.telemetry.getHistogramById("NEWTAB_PAGE_LIFE_SPAN_SUGGESTED").add(delta); - } - else { - Services.telemetry.getHistogramById("NEWTAB_PAGE_LIFE_SPAN").add(delta); - } }, /** @@ -250,43 +235,10 @@ var gPage = { }, onPageVisibleAndLoaded() { - // Send the index of the last visible tile. - this.reportLastVisibleTileIndex(); - // Maybe tell the user they can undo an initial automigration - this.maybeShowAutoMigrationUndoNotification(); - }, - - reportLastVisibleTileIndex() { - let cwu = window.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils); - - let rect = cwu.getBoundsWithoutFlushing(gGrid.node); - let nodes = cwu.nodesFromRect(rect.left, rect.top, 0, rect.width, - rect.height, 0, true, false); - - let i = -1; - let lastIndex = -1; - let sites = gGrid.sites; - - for (let node of nodes) { - if (node.classList && node.classList.contains("newtab-cell")) { - if (sites[++i]) { - lastIndex = i; - if (sites[i].link.targetedSite) { - // record that suggested tile is shown to use suggested-tiles-histogram - this._suggestedTilePresent = true; - } - } - } - } }, toggleEnabled: function(aEvent) { gAllPages.enabled = !gAllPages.enabled; - event.stopPropagation(); - }, - - maybeShowAutoMigrationUndoNotification() { - // sendAsyncMessage("NewTab:MaybeShowAutoMigrationUndoNotification"); - }, + aEvent.stopPropagation(); + } }; diff --git a/application/palemoon/components/newtab/sites.js b/application/palemoon/components/newtab/sites.js index a368146bb..cb5675238 100644 --- a/application/palemoon/components/newtab/sites.js +++ b/application/palemoon/components/newtab/sites.js @@ -136,15 +136,6 @@ Site.prototype = { return str; }, - _getSuggestedTileExplanation: function() { - let targetedName = `<strong> ${this.link.targetedName} </strong>`; - let targetedSite = `<strong> ${this.link.targetedSite} </strong>`; - if (this.link.explanation) { - return this._newTabString(this.link.explanation, [targetedName, targetedSite]); - } - return newTabString("suggested.button", [targetedName]); - }, - /** * Checks for and modifies link at campaign end time */ @@ -155,11 +146,8 @@ Site.prototype = { this.link.url = Services.io.newURI(this.url, null, null).resolve("/"); // clear supplied images - this triggers thumbnail download for new url delete this.link.imageURI; - delete this.link.enhancedImageURI; // remove endTime to avoid further time checks delete this.link.endTime; - // clear enhanced-content image that may still exist in preloaded page - this._querySelector(".enhanced-content").style.backgroundImage = ""; gPinnedLinks.replace(oldUrl, this.link); } }, @@ -337,7 +325,7 @@ Site.prototype = { } else if (!pinned && target.classList.contains("newtab-control-pin")) { if (this.pin()) { - // suggested link has changed - update rest of the pages + // link has changed - update rest of the pages gAllPages.update(gPage); } action = "pin"; diff --git a/application/palemoon/components/nsAboutRedirector.js b/application/palemoon/components/nsAboutRedirector.js index 9c7d7953f..4d99a78f5 100644 --- a/application/palemoon/components/nsAboutRedirector.js +++ b/application/palemoon/components/nsAboutRedirector.js @@ -61,10 +61,6 @@ AboutRedirector.prototype = { url: "chrome://global/content/aboutRights.xhtml", flags: (URI_SAFE_FOR_UNTRUSTED_CONTENT | MAKE_LINKABLE | ALLOW_SCRIPT) }, - "robots": { - url: "chrome://browser/content/aboutRobots.xhtml", - flags: (URI_SAFE_FOR_UNTRUSTED_CONTENT | ALLOW_SCRIPT | HIDE_FROM_ABOUTABOUT) - }, "sessionrestore": { url: "chrome://browser/content/aboutSessionRestore.xhtml", flags: ALLOW_SCRIPT diff --git a/application/palemoon/components/nsBrowserContentHandler.js b/application/palemoon/components/nsBrowserContentHandler.js index 6a75b40f2..e7f1414c2 100644 --- a/application/palemoon/components/nsBrowserContentHandler.js +++ b/application/palemoon/components/nsBrowserContentHandler.js @@ -100,20 +100,14 @@ const OVERRIDE_NEW_BUILD_ID = 3; * OVERRIDE_NONE otherwise. */ function needHomepageOverride(prefb) { - var savedmstone = null; - try { - savedmstone = prefb.getCharPref("browser.startup.homepage_override.mstone"); - } catch (e) {} + var savedmstone = prefb.getCharPref("browser.startup.homepage_override.mstone", ""); if (savedmstone == "ignore") return OVERRIDE_NONE; var mstone = Services.appinfo.platformVersion; - var savedBuildID = null; - try { - savedBuildID = prefb.getCharPref("browser.startup.homepage_override.buildID"); - } catch (e) {} + var savedBuildID = prefb.getCharPref("browser.startup.homepage_override.buildID", ""); var buildID = Services.appinfo.platformBuildID; @@ -550,10 +544,7 @@ nsBrowserContentHandler.prototype = { // URL if we do end up showing an overridePage. This makes it possible // to have the overridePage's content vary depending on the version we're // upgrading from. - let old_mstone = "unknown"; - try { - old_mstone = Services.prefs.getCharPref("browser.startup.homepage_override.mstone"); - } catch (ex) {} + let old_mstone = Services.prefs.getCharPref("browser.startup.homepage_override.mstone", "unknown"); let override = needHomepageOverride(prefb); if (override != OVERRIDE_NONE) { switch (override) { diff --git a/application/palemoon/components/nsBrowserGlue.js b/application/palemoon/components/nsBrowserGlue.js index ad48dab29..01a133833 100644 --- a/application/palemoon/components/nsBrowserGlue.js +++ b/application/palemoon/components/nsBrowserGlue.js @@ -990,14 +990,8 @@ BrowserGlue.prototype = { // An import operation is about to run. // Don't try to recreate smart bookmarks if autoExportHTML is true or // smart bookmarks are disabled. - var autoExportHTML = false; - try { - autoExportHTML = Services.prefs.getBoolPref("browser.bookmarks.autoExportHTML"); - } catch(ex) {} - var smartBookmarksVersion = 0; - try { - smartBookmarksVersion = Services.prefs.getIntPref("browser.places.smartBookmarksVersion"); - } catch(ex) {} + var autoExportHTML = Services.prefs.getBoolPref("browser.bookmarks.autoExportHTML", false); + var smartBookmarksVersion = Services.prefs.getIntPref("browser.places.smartBookmarksVersion", 0); if (!autoExportHTML && smartBookmarksVersion != -1) Services.prefs.setIntPref("browser.places.smartBookmarksVersion", 0); @@ -1556,10 +1550,7 @@ BrowserGlue.prototype = { const MAX_RESULTS = 10; // Get current smart bookmarks version. If not set, create them. - let smartBookmarksCurrentVersion = 0; - try { - smartBookmarksCurrentVersion = Services.prefs.getIntPref(SMART_BOOKMARKS_PREF); - } catch(ex) {} + let smartBookmarksCurrentVersion = Services.prefs.getIntPref(SMART_BOOKMARKS_PREF, 0); // If version is current or smart bookmarks are disabled, just bail out. if (smartBookmarksCurrentVersion == -1 || diff --git a/application/palemoon/components/places/PlacesUIUtils.jsm b/application/palemoon/components/places/PlacesUIUtils.jsm index 05d79241c..e3a9e1322 100644 --- a/application/palemoon/components/places/PlacesUIUtils.jsm +++ b/application/palemoon/components/places/PlacesUIUtils.jsm @@ -1170,11 +1170,8 @@ this.PlacesUIUtils = { * @return The URL with the fragment at the end */ getImageURLForResolution: - function PUIU_getImageURLForResolution(aWindow, aURL, aWidth = 16, aHeight = 16) { - let width = Math.round(aWidth * aWindow.devicePixelRatio); - let height = Math.round(aHeight * aWindow.devicePixelRatio); - return aURL + (aURL.includes("#") ? "&" : "#") + - "-moz-resolution=" + width + "," + height; + function PUIU_getImageURLForResolution(aWindow, aURL, aWidth, aHeight) { + return aURL; } }; diff --git a/application/palemoon/components/preferences/newtaburl.js b/application/palemoon/components/preferences/newtaburl.js index ac0eec1c5..3c82df846 100644 --- a/application/palemoon/components/preferences/newtaburl.js +++ b/application/palemoon/components/preferences/newtaburl.js @@ -22,7 +22,11 @@ var gNewtabUrl = { return;
}
} else {
- newtabUrlChoice = Services.prefs.getIntPref("browser.newtab.choice");
+ if (this.newtabUrlChoiceIsSet) {
+ newtabUrlChoice = Services.prefs.getIntPref("browser.newtab.choice");
+ } else {
+ newtabUrlChoice = this.getNewtabChoice();
+ }
}
if (browserHomepageUrl || browserHomepageUrl == "") {
if (Services.prefs.getBoolPref("browser.preferences.instantApply")) {
@@ -64,5 +68,35 @@ var gNewtabUrl = { }
Services.prefs.setCharPref("browser.newtab.url",newtabUrlPref);
} catch(e) { console.error(e); }
+ },
+
+ /**
+ * Determines the value of browser.newtab.choice based
+ * on the value of browser.newtab.url
+ *
+ * @returns the value of browser.newtab.choice
+ */
+ getNewtabChoice: function() {
+ let newtabUrlPref = Services.prefs.getCharPref("browser.newtab.url");
+ let browserHomepageUrl = Services.prefs.getComplexValue("browser.startup.homepage",
+ Components.interfaces.nsIPrefLocalizedString).data;
+ let newtabUrlSanitizedPref = browserHomepageUrl.split("|")[0];
+ let defaultStartupHomepage = Services.prefs.getDefaultBranch("browser.")
+ .getComplexValue("startup.homepage",
+ Components.interfaces.nsIPrefLocalizedString).data;
+ switch (newtabUrlPref) {
+ case "about:logopage":
+ return 1;
+ case defaultStartupHomepage:
+ return 2;
+ case newtabUrlSanitizedPref:
+ return 3;
+ case "about:newtab":
+ return 4;
+ default: // Custom URL entered.
+ // We need this to consider instantApply.
+ this.newtabPageCustom = newtabUrlPref;
+ return 0;
+ }
}
};
diff --git a/application/palemoon/components/preferences/preferences.xul b/application/palemoon/components/preferences/preferences.xul index 2b7fd9ded..a1d9c8cf7 100644 --- a/application/palemoon/components/preferences/preferences.xul +++ b/application/palemoon/components/preferences/preferences.xul @@ -56,7 +56,7 @@ #endif #endif onunload="if (typeof gSecurityPane != 'undefined') gSecurityPane.syncAddonSecurityLevel();" - ondialogaccept="if (typeof gTabsPane != 'undefined') gNewtabUrl.writeNewtabUrl();"> + ondialogaccept="gNewtabUrl.writeNewtabUrl();"> <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/> <script type="application/javascript" src="chrome://browser/content/preferences/newtaburl.js"/> diff --git a/application/palemoon/components/preferences/tabs.js b/application/palemoon/components/preferences/tabs.js index 17084a770..b09cb60df 100644 --- a/application/palemoon/components/preferences/tabs.js +++ b/application/palemoon/components/preferences/tabs.js @@ -78,34 +78,13 @@ var gTabsPane = { /** * Determines the value of the New Tab display drop-down based * on the value of browser.newtab.url. - * - * @returns the appropriate value of browser.newtab.choice */ readNewtabUrl: function() { - 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 defaultStartupHomepage: - newtabUrlChoice.value = 2; - break; - case newtabUrlSanitizedPref.value: - newtabUrlChoice.value = 3; - break; - case "about:newtab": - newtabUrlChoice.value = 4; - break; - default: // Custom URL entered. - document.getElementById("newtabPageCustom").hidden = false; - newtabUrlChoice.value = 0; - // We need this to consider instantApply. - this.newtabPageCustom = newtabUrlPref.value; + newtabUrlChoice.value = gNewtabUrl.getNewtabChoice(); + if (newtabUrlChoice.value == 0) { + document.getElementById("newtabPageCustom").hidden = false; } + gNewtabUrl.newtabUrlChoiceIsSet = true; } }; diff --git a/application/palemoon/components/search/content/search.xml b/application/palemoon/components/search/content/search.xml index 4532f5720..0c33b1527 100644 --- a/application/palemoon/components/search/content/search.xml +++ b/application/palemoon/components/search/content/search.xml @@ -283,11 +283,6 @@ <parameter name="element"/> <parameter name="uri"/> <body><![CDATA[ - if (uri) { - let size = Math.round(16 * window.devicePixelRatio); - if (!uri.includes("#")) - uri += "#-moz-resolution=" + size + "," + size; - } element.setAttribute("src", uri); ]]></body> </method> |