diff options
Diffstat (limited to 'browser/components')
17 files changed, 254 insertions, 185 deletions
diff --git a/browser/components/about/AboutRedirector.cpp b/browser/components/about/AboutRedirector.cpp index a09932d95..717ae9c48 100644 --- a/browser/components/about/AboutRedirector.cpp +++ b/browser/components/about/AboutRedirector.cpp @@ -35,75 +35,117 @@ struct RedirEntry { URI_SAFE_FOR_UNTRUSTED_CONTENT. */ static RedirEntry kRedirMap[] = { - { "blocked", "chrome://browser/content/blockedSite.xhtml", + { + "basilisk", "chrome://global/content/memoriam.xhtml", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "blocked", "chrome://browser/content/blockedSite.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::URI_CAN_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, - { "certerror", "chrome://browser/content/aboutNetError.xhtml", + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "certerror", "chrome://browser/content/aboutNetError.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::URI_CAN_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, - { "socialerror", "chrome://browser/content/aboutSocialError.xhtml", + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "socialerror", "chrome://browser/content/aboutSocialError.xhtml", nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, - { "providerdirectory", "chrome://browser/content/aboutProviderDirectory.xhtml", + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "providerdirectory", "chrome://browser/content/aboutProviderDirectory.xhtml", nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, - { "tabcrashed", "chrome://browser/content/aboutTabCrashed.xhtml", + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "tabcrashed", "chrome://browser/content/aboutTabCrashed.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, - { "feeds", "chrome://browser/content/feeds/subscribe.xhtml", + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "feeds", "chrome://browser/content/feeds/subscribe.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, - { "privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.xhtml", + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.xhtml", nsIAboutModule::URI_MUST_LOAD_IN_CHILD | - nsIAboutModule::ALLOW_SCRIPT }, - { "rights", - "chrome://global/content/aboutRights.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "rights", "chrome://global/content/aboutRights.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::MAKE_LINKABLE | - nsIAboutModule::ALLOW_SCRIPT }, - { "robots", "chrome://browser/content/aboutRobots.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "robots", "chrome://browser/content/aboutRobots.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | - nsIAboutModule::ALLOW_SCRIPT }, - { "searchreset", "chrome://browser/content/search/searchReset.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "searchreset", "chrome://browser/content/search/searchReset.xhtml", nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, - { "sessionrestore", "chrome://browser/content/aboutSessionRestore.xhtml", - nsIAboutModule::ALLOW_SCRIPT }, - { "welcomeback", "chrome://browser/content/aboutWelcomeBack.xhtml", - nsIAboutModule::ALLOW_SCRIPT }, - { "sync-tabs", "chrome://browser/content/sync/aboutSyncTabs.xul", - nsIAboutModule::ALLOW_SCRIPT }, - // Linkable because of indexeddb use (bug 1228118) + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "sessionrestore", "chrome://browser/content/aboutSessionRestore.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "welcomeback", "chrome://browser/content/aboutWelcomeBack.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "sync-tabs", "chrome://browser/content/sync/aboutSyncTabs.xul", + nsIAboutModule::ALLOW_SCRIPT + }, { "home", "chrome://browser/content/abouthome/aboutHome.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT | + // Linkable because of indexeddb use (bug 1228118) nsIAboutModule::MAKE_LINKABLE | nsIAboutModule::ENABLE_INDEXED_DB }, - // the newtab's actual URL will be determined when the channel is created - { "newtab", "about:blank", - nsIAboutModule::ALLOW_SCRIPT }, - { "preferences", "chrome://browser/content/preferences/in-content/preferences.xul", - nsIAboutModule::ALLOW_SCRIPT }, - { "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul", - nsIAboutModule::ALLOW_SCRIPT }, + { + // the newtab's actual URL will be determined when the channel is created + "newtab", "about:blank", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "preferences", "chrome://browser/content/preferences/in-content/preferences.xul", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul", + nsIAboutModule::ALLOW_SCRIPT + }, #ifdef MOZ_SERVICES_HEALTHREPORT - { "healthreport", "chrome://browser/content/abouthealthreport/abouthealth.xhtml", - nsIAboutModule::ALLOW_SCRIPT }, + { + "healthreport", "chrome://browser/content/abouthealthreport/abouthealth.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, #endif - { "accounts", "chrome://browser/content/aboutaccounts/aboutaccounts.xhtml", - nsIAboutModule::ALLOW_SCRIPT }, - { "reader", "chrome://global/content/reader/aboutReader.html", + { + "accounts", "chrome://browser/content/aboutaccounts/aboutaccounts.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "reader", "chrome://global/content/reader/aboutReader.html", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::URI_MUST_LOAD_IN_CHILD | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, }; static const int kRedirTotal = ArrayLength(kRedirMap); diff --git a/browser/components/build/nsModule.cpp b/browser/components/build/nsModule.cpp index f85d8812c..1fad0ce68 100644 --- a/browser/components/build/nsModule.cpp +++ b/browser/components/build/nsModule.cpp @@ -85,6 +85,7 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = { { NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID }, #endif { NS_FEEDSNIFFER_CONTRACTID, &kNS_FEEDSNIFFER_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "basilisk", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "socialerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, 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/browser/components/moz.build b/browser/components/moz.build index 0393b6e92..a49580200 100644 --- a/browser/components/moz.build +++ b/browser/components/moz.build @@ -37,11 +37,8 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'browsercompsbase' -EXTRA_PP_COMPONENTS += [ - 'BrowserComponents.manifest', -] - EXTRA_COMPONENTS += [ + 'BrowserComponents.manifest', 'nsBrowserContentHandler.js', 'nsBrowserGlue.js', ] diff --git a/browser/components/nsBrowserContentHandler.js b/browser/components/nsBrowserContentHandler.js index b366c3f81..74144fc1b 100644 --- a/browser/components/nsBrowserContentHandler.js +++ b/browser/components/nsBrowserContentHandler.js @@ -558,7 +558,7 @@ nsBrowserContentHandler.prototype = { if (overridePage && startPage && !willRestoreSession && !skipStartPage) return overridePage + "|" + startPage; - return overridePage || startPage || "about:blank"; + return overridePage || startPage || "about:blank" || "about:logopage"; }, get startPage() { diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index f97c173a0..448bb910d 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -70,15 +70,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-s ["webrtcUI", "resource:///modules/webrtcUI.jsm"], ].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource)); -if (AppConstants.MOZ_CRASHREPORTER) { - XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter", - "resource:///modules/ContentCrashHandlers.jsm"); - XPCOMUtils.defineLazyModuleGetter(this, "UnsubmittedCrashHandler", - "resource:///modules/ContentCrashHandlers.jsm"); - XPCOMUtils.defineLazyModuleGetter(this, "CrashSubmit", - "resource://gre/modules/CrashSubmit.jsm"); -} - XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() { return Services.strings.createBundle('chrome://branding/locale/brand.properties'); }); @@ -710,10 +701,6 @@ BrowserGlue.prototype = { } TabCrashHandler.init(); - if (AppConstants.MOZ_CRASHREPORTER) { - PluginCrashReporter.init(); - UnsubmittedCrashHandler.init(); - } Services.obs.notifyObservers(null, "browser-ui-startup-complete", ""); }, diff --git a/browser/components/places/PlacesUIUtils.jsm b/browser/components/places/PlacesUIUtils.jsm index b25835a71..17fa276aa 100644 --- a/browser/components/places/PlacesUIUtils.jsm +++ b/browser/components/places/PlacesUIUtils.jsm @@ -46,43 +46,6 @@ let gFaviconLoadDataMap = new Map(); // copied from utilityOverlay.js const TAB_DROP_TYPE = "application/x-moz-tabbrowser-tab"; -// This function isn't public both because it's synchronous and because it is -// going to be removed in bug 1072833. -function IsLivemark(aItemId) { - // Since this check may be done on each dragover event, it's worth maintaining - // a cache. - let self = IsLivemark; - if (!("ids" in self)) { - const LIVEMARK_ANNO = PlacesUtils.LMANNO_FEEDURI; - - let idsVec = PlacesUtils.annotations.getItemsWithAnnotation(LIVEMARK_ANNO); - self.ids = new Set(idsVec); - - let obs = Object.freeze({ - QueryInterface: XPCOMUtils.generateQI(Ci.nsIAnnotationObserver), - - onItemAnnotationSet(itemId, annoName) { - if (annoName == LIVEMARK_ANNO) - self.ids.add(itemId); - }, - - onItemAnnotationRemoved(itemId, annoName) { - // If annoName is set to an empty string, the item is gone. - if (annoName == LIVEMARK_ANNO || annoName == "") - self.ids.delete(itemId); - }, - - onPageAnnotationSet() { }, - onPageAnnotationRemoved() { }, - }); - PlacesUtils.annotations.addObserver(obs); - PlacesUtils.registerShutdownFunction(() => { - PlacesUtils.annotations.removeObserver(obs); - }); - } - return self.ids.has(aItemId); -} - let InternalFaviconLoader = { /** * This gets called for every inner window that is destroyed. @@ -509,6 +472,52 @@ this.PlacesUIUtils = { }, /** + * Test if a bookmark item = a live bookmark item. + * + * @param aItemId + * item identifier + * @return true if a live bookmark item, false otherwise. + * + * @note Maybe this should be removed later, see bug 1072833. + */ + _isLivemark: + function PUIU__isLivemark(aItemId) + { + // Since this check may be done on each dragover event, it's worth maintaining + // a cache. + let self = PUIU__isLivemark; + if (!("ids" in self)) { + const LIVEMARK_ANNO = PlacesUtils.LMANNO_FEEDURI; + + let idsVec = PlacesUtils.annotations.getItemsWithAnnotation(LIVEMARK_ANNO); + self.ids = new Set(idsVec); + + let obs = Object.freeze({ + QueryInterface: XPCOMUtils.generateQI(Ci.nsIAnnotationObserver), + + onItemAnnotationSet(itemId, annoName) { + if (annoName == LIVEMARK_ANNO) + self.ids.add(itemId); + }, + + onItemAnnotationRemoved(itemId, annoName) { + // If annoName is set to an empty string, the item is gone. + if (annoName == LIVEMARK_ANNO || annoName == "") + self.ids.delete(itemId); + }, + + onPageAnnotationSet() { }, + onPageAnnotationRemoved() { }, + }); + PlacesUtils.annotations.addObserver(obs); + PlacesUtils.registerShutdownFunction(() => { + PlacesUtils.annotations.removeObserver(obs); + }); + } + return self.ids.has(aItemId); + }, + + /** * Constructs a Transaction for the drop or paste of a blob of data into * a container. * @param data @@ -857,7 +866,7 @@ this.PlacesUIUtils = { throw new Error("invalid value for aNodeOrItemId"); } - if (itemId == PlacesUtils.placesRootId || IsLivemark(itemId)) + if (itemId == PlacesUtils.placesRootId || this._isLivemark(itemId)) return true; // leftPaneFolderId, and as a result, allBookmarksFolderId, is a lazy getter diff --git a/browser/components/places/content/controller.js b/browser/components/places/content/controller.js index 0d66fbcaf..ebdab60f4 100644 --- a/browser/components/places/content/controller.js +++ b/browser/components/places/content/controller.js @@ -253,7 +253,8 @@ PlacesController.prototype = { } else host = NetUtil.newURI(this._view.selectedNode.uri).host; - ForgetAboutSite.removeDataFromDomain(host); + ForgetAboutSite.removeDataFromDomain(host) + .catch(Components.utils.reportError); break; case "cmd_selectAll": this.selectAll(); diff --git a/browser/components/places/content/editBookmarkOverlay.js b/browser/components/places/content/editBookmarkOverlay.js index e26cfb138..d59f5c764 100644 --- a/browser/components/places/content/editBookmarkOverlay.js +++ b/browser/components/places/content/editBookmarkOverlay.js @@ -57,12 +57,14 @@ var gEditItemOverlay = { } } let focusedElement = aInitInfo.focusedElement; + let onPanelReady = aInitInfo.onPanelReady; return this._paneInfo = { itemId, itemGuid, isItem, isURI, uri, title, isBookmark, isFolderShortcut, isParentReadOnly, bulkTagging, uris, - visibleRows, postData, isTag, focusedElement }; + visibleRows, postData, isTag, focusedElement, + onPanelReady }; }, get initialized() { @@ -214,7 +216,8 @@ var gEditItemOverlay = { let { itemId, isItem, isURI, isBookmark, bulkTagging, uris, - visibleRows, focusedElement } = this._setPaneInfo(aInfo); + visibleRows, focusedElement, + onPanelReady } = this._setPaneInfo(aInfo); let showOrCollapse = (rowId, isAppropriateForInput, nameInHiddenRows = null) => { @@ -286,22 +289,34 @@ var gEditItemOverlay = { this._observersAdded = true; } - // The focusedElement possible values are: - // * preferred: focus the field that the user touched first the last - // time the pane was shown (either namePicker or tagsField) - // * first: focus the first non collapsed textbox - // Note: since all controls are collapsed by default, we don't get the - // default XUL dialog behavior, that selects the first control, so we set - // the focus explicitly. - let elt; - if (focusedElement === "preferred") { - elt = this._element(gPrefService.getCharPref("browser.bookmarks.editDialog.firstEditField")); - } else if (focusedElement === "first") { - elt = document.querySelector("textbox:not([collapsed=true])"); - } - if (elt) { - elt.focus(); - elt.select(); + let focusElement = () => { + // The focusedElement possible values are: + // * preferred: focus the field that the user touched first the last + // time the pane was shown (either namePicker or tagsField) + // * first: focus the first non collapsed textbox + // Note: since all controls are collapsed by default, we don't get the + // default XUL dialog behavior, that selects the first control, so we set + // the focus explicitly. + // Note: If focusedElement === "preferred", this file expects gPrefService + // to be defined in the global scope. + let elt; + if (focusedElement === "preferred") { + /* eslint-disable no-undef */ + elt = this._element(gPrefService.getCharPref("browser.bookmarks.editDialog.firstEditField")); + /* eslint-enable no-undef */ + } else if (focusedElement === "first") { + elt = document.querySelector("textbox:not([collapsed=true])"); + } + if (elt) { + elt.focus(); + elt.select(); + } + }; + + if (onPanelReady) { + onPanelReady(focusElement); + } else { + focusElement(); } }, @@ -335,10 +350,23 @@ var gEditItemOverlay = { if (aElement.value != aValue) { aElement.value = aValue; - // Clear the undo stack - let editor = aElement.editor; - if (editor) - editor.transactionManager.clear(); + // Clear the editor's undo stack + let transactionManager; + try { + transactionManager = aElement.editor.transactionManager; + } catch (e) { + // When retrieving the transaction manager, editor may be null resulting + // in a TypeError. Additionally, the transaction manager may not + // exist yet, which causes access to it to throw NS_ERROR_FAILURE. + // In either event, the transaction manager doesn't exist it, so we + // don't need to worry about clearing it. + if (!(e instanceof TypeError) && e.result != Cr.NS_ERROR_FAILURE) { + throw e; + } + } + if (transactionManager) { + transactionManager.clear(); + } } }, diff --git a/browser/components/places/content/treeView.js b/browser/components/places/content/treeView.js index 5baf3a21f..181bb5404 100644 --- a/browser/components/places/content/treeView.js +++ b/browser/components/places/content/treeView.js @@ -170,7 +170,9 @@ PlacesTreeView.prototype = { let row = -1; let useNodeIndex = typeof(aNodeIndex) == "number"; if (parent == this._rootNode) { - row = useNodeIndex ? aNodeIndex : this._rootNode.getChildIndex(aNode); + if (aNode instanceof Ci.nsINavHistoryResultNode) { + row = useNodeIndex ? aNodeIndex : this._rootNode.getChildIndex(aNode); + } } else if (useNodeIndex && typeof(aParentRow) == "number") { // If we have both the row of the parent node, and the node's index, we diff --git a/browser/components/preferences/in-content/advanced.js b/browser/components/preferences/in-content/advanced.js index 448a21dae..5f9458eee 100644 --- a/browser/components/preferences/in-content/advanced.js +++ b/browser/components/preferences/in-content/advanced.js @@ -40,9 +40,6 @@ var gAdvancedPane = { this.updateReadPrefs(); } this.updateOfflineApps(); - if (AppConstants.MOZ_CRASHREPORTER) { - this.initSubmitCrashes(); - } this.initTelemetry(); if (AppConstants.MOZ_TELEMETRY_REPORTING) { this.initSubmitHealthReport(); diff --git a/browser/components/preferences/in-content/advanced.xul b/browser/components/preferences/in-content/advanced.xul index facaaeaa9..4973f8e09 100644 --- a/browser/components/preferences/in-content/advanced.xul +++ b/browser/components/preferences/in-content/advanced.xul @@ -54,13 +54,6 @@ type="bool"/> #endif - <!-- Data Choices tab --> -#ifdef MOZ_CRASHREPORTER - <preference id="browser.crashReports.unsubmittedCheck.autoSubmit2" - name="browser.crashReports.unsubmittedCheck.autoSubmit2" - type="bool"/> -#endif - <!-- Network tab --> <preference id="browser.cache.disk.capacity" name="browser.cache.disk.capacity" @@ -233,22 +226,6 @@ </vbox> </groupbox> #endif -#ifdef MOZ_CRASHREPORTER - <groupbox> - <caption> - <checkbox id="automaticallySubmitCrashesBox" - preference="browser.crashReports.unsubmittedCheck.autoSubmit2" - label="&alwaysSubmitCrashReports.label;" - accesskey="&alwaysSubmitCrashReports.accesskey;"/> - </caption> - <hbox class="indent"> - <label flex="1">&crashReporterDesc2.label;</label> - <spacer flex="10"/> - <label id="crashReporterLearnMore" - class="text-link">&crashReporterLearnMore.label;</label> - </hbox> - </groupbox> -#endif </tabpanel> #endif diff --git a/browser/components/preferences/in-content/security.js b/browser/components/preferences/in-content/security.js index a8ad28c7e..0d7af39a3 100644 --- a/browser/components/preferences/in-content/security.js +++ b/browser/components/preferences/in-content/security.js @@ -168,12 +168,24 @@ var gSecurityPane = { let safeBrowsingPhishingPref = document.getElementById("browser.safebrowsing.phishing.enabled"); let safeBrowsingMalwarePref = document.getElementById("browser.safebrowsing.malware.enabled"); + let safeBrowsingUIPref = document.getElementById("browser.safebrowsing.UI.enabled"); + let safeBrowsingUISep = document.getElementById("safeBrowsingUISep"); + let safeBrowsingUIGroup = document.getElementById("safeBrowsingUIGroup"); + let blockDownloadsPref = document.getElementById("browser.safebrowsing.downloads.enabled"); let malwareTable = document.getElementById("urlclassifier.malwareTable"); let blockUnwantedPref = document.getElementById("browser.safebrowsing.downloads.remote.block_potentially_unwanted"); let blockUncommonPref = document.getElementById("browser.safebrowsing.downloads.remote.block_uncommon"); + if (safeBrowsingUIPref.value == false) { + safeBrowsingUISep.setAttribute("hidden", "true"); + safeBrowsingUIGroup.setAttribute("hidden", "true"); + } else { + safeBrowsingUISep.removeAttribute("hidden"); + safeBrowsingUIGroup.removeAttribute("hidden"); + } + enableSafeBrowsing.addEventListener("command", function() { safeBrowsingPhishingPref.value = enableSafeBrowsing.checked; safeBrowsingMalwarePref.value = enableSafeBrowsing.checked; diff --git a/browser/components/preferences/in-content/security.xul b/browser/components/preferences/in-content/security.xul index b7bdb9361..5dc8ad5e9 100644 --- a/browser/components/preferences/in-content/security.xul +++ b/browser/components/preferences/in-content/security.xul @@ -28,6 +28,10 @@ name="browser.safebrowsing.phishing.enabled" type="bool"/> + <preference id="browser.safebrowsing.UI.enabled" + name="browser.safebrowsing.UI.enabled" + type="bool"/> + <preference id="browser.safebrowsing.downloads.enabled" name="browser.safebrowsing.downloads.enabled" type="bool"/> @@ -73,8 +77,8 @@ accesskey="&addonExceptions.accesskey;"/> </hbox> - <separator class="thin"/> - <vbox align="start"> + <separator id="safeBrowsingUISep" class="thin"/> + <vbox id="safeBrowsingUIGroup" align="start"> <checkbox id="enableSafeBrowsing" label="&enableSafeBrowsing.label;" accesskey="&enableSafeBrowsing.accesskey;" /> diff --git a/browser/components/sessionstore/content/aboutSessionRestore.js b/browser/components/sessionstore/content/aboutSessionRestore.js index cc8d2da0b..8a9410aa8 100644 --- a/browser/components/sessionstore/content/aboutSessionRestore.js +++ b/browser/components/sessionstore/content/aboutSessionRestore.js @@ -41,7 +41,11 @@ window.onload = function() { return; } - gStateObject = JSON.parse(sessionData.value); + try { + gStateObject = JSON.parse(sessionData.value); + } catch (e) { + Cu.reportError(e); + } // make sure the data is tracked to be restored in case of a subsequent crash var event = document.createEvent("UIEvents"); @@ -68,30 +72,32 @@ function initTreeView() { var winLabel = tabList.getAttribute("_window_label"); gTreeData = []; - gStateObject.windows.forEach(function(aWinData, aIx) { - var winState = { - label: winLabel.replace("%S", (aIx + 1)), - open: true, - checked: true, - ix: aIx - }; - winState.tabs = aWinData.tabs.map(function(aTabData) { - var entry = aTabData.entries[aTabData.index - 1] || { url: "about:blank" }; - var iconURL = aTabData.image || null; - // don't initiate a connection just to fetch a favicon (see bug 462863) - if (/^https?:/.test(iconURL)) - iconURL = "moz-anno:favicon:" + iconURL; - return { - label: entry.title || entry.url, + if (gStateObject) { + gStateObject.windows.forEach(function(aWinData, aIx) { + var winState = { + label: winLabel.replace("%S", (aIx + 1)), + open: true, checked: true, - src: iconURL, - parent: winState + ix: aIx }; - }); - gTreeData.push(winState); - for (let tab of winState.tabs) - gTreeData.push(tab); - }, this); + winState.tabs = aWinData.tabs.map(function(aTabData) { + var entry = aTabData.entries[aTabData.index - 1] || { url: "about:blank" }; + var iconURL = aTabData.image || null; + // don't initiate a connection just to fetch a favicon (see bug 462863) + if (/^https?:/.test(iconURL)) + iconURL = "moz-anno:favicon:" + iconURL; + return { + label: entry.title || entry.url, + checked: true, + src: iconURL, + parent: winState + }; + }); + gTreeData.push(winState); + for (let tab of winState.tabs) + gTreeData.push(tab); + }, this); + } tabList.view = treeView; tabList.view.selection.select(0); diff --git a/browser/components/webextensions/ext-commands.js b/browser/components/webextensions/ext-commands.js index 416544e86..b6e7ab3d1 100644 --- a/browser/components/webextensions/ext-commands.js +++ b/browser/components/webextensions/ext-commands.js @@ -74,15 +74,14 @@ CommandList.prototype = { // For Windows, chrome.runtime expects 'win' while chrome.commands // expects 'windows'. We can special case this for now. let os = PlatformInfo.os == "win" ? "windows" : PlatformInfo.os; - for (let name of Object.keys(manifest.commands)) { - let command = manifest.commands[name]; - let shortcut = command.suggested_key[os] || command.suggested_key.default; - if (shortcut) { - commands.set(name, { - description: command.description, - shortcut: shortcut.replace(/\s+/g, ""), - }); - } + for (let [name, command] of Object.entries(manifest.commands)) { + let suggested_key = command.suggested_key || {}; + let shortcut = suggested_key[os] || suggested_key.default; + shortcut = shortcut ? shortcut.replace(/\s+/g, "") : null; + commands.set(name, { + description: command.description, + shortcut, + }); } return commands; }, @@ -96,8 +95,10 @@ CommandList.prototype = { let keyset = doc.createElementNS(XUL_NS, "keyset"); keyset.id = `ext-keyset-id-${this.id}`; this.commands.forEach((command, name) => { - let keyElement = this.buildKey(doc, name, command.shortcut); - keyset.appendChild(keyElement); + if (command.shortcut) { + let keyElement = this.buildKey(doc, name, command.shortcut); + keyset.appendChild(keyElement); + } }); doc.documentElement.appendChild(keyset); this.keysetsMap.set(window, keyset); @@ -162,11 +163,12 @@ CommandList.prototype = { // The modifiers are the remaining elements. keyElement.setAttribute("modifiers", this.getModifiersAttribute(parts)); - if (/^[A-Z0-9]$/.test(chromeKey)) { + if (/^[A-Z]$/.test(chromeKey)) { // We use the key attribute for all single digits and characters. keyElement.setAttribute("key", chromeKey); } else { keyElement.setAttribute("keycode", this.getKeycodeAttribute(chromeKey)); + keyElement.setAttribute("event", "keydown"); } return keyElement; @@ -186,6 +188,9 @@ CommandList.prototype = { * @returns {string} The constructed value for the Key's 'keycode' attribute. */ getKeycodeAttribute(chromeKey) { + if (/[0-9]/.test(chromeKey)) { + return `VK_${chromeKey}`; + } return `VK${chromeKey.replace(/([A-Z])/g, "_$&").toUpperCase()}`; }, |