diff options
author | Gaming4JC <g4jc@bulletmail.org> | 2018-05-26 18:46:33 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@bulletmail.org> | 2018-05-26 18:46:33 -0400 |
commit | d2c47f5aa8c8d3ea01e8485dc6528b3f3721bd58 (patch) | |
tree | 7b25f53ab0f0ea9a2a49cccf232f651ef3dd1892 | |
parent | 9354fa4d91a79dcfa8aba3251b22abf78b61e083 (diff) | |
download | iceweasel-uxp-d2c47f5aa8c8d3ea01e8485dc6528b3f3721bd58.tar.gz |
remove safebrowsing and disable features
-rw-r--r-- | app/profile/firefox.js | 2 | ||||
-rw-r--r-- | base/content/browser-doctype.inc | 2 | ||||
-rw-r--r-- | base/content/browser-safebrowsing.js | 2 | ||||
-rw-r--r-- | base/content/browser-sets.inc | 2 | ||||
-rwxr-xr-x | base/content/browser.js | 8 | ||||
-rwxr-xr-x | base/content/global-scripts.inc | 2 | ||||
-rw-r--r-- | base/content/tab-content.js | 2 | ||||
-rw-r--r-- | base/content/utilityOverlay.js | 3 | ||||
-rw-r--r-- | base/jar.mn | 4 | ||||
-rw-r--r-- | branding/shared/preferences.inc | 9 | ||||
-rw-r--r-- | components/about/AboutRedirector.cpp | 2 | ||||
-rw-r--r-- | components/build/nsModule.cpp | 2 | ||||
-rw-r--r-- | components/preferences/blocklists.js | 2 | ||||
-rw-r--r-- | components/preferences/in-content/jar.mn | 2 | ||||
-rw-r--r-- | components/preferences/in-content/security.js | 16 | ||||
-rw-r--r-- | components/preferences/in-content/security.xul | 18 | ||||
-rw-r--r-- | components/sessionstore/content/aboutSessionRestore.js | 7 | ||||
-rw-r--r-- | configure.in | 16 | ||||
-rwxr-xr-x | confvars.sh | 13 | ||||
-rw-r--r-- | installer/package-manifest.in | 9 | ||||
-rw-r--r-- | locales/jar.mn | 2 | ||||
-rw-r--r-- | modules/ReaderParent.jsm | 116 |
22 files changed, 74 insertions, 167 deletions
diff --git a/app/profile/firefox.js b/app/profile/firefox.js index 0b733a6..8e5f7b3 100644 --- a/app/profile/firefox.js +++ b/app/profile/firefox.js @@ -964,8 +964,10 @@ pref("services.sync.prefs.sync.browser.link.open_newwindow", true); pref("services.sync.prefs.sync.browser.newtabpage.enabled", true); pref("services.sync.prefs.sync.browser.newtabpage.pinned", true); pref("services.sync.prefs.sync.browser.offline-apps.notify", true); +#ifdef MOZ_SAFE_BROWSING pref("services.sync.prefs.sync.browser.safebrowsing.phishing.enabled", true); pref("services.sync.prefs.sync.browser.safebrowsing.malware.enabled", true); +#endif pref("services.sync.prefs.sync.browser.search.update", true); pref("services.sync.prefs.sync.browser.sessionstore.restore_on_demand", true); pref("services.sync.prefs.sync.browser.startup.homepage", true); diff --git a/base/content/browser-doctype.inc b/base/content/browser-doctype.inc index 10015d8..ad08f4b 100644 --- a/base/content/browser-doctype.inc +++ b/base/content/browser-doctype.inc @@ -13,8 +13,10 @@ %customizeToolbarDTD; <!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd"> %placesDTD; +#ifdef MOZ_SAFE_BROWSING <!ENTITY % safebrowsingDTD SYSTEM "chrome://browser/locale/safebrowsing/phishing-afterload-warning-message.dtd"> %safebrowsingDTD; +#endif <!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd"> %aboutHomeDTD; <!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd"> diff --git a/base/content/browser-safebrowsing.js b/base/content/browser-safebrowsing.js index 430d84f..a66595b 100644 --- a/base/content/browser-safebrowsing.js +++ b/base/content/browser-safebrowsing.js @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifdef MOZ_SAFE_BROWSING var gSafeBrowsing = { setReportPhishingMenu: function() { @@ -46,3 +47,4 @@ var gSafeBrowsing = { return SafeBrowsing.getReportURL(name, gBrowser.currentURI); } } +#endif diff --git a/base/content/browser-sets.inc b/base/content/browser-sets.inc index 0c75352..d0c3d11 100644 --- a/base/content/browser-sets.inc +++ b/base/content/browser-sets.inc @@ -285,7 +285,7 @@ <key id="key_fullScreen_old" key="&fullScreenCmd.macCommandKey;" command="View:FullScreen" modifiers="accel,shift"/> <key keycode="VK_F11" command="View:FullScreen"/> #endif - <key id="toggleReaderMode" key="&toggleReaderMode.key;" command="View:ReaderView" modifiers="accel,alt" disabled="true"/> + <key id="key_toggleReaderMode" key="&toggleReaderMode.key;" command="View:ReaderView" modifiers="accel,alt" disabled="true"/> <key key="&reloadCmd.commandkey;" command="Browser:Reload" modifiers="accel" id="key_reload"/> <key key="&reloadCmd.commandkey;" command="Browser:ReloadSkipCache" modifiers="accel,shift"/> <key id="key_viewSource" key="&pageSourceCmd.commandkey;" command="View:PageSource" modifiers="accel"/> diff --git a/base/content/browser.js b/base/content/browser.js index 2380f5d..8679bca 100755 --- a/base/content/browser.js +++ b/base/content/browser.js @@ -60,8 +60,10 @@ Cu.import("resource://gre/modules/NotificationDB.jsm"); ["webrtcUI", "resource:///modules/webrtcUI.jsm", ] ].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource)); -XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing", - "resource://gre/modules/SafeBrowsing.jsm"); +#ifdef MOZ_SAFE_BROWSING + XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing", + "resource://gre/modules/SafeBrowsing.jsm"); +#endif // lazy service getters [ @@ -1200,8 +1202,10 @@ var gBrowserInit = { } } +#ifdef MOZ_SAFE_BROWSING // Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008. setTimeout(function() { SafeBrowsing.init(); }, 2000); +#endif Services.obs.addObserver(gIdentityHandler, "perm-changed", false); Services.obs.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false); diff --git a/base/content/global-scripts.inc b/base/content/global-scripts.inc index dac7587..ca942ce 100755 --- a/base/content/global-scripts.inc +++ b/base/content/global-scripts.inc @@ -23,7 +23,9 @@ <script type="application/javascript" src="chrome://browser/content/browser-places.js"/> <script type="application/javascript" src="chrome://browser/content/browser-plugins.js"/> <script type="application/javascript" src="chrome://browser/content/browser-refreshblocker.js"/> +#ifdef MOZ_SAFE_BROWSING <script type="application/javascript" src="chrome://browser/content/browser-safebrowsing.js"/> +#endif <script type="application/javascript" src="chrome://browser/content/browser-sidebar.js"/> <script type="application/javascript" src="chrome://browser/content/browser-social.js"/> <script type="application/javascript" src="chrome://browser/content/browser-syncui.js"/> diff --git a/base/content/tab-content.js b/base/content/tab-content.js index 7e80379..a57dc66 100644 --- a/base/content/tab-content.js +++ b/base/content/tab-content.js @@ -307,7 +307,7 @@ var AboutReaderListener = { if (content.document.body) { // Update the toolbar icon to show the "reader active" icon. sendAsyncMessage("Reader:UpdateReaderButton"); - new AboutReader(global, content, this._articlePromise); + new AboutReader(content, this._articlePromise); this._articlePromise = null; } break; diff --git a/base/content/utilityOverlay.js b/base/content/utilityOverlay.js index b041915..4ea6d8f 100644 --- a/base/content/utilityOverlay.js +++ b/base/content/utilityOverlay.js @@ -819,9 +819,8 @@ function openTourPage() function buildHelpMenu() { // Enable/disable the "Report Web Forgery" menu item. - if (typeof gSafeBrowsing != "undefined") { + if (typeof gSafeBrowsing != "undefined") gSafeBrowsing.setReportPhishingMenu(); - } } function isElementVisible(aElement) diff --git a/base/jar.mn b/base/jar.mn index b84294c..515fffc 100644 --- a/base/jar.mn +++ b/base/jar.mn @@ -88,7 +88,9 @@ browser.jar: content/browser/browser-places.js (content/browser-places.js) content/browser/browser-plugins.js (content/browser-plugins.js) content/browser/browser-refreshblocker.js (content/browser-refreshblocker.js) +#ifdef MOZ_SAFE_BROWSING content/browser/browser-safebrowsing.js (content/browser-safebrowsing.js) +#endif content/browser/browser-sidebar.js (content/browser-sidebar.js) content/browser/browser-social.js (content/browser-social.js) * content/browser/browser-syncui.js (content/browser-syncui.js) @@ -189,9 +191,11 @@ browser.jar: #endif # the following files are browser-specific overrides % override chrome://global/content/license.html chrome://browser/content/license.html +#ifdef MOZ_SAFE_BROWSING content/browser/report-phishing-overlay.xul (content/report-phishing-overlay.xul) content/browser/blockedSite.xhtml (content/blockedSite.xhtml) % overlay chrome://browser/content/browser.xul chrome://browser/content/report-phishing-overlay.xul +#endif % override chrome://global/content/netError.xhtml chrome://browser/content/aboutNetError.xhtml % override chrome://global/content/mozilla.xhtml chrome://browser/content/mozilla.xhtml diff --git a/branding/shared/preferences.inc b/branding/shared/preferences.inc index 8da1105..e1b8d3b 100644 --- a/branding/shared/preferences.inc +++ b/branding/shared/preferences.inc @@ -22,14 +22,5 @@ pref("app.update.badgeWaitTime", 0); // If this is less than 5, then pasting code into the web console or scratchpad is disabled pref("devtools.selfxss.count", 100); -// Disable Google Safebrowsing by default. Without an API key, this won't work. -pref("browser.safebrowsing.phishing.enabled", false); -pref("browser.safebrowsing.malware.enabled", false); -pref("browser.safebrowsing.downloads.enabled", false); -pref("browser.safebrowsing.downloads.remote.enabled", false); - -// Disable the UI controls for it as well for Iceweasel-official. -pref("browser.safebrowsing.UI.enabled", false); - // pref("general.useragent.appVersionIsBuildID", true); diff --git a/components/about/AboutRedirector.cpp b/components/about/AboutRedirector.cpp index 18ce2fa..09558b7 100644 --- a/components/about/AboutRedirector.cpp +++ b/components/about/AboutRedirector.cpp @@ -52,6 +52,7 @@ static RedirEntry kRedirMap[] = { nsIAboutModule::MAKE_LINKABLE }, /* Iceweasel specific branding end */ +#ifdef MOZ_SAFE_BROWSING { "blocked", "chrome://browser/content/blockedSite.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | @@ -59,6 +60,7 @@ static RedirEntry kRedirMap[] = { nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::HIDE_FROM_ABOUTABOUT }, +#endif { "certerror", "chrome://browser/content/aboutNetError.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | diff --git a/components/build/nsModule.cpp b/components/build/nsModule.cpp index 7e35cc8..b333fa9 100644 --- a/components/build/nsModule.cpp +++ b/components/build/nsModule.cpp @@ -86,7 +86,9 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = { #endif { NS_FEEDSNIFFER_CONTRACTID, &kNS_FEEDSNIFFER_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "iceweasel", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, +#ifdef MOZ_SAFE_BROWSING { NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, +#endif { NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "socialerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, { NS_ABOUT_MODULE_CONTRACTID_PREFIX "providerdirectory", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, diff --git a/components/preferences/blocklists.js b/components/preferences/blocklists.js index bc39eb6..c0ce5b6 100644 --- a/components/preferences/blocklists.js +++ b/components/preferences/blocklists.js @@ -6,9 +6,11 @@ Components.utils.import("resource://gre/modules/Services.jsm"); const BASE_LIST_ID = "base"; const CONTENT_LIST_ID = "content"; const TRACK_SUFFIX = "-track-digest256"; +#ifdef MOZ_SAFE_BROWSING const TRACKING_TABLE_PREF = "urlclassifier.trackingTable"; const LISTS_PREF_BRANCH = "browser.safebrowsing.provider.mozilla.lists."; const UPDATE_TIME_PREF = "browser.safebrowsing.provider.mozilla.nextupdatetime"; +#endif var gBlocklistManager = { _type: "", diff --git a/components/preferences/in-content/jar.mn b/components/preferences/in-content/jar.mn index 3497ff5..130bf85 100644 --- a/components/preferences/in-content/jar.mn +++ b/components/preferences/in-content/jar.mn @@ -14,5 +14,5 @@ browser.jar: content/browser/preferences/in-content/applications.js * content/browser/preferences/in-content/content.js content/browser/preferences/in-content/sync.js - content/browser/preferences/in-content/security.js +* content/browser/preferences/in-content/security.js content/browser/preferences/in-content/search.js diff --git a/components/preferences/in-content/security.js b/components/preferences/in-content/security.js index 0d7af39..37a187f 100644 --- a/components/preferences/in-content/security.js +++ b/components/preferences/in-content/security.js @@ -23,7 +23,9 @@ var gSecurityPane = { this._pane = document.getElementById("paneSecurity"); this._initMasterPasswordUI(); +#ifdef MOZ_SAFE_BROWSING this._initSafeBrowsing(); +#endif setEventListener("addonExceptions", "command", gSecurityPane.showAddonExceptions); @@ -160,6 +162,7 @@ var gSecurityPane = { checkbox.checked = !noMP; }, +#ifdef MOZ_SAFE_BROWSING _initSafeBrowsing() { let enableSafeBrowsing = document.getElementById("enableSafeBrowsing"); let blockDownloads = document.getElementById("blockDownloads"); @@ -168,24 +171,12 @@ 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; @@ -244,6 +235,7 @@ var gSecurityPane = { blockUncommonUnwanted.checked = blockUnwantedPref.value && blockUncommonPref.value; }, +#endif /** * Enables/disables the master password button depending on the state of the diff --git a/components/preferences/in-content/security.xul b/components/preferences/in-content/security.xul index 5dc8ad5..33e1471 100644 --- a/components/preferences/in-content/security.xul +++ b/components/preferences/in-content/security.xul @@ -16,11 +16,13 @@ name="pref.privacy.disable_button.view_passwords_exceptions" type="bool"/> - <!-- Add-ons, malware, phishing --> + <!-- Add-ons --> <preference id="xpinstall.whitelist.required" name="xpinstall.whitelist.required" type="bool"/> +#ifdef MOZ_SAFE_BROWSING + <!-- Malware, phishing --> <preference id="browser.safebrowsing.malware.enabled" name="browser.safebrowsing.malware.enabled" type="bool"/> @@ -28,10 +30,6 @@ 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"/> @@ -46,6 +44,7 @@ <preference id="browser.safebrowsing.downloads.remote.block_uncommon" name="browser.safebrowsing.downloads.remote.block_uncommon" type="bool"/> +#endif <!-- Passwords --> <preference id="signon.rememberSignons" name="signon.rememberSignons" type="bool"/> @@ -61,7 +60,7 @@ <html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a> </hbox> -<!-- addons, forgery (phishing) UI --> +<!-- addons --> <groupbox id="addonsPhishingGroup" data-category="paneSecurity" hidden="true"> <caption><label>&general.label;</label></caption> @@ -77,8 +76,10 @@ accesskey="&addonExceptions.accesskey;"/> </hbox> - <separator id="safeBrowsingUISep" class="thin"/> - <vbox id="safeBrowsingUIGroup" align="start"> +#ifdef MOZ_SAFE_BROWSING +<!-- Safebrowsing (phishing) UI --> + <separator class="thin"/> + <vbox align="start"> <checkbox id="enableSafeBrowsing" label="&enableSafeBrowsing.label;" accesskey="&enableSafeBrowsing.accesskey;" /> @@ -91,6 +92,7 @@ accesskey="&blockUncommonUnwanted.accesskey;" /> </vbox> </vbox> +#endif </groupbox> <!-- Passwords --> diff --git a/components/sessionstore/content/aboutSessionRestore.js b/components/sessionstore/content/aboutSessionRestore.js index 8a9410a..8f26523 100644 --- a/components/sessionstore/content/aboutSessionRestore.js +++ b/components/sessionstore/content/aboutSessionRestore.js @@ -188,6 +188,9 @@ function onListClick(aEvent) { if (aEvent.button == 2) return; + if (!treeView.treeBox) { + return; + } var cell = treeView.treeBox.getCellAt(aEvent.clientX, aEvent.clientY); if (cell.col) { // Restore this specific tab in the same window for middle/double/accel clicking @@ -286,7 +289,9 @@ var treeView = { get rowCount() { return gTreeData.length; }, setTree: function(treeBox) { this.treeBox = treeBox; }, getCellText: function(idx, column) { return gTreeData[idx].label; }, - isContainer: function(idx) { return "open" in gTreeData[idx]; }, + isContainer: function(idx) { + return gTreeData[idx] ? "open" in gTreeData[idx] : false; + }, getCellValue: function(idx, column){ return gTreeData[idx].checked; }, isContainerOpen: function(idx) { return gTreeData[idx].open; }, isContainerEmpty: function(idx) { return false; }, diff --git a/configure.in b/configure.in index 22cae48..3008ef7 100644 --- a/configure.in +++ b/configure.in @@ -11,18 +11,4 @@ AC_SUBST(MOZ_PHOENIX) AC_DEFINE(HYPE_ICEWEASEL) AC_SUBST(HYPE_ICEWEASEL) -dnl Optional parts of the build. - -dnl ======================================================== -dnl = Disable WebExtensions -dnl ======================================================== -MOZ_ARG_DISABLE_BOOL(webextensions, -[ --disable-webextensions Disable WebExtensions], - MOZ_WEBEXTENSIONS=, - MOZ_WEBEXTENSIONS=1) - -if test -n "$MOZ_WEBEXTENSIONS"; then - AC_DEFINE(MOZ_WEBEXTENSIONS) -fi - -AC_SUBST(MOZ_WEBEXTENSIONS)
\ No newline at end of file +dnl Optional parts of the build.
\ No newline at end of file diff --git a/confvars.sh b/confvars.sh index 729cba1..5809e2d 100755 --- a/confvars.sh +++ b/confvars.sh @@ -53,13 +53,14 @@ MOZ_PROFILE_MIGRATOR=1 MOZ_APP_STATIC_INI=1 MOZ_WEBGL_CONFORMANT=1 MOZ_JSDOWNLOADS=1 -MOZ_WEBRTC=1 -MOZ_WEBEXTENSIONS=1 +MOZ_WEBRTC= +MOZ_WEBEXTENSIONS= MOZ_DEVTOOLS=1 MOZ_SERVICES_COMMON=1 -MOZ_SERVICES_SYNC=0 -MOZ_SERVICES_HEALTHREPORT=0 +MOZ_SERVICES_SYNC= +MOZ_SERVICES_HEALTHREPORT= +MOZ_SAFE_BROWSING= # Disable checking that add-ons are signed by the trusted root -MOZ_ADDON_SIGNING=0 -MOZ_REQUIRE_SIGNING=0 +MOZ_ADDON_SIGNING= +MOZ_REQUIRE_SIGNING= diff --git a/installer/package-manifest.in b/installer/package-manifest.in index 8b308db..92d225a 100644 --- a/installer/package-manifest.in +++ b/installer/package-manifest.in @@ -69,9 +69,6 @@ #ifndef MOZ_STATIC_JS @BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@ #endif -#ifdef MOZ_DMD -@BINPATH@/@DLL_PREFIX@dmd@DLL_SUFFIX@ -#endif #ifndef MOZ_SYSTEM_NSPR #ifndef MOZ_FOLD_LIBS @BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@ @@ -254,9 +251,6 @@ @RESPATH@/components/layout_xul.xpt @RESPATH@/components/locale.xpt @RESPATH@/components/lwbrk.xpt -#ifdef MOZ_ENABLE_PROFILER_SPS -@RESPATH@/components/memory_profiler.xpt -#endif @RESPATH@/browser/components/migration.xpt @RESPATH@/components/mimetype.xpt @RESPATH@/components/mozfind.xpt @@ -288,9 +282,6 @@ @RESPATH@/components/plugin.xpt @RESPATH@/components/pref.xpt @RESPATH@/components/prefetch.xpt -#ifdef MOZ_ENABLE_PROFILER_SPS -@RESPATH@/components/profiler.xpt -#endif @RESPATH@/components/rdf.xpt @RESPATH@/components/satchel.xpt @RESPATH@/components/saxparser.xpt diff --git a/locales/jar.mn b/locales/jar.mn index 653b1b4..8177da0 100644 --- a/locales/jar.mn +++ b/locales/jar.mn @@ -53,8 +53,10 @@ locale/browser/places/bookmarkProperties.properties (%chrome/browser/places/bookmarkProperties.properties) locale/browser/preferences/selectBookmark.dtd (%chrome/browser/preferences/selectBookmark.dtd) locale/browser/places/moveBookmarks.dtd (%chrome/browser/places/moveBookmarks.dtd) +#ifdef MOZ_SAFE_BROWSING locale/browser/safebrowsing/phishing-afterload-warning-message.dtd (%chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd) locale/browser/safebrowsing/report-phishing.dtd (%chrome/browser/safebrowsing/report-phishing.dtd) +#endif locale/browser/feeds/subscribe.dtd (%chrome/browser/feeds/subscribe.dtd) locale/browser/feeds/subscribe.properties (%chrome/browser/feeds/subscribe.properties) locale/browser/migration/migration.dtd (%chrome/browser/migration/migration.dtd) diff --git a/modules/ReaderParent.jsm b/modules/ReaderParent.jsm index 6fcaada..c81aa99 100644 --- a/modules/ReaderParent.jsm +++ b/modules/ReaderParent.jsm @@ -11,64 +11,26 @@ this.EXPORTED_SYMBOLS = [ "ReaderParent" ]; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/Task.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", "resource://gre/modules/ReaderMode.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "UITour", "resource:///modules/UITour.jsm"); const gStringBundle = Services.strings.createBundle("chrome://global/locale/aboutReader.properties"); var ReaderParent = { - _readerModeInfoPanelOpen: false, - MESSAGES: [ - "Reader:ArticleGet", - "Reader:FaviconRequest", "Reader:UpdateReaderButton", ], - init: function() { + init() { let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager); for (let msg of this.MESSAGES) { mm.addMessageListener(msg, this); } }, - receiveMessage: function(message) { + receiveMessage(message) { switch (message.name) { - case "Reader:ArticleGet": - this._getArticle(message.data.url, message.target).then((article) => { - // Make sure the target browser is still alive before trying to send data back. - if (message.target.messageManager) { - message.target.messageManager.sendAsyncMessage("Reader:ArticleData", { article: article }); - } - }, e => { - if (e && e.newURL) { - // Make sure the target browser is still alive before trying to send data back. - if (message.target.messageManager) { - message.target.messageManager.sendAsyncMessage("Reader:ArticleData", { newURL: e.newURL }); - } - } - }); - break; - - case "Reader:FaviconRequest": { - if (message.target.messageManager) { - let faviconUrl = PlacesUtils.promiseFaviconLinkUrl(message.data.url); - faviconUrl.then(function onResolution(favicon) { - message.target.messageManager.sendAsyncMessage("Reader:FaviconReturn", { - url: message.data.url, - faviconUrl: favicon.path.replace(/^favicon:/, "") - }) - }, - function onRejection(reason) { - Cu.reportError("Error requesting favicon URL for about:reader content: " + reason); - }).catch(Cu.reportError); - } - break; - } - case "Reader:UpdateReaderButton": { let browser = message.target; if (message.data && message.data.isArticle !== undefined) { @@ -80,7 +42,7 @@ var ReaderParent = { } }, - updateReaderButton: function(browser) { + updateReaderButton(browser) { let win = browser.ownerGlobal; if (browser != win.gBrowser.selectedBrowser) { return; @@ -88,7 +50,11 @@ var ReaderParent = { let button = win.document.getElementById("reader-mode-button"); let command = win.document.getElementById("View:ReaderView"); - let key = win.document.getElementById("toggleReaderMode"); + let key = win.document.getElementById("key_toggleReaderMode"); + // aria-reader is not a real ARIA attribute. However, this will cause + // Gecko accessibility to expose the "reader" object attribute. We do this + // so that the reader state is easy for accessibility clients to access + // programmatically. if (browser.currentURI.spec.startsWith("about:reader")) { button.setAttribute("readeractive", true); button.hidden = false; @@ -98,6 +64,7 @@ var ReaderParent = { command.setAttribute("hidden", false); command.setAttribute("accesskey", gStringBundle.GetStringFromName("readerView.close.accesskey")); key.setAttribute("disabled", false); + browser.setAttribute("aria-reader", "active"); } else { button.removeAttribute("readeractive"); button.hidden = !browser.isArticle; @@ -107,24 +74,15 @@ var ReaderParent = { command.setAttribute("hidden", !browser.isArticle); command.setAttribute("accesskey", gStringBundle.GetStringFromName("readerView.enter.accesskey")); key.setAttribute("disabled", !browser.isArticle); - } - - let currentUriHost = browser.currentURI && browser.currentURI.asciiHost; - if (browser.isArticle && - !Services.prefs.getBoolPref("browser.reader.detectedFirstArticle") && - currentUriHost && !currentUriHost.endsWith("mozilla.org")) { - this.showReaderModeInfoPanel(browser); - Services.prefs.setBoolPref("browser.reader.detectedFirstArticle", true); - this._readerModeInfoPanelOpen = true; - } else if (this._readerModeInfoPanelOpen) { - if (UITour.isInfoOnTarget(win, "readerMode-urlBar")) { - UITour.hideInfo(win); + if (browser.isArticle) { + browser.setAttribute("aria-reader", "available"); + } else { + browser.removeAttribute("aria-reader"); } - this._readerModeInfoPanelOpen = false; } }, - forceShowReaderIcon: function(browser) { + forceShowReaderIcon(browser) { browser.isArticle = true; this.updateReaderButton(browser); }, @@ -136,51 +94,9 @@ var ReaderParent = { this.toggleReaderMode(event); }, - toggleReaderMode: function(event) { + toggleReaderMode(event) { let win = event.target.ownerGlobal; let browser = win.gBrowser.selectedBrowser; browser.messageManager.sendAsyncMessage("Reader:ToggleReaderMode"); - }, - - /** - * Shows an info panel from the UITour for Reader Mode. - * - * @param browser The <browser> that the tour should be started for. - */ - showReaderModeInfoPanel(browser) { - let win = browser.ownerGlobal; - let targetPromise = UITour.getTarget(win, "readerMode-urlBar"); - targetPromise.then(target => { - let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties"); - let icon = "chrome://browser/skin/"; - if (win.devicePixelRatio > 1) { - icon += "reader-tour@2x.png"; - } else { - icon += "reader-tour.png"; - } - UITour.showInfo(win, target, - browserBundle.GetStringFromName("readingList.promo.firstUse.readerView.title"), - browserBundle.GetStringFromName("readingList.promo.firstUse.readerView.body"), - icon); - }); - }, - - /** - * Gets an article for a given URL. This method will download and parse a document. - * - * @param url The article URL. - * @param browser The browser where the article is currently loaded. - * @return {Promise} - * @resolves JS object representing the article, or null if no article is found. - */ - _getArticle: Task.async(function* (url, browser) { - return yield ReaderMode.downloadAndParseDocument(url).catch(e => { - if (e && e.newURL) { - // Pass up the error so we can navigate the browser in question to the new URL: - throw e; - } - Cu.reportError("Error downloading and parsing document: " + e); - return null; - }); - }) + } }; |