"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "application/palemoon/base/content/utilityOverlay.js" between
UXP-2019.03.27.tar.gz and UXP-2019.06.08.tar.gz

About: Basilisk is a full-featured, optimized browser derived from the code behind the pre-Servo Firefox browser (29–56 era). UXP = Unified XUL Platform. Source code.

utilityOverlay.js  (UXP-2019.03.27):utilityOverlay.js  (UXP-2019.06.08)
skipping to change at line 15 skipping to change at line 15
// Services = object with smart getters for common XPCOM services // Services = object with smart getters for common XPCOM services
Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
Components.utils.import("resource:///modules/RecentWindow.jsm"); Components.utils.import("resource:///modules/RecentWindow.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ShellService", XPCOMUtils.defineLazyModuleGetter(this, "ShellService",
"resource:///modules/ShellService.jsm"); "resource:///modules/ShellService.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm");
XPCOMUtils.defineLazyGetter(this, "BROWSER_NEW_TAB_URL", function () { XPCOMUtils.defineLazyGetter(this, "BROWSER_NEW_TAB_URL", function () {
const PREF = "browser.newtab.url"; const PREF = "browser.newtab.url";
function getNewTabPageURL() { function getNewTabPageURL() {
if (!Services.prefs.prefHasUserValue(PREF)) { if (!Services.prefs.prefHasUserValue(PREF)) {
if (PrivateBrowsingUtils.isWindowPrivate(window) && if (PrivateBrowsingUtils.isWindowPrivate(window) &&
!PrivateBrowsingUtils.permanentPrivateBrowsing) !PrivateBrowsingUtils.permanentPrivateBrowsing)
return "about:privatebrowsing"; return "about:privatebrowsing";
} }
return Services.prefs.getCharPref(PREF) || "about:blank"; return Services.prefs.getCharPref(PREF) || "about:blank";
skipping to change at line 60 skipping to change at line 63
// a "blank page" to fix focus issues. // a "blank page" to fix focus issues.
// Original code: return aURL == "about:blank" || aURL == BROWSER_NEW_TAB_URL; // Original code: return aURL == "about:blank" || aURL == BROWSER_NEW_TAB_URL;
return aURL == "about:blank" || aURL == "about:newtab" || aURL == "about:logop age"; return aURL == "about:blank" || aURL == "about:newtab" || aURL == "about:logop age";
} }
function getBrowserURL() function getBrowserURL()
{ {
return "chrome://browser/content/browser.xul"; return "chrome://browser/content/browser.xul";
} }
function getBoolPref(pref, defaultValue) {
Deprecated.warning("getBoolPref is deprecated and will be removed in a future
release. " +
"You should use Services.pref.getBoolPref (Services.jsm).",
"https://github.com/MoonchildProductions/UXP/issues/989");
return Services.prefs.getBoolPref(pref, defaultValue);
}
function getTopWin(skipPopups) { function getTopWin(skipPopups) {
// If this is called in a browser window, use that window regardless of // If this is called in a browser window, use that window regardless of
// whether it's the frontmost window, since commands can be executed in // whether it's the frontmost window, since commands can be executed in
// background windows (bug 626148). // background windows (bug 626148).
if (top.document.documentElement.getAttribute("windowtype") == "navigator:brow ser" && if (top.document.documentElement.getAttribute("windowtype") == "navigator:brow ser" &&
(!skipPopups || top.toolbar.visible)) (!skipPopups || top.toolbar.visible))
return top; return top;
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(window); let isPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
return RecentWindow.getMostRecentBrowserWindow({private: isPrivate, return RecentWindow.getMostRecentBrowserWindow({private: isPrivate,
allowPopups: !skipPopups}); allowPopups: !skipPopups});
} }
function openTopWin(url) { function openTopWin(url) {
/* deprecated */ /* deprecated */
openUILinkIn(url, "current"); openUILinkIn(url, "current");
} }
function getBoolPref(prefname, def)
{
try {
return Services.prefs.getBoolPref(prefname);
}
catch(er) {
return def;
}
}
/* openUILink handles clicks on UI elements that cause URLs to load. /* openUILink handles clicks on UI elements that cause URLs to load.
* *
* As the third argument, you may pass an object with the same properties as * As the third argument, you may pass an object with the same properties as
* accepted by openUILinkIn, plus "ignoreButton" and "ignoreAlt". * accepted by openUILinkIn, plus "ignoreButton" and "ignoreAlt".
*/ */
function openUILink(url, event, aIgnoreButton, aIgnoreAlt, aAllowThirdPartyFixup , function openUILink(url, event, aIgnoreButton, aIgnoreAlt, aAllowThirdPartyFixup ,
aPostData, aReferrerURI) { aPostData, aReferrerURI) {
let params; let params;
if (aIgnoreButton && typeof aIgnoreButton == "object") { if (aIgnoreButton && typeof aIgnoreButton == "object") {
skipping to change at line 153 skipping to change at line 153
if (!e) if (!e)
return "current"; return "current";
var shift = e.shiftKey; var shift = e.shiftKey;
var ctrl = e.ctrlKey; var ctrl = e.ctrlKey;
var meta = e.metaKey; var meta = e.metaKey;
var alt = e.altKey && !ignoreAlt; var alt = e.altKey && !ignoreAlt;
// ignoreButton allows "middle-click paste" to use function without always ope ning in a new window. // ignoreButton allows "middle-click paste" to use function without always ope ning in a new window.
var middle = !ignoreButton && e.button == 1; var middle = !ignoreButton && e.button == 1;
var middleUsesTabs = getBoolPref("browser.tabs.opentabfor.middleclick", true); var middleUsesTabs = Services.prefs.getBoolPref("browser.tabs.opentabfor.middl eclick", true);
// Don't do anything special with right-mouse clicks. They're probably clicks on context menu items. // Don't do anything special with right-mouse clicks. They're probably clicks on context menu items.
#ifdef XP_MACOSX #ifdef XP_MACOSX
if (meta || (middle && middleUsesTabs)) if (meta || (middle && middleUsesTabs))
#else #else
if (ctrl || (middle && middleUsesTabs)) if (ctrl || (middle && middleUsesTabs))
#endif #endif
return shift ? "tabshifted" : "tab"; return shift ? "tabshifted" : "tab";
if (alt && getBoolPref("browser.altClickSave", false)) if (alt && Services.prefs.getBoolPref("browser.altClickSave", false))
return "save"; return "save";
if (shift || (middle && !middleUsesTabs)) if (shift || (middle && !middleUsesTabs))
return "window"; return "window";
return "current"; return "current";
} }
/* openUILinkIn opens a URL in a place specified by the parameter |where|. /* openUILinkIn opens a URL in a place specified by the parameter |where|.
* *
skipping to change at line 336 skipping to change at line 336
} }
Services.ww.openWindow(w || window, getBrowserURL(), null, features, sa); Services.ww.openWindow(w || window, getBrowserURL(), null, features, sa);
return; return;
} }
let loadInBackground = where == "current" ? false : aInBackground; let loadInBackground = where == "current" ? false : aInBackground;
if (loadInBackground == null) { if (loadInBackground == null) {
loadInBackground = aFromChrome ? loadInBackground = aFromChrome ?
false : false :
getBoolPref("browser.tabs.loadInBackground"); Services.prefs.getBoolPref("browser.tabs.loadInBackgrou nd");
} }
let uriObj; let uriObj;
if (where == "current") { if (where == "current") {
try { try {
uriObj = Services.io.newURI(url, null, null); uriObj = Services.io.newURI(url, null, null);
} catch (e) {} } catch (e) {}
} }
if (where == "current" && w.gBrowser.selectedTab.pinned) { if (where == "current" && w.gBrowser.selectedTab.pinned) {
skipping to change at line 517 skipping to change at line 517
} }
// This function exists for legacy reasons. // This function exists for legacy reasons.
function getShellService() function getShellService()
{ {
return ShellService; return ShellService;
} }
function isBidiEnabled() { function isBidiEnabled() {
// first check the pref. // first check the pref.
if (getBoolPref("bidi.browser.ui", false)) if (Services.prefs.getBoolPref("bidi.browser.ui", false))
return true; return true;
// if the pref isn't set, check for an RTL locale and force the pref to true // if the pref isn't set, check for an RTL locale and force the pref to true
// if we find one. // if we find one.
var rv = false; var rv = false;
try { try {
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1" ] var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1" ]
.getService(Components.interfaces.nsILocaleSer vice); .getService(Components.interfaces.nsILocaleSer vice);
var systemLocale = localeService.getSystemLocale().getCategory("NSILOCALE_CT YPE").substr(0,3); var systemLocale = localeService.getSystemLocale().getCategory("NSILOCALE_CT YPE").substr(0,3);
skipping to change at line 559 skipping to change at line 559
var um = var um =
Components.classes["@mozilla.org/updates/update-manager;1"]. Components.classes["@mozilla.org/updates/update-manager;1"].
getService(Components.interfaces.nsIUpdateManager); getService(Components.interfaces.nsIUpdateManager);
var prompter = var prompter =
Components.classes["@mozilla.org/updates/update-prompt;1"]. Components.classes["@mozilla.org/updates/update-prompt;1"].
createInstance(Components.interfaces.nsIUpdatePrompt); createInstance(Components.interfaces.nsIUpdatePrompt);
// If there's an update ready to be applied, show the "Update Downloaded" // If there's an update ready to be applied, show the "Update Downloaded"
// UI instead and let the user know they have to restart the application for // UI instead and let the user know they have to restart the application for
// the changes to be applied. // the changes to be applied.
if (um.activeUpdate && um.activeUpdate.state == "pending") if (um.activeUpdate && ["pending", "pending-elevate", "applied"].includes(um.a ctiveUpdate.state))
prompter.showUpdateDownloaded(um.activeUpdate); prompter.showUpdateDownloaded(um.activeUpdate);
else else
prompter.checkForUpdates(); prompter.checkForUpdates();
} }
#endif #endif
/** /**
* Set up the help menu software update items to show proper status, * Set up the help menu software update items to show proper status,
* also disabling the items if update is disabled. * also disabling the items if update is disabled.
*/ */
skipping to change at line 585 skipping to change at line 585
getService(Components.interfaces.nsIApplicationUpdateService); getService(Components.interfaces.nsIApplicationUpdateService);
var um = var um =
Components.classes["@mozilla.org/updates/update-manager;1"]. Components.classes["@mozilla.org/updates/update-manager;1"].
getService(Components.interfaces.nsIUpdateManager); getService(Components.interfaces.nsIUpdateManager);
// Disable the UI if the update enabled pref has been locked by the // Disable the UI if the update enabled pref has been locked by the
// administrator or if we cannot update for some other reason. // administrator or if we cannot update for some other reason.
var checkForUpdates = document.getElementById("checkForUpdates"); var checkForUpdates = document.getElementById("checkForUpdates");
var appMenuCheckForUpdates = document.getElementById("appmenu_checkForUpdates" ); var appMenuCheckForUpdates = document.getElementById("appmenu_checkForUpdates" );
var canCheckForUpdates = updates.canCheckForUpdates; var canCheckForUpdates = updates.canCheckForUpdates;
checkForUpdates.setAttribute("disabled", !canCheckForUpdates); checkForUpdates.setAttribute("disabled", !canCheckForUpdates);
appMenuCheckForUpdates.setAttribute("disabled", !canCheckForUpdates);
if (!canCheckForUpdates) if (appMenuCheckForUpdates) {
appMenuCheckForUpdates.setAttribute("disabled", !canCheckForUpdates);
}
if (!canCheckForUpdates) {
return; return;
}
var strings = document.getElementById("bundle_browser"); var strings = document.getElementById("bundle_browser");
var activeUpdate = um.activeUpdate; var activeUpdate = um.activeUpdate;
// If there's an active update, substitute its name into the label // If there's an active update, substitute its name into the label
// we show for this item, otherwise display a generic label. // we show for this item, otherwise display a generic label.
function getStringWithUpdateName(key) { function getStringWithUpdateName(key) {
if (activeUpdate && activeUpdate.name) if (activeUpdate && activeUpdate.name)
return strings.getFormattedString(key, [activeUpdate.name]); return strings.getFormattedString(key, [activeUpdate.name]);
return strings.getString(key + "Fallback"); return strings.getString(key + "Fallback");
skipping to change at line 624 skipping to change at line 630
case "pending": case "pending":
// If we're waiting for the user to restart, show: "Apply Downloaded // If we're waiting for the user to restart, show: "Apply Downloaded
// Updates Now..." from updatesItem_pending or // Updates Now..." from updatesItem_pending or
// updatesItem_pendingFallback // updatesItem_pendingFallback
key = "pending"; key = "pending";
break; break;
} }
} }
checkForUpdates.label = getStringWithUpdateName("updatesItem_" + key); checkForUpdates.label = getStringWithUpdateName("updatesItem_" + key);
appMenuCheckForUpdates.label = getStringWithUpdateName("updatesItem_" + key);
if (appMenuCheckForUpdates) {
appMenuCheckForUpdates.label = getStringWithUpdateName("updatesItem_" + key)
;
}
// updatesItem_default.accesskey, updatesItem_downloading.accesskey, // updatesItem_default.accesskey, updatesItem_downloading.accesskey,
// updatesItem_resume.accesskey or updatesItem_pending.accesskey // updatesItem_resume.accesskey or updatesItem_pending.accesskey
checkForUpdates.accessKey = strings.getString("updatesItem_" + key + checkForUpdates.accessKey = strings.getString("updatesItem_" + key +
".accesskey"); ".accesskey");
appMenuCheckForUpdates.accessKey = strings.getString("updatesItem_" + key +
".accesskey"); if (appMenuCheckForUpdates) {
appMenuCheckForUpdates.accessKey = strings.getString("updatesItem_" + key +
".accesskey");
}
if (um.activeUpdate && updates.isDownloading) { if (um.activeUpdate && updates.isDownloading) {
checkForUpdates.setAttribute("loading", "true"); checkForUpdates.setAttribute("loading", "true");
appMenuCheckForUpdates.setAttribute("loading", "true"); if (appMenuCheckForUpdates) {
appMenuCheckForUpdates.setAttribute("loading", "true");
}
} else { } else {
checkForUpdates.removeAttribute("loading"); checkForUpdates.removeAttribute("loading");
appMenuCheckForUpdates.removeAttribute("loading"); if (appMenuCheckForUpdates) {
appMenuCheckForUpdates.removeAttribute("loading");
}
} }
#else #else
#ifndef XP_MACOSX #ifndef XP_MACOSX
// Some extensions may rely on these being present so only hide the about // Some extensions may rely on these being present so only hide the about
// separator when there are no elements besides the check for updates menuitem // separator when there are no elements besides the check for updates menuitem
// in between the about separator and the updates separator. // in between the about separator and the updates separator.
var updatesSeparator = document.getElementById("updatesSeparator"); var updatesSeparator = document.getElementById("updatesSeparator");
var aboutSeparator = document.getElementById("aboutSeparator"); var aboutSeparator = document.getElementById("aboutSeparator");
var checkForUpdates = document.getElementById("checkForUpdates"); var checkForUpdates = document.getElementById("checkForUpdates");
if (updatesSeparator.nextSibling === checkForUpdates && if (updatesSeparator.nextSibling === checkForUpdates &&
skipping to change at line 674 skipping to change at line 692
#elifdef XP_MACOSX #elifdef XP_MACOSX
var features = "chrome,resizable=no,minimizable=no"; var features = "chrome,resizable=no,minimizable=no";
#else #else
var features = "chrome,centerscreen,dependent,dialog=no"; var features = "chrome,centerscreen,dependent,dialog=no";
#endif #endif
window.openDialog("chrome://browser/content/aboutDialog.xul", "", features); window.openDialog("chrome://browser/content/aboutDialog.xul", "", features);
} }
function openPreferences(paneID, extraArgs) function openPreferences(paneID, extraArgs)
{ {
var instantApply = getBoolPref("browser.preferences.instantApply", false); var instantApply = Services.prefs.getBoolPref("browser.preferences.instantAppl y", false);
var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dial og=no" : ",modal"); var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dial og=no" : ",modal");
var win = Services.wm.getMostRecentWindow("Browser:Preferences"); var win = Services.wm.getMostRecentWindow("Browser:Preferences");
if (win) { if (win) {
win.focus(); win.focus();
if (paneID) { if (paneID) {
var pane = win.document.getElementById(paneID); var pane = win.document.getElementById(paneID);
win.document.documentElement.showPane(pane); win.document.documentElement.showPane(pane);
} }
skipping to change at line 703 skipping to change at line 721
return openDialog("chrome://browser/content/preferences/preferences.xul", return openDialog("chrome://browser/content/preferences/preferences.xul",
"Preferences", features, paneID, extraArgs); "Preferences", features, paneID, extraArgs);
} }
function openAdvancedPreferences(tabID) function openAdvancedPreferences(tabID)
{ {
openPreferences("paneAdvanced", { "advancedTab" : tabID }); openPreferences("paneAdvanced", { "advancedTab" : tabID });
} }
/** /**
* Opens the release notes page for this version of the application.
*/
function openReleaseNotes()
{
var relnotesURL = Components.classes["@mozilla.org/toolkit/URLFormatterService
;1"]
.getService(Components.interfaces.nsIURLFormatter)
.formatURLPref("app.releaseNotesURL");
openUILinkIn(relnotesURL, "tab");
}
/**
* Opens the troubleshooting information (about:support) page for this version * Opens the troubleshooting information (about:support) page for this version
* of the application. * of the application.
*/ */
function openTroubleshootingPage() function openTroubleshootingPage()
{ {
openUILinkIn("about:support", "tab"); openUILinkIn("about:support", "tab");
} }
/** /**
* Opens the feedback page for this version of the application. * Opens the feedback page for this version of the application.
skipping to change at line 854 skipping to change at line 884
.formatURLPref("app.support.baseURL"); .formatURLPref("app.support.baseURL");
url += aHelpTopic; url += aHelpTopic;
var where = aCalledFromModal ? "window" : "tab"; var where = aCalledFromModal ? "window" : "tab";
openUILinkIn(url, where); openUILinkIn(url, where);
} }
function openPrefsHelp() { function openPrefsHelp() {
// non-instant apply prefwindows are usually modal, so we can't open in the to pmost window, // non-instant apply prefwindows are usually modal, so we can't open in the to pmost window,
// since its probably behind the window. // since its probably behind the window.
var instantApply = getBoolPref("browser.preferences.instantApply"); var instantApply = Services.prefs.getBoolPref("browser.preferences.instantAppl y");
var helpTopic = document.getElementsByTagName("prefwindow")[0].currentPane.hel pTopic; var helpTopic = document.getElementsByTagName("prefwindow")[0].currentPane.hel pTopic;
openHelpLink(helpTopic, !instantApply); openHelpLink(helpTopic, !instantApply);
} }
function trimURL(aURL) { function trimURL(aURL) {
// This function must not modify the given URL such that calling // This function must not modify the given URL such that calling
// nsIURIFixup::createFixupURI with the result will produce a different URI. // nsIURIFixup::createFixupURI with the result will produce a different URI.
return aURL /* remove single trailing slash for http/https/ftp URLs */ return aURL /* remove single trailing slash for http/https/ftp URLs */
.replace(/^((?:http|https|ftp):\/\/[^/]+)\/$/, "$1") .replace(/^((?:http|https|ftp):\/\/[^/]+)\/$/, "$1")
 End of changes. 18 change blocks. 
24 lines changed or deleted 57 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)