diff options
Diffstat (limited to 'toolkit')
96 files changed, 708 insertions, 1921 deletions
diff --git a/toolkit/.eslintrc.js b/toolkit/.eslintrc.js index 181f19f29..891a114b3 100644 --- a/toolkit/.eslintrc.js +++ b/toolkit/.eslintrc.js @@ -111,9 +111,6 @@ module.exports = { // No reassigning native JS objects "no-native-reassign": "error", - // No (!foo in bar) - "no-negated-in-lhs": "error", - // Nested ternary statements are confusing "no-nested-ternary": "error", diff --git a/toolkit/components/alerts/resources/content/alert.js b/toolkit/components/alerts/resources/content/alert.js index ce60ab0fa..12068b548 100644 --- a/toolkit/components/alerts/resources/content/alert.js +++ b/toolkit/components/alerts/resources/content/alert.js @@ -313,6 +313,7 @@ function onAlertClick() { let alertBox = document.getElementById("alertBox"); if (alertBox.getAttribute("animate") == "true") { // Closed when the animation ends. + alertBox.style.animationDuration = ".6s"; alertBox.setAttribute("clicked", "true"); } else { window.close(); @@ -355,6 +356,7 @@ function onAlertClose() { let alertBox = document.getElementById("alertBox"); if (alertBox.getAttribute("animate") == "true") { // Closed when the animation ends. + alertBox.style.animationDuration = ".6s"; alertBox.setAttribute("closing", "true"); } else { window.close(); diff --git a/toolkit/components/build/nsToolkitCompsModule.cpp b/toolkit/components/build/nsToolkitCompsModule.cpp index 22bb434a0..2c7287d8c 100644 --- a/toolkit/components/build/nsToolkitCompsModule.cpp +++ b/toolkit/components/build/nsToolkitCompsModule.cpp @@ -46,7 +46,7 @@ #include "NativeFileWatcherNotSupported.h" #endif // (XP_WIN) -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) #define MOZ_HAS_TERMINATOR #endif diff --git a/toolkit/components/captivedetect/captivedetect.js b/toolkit/components/captivedetect/captivedetect.js index 5493ecec6..0e8c75981 100644 --- a/toolkit/components/captivedetect/captivedetect.js +++ b/toolkit/components/captivedetect/captivedetect.js @@ -90,7 +90,7 @@ function LoginObserver(captivePortalDetector) { .getService(Ci.nsIHttpActivityDistributor); let urlFetcher = null; - let waitForNetworkActivity = Services.appinfo.widgetToolkit == "gonk"; + let waitForNetworkActivity = false; let pageCheckingDone = function pageCheckingDone() { if (state === LOGIN_OBSERVER_STATE_VERIFYING) { diff --git a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp b/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp index 950d3b487..7f3b8cd08 100644 --- a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp +++ b/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp @@ -145,9 +145,6 @@ static const mozilla::Module::ContractIDEntry kDiskSpaceWatcherContracts[] = { }; static const mozilla::Module::CategoryEntry kDiskSpaceWatcherCategories[] = { -#ifdef MOZ_WIDGET_GONK - { "profile-after-change", "Disk Space Watcher Service", DISKSPACEWATCHER_CONTRACTID }, -#endif { nullptr } }; diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index 7439d9d11..bee5bf269 100644 --- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm +++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm @@ -300,12 +300,7 @@ this.DownloadIntegration = { aDownload.hasBlockedData) { return true; } -#ifdef MOZ_B2G - // On B2G we keep a few days of history. - let maxTime = Date.now() - - Services.prefs.getIntPref("dom.downloads.max_retention_days") * 24 * 60 * 60 * 1000; - return aDownload.startTime > maxTime; -#elif defined(MOZ_WIDGET_ANDROID) +#if defined(MOZ_WIDGET_ANDROID) // On Android we store all history. return true; #else @@ -415,8 +410,6 @@ this.DownloadIntegration = { directoryPath = yield this.getPreferredDownloadsDirectory(); #elifdef MOZ_WIDGET_ANDROID directoryPath = yield this.getSystemDownloadsDirectory(); -#elifdef MOZ_WIDGET_GONK - directoryPath = yield this.getSystemDownloadsDirectory(); #else directoryPath = this._getDirectory("TmpD"); #endif diff --git a/toolkit/components/jsdownloads/src/DownloadPlatform.cpp b/toolkit/components/jsdownloads/src/DownloadPlatform.cpp index 1506b7c30..d91124ee6 100644 --- a/toolkit/components/jsdownloads/src/DownloadPlatform.cpp +++ b/toolkit/components/jsdownloads/src/DownloadPlatform.cpp @@ -102,7 +102,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIURI* aReferrer, nsIF const nsACString& aContentType, bool aIsPrivate) { #if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID) \ - || defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GONK) + || defined(MOZ_WIDGET_GTK) nsAutoString path; if (aTarget && NS_SUCCEEDED(aTarget->GetPath(path))) { diff --git a/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm b/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm index f5102b4a8..5bd351ee9 100644 --- a/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm +++ b/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm @@ -106,12 +106,7 @@ XPCOMUtils.defineLazyGetter(DownloadUIHelper, "strings", function () { */ this.DownloadPrompter = function (aParent) { - if (AppConstants.MOZ_B2G) { - // On B2G there is no prompter implementation. - this._prompter = null; - } else { - this._prompter = Services.ww.getNewPrompter(aParent); - } + this._prompter = Services.ww.getNewPrompter(aParent); } this.DownloadPrompter.prototype = { diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build index 5dba09a32..e0b412428 100644 --- a/toolkit/components/moz.build +++ b/toolkit/components/moz.build @@ -70,8 +70,7 @@ DIRS += [ if CONFIG['MOZ_WEBEXTENSIONS']: DIRS += ['webextensions'] -if CONFIG['ENABLE_INTL_API']: - DIRS += ['mozintl'] +DIRS += ['mozintl'] if not CONFIG['MOZ_FENNEC']: DIRS += ['narrate', 'viewsource']; diff --git a/toolkit/components/osfile/modules/osfile_async_front.jsm b/toolkit/components/osfile/modules/osfile_async_front.jsm index 181471cd8..964e53084 100644 --- a/toolkit/components/osfile/modules/osfile_async_front.jsm +++ b/toolkit/components/osfile/modules/osfile_async_front.jsm @@ -753,13 +753,13 @@ File.prototype = { }; -if (SharedAll.Constants.Sys.Name != "Android" && SharedAll.Constants.Sys.Name != "Gonk") { +if (SharedAll.Constants.Sys.Name != "Android") { /** * Set the last access and modification date of the file. * The time stamp resolution is 1 second at best, but might be worse * depending on the platform. * - * WARNING: This method is not implemented on Android/B2G. On Android/B2G, + * WARNING: This method is not implemented on Android. On Android, * you should use File.setDates instead. * * @return {promise} diff --git a/toolkit/components/osfile/modules/osfile_unix_front.jsm b/toolkit/components/osfile/modules/osfile_unix_front.jsm index 19a27ae1a..bd60d4d84 100644 --- a/toolkit/components/osfile/modules/osfile_unix_front.jsm +++ b/toolkit/components/osfile/modules/osfile_unix_front.jsm @@ -838,7 +838,7 @@ * implementation. */ File.DirectoryIterator.Entry.toMsg = function toMsg(value) { - if (!value instanceof File.DirectoryIterator.Entry) { + if (!(value instanceof File.DirectoryIterator.Entry)) { throw new TypeError("parameter of " + "File.DirectoryIterator.Entry.toMsg must be a " + "File.DirectoryIterator.Entry"); @@ -905,7 +905,7 @@ * is asymmetric and returns an object with a different implementation. */ File.Info.toMsg = function toMsg(stat) { - if (!stat instanceof File.Info) { + if (!(stat instanceof File.Info)) { throw new TypeError("parameter of File.Info.toMsg must be a File.Info"); } let serialized = {}; diff --git a/toolkit/components/osfile/modules/osfile_win_front.jsm b/toolkit/components/osfile/modules/osfile_win_front.jsm index 387dd08b5..1123b251c 100644 --- a/toolkit/components/osfile/modules/osfile_win_front.jsm +++ b/toolkit/components/osfile/modules/osfile_win_front.jsm @@ -909,7 +909,7 @@ * implementation. */ File.DirectoryIterator.Entry.toMsg = function toMsg(value) { - if (!value instanceof File.DirectoryIterator.Entry) { + if (!(value instanceof File.DirectoryIterator.Entry)) { throw new TypeError("parameter of " + "File.DirectoryIterator.Entry.toMsg must be a " + "File.DirectoryIterator.Entry"); @@ -958,7 +958,7 @@ * is asymmetric and returns an object with a different implementation. */ File.Info.toMsg = function toMsg(stat) { - if (!stat instanceof File.Info) { + if (!(stat instanceof File.Info)) { throw new TypeError("parameter of File.Info.toMsg must be a File.Info"); } let serialized = {}; diff --git a/toolkit/components/osfile/tests/xpcshell/test_constants.js b/toolkit/components/osfile/tests/xpcshell/test_constants.js index e92f33ab8..5b91484bd 100644 --- a/toolkit/components/osfile/tests/xpcshell/test_constants.js +++ b/toolkit/components/osfile/tests/xpcshell/test_constants.js @@ -15,12 +15,7 @@ add_task(function* check_definition() { do_check_true(OS.Constants.Path!=null); do_check_true(OS.Constants.Sys!=null); //check system name - if (OS.Constants.Sys.Name == "Gonk") { - // Services.appinfo.OS doesn't know the difference between Gonk and Android - do_check_eq(Services.appinfo.OS, "Android"); - } else { - do_check_eq(Services.appinfo.OS, OS.Constants.Sys.Name); - } + do_check_eq(Services.appinfo.OS, OS.Constants.Sys.Name); //check if using DEBUG build if (Components.classes["@mozilla.org/xpcom/debug;1"].getService(Components.interfaces.nsIDebug2).isDebugBuild == true) { diff --git a/toolkit/components/osfile/tests/xpcshell/test_osfile_async_setDates.js b/toolkit/components/osfile/tests/xpcshell/test_osfile_async_setDates.js index 17d3afa7c..6a5ecd5e3 100644 --- a/toolkit/components/osfile/tests/xpcshell/test_osfile_async_setDates.js +++ b/toolkit/components/osfile/tests/xpcshell/test_osfile_async_setDates.js @@ -96,8 +96,8 @@ add_task(function* test_nonproto() { // Prototypical tests, operating on |File| handles. add_task(function* test_proto() { - if (OS.Constants.Sys.Name == "Android" || OS.Constants.Sys.Name == "Gonk") { - do_print("File.prototype.setDates is not implemented for Android/B2G"); + if (OS.Constants.Sys.Name == "Android") { + do_print("File.prototype.setDates is not implemented for Android"); do_check_eq(OS.File.prototype.setDates, undefined); return; } @@ -107,7 +107,7 @@ add_task(function* test_proto() { "test_osfile_async_setDates_proto.tmp"); yield OS.File.writeAtomic(path, new Uint8Array(1)); - try { + try { let fd = yield OS.File.open(path, {write: true}); try { diff --git a/toolkit/components/osfile/tests/xpcshell/test_path_constants.js b/toolkit/components/osfile/tests/xpcshell/test_path_constants.js index c0057c750..9b9868bb2 100644 --- a/toolkit/components/osfile/tests/xpcshell/test_path_constants.js +++ b/toolkit/components/osfile/tests/xpcshell/test_path_constants.js @@ -58,7 +58,7 @@ add_task(function* test_simple_paths() { // Test presence of paths that only exist on Desktop platforms add_task(function* test_desktop_paths() { - if (OS.Constants.Sys.Name == "Android" || OS.Constants.Sys.Name == "Gonk") { + if (OS.Constants.Sys.Name == "Android") { return; } do_check_true(!!OS.Constants.Path.desktopDir); diff --git a/toolkit/components/printing/tests/browser.ini b/toolkit/components/printing/tests/browser.ini index 88d6bb454..5f2867189 100644 --- a/toolkit/components/printing/tests/browser.ini +++ b/toolkit/components/printing/tests/browser.ini @@ -1,2 +1,5 @@ [browser_page_change_print_original.js] +support-files = + file_page_change_print_original_1.html + file_page_change_print_original_2.html skip-if = os == "mac" diff --git a/toolkit/components/printing/tests/browser_page_change_print_original.js b/toolkit/components/printing/tests/browser_page_change_print_original.js index 5990a486b..864150451 100644 --- a/toolkit/components/printing/tests/browser_page_change_print_original.js +++ b/toolkit/components/printing/tests/browser_page_change_print_original.js @@ -3,8 +3,11 @@ * and we re-initialize print preview (e.g. by changing page orientation), * we still show (and will therefore print) the original contents. */ +const TEST_PATH = getRootDirectory(gTestPath) + .replace("chrome://mochitests/content", "http://example.com"); + add_task(function* pp_after_orientation_change() { - const DATA_URI = `data:text/html,<script>window.onafterprint = function() { setTimeout("window.location = 'data:text/plain,REPLACED PAGE!'", 0); }</script><pre>INITIAL PAGE</pre>`; + const URI = TEST_PATH + "file_page_change_print_original_1.html"; // Can only do something if we have a print preview UI: if (AppConstants.platform != "win" && AppConstants.platform != "linux") { ok(true, "Can't test if there's no print preview."); @@ -12,7 +15,7 @@ add_task(function* pp_after_orientation_change() { } // Ensure we get a browserStopped for this browser - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, DATA_URI, false, true); + let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, URI, false, true); let browserToPrint = tab.linkedBrowser; let ppBrowser = PrintPreviewListener.getPrintPreviewBrowser(); @@ -26,7 +29,7 @@ add_task(function* pp_after_orientation_change() { // Assert that we are showing the original page yield ContentTask.spawn(ppBrowser, null, function* () { - is(content.document.body.textContent, "INITIAL PAGE", "Should have initial page print previewed."); + is(content.document.body.textContent.trim(), "INITIAL PAGE", "Should have initial page print previewed."); }); yield originalTabNavigated; @@ -43,12 +46,12 @@ add_task(function* pp_after_orientation_change() { // Check that we're still showing the original page. yield ContentTask.spawn(ppBrowser, null, function* () { - is(content.document.body.textContent, "INITIAL PAGE", "Should still have initial page print previewed."); + is(content.document.body.textContent.trim(), "INITIAL PAGE", "Should still have initial page print previewed."); }); // Check that the other tab is definitely showing the new page: yield ContentTask.spawn(browserToPrint, null, function* () { - is(content.document.body.textContent, "REPLACED PAGE!", "Original page should have changed."); + is(content.document.body.textContent.trim(), "REPLACED PAGE!", "Original page should have changed."); }); PrintUtils.exitPrintPreview(); diff --git a/toolkit/components/printing/tests/file_page_change_print_original_1.html b/toolkit/components/printing/tests/file_page_change_print_original_1.html new file mode 100644 index 000000000..76e3be137 --- /dev/null +++ b/toolkit/components/printing/tests/file_page_change_print_original_1.html @@ -0,0 +1,8 @@ +<script> +window.onafterprint = function() { + setTimeout(function() { + window.location = "file_page_change_print_original_2.html" + }, 0); +} +</script> +<pre>INITIAL PAGE</pre> diff --git a/toolkit/components/printing/tests/file_page_change_print_original_2.html b/toolkit/components/printing/tests/file_page_change_print_original_2.html new file mode 100644 index 000000000..44f33281c --- /dev/null +++ b/toolkit/components/printing/tests/file_page_change_print_original_2.html @@ -0,0 +1 @@ +REPLACED PAGE! diff --git a/toolkit/components/reader/.eslintrc.js b/toolkit/components/reader/.eslintrc.js index 1c09e0bf7..617c1f9cf 100644 --- a/toolkit/components/reader/.eslintrc.js +++ b/toolkit/components/reader/.eslintrc.js @@ -109,9 +109,6 @@ module.exports = { // No reassigning native JS objects "no-native-reassign": "error", - // No (!foo in bar) - "no-negated-in-lhs": "error", - // Nested ternary statements are confusing "no-nested-ternary": "error", diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js index fb3f69f4c..9f9003516 100644 --- a/toolkit/components/search/nsSearchService.js +++ b/toolkit/components/search/nsSearchService.js @@ -23,8 +23,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch", "resource://gre/modules/TelemetryStopwatch.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", - "resource://gre/modules/Deprecated.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "SearchStaticData", "resource://gre/modules/SearchStaticData.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "setTimeout", @@ -2695,13 +2693,6 @@ SearchService.prototype = { return; } - let warning = - "Search service falling back to synchronous initialization. " + - "This is generally the consequence of an add-on using a deprecated " + - "search service API."; - Deprecated.warning(warning, "https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIBrowserSearchService#async_warning"); - LOG(warning); - this._syncInit(); if (!Components.isSuccessCode(this._initRV)) { throw this._initRV; diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp index 85d5afdf9..fde00d1db 100644 --- a/toolkit/components/startup/nsAppStartup.cpp +++ b/toolkit/components/startup/nsAppStartup.cpp @@ -237,7 +237,7 @@ NS_IMPL_ISUPPORTS(nsAppStartup, NS_IMETHODIMP nsAppStartup::CreateHiddenWindow() { -#if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_UIKIT) +#if defined(MOZ_WIDGET_UIKIT) return NS_OK; #else nsCOMPtr<nsIAppShellService> appShellService @@ -252,7 +252,7 @@ nsAppStartup::CreateHiddenWindow() NS_IMETHODIMP nsAppStartup::DestroyHiddenWindow() { -#if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_UIKIT) +#if defined(MOZ_WIDGET_UIKIT) return NS_OK; #else nsCOMPtr<nsIAppShellService> appShellService diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index ad2263c9b..6dbd59bcf 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -1127,7 +1127,7 @@ TelemetryImpl::SnapshotSubsessionHistograms(bool clearSubsession, JSContext *cx, JS::MutableHandle<JS::Value> ret) { -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) return TelemetryHistogram::CreateHistogramSnapshots(cx, ret, true, clearSubsession); #else diff --git a/toolkit/components/telemetry/TelemetryEnvironment.jsm b/toolkit/components/telemetry/TelemetryEnvironment.jsm index 910d804ae..295679ca4 100644 --- a/toolkit/components/telemetry/TelemetryEnvironment.jsm +++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm @@ -28,11 +28,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "AttributionCode", "resource:///modules/AttributionCode.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "ctypes", "resource://gre/modules/ctypes.jsm"); -if (AppConstants.platform !== "gonk") { - Cu.import("resource://gre/modules/AddonManager.jsm"); - XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager", - "resource://gre/modules/LightweightThemeManager.jsm"); -} +Cu.import("resource://gre/modules/AddonManager.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager", + "resource://gre/modules/LightweightThemeManager.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "ProfileAge", "resource://gre/modules/ProfileAge.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils", @@ -528,11 +526,9 @@ EnvironmentAddonBuilder.prototype = { _updateAddons: Task.async(function* () { this._environment._log.trace("_updateAddons"); let personaId = null; - if (AppConstants.platform !== "gonk") { - let theme = LightweightThemeManager.currentTheme; - if (theme) { - personaId = theme.id; - } + let theme = LightweightThemeManager.currentTheme; + if (theme) { + personaId = theme.id; } let addons = { @@ -745,14 +741,8 @@ function EnvironmentCache() { // until the initial environment has been built. let p = []; - if (AppConstants.platform === "gonk") { - this._addonBuilder = { - watchForChanges: function() {} - }; - } else { - this._addonBuilder = new EnvironmentAddonBuilder(this); - p = [ this._addonBuilder.init() ]; - } + this._addonBuilder = new EnvironmentAddonBuilder(this); + p = [ this._addonBuilder.init() ]; this._currentEnvironment.profile = {}; p.push(this._updateProfile()); @@ -1079,10 +1069,6 @@ EnvironmentCache.prototype = { * @returns null on error, true if we are the default browser, or false otherwise. */ _isDefaultBrowser: function () { - if (AppConstants.platform === "gonk") { - return true; - } - if (!("@mozilla.org/browser/shell-service;1" in Cc)) { this._log.info("_isDefaultBrowser - Could not obtain browser shell service"); return null; @@ -1139,10 +1125,8 @@ EnvironmentCache.prototype = { userPrefs: this._getPrefData(), }; - if (AppConstants.platform !== "gonk") { - this._currentEnvironment.settings.addonCompatibilityCheckEnabled = - AddonManager.checkCompatibility; - } + this._currentEnvironment.settings.addonCompatibilityCheckEnabled = + AddonManager.checkCompatibility; if (AppConstants.platform !== "android") { this._currentEnvironment.settings.isDefaultBrowser = @@ -1246,7 +1230,7 @@ EnvironmentCache.prototype = { * not a portable device. */ _getDeviceData: function () { - if (!["gonk", "android"].includes(AppConstants.platform)) { + if (!["android"].includes(AppConstants.platform)) { return null; } @@ -1269,7 +1253,7 @@ EnvironmentCache.prototype = { locale: forceToStringOrNull(getSystemLocale()), }; - if (["gonk", "android"].includes(AppConstants.platform)) { + if (["android"].includes(AppConstants.platform)) { data.kernelVersion = forceToStringOrNull(getSysinfoProperty("kernel_version", null)); } else if (AppConstants.platform === "win") { // The path to the "UBR" key, queried to get additional version details on Windows. @@ -1333,7 +1317,7 @@ EnvironmentCache.prototype = { features: {}, }; - if (!["gonk", "android", "linux"].includes(AppConstants.platform)) { + if (!["android", "linux"].includes(AppConstants.platform)) { let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo); try { gfxData.monitors = gfxInfo.getMonitors(); @@ -1398,7 +1382,7 @@ EnvironmentCache.prototype = { if (AppConstants.platform === "win") { data.isWow64 = getSysinfoProperty("isWow64", null); - } else if (["gonk", "android"].includes(AppConstants.platform)) { + } else if (["android"].includes(AppConstants.platform)) { data.device = this._getDeviceData(); } diff --git a/toolkit/components/telemetry/TelemetryHistogram.cpp b/toolkit/components/telemetry/TelemetryHistogram.cpp index abae9c613..ba0288979 100644 --- a/toolkit/components/telemetry/TelemetryHistogram.cpp +++ b/toolkit/components/telemetry/TelemetryHistogram.cpp @@ -583,7 +583,7 @@ internal_GetHistogramByName(const nsACString &name, Histogram **ret) } -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) /** * This clones a histogram |existing| with the id |existingId| to a @@ -684,7 +684,7 @@ internal_HistogramAdd(Histogram& histogram, int32_t value, uint32_t dataset) return NS_OK; } -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) if (Histogram* subsession = internal_GetSubsessionHistogram(histogram)) { subsession->Add(value); } @@ -729,7 +729,7 @@ internal_HistogramClear(Histogram& aHistogram, bool onlySubsession) aHistogram.Clear(); } -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) if (Histogram* subsession = internal_GetSubsessionHistogram(aHistogram)) { subsession->Clear(); } @@ -926,7 +926,7 @@ private: typedef nsBaseHashtableET<nsCStringHashKey, Histogram*> KeyedHistogramEntry; typedef AutoHashtable<KeyedHistogramEntry> KeyedHistogramMapType; KeyedHistogramMapType mHistogramMap; -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) KeyedHistogramMapType mSubsessionMap; #endif @@ -950,7 +950,7 @@ KeyedHistogram::KeyedHistogram(const nsACString &name, uint32_t min, uint32_t max, uint32_t bucketCount, uint32_t dataset) : mHistogramMap() -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) , mSubsessionMap() #endif , mName(name) @@ -968,7 +968,7 @@ nsresult KeyedHistogram::GetHistogram(const nsCString& key, Histogram** histogram, bool subsession) { -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) KeyedHistogramMapType& map = subsession ? mSubsessionMap : mHistogramMap; #else KeyedHistogramMapType& map = mHistogramMap; @@ -980,7 +980,7 @@ KeyedHistogram::GetHistogram(const nsCString& key, Histogram** histogram, } nsCString histogramName; -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) if (subsession) { histogramName.AppendLiteral(SUBSESSION_HISTOGRAM_PREFIX); } @@ -1042,7 +1042,7 @@ KeyedHistogram::Add(const nsCString& key, uint32_t sample) if (!histogram) { return NS_ERROR_FAILURE; } -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) Histogram* subsession = GetHistogram(key, true); MOZ_ASSERT(subsession); if (!subsession) { @@ -1055,7 +1055,7 @@ KeyedHistogram::Add(const nsCString& key, uint32_t sample) } histogram->Add(sample); -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) subsession->Add(sample); #endif return NS_OK; @@ -1068,7 +1068,7 @@ KeyedHistogram::Clear(bool onlySubsession) if (!XRE_IsParentProcess()) { return; } -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) for (auto iter = mSubsessionMap.Iter(); !iter.Done(); iter.Next()) { iter.Get()->mData->Clear(); } @@ -1137,7 +1137,7 @@ nsresult KeyedHistogram::GetJSSnapshot(JSContext* cx, JS::Handle<JSObject*> obj, bool subsession, bool clearSubsession) { -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) KeyedHistogramMapType& map = subsession ? mSubsessionMap : mHistogramMap; #else KeyedHistogramMapType& map = mHistogramMap; @@ -1146,7 +1146,7 @@ KeyedHistogram::GetJSSnapshot(JSContext* cx, JS::Handle<JSObject*> obj, return NS_ERROR_FAILURE; } -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) if (subsession && clearSubsession) { Clear(true); } @@ -1637,7 +1637,7 @@ internal_JSHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp) } bool onlySubsession = false; -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); if (args.length() >= 1) { @@ -1874,7 +1874,7 @@ internal_JSKeyedHistogram_Snapshot(JSContext *cx, unsigned argc, JS::Value *vp) return internal_KeyedHistogram_SnapshotImpl(cx, argc, vp, false, false); } -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) bool internal_JSKeyedHistogram_SubsessionSnapshot(JSContext *cx, unsigned argc, JS::Value *vp) @@ -1883,7 +1883,7 @@ internal_JSKeyedHistogram_SubsessionSnapshot(JSContext *cx, } #endif -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) bool internal_JSKeyedHistogram_SnapshotSubsessionAndClear(JSContext *cx, unsigned argc, @@ -1911,7 +1911,7 @@ internal_JSKeyedHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp) return false; } -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) bool onlySubsession = false; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1974,7 +1974,7 @@ internal_WrapAndReturnKeyedHistogram(KeyedHistogram *h, JSContext *cx, if (!(JS_DefineFunction(cx, obj, "add", internal_JSKeyedHistogram_Add, 2, 0) && JS_DefineFunction(cx, obj, "snapshot", internal_JSKeyedHistogram_Snapshot, 1, 0) -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) && JS_DefineFunction(cx, obj, "subsessionSnapshot", internal_JSKeyedHistogram_SubsessionSnapshot, 1, 0) && JS_DefineFunction(cx, obj, "snapshotSubsessionAndClear", @@ -2425,7 +2425,7 @@ TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx, } Histogram* original = h; -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) if (subsession) { h = internal_GetSubsessionHistogram(*h); if (!h) { @@ -2453,7 +2453,7 @@ TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx, } } -#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +#if !defined(MOZ_WIDGET_ANDROID) if (subsession && clearSubsession) { h->Clear(); } diff --git a/toolkit/components/telemetry/TelemetrySession.jsm b/toolkit/components/telemetry/TelemetrySession.jsm index 3d97dc155..179e6436a 100644 --- a/toolkit/components/telemetry/TelemetrySession.jsm +++ b/toolkit/components/telemetry/TelemetrySession.jsm @@ -1372,7 +1372,7 @@ var Impl = { let payload; try { - const isMobile = ["gonk", "android"].includes(AppConstants.platform); + const isMobile = ["android"].includes(AppConstants.platform); const isSubsession = isMobile ? false : !this._isClassicReason(reason); if (isMobile) { diff --git a/toolkit/components/telemetry/TelemetryStorage.jsm b/toolkit/components/telemetry/TelemetryStorage.jsm index 91cfc993d..c844aacf0 100644 --- a/toolkit/components/telemetry/TelemetryStorage.jsm +++ b/toolkit/components/telemetry/TelemetryStorage.jsm @@ -106,7 +106,7 @@ PingParseError.prototype.constructor = PingParseError; var Policy = { now: () => new Date(), getArchiveQuota: () => ARCHIVE_QUOTA_BYTES, - getPendingPingsQuota: () => (AppConstants.platform in ["android", "gonk"]) + getPendingPingsQuota: () => (AppConstants.platform in ["android"]) ? PENDING_PINGS_QUOTA_BYTES_MOBILE : PENDING_PINGS_QUOTA_BYTES_DESKTOP, }; diff --git a/toolkit/components/telemetry/tests/unit/head.js b/toolkit/components/telemetry/tests/unit/head.js index 51be25766..87afd3617 100644 --- a/toolkit/components/telemetry/tests/unit/head.js +++ b/toolkit/components/telemetry/tests/unit/head.js @@ -20,7 +20,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS", const gIsWindows = AppConstants.platform == "win"; const gIsMac = AppConstants.platform == "macosx"; const gIsAndroid = AppConstants.platform == "android"; -const gIsGonk = AppConstants.platform == "gonk"; +const gIsGonk = false; const gIsLinux = AppConstants.platform == "linux"; const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry); diff --git a/toolkit/components/viewsource/content/viewSource-content.js b/toolkit/components/viewsource/content/viewSource-content.js index fa1dd19f1..70d23eaa4 100644 --- a/toolkit/components/viewsource/content/viewSource-content.js +++ b/toolkit/components/viewsource/content/viewSource-content.js @@ -330,6 +330,8 @@ var ViewSourceContent = { .createInstance(Ci.nsISHEntry); shEntry.setURI(BrowserUtils.makeURI(viewSrcURL, null, null)); shEntry.setTitle(viewSrcURL); + let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal(); + shEntry.triggeringPrincipal = systemPrincipal; shEntry.loadType = Ci.nsIDocShellLoadInfo.loadHistory; shEntry.cacheKey = shEntrySource.cacheKey; docShell.QueryInterface(Ci.nsIWebNavigation) diff --git a/toolkit/components/webextensions/.eslintrc.js b/toolkit/components/webextensions/.eslintrc.js index 70196fc6a..70f91ab6d 100644 --- a/toolkit/components/webextensions/.eslintrc.js +++ b/toolkit/components/webextensions/.eslintrc.js @@ -173,9 +173,6 @@ module.exports = { // eslint-disable-line no-undef // No reassigning native JS objects "no-native-reassign": "error", - // No (!foo in bar) - "no-negated-in-lhs": "error", - // Nested ternary statements are confusing "no-nested-ternary": "error", diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index e9087dfcb..7209b7ad0 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -497,26 +497,7 @@ var snapshotFormatters = { $("prefs-user-js-section").style.display = ""; // Clear the no-copy class $("prefs-user-js-section").className = ""; - }, - - sandbox: function sandbox(data) { - if (!AppConstants.MOZ_SANDBOX) - return; - - let strings = stringBundle(); - let tbody = $("sandbox-tbody"); - for (let key in data) { - // Simplify the display a little in the common case. - if (key === "hasPrivilegedUserNamespaces" && - data[key] === data["hasUserNamespaces"]) { - continue; - } - tbody.appendChild($.new("tr", [ - $.new("th", strings.GetStringFromName(key), "column"), - $.new("td", data[key]) - ])); - } - }, + } }; var $ = document.getElementById.bind(document); diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml index 9574365a3..a92dcfb4a 100644 --- a/toolkit/content/aboutSupport.xhtml +++ b/toolkit/content/aboutSupport.xhtml @@ -475,20 +475,6 @@ </tbody> </table> - - <!-- - - - - - - - - - - - - - - - - - - - - --> - -#if defined(MOZ_SANDBOX) - <h2 class="major-section" id="sandbox"> - &aboutSupport.sandboxTitle; - </h2> - - <table> - <tbody id="sandbox-tbody"> - </tbody> - </table> -#endif - </div> </body> diff --git a/toolkit/content/license.html b/toolkit/content/license.html index 45889a191..a348fdfa6 100644 --- a/toolkit/content/license.html +++ b/toolkit/content/license.html @@ -103,7 +103,6 @@ <li><a href="about:license#icu">ICU License</a></li> <li><a href="about:license#immutable">Immutable.js License</a></li> <li><a href="about:license#jpnic">Japan Network Information Center License</a></li> - <li><a href="about:license#jemalloc">jemalloc License</a></li> <li><a href="about:license#jquery">jQuery License</a></li> <li><a href="about:license#k_exp">k_exp License</a></li> <li><a href="about:license#khronos">Khronos group License</a></li> @@ -3527,46 +3526,6 @@ Chiyoda-ku, Tokyo 101-0047, Japan. <hr> - <h1><a id="jemalloc"></a>jemalloc License</h1> - - <p>This license applies to files in the directories - <span class="path">memory/mozjemalloc/</span> and - <span class="path">memory/jemalloc/</span>. - </p> - -<pre> -Copyright (C) 2002-2012 Jason Evans <jasone@canonware.com>. -All rights reserved. -Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved. -Copyright (C) 2009-2012 Facebook, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice(s), this list of conditions and the following disclaimer as - the first lines of this file unmodified other than the possible - addition of one or more copyright notices. -2. Redistributions in binary form must reproduce the above copyright - notice(s), this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -</pre> - - <hr> - <h1><a id="jquery"></a>jQuery License</h1> <p>This license applies to all copies of jQuery in the code.</p> diff --git a/toolkit/content/widgets/browser.xml b/toolkit/content/widgets/browser.xml index a5f37b62a..e595c847d 100644 --- a/toolkit/content/widgets/browser.xml +++ b/toolkit/content/widgets/browser.xml @@ -135,6 +135,7 @@ aURI = "about:blank"; var aReferrerPolicy = Components.interfaces.nsIHttpChannel.REFERRER_POLICY_DEFAULT; + var aTriggeringPrincipal; // Check for loadURIWithFlags(uri, { ... }); var params = arguments[1]; @@ -144,6 +145,9 @@ if ('referrerPolicy' in params) { aReferrerPolicy = params.referrerPolicy; } + if ("triggeringPrincipal" in params) { + aTriggeringPrincipal = params.triggeringPrincipal; + } aCharset = params.charset; aPostData = params.postData; } @@ -151,7 +155,7 @@ this._wrapURIChangeCall(() => this.webNavigation.loadURIWithOptions( aURI, aFlags, aReferrerURI, aReferrerPolicy, - aPostData, null, null)); + aPostData, null, null, aTriggeringPrincipal)); ]]> </body> </method> diff --git a/toolkit/content/widgets/datetimepopup.xml b/toolkit/content/widgets/datetimepopup.xml index b4335e1ce..19e7b4f8a 100644 --- a/toolkit/content/widgets/datetimepopup.xml +++ b/toolkit/content/widgets/datetimepopup.xml @@ -26,8 +26,8 @@ this.l10n = {}; const mozIntl = Components.classes["@mozilla.org/mozintl;1"] .getService(Components.interfaces.mozIMozIntl); - mozIntl.addGetCalendarInfo(l10n); - mozIntl.addGetDisplayNames(l10n); + mozIntl.addGetCalendarInfo(this.l10n); + mozIntl.addGetDisplayNames(this.l10n); // Notify DateTimePickerHelper.jsm that binding is ready. this.dispatchEvent(new CustomEvent("DateTimePickerBindingReady")); ]]></constructor> diff --git a/toolkit/crashreporter/crashreporter.mozbuild b/toolkit/crashreporter/crashreporter.mozbuild index b8c639175..a9824517c 100644 --- a/toolkit/crashreporter/crashreporter.mozbuild +++ b/toolkit/crashreporter/crashreporter.mozbuild @@ -21,7 +21,4 @@ elif CONFIG['GNU_CXX']: if CONFIG['CLANG_CXX']: CXXFLAGS += ['-Wno-implicit-fallthrough'] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - DEFINES['ELFSIZE'] = 32 - DEFINES['NO_STABS_SUPPORT'] = True diff --git a/toolkit/crashreporter/google-breakpad/src/client/linux/moz.build b/toolkit/crashreporter/google-breakpad/src/client/linux/moz.build index 71a438940..9bb8bace3 100644 --- a/toolkit/crashreporter/google-breakpad/src/client/linux/moz.build +++ b/toolkit/crashreporter/google-breakpad/src/client/linux/moz.build @@ -32,7 +32,4 @@ if CONFIG['OS_TARGET'] == 'Android' and CONFIG['CPU_ARCH'] == 'x86': # The NDK's user.h defines this struct with a different name. DEFINES['user_fpxregs_struct'] = 'user_fxsr_struct' -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - DEFINES['getcontext'] = 'breakpad_getcontext' - include('/toolkit/crashreporter/crashreporter.mozbuild') diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index 1e0743192..0d1286bdc 100644 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -1527,11 +1527,9 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory, if (gExceptionHandler) return NS_ERROR_ALREADY_INITIALIZED; -#if !defined(DEBUG) || defined(MOZ_WIDGET_GONK) +#if !defined(DEBUG) // In non-debug builds, enable the crash reporter by default, and allow // disabling it with the MOZ_CRASHREPORTER_DISABLE environment variable. - // Also enable it by default in debug gonk builds as it is difficult to - // set environment on startup. const char *envvar = PR_GetEnv("MOZ_CRASHREPORTER_DISABLE"); if (envvar && *envvar && !force) return NS_OK; @@ -1543,10 +1541,7 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory, return NS_OK; #endif -#if defined(MOZ_WIDGET_GONK) - doReport = false; - headlessClient = true; -#elif defined(XP_WIN) +#if defined(XP_WIN) doReport = ShouldReport(); #else // this environment variable prevents us from launching @@ -3417,22 +3412,10 @@ OOPInit() #if (defined(XP_WIN) || defined(XP_MACOSX)) nsCOMPtr<nsIFile> tmpDir; -# if defined(MOZ_CONTENT_SANDBOX) - nsresult rv = NS_GetSpecialDirectory(NS_APP_CONTENT_PROCESS_TEMP_DIR, - getter_AddRefs(tmpDir)); - if (NS_FAILED(rv) && PR_GetEnv("XPCSHELL_TEST_PROFILE_DIR")) { - // Temporary hack for xpcshell, will be fixed in bug 1257098 - rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tmpDir)); - } - if (NS_SUCCEEDED(rv)) { - childProcessTmpDir = CreatePathFromFile(tmpDir); - } -# else if (NS_SUCCEEDED(NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tmpDir)))) { childProcessTmpDir = CreatePathFromFile(tmpDir); } -# endif // defined(MOZ_CONTENT_SANDBOX) #endif // (defined(XP_WIN) || defined(XP_MACOSX)) #if defined(XP_WIN) diff --git a/toolkit/identity/FirefoxAccounts.jsm b/toolkit/identity/FirefoxAccounts.jsm index 54efaf3b4..1d2ed0439 100644 --- a/toolkit/identity/FirefoxAccounts.jsm +++ b/toolkit/identity/FirefoxAccounts.jsm @@ -35,18 +35,11 @@ var log = Log.repository.getLogger("Identity.FxAccounts"); log.level = LOG_LEVEL; log.addAppender(new Log.ConsoleAppender(new Log.BasicFormatter())); -#ifdef MOZ_B2G -XPCOMUtils.defineLazyModuleGetter(this, "FxAccountsManager", - "resource://gre/modules/FxAccountsManager.jsm", - "FxAccountsManager"); -Cu.import("resource://gre/modules/FxAccountsCommon.js"); -#else -log.warn("The FxAccountsManager is only functional in B2G at this time."); +log.warn("The FxAccountsManager has been removed."); var FxAccountsManager = null; var ONVERIFIED_NOTIFICATION = null; var ONLOGIN_NOTIFICATION = null; var ONLOGOUT_NOTIFICATION = null; -#endif function FxAccountsService() { Services.obs.addObserver(this, "quit-application-granted", false); diff --git a/toolkit/identity/tests/unit/xpcshell.ini b/toolkit/identity/tests/unit/xpcshell.ini index 8ef9b79bc..38b37402c 100644 --- a/toolkit/identity/tests/unit/xpcshell.ini +++ b/toolkit/identity/tests/unit/xpcshell.ini @@ -1,7 +1,7 @@ [DEFAULT] head = head_identity.js tail = tail_identity.js -skip-if = (appname != "b2g" || toolkit == 'gonk') +skip-if = true support-files = data/idp_1/.well-known/browserid data/idp_invalid_1/.well-known/browserid diff --git a/toolkit/jetpack/dev/volcan.js b/toolkit/jetpack/dev/volcan.js index 6a68ed12d..7ec208eec 100644 --- a/toolkit/jetpack/dev/volcan.js +++ b/toolkit/jetpack/dev/volcan.js @@ -139,7 +139,7 @@ var Client = Class({ .then(this.onReady.bind(this, this.root), this.onFail); } else { var actor = this.get(packet.from) || this.root; - var event = actor.events[packet.type]; + event = actor.events[packet.type]; if (event) { var message = new MessageEvent(packet.type, { data: event.read(packet) diff --git a/toolkit/jetpack/moz.build b/toolkit/jetpack/moz.build index 2e5dbe5e8..22be010d6 100644 --- a/toolkit/jetpack/moz.build +++ b/toolkit/jetpack/moz.build @@ -12,116 +12,115 @@ EXTRA_JS_MODULES.sdk.system += [ 'modules/system/Startup.js', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] != "gonk": - EXTRA_JS_MODULES.commonjs.method.test += [ - 'method/test/browser.js', - 'method/test/common.js', - ] +EXTRA_JS_MODULES.commonjs.method.test += [ + 'method/test/browser.js', + 'method/test/common.js', +] - EXTRA_JS_MODULES.commonjs.sdk.deprecated += [ - 'sdk/deprecated/api-utils.js', - 'sdk/deprecated/sync-worker.js', - 'sdk/deprecated/unit-test-finder.js', - 'sdk/deprecated/unit-test.js', - 'sdk/deprecated/window-utils.js', - ] +EXTRA_JS_MODULES.commonjs.sdk.deprecated += [ + 'sdk/deprecated/api-utils.js', + 'sdk/deprecated/sync-worker.js', + 'sdk/deprecated/unit-test-finder.js', + 'sdk/deprecated/unit-test.js', + 'sdk/deprecated/window-utils.js', +] - EXTRA_JS_MODULES.commonjs.sdk.frame += [ - 'sdk/frame/hidden-frame.js', - 'sdk/frame/utils.js', - ] +EXTRA_JS_MODULES.commonjs.sdk.frame += [ + 'sdk/frame/hidden-frame.js', + 'sdk/frame/utils.js', +] - EXTRA_JS_MODULES.commonjs.sdk.panel += [ - 'sdk/panel/events.js', - 'sdk/panel/utils.js', - ] +EXTRA_JS_MODULES.commonjs.sdk.panel += [ + 'sdk/panel/events.js', + 'sdk/panel/utils.js', +] - EXTRA_JS_MODULES.commonjs.sdk.places += [ - 'sdk/places/bookmarks.js', - 'sdk/places/contract.js', - 'sdk/places/events.js', - 'sdk/places/favicon.js', - 'sdk/places/history.js', - 'sdk/places/utils.js', - ] +EXTRA_JS_MODULES.commonjs.sdk.places += [ + 'sdk/places/bookmarks.js', + 'sdk/places/contract.js', + 'sdk/places/events.js', + 'sdk/places/favicon.js', + 'sdk/places/history.js', + 'sdk/places/utils.js', +] - EXTRA_JS_MODULES.commonjs.sdk.places.host += [ - 'sdk/places/host/host-bookmarks.js', - 'sdk/places/host/host-query.js', - 'sdk/places/host/host-tags.js', - ] +EXTRA_JS_MODULES.commonjs.sdk.places.host += [ + 'sdk/places/host/host-bookmarks.js', + 'sdk/places/host/host-query.js', + 'sdk/places/host/host-tags.js', +] - EXTRA_JS_MODULES.commonjs.sdk.tabs += [ - 'sdk/tabs/common.js', - 'sdk/tabs/events.js', - 'sdk/tabs/helpers.js', - 'sdk/tabs/namespace.js', - 'sdk/tabs/observer.js', - 'sdk/tabs/tab-fennec.js', - 'sdk/tabs/tab-firefox.js', - 'sdk/tabs/tab.js', - 'sdk/tabs/tabs-firefox.js', - 'sdk/tabs/utils.js', - 'sdk/tabs/worker.js', - ] +EXTRA_JS_MODULES.commonjs.sdk.tabs += [ + 'sdk/tabs/common.js', + 'sdk/tabs/events.js', + 'sdk/tabs/helpers.js', + 'sdk/tabs/namespace.js', + 'sdk/tabs/observer.js', + 'sdk/tabs/tab-fennec.js', + 'sdk/tabs/tab-firefox.js', + 'sdk/tabs/tab.js', + 'sdk/tabs/tabs-firefox.js', + 'sdk/tabs/utils.js', + 'sdk/tabs/worker.js', +] - EXTRA_JS_MODULES.commonjs.sdk.test += [ - 'sdk/test/assert.js', - 'sdk/test/harness.js', - 'sdk/test/httpd.js', - 'sdk/test/loader.js', - 'sdk/test/memory.js', - 'sdk/test/options.js', - 'sdk/test/runner.js', - 'sdk/test/utils.js', - ] +EXTRA_JS_MODULES.commonjs.sdk.test += [ + 'sdk/test/assert.js', + 'sdk/test/harness.js', + 'sdk/test/httpd.js', + 'sdk/test/loader.js', + 'sdk/test/memory.js', + 'sdk/test/options.js', + 'sdk/test/runner.js', + 'sdk/test/utils.js', +] + +EXTRA_JS_MODULES.commonjs.sdk.ui += [ + 'sdk/ui/component.js', + 'sdk/ui/frame.js', + 'sdk/ui/id.js', + 'sdk/ui/sidebar.js', + 'sdk/ui/state.js', + 'sdk/ui/toolbar.js', +] +if CONFIG['MC_PALEMOON']: EXTRA_JS_MODULES.commonjs.sdk.ui += [ - 'sdk/ui/component.js', - 'sdk/ui/frame.js', - 'sdk/ui/id.js', - 'sdk/ui/sidebar.js', - 'sdk/ui/state.js', - 'sdk/ui/toolbar.js', + 'sdk/ui/buttons.js', ] - if CONFIG['MC_PALEMOON']: - EXTRA_JS_MODULES.commonjs.sdk.ui += [ - 'sdk/ui/buttons.js', - ] - - EXTRA_JS_MODULES.commonjs.sdk.ui.button += [ - 'sdk/ui/button/action.js', - 'sdk/ui/button/contract.js', - 'sdk/ui/button/toggle.js', - ] +EXTRA_JS_MODULES.commonjs.sdk.ui.button += [ + 'sdk/ui/button/action.js', + 'sdk/ui/button/contract.js', + 'sdk/ui/button/toggle.js', +] - EXTRA_PP_JS_MODULES.commonjs.sdk.ui.button += [ - 'sdk/ui/button/view.js', - ] +EXTRA_PP_JS_MODULES.commonjs.sdk.ui.button += [ + 'sdk/ui/button/view.js', +] - EXTRA_JS_MODULES.commonjs.sdk.ui.sidebar += [ - 'sdk/ui/sidebar/actions.js', - 'sdk/ui/sidebar/contract.js', - 'sdk/ui/sidebar/namespace.js', - 'sdk/ui/sidebar/utils.js', - 'sdk/ui/sidebar/view.js', - ] +EXTRA_JS_MODULES.commonjs.sdk.ui.sidebar += [ + 'sdk/ui/sidebar/actions.js', + 'sdk/ui/sidebar/contract.js', + 'sdk/ui/sidebar/namespace.js', + 'sdk/ui/sidebar/utils.js', + 'sdk/ui/sidebar/view.js', +] - EXTRA_JS_MODULES.commonjs.sdk.window += [ - 'sdk/window/browser.js', - 'sdk/window/events.js', - 'sdk/window/helpers.js', - 'sdk/window/namespace.js', - 'sdk/window/utils.js', - ] +EXTRA_JS_MODULES.commonjs.sdk.window += [ + 'sdk/window/browser.js', + 'sdk/window/events.js', + 'sdk/window/helpers.js', + 'sdk/window/namespace.js', + 'sdk/window/utils.js', +] - EXTRA_JS_MODULES.commonjs.sdk.windows += [ - 'sdk/windows/fennec.js', - 'sdk/windows/firefox.js', - 'sdk/windows/observer.js', - 'sdk/windows/tabs-fennec.js', - ] +EXTRA_JS_MODULES.commonjs.sdk.windows += [ + 'sdk/windows/fennec.js', + 'sdk/windows/firefox.js', + 'sdk/windows/observer.js', + 'sdk/windows/tabs-fennec.js', +] EXTRA_JS_MODULES.commonjs += [ 'index.js', diff --git a/toolkit/jetpack/sdk/lang/weak-set.js b/toolkit/jetpack/sdk/lang/weak-set.js index 8972602a5..0b81a395b 100644 --- a/toolkit/jetpack/sdk/lang/weak-set.js +++ b/toolkit/jetpack/sdk/lang/weak-set.js @@ -2,12 +2,12 @@ * 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/. */ +"use strict"; + module.metadata = { "stability": "experimental" }; -"use strict"; - const { Cu } = require("chrome"); function makeGetterFor(Type) { diff --git a/toolkit/jetpack/sdk/ui/buttons.js b/toolkit/jetpack/sdk/ui/buttons.js index 66e0fd742..6aaed3865 100644 --- a/toolkit/jetpack/sdk/ui/buttons.js +++ b/toolkit/jetpack/sdk/ui/buttons.js @@ -50,7 +50,7 @@ function insertButton(aWindow, id, onBuild) { let toolbar = toolbarId != "" && doc.getElementById(toolbarId); if (toolbar) { - let nextItem = doc.getElementById(nextItemId); + let nextItem = nextItemId != "" && doc.getElementById(nextItemId); // If nextItem not in toolbar then retrieve it by reading currentset attribute if (!(nextItem && nextItem.parentNode && nextItem.parentNode.id == toolbarId)) { nextItem = null; diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build index 556b779dd..102ebb44b 100644 --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -204,11 +204,6 @@ if CONFIG['OS_ARCH'] == 'WINNT': 'winspool', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - OS_LIBS += [ - 'dbus', - ] - if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android': OS_LIBS += [ 'rt', @@ -252,35 +247,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': 'GLESv2', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - OS_LIBS += [ - 'ui', - 'media', - 'hardware_legacy', - 'hardware', - 'utils', - 'cutils', - 'sysutils', - 'camera_client', - 'sensorservice', - 'stagefright', - 'stagefright_foundation', - 'stagefright_omx', - 'binder', - 'gui', - 'mtp', - ] - - if int(CONFIG['ANDROID_VERSION']) >= 17: - OS_LIBS += [ - 'sync', - ] - - if CONFIG['ANDROID_VERSION'] >= '16': - OS_LIBS += [ - 'mdnssd', - ] - if 'rtsp' in CONFIG['NECKO_PROTOCOLS']: OS_LIBS += [ 'stagefright_foundation', diff --git a/toolkit/locales/en-US/chrome/global/aboutSupport.dtd b/toolkit/locales/en-US/chrome/global/aboutSupport.dtd index 9f64ef0f1..8459300c5 100644 --- a/toolkit/locales/en-US/chrome/global/aboutSupport.dtd +++ b/toolkit/locales/en-US/chrome/global/aboutSupport.dtd @@ -109,8 +109,6 @@ variant of aboutSupport.showDir.label. --> <!ENTITY aboutSupport.copyTextToClipboard.label "Copy text to clipboard"> <!ENTITY aboutSupport.copyRawDataToClipboard.label "Copy raw data to clipboard"> -<!ENTITY aboutSupport.sandboxTitle "Sandbox"> - <!ENTITY aboutSupport.safeModeTitle "Try Safe Mode"> <!ENTITY aboutSupport.restartInSafeMode.label "Restart with Add-ons Disabled…"> diff --git a/toolkit/locales/en-US/chrome/global/aboutSupport.properties b/toolkit/locales/en-US/chrome/global/aboutSupport.properties index 41501c01b..0bc612b79 100644 --- a/toolkit/locales/en-US/chrome/global/aboutSupport.properties +++ b/toolkit/locales/en-US/chrome/global/aboutSupport.properties @@ -91,14 +91,6 @@ gpuProcessKillButton = Terminate GPU Process minLibVersions = Expected minimum version loadedLibVersions = Version in use -hasSeccompBPF = Seccomp-BPF (System Call Filtering) -hasSeccompTSync = Seccomp Thread Synchronization -hasUserNamespaces = User Namespaces -hasPrivilegedUserNamespaces = User Namespaces for privileged processes -canSandboxContent = Content Process Sandboxing -canSandboxMedia = Media Plugin Sandboxing -contentSandboxLevel = Content Process Sandbox Level - # LOCALIZATION NOTE %1$S and %2$S will be replaced with the number of remote and the total number # of windows, respectively, while %3$S will be replaced with one of the status strings below, # which contains a description of the multi-process preference and status. diff --git a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd index c74fdeb2f..febc18dfd 100644 --- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd +++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd @@ -1,6 +1,7 @@ <!-- This Source Code Form is subject to the terms of the Mozilla Public - 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/. --> + <!ENTITY addons.windowTitle "Add-ons Manager"> <!ENTITY search.placeholder "Search all add-ons"> @@ -210,7 +211,7 @@ <!ENTITY addon.loadingReleaseNotes.label "Loading…"> <!ENTITY addon.errorLoadingReleaseNotes.label "Sorry, but there was an error loading the release notes."> -<!ENTITY addon.nativeAddon "This add-on directly targets Pale Moon"> +<!ENTITY addon.nativeAddon "This add-on directly targets &brandFullName;"> <!ENTITY addon.compatAddon "This add-on targets Mozilla Firefox and runs in compatibility mode"> <!ENTITY addon.createdBy.label "By "> diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.jsm index 2b18f3c1a..a0ca00935 100644 --- a/toolkit/modules/AppConstants.jsm +++ b/toolkit/modules/AppConstants.jsm @@ -81,20 +81,6 @@ this.AppConstants = Object.freeze({ false, #endif - MOZ_SANDBOX: -#ifdef MOZ_SANDBOX - true, -#else - false, -#endif - - MOZ_CONTENT_SANDBOX: -#ifdef MOZ_CONTENT_SANDBOX - true, -#else - false, -#endif - MOZ_TELEMETRY_REPORTING: #ifdef MOZ_TELEMETRY_REPORTING true, @@ -144,14 +130,6 @@ this.AppConstants = Object.freeze({ false, #endif -# MOZ_B2G covers both device and desktop b2g - MOZ_B2G: -#ifdef MOZ_B2G - true, -#else - false, -#endif - XP_UNIX: #ifdef XP_UNIX true, @@ -170,8 +148,6 @@ this.AppConstants = Object.freeze({ "macosx", #elif MOZ_WIDGET_ANDROID "android", -#elif MOZ_WIDGET_GONK - "gonk", #elif XP_LINUX "linux", #else @@ -218,13 +194,6 @@ this.AppConstants = Object.freeze({ false, #endif - MOZ_B2G_RIL: -#ifdef MOZ_B2G_RIL - true, -#else - false, -#endif - MOZ_GRAPHENE: #ifdef MOZ_GRAPHENE true, @@ -314,8 +283,6 @@ this.AppConstants = Object.freeze({ INSTALL_LOCALE: "@AB_CD@", MOZ_WIDGET_TOOLKIT: "@MOZ_WIDGET_TOOLKIT@", ANDROID_PACKAGE_NAME: "@ANDROID_PACKAGE_NAME@", - MOZ_B2G_VERSION: @MOZ_B2G_VERSION@, - MOZ_B2G_OS_NAME: @MOZ_B2G_OS_NAME@, DEBUG_JS_MODULES: "@DEBUG_JS_MODULES@", diff --git a/toolkit/modules/Sqlite.jsm b/toolkit/modules/Sqlite.jsm index e8d986c0e..6f7a7d94c 100644 --- a/toolkit/modules/Sqlite.jsm +++ b/toolkit/modules/Sqlite.jsm @@ -995,7 +995,7 @@ function cloneStorageConnection(options) { if (!source) { throw new TypeError("connection not specified in clone options."); } - if (!source instanceof Ci.mozIStorageAsyncConnection) { + if (!(source instanceof Ci.mozIStorageAsyncConnection)) { throw new TypeError("Connection must be a valid Storage connection."); } diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm index 60f7e8666..e11d47774 100644 --- a/toolkit/modules/Troubleshoot.jsm +++ b/toolkit/modules/Troubleshoot.jsm @@ -530,28 +530,3 @@ var dataProviders = { } }; -if (AppConstants.MOZ_SANDBOX) { - dataProviders.sandbox = function sandbox(done) { - let data = {}; - if (AppConstants.platform == "linux") { - const keys = ["hasSeccompBPF", "hasSeccompTSync", - "hasPrivilegedUserNamespaces", "hasUserNamespaces", - "canSandboxContent", "canSandboxMedia"]; - - let sysInfo = Cc["@mozilla.org/system-info;1"]. - getService(Ci.nsIPropertyBag2); - for (let key of keys) { - if (sysInfo.hasKey(key)) { - data[key] = sysInfo.getPropertyAsBool(key); - } - } - } - - if (AppConstants.MOZ_CONTENT_SANDBOX) { - data.contentSandboxLevel = - Services.prefs.getIntPref("security.sandbox.content.level"); - } - - done(data); - } -} diff --git a/toolkit/modules/UpdateUtils.jsm b/toolkit/modules/UpdateUtils.jsm index ef8475364..e92b1b797 100644 --- a/toolkit/modules/UpdateUtils.jsm +++ b/toolkit/modules/UpdateUtils.jsm @@ -87,24 +87,6 @@ this.UpdateUtils = { url = url.replace(/%CUSTOM%/g, Preferences.get(PREF_APP_UPDATE_CUSTOM, "")); url = url.replace(/\+/g, "%2B"); - if (AppConstants.platform == "gonk") { - let sysLibs = {}; - Cu.import("resource://gre/modules/systemlibs.js", sysLibs); - let productDevice = sysLibs.libcutils.property_get("ro.product.device"); - let buildType = sysLibs.libcutils.property_get("ro.build.type"); - url = url.replace(/%PRODUCT_MODEL%/g, - sysLibs.libcutils.property_get("ro.product.model")); - if (buildType == "user" || buildType == "userdebug") { - url = url.replace(/%PRODUCT_DEVICE%/g, productDevice); - } else { - url = url.replace(/%PRODUCT_DEVICE%/g, productDevice + "-" + buildType); - } - url = url.replace(/%B2G_VERSION%/g, - Preferences.get(PREF_APP_B2G_VERSION, null)); - url = url.replace(/%IMEI%/g, - Preferences.get(PREF_APP_UPDATE_IMEI_HASH, "default")); - } - return url; } }; diff --git a/toolkit/modules/sessionstore/Utils.jsm b/toolkit/modules/sessionstore/Utils.jsm index 863bca6f5..25b75c71b 100644 --- a/toolkit/modules/sessionstore/Utils.jsm +++ b/toolkit/modules/sessionstore/Utils.jsm @@ -16,12 +16,17 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm", this); XPCOMUtils.defineLazyServiceGetter(this, "serializationHelper", "@mozilla.org/network/serialization-helper;1", "nsISerializationHelper"); +XPCOMUtils.defineLazyGetter(this, "SERIALIZED_SYSTEMPRINCIPAL", function() { + return Utils.serializePrincipal(Services.scriptSecurityManager.getSystemPrincipal()); +}); function debug(msg) { Services.console.logStringMessage("Utils: " + msg); } this.Utils = Object.freeze({ + get SERIALIZED_SYSTEMPRINCIPAL() { return SERIALIZED_SYSTEMPRINCIPAL; }, + makeURI: function (url) { return Services.io.newURI(url, null, null); }, diff --git a/toolkit/modules/tests/browser/browser_Troubleshoot.js b/toolkit/modules/tests/browser/browser_Troubleshoot.js index 34c2a2791..7f0069dc9 100644 --- a/toolkit/modules/tests/browser/browser_Troubleshoot.js +++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js @@ -469,10 +469,6 @@ const SNAPSHOT_SCHEMA = { required: false, type: "boolean" }, - contentSandboxLevel: { - required: AppConstants.MOZ_CONTENT_SANDBOX, - type: "number" - }, }, }, }, diff --git a/toolkit/moz.configure b/toolkit/moz.configure index c1e0880c9..854814292 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -112,8 +112,7 @@ set_config('L10NBASEDIR', l10n_base) # reason. option('--enable-default-toolkit', nargs=1, choices=('cairo-windows', 'cairo-gtk2', 'cairo-gtk2-x11', 'cairo-gtk3', - 'cairo-cocoa', 'cairo-uikit', 'cairo-android', - 'cairo-gonk'), + 'cairo-cocoa', 'cairo-uikit', 'cairo-android'), help='Select default toolkit') @depends('--enable-default-toolkit', target) @@ -232,7 +231,7 @@ set_define(gl_provider_define, True) # ============================================================== @depends(toolkit) def pdf_printing(toolkit): - if toolkit in ('windows', 'gtk2', 'gtk3', 'android', 'gonk'): + if toolkit in ('windows', 'gtk2', 'gtk3', 'android'): return True @depends(pdf_printing) @@ -254,8 +253,8 @@ option(env='MOZ_INSTRUMENT_EVENT_LOOP', @depends('MOZ_INSTRUMENT_EVENT_LOOP', toolkit) def instrument_event_loop(value, toolkit): - if value or (toolkit in ('windows', 'gtk2', 'gtk3', 'cocoa', 'android', - 'gonk') and value.origin == 'default'): + if value or (toolkit in ('windows', 'gtk2', 'gtk3', 'cocoa', + 'android') and value.origin == 'default'): return True set_config('MOZ_INSTRUMENT_EVENT_LOOP', instrument_event_loop) diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm index 3913c2088..d4c3a6967 100644 --- a/toolkit/mozapps/extensions/AddonManager.jsm +++ b/toolkit/mozapps/extensions/AddonManager.jsm @@ -2671,6 +2671,8 @@ this.AddonManager = { ERROR_CORRUPT_FILE: -3, // An error occured trying to write to the filesystem. ERROR_FILE_ACCESS: -4, + // The downloaded file seems to be Jetpack. + ERROR_JETPACKSDK_FILE: -8, // The downloaded file seems to be WebExtension. ERROR_WEBEXT_FILE: -9, diff --git a/toolkit/mozapps/extensions/AddonPathService.cpp b/toolkit/mozapps/extensions/AddonPathService.cpp index 006149100..ddfdbe817 100644 --- a/toolkit/mozapps/extensions/AddonPathService.cpp +++ b/toolkit/mozapps/extensions/AddonPathService.cpp @@ -128,6 +128,16 @@ AddonPathService::InsertPath(const nsAString& path, const nsAString& addonIdStri return NS_OK; } +NS_IMETHODIMP +AddonPathService::MapURIToAddonId(nsIURI* aURI, nsAString& addonIdString) +{ + if (JSAddonId* id = MapURIToAddonID(aURI)) { + JSFlatString* flat = JS_ASSERT_STRING_IS_FLAT(JS::StringOfAddonId(id)); + AssignJSFlatString(addonIdString, flat); + } + return NS_OK; +} + static nsresult ResolveURI(nsIURI* aURI, nsAString& out) { diff --git a/toolkit/mozapps/extensions/amIAddonPathService.idl b/toolkit/mozapps/extensions/amIAddonPathService.idl index 863689858..9c9197a61 100644 --- a/toolkit/mozapps/extensions/amIAddonPathService.idl +++ b/toolkit/mozapps/extensions/amIAddonPathService.idl @@ -5,6 +5,8 @@ #include "nsISupports.idl" +interface nsIURI; + /** * This service maps file system paths where add-ons reside to the ID * of the add-on. Paths are added by the add-on manager. They can @@ -26,4 +28,10 @@ interface amIAddonPathService : nsISupports * associated with the given add-on ID. */ void insertPath(in AString path, in AString addonId); + + /** + * Given a URI to a file, return the ID of the add-on that the file belongs + * to. Returns an empty string if there is no add-on there. + */ + AString mapURIToAddonId(in nsIURI aURI); }; diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index 8d9c132e6..fc4392231 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -18,10 +18,12 @@ Cu.import("resource://gre/modules/addons/AddonRepository.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", "resource://gre/modules/PluralForm.jsm"); +#ifdef MOZ_DEVTOOLS XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () { return Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {}). BrowserToolboxProcess; }); +#endif const PREF_DISCOVERURL = "extensions.webservice.discoverURL"; const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane"; @@ -1002,6 +1004,7 @@ var gViewController = { } }, +#ifdef MOZ_DEVTOOLS cmd_debugItem: { doCommand: function cmd_debugItem_doCommand(aAddon) { BrowserToolboxProcess.init({ addonID: aAddon.id }); @@ -1015,6 +1018,7 @@ var gViewController = { return aAddon && aAddon.isDebuggable && debuggerEnabled && remoteEnabled; } }, +#endif cmd_showItemPreferences: { isEnabled: function cmd_showItemPreferences_isEnabled(aAddon) { diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml index fab340540..cbd05bfa9 100644 --- a/toolkit/mozapps/extensions/content/extensions.xml +++ b/toolkit/mozapps/extensions/content/extensions.xml @@ -9,6 +9,8 @@ %extensionsDTD; <!ENTITY % aboutDTD SYSTEM "chrome://mozapps/locale/extensions/about.dtd"> %aboutDTD; +<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" > +%brandDTD; ]> <bindings id="addonBindings" @@ -855,8 +857,10 @@ <xul:label anonid="name" class="name" crop="end" flex="1" xbl:inherits="value=name,tooltiptext=name"/> <xul:label anonid="version" class="version"/> +#ifdef MOZ_PHOENIX_EXTENSIONS <xul:label class="nativeIndicator nativeAddon" value="●" tooltiptext="&addon.nativeAddon;"/> <xul:label class="nativeIndicator compatAddon" value="●" tooltiptext="&addon.compatAddon;"/> +#endif <xul:label class="disabled-postfix" value="&addon.disabled.postfix;"/> <xul:label class="update-postfix" value="&addon.update.postfix;"/> <xul:spacer flex="5000"/> <!-- Necessary to make the name crop --> @@ -1362,8 +1366,10 @@ [this.mAddon.name], 1); } else { this.removeAttribute("notification"); +#ifdef MOZ_PHOENIX_EXTENSIONS if (this.mAddon.type == "extension") this.setAttribute("native", this.mAddon.native); +#endif } } @@ -1622,11 +1628,13 @@ ]]></body> </method> +#ifdef MOZ_DEVTOOLS <method name="debug"> <body><![CDATA[ gViewController.doCommand("cmd_debugItem", this.mAddon); ]]></body> </method> +#endif <method name="showPreferences"> <body><![CDATA[ diff --git a/toolkit/mozapps/extensions/content/extensions.xul b/toolkit/mozapps/extensions/content/extensions.xul index c1a8edc86..c5eeb534f 100644 --- a/toolkit/mozapps/extensions/content/extensions.xul +++ b/toolkit/mozapps/extensions/content/extensions.xul @@ -53,8 +53,10 @@ <menuitem id="menuitem_uninstallItem" command="cmd_uninstallItem" label="&cmd.uninstallAddon.label;" accesskey="&cmd.uninstallAddon.accesskey;"/> +#ifdef MOZ_DEVTOOLS <menuitem id="menuitem_debugItem" command="cmd_debugItem" label="&cmd.debugAddon.label;"/> +#endif <menuseparator id="addonitem-menuseparator" /> <menuitem id="menuitem_preferences" command="cmd_showItemPreferences" #ifdef XP_WIN @@ -101,7 +103,9 @@ <command id="cmd_findItemUpdates"/> <command id="cmd_showItemPreferences"/> <command id="cmd_showItemAbout"/> +#ifdef MOZ_DEVTOOLS <command id="cmd_debugItem"/> +#endif <command id="cmd_enableItem"/> <command id="cmd_disableItem"/> <command id="cmd_installItem"/> @@ -631,9 +635,11 @@ #endif command="cmd_showItemPreferences"/> <spacer flex="1"/> +#ifdef MOZ_DEVTOOLS <button id="detail-debug-btn" class="addon-control debug" label="Debug" command="cmd_debugItem" /> +#endif <button id="detail-enable-btn" class="addon-control enable" label="&cmd.enableAddon.label;" accesskey="&cmd.enableAddon.accesskey;" diff --git a/toolkit/mozapps/extensions/extensions.manifest b/toolkit/mozapps/extensions/extensions.manifest index f0f00545f..14aca3ff6 100644 --- a/toolkit/mozapps/extensions/extensions.manifest +++ b/toolkit/mozapps/extensions/extensions.manifest @@ -1,7 +1,6 @@ component {66354bc9-7ed1-4692-ae1d-8da97d6b205e} nsBlocklistService.js contract @mozilla.org/extensions/blocklist;1 {66354bc9-7ed1-4692-ae1d-8da97d6b205e} category profile-after-change nsBlocklistService @mozilla.org/extensions/blocklist;1 -#ifndef MOZ_WIDGET_GONK category update-timer nsBlocklistService @mozilla.org/extensions/blocklist;1,getService,blocklist-background-update-timer,extensions.blocklist.interval,86400 component {4399533d-08d1-458c-a87a-235f74451cfa} addonManager.js contract @mozilla.org/addons/integration;1 {4399533d-08d1-458c-a87a-235f74451cfa} @@ -17,4 +16,3 @@ category JavaScript-global-property InstallTrigger @mozilla.org/addons/installtr category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm #endif category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm -#endif diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm index 939e2e269..8d742ea42 100644 --- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm @@ -766,8 +766,17 @@ this.AddonUpdateChecker = { * down in-progress update requests */ checkForUpdates: function AUC_checkForUpdates(aId, aUpdateKey, aUrl, aObserver) { - // Exclude default theme - if (aId != "{972ce4c6-7e08-4474-a285-3208198ce6fd}") + // Define an array of internally used IDs to NOT send to AUS such as the + // Default Theme. Please keep this list in sync with: + // toolkit/mozapps/webextensions/AddonUpdateChecker.jsm + let internalIDS = [ + '{972ce4c6-7e08-4474-a285-3208198ce6fd}', + 'modern@themes.mozilla.org' + ]; + + // If the ID is not in the array then go ahead and query AUS + if (internalIDS.indexOf(aId) == -1) { return new UpdateParser(aId, aUpdateKey, aUrl, aObserver); + } } }; diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index c43811ba8..5b3585cd8 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -36,8 +36,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm"); +#ifdef MOZ_DEVTOOLS XPCOMUtils.defineLazyModuleGetter(this, "BrowserToolboxProcess", "resource://devtools/client/framework/ToolboxProcess.jsm"); +#endif XPCOMUtils.defineLazyModuleGetter(this, "ConsoleAPI", "resource://gre/modules/Console.jsm"); @@ -52,6 +54,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "ResProtocolHandler", "@mozilla.org/network/protocol;1?name=resource", "nsIResProtocolHandler"); +XPCOMUtils.defineLazyServiceGetter(this, + "AddonPathService", + "@mozilla.org/addon-path-service;1", + "amIAddonPathService"); const nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile", "initWithPath"); @@ -106,6 +112,10 @@ const DIR_TRASH = "trash"; const FILE_DATABASE = "extensions.json"; const FILE_OLD_CACHE = "extensions.cache"; const FILE_INSTALL_MANIFEST = "install.rdf"; +#ifndef MOZ_JETPACK +const FILE_JETPACK_MANIFEST_1 = "harness-options.json"; +const FILE_JETPACK_MANIFEST_2 = "package.json"; +#endif const FILE_WEBEXT_MANIFEST = "manifest.json"; const FILE_XPI_ADDONS_LIST = "extensions.ini"; @@ -134,7 +144,9 @@ const FIREFOX_APPCOMPATVERSION = "56.9" // The value for this is in Makefile.in #expand const DB_SCHEMA = __MOZ_EXTENSIONS_DB_SCHEMA__; +#ifdef MOZ_DEVTOOLS const NOTIFICATION_TOOLBOXPROCESS_LOADED = "ToolboxProcessLoaded"; +#endif // Properties that exist in the install manifest const PROP_METADATA = ["id", "version", "type", "internalName", "updateURL", @@ -1059,37 +1071,36 @@ function loadManifestFromDir(aDir) { * @throws if the XPI file does not contain a valid install manifest. * Throws with |webext:true| if a WebExtension manifest was found * to distinguish between WebExtensions and corrupt files. + * Throws with |jetpacksdk:true| if a Jetpack files were found + * if Jetpack its self isn't built. */ function loadManifestFromZipReader(aZipReader) { - let zis; - try { - zis = aZipReader.getInputStream(FILE_INSTALL_MANIFEST); - } catch (e) { - // We're going to throw here, but depending on whether we have a - // WebExtension manifest in the XPI, we'll throw with the webext flag. - try { - let zws = aZipReader.getInputStream(FILE_WEBEXT_MANIFEST); - zws.close(); - } catch(e2) { - // We have neither an install manifest nor a WebExtension manifest; - // this means the extension file has a structural problem. - // Just pass the original error up the chain in that case. + // If WebExtension but not install.rdf throw an error + if (aZipReader.hasEntry(FILE_WEBEXT_MANIFEST)) { + if (!aZipReader.hasEntry(FILE_INSTALL_MANIFEST)) { throw { - name: e.name, - message: e.message + name: "UnsupportedExtension", + message: Services.appinfo.name + " does not support WebExtensions", + webext: true }; } - // If we get here, we have a WebExtension manifest but no install - // manifest. Pass the error up the chain with the webext flag. + } + +#ifndef MOZ_JETPACK + // If Jetpack is not built throw an error + if (aZipReader.hasEntry(FILE_JETPACK_MANIFEST_1) || + aZipReader.hasEntry(FILE_JETPACK_MANIFEST_2)) { throw { - name: e.name, - message: e.message, - webext: true + name: "UnsupportedExtension", + message: Services.appinfo.name + " does not support Jetpack Extensions", + jetpacksdk: true }; } - - // We found an install manifest, so it's either a regular or hybrid - // extension. Continue processing. +#endif + + // Attempt to open install.rdf else throw normally + let zis = aZipReader.getInputStream(FILE_INSTALL_MANIFEST); + // Create a buffered input stream for install.rdf let bis = Cc["@mozilla.org/network/buffered-input-stream;1"]. createInstance(Ci.nsIBufferedInputStream); bis.init(zis, 4096); @@ -1118,7 +1129,9 @@ function loadManifestFromZipReader(aZipReader) { return addon; } finally { + // Close the buffered input stream bis.close(); + // Close the input stream to install.rdf zis.close(); } } @@ -1842,8 +1855,10 @@ this.XPIProvider = { _enabledExperiments: null, // A Map from an add-on install to its ID _addonFileMap: new Map(), +#ifdef MOZ_DEVTOOLS // Flag to know if ToolboxProcess.jsm has already been loaded by someone or not _toolboxProcessLoaded: false, +#endif // Have we started shutting down bootstrap add-ons? _closing: false, @@ -1887,8 +1902,7 @@ this.XPIProvider = { logger.info("Mapping " + aID + " to " + aFile.path); this._addonFileMap.set(aID, aFile.path); - let service = Cc["@mozilla.org/addon-path-service;1"].getService(Ci.amIAddonPathService); - service.insertPath(aFile.path, aID); + AddonPathService.insertPath(aFile.path, aID); }, /** @@ -2080,6 +2094,8 @@ this.XPIProvider = { Services.prefs.addObserver(PREF_EM_MIN_COMPAT_APP_VERSION, this, false); Services.prefs.addObserver(PREF_EM_MIN_COMPAT_PLATFORM_VERSION, this, false); Services.obs.addObserver(this, NOTIFICATION_FLUSH_PERMISSIONS, false); + +#ifdef MOZ_DEVTOOLS if (Cu.isModuleLoaded("resource://devtools/client/framework/ToolboxProcess.jsm")) { // If BrowserToolboxProcess is already loaded, set the boolean to true // and do whatever is needed @@ -2091,6 +2107,7 @@ this.XPIProvider = { // Else, wait for it to load Services.obs.addObserver(this, NOTIFICATION_TOOLBOXPROCESS_LOADED, false); } +#endif let flushCaches = this.checkForChanges(aAppChanged, aOldAppVersion, aOldPlatformVersion); @@ -3916,16 +3933,8 @@ this.XPIProvider = { * @see amIAddonManager.mapURIToAddonID */ mapURIToAddonID: function XPI_mapURIToAddonID(aURI) { - let resolved = this._resolveURIToFile(aURI); - if (!resolved || !(resolved instanceof Ci.nsIFileURL)) - return null; - - for (let [id, path] of this._addonFileMap) { - if (resolved.file.path.startsWith(path)) - return id; - } - - return null; + // Returns `null` instead of empty string if the URI can't be mapped. + return AddonPathService.mapURIToAddonId(aURI) || null; }, /** @@ -4093,12 +4102,14 @@ this.XPIProvider = { } return; } +#ifdef MOZ_DEVTOOLS else if (aTopic == NOTIFICATION_TOOLBOXPROCESS_LOADED) { Services.obs.removeObserver(this, NOTIFICATION_TOOLBOXPROCESS_LOADED, false); this._toolboxProcessLoaded = true; BrowserToolboxProcess.on("connectionchange", this.onDebugConnectionChange.bind(this)); } +#endif if (aTopic == "nsPref:changed") { switch (aData) { @@ -4363,12 +4374,14 @@ this.XPIProvider = { logger.warn("Error loading bootstrap.js for " + aId, e); } +#ifdef MOZ_DEVTOOLS // Only access BrowserToolboxProcess if ToolboxProcess.jsm has been // initialized as otherwise, when it will be initialized, all addons' // globals will be added anyways if (this._toolboxProcessLoaded) { BrowserToolboxProcess.setAddonOptions(aId, { global: this.bootstrapScopes[aId] }); } +#endif }, /** @@ -4388,11 +4401,13 @@ this.XPIProvider = { this.persistBootstrappedAddons(); this.addAddonsToCrashReporter(); +#ifdef MOZ_DEVTOOLS // Only access BrowserToolboxProcess if ToolboxProcess.jsm has been // initialized as otherwise, there won't be any addon globals added to it if (this._toolboxProcessLoaded) { BrowserToolboxProcess.setAddonOptions(aId, { global: null }); } +#endif }, /** @@ -5010,6 +5025,11 @@ AddonInstall.prototype = { if (e.webext) { logger.warn("WebExtension XPI", e); this.error = AddonManager.ERROR_WEBEXT_FILE; +#ifndef MOZ_JETPACK + } else if (e.jetpacksdk) { + logger.warn("Jetpack XPI", e); + this.error = AddonManager.ERROR_JETPACKSDK_FILE; +#endif } else { logger.warn("Invalid XPI", e); this.error = AddonManager.ERROR_CORRUPT_FILE; @@ -5651,6 +5671,10 @@ AddonInstall.prototype = { catch (e) { if (e.webext) { this.downloadFailed(AddonManager.ERROR_WEBEXT_FILE, e); +#ifndef MOZ_JETPACK + } else if (e.jetpacksdk) { + this.downloadFailed(AddonManager.ERROR_JETPACKSDK_FILE, e); +#endif } else { this.downloadFailed(AddonManager.ERROR_CORRUPT_FILE, e); } @@ -6447,21 +6471,23 @@ AddonInternal.prototype = { if (!aPlatformVersion) aPlatformVersion = Services.appinfo.platformVersion; +#ifdef MOZ_PHOENIX_EXTENSIONS this.native = false; - +#endif + let version; if (app.id == Services.appinfo.ID) { version = aAppVersion; +#ifdef MOZ_PHOENIX_EXTENSIONS this.native = true; } -#ifdef MOZ_PHOENIX_EXTENSIONS else if (app.id == FIREFOX_ID) { version = FIREFOX_APPCOMPATVERSION; if (this.type == "locale") //Never allow language packs in Firefox compatibility mode return false; - } #endif + } else if (app.id == TOOLKIT_ID) version = aPlatformVersion diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js index d26029455..6b37ed640 100644 --- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js +++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js @@ -70,7 +70,11 @@ const PROP_JSON_FIELDS = ["id", "syncGUID", "location", "version", "type", "skinnable", "size", "sourceURI", "releaseNotesURI", "softDisabled", "foreignInstall", "hasBinaryComponents", "strictCompatibility", "locales", "targetApplications", - "targetPlatforms", "multiprocessCompatible", "native"]; + "targetPlatforms", "multiprocessCompatible", +#ifdef MOZ_PHOENIX_EXTENSIONS + "native" +#endif + ]; // Time to wait before async save of XPI JSON database, in milliseconds const ASYNC_SAVE_DELAY_MS = 20; diff --git a/toolkit/mozapps/extensions/nsBlocklistService.js b/toolkit/mozapps/extensions/nsBlocklistService.js index 936c9d1b5..487dae8e5 100644 --- a/toolkit/mozapps/extensions/nsBlocklistService.js +++ b/toolkit/mozapps/extensions/nsBlocklistService.js @@ -910,7 +910,7 @@ Blocklist.prototype = { let issuer = blocklistElement.getAttribute("issuerName"); for (let snElement of blocklistElement.children) { try { - gCertBlocklistService.addRevokedCert(issuer, snElement.textContent); + gCertBlocklistService.revokeCertByIssuerAndSerial(issuer, snElement.textContent); } catch (e) { // we want to keep trying other elements since missing all items // is worse than missing one diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js b/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js index a6f9c8052..a153256dc 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js @@ -95,8 +95,10 @@ function run_test_early() { "resource://gre/modules/addons/XPIProvider.jsm", {}); // Make the early API call. - do_check_null(s.XPIProvider.mapURIToAddonID(uri)); + // AddonManager still misses its provider and so doesn't work yet. do_check_null(AddonManager.mapURIToAddonID(uri)); + // But calling XPIProvider directly works immediately + do_check_eq(s.XPIProvider.mapURIToAddonID(uri), id); // Actually start up the manager. startupManager(false); diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini index 2a12f147a..51419a6e3 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini @@ -1,6 +1,6 @@ # The file is shared between the two main xpcshell manifest files. [DEFAULT] -skip-if = toolkit == 'android' || toolkit == 'gonk' +skip-if = toolkit == 'android' [test_AddonRepository.js] # Bug 676992: test consistently hangs on Android diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-unpack.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-unpack.ini index 51520f888..1f4fd692e 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-unpack.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-unpack.ini @@ -2,7 +2,7 @@ head = head_addons.js head_unpack.js tail = firefox-appdir = browser -skip-if = toolkit == 'android' || toolkit == 'gonk' +skip-if = toolkit == 'android' dupe-manifest = [include:xpcshell-shared.ini] diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 83ab77c74..afe13895d 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -1,5 +1,5 @@ [DEFAULT] -skip-if = buildapp == 'mulet' || toolkit == 'android' || toolkit == 'gonk' +skip-if = buildapp == 'mulet' || toolkit == 'android' head = head_addons.js tail = firefox-appdir = browser diff --git a/toolkit/mozapps/extensions/test/xpinstall/browser_datauri.js b/toolkit/mozapps/extensions/test/xpinstall/browser_datauri.js index 917f2465d..b24bce4b5 100644 --- a/toolkit/mozapps/extensions/test/xpinstall/browser_datauri.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_datauri.js @@ -13,6 +13,13 @@ function setup_redirect(aSettings) { } function test() { + waitForExplicitFinish(); + SpecialPowers.pushPrefEnv({ + "set": [["security.data_uri.block_toplevel_data_uri_navigations", false]] + }, runTest); +} + +function runTest() { Harness.installOriginBlockedCallback = install_blocked; Harness.installsCompletedCallback = finish_test; Harness.setup(); @@ -33,4 +40,5 @@ function finish_test(count) { gBrowser.removeCurrentTab(); Harness.finish(); + finish(); } diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index e23ab3f40..0cf7b8938 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -55,8 +55,6 @@ const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.proper const KEY_UPDROOT = "UpdRootD"; const KEY_EXECUTABLE = "XREExeF"; -// Gonk only -const KEY_UPDATE_ARCHIVE_DIR = "UpdArchD"; const DIR_UPDATES = "updates"; @@ -198,17 +196,6 @@ const APPID_TO_TOPIC = { var gUpdateMutexHandle = null; -// Gonk only -var gSDCardMountLock = null; - -// Gonk only -XPCOMUtils.defineLazyGetter(this, "gExtStorage", function aus_gExtStorage() { - if (AppConstants.platform != "gonk") { - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - } - return Services.env.get("EXTERNAL_STORAGE"); -}); - XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils", "resource://gre/modules/UpdateUtils.jsm"); @@ -564,13 +551,6 @@ function getCanStageUpdates() { return true; } - // For Gonk, the updater will remount the /system partition to move staged - // files into place. - if (AppConstants.platform == "gonk") { - LOG("getCanStageUpdates - able to stage updates because this is gonk"); - return true; - } - if (!hasUpdateMutex()) { LOG("getCanStageUpdates - unable to apply updates because another " + "instance of the application is already handling updates for this " + @@ -798,105 +778,6 @@ function writeVersionFile(dir, version) { } /** - * Gonk only function that reads the link file specified in the update.link file - * in the specified directory and returns the nsIFile for the corresponding - * file. - * @param dir - * The dir to look for an update.link file in - * @return A nsIFile for the file path specified in the - * update.link file or null if the update.link file - * doesn't exist. - */ -function getFileFromUpdateLink(dir) { - if (AppConstants.platform != "gonk") { - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - } - let linkFile = dir.clone(); - linkFile.append(FILE_UPDATE_LINK); - let link = readStringFromFile(linkFile); - LOG("getFileFromUpdateLink linkFile.path: " + linkFile.path + ", link: " + link); - if (!link) { - return null; - } - let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); - file.initWithPath(link); - return file; -} - -/** - * Gonk only function to create a link file. This allows the actual patch to - * live in a directory different from the update directory. - * @param dir - * The patch directory where the update.link file - * should be written. - * @param patchFile - * The fully qualified filename of the patchfile. - */ -function writeLinkFile(dir, patchFile) { - if (AppConstants.platform != "gonk") { - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - } - let linkFile = dir.clone(); - linkFile.append(FILE_UPDATE_LINK); - writeStringToFile(linkFile, patchFile.path); - if (patchFile.path.indexOf(gExtStorage) == 0) { - // The patchfile is being stored on external storage. Try to lock it - // so that it doesn't get shared with the PC while we're downloading - // to it. - acquireSDCardMountLock(); - } -} - -/** - * Gonk only function to acquire a VolumeMountLock for the sdcard volume. - * - * This prevents the SDCard from being shared with the PC while - * we're downloading the update. - */ -function acquireSDCardMountLock() { - if (AppConstants.platform != "gonk") { - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - } - let volsvc = Cc["@mozilla.org/telephony/volume-service;1"]. - getService(Ci.nsIVolumeService); - if (volsvc) { - gSDCardMountLock = volsvc.createMountLock("sdcard"); - } -} - -/** - * Gonk only function that determines if the state corresponds to an - * interrupted update. This could either be because the download was - * interrupted, or because staging the update was interrupted. - * - * @return true if the state corresponds to an interrupted - * update. - */ -function isInterruptedUpdate(status) { - if (AppConstants.platform != "gonk") { - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - } - return (status == STATE_DOWNLOADING) || - (status == STATE_PENDING) || - (status == STATE_APPLYING); -} - -/** - * Releases any SDCard mount lock that we might have. - * - * This once again allows the SDCard to be shared with the PC. - */ -function releaseSDCardMountLock() { - if (AppConstants.platform != "gonk") { - throw Cr.NS_ERROR_UNEXPECTED; - } - if (gSDCardMountLock) { - gSDCardMountLock.unlock(); - gSDCardMountLock = null; - } -} - -/** * Determines if the service should be used to attempt an update * or not. * @@ -1058,14 +939,6 @@ function cleanUpUpdatesDir(aRemovePatchFiles = true) { let dirEntries = updateDir.directoryEntries; while (dirEntries.hasMoreElements()) { let file = dirEntries.getNext().QueryInterface(Ci.nsIFile); - if (AppConstants.platform == "gonk") { - if (file.leafName == FILE_UPDATE_LINK) { - let linkedFile = getFileFromUpdateLink(updateDir); - if (linkedFile && linkedFile.exists()) { - linkedFile.remove(false); - } - } - } // Now, recursively remove this file. The recursive removal is needed for // Mac OSX because this directory will contain a copy of updater.app, @@ -1078,9 +951,6 @@ function cleanUpUpdatesDir(aRemovePatchFiles = true) { } } } - if (AppConstants.platform == "gonk") { - releaseSDCardMountLock(); - } } /** @@ -1809,12 +1679,6 @@ function UpdateService() { LOG("Creating UpdateService"); Services.obs.addObserver(this, "xpcom-shutdown", false); Services.prefs.addObserver(PREF_APP_UPDATE_LOG, this, false); - if (AppConstants.platform == "gonk") { - // PowerManagerService::SyncProfile (which is called for Reboot, PowerOff - // and Restart) sends the profile-change-net-teardown event. We can then - // pause the download in a similar manner to xpcom-shutdown. - Services.obs.addObserver(this, "profile-change-net-teardown", false); - } } UpdateService.prototype = { @@ -1980,23 +1844,6 @@ UpdateService.prototype = { } } - if (AppConstants.platform == "gonk") { - // This code is called very early in the boot process, before we've even - // had a chance to setup the UI so we can give feedback to the user. - // - // Since the download may be occuring over a link which has associated - // cost, we want to require user-consent before resuming the download. - // Also, applying an already downloaded update now is undesireable, - // since the phone will look dead while the update is being applied. - // Applying the update can take several minutes. Instead we wait until - // the UI is initialized so it is possible to give feedback to and get - // consent to update from the user. - if (isInterruptedUpdate(status)) { - LOG("UpdateService:_postUpdateProcessing - interrupted update detected - wait for user consent"); - return; - } - } - if (status == STATE_DOWNLOADING) { LOG("UpdateService:_postUpdateProcessing - patch found in downloading " + "state"); @@ -2038,34 +1885,6 @@ UpdateService.prototype = { return; } - if (AppConstants.platform == "gonk") { - // The update is only applied but not selected to be installed - if (status == STATE_APPLIED && update && update.isOSUpdate) { - LOG("UpdateService:_postUpdateProcessing - update staged as applied found"); - return; - } - - if (status == STATE_APPLIED_OS && update && update.isOSUpdate) { - // In gonk, we need to check for OS update status after startup, since - // the recovery partition won't write to update.status for us - let recoveryService = Cc["@mozilla.org/recovery-service;1"]. - getService(Ci.nsIRecoveryService); - let fotaStatus = recoveryService.getFotaUpdateStatus(); - switch (fotaStatus) { - case Ci.nsIRecoveryService.FOTA_UPDATE_SUCCESS: - status = STATE_SUCCEEDED; - break; - case Ci.nsIRecoveryService.FOTA_UPDATE_FAIL: - status = STATE_FAILED + ": " + FOTA_GENERAL_ERROR; - break; - case Ci.nsIRecoveryService.FOTA_UPDATE_UNKNOWN: - default: - status = STATE_FAILED + ": " + FOTA_UNKNOWN_ERROR; - break; - } - } - } - if (!update) { if (status != STATE_SUCCEEDED) { LOG("UpdateService:_postUpdateProcessing - previous patch failed " + @@ -2519,11 +2338,6 @@ UpdateService.prototype = { var um = Cc["@mozilla.org/updates/update-manager;1"]. getService(Ci.nsIUpdateManager); if (um.activeUpdate) { - if (AppConstants.platform == "gonk") { - // For gonk, the user isn't necessarily aware of the update, so we need - // to show the prompt to make sure. - this._showPrompt(um.activeUpdate); - } AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_HAS_ACTIVEUPDATE); return; } @@ -2714,21 +2528,6 @@ UpdateService.prototype = { } this._downloader.cancel(); } - if (AppConstants.platform == "gonk") { - let um = Cc["@mozilla.org/updates/update-manager;1"]. - getService(Ci.nsIUpdateManager); - let activeUpdate = um.activeUpdate; - if (activeUpdate && - (activeUpdate.appVersion != update.appVersion || - activeUpdate.buildID != update.buildID)) { - // We have an activeUpdate (which presumably was interrupted), and are - // about start downloading a new one. Make sure we remove all traces - // of the active one (otherwise we'll start appending the new update.mar - // the the one that's been partially downloaded). - LOG("UpdateService:downloadUpdate - removing stale active update."); - cleanupActiveUpdate(); - } - } // Set the previous application version prior to downloading the update. update.previousAppVersion = Services.appinfo.version; this._downloader = new Downloader(background, this); @@ -3142,21 +2941,6 @@ UpdateManager.prototype = { "the update was staged. state: " + update.state + ", status: " + status); Services.obs.notifyObservers(null, "update-staged", update.state); - if (AppConstants.platform == "gonk") { - // Do this after everything else, since it will likely cause the app to - // shut down. - if (update.state == STATE_APPLIED) { - // Notify the user that an update has been staged and is ready for - // installation (i.e. that they should restart the application). We do - // not notify on failed update attempts. - let prompter = Cc["@mozilla.org/updates/update-prompt;1"]. - createInstance(Ci.nsIUpdatePrompt); - prompter.showUpdateDownloaded(update, true); - } else { - releaseSDCardMountLock(); - } - return; - } // Only prompt when the UI isn't already open. let windowType = getPref("getCharPref", PREF_APP_UPDATE_ALTWINDOWTYPE, null); if (Services.wm.getMostRecentWindow(UPDATE_WINDOW_NAME) || @@ -3515,9 +3299,6 @@ Downloader.prototype = { if (this._request && this._request instanceof Ci.nsIRequest) { this._request.cancel(cancelError); } - if (AppConstants.platform == "gonk") { - releaseSDCardMountLock(); - } }, /** @@ -3647,17 +3428,8 @@ Downloader.prototype = { return selectedPatch; } - if (AppConstants.platform == "gonk") { - if (state == STATE_PENDING || state == STATE_APPLYING) { - LOG("Downloader:_selectPatch - resuming interrupted apply"); - return selectedPatch; - } - if (state == STATE_APPLIED) { - LOG("Downloader:_selectPatch - already downloaded and staged"); - return null; - } - } else if (state == STATE_PENDING || state == STATE_PENDING_SERVICE || - state == STATE_PENDING_ELEVATE) { + if (state == STATE_PENDING || state == STATE_PENDING_SERVICE || + state == STATE_PENDING_ELEVATE) { LOG("Downloader:_selectPatch - already downloaded and staged"); return null; } @@ -3719,15 +3491,7 @@ Downloader.prototype = { */ _getUpdateArchiveFile: function Downloader__getUpdateArchiveFile() { var updateArchive; - if (AppConstants.platform == "gonk") { - try { - updateArchive = FileUtils.getDir(KEY_UPDATE_ARCHIVE_DIR, [], true); - } catch (e) { - return null; - } - } else { - updateArchive = getUpdatesDir().clone(); - } + updateArchive = getUpdatesDir().clone(); updateArchive.append(FILE_UPDATE_MAR); return updateArchive; @@ -3761,71 +3525,6 @@ Downloader.prototype = { let patchFile = null; - // Only used by gonk - let status = STATE_NONE; - if (AppConstants.platform == "gonk") { - status = readStatusFile(updateDir); - if (isInterruptedUpdate(status)) { - LOG("Downloader:downloadUpdate - interruptted update"); - // The update was interrupted. Try to locate the existing patch file. - // For an interrupted download, this allows a resume rather than a - // re-download. - patchFile = getFileFromUpdateLink(updateDir); - if (!patchFile) { - // No link file. We'll just assume that the update.mar is in the - // update directory. - patchFile = updateDir.clone(); - patchFile.append(FILE_UPDATE_MAR); - } - if (patchFile.exists()) { - LOG("Downloader:downloadUpdate - resuming with patchFile " + patchFile.path); - if (patchFile.fileSize == this._patch.size) { - LOG("Downloader:downloadUpdate - patchFile appears to be fully downloaded"); - // Bump the status along so that we don't try to redownload again. - if (getElevationRequired()) { - status = STATE_PENDING_ELEVATE; - } else { - status = STATE_PENDING; - } - } - } else { - LOG("Downloader:downloadUpdate - patchFile " + patchFile.path + - " doesn't exist - performing full download"); - // The patchfile doesn't exist, we might as well treat this like - // a new download. - patchFile = null; - } - if (patchFile && status != STATE_DOWNLOADING) { - // It looks like the patch was downloaded, but got interrupted while it - // was being verified or applied. So we'll fake the downloading portion. - - if (getElevationRequired()) { - writeStatusFile(updateDir, STATE_PENDING_ELEVATE); - } else { - writeStatusFile(updateDir, STATE_PENDING); - } - - // Since the code expects the onStopRequest callback to happen - // asynchronously (And you have to call AUS_addDownloadListener - // after calling AUS_downloadUpdate) we need to defer this. - - this._downloadTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); - this._downloadTimer.initWithCallback(function() { - this._downloadTimer = null; - // Send a fake onStopRequest. Filling in the destination allows - // _verifyDownload to work, and then the update will be applied. - this._request = {destination: patchFile}; - this.onStopRequest(this._request, null, Cr.NS_OK); - }.bind(this), 0, Ci.nsITimer.TYPE_ONE_SHOT); - - // Returning STATE_DOWNLOADING makes UpdatePrompt think we're - // downloading. The onStopRequest that we spoofed above will make it - // look like the download finished. - return STATE_DOWNLOADING; - } - } - } - if (!patchFile) { // Find a place to put the patchfile that we're going to download. patchFile = this._getUpdateArchiveFile(); @@ -3836,19 +3535,6 @@ Downloader.prototype = { return STATE_NONE; } - if (AppConstants.platform == "gonk") { - if (patchFile.path.indexOf(updateDir.path) != 0) { - // The patchFile is in a directory which is different from the - // updateDir, create a link file. - writeLinkFile(updateDir, patchFile); - - if (!isInterruptedUpdate(status) && patchFile.exists()) { - // Remove stale patchFile - patchFile.remove(false); - } - } - } - update.QueryInterface(Ci.nsIPropertyBag); let interval = this.background ? update.getProperty("backgroundInterval") : DOWNLOAD_FOREGROUND_INTERVAL; @@ -4119,13 +3805,6 @@ Downloader.prototype = { this._update.statusText = getStatusTextFromCode(status, Cr.NS_BINDING_FAILED); - if (AppConstants.platform == "gonk") { - // bug891009: On FirefoxOS, manaully retry OTA download will reuse - // the Update object. We need to remove selected patch so that download - // can be triggered again successfully. - this._update.selectedPatch.selected = false; - } - // Destroy the updates directory, since we're done with it. cleanUpUpdatesDir(); @@ -4187,13 +3866,6 @@ Downloader.prototype = { } } - if (AppConstants.platform == "gonk") { - // We always forward errors in B2G, since Gaia controls the update UI - let prompter = Cc["@mozilla.org/updates/update-prompt;1"]. - createInstance(Ci.nsIUpdatePrompt); - prompter.showUpdateError(this._update); - } - // Prevent leaking the update object (bug 454964). this._update = null; } diff --git a/toolkit/mozapps/update/updater/automounter_gonk.cpp b/toolkit/mozapps/update/updater/automounter_gonk.cpp deleted file mode 100644 index 3dff2a133..000000000 --- a/toolkit/mozapps/update/updater/automounter_gonk.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -#include <android/log.h> -#include <cutils/android_reboot.h> -#include <errno.h> -#include <stdlib.h> -#include <sys/mount.h> -#include <sys/reboot.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> - -#include "automounter_gonk.h" -#include "updatedefines.h" -#include "updatelogging.h" - -#define LOG_TAG "GonkAutoMounter" - -#define GONK_LOG(level, format, ...) \ - LOG((LOG_TAG ": " format "\n", ##__VA_ARGS__)); \ - __android_log_print(level, LOG_TAG, format, ##__VA_ARGS__) - -#define LOGI(format, ...) GONK_LOG(ANDROID_LOG_INFO, format, ##__VA_ARGS__) -#define LOGE(format, ...) GONK_LOG(ANDROID_LOG_ERROR, format, ##__VA_ARGS__) - -const char *kGonkMountsPath = "/proc/mounts"; -const char *kGonkSystemPath = "/system"; - -GonkAutoMounter::GonkAutoMounter() : mDevice(nullptr), mAccess(Unknown) -{ - if (!RemountSystem(ReadWrite)) { - LOGE("Could not remount %s as read-write.", kGonkSystemPath); - } -} - -GonkAutoMounter::~GonkAutoMounter() -{ - bool result = RemountSystem(ReadOnly); - free(mDevice); - - if (!result) { - // Don't take any chances when remounting as read-only fails, just reboot. - Reboot(); - } -} - -void -GonkAutoMounter::Reboot() -{ - // The android_reboot wrapper provides more safety, doing fancier read-only - // remounting and attempting to sync() the filesystem first. If this fails - // our only hope is to force a reboot directly without these protections. - // For more, see system/core/libcutils/android_reboot.c - LOGE("Could not remount %s as read-only, forcing a system reboot.", - kGonkSystemPath); - LogFlush(); - - if (android_reboot(ANDROID_RB_RESTART, 0, nullptr) != 0) { - LOGE("Safe system reboot failed, attempting to force"); - LogFlush(); - - if (reboot(RB_AUTOBOOT) != 0) { - LOGE("CRITICAL: Failed to force restart"); - } - } -} - -static const char * -MountAccessToString(MountAccess access) -{ - switch (access) { - case ReadOnly: return "read-only"; - case ReadWrite: return "read-write"; - default: return "unknown"; - } -} - -bool -GonkAutoMounter::RemountSystem(MountAccess access) -{ - if (!UpdateMountStatus()) { - return false; - } - - if (mAccess == access) { - return true; - } - - unsigned long flags = MS_REMOUNT; - if (access == ReadOnly) { - flags |= MS_RDONLY; - // Give the system a chance to flush file buffers - sync(); - } - - if (!MountSystem(flags)) { - return false; - } - - // Check status again to verify /system has been properly remounted - if (!UpdateMountStatus()) { - return false; - } - - if (mAccess != access) { - LOGE("Updated mount status %s should be %s", - MountAccessToString(mAccess), - MountAccessToString(access)); - return false; - } - - return true; -} - -bool -GonkAutoMounter::UpdateMountStatus() -{ - FILE *mountsFile = NS_tfopen(kGonkMountsPath, "r"); - - if (mountsFile == nullptr) { - LOGE("Error opening %s: %s", kGonkMountsPath, strerror(errno)); - return false; - } - - // /proc/mounts returns a 0 size from fstat, so we use the same - // pre-allocated buffer size that ADB does here - const int mountsMaxSize = 4096; - char mountData[mountsMaxSize]; - size_t read = fread(mountData, 1, mountsMaxSize - 1, mountsFile); - mountData[read + 1] = '\0'; - - if (ferror(mountsFile)) { - LOGE("Error reading %s, %s", kGonkMountsPath, strerror(errno)); - fclose(mountsFile); - return false; - } - - char *token, *tokenContext; - bool foundSystem = false; - - for (token = strtok_r(mountData, "\n", &tokenContext); - token; - token = strtok_r(nullptr, "\n", &tokenContext)) - { - if (ProcessMount(token)) { - foundSystem = true; - break; - } - } - - fclose(mountsFile); - - if (!foundSystem) { - LOGE("Couldn't find %s mount in %s", kGonkSystemPath, kGonkMountsPath); - } - return foundSystem; -} - -bool -GonkAutoMounter::ProcessMount(const char *mount) -{ - const int strSize = 256; - char mountDev[strSize]; - char mountDir[strSize]; - char mountAccess[strSize]; - - int rv = sscanf(mount, "%255s %255s %*s %255s %*d %*d\n", - mountDev, mountDir, mountAccess); - mountDev[strSize - 1] = '\0'; - mountDir[strSize - 1] = '\0'; - mountAccess[strSize - 1] = '\0'; - - if (rv != 3) { - return false; - } - - if (strcmp(kGonkSystemPath, mountDir) != 0) { - return false; - } - - free(mDevice); - mDevice = strdup(mountDev); - mAccess = Unknown; - - char *option, *optionContext; - for (option = strtok_r(mountAccess, ",", &optionContext); - option; - option = strtok_r(nullptr, ",", &optionContext)) - { - if (strcmp("ro", option) == 0) { - mAccess = ReadOnly; - break; - } else if (strcmp("rw", option) == 0) { - mAccess = ReadWrite; - break; - } - } - - return true; -} - -/* - * Mark the given block device as read-write or read-only, using the BLKROSET - * ioctl. - */ -static void SetBlockReadWriteStatus(const char *blockdev, bool setReadOnly) { - int fd; - int roMode = setReadOnly ? 1 : 0; - - fd = open(blockdev, O_RDONLY); - if (fd < 0) { - return; - } - - if (ioctl(fd, BLKROSET, &roMode) == -1) { - LOGE("Error setting read-only mode on %s to %s: %s", blockdev, - setReadOnly ? "true": "false", strerror(errno)); - } - close(fd); -} - - -bool -GonkAutoMounter::MountSystem(unsigned long flags) -{ - if (!mDevice) { - LOGE("No device was found for %s", kGonkSystemPath); - return false; - } - - // Without setting the block device ro mode to false, we get a permission - // denied error while trying to remount it in read-write. - SetBlockReadWriteStatus(mDevice, (flags & MS_RDONLY)); - - const char *readOnly = flags & MS_RDONLY ? "read-only" : "read-write"; - int result = mount(mDevice, kGonkSystemPath, "none", flags, nullptr); - - if (result != 0) { - LOGE("Error mounting %s as %s: %s", kGonkSystemPath, readOnly, - strerror(errno)); - return false; - } - - LOGI("Mounted %s partition as %s", kGonkSystemPath, readOnly); - return true; -} diff --git a/toolkit/mozapps/update/updater/automounter_gonk.h b/toolkit/mozapps/update/updater/automounter_gonk.h deleted file mode 100644 index e40cacbc2..000000000 --- a/toolkit/mozapps/update/updater/automounter_gonk.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -#ifndef AUTOMOUNTER_GONK_H__ -#define AUTOMOUNTER_GONK_H__ - -typedef enum { - ReadOnly, - ReadWrite, - Unknown -} MountAccess; - -/** - * This class will remount the /system partition as read-write in Gonk to allow - * the updater write access. Upon destruction, /system will be remounted back to - * read-only. If something causes /system to remain read-write, this class will - * reboot the device and allow the system to mount as read-only. - * - * Code inspired from AOSP system/core/adb/remount_service.c - */ -class GonkAutoMounter -{ -public: - GonkAutoMounter(); - ~GonkAutoMounter(); - - MountAccess GetAccess() const - { - return mAccess; - } - -private: - bool RemountSystem(MountAccess access); - bool ForceRemountReadOnly(); - bool UpdateMountStatus(); - bool ProcessMount(const char *mount); - bool MountSystem(unsigned long flags); - void Reboot(); - -private: - char *mDevice; - MountAccess mAccess; -}; - -#endif // AUTOMOUNTER_GONK_H__ diff --git a/toolkit/mozapps/update/updater/progressui_gonk.cpp b/toolkit/mozapps/update/updater/progressui_gonk.cpp deleted file mode 100644 index f77d0af63..000000000 --- a/toolkit/mozapps/update/updater/progressui_gonk.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * vim: sw=2 ts=8 et : - */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -#include <assert.h> -#include <stdio.h> - -#include <string> - -#include "android/log.h" - -#include "progressui.h" - -#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoUpdater" , ## args) - -using namespace std; - -int InitProgressUI(int *argc, char ***argv) -{ - return 0; -} - -int ShowProgressUI() -{ - LOG("Starting to apply update ...\n"); - return 0; -} - -void QuitProgressUI() -{ - LOG("Finished applying update\n"); -} - -void UpdateProgressUI(float progress) -{ - assert(0.0f <= progress && progress <= 100.0f); - - static const size_t kProgressBarLength = 50; - static size_t sLastNumBars; - size_t numBars = size_t(float(kProgressBarLength) * progress / 100.0f); - if (numBars == sLastNumBars) { - return; - } - sLastNumBars = numBars; - - size_t numSpaces = kProgressBarLength - numBars; - string bars(numBars, '='); - string spaces(numSpaces, ' '); - LOG("Progress [ %s%s ]\n", bars.c_str(), spaces.c_str()); -} diff --git a/toolkit/mozapps/update/updater/updater-common.build b/toolkit/mozapps/update/updater/updater-common.build index 02b7338bc..6444df8d9 100644 --- a/toolkit/mozapps/update/updater/updater-common.build +++ b/toolkit/mozapps/update/updater/updater-common.build @@ -90,17 +90,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': LOCAL_INCLUDES += [ '/toolkit/xre', ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - have_progressui = 1 - srcs += [ - 'automounter_gonk.cpp', - 'progressui_gonk.cpp', - ] - DISABLE_STL_WRAPPING = True - OS_LIBS += [ - 'cutils', - 'sysutils', - ] if have_progressui == 0: srcs += [ diff --git a/toolkit/mozapps/update/updater/updater.cpp b/toolkit/mozapps/update/updater/updater.cpp index 63a92c084..dbf50329c 100644 --- a/toolkit/mozapps/update/updater/updater.cpp +++ b/toolkit/mozapps/update/updater/updater.cpp @@ -110,33 +110,10 @@ struct UpdateServerThreadArgs #define USE_EXECV #endif -#if defined(MOZ_WIDGET_GONK) -# include "automounter_gonk.h" -# include <unistd.h> -# include <android/log.h> -# include <linux/ioprio.h> -# include <sys/resource.h> - -#if ANDROID_VERSION < 21 -// The only header file in bionic which has a function prototype for ioprio_set -// is libc/include/sys/linux-unistd.h. However, linux-unistd.h conflicts -// badly with unistd.h, so we declare the prototype for ioprio_set directly. -extern "C" MOZ_EXPORT int ioprio_set(int which, int who, int ioprio); -#else -# include <sys/syscall.h> -static int ioprio_set(int which, int who, int ioprio) { - return syscall(__NR_ioprio_set, which, who, ioprio); -} -#endif - -# define MAYBE_USE_HARD_LINKS 1 -static bool sUseHardLinks = true; -#else # define MAYBE_USE_HARD_LINKS 0 -#endif #if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \ - !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK) + !defined(XP_MACOSX) #include "nss.h" #include "prerror.h" #endif @@ -2495,44 +2472,9 @@ ReadMARChannelIDs(const NS_tchar *path, MARChannelStringTable *results) static int GetUpdateFileName(NS_tchar *fileName, int maxChars) { -#if defined(MOZ_WIDGET_GONK) - // If an update.link file exists, then it will contain the name - // of the update file (terminated by a newline). - - NS_tchar linkFileName[MAXPATHLEN]; - NS_tsnprintf(linkFileName, sizeof(linkFileName)/sizeof(linkFileName[0]), - NS_T("%s/update.link"), gPatchDirPath); - AutoFile linkFile(NS_tfopen(linkFileName, NS_T("rb"))); - if (linkFile == nullptr) { - NS_tsnprintf(fileName, maxChars, - NS_T("%s/update.mar"), gPatchDirPath); - return OK; - } - - char dataFileName[MAXPATHLEN]; - size_t bytesRead; - - if ((bytesRead = fread(dataFileName, 1, sizeof(dataFileName)-1, linkFile)) <= 0) { - *fileName = NS_T('\0'); - return READ_ERROR; - } - if (dataFileName[bytesRead-1] == '\n') { - // Strip trailing newline (for \n and \r\n) - bytesRead--; - } - if (dataFileName[bytesRead-1] == '\r') { - // Strip trailing CR (for \r, \r\n) - bytesRead--; - } - dataFileName[bytesRead] = '\0'; - - strncpy(fileName, dataFileName, maxChars-1); - fileName[maxChars-1] = '\0'; -#else - // We currently only support update.link files under GONK + // We currently don't support update.link files NS_tsnprintf(fileName, maxChars, NS_T("%s/update.mar"), gPatchDirPath); -#endif return OK; } @@ -2776,26 +2718,8 @@ int NS_main(int argc, NS_tchar **argv) } #endif -#if defined(MOZ_WIDGET_GONK) - if (EnvHasValue("LD_PRELOAD")) { - // If the updater is launched with LD_PRELOAD set, then we wind up - // preloading libmozglue.so. Under some circumstances, this can cause - // the remount of /system to fail when going from rw to ro, so if we - // detect LD_PRELOAD we unsetenv it and relaunch ourselves without it. - // This will cause the offending preloaded library to be closed. - // - // For a variety of reasons, this is really hard to do in a safe manner - // in the parent process, so we do it here. - unsetenv("LD_PRELOAD"); - execv(argv[0], argv); - __android_log_print(ANDROID_LOG_INFO, "updater", - "execve failed: errno: %d. Exiting...", errno); - _exit(1); - } -#endif - #if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \ - !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK) + !defined(XP_MACOSX) // On Windows and Mac we rely on native APIs to do verifications so we don't // need to initialize NSS at all there. // Otherwise, minimize the amount of NSS we depend on by avoiding all the NSS @@ -3085,36 +3009,6 @@ int NS_main(int argc, NS_tchar **argv) } #endif -#ifdef MOZ_WIDGET_GONK - const char *prioEnv = getenv("MOZ_UPDATER_PRIO"); - if (prioEnv) { - int32_t prioVal; - int32_t oomScoreAdj; - int32_t ioprioClass; - int32_t ioprioLevel; - if (sscanf(prioEnv, "%d/%d/%d/%d", - &prioVal, &oomScoreAdj, &ioprioClass, &ioprioLevel) == 4) { - LOG(("MOZ_UPDATER_PRIO=%s", prioEnv)); - if (setpriority(PRIO_PROCESS, 0, prioVal)) { - LOG(("setpriority(%d) failed, errno = %d", prioVal, errno)); - } - if (ioprio_set(IOPRIO_WHO_PROCESS, 0, - IOPRIO_PRIO_VALUE(ioprioClass, ioprioLevel))) { - LOG(("ioprio_set(%d,%d) failed: errno = %d", - ioprioClass, ioprioLevel, errno)); - } - FILE *fs = fopen("/proc/self/oom_score_adj", "w"); - if (fs) { - fprintf(fs, "%d", oomScoreAdj); - fclose(fs); - } else { - LOG(("Unable to open /proc/self/oom_score_adj for writing, errno = %d", - errno)); - } - } - } -#endif - #ifdef XP_WIN if (pid > 0) { HANDLE parent = OpenProcess(SYNCHRONIZE, false, (DWORD) pid); @@ -3439,27 +3333,6 @@ int NS_main(int argc, NS_tchar **argv) } #endif -#if defined(MOZ_WIDGET_GONK) - // In gonk, the master b2g process sets its umask to 0027 because - // there's no reason for it to ever create world-readable files. - // The updater binary, however, needs to do this, and it inherits - // the master process's cautious umask. So we drop down a bit here. - umask(0022); - - // Remount the /system partition as read-write for gonk. The destructor will - // remount /system as read-only. We add an extra level of scope here to avoid - // calling LogFinish() before the GonkAutoMounter destructor has a chance - // to be called - { -#if !defined(TEST_UPDATER) - GonkAutoMounter mounter; - if (mounter.GetAccess() != MountAccess::ReadWrite) { - WriteStatusFile(FILESYSTEM_MOUNT_READWRITE_ERROR); - return 1; - } -#endif -#endif - if (sStagedUpdate) { // When staging updates, blow away the old installation directory and create // it from scratch. @@ -3759,10 +3632,6 @@ int NS_main(int argc, NS_tchar **argv) } #endif /* XP_WIN */ -#if defined(MOZ_WIDGET_GONK) - } // end the extra level of scope for the GonkAutoMounter -#endif - #ifdef XP_MACOSX // When the update is successful remove the precomplete file in the root of // the application bundle and move the distribution directory from diff --git a/toolkit/mozapps/webextensions/extensions.manifest b/toolkit/mozapps/webextensions/extensions.manifest index c7d2ee386..7ce20c3ec 100644 --- a/toolkit/mozapps/webextensions/extensions.manifest +++ b/toolkit/mozapps/webextensions/extensions.manifest @@ -5,7 +5,6 @@ component {e0a106ed-6ad4-47a4-b6af-2f1c8aa4712d} nsBlocklistServiceContent.js pr contract @mozilla.org/extensions/blocklist;1 {e0a106ed-6ad4-47a4-b6af-2f1c8aa4712d} process=content category update-timer nsBlocklistService @mozilla.org/extensions/blocklist;1,getService,blocklist-background-update-timer,extensions.blocklist.interval,86400 -#ifndef MOZ_WIDGET_GONK component {4399533d-08d1-458c-a87a-235f74451cfa} addonManager.js contract @mozilla.org/addons/integration;1 {4399533d-08d1-458c-a87a-235f74451cfa} #ifndef MOZ_WIDGET_ANDROID @@ -22,6 +21,5 @@ category JavaScript-global-property InstallTrigger @mozilla.org/addons/installtr category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm #endif category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm -#endif component {8866d8e3-4ea5-48b7-a891-13ba0ac15235} amWebAPI.js contract @mozilla.org/addon-web-api/manager;1 {8866d8e3-4ea5-48b7-a891-13ba0ac15235} diff --git a/toolkit/mozapps/webextensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/webextensions/internal/AddonUpdateChecker.jsm index 918ba5328..bdd3a81e7 100644 --- a/toolkit/mozapps/webextensions/internal/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/webextensions/internal/AddonUpdateChecker.jsm @@ -929,8 +929,17 @@ this.AddonUpdateChecker = { * down in-progress update requests */ checkForUpdates: function(aId, aUpdateKey, aUrl, aObserver) { - // Exclude default theme - if (aId != "{972ce4c6-7e08-4474-a285-3208198ce6fd}") + // Define an array of internally used IDs to NOT send to AUS such as the + // Default Theme. Please keep this list in sync with: + // toolkit/mozapps/extensions/AddonUpdateChecker.jsm + let internalIDS = [ + '{972ce4c6-7e08-4474-a285-3208198ce6fd}', + 'modern@themes.mozilla.org' + ]; + + // If the ID is not in the array then go ahead and query AUS + if (internalIDS.indexOf(aId) == -1) { return new UpdateParser(aId, aUpdateKey, aUrl, aObserver); + } } }; diff --git a/toolkit/mozapps/webextensions/nsBlocklistService.js b/toolkit/mozapps/webextensions/nsBlocklistService.js index 0af90430c..268c197fc 100644 --- a/toolkit/mozapps/webextensions/nsBlocklistService.js +++ b/toolkit/mozapps/webextensions/nsBlocklistService.js @@ -907,10 +907,6 @@ Blocklist.prototype = { this._handleEmItemNode); break; case "pluginItems": - // We don't support plugins on b2g. - if (AppConstants.MOZ_B2G) { - return; - } this._pluginEntries = this._processItemNodes(element.childNodes, "pluginItem", this._handlePluginItemNode); break; @@ -1151,8 +1147,7 @@ Blocklist.prototype = { /* See nsIBlocklistService */ getPluginBlocklistState: function(plugin, appVersion, toolkitVersion) { - if (AppConstants.platform == "android" || - AppConstants.MOZ_B2G) { + if (AppConstants.platform == "android") { return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; } if (!this._isBlocklistLoaded()) @@ -1314,10 +1309,6 @@ Blocklist.prototype = { }, _blocklistUpdated: function(oldAddonEntries, oldPluginEntries) { - if (AppConstants.MOZ_B2G) { - return; - } - var addonList = []; // A helper function that reverts the prefs passed to default values. diff --git a/toolkit/profile/nsProfileLock.cpp b/toolkit/profile/nsProfileLock.cpp index cc9ecb62e..d75b6082d 100644 --- a/toolkit/profile/nsProfileLock.cpp +++ b/toolkit/profile/nsProfileLock.cpp @@ -30,10 +30,6 @@ #include "prenv.h" #endif -#if defined(MOZ_WIDGET_GONK) -#include <sys/syscall.h> -#endif - // ********************************************************************** // class nsProfileLock // @@ -192,25 +188,6 @@ void nsProfileLock::FatalSignalHandler(int signo } } -#ifdef MOZ_WIDGET_GONK - switch (signo) { - case SIGQUIT: - case SIGILL: - case SIGABRT: - case SIGSEGV: - // Retrigger the signal for those that can generate a core dump - signal(signo, SIG_DFL); - if (info->si_code <= 0) { - if (syscall(__NR_tgkill, getpid(), syscall(__NR_gettid), signo) < 0) { - break; - } - } - return; - default: - break; - } -#endif - // Backstop exit call, just in case. _exit(signo); } diff --git a/toolkit/themes/linux/global/inContentUI.css b/toolkit/themes/linux/global/inContentUI.css new file mode 100644 index 000000000..afcef9274 --- /dev/null +++ b/toolkit/themes/linux/global/inContentUI.css @@ -0,0 +1,41 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +/* + * The default namespace for this file is XUL. Be sure to prefix rules that + * are applicable to both XUL and HTML with '*|'. + */ +@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); +@namespace html url("http://www.w3.org/1999/xhtml"); + +/* Page background */ +*|*:root { + -moz-appearance: none; + padding: 18px; + background-color: Window; + background-image: /* Texture */ + url("chrome://global/skin/inContentUI/background-texture.png"); + color: WindowText; +} + +/* Use the new in-content colors for #contentAreaDownloadsView. After landing + of bug 989469 the colors can be moved to *|*:root */ +*|*#contentAreaDownloadsView { + background: #f1f1f1; + color: #424e5a; +} + +html|html { + font: message-box; +} + +/* Content */ +*|*.main-content { + /* Needed to allow the radius to clip the inner content, see bug 595656 */ + overflow: hidden; + background-color: -moz-Field; + color: -moz-FieldText; + border: 1px solid ThreeDShadow; + border-radius: 5px; +} diff --git a/toolkit/themes/linux/global/jar.mn b/toolkit/themes/linux/global/jar.mn index b0d0b9ddb..0efc8c5cf 100644 --- a/toolkit/themes/linux/global/jar.mn +++ b/toolkit/themes/linux/global/jar.mn @@ -16,6 +16,7 @@ toolkit.jar: skin/classic/global/findBar.css skin/classic/global/global.css skin/classic/global/groupbox.css + skin/classic/global/inContentUI.css skin/classic/global/listbox.css skin/classic/global/menu.css skin/classic/global/menulist.css diff --git a/toolkit/themes/osx/global/inContentUI.css b/toolkit/themes/osx/global/inContentUI.css new file mode 100644 index 000000000..17e2e6ae3 --- /dev/null +++ b/toolkit/themes/osx/global/inContentUI.css @@ -0,0 +1,144 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +%include shared.inc + +/* + * The default namespace for this file is XUL. Be sure to prefix rules that + * are applicable to both XUL and HTML with '*|'. + */ +@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); +@namespace html url("http://www.w3.org/1999/xhtml"); + +/* Page background */ +*|*:root { + -moz-appearance: none; + padding: 18px; + background-image: /* Texture */ + url("chrome://global/skin/inContentUI/background-texture.png"), + /* Gradient */ + linear-gradient(#ADB5C2, #BFC6D1); +} + +/* Use the new in-content colors for #contentAreaDownloadsView. After landing + of bug 989469 the colors can be moved to *|*:root */ +*|*#contentAreaDownloadsView { + background: #f1f1f1; + color: #424e5a; +} + +html|html { + font: message-box; +} + +/* Content */ +*|*.main-content { + /* Needed to allow the radius to clip the inner content, see bug 595656 */ + overflow: hidden; + background-image: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.05)); + border: 1px solid rgba(50, 65, 92, 0.4); + border-radius: 5px; +} + +/* Buttons */ +*|button, +menulist, +colorpicker[type="button"] { + -moz-appearance: none; + padding: 1px 4px; + min-width: 60px; + border-radius: 3px; + border: 1px solid rgba(60,73,97,0.5); + box-shadow: inset 0 1px rgba(255,255,255,0.25), 0 1px rgba(255,255,255,0.25); + background-color: transparent; + background-image: linear-gradient(rgba(255,255,255,0.45), rgba(255,255,255,0.2)); + background-clip: padding-box; + color: #252F3B; + text-shadow: @loweredShadow@; +} + +button:-moz-focusring > .button-box, +menulist:-moz-focusring:not([open="true"]) > .menulist-label-box, +colorpicker[type="button"]:-moz-focusring:not([open="true"]) > .colorpicker-button-colorbox { + outline: 1px dotted #252F3B; +} + +html|button[disabled], +button[disabled="true"], +menulist[disabled="true"], +colorpicker[type="button"][disabled="true"] { + opacity: 0.8; + color: #505050; +} + +html|button:not([disabled]):active:hover, +button:not([disabled="true"]):active:hover, +menulist[open="true"]:not([disabled="true"]), +colorpicker[type="button"][open="true"]:not([disabled="true"]) { + box-shadow: inset 0 1px 3px rgba(0,0,0,.2), 0 1px rgba(255,255,255,0.25); + background-image: linear-gradient(rgba(45,54,71,0.3), rgba(45,54,71,0.1)); + border-color: rgba(60,73,97,0.7); +} + +menulist { + -moz-padding-end: 0; + margin-left: 5px; + margin-right: 5px; +} + +/* Tweak margins so the focus ring is in the right place. */ +menulist > .menulist-label-box { + -moz-margin-end: 3px; + margin-top: 1px; +} + +menulist > .menulist-label-box > .menulist-label { + margin-top: 0px !important; + margin-bottom: 0px !important; +} + +menulist > .menulist-dropmarker { + -moz-appearance: none; + display: -moz-box; + background: transparent; + border: none; + -moz-border-start: 1px solid rgba(60,73,97,0.5); + margin-top: -1px; + margin-bottom: -1px; +} + +colorpicker[type="button"] { + margin: 1px 5px 2px 5px; + padding: 3px; + height: 25px; +} + +spinbuttons { + -moz-appearance: none; +} + +spinbuttons > .spinbuttons-box > .spinbuttons-button { + min-width: 12px; +} + +.spinbuttons-button > .button-box > .button-text { + display: none; +} + +.spinbuttons-button[disabled="true"] > .button-box > .button-icon { + opacity: 0.5; +} + +spinbuttons > .spinbuttons-box > .spinbuttons-up { + list-style-image: url("chrome://global/skin/arrow/arrow-up.gif"); + border-bottom-width: 0; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} + +spinbuttons > .spinbuttons-box > .spinbuttons-down { + list-style-image: url("chrome://global/skin/arrow/arrow-dn.gif"); + border-top-left-radius: 0; + border-top-right-radius: 0; +} diff --git a/toolkit/themes/osx/global/jar.mn b/toolkit/themes/osx/global/jar.mn index 79bb062ab..9407ccee5 100644 --- a/toolkit/themes/osx/global/jar.mn +++ b/toolkit/themes/osx/global/jar.mn @@ -21,6 +21,7 @@ toolkit.jar: * skin/classic/global/findBar.css * skin/classic/global/global.css skin/classic/global/groupbox.css +* skin/classic/global/inContentUI.css skin/classic/global/linkTree.css skin/classic/global/listbox.css skin/classic/global/menu.css diff --git a/toolkit/themes/shared/alert-common.css b/toolkit/themes/shared/alert-common.css index 010e89393..17510c0db 100644 --- a/toolkit/themes/shared/alert-common.css +++ b/toolkit/themes/shared/alert-common.css @@ -15,14 +15,12 @@ } #alertBox[animate][clicked] { - animation-duration: .6s; animation-name: alert-clicked-animation; } /* This is used if the close button is clicked before the animation has finished. */ #alertBox[animate][closing] { - animation-duration: .6s; animation-name: alert-closing-animation; } diff --git a/toolkit/themes/windows/global/inContentUI.css b/toolkit/themes/windows/global/inContentUI.css new file mode 100644 index 000000000..a3bca7b06 --- /dev/null +++ b/toolkit/themes/windows/global/inContentUI.css @@ -0,0 +1,159 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +/* + * The default namespace for this file is XUL. Be sure to prefix rules that + * are applicable to both XUL and HTML with '*|'. + */ +@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); +@namespace html url("http://www.w3.org/1999/xhtml"); + +/* Page background */ +*|*:root { + -moz-appearance: none; + padding: 18px; + background-repeat: repeat; + color: -moz-dialogText; + background-color: -moz-dialog; + background-image: /* Texture */ + url("chrome://global/skin/inContentUI/background-texture.png"); +} + +html|html { + font: message-box; +} + +@media (-moz-windows-default-theme) and (-moz-os-version: windows-vista), + (-moz-windows-default-theme) and (-moz-os-version: windows-win7) { + *|*:root { + color: #000; + background-color: #CCD9EA; + } +} + +@media (-moz-windows-glass) { + *|*:root { + /* Blame shorlander for this monstrosity. */ + background-image: /* Side gradients */ + linear-gradient(to right, + rgba(255,255,255,0.2), transparent 40%, + transparent 60%, rgba(255,255,255,0.2)), + /* Aero-style light beams */ + -moz-linear-gradient(left 32deg, + /* First light beam */ + transparent 19.5%, rgba(255,255,255,0.1) 20%, + rgba(255,255,255,0.1) 21.5%, rgba(255,255,255,0.2) 22%, + rgba(255,255,255,0.2) 25.5%, rgba(255,255,255,0.1) 26%, + rgba(255,255,255,0.1) 27.5%, transparent 28%, + /* Second light beam */ + transparent 49.5%, rgba(255,255,255,0.1) 50%, + rgba(255,255,255,0.1) 52.5%, rgba(255,255,255,0.2) 53%, + rgba(255,255,255,0.2) 54.5%, rgba(255,255,255,0.1) 55%, + rgba(255,255,255,0.1) 57.5%, transparent 58%, + /* Third light beam */ + transparent 87%, rgba(255,255,255,0.2) 90%), + /* Texture */ + url("chrome://global/skin/inContentUI/background-texture.png"); + } +} + +/* Use the new in-content colors for #contentAreaDownloadsView. After landing + of bug 989469 the colors can be moved to *|*:root */ +*|*#contentAreaDownloadsView { + background: #f1f1f1; + color: #424e5a; +} + +/* Content */ +*|*.main-content { + /* Needed to allow the radius to clip the inner content, see bug 595656 */ + overflow: hidden; + background-color: rgba(255, 255, 255, 0.35); + background-image: linear-gradient(rgba(255, 255, 255, 0), + rgba(255, 255, 255, 0.75)); + border: 1px solid #C3CEDF; +} + +%ifdef XP_WIN +@media (-moz-os-version: windows-vista), + (-moz-os-version: windows-win7) { +%endif + *|*.main-content { + border-radius: 5px; + } +%ifdef XP_WIN +} +%endif + +@media (-moz-windows-glass) { + /* Buttons */ + *|button, + menulist, + colorpicker[type="button"] { + -moz-appearance: none; + color: black; + padding: 0 5px; + background: linear-gradient(rgba(251, 252, 253, 0.95), transparent 49%, + rgba(211, 212, 213, 0.45) 51%, rgba(225, 226, 229, 0.3)); + background-clip: padding-box; + border-radius: 3px; + border: 1px solid rgba(31, 64, 100, 0.4); + border-top-color: rgba(31, 64, 100, 0.3); + box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset, + 0 0 2px 1px rgba(255, 255, 255, 0.25) inset; + } + + menulist { + -moz-padding-end: 0; + } + + colorpicker[type="button"]:-moz-focusring:not([open="true"]) > .colorpicker-button-colorbox { + outline: 1px dotted ThreeDDarkShadow; + } + + html|button[disabled], + button[disabled="true"], + menulist[disabled="true"], + colorpicker[type="button"][disabled="true"] { + -moz-border-top-colors: rgba(31, 64, 100, 0.3) !important; + -moz-border-right-colors: rgba(31, 64, 100, 0.4) !important; + -moz-border-bottom-colors: rgba(31, 64, 100, 0.4) !important; + -moz-border-left-colors: rgba(31, 64, 100, 0.4) !important; + opacity: 0.8; + color: #505050; + } + + html|button:not([disabled]):active:hover, + button:not([disabled="true"]):active:hover, + menulist[open="true"]:not([disabled="true"]), + colorpicker[type="button"][open="true"]:not([disabled="true"]) { + background-color: rgba(61, 76, 92, 0.2); + border-color: rgba(39, 53, 68, 0.5); + box-shadow: 0 0 3px 1px rgba(39, 53, 68, 0.2) inset; + } + + button > .button-box { + padding: 1px !important; + } + + spinbuttons > .spinbuttons-box > .spinbuttons-button { + border-radius: 0; + padding: 0 4px; + } + + spinbuttons > .spinbuttons-box > .spinbuttons-up { + list-style-image: url("chrome://global/skin/arrow/arrow-up.gif"); + border-bottom-width: 0; + } + + spinbuttons > .spinbuttons-box > .spinbuttons-down { + list-style-image: url("chrome://global/skin/arrow/arrow-dn.gif"); + } +} + +colorpicker[type="button"] { + margin: 1px 5px 2px 5px; + padding: 3px; + height: 25px; +} diff --git a/toolkit/themes/windows/global/jar.mn b/toolkit/themes/windows/global/jar.mn index a6ccbd71d..8c5d5de5a 100644 --- a/toolkit/themes/windows/global/jar.mn +++ b/toolkit/themes/windows/global/jar.mn @@ -27,6 +27,7 @@ toolkit.jar: skin/classic/global/console/itemSelected.png (console/itemSelected.png) skin/classic/global/findBar.css * skin/classic/global/global.css +* skin/classic/global/inContentUI.css skin/classic/global/listbox.css skin/classic/global/netError.css skin/classic/global/numberbox.css diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild index 3b3bf80ae..98c109c1b 100644 --- a/toolkit/toolkit.mozbuild +++ b/toolkit/toolkit.mozbuild @@ -4,12 +4,8 @@ # 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/. -if CONFIG['MOZ_SANDBOX']: - DIRS += ['/security/sandbox'] - DIRS += [ - # Depends on NSS and NSPR, and must be built after sandbox or else B2G emulator - # builds fail. + # Depends on NSS and NSPR '/security/certverifier', # Depends on certverifier '/security/apps', @@ -132,8 +128,7 @@ DIRS += [ if CONFIG['MOZ_PREF_EXTENSIONS']: DIRS += ['/extensions/pref'] -if CONFIG['MOZ_DEVTOOLS_SERVER']: - DIRS += ['/devtools'] +DIRS += ['/devtools'] DIRS += [ '/services', @@ -153,7 +148,7 @@ DIRS += [ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: DIRS += ['/toolkit/system/gnome'] -if CONFIG['ENABLE_MARIONETTE'] or CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('gonk', 'android'): +if CONFIG['ENABLE_MARIONETTE'] or CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('android'): DIRS += [ '/testing/firefox-ui', '/testing/marionette', diff --git a/toolkit/xre/EventTracer.cpp b/toolkit/xre/EventTracer.cpp index cb0d88524..f1118f1b2 100644 --- a/toolkit/xre/EventTracer.cpp +++ b/toolkit/xre/EventTracer.cpp @@ -65,12 +65,6 @@ #include <prthread.h> #include <prtime.h> -#ifdef MOZ_WIDGET_GONK -#include "nsThreadUtils.h" -#include "nsIObserverService.h" -#include "mozilla/Services.h" -#endif - using mozilla::TimeDuration; using mozilla::TimeStamp; using mozilla::FireAndWaitForTracerEvent; @@ -85,31 +79,6 @@ struct TracerStartClosure { int32_t mThresholdInterval; }; -#ifdef MOZ_WIDGET_GONK -class EventLoopLagDispatcher : public Runnable -{ - public: - explicit EventLoopLagDispatcher(int aLag) - : mLag(aLag) {} - - NS_IMETHOD Run() override - { - nsCOMPtr<nsIObserverService> obsService = - mozilla::services::GetObserverService(); - if (!obsService) { - return NS_ERROR_FAILURE; - } - - nsAutoString value; - value.AppendInt(mLag); - return obsService->NotifyObservers(nullptr, "event-loop-lag", value.get()); - } - - private: - int mLag; -}; -#endif - /* * The tracer thread fires events at the native event loop roughly * every kMeasureInterval. It will sleep to attempt not to send them @@ -180,10 +149,6 @@ void TracerThread(void *arg) fprintf(log, "MOZ_EVENT_TRACE sample %llu %lf\n", now, duration.ToMilliseconds()); -#ifdef MOZ_WIDGET_GONK - NS_DispatchToMainThread( - new EventLoopLagDispatcher(int(duration.ToSecondsSigDigits() * 1000))); -#endif } if (next_sleep > duration.ToMilliseconds()) { diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build index 7ada19d41..55b59ca83 100644 --- a/toolkit/xre/moz.build +++ b/toolkit/xre/moz.build @@ -149,12 +149,6 @@ LOCAL_INCLUDES += [ '/xpcom/build', ] -if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT': - LOCAL_INCLUDES += [ - '/security/sandbox/chromium', - '/security/sandbox/chromium-shim', - ] - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': LOCAL_INCLUDES += [ '/widget', diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 3493cd837..2050b9671 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -106,10 +106,6 @@ #endif #endif -#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) -#include "nsIUUIDGenerator.h" -#endif - #ifdef ACCESSIBILITY #include "nsAccessibilityService.h" #if defined(XP_WIN) @@ -197,14 +193,6 @@ #include "GeneratedJNIWrappers.h" #endif -#if defined(MOZ_SANDBOX) -#if defined(XP_LINUX) && !defined(ANDROID) -#include "mozilla/SandboxInfo.h" -#elif defined(XP_WIN) -#include "SandboxBroker.h" -#endif -#endif - extern uint32_t gRestartMode; extern void InstallSignalHandlers(const char *ProgramName); @@ -2952,25 +2940,6 @@ XREMain::XRE_mainInit(bool* aExitFlag) if (NS_FAILED(rv)) return 1; -#if defined(MOZ_SANDBOX) && defined(XP_WIN) - if (mAppData->sandboxBrokerServices) { - SandboxBroker::Initialize(mAppData->sandboxBrokerServices); - Telemetry::Accumulate(Telemetry::SANDBOX_BROKER_INITIALIZED, true); - } else { - Telemetry::Accumulate(Telemetry::SANDBOX_BROKER_INITIALIZED, false); -#if defined(MOZ_CONTENT_SANDBOX) - // If we're sandboxing content and we fail to initialize, then crashing here - // seems like the sensible option. - if (BrowserTabsRemoteAutostart()) { - MOZ_CRASH("Failed to initialize broker services, can't continue."); - } -#endif - // Otherwise just warn for the moment, as most things will work. - NS_WARNING("Failed to initialize broker services, sandboxed processes will " - "fail to start."); - } -#endif - #ifdef XP_MACOSX // Set up ability to respond to system (Apple) events. This must occur before // ProcessUpdates to ensure that links clicked in external applications aren't @@ -3913,24 +3882,6 @@ XREMain::XRE_mainRun() } #endif /* MOZ_INSTRUMENT_EVENT_LOOP */ -#if defined(MOZ_SANDBOX) && defined(XP_LINUX) && !defined(MOZ_WIDGET_GONK) - // If we're on Linux, we now have information about the OS capabilities - // available to us. - SandboxInfo sandboxInfo = SandboxInfo::Get(); - Telemetry::Accumulate(Telemetry::SANDBOX_HAS_SECCOMP_BPF, - sandboxInfo.Test(SandboxInfo::kHasSeccompBPF)); - Telemetry::Accumulate(Telemetry::SANDBOX_HAS_SECCOMP_TSYNC, - sandboxInfo.Test(SandboxInfo::kHasSeccompTSync)); - Telemetry::Accumulate(Telemetry::SANDBOX_HAS_USER_NAMESPACES_PRIVILEGED, - sandboxInfo.Test(SandboxInfo::kHasPrivilegedUserNamespaces)); - Telemetry::Accumulate(Telemetry::SANDBOX_HAS_USER_NAMESPACES, - sandboxInfo.Test(SandboxInfo::kHasUserNamespaces)); - Telemetry::Accumulate(Telemetry::SANDBOX_CONTENT_ENABLED, - sandboxInfo.Test(SandboxInfo::kEnabledForContent)); - Telemetry::Accumulate(Telemetry::SANDBOX_MEDIA_ENABLED, - sandboxInfo.Test(SandboxInfo::kEnabledForMedia)); -#endif /* MOZ_SANDBOX && XP_LINUX && !MOZ_WIDGET_GONK */ - { rv = appStartup->Run(); if (NS_FAILED(rv)) { @@ -3996,10 +3947,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData) // See bug 1279614. XRE_CreateStatsObject(); -#if defined(MOZ_SANDBOX) && defined(XP_LINUX) && !defined(ANDROID) - SandboxInfo::ThreadingCheck(); -#endif - char aLocal; GeckoProfilerInitRAII profilerGuard(&aLocal); diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 4a612e495..f62dbdd6d 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -75,15 +75,6 @@ #include "mozilla/Telemetry.h" -#if defined(MOZ_SANDBOX) && defined(XP_WIN) -#include "mozilla/sandboxTarget.h" -#include "mozilla/sandboxing/loggingCallbacks.h" -#endif - -#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK) -#include "mozilla/Preferences.h" -#endif - #ifdef MOZ_IPDL_TESTS #include "mozilla/_ipdltest/IPDLUnitTests.h" #include "mozilla/_ipdltest/IPDLUnitTestProcessChild.h" @@ -264,7 +255,7 @@ XRE_InitChildProcess(int aArgc, setupProfilingStuff(); #endif -#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GONK) +#if !defined(MOZ_WIDGET_ANDROID) // On non-Fennec Gecko, the GMPLoader code resides in plugin-container, // and we must forward it through to the GMP code here. GMPProcessChild::SetGMPLoader(aChildData->gmpLoader.get()); @@ -299,11 +290,6 @@ XRE_InitChildProcess(int aArgc, freopen("CONIN$", "r", stdin); } -#if defined(MOZ_SANDBOX) - if (aChildData->sandboxTargetServices) { - SandboxTarget::Instance()->SetTargetServices(aChildData->sandboxTargetServices); - } -#endif #endif // NB: This must be called before profiler_init @@ -519,11 +505,6 @@ XRE_InitChildProcess(int aArgc, // If passed in grab the application path for xpcom init bool foundAppdir = false; -#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) - // If passed in grab the profile path for sandboxing - bool foundProfile = false; -#endif - for (int idx = aArgc; idx > 0; idx--) { if (aArgv[idx] && !strcmp(aArgv[idx], "-appdir")) { MOZ_ASSERT(!foundAppdir); @@ -539,19 +520,6 @@ XRE_InitChildProcess(int aArgc, if (aArgv[idx] && !strcmp(aArgv[idx], "-safeMode")) { gSafeMode = true; } - -#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) - if (aArgv[idx] && !strcmp(aArgv[idx], "-profile")) { - MOZ_ASSERT(!foundProfile); - if (foundProfile) { - continue; - } - nsCString profile; - profile.Assign(nsDependentCString(aArgv[idx+1])); - static_cast<ContentProcess*>(process.get())->SetProfile(profile); - foundProfile = true; - } -#endif /* XP_MACOSX && MOZ_CONTENT_SANDBOX */ } } break; @@ -587,12 +555,6 @@ XRE_InitChildProcess(int aArgc, ::SetProcessShutdownParameters(0x280 - 1, SHUTDOWN_NORETRY); #endif -#if defined(MOZ_SANDBOX) && defined(XP_WIN) - // We need to do this after the process has been initialised, as - // InitLoggingIfRequired may need access to prefs. - mozilla::sandboxing::InitLoggingIfRequired(aChildData->ProvideLogFunction); -#endif - OverrideDefaultLocaleIfNeeded(); // Run the UI event loop on the main thread. diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp index 54a711000..ab0bdf005 100644 --- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -74,23 +74,6 @@ GetUpdateLog() #define UPDATER_PNG "updater.png" #endif -#if defined(MOZ_WIDGET_GONK) -#include <linux/ioprio.h> - -static const int kB2GServiceArgc = 2; -static const char *kB2GServiceArgv[] = { "/system/bin/start", "b2g" }; - -static const char kAppUpdaterPrio[] = "app.update.updater.prio"; -static const char kAppUpdaterOomScoreAdj[] = "app.update.updater.oom_score_adj"; -static const char kAppUpdaterIOPrioClass[] = "app.update.updater.ioprio.class"; -static const char kAppUpdaterIOPrioLevel[] = "app.update.updater.ioprio.level"; - -static const int kAppUpdaterPrioDefault = 19; // -20..19 where 19 = lowest priority -static const int kAppUpdaterOomScoreAdjDefault = -1000; // -1000 = Never kill -static const int kAppUpdaterIOPrioClassDefault = IOPRIO_CLASS_IDLE; -static const int kAppUpdaterIOPrioLevelDefault = 0; // Doesn't matter for CLASS IDLE -#endif - static nsresult GetCurrentWorkingDir(char *buf, size_t size) { @@ -387,7 +370,7 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir, * @param pathToAppend A new library path to prepend to LD_LIBRARY_PATH */ #if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \ - !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK) + !defined(XP_MACOSX) #include "prprf.h" #define PATH_SEPARATOR ":" #define LD_LIBRARY_PATH_ENVVAR_NAME "LD_LIBRARY_PATH" @@ -503,15 +486,9 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, #else nsAutoCString appFilePath; -#if defined(MOZ_WIDGET_GONK) - appFilePath.Assign(kB2GServiceArgv[0]); - appArgc = kB2GServiceArgc; - appArgv = const_cast<char**>(kB2GServiceArgv); -#else rv = appFile->GetNativePath(appFilePath); if (NS_FAILED(rv)) return; -#endif nsAutoCString updaterPath; rv = updater->GetNativePath(updaterPath); @@ -617,19 +594,13 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, PR_SetEnv("MOZ_SAFE_MODE_RESTART=1"); } #if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \ - !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK) + !defined(XP_MACOSX) AppendToLibPath(installDirPath.get()); #endif LOG(("spawning updater process for replacing [%s]\n", updaterPath.get())); #if defined(XP_UNIX) & !defined(XP_MACOSX) -# if defined(MOZ_WIDGET_GONK) - // In Gonk, we preload libmozglue, which the updater process doesn't need. - // Since the updater will move and delete libmozglue.so, this can actually - // stop the /system mount from correctly being remounted as read-only. - unsetenv("LD_PRELOAD"); -# endif exit(execv(updaterPath.get(), argv)); #elif defined(XP_WIN) // Switch the application using updater.exe @@ -647,46 +618,6 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, #endif } -#if defined(MOZ_WIDGET_GONK) -static nsresult -GetOSApplyToDir(nsACString& applyToDir) -{ - nsCOMPtr<nsIProperties> ds = - do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID); - NS_ASSERTION(ds, "Can't get directory service"); - - nsCOMPtr<nsIFile> osApplyToDir; - nsresult rv = ds->Get(XRE_OS_UPDATE_APPLY_TO_DIR, NS_GET_IID(nsIFile), - getter_AddRefs(osApplyToDir)); - if (NS_FAILED(rv)) { - LOG(("Can't get the OS applyTo dir")); - return rv; - } - - return osApplyToDir->GetNativePath(applyToDir); -} - -static void -SetOSApplyToDir(nsIUpdate* update, const nsACString& osApplyToDir) -{ - nsresult rv; - nsCOMPtr<nsIWritablePropertyBag> updateProperties = - do_QueryInterface(update, &rv); - - if (NS_FAILED(rv)) { - return; - } - - RefPtr<nsVariant> variant = new nsVariant(); - rv = variant->SetAsACString(osApplyToDir); - if (NS_FAILED(rv)) { - return; - } - - updateProperties->SetProperty(NS_LITERAL_STRING("osApplyToDir"), variant); -} -#endif - /** * Apply an update. This applies to both normal and staged updates. * @@ -780,13 +711,9 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile, if (NS_FAILED(rv)) return; - // Get the directory where the update was staged for replace and GONK OS - // Updates or where it will be applied. -#ifndef MOZ_WIDGET_GONK - // OS Updates are only supported on GONK so force it to false on everything + // OS Updates were only supported on GONK so force it to false on everything // but GONK to simplify the following logic. isOSUpdate = false; -#endif nsAutoCString applyToDir; nsCOMPtr<nsIFile> updatedDir; if (restart && !isOSUpdate) { @@ -806,15 +733,6 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile, return; } applyToDir = NS_ConvertUTF16toUTF8(applyToDirW); -#elif MOZ_WIDGET_GONK - if (isOSUpdate) { - if (!osApplyToDir) { - return; - } - rv = osApplyToDir->GetNativePath(applyToDir); - } else { - rv = updatedDir->GetNativePath(applyToDir); - } #else rv = updatedDir->GetNativePath(applyToDir); #endif @@ -900,33 +818,13 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile, PR_SetEnv("MOZ_SAFE_MODE_RESTART=1"); } #if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \ - !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK) + !defined(XP_MACOSX) AppendToLibPath(installDirPath.get()); #endif if (isOSUpdate) { PR_SetEnv("MOZ_OS_UPDATE=1"); } -#if defined(MOZ_WIDGET_GONK) - // We want the updater to be CPU friendly and not subject to being killed by - // the low memory killer, so we pass in some preferences to allow it to - // adjust its priority. - - int32_t prioVal = Preferences::GetInt(kAppUpdaterPrio, - kAppUpdaterPrioDefault); - int32_t oomScoreAdj = Preferences::GetInt(kAppUpdaterOomScoreAdj, - kAppUpdaterOomScoreAdjDefault); - int32_t ioprioClass = Preferences::GetInt(kAppUpdaterIOPrioClass, - kAppUpdaterIOPrioClassDefault); - int32_t ioprioLevel = Preferences::GetInt(kAppUpdaterIOPrioLevel, - kAppUpdaterIOPrioLevelDefault); - nsPrintfCString prioEnv("MOZ_UPDATER_PRIO=%d/%d/%d/%d", - prioVal, oomScoreAdj, ioprioClass, ioprioLevel); - // Note: we allocate a new string on heap and pass that to PR_SetEnv, since - // the string can be used after this function returns. This means that we - // will intentionally leak this buffer. - PR_SetEnv(ToNewCString(prioEnv)); -#endif LOG(("spawning updater process [%s]\n", updaterPath.get())); @@ -1122,12 +1020,6 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate) // Check for and process any available updates bool persistent; nsresult rv = NS_ERROR_FAILURE; // Take the NS_FAILED path when non-GONK -#ifdef MOZ_WIDGET_GONK - // Check in the sdcard for updates first, since that's our preferred - // download location. - rv = dirProvider->GetFile(XRE_UPDATE_ARCHIVE_DIR, &persistent, - getter_AddRefs(updRoot)); -#endif if (NS_FAILED(rv)) { rv = dirProvider->GetFile(XRE_UPDATE_ROOT_DIR, &persistent, getter_AddRefs(updRoot)); @@ -1217,34 +1109,6 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate) } mInfo.mAppVersion = appVersion; -#if defined(MOZ_WIDGET_GONK) - NS_ENSURE_ARG_POINTER(aUpdate); - - bool isOSUpdate; - if (NS_SUCCEEDED(aUpdate->GetIsOSUpdate(&isOSUpdate)) && - isOSUpdate) { - nsAutoCString osApplyToDir; - - // This needs to be done on the main thread, so we pass it along in - // BackgroundThreadInfo - nsresult rv = GetOSApplyToDir(osApplyToDir); - if (NS_FAILED(rv)) { - LOG(("Can't get the OS apply to dir")); - return rv; - } - - SetOSApplyToDir(aUpdate, osApplyToDir); - - mInfo.mIsOSUpdate = true; - rv = NS_NewNativeLocalFile(osApplyToDir, false, - getter_AddRefs(mInfo.mOSApplyToDir)); - if (NS_FAILED(rv)) { - LOG(("Can't create nsIFile for OS apply to dir")); - return rv; - } - } -#endif - MOZ_ASSERT(NS_IsMainThread(), "not main thread"); nsCOMPtr<nsIRunnable> r = NewRunnableMethod(this, &nsUpdateProcessor::StartStagedUpdate); return NS_NewThread(getter_AddRefs(mProcessWatcher), r); diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index 09168319f..d904cb83a 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -62,11 +62,6 @@ #include "UIKitDirProvider.h" #endif -#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) -#include "nsIUUIDGenerator.h" -#include "mozilla/Unused.h" -#endif - #if defined(XP_MACOSX) #define APP_REGISTRY_NAME "Application Registry" #elif defined(XP_WIN) @@ -77,14 +72,6 @@ #define PREF_OVERRIDE_DIRNAME "preferences" -#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) -static already_AddRefed<nsIFile> GetContentProcessSandboxTempDir(); -static nsresult DeleteDirIfExists(nsIFile *dir); -static bool IsContentSandboxDisabled(); -static const char* GetContentProcessTempBaseDirKey(); -static already_AddRefed<nsIFile> CreateContentProcessSandboxTempDir(); -#endif - static already_AddRefed<nsIFile> CloneAndAppend(nsIFile* aFile, const char* name) { @@ -139,10 +126,6 @@ nsXREDirProvider::Initialize(nsIFile *aXULAppDir, } } -#ifdef MOZ_B2G - LoadAppBundleDirs(); -#endif - return NS_OK; } @@ -495,14 +478,6 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, bool unused; rv = dirsvc->GetFile("XCurProcD", &unused, getter_AddRefs(file)); } -#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) - else if (!strcmp(aProperty, NS_APP_CONTENT_PROCESS_TEMP_DIR)) { - if (!mContentTempDir && NS_FAILED((rv = LoadContentProcessTempDir()))) { - return rv; - } - rv = mContentTempDir->Clone(getter_AddRefs(file)); - } -#endif // defined(XP_WIN) && defined(MOZ_CONTENT_SANDBOX) else if (NS_SUCCEEDED(GetProfileStartupDir(getter_AddRefs(file)))) { // We need to allow component, xpt, and chrome registration to // occur prior to the profile-after-change notification. @@ -729,176 +704,6 @@ LoadExtensionDirectories(nsINIParser &parser, while (true); } -#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) - -static const char* -GetContentProcessTempBaseDirKey() -{ -#if defined(XP_WIN) - return NS_WIN_LOW_INTEGRITY_TEMP_BASE; -#else - return NS_OS_TEMP_DIR; -#endif -} - -// -// Sets mContentTempDir so that it refers to the appropriate temp dir. -// If the sandbox is enabled, NS_APP_CONTENT_PROCESS_TEMP_DIR, otherwise -// NS_OS_TEMP_DIR is used. -// -nsresult -nsXREDirProvider::LoadContentProcessTempDir() -{ - mContentTempDir = GetContentProcessSandboxTempDir(); - if (mContentTempDir) { - return NS_OK; - } else { - return NS_GetSpecialDirectory(NS_OS_TEMP_DIR, - getter_AddRefs(mContentTempDir)); - } -} - -static bool -IsContentSandboxDisabled() -{ - bool isSandboxDisabled = false; - if (!BrowserTabsRemoteAutostart()) { - return false; - } -#if defined(XP_WIN) || defined(XP_MACOSX) - isSandboxDisabled = Preferences::GetInt("security.sandbox.content.level") < 1; -#endif - return isSandboxDisabled; -} - -// -// If a content process sandbox temp dir is to be used, returns an nsIFile -// for the directory. Returns null if the content sandbox is disabled or -// an error occurs. -// -static already_AddRefed<nsIFile> -GetContentProcessSandboxTempDir() -{ - if (IsContentSandboxDisabled()) { - return nullptr; - } - - nsCOMPtr<nsIFile> localFile; - - nsresult rv = NS_GetSpecialDirectory(GetContentProcessTempBaseDirKey(), - getter_AddRefs(localFile)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return nullptr; - } - - nsAutoString tempDirSuffix; - rv = Preferences::GetString("security.sandbox.content.tempDirSuffix", - &tempDirSuffix); - if (NS_WARN_IF(NS_FAILED(rv)) || tempDirSuffix.IsEmpty()) { - return nullptr; - } - - rv = localFile->Append(NS_LITERAL_STRING("Temp-") + tempDirSuffix); - if (NS_WARN_IF(NS_FAILED(rv))) { - return nullptr; - } - - return localFile.forget(); -} - -// -// Create a temporary directory for use from sandboxed content processes. -// Only called in the parent. The path is derived from a UUID stored in a -// pref which is available to content processes. Returns null if the -// content sandbox is disabled or if an error occurs. -// -static already_AddRefed<nsIFile> -CreateContentProcessSandboxTempDir() -{ - if (IsContentSandboxDisabled()) { - return nullptr; - } - - // Get (and create if blank) temp directory suffix pref. - nsresult rv; - nsAdoptingString tempDirSuffix = - Preferences::GetString("security.sandbox.content.tempDirSuffix"); - if (tempDirSuffix.IsEmpty()) { - nsCOMPtr<nsIUUIDGenerator> uuidgen = - do_GetService("@mozilla.org/uuid-generator;1", &rv); - if (NS_WARN_IF(NS_FAILED(rv))) { - return nullptr; - } - - nsID uuid; - rv = uuidgen->GenerateUUIDInPlace(&uuid); - if (NS_WARN_IF(NS_FAILED(rv))) { - return nullptr; - } - - char uuidChars[NSID_LENGTH]; - uuid.ToProvidedString(uuidChars); - tempDirSuffix.AssignASCII(uuidChars); - - // Save the pref - rv = Preferences::SetCString("security.sandbox.content.tempDirSuffix", - uuidChars); - if (NS_WARN_IF(NS_FAILED(rv))) { - // If we fail to save the pref we don't want to create the temp dir, - // because we won't be able to clean it up later. - return nullptr; - } - - nsCOMPtr<nsIPrefService> prefsvc = Preferences::GetService(); - if (!prefsvc || NS_FAILED((rv = prefsvc->SavePrefFile(nullptr)))) { - // Again, if we fail to save the pref file we might not be able to clean - // up the temp directory, so don't create one. - NS_WARNING("Failed to save pref file, cannot create temp dir."); - return nullptr; - } - } - - nsCOMPtr<nsIFile> sandboxTempDir = GetContentProcessSandboxTempDir(); - if (!sandboxTempDir) { - NS_WARNING("Failed to determine sandbox temp dir path."); - return nullptr; - } - - // Remove the directory. It may exist due to a previous crash. - if (NS_FAILED(DeleteDirIfExists(sandboxTempDir))) { - NS_WARNING("Failed to reset sandbox temp dir."); - return nullptr; - } - - // Create the directory - rv = sandboxTempDir->Create(nsIFile::DIRECTORY_TYPE, 0700); - if (NS_FAILED(rv)) { - NS_WARNING("Failed to create sandbox temp dir."); - return nullptr; - } - - return sandboxTempDir.forget(); -} - -static nsresult -DeleteDirIfExists(nsIFile* dir) -{ - if (dir) { - // Don't return an error if the directory doesn't exist. - // Windows Remove() returns NS_ERROR_FILE_NOT_FOUND while - // OS X returns NS_ERROR_FILE_TARGET_DOES_NOT_EXIST. - nsresult rv = dir->Remove(/* aRecursive */ true); - if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND && - rv != NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) { - return rv; - } - } - return NS_OK; -} - -#endif // (defined(XP_WIN) || defined(XP_MACOSX)) && - // defined(MOZ_CONTENT_SANDBOX) - void nsXREDirProvider::LoadExtensionBundleDirectories() { @@ -952,38 +757,6 @@ nsXREDirProvider::LoadExtensionBundleDirectories() } } -#ifdef MOZ_B2G -void -nsXREDirProvider::LoadAppBundleDirs() -{ - nsCOMPtr<nsIFile> dir; - bool persistent = false; - nsresult rv = GetFile(XRE_APP_DISTRIBUTION_DIR, &persistent, getter_AddRefs(dir)); - if (NS_FAILED(rv)) - return; - - dir->AppendNative(NS_LITERAL_CSTRING("bundles")); - - nsCOMPtr<nsISimpleEnumerator> e; - rv = dir->GetDirectoryEntries(getter_AddRefs(e)); - if (NS_FAILED(rv)) - return; - - nsCOMPtr<nsIDirectoryEnumerator> files = do_QueryInterface(e); - if (!files) - return; - - nsCOMPtr<nsIFile> subdir; - while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(subdir))) && subdir) { - mAppBundleDirectories.AppendObject(subdir); - - nsCOMPtr<nsIFile> manifest = - CloneAndAppend(subdir, "chrome.manifest"); - XRE_AddManifestLocation(NS_APP_LOCATION, manifest); - } -} -#endif - static const char *const kAppendPrefDir[] = { "defaults", "preferences", nullptr }; #ifdef DEBUG_bsmedberg @@ -1203,14 +976,6 @@ nsXREDirProvider::DoStartup() } obsSvc->NotifyObservers(nullptr, "profile-initial-state", nullptr); - -#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) - // The parent is responsible for creating the sandbox temp dir - if (XRE_IsParentProcess()) { - mContentProcessSandboxTempDir = CreateContentProcessSandboxTempDir(); - mContentTempDir = mContentProcessSandboxTempDir; - } -#endif } return NS_OK; } @@ -1221,12 +986,6 @@ nsXREDirProvider::DoShutdown() PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); if (mProfileNotified) { -#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) - if (XRE_IsParentProcess()) { - Unused << DeleteDirIfExists(mContentProcessSandboxTempDir); - } -#endif - nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService(); NS_ASSERTION(obsSvc, "No observer service?"); @@ -1363,14 +1122,6 @@ nsresult nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult) { nsCOMPtr<nsIFile> updRoot; -#if defined(MOZ_WIDGET_GONK) - - nsresult rv = NS_NewNativeLocalFile(nsDependentCString("/data/local"), - true, - getter_AddRefs(updRoot)); - NS_ENSURE_SUCCESS(rv, rv); - -#else nsCOMPtr<nsIFile> appFile; bool per = false; nsresult rv = GetFile(XRE_EXECUTABLE_FILE, &per, getter_AddRefs(appFile)); @@ -1502,7 +1253,6 @@ nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult) NS_ENSURE_SUCCESS(rv, rv); #endif // XP_WIN -#endif updRoot.forget(aResult); return NS_OK; } @@ -1606,9 +1356,6 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal) NS_ENSURE_SUCCESS(rv, rv); rv = NS_NewLocalFile(path, true, getter_AddRefs(localDir)); -#elif defined(MOZ_WIDGET_GONK) - rv = NS_NewNativeLocalFile(NS_LITERAL_CSTRING("/data/b2g"), true, - getter_AddRefs(localDir)); #elif defined(XP_UNIX) const char* homeDir = getenv("HOME"); if (!homeDir || !*homeDir) diff --git a/toolkit/xre/nsXREDirProvider.h b/toolkit/xre/nsXREDirProvider.h index 7ec64da78..655f664e6 100644 --- a/toolkit/xre/nsXREDirProvider.h +++ b/toolkit/xre/nsXREDirProvider.h @@ -121,19 +121,9 @@ protected: // delimiters. static inline nsresult AppendProfileString(nsIFile* aFile, const char* aPath); -#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) - // Load the temp directory for sandboxed content processes - nsresult LoadContentProcessTempDir(); -#endif - // Calculate and register extension and theme bundle directories. void LoadExtensionBundleDirectories(); -#ifdef MOZ_B2G - // Calculate and register app-bundled extension directories. - void LoadAppBundleDirs(); -#endif - void Append(nsIFile* aDirectory); nsCOMPtr<nsIDirectoryServiceProvider> mAppProvider; @@ -146,10 +136,6 @@ protected: nsCOMPtr<nsIFile> mProfileDir; nsCOMPtr<nsIFile> mProfileLocalDir; bool mProfileNotified; -#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) - nsCOMPtr<nsIFile> mContentTempDir; - nsCOMPtr<nsIFile> mContentProcessSandboxTempDir; -#endif nsCOMArray<nsIFile> mAppBundleDirectories; nsCOMArray<nsIFile> mExtensionDirectories; nsCOMArray<nsIFile> mThemeDirectories; |