diff -Nru firefox-56.0~b4+build4/browser/base/content/blockedSite.xhtml firefox-56.0~b5+build1/browser/base/content/blockedSite.xhtml --- firefox-56.0~b4+build4/browser/base/content/blockedSite.xhtml 2017-08-19 12:28:04.000000000 +0000 +++ firefox-56.0~b5+build1/browser/base/content/blockedSite.xhtml 2017-08-22 06:02:52.000000000 +0000 @@ -122,8 +122,12 @@ el.remove(); } - // Set sitename - document.getElementById(error + "_sitename").textContent = getHostString(); + // Set sitename if necessary. + let sitenameElem = document.getElementById(error + "_sitename"); + if (sitenameElem) { + sitenameElem.textContent = getHostString(); + } + document.title = document.getElementById("errorTitleText_" + error) .innerHTML; diff -Nru firefox-56.0~b4+build4/browser/base/content/test/static/browser_all_files_referenced.js firefox-56.0~b5+build1/browser/base/content/test/static/browser_all_files_referenced.js --- firefox-56.0~b4+build4/browser/base/content/test/static/browser_all_files_referenced.js 2017-08-19 12:28:04.000000000 +0000 +++ firefox-56.0~b5+build1/browser/base/content/test/static/browser_all_files_referenced.js 2017-08-22 06:02:52.000000000 +0000 @@ -118,6 +118,10 @@ // browser/extensions/pdfjs/content/web/viewer.js#7450 {file: "resource://pdf.js/web/debugger.js"}, + // These are used in content processes. They are actually referenced. + {file: "resource://shield-recipe-client-content/shield-content-frame.js"}, + {file: "resource://shield-recipe-client-content/shield-content-process.js"}, + // Starting from here, files in the whitelist are bugs that need fixing. // Bug 1339420 {file: "chrome://branding/content/icon128.png"}, diff -Nru firefox-56.0~b4+build4/browser/components/nsBrowserContentHandler.js firefox-56.0~b5+build1/browser/components/nsBrowserContentHandler.js --- firefox-56.0~b4+build4/browser/components/nsBrowserContentHandler.js 2017-08-19 12:28:04.000000000 +0000 +++ firefox-56.0~b5+build1/browser/components/nsBrowserContentHandler.js 2017-08-22 06:02:53.000000000 +0000 @@ -138,14 +138,21 @@ function getPostUpdateOverridePage(defaultOverridePage) { var um = Components.classes["@mozilla.org/updates/update-manager;1"] .getService(Components.interfaces.nsIUpdateManager); - try { - // If the updates.xml file is deleted then getUpdateAt will throw. - var update = um.getUpdateAt(0) + // The active update should be present when this code is called. If for + // whatever reason it isn't fallback to the latest update in the update + // history. + if (um.activeUpdate) { + var update = um.activeUpdate .QueryInterface(Components.interfaces.nsIPropertyBag); - } catch (e) { - // This should never happen. - Components.utils.reportError("Unable to find update: " + e); - return defaultOverridePage; + } else { + // If the updates.xml file is deleted then getUpdateAt will throw. + try { + update = um.getUpdateAt(0) + .QueryInterface(Components.interfaces.nsIPropertyBag); + } catch (e) { + Components.utils.reportError("Unable to find update: " + e); + return defaultOverridePage; + } } let actions = update.getProperty("actions"); diff -Nru firefox-56.0~b4+build4/browser/components/preferences/in-content/main.js firefox-56.0~b5+build1/browser/components/preferences/in-content/main.js --- firefox-56.0~b4+build4/browser/components/preferences/in-content/main.js 2017-08-19 12:28:04.000000000 +0000 +++ firefox-56.0~b5+build1/browser/components/preferences/in-content/main.js 2017-08-22 06:02:53.000000000 +0000 @@ -11,6 +11,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "CloudStorage", + "resource://gre/modules/CloudStorage.jsm"); if (AppConstants.E10S_TESTING_ONLY) { XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils", @@ -88,6 +90,8 @@ gMainPane.updateBrowserStartupLastSession); setEventListener("browser.download.dir", "change", gMainPane.displayDownloadDirPref); + setEventListener("saveWhere", "command", + gMainPane.handleSaveToCommand); if (AppConstants.HAVE_SHELL_SERVICE) { setEventListener("setDefaultButton", "command", gMainPane.setDefaultBrowser); @@ -503,6 +507,8 @@ * 1 - The system's downloads folder is the default download location. * 2 - The default download location is elsewhere as specified in * browser.download.dir. + * 3 - The default download location is elsewhere as specified by + * cloud storage API getDownloadFolder * browser.download.downloadDir * deprecated. * browser.download.defaultFolder @@ -520,11 +526,91 @@ downloadFolder.disabled = !preference.value || preference.locked; chooseFolder.disabled = !preference.value || preference.locked; + this.readCloudStorage().catch(Components.utils.reportError); // don't override the preference's value in UI return undefined; }, /** + * Show/Hide the cloud storage radio button with provider name as label if + * cloud storage provider is in use. + * Select cloud storage radio button if browser.download.useDownloadDir is true + * and browser.download.folderList has value 3. Enables/disables the folder field + * and Browse button if cloud storage radio button is selected. + * + */ + async readCloudStorage() { + // Get preferred provider in use display name + let providerDisplayName = await CloudStorage.getProviderIfInUse(); + if (providerDisplayName) { + // Show cloud storage radio button with provider name in label + let saveToCloudRadio = document.getElementById("saveToCloud"); + let cloudStrings = Services.strings.createBundle("resource://cloudstorage/preferences.properties"); + saveToCloudRadio.label = cloudStrings.formatStringFromName("saveFilesToCloudStorage", + [providerDisplayName], 1); + saveToCloudRadio.hidden = false; + + let useDownloadDirPref = document.getElementById("browser.download.useDownloadDir"); + let folderListPref = document.getElementById("browser.download.folderList"); + + // Check if useDownloadDir is true and folderListPref is set to Cloud Storage value 3 + // before selecting cloudStorageradio button. Disable folder field and Browse button if + // 'Save to Cloud Storage Provider' radio option is selected + if (useDownloadDirPref.value && folderListPref.value === 3) { + document.getElementById("saveWhere").selectedItem = saveToCloudRadio; + document.getElementById("downloadFolder").disabled = true; + document.getElementById("chooseFolder").disabled = true; + } + } + }, + + /** + * Handle clicks to 'Save To or ' and + * 'Save to ' if cloud storage radio button is displayed in UI. + * Sets browser.download.folderList value and Enables/disables the folder field and Browse + * button based on option selected. + */ + handleSaveToCommand(event) { + return this.handleSaveToCommandTask(event).catch(Components.utils.reportError); + }, + async handleSaveToCommandTask(event) { + if (event.target.id !== "saveToCloud" && event.target.id !== "saveTo") { + return; + } + // Check if Save To Cloud Storage Provider radio option is displayed in UI + // before continuing. + let saveToCloudRadio = document.getElementById("saveToCloud"); + if (!saveToCloudRadio.hidden) { + // When switching between SaveTo and SaveToCloud radio button + // with useDownloadDirPref value true, if selectedIndex is other than + // SaveTo radio button disable downloadFolder filefield and chooseFolder button + let saveWhere = document.getElementById("saveWhere"); + let useDownloadDirPref = document.getElementById("browser.download.useDownloadDir"); + if (useDownloadDirPref.value) { + let downloadFolder = document.getElementById("downloadFolder"); + let chooseFolder = document.getElementById("chooseFolder"); + downloadFolder.disabled = saveWhere.selectedIndex || useDownloadDirPref.locked; + chooseFolder.disabled = saveWhere.selectedIndex || useDownloadDirPref.locked; + } + + // Set folderListPref value depending on radio option + // selected. folderListPref should be set to 3 if Save To Cloud Storage Provider + // option is selected. If user switch back to 'Save To' custom path or system + // default Downloads, check pref 'browser.download.dir' before setting respective + // folderListPref value. If currentDirPref is unspecified folderList should + // default to 1 + let folderListPref = document.getElementById("browser.download.folderList"); + let saveTo = document.getElementById("saveTo"); + if (saveWhere.selectedItem == saveToCloudRadio) { + folderListPref.value = 3; + } else if (saveWhere.selectedItem == saveTo) { + let currentDirPref = document.getElementById("browser.download.dir"); + folderListPref.value = currentDirPref.value ? await this._folderToIndex(currentDirPref.value) : 1; + } + } + }, + + /** * Displays a file picker in which the user can choose the location where * downloads are automatically saved, updating preferences and UI in * response to the choice, if one is made. @@ -592,12 +678,21 @@ .QueryInterface(Components.interfaces.nsIFileProtocolHandler); var iconUrlSpec; + let folderIndex = folderListPref.value; + if (folderIndex == 3) { + // When user has selected cloud storage, use value in currentDirPref to + // compute index to display download folder label and icon to avoid + // displaying blank downloadFolder label and icon on load of preferences UI + // Set folderIndex to 1 if currentDirPref is unspecified + folderIndex = currentDirPref.value ? await this._folderToIndex(currentDirPref.value) : 1; + } + // Display a 'pretty' label or the path in the UI. - if (folderListPref.value == 2) { + if (folderIndex == 2) { // Custom path selected and is configured downloadFolder.label = this._getDisplayNameOfFile(currentDirPref.value); iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value); - } else if (folderListPref.value == 1) { + } else if (folderIndex == 1) { // 'Downloads' downloadFolder.label = bundlePreferences.getString("downloadsFolderName"); iconUrlSpec = fph.getURLSpecFromFile(await this._indexToFolder(1)); diff -Nru firefox-56.0~b4+build4/browser/components/preferences/in-content/main.xul firefox-56.0~b5+build1/browser/components/preferences/in-content/main.xul --- firefox-56.0~b4+build4/browser/components/preferences/in-content/main.xul 2017-08-19 12:28:04.000000000 +0000 +++ firefox-56.0~b5+build1/browser/components/preferences/in-content/main.xul 2017-08-22 06:02:53.000000000 +0000 @@ -280,10 +280,16 @@ /> + + + + value="false" + label="&alwaysAskWhere.label;" + accesskey="&alwaysAskWhere.accesskey;"/> diff -Nru firefox-56.0~b4+build4/browser/components/preferences/in-content-new/main.js firefox-56.0~b5+build1/browser/components/preferences/in-content-new/main.js --- firefox-56.0~b4+build4/browser/components/preferences/in-content-new/main.js 2017-08-19 12:28:04.000000000 +0000 +++ firefox-56.0~b5+build1/browser/components/preferences/in-content-new/main.js 2017-08-22 06:02:53.000000000 +0000 @@ -15,6 +15,8 @@ Components.utils.import("resource://gre/modules/AppConstants.jsm"); Components.utils.import("resource://gre/modules/DownloadUtils.jsm"); Components.utils.import("resource://gre/modules/LoadContextInfo.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "CloudStorage", + "resource://gre/modules/CloudStorage.jsm"); // Constants & Enumeration Values const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed"; @@ -409,6 +411,7 @@ setEventListener("actionColumn", "click", gMainPane.sort); setEventListener("chooseFolder", "command", gMainPane.chooseFolder); setEventListener("browser.download.dir", "change", gMainPane.displayDownloadDirPref); + setEventListener("saveWhere", "command", gMainPane.handleSaveToCommand); // Listen for window unload so we can remove our preference observers. window.addEventListener("unload", this); @@ -2249,6 +2252,8 @@ * 1 - The system's downloads folder is the default download location. * 2 - The default download location is elsewhere as specified in * browser.download.dir. + * 3 - The default download location is elsewhere as specified by + * cloud storage API getDownloadFolder * browser.download.downloadDir * deprecated. * browser.download.defaultFolder @@ -2266,11 +2271,91 @@ downloadFolder.disabled = !preference.value || preference.locked; chooseFolder.disabled = !preference.value || preference.locked; + this.readCloudStorage().catch(Components.utils.reportError); // don't override the preference's value in UI return undefined; }, /** + * Show/Hide the cloud storage radio button with provider name as label if + * cloud storage provider is in use. + * Select cloud storage radio button if browser.download.useDownloadDir is true + * and browser.download.folderList has value 3. Enables/disables the folder field + * and Browse button if cloud storage radio button is selected. + * + */ + async readCloudStorage() { + // Get preferred provider in use display name + let providerDisplayName = await CloudStorage.getProviderIfInUse(); + if (providerDisplayName) { + // Show cloud storage radio button with provider name in label + let saveToCloudRadio = document.getElementById("saveToCloud"); + let cloudStrings = Services.strings.createBundle("resource://cloudstorage/preferences.properties"); + saveToCloudRadio.label = cloudStrings.formatStringFromName("saveFilesToCloudStorage", + [providerDisplayName], 1); + saveToCloudRadio.hidden = false; + + let useDownloadDirPref = document.getElementById("browser.download.useDownloadDir"); + let folderListPref = document.getElementById("browser.download.folderList"); + + // Check if useDownloadDir is true and folderListPref is set to Cloud Storage value 3 + // before selecting cloudStorageradio button. Disable folder field and Browse button if + // 'Save to Cloud Storage Provider' radio option is selected + if (useDownloadDirPref.value && folderListPref.value === 3) { + document.getElementById("saveWhere").selectedItem = saveToCloudRadio; + document.getElementById("downloadFolder").disabled = true; + document.getElementById("chooseFolder").disabled = true; + } + } + }, + + /** + * Handle clicks to 'Save To or ' and + * 'Save to ' if cloud storage radio button is displayed in UI. + * Sets browser.download.folderList value and Enables/disables the folder field and Browse + * button based on option selected. + */ + handleSaveToCommand(event) { + return this.handleSaveToCommandTask(event).catch(Components.utils.reportError); + }, + async handleSaveToCommandTask(event) { + if (event.target.id !== "saveToCloud" && event.target.id !== "saveTo") { + return; + } + // Check if Save To Cloud Storage Provider radio option is displayed in UI + // before continuing. + let saveToCloudRadio = document.getElementById("saveToCloud"); + if (!saveToCloudRadio.hidden) { + // When switching between SaveTo and SaveToCloud radio button + // with useDownloadDirPref value true, if selectedIndex is other than + // SaveTo radio button disable downloadFolder filefield and chooseFolder button + let saveWhere = document.getElementById("saveWhere"); + let useDownloadDirPref = document.getElementById("browser.download.useDownloadDir"); + if (useDownloadDirPref.value) { + let downloadFolder = document.getElementById("downloadFolder"); + let chooseFolder = document.getElementById("chooseFolder"); + downloadFolder.disabled = saveWhere.selectedIndex || useDownloadDirPref.locked; + chooseFolder.disabled = saveWhere.selectedIndex || useDownloadDirPref.locked; + } + + // Set folderListPref value depending on radio option + // selected. folderListPref should be set to 3 if Save To Cloud Storage Provider + // option is selected. If user switch back to 'Save To' custom path or system + // default Downloads, check pref 'browser.download.dir' before setting respective + // folderListPref value. If currentDirPref is unspecified folderList should + // default to 1 + let folderListPref = document.getElementById("browser.download.folderList"); + let saveTo = document.getElementById("saveTo"); + if (saveWhere.selectedItem == saveToCloudRadio) { + folderListPref.value = 3; + } else if (saveWhere.selectedItem == saveTo) { + let currentDirPref = document.getElementById("browser.download.dir"); + folderListPref.value = currentDirPref.value ? await this._folderToIndex(currentDirPref.value) : 1; + } + } + }, + + /** * Displays a file picker in which the user can choose the location where * downloads are automatically saved, updating preferences and UI in * response to the choice, if one is made. @@ -2338,12 +2423,21 @@ .QueryInterface(Components.interfaces.nsIFileProtocolHandler); var iconUrlSpec; + let folderIndex = folderListPref.value; + if (folderIndex == 3) { + // When user has selected cloud storage, use value in currentDirPref to + // compute index to display download folder label and icon to avoid + // displaying blank downloadFolder label and icon on load of preferences UI + // Set folderIndex to 1 if currentDirPref is unspecified + folderIndex = currentDirPref.value ? await this._folderToIndex(currentDirPref.value) : 1; + } + // Display a 'pretty' label or the path in the UI. - if (folderListPref.value == 2) { + if (folderIndex == 2) { // Custom path selected and is configured downloadFolder.label = this._getDisplayNameOfFile(currentDirPref.value); iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value); - } else if (folderListPref.value == 1) { + } else if (folderIndex == 1) { // 'Downloads' downloadFolder.label = bundlePreferences.getString("downloadsFolderName"); iconUrlSpec = fph.getURLSpecFromFile(await this._indexToFolder(1)); diff -Nru firefox-56.0~b4+build4/browser/components/preferences/in-content-new/main.xul firefox-56.0~b5+build1/browser/components/preferences/in-content-new/main.xul --- firefox-56.0~b4+build4/browser/components/preferences/in-content-new/main.xul 2017-08-19 12:28:04.000000000 +0000 +++ firefox-56.0~b5+build1/browser/components/preferences/in-content-new/main.xul 2017-08-22 06:02:53.000000000 +0000 @@ -684,6 +684,10 @@ #endif /> + +