[Pale-Moon] Issue #1737 - Part 8: Phase 1 proofread + adjust for updated code style

This commit is contained in:
Pale Moon 2020-04-17 17:33:28 +02:00 • committed by Roy Tam
commit 054a3fb4a5
21 changed files with 221 additions and 292 deletions

View file

@ -268,8 +268,7 @@ var FullScreen = {
let host = null; let host = null;
try { try {
host = uri.host; host = uri.host;
} catch(e) { } catch(e) {}
}
let hostLabel = document.getElementById("full-screen-domain-text"); let hostLabel = document.getElementById("full-screen-domain-text");
if (host) { if (host) {
// Document's principal's URI has a host. Display a warning including the hostname. // Document's principal's URI has a host. Display a warning including the hostname.

View file

@ -296,8 +296,7 @@ var gGestureSupport = {
let command; let command;
try { try {
command = this._getPref(aGesture.concat(subCombo).join(".")); command = this._getPref(aGesture.concat(subCombo).join("."));
} catch(e) { } catch(e) {}
}
if (command) { if (command) {
return command; return command;

View file

@ -125,8 +125,7 @@ var browserMenuDragging = {
if (!!parentPopup.openNode) { if (!!parentPopup.openNode) {
try { try {
parentPopup.openNode.hidePopup(); parentPopup.openNode.hidePopup();
} catch(e) { } catch(e) {}
}
} }
parentPopup.openNode = menupopup; parentPopup.openNode = menupopup;
@ -318,8 +317,7 @@ var browserMenuDragging = {
default: default:
return xpPref.setBoolPref(aPrefString, aValue); break; return xpPref.setBoolPref(aPrefString, aValue); break;
} }
} catch(e) { } catch(e) {}
}
return null; return null;
}, },
@ -328,8 +326,7 @@ var browserMenuDragging = {
var pbi = Components.classes["@mozilla.org/preferences;1"]. var pbi = Components.classes["@mozilla.org/preferences;1"].
getService(Components.interfaces.nsIPrefBranch2); getService(Components.interfaces.nsIPrefBranch2);
pbi.addObserver(aObserver.domain, aObserver, false); pbi.addObserver(aObserver.domain, aObserver, false);
} catch(e) { } catch(e) {}
}
}, },
removePrefListener: function(aObserver) { removePrefListener: function(aObserver) {
@ -337,8 +334,7 @@ var browserMenuDragging = {
var pbi = Components.classes["@mozilla.org/preferences;1"]. var pbi = Components.classes["@mozilla.org/preferences;1"].
getService(Components.interfaces.nsIPrefBranch2); getService(Components.interfaces.nsIPrefBranch2);
pbi.removeObserver(aObserver.domain, aObserver); pbi.removeObserver(aObserver.domain, aObserver);
} catch(e) { } catch(e) {}
}
}, },
PrefListener:{ PrefListener:{

View file

@ -299,8 +299,7 @@ var PlacesCommandHook = {
title = title || url.spec; title = title || url.spec;
description = PlacesUIUtils.getDescriptionFromDocument(webNav.document); description = PlacesUIUtils.getDescriptionFromDocument(webNav.document);
charset = webNav.document.characterSet; charset = webNav.document.characterSet;
} catch(e) { } catch(e) {}
}
if (aShowEditUI) { if (aShowEditUI) {
// If we bookmark the page here (i.e. page was not "starred" already) // If we bookmark the page here (i.e. page was not "starred" already)

View file

@ -725,8 +725,7 @@ var allTabs = {
let tabstring = tab.linkedBrowser.currentURI.spec; let tabstring = tab.linkedBrowser.currentURI.spec;
try { try {
tabstring = decodeURI(tabstring); tabstring = decodeURI(tabstring);
} catch (e) { } catch(e) {}
}
tabstring = tab.label + " " + tab.label.toLocaleLowerCase() + " " + tabstring; tabstring = tab.label + " " + tab.label.toLocaleLowerCase() + " " + tabstring;
for (let i = 0; i < filter.length; i++) { for (let i = 0; i < filter.length; i++) {
matches += tabstring.includes(filter[i]); matches += tabstring.includes(filter[i]);

View file

@ -39,8 +39,7 @@ var gBrowserThumbnails = {
try { try {
if (Services.prefs.getBoolPref("browser.pagethumbnails.capturing_disabled")) if (Services.prefs.getBoolPref("browser.pagethumbnails.capturing_disabled"))
return; return;
} catch (e) { } catch(e) {}
}
PageThumbs.addExpirationFilter(this); PageThumbs.addExpirationFilter(this);
gBrowser.addTabsProgressListener(this); gBrowser.addTabsProgressListener(this);

View file

@ -181,9 +181,10 @@ function pageShowEventHandlers(persisted) {
// The PluginClickToPlay events are not fired when navigating using the // The PluginClickToPlay events are not fired when navigating using the
// BF cache. |persisted| is true when the page is loaded from the // BF cache. |persisted| is true when the page is loaded from the
// BF cache, so this code reshows the notification if necessary. // BF cache, so this code reshows the notification if necessary.
if (persisted) if (persisted) {
gPluginHandler.reshowClickToPlayNotification(); gPluginHandler.reshowClickToPlayNotification();
} }
}
function UpdateBackForwardCommands(aWebNavigation) { function UpdateBackForwardCommands(aWebNavigation) {
var backBroadcaster = document.getElementById("Browser:Back"); var backBroadcaster = document.getElementById("Browser:Back");
@ -673,8 +674,7 @@ var gPopupBlockerObserver = {
var host = ""; var host = "";
try { try {
host = gBrowser.currentURI.host; host = gBrowser.currentURI.host;
} catch(e) { } catch(e) {}
}
var bundlePreferences = document.getElementById("bundle_preferences"); var bundlePreferences = document.getElementById("bundle_preferences");
var params = { blockVisible : false, var params = { blockVisible : false,
@ -1041,8 +1041,7 @@ var gBrowserInit = {
// so that we don't disrupt startup // so that we don't disrupt startup
try { try {
gBrowser.loadTabs(specs, false, true); gBrowser.loadTabs(specs, false, true);
} catch(e) { } catch(e) {}
}
} else if (uriToLoad instanceof XULElement) { } else if (uriToLoad instanceof XULElement) {
// swap the given tab with the default about:blank tab and then close // swap the given tab with the default about:blank tab and then close
// the original tab in the other window. // the original tab in the other window.
@ -1372,8 +1371,7 @@ var gBrowserInit = {
try { try {
gBrowser.removeProgressListener(window.XULBrowserWindow); gBrowser.removeProgressListener(window.XULBrowserWindow);
gBrowser.removeTabsProgressListener(window.TabsProgressListener); gBrowser.removeTabsProgressListener(window.TabsProgressListener);
} catch (ex) { } catch(ex) {}
}
BookmarkingUI.uninit(); BookmarkingUI.uninit();
@ -1507,8 +1505,7 @@ var gBrowserInit = {
let dockSupport = Cc["@mozilla.org/widget/macdocksupport;1"] let dockSupport = Cc["@mozilla.org/widget/macdocksupport;1"]
.getService(Ci.nsIMacDockSupport); .getService(Ci.nsIMacDockSupport);
dockSupport.dockMenu = nativeMenu; dockSupport.dockMenu = nativeMenu;
} catch (e) { } catch(e) {}
}
} }
} }
@ -1692,8 +1689,7 @@ function BrowserForward(aEvent) {
if (where == "current") { if (where == "current") {
try { try {
gBrowser.goForward(); gBrowser.goForward();
} catch(ex) { } catch(ex) {}
}
} else { } else {
duplicateTabIn(gBrowser.selectedTab, where, 1); duplicateTabIn(gBrowser.selectedTab, where, 1);
} }
@ -1705,8 +1701,7 @@ function BrowserBack(aEvent) {
if (where == "current") { if (where == "current") {
try { try {
gBrowser.goBack(); gBrowser.goBack();
} catch(ex) { } catch(ex) {}
}
} else { } else {
duplicateTabIn(gBrowser.selectedTab, where, -1); duplicateTabIn(gBrowser.selectedTab, where, -1);
} }
@ -1817,8 +1812,7 @@ function loadOneOrMoreURIs(aURIString) {
// so that we don't disrupt startup // so that we don't disrupt startup
try { try {
gBrowser.loadTabs(aURIString.split("|"), false, true); gBrowser.loadTabs(aURIString.split("|"), false, true);
} catch(e) { } catch(e) {}
}
} }
function focusAndSelectUrlBar() { function focusAndSelectUrlBar() {
@ -1901,8 +1895,7 @@ var gLastOpenDirectory = {
Ci.nsILocalFile); Ci.nsILocalFile);
if (!this._lastDir.exists()) if (!this._lastDir.exists())
this._lastDir = null; this._lastDir = null;
} catch(e) { } catch(e) {}
}
} }
return this._lastDir; return this._lastDir;
}, },
@ -1939,8 +1932,7 @@ function BrowserOpenFileWindow() {
gLastOpenDirectory.path = gLastOpenDirectory.path =
fp.file.parent.QueryInterface(Ci.nsILocalFile); fp.file.parent.QueryInterface(Ci.nsILocalFile);
} }
} catch (ex) { } catch(ex) {}
}
openUILinkIn(fp.fileURL.spec, "current"); openUILinkIn(fp.fileURL.spec, "current");
} }
}; };
@ -1952,8 +1944,7 @@ function BrowserOpenFileWindow() {
nsIFilePicker.filterHTML); nsIFilePicker.filterHTML);
fp.displayDirectory = gLastOpenDirectory.path; fp.displayDirectory = gLastOpenDirectory.path;
fp.open(fpCallback); fp.open(fpCallback);
} catch (ex) { } catch(ex) {}
}
} }
function BrowserCloseTabOrWindow() { function BrowserCloseTabOrWindow() {
@ -1998,8 +1989,7 @@ function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy,
originPrincipal: originPrincipal, originPrincipal: originPrincipal,
triggeringPrincipal: triggeringPrincipal, triggeringPrincipal: triggeringPrincipal,
forceAboutBlankViewerInCurrent: forceAboutBlankViewerInCurrent }); forceAboutBlankViewerInCurrent: forceAboutBlankViewerInCurrent });
} catch (e) { } catch(e) {}
}
} }
/** /**
@ -2069,8 +2059,7 @@ function getShortcutOrURIAndPostData(url, callback = null) {
try { try {
// makeURI() throws if URI is invalid. // makeURI() throws if URI is invalid.
uri = makeURI(shortcutURL); uri = makeURI(shortcutURL);
} catch (ex) { } catch(ex) {}
}
if (uri) { if (uri) {
// Try to get the saved character-set. // Try to get the saved character-set.
@ -2177,8 +2166,7 @@ function readFromClipboard()
data = data.value.QueryInterface(Components.interfaces.nsISupportsString); data = data.value.QueryInterface(Components.interfaces.nsISupportsString);
url = data.data.substring(0, dataLen.value / 2); url = data.data.substring(0, dataLen.value / 2);
} }
} catch (ex) { } catch(ex) {}
}
return url; return url;
} }
@ -2255,8 +2243,7 @@ function URLBarSetURI(aURI) {
// Strip off "wyciwyg://" and passwords for the location bar // Strip off "wyciwyg://" and passwords for the location bar
try { try {
uri = Services.uriFixup.createExposableURI(uri); uri = Services.uriFixup.createExposableURI(uri);
} catch (e) { } catch(e) {}
}
// Replace initial page URIs with an empty string // Replace initial page URIs with an empty string
// only if there's no opener (bug 370555). // only if there's no opener (bug 370555).
@ -2306,8 +2293,7 @@ function losslessDecodeURI(aURI) {
// by the location bar (bug 410726). // by the location bar (bug 410726).
.replace(/%(?!3B|2F|3F|3A|40|26|3D|2B|24|2C|23)|[\r\n\t]/ig, .replace(/%(?!3B|2F|3F|3A|40|26|3D|2B|24|2C|23)|[\r\n\t]/ig,
encodeURIComponent); encodeURIComponent);
} catch (e) { } catch(e) {}
}
} }
} }
@ -2692,13 +2678,11 @@ function BrowserReloadWithFlags(reloadFlags) {
var sh = webNav.sessionHistory; var sh = webNav.sessionHistory;
if (sh) if (sh)
webNav = sh.QueryInterface(nsIWebNavigation); webNav = sh.QueryInterface(nsIWebNavigation);
} catch(e) { } catch(e) {}
}
try { try {
webNav.reload(reloadFlags); webNav.reload(reloadFlags);
} catch(e) { } catch(e) {}
}
} }
var PrintPreviewListener = { var PrintPreviewListener = {
@ -2887,17 +2871,16 @@ var bookmarksButtonObserver = {
let name = {}; let name = {};
let url = browserDragAndDrop.drop(aEvent, name); let url = browserDragAndDrop.drop(aEvent, name);
try { try {
PlacesUIUtils.showBookmarkDialog({ action: "add" PlacesUIUtils.showBookmarkDialog({ action: "add",
, type: "bookmark" type: "bookmark",
, uri: makeURI(url) uri: makeURI(url),
, title: name title: name,
, hiddenRows: [ "description" hiddenRows: [ "description",
, "location" "location",
, "loadInSidebar" "loadInSidebar",
, "keyword" ] "keyword" ]
}, window); }, window);
} catch(ex) { } catch(ex) {}
}
}, },
onDragOver: function(aEvent) { onDragOver: function(aEvent) {
@ -2914,8 +2897,7 @@ var newTabButtonObserver = {
browserDragAndDrop.dragOver(aEvent); browserDragAndDrop.dragOver(aEvent);
}, },
onDragExit: function(aEvent) { onDragExit: function(aEvent) {},
},
onDrop: function(aEvent) { onDrop: function(aEvent) {
let links = browserDragAndDrop.dropLinks(aEvent); let links = browserDragAndDrop.dropLinks(aEvent);
@ -2936,8 +2918,7 @@ var newWindowButtonObserver = {
browserDragAndDrop.dragOver(aEvent); browserDragAndDrop.dragOver(aEvent);
}, },
onDragExit: function(aEvent) { onDragExit: function(aEvent) {},
},
onDrop: function(aEvent) { onDrop: function(aEvent) {
let links = browserDragAndDrop.dropLinks(aEvent); let links = browserDragAndDrop.dropLinks(aEvent);
@ -3495,9 +3476,10 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
// Hacky: update the PopupNotifications' object's reference to the iconBox, // Hacky: update the PopupNotifications' object's reference to the iconBox,
// if it already exists, since it may have changed if the URL bar was // if it already exists, since it may have changed if the URL bar was
// added/removed. // added/removed.
if (!window.__lookupGetter__("PopupNotifications")) if (!window.__lookupGetter__("PopupNotifications")) {
PopupNotifications.iconBox = document.getElementById("notification-popup-box"); PopupNotifications.iconBox = document.getElementById("notification-popup-box");
} }
}
PlacesToolbarHelper.customizeDone(); PlacesToolbarHelper.customizeDone();
BookmarkingUI.customizeDone(); BookmarkingUI.customizeDone();
@ -4119,8 +4101,7 @@ var XULBrowserWindow = {
"<" + contentHost + "> but cached host is <" + this._host + ">.\n" "<" + contentHost + "> but cached host is <" + this._host + ">.\n"
); );
} }
} catch (ex) { } catch(ex) {}
}
#endif #endif
return; return;
} }
@ -4608,9 +4589,10 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) {
// Empty the menu // Empty the menu
for (var i = popup.childNodes.length-1; i >= 0; --i) { for (var i = popup.childNodes.length-1; i >= 0; --i) {
var deadItem = popup.childNodes[i]; var deadItem = popup.childNodes[i];
if (deadItem.hasAttribute("toolbarId")) if (deadItem.hasAttribute("toolbarId")) {
popup.removeChild(deadItem); popup.removeChild(deadItem);
} }
}
var firstMenuItem = aInsertPoint || popup.firstChild; var firstMenuItem = aInsertPoint || popup.firstChild;
@ -4729,8 +4711,9 @@ var AudioIndicator = {
}, },
observe: function(subject, topic, data) { observe: function(subject, topic, data) {
if (topic == "nsPref:changed") if (topic == "nsPref:changed") {
this.syncUI(); this.syncUI();
}
}, },
_prefName: "browser.tabs.showAudioPlayingIcon" _prefName: "browser.tabs.showAudioPlayingIcon"
@ -4774,8 +4757,9 @@ var TabsOnTop = {
}, },
observe: function(subject, topic, data) { observe: function(subject, topic, data) {
if (topic == "nsPref:changed") if (topic == "nsPref:changed") {
this.syncUI(); this.syncUI();
}
}, },
_prefName: "browser.tabs.onTop" _prefName: "browser.tabs.onTop"
@ -5086,8 +5070,7 @@ var gHomeButton = {
try { try {
url = gPrefService.getComplexValue(this.prefDomain, url = gPrefService.getComplexValue(this.prefDomain,
Components.interfaces.nsIPrefLocalizedString).data; Components.interfaces.nsIPrefLocalizedString).data;
} catch(e) { } catch(e) {}
}
// use this if we can't find the pref // use this if we can't find the pref
if (!url) { if (!url) {
@ -5551,8 +5534,7 @@ function UpdateCharsetDetector(target) {
try { try {
prefvalue = gPrefService.getComplexValue("intl.charset.detector", Ci.nsIPrefLocalizedString).data; prefvalue = gPrefService.getComplexValue("intl.charset.detector", Ci.nsIPrefLocalizedString).data;
} catch (ex) { } catch(ex) {}
}
if (!prefvalue) { if (!prefvalue) {
prefvalue = "off"; prefvalue = "off";
@ -5760,8 +5742,7 @@ var BrowserOffline = {
if (cancelGoOffline.data) { if (cancelGoOffline.data) {
return false; return false;
} }
} catch (ex) { } catch(ex) {}
}
return true; return true;
}, },
@ -6420,12 +6401,13 @@ function AddKeywordForSearchField() {
formData.push(escapeNameValuePair(el.name, el.value, isURLEncoded)); formData.push(escapeNameValuePair(el.name, el.value, isURLEncoded));
} else if (el instanceof HTMLSelectElement && el.selectedIndex >= 0) { } else if (el instanceof HTMLSelectElement && el.selectedIndex >= 0) {
for (var j=0; j < el.options.length; j++) { for (var j=0; j < el.options.length; j++) {
if (el.options[j].selected) if (el.options[j].selected) {
formData.push(escapeNameValuePair(el.name, el.options[j].value, formData.push(escapeNameValuePair(el.name, el.options[j].value,
isURLEncoded)); isURLEncoded));
} }
} }
} }
}
var postData; var postData;

View file

@ -67,8 +67,7 @@ var handleContentContextMenu = function (event) {
let plugin = null; let plugin = null;
try { try {
plugin = event.target.QueryInterface(Ci.nsIObjectLoadingContent); plugin = event.target.QueryInterface(Ci.nsIObjectLoadingContent);
} catch(e) { } catch(e) {}
}
if (plugin && plugin.displayedType == Ci.nsIObjectLoadingContent.TYPE_PLUGIN) { if (plugin && plugin.displayedType == Ci.nsIObjectLoadingContent.TYPE_PLUGIN) {
// Don't open a context menu for plugins. // Don't open a context menu for plugins.
return; return;
@ -130,15 +129,12 @@ var handleContentContextMenu = function (event) {
imageCache.findEntryProperties(event.target.currentURI, doc); imageCache.findEntryProperties(event.target.currentURI, doc);
try { try {
contentType = props.get("type", Ci.nsISupportsCString).data; contentType = props.get("type", Ci.nsISupportsCString).data;
} catch(e) { } catch(e) {}
}
try { try {
contentDisposition = contentDisposition =
props.get("content-disposition", Ci.nsISupportsCString).data; props.get("content-disposition", Ci.nsISupportsCString).data;
} catch(e) { } catch(e) {}
} } catch(e) {}
} catch(e) {
}
} }
let selectionInfo = BrowserUtils.getSelectionDetails(content); let selectionInfo = BrowserUtils.getSelectionDetails(content);

View file

@ -30,8 +30,7 @@ nsContextMenu.prototype = {
this.ellipsis = "\u2026"; this.ellipsis = "\u2026";
try { try {
this.ellipsis = gPrefService.getComplexValue("intl.ellipsis", Ci.nsIPrefLocalizedString).data; this.ellipsis = gPrefService.getComplexValue("intl.ellipsis", Ci.nsIPrefLocalizedString).data;
} catch(e) { } catch(e) {}
}
this.isContentSelected = this.isContentSelection(); this.isContentSelected = this.isContentSelection();
this.onPlainTextLink = false; this.onPlainTextLink = false;
@ -87,16 +86,14 @@ nsContextMenu.prototype = {
if (/^(?:https?|ftp):/i.test(linkText)) { if (/^(?:https?|ftp):/i.test(linkText)) {
try { try {
uri = makeURI(linkText); uri = makeURI(linkText);
} catch(ex) { } catch(ex) {}
}
} else if (/^[-a-z\d\.]+\.[-a-z\d]{2,}[-_=~:#%&\?\w\/\.]*$/i.test(linkText)) { } else if (/^[-a-z\d\.]+\.[-a-z\d]{2,}[-_=~:#%&\?\w\/\.]*$/i.test(linkText)) {
// Check if this could be a valid url, just missing the protocol. // Check if this could be a valid url, just missing the protocol.
let uriFixup = Cc["@mozilla.org/docshell/urifixup;1"] let uriFixup = Cc["@mozilla.org/docshell/urifixup;1"]
.getService(Ci.nsIURIFixup); .getService(Ci.nsIURIFixup);
try { try {
uri = uriFixup.createFixupURI(linkText, uriFixup.FIXUP_FLAG_NONE); uri = uriFixup.createFixupURI(linkText, uriFixup.FIXUP_FLAG_NONE);
} catch(ex) { } catch(ex) {}
}
} }
if (uri && uri.host) { if (uri && uri.host) {
@ -613,8 +610,7 @@ nsContextMenu.prototype = {
// this.principal.checkMayLoad(this.linkURI, false, true); // this.principal.checkMayLoad(this.linkURI, false, true);
this.linkDownload = elem.download; this.linkDownload = elem.download;
} }
} catch(ex) { } catch(ex) {}
}
} }
// Background image? Don't bother if we've already found a // Background image? Don't bother if we've already found a
@ -917,8 +913,7 @@ nsContextMenu.prototype = {
let url = uri.QueryInterface(Ci.nsIURL); let url = uri.QueryInterface(Ci.nsIURL);
if (url.fileBaseName) if (url.fileBaseName)
name = decodeURI(url.fileBaseName) + ".jpg"; name = decodeURI(url.fileBaseName) + ".jpg";
} catch (e) { } catch(e) {}
}
if (!name) { if (!name) {
name = "snapshot.jpg"; name = "snapshot.jpg";
} }
@ -1059,8 +1054,7 @@ nsContextMenu.prototype = {
const promptSvc = Cc["@mozilla.org/embedcomp/prompt-service;1"]. const promptSvc = Cc["@mozilla.org/embedcomp/prompt-service;1"].
getService(Ci.nsIPromptService); getService(Ci.nsIPromptService);
promptSvc.alert(doc.defaultView, title, msg); promptSvc.alert(doc.defaultView, title, msg);
} catch (ex) { } catch(ex) {}
}
return; return;
} }
@ -1468,15 +1462,13 @@ nsContextMenu.prototype = {
try { try {
locale = gPrefService.getComplexValue("intl.accept_languages", locale = gPrefService.getComplexValue("intl.accept_languages",
Ci.nsIPrefLocalizedString).data; Ci.nsIPrefLocalizedString).data;
} catch(e) { } catch(e) {}
}
var version = "-"; var version = "-";
try { try {
version = Cc["@mozilla.org/xre/app-info;1"]. version = Cc["@mozilla.org/xre/app-info;1"].
getService(Ci.nsIXULAppInfo).version; getService(Ci.nsIXULAppInfo).version;
} catch(e) { } catch(e) {}
}
uri = uri.replace(/%LOCALE%/, escape(locale)).replace(/%VERSION%/, version); uri = uri.replace(/%LOCALE%/, escape(locale)).replace(/%VERSION%/, version);

View file

@ -37,8 +37,7 @@ function onLoad() {
if (useAutoFill) { if (useAutoFill) {
dialog.input.setAttribute("completedefaultindex", "true"); dialog.input.setAttribute("completedefaultindex", "true");
} }
} catch(ex) { } catch(ex) {}
}
try { try {
var value = pref.getIntPref("general.open_location.last_window_choice"); var value = pref.getIntPref("general.open_location.last_window_choice");
@ -47,8 +46,7 @@ function onLoad() {
dialog.openWhereList.selectedItem = element; dialog.openWhereList.selectedItem = element;
} }
dialog.input.value = gOpenLocationLastURL.value; dialog.input.value = gOpenLocationLastURL.value;
} catch(ex) { } catch(ex) {}
}
if (dialog.input.value) { if (dialog.input.value) {
// XXX should probably be done automatically // XXX should probably be done automatically
@ -109,8 +107,7 @@ function openLocation(openData) {
browser.delayedOpenTab(openData.url, null, null, openData.postData, true); browser.delayedOpenTab(openData.url, null, null, openData.postData, true);
break; break;
} }
} catch(ex) { } catch(ex) {}
}
if (pref) { if (pref) {
gOpenLocationLastURL.value = dialog.input.value; gOpenLocationLastURL.value = dialog.input.value;
@ -147,6 +144,5 @@ function onChooseFile()
nsIFilePicker.filterImages | nsIFilePicker.filterXML | nsIFilePicker.filterImages | nsIFilePicker.filterXML |
nsIFilePicker.filterHTML); nsIFilePicker.filterHTML);
fp.open(fpCallback); fp.open(fpCallback);
} catch(ex) { } catch(ex) {}
}
} }

View file

@ -67,8 +67,7 @@ var padlock_PadLock =
// do not warn when using local protocols // do not warn when using local protocols
is_insecure = false; is_insecure = false;
} }
} catch(ex) { } catch(ex) {}
}
let ub = document.getElementById("urlbar"); let ub = document.getElementById("urlbar");
if (ub) { if (ub) {
@ -84,8 +83,7 @@ var padlock_PadLock =
padlock_PadLock.setPadlockLevel("padlock-ib", level); padlock_PadLock.setPadlockLevel("padlock-ib", level);
padlock_PadLock.setPadlockLevel("padlock-ib-left", level); padlock_PadLock.setPadlockLevel("padlock-ib-left", level);
padlock_PadLock.setPadlockLevel("padlock-ub-right", level); padlock_PadLock.setPadlockLevel("padlock-ub-right", level);
} catch(e) { } catch(e) {}
}
padlock_PadLock.setPadlockLevel("padlock-sb", level); padlock_PadLock.setPadlockLevel("padlock-sb", level);
padlock_PadLock.setPadlockLevel("padlock-tab", level); padlock_PadLock.setPadlockLevel("padlock-tab", level);
@ -203,8 +201,7 @@ var padlock_PadLock =
try { try {
// XXX should probably be done automatically // XXX should probably be done automatically
document.getElementById("urlbar").setAttribute("https_color", colshow); document.getElementById("urlbar").setAttribute("https_color", colshow);
} catch(e) { } catch(e) {}
}
var lockenabled = padlock_PadLock.prefbranch.getBoolPref("shown"); var lockenabled = padlock_PadLock.prefbranch.getBoolPref("shown");
var padshow = ""; var padshow = "";
@ -216,8 +213,7 @@ var padlock_PadLock =
document.getElementById("padlock-ib").setAttribute("padshow", padshow); document.getElementById("padlock-ib").setAttribute("padshow", padshow);
document.getElementById("padlock-ib-left").setAttribute("padshow", padshow); document.getElementById("padlock-ib-left").setAttribute("padshow", padshow);
document.getElementById("padlock-ub-right").setAttribute("padshow", padshow); document.getElementById("padlock-ub-right").setAttribute("padshow", padshow);
} catch(e) { } catch(e) {}
}
document.getElementById("padlock-sb").setAttribute("padshow", padshow); document.getElementById("padlock-sb").setAttribute("padshow", padshow);
document.getElementById("padlock-tab").setAttribute("padshow", padshow); document.getElementById("padlock-tab").setAttribute("padshow", padshow);
@ -226,8 +222,7 @@ var padlock_PadLock =
document.getElementById("padlock-ib").setAttribute("padstyle", padstyle); document.getElementById("padlock-ib").setAttribute("padstyle", padstyle);
document.getElementById("padlock-ib-left").setAttribute("padstyle", padstyle); document.getElementById("padlock-ib-left").setAttribute("padstyle", padstyle);
document.getElementById("padlock-ub-right").setAttribute("padstyle", padstyle); document.getElementById("padlock-ub-right").setAttribute("padstyle", padstyle);
} catch(e) { } catch(e) {}
}
document.getElementById("padlock-sb").setAttribute("padstyle", padstyle); document.getElementById("padlock-sb").setAttribute("padstyle", padstyle);
document.getElementById("padlock-tab").setAttribute("padstyle", padstyle); document.getElementById("padlock-tab").setAttribute("padstyle", padstyle);

View file

@ -102,8 +102,7 @@ function onOK() {
// disableAddons will asynchronously restart the application // disableAddons will asynchronously restart the application
return false; return false;
} }
} catch(e) { } catch(e) {}
}
restartApp(); restartApp();
return false; return false;

View file

@ -119,15 +119,13 @@ Sanitizer.prototype = {
// Cache doesn't consult timespan, nor does it have the // Cache doesn't consult timespan, nor does it have the
// facility for timespan-based eviction. Wipe it. // facility for timespan-based eviction. Wipe it.
cache.clear(); cache.clear();
} catch(er) { } catch(er) {}
}
var imageCache = Cc["@mozilla.org/image/tools;1"]. var imageCache = Cc["@mozilla.org/image/tools;1"].
getService(Ci.imgITools).getImgCacheForDocument(null); getService(Ci.imgITools).getImgCacheForDocument(null);
try { try {
imageCache.clearCache(false); // true=chrome, false=content imageCache.clearCache(false); // true=chrome, false=content
} catch(er) { } catch(er) {}
}
}, },
get canClear() { get canClear() {
@ -224,16 +222,14 @@ Sanitizer.prototype = {
var os = Components.classes["@mozilla.org/observer-service;1"] var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService); .getService(Components.interfaces.nsIObserverService);
os.notifyObservers(null, "browser:purge-session-history", ""); os.notifyObservers(null, "browser:purge-session-history", "");
} catch(e) { } catch(e) {}
}
// Clear last URL of the Open Web Location dialog // Clear last URL of the Open Web Location dialog
var prefs = Components.classes["@mozilla.org/preferences-service;1"] var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch); .getService(Components.interfaces.nsIPrefBranch);
try { try {
prefs.clearUserPref("general.open_location.last_url"); prefs.clearUserPref("general.open_location.last_url");
} catch(e) { } catch(e) {}
}
}, },
get canClear() get canClear()

View file

@ -164,8 +164,7 @@ var gSanitizePromptDialog = {
try { try {
document.documentElement.getButton("accept").disabled = !found; document.documentElement.getButton("accept").disabled = !found;
} catch(e) { } catch(e) {}
}
// Update the warning prompt if needed // Update the warning prompt if needed
this.prepareWarning(true); this.prepareWarning(true);

View file

@ -344,8 +344,7 @@ function openLinkIn(url, where, params) {
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) {
@ -542,8 +541,7 @@ function isBidiEnabled() {
rv = true; rv = true;
Services.prefs.setBoolPref("bidi.browser.ui", true); Services.prefs.setBoolPref("bidi.browser.ui", true);
} }
} catch (e) { } catch(e) {}
}
return rv; return rv;
} }
@ -863,8 +861,7 @@ function isValidFeed(aLink, aPrincipal, aIsFeed) {
urlSecurityCheck(aLink.href, aPrincipal, urlSecurityCheck(aLink.href, aPrincipal,
Components.interfaces.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL); Components.interfaces.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
return type || "application/rss+xml"; return type || "application/rss+xml";
} catch(ex) { } catch(ex) {}
}
} }
return null; return null;

View file

@ -570,8 +570,7 @@ nsBrowserContentHandler.prototype = {
break; break;
} }
} }
} catch(ex) { } catch(ex) {}
}
// formatURLPref might return "about:blank" if getting the pref fails // formatURLPref might return "about:blank" if getting the pref fails
if (overridePage == "about:blank") { if (overridePage == "about:blank") {
@ -623,8 +622,7 @@ nsBrowserContentHandler.prototype = {
if (height) { if (height) {
this.mFeatures += ",height=" + height; this.mFeatures += ",height=" + height;
} }
} catch(e) { } catch(e) {}
}
// The global PB Service consumes this flag, so only eat it in per-window // The global PB Service consumes this flag, so only eat it in per-window
// PB builds. // PB builds.
@ -780,8 +778,7 @@ nsDefaultCommandLineHandler.prototype = {
try { try {
handURIToExistingBrowser(urilist[0], nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW, cmdLine); handURIToExistingBrowser(urilist[0], nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW, cmdLine);
return; return;
} catch(e) { } catch(e) {}
}
} }
var URLlist = urilist.filter(shouldLoadURI).map(function(u) u.spec); var URLlist = urilist.filter(shouldLoadURI).map(function(u) u.spec);

View file

@ -475,8 +475,7 @@ BrowserGlue.prototype = {
try { try {
averageTime = Services.prefs.getIntPref("browser.slowStartup.averageTime"); averageTime = Services.prefs.getIntPref("browser.slowStartup.averageTime");
samples = Services.prefs.getIntPref("browser.slowStartup.samples"); samples = Services.prefs.getIntPref("browser.slowStartup.samples");
} catch(e) { } catch(e) {}
}
averageTime = (averageTime * samples + currentTime) / ++samples; averageTime = (averageTime * samples + currentTime) / ++samples;
@ -655,8 +654,7 @@ BrowserGlue.prototype = {
// Windows 8 is version 6.2. // Windows 8 is version 6.2.
let version = Services.sysinfo.getProperty("version"); let version = Services.sysinfo.getProperty("version");
claimAllTypes = (parseFloat(version) < 6.2); claimAllTypes = (parseFloat(version) < 6.2);
} catch (ex) { } catch (ex) {}
}
#endif #endif
ShellService.setDefaultBrowser(claimAllTypes, false); ShellService.setDefaultBrowser(claimAllTypes, false);
} }
@ -962,8 +960,7 @@ BrowserGlue.prototype = {
Services.prefs.getBoolPref("browser.places.importBookmarksHTML"); Services.prefs.getBoolPref("browser.places.importBookmarksHTML");
if (importBookmarksHTML) if (importBookmarksHTML)
importBookmarks = true; importBookmarks = true;
} catch(ex) { } catch(ex) {}
}
Task.spawn(function() { Task.spawn(function() {
// Check if Safe Mode or the user has required to restore bookmarks from // Check if Safe Mode or the user has required to restore bookmarks from
@ -977,8 +974,7 @@ BrowserGlue.prototype = {
yield this._backupBookmarks(); yield this._backupBookmarks();
importBookmarks = true; importBookmarks = true;
} }
} catch(ex) { } catch(ex) {}
}
// If the user did not require to restore default bookmarks, or import // If the user did not require to restore default bookmarks, or import
// from bookmarks.html, we will try to restore from JSON/JSONLZ4 // from bookmarks.html, we will try to restore from JSON/JSONLZ4
@ -1171,8 +1167,7 @@ BrowserGlue.prototype = {
let maxBackups = BOOKMARKS_BACKUP_MAX_BACKUPS; let maxBackups = BOOKMARKS_BACKUP_MAX_BACKUPS;
try { try {
maxBackups = Services.prefs.getIntPref("browser.bookmarks.max_backups"); maxBackups = Services.prefs.getIntPref("browser.bookmarks.max_backups");
} } catch(ex) {
catch(ex) {
// Use default. // Use default.
} }
@ -1225,8 +1220,7 @@ BrowserGlue.prototype = {
let currentUIVersion = 0; let currentUIVersion = 0;
try { try {
currentUIVersion = Services.prefs.getIntPref("browser.migration.version"); currentUIVersion = Services.prefs.getIntPref("browser.migration.version");
} catch(ex) { } catch(ex) {}
}
if (currentUIVersion >= UI_VERSION) { if (currentUIVersion >= UI_VERSION) {
return; return;
} }
@ -1432,8 +1426,7 @@ BrowserGlue.prototype = {
Services.prefs.clearUserPref("privacy.donottrackheader.value"); Services.prefs.clearUserPref("privacy.donottrackheader.value");
} }
} }
catch (ex) { catch (ex) {}
}
} }
#ifndef MOZ_JXR #ifndef MOZ_JXR
@ -1447,8 +1440,7 @@ BrowserGlue.prototype = {
} else if (ihaValue.includes("image/jxr")) { } else if (ihaValue.includes("image/jxr")) {
Services.prefs.clearUserPref(ihaPref); Services.prefs.clearUserPref(ihaPref);
} }
} } catch(ex) {}
catch (ex) {}
} }
#endif #endif
@ -1546,8 +1538,7 @@ BrowserGlue.prototype = {
var url = "about:permissions"; var url = "about:permissions";
try { try {
url = url + "?filter=" + aPrincipal.URI.host; url = url + "?filter=" + aPrincipal.URI.host;
} catch(e) { } catch(e) {}
}
win.openUILinkIn(url, "tab"); win.openUILinkIn(url, "tab");
}, },
@ -1555,8 +1546,7 @@ BrowserGlue.prototype = {
try { try {
return !!Cc["@mozilla.org/system-alerts-service;1"].getService( return !!Cc["@mozilla.org/system-alerts-service;1"].getService(
Ci.nsIAlertsService); Ci.nsIAlertsService);
} catch(e) { } catch(e) {}
}
return false; return false;
}, },
@ -1590,8 +1580,7 @@ BrowserGlue.prototype = {
if (!this._dataSource.HasAssertion(docResource, persistResource, aSource, true)) { if (!this._dataSource.HasAssertion(docResource, persistResource, aSource, true)) {
this._dataSource.Assert(docResource, persistResource, aSource, true); this._dataSource.Assert(docResource, persistResource, aSource, true);
} }
} } catch(ex) {}
catch(ex) {}
}, },
// ------------------------------ // ------------------------------