diff --git a/.eslintignore b/.eslintignore index 9dabcaf52c0..4893d462952 100644 --- a/.eslintignore +++ b/.eslintignore @@ -44,29 +44,6 @@ services/** startupcache/** storage/** testing/** -toolkit/components/** -toolkit/content/** -toolkit/crashreporter/** -toolkit/forgetaboutsite/** -toolkit/identity/** -toolkit/library/** -toolkit/locales/** -toolkit/modules/** -# This file contains preprocessor statements. -toolkit/mozapps/extensions/internal/AddonConstants.jsm -toolkit/mozapps/downloads/** -toolkit/mozapps/handling/** -toolkit/mozapps/installer/** -toolkit/mozapps/preferences/** -toolkit/mozapps/update/** -toolkit/obsolete/** -toolkit/pluginproblem/** -toolkit/profile/** -toolkit/system/** -toolkit/themes/** -toolkit/toolkit.mozbuild/** -toolkit/webapps/** -toolkit/xre/** tools/** uriloader/** view/** @@ -196,3 +173,34 @@ mobile/android/components/Snippets.js # Bug 1178739: Ignore this file as a quick fix for "Illegal yield expression" mobile/android/modules/HomeProvider.jsm + +# toolkit/ exclusions + +# Not part of the default build +toolkit/components/help/** + +# Intentionally invalid JS +toolkit/components/workerloader/tests/moduleF-syntax-error.js + +# Tests old non-star function generators +toolkit/modules/tests/xpcshell/test_task.js + +# Not yet updated +toolkit/components/osfile/** +toolkit/components/passwordmgr/** +toolkit/components/places/** +toolkit/mozapps/extensions/** + +# Uses preprocessing +toolkit/content/contentAreaUtils.js +toolkit/components/jsdownloads/src/DownloadIntegration.jsm +toolkit/components/search/nsSearchService.js +toolkit/components/url-classifier/** +toolkit/components/urlformatter/nsURLFormatter.js +toolkit/identity/FirefoxAccounts.jsm +toolkit/modules/AppConstants.jsm +toolkit/modules/SessionRecorder.jsm +toolkit/mozapps/downloads/nsHelperAppDlg.js +toolkit/mozapps/extensions/internal/AddonConstants.jsm +toolkit/mozapps/update/tests/data/xpcshellConstantsPP.js +toolkit/webapps/** diff --git a/toolkit/components/aboutperformance/content/aboutPerformance.js b/toolkit/components/aboutperformance/content/aboutPerformance.js index b6e846baf84..ca0d14caeae 100644 --- a/toolkit/components/aboutperformance/content/aboutPerformance.js +++ b/toolkit/components/aboutperformance/content/aboutPerformance.js @@ -561,7 +561,7 @@ var View = { cachedElements.eltName.textContent = `Full name: ${delta.fullName}.`; cachedElements.eltLoaded.textContent = `Measure start: ${Math.round(delta.age/1000)} seconds ago.` - let processes = [for (proc of delta.diff.processes) `${proc.processId} (${proc.isChildProcess?"child":"parent"})`]; + let processes = delta.diff.processes.map(proc => `${proc.processId} (${proc.isChildProcess?"child":"parent"})`); cachedElements.eltProcess.textContent = `Processes: ${processes.join(", ")}`; let jankSuffix = ""; let cpowSuffix = ""; diff --git a/toolkit/components/aboutperformance/tests/browser/browser_aboutperformance.js b/toolkit/components/aboutperformance/tests/browser/browser_aboutperformance.js index b8188cd8016..5521fad5239 100644 --- a/toolkit/components/aboutperformance/tests/browser/browser_aboutperformance.js +++ b/toolkit/components/aboutperformance/tests/browser/browser_aboutperformance.js @@ -164,8 +164,8 @@ function frameScript() { return; } - let addonTitles = [for (eltContent of eltAddons.querySelectorAll("span.title")) eltContent.textContent]; - let webTitles = [for (eltContent of eltWeb.querySelectorAll("span.title")) eltContent.textContent]; + let addonTitles = Array.from(eltAddons.querySelectorAll("span.title"), elt => elt.textContent); + let webTitles = Array.from(eltWeb.querySelectorAll("span.title"), elt => elt.textContent); hasTitleInAddons = addonTitles.includes(title); hasTitleInWebpages = webTitles.includes(title); diff --git a/toolkit/components/apppicker/content/appPicker.js b/toolkit/components/apppicker/content/appPicker.js index e02b77f6af8..3e648efc990 100644 --- a/toolkit/components/apppicker/content/appPicker.js +++ b/toolkit/components/apppicker/content/appPicker.js @@ -1,8 +1,8 @@ -# -*- indent-tabs-mode: nil; js-indent-level: 2 -*- -# -# 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/. +/* 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/. */ + +Components.utils.import("resource://gre/modules/AppConstants.jsm"); function AppPicker() {}; @@ -117,20 +117,19 @@ AppPicker.prototype = * Retrieve the pretty description from the file */ getFileDisplayName: function getFileDisplayName(file) { -#ifdef XP_WIN - if (file instanceof Components.interfaces.nsILocalFileWin) { - try { - return file.getVersionInfoField("FileDescription"); - } catch (e) {} + if (AppConstants.platform == "win") { + if (file instanceof Components.interfaces.nsILocalFileWin) { + try { + return file.getVersionInfoField("FileDescription"); + } catch (e) {} + } + } else if (AppConstants.platform == "macosx") { + if (file instanceof Components.interfaces.nsILocalFileMac) { + try { + return file.bundleDisplayName; + } catch (e) {} + } } -#endif -#ifdef XP_MACOSX - if (file instanceof Components.interfaces.nsILocalFileMac) { - try { - return file.bundleDisplayName; - } catch (e) {} - } -#endif return file.leafName; }, @@ -186,15 +185,13 @@ AppPicker.prototype = var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties); var startLocation; -#ifdef XP_WIN - startLocation = "ProgF"; // Program Files -#else -#ifdef XP_MACOSX - startLocation = "LocApp"; // Local Applications -#else - startLocation = "Home"; -#endif -#endif + if (AppConstants.platform == "win") { + startLocation = "ProgF"; // Program Files + } else if (AppConstants.platform == "macosx") { + startLocation = "LocApp"; // Local Applications + } else { + startLocation = "Home"; + } fp.displayDirectory = fileLoc.get(startLocation, Components.interfaces.nsILocalFile); diff --git a/toolkit/components/apppicker/jar.mn b/toolkit/components/apppicker/jar.mn index d8431c3fea2..60e029d8a72 100644 --- a/toolkit/components/apppicker/jar.mn +++ b/toolkit/components/apppicker/jar.mn @@ -4,5 +4,5 @@ toolkit.jar: content/global/appPicker.xul (content/appPicker.xul) -* content/global/appPicker.js (content/appPicker.js) + content/global/appPicker.js (content/appPicker.js) diff --git a/toolkit/components/filewatcher/tests/xpcshell/test_arguments.js b/toolkit/components/filewatcher/tests/xpcshell/test_arguments.js index 8bc22605617..7e62b1cb60a 100644 --- a/toolkit/components/filewatcher/tests/xpcshell/test_arguments.js +++ b/toolkit/components/filewatcher/tests/xpcshell/test_arguments.js @@ -29,14 +29,18 @@ add_task(function* test_null_args_addPath() { // Check for error when passing a null first argument try { watcher.addPath(testPath, null, dummyFunc); - } catch (ex if ex.result == Cr.NS_ERROR_NULL_POINTER) { + } catch (ex) { + if (ex.result != Cr.NS_ERROR_NULL_POINTER) + throw ex; do_print("Initialisation thrown NS_ERROR_NULL_POINTER as expected."); } // Check for error when passing both null arguments try { watcher.addPath(testPath, null, null); - } catch (ex if ex.result == Cr.NS_ERROR_NULL_POINTER) { + } catch (ex) { + if (ex.result != Cr.NS_ERROR_NULL_POINTER) + throw ex; do_print("Initialisation thrown NS_ERROR_NULL_POINTER as expected."); } }); @@ -58,14 +62,18 @@ add_task(function* test_null_args_removePath() { // Check for error when passing a null first argument try { watcher.removePath(testPath, null, dummyFunc); - } catch (ex if ex.result == Cr.NS_ERROR_NULL_POINTER) { + } catch (ex) { + if (ex.result != Cr.NS_ERROR_NULL_POINTER) + throw ex; do_print("Initialisation thrown NS_ERROR_NULL_POINTER as expected."); } // Check for error when passing both null arguments try { watcher.removePath(testPath, null, null); - } catch (ex if ex.result == Cr.NS_ERROR_NULL_POINTER) { + } catch (ex) { + if (ex.result != Cr.NS_ERROR_NULL_POINTER) + throw ex; do_print("Initialisation thrown NS_ERROR_NULL_POINTER as expected."); } }); diff --git a/toolkit/components/lz4/tests/xpcshell/test_lz4_sync.js b/toolkit/components/lz4/tests/xpcshell/test_lz4_sync.js index 7f2f21271cc..61605373b79 100644 --- a/toolkit/components/lz4/tests/xpcshell/test_lz4_sync.js +++ b/toolkit/components/lz4/tests/xpcshell/test_lz4_sync.js @@ -13,7 +13,7 @@ function compare_arrays(a, b) { return Array.prototype.join.call(a) == Array.prototype.join.call(a); } -add_task(function() { +add_task(function*() { let path = OS.Path.join("data", "compression.lz"); let data = yield OS.File.read(path); let decompressed = Lz4.decompressFileContent(data); @@ -21,7 +21,7 @@ add_task(function() { do_check_eq(text, "Hello, lz4"); }); -add_task(function() { +add_task(function*() { for (let length of [0, 1, 1024]) { let array = new Uint8Array(length); for (let i = 0; i < length; ++i) { diff --git a/toolkit/components/microformats/Microformats.js b/toolkit/components/microformats/Microformats.js index c291160314f..8c0433ffdfa 100644 --- a/toolkit/components/microformats/Microformats.js +++ b/toolkit/components/microformats/Microformats.js @@ -9,7 +9,7 @@ this.Microformats = { list: [], /* Custom iterator so that microformats can be enumerated as */ /* for (i in Microformats) */ - __iterator__: function () { + __iterator__: function* () { for (let i=0; i < this.list.length; i++) { yield this.list[i]; } diff --git a/toolkit/components/perfmonitoring/PerformanceStats.jsm b/toolkit/components/perfmonitoring/PerformanceStats.jsm index 7f09ed9fea7..6b1f32b1229 100644 --- a/toolkit/components/perfmonitoring/PerformanceStats.jsm +++ b/toolkit/components/perfmonitoring/PerformanceStats.jsm @@ -403,7 +403,7 @@ PerformanceMonitor.prototype = { * The names of probes activated in this monitor. */ get probeNames() { - return [for (probe of this._probes) probe.name]; + return this._probes.map(probe => probe.name); }, /** @@ -471,7 +471,7 @@ PerformanceMonitor.prototype = { promiseSnapshot: function(options = null) { let probes = this._checkBeforeSnapshot(options); return Task.spawn(function*() { - let childProcesses = yield Process.broadcastAndCollect("collect", {probeNames: [for (probe of probes) probe.name]}); + let childProcesses = yield Process.broadcastAndCollect("collect", {probeNames: probes.map(p => p.name)}); let xpcom = performanceStatsService.getSnapshot(); return new ApplicationSnapshot({ xpcom, @@ -752,7 +752,7 @@ function PerformanceDiff(current, old = null) { // The stats don't contain data from this probe. continue; } - let data = [for (item of this._all) item[k]]; + let data = this._all.map(item => item[k]); let probe = Probes[k]; this[k] = probe.compose(data); } @@ -762,10 +762,10 @@ PerformanceDiff.prototype = { return `[PerformanceDiff] ${this.key}`; }, get windowIds() { - return [for (item of this._all) item.windowId].filter(x => !!x); + return this._all.map(item => item.windowId).filter(x => !!x); }, get groupIds() { - return [for (item of this._all) item.groupId]; + return this._all.map(item => item.groupId); }, get key() { if (this.addonId) { @@ -777,10 +777,10 @@ PerformanceDiff.prototype = { return this._all[0].groupId; }, get names() { - return [for (item of this._all) item.name]; + return this._all.map(item => item.name); }, get processes() { - return [for (item of this._all) { isChildProcess: item.isChildProcess, processId: item.processId}]; + return this._all.map(item => ({ isChildProcess: item.isChildProcess, processId: item.processId})); } }; diff --git a/toolkit/components/promiseworker/PromiseWorker.jsm b/toolkit/components/promiseworker/PromiseWorker.jsm index a90b91477fc..5f34b45ddce 100644 --- a/toolkit/components/promiseworker/PromiseWorker.jsm +++ b/toolkit/components/promiseworker/PromiseWorker.jsm @@ -290,11 +290,13 @@ this.BasePromiseWorker.prototype = { this.log("Posting message", message); try { this._worker.postMessage(message, ...[transfers]); - } catch (ex if typeof ex == "number") { - this.log("Could not post message", message, "due to xpcom error", ex); - // handle raw xpcom errors (see eg bug 961317) - throw new Components.Exception("Error in postMessage", ex); } catch (ex) { + if (typeof ex == "number") { + this.log("Could not post message", message, "due to xpcom error", ex); + // handle raw xpcom errors (see eg bug 961317) + throw new Components.Exception("Error in postMessage", ex); + } + this.log("Could not post message", message, "due to error", ex); throw ex; } diff --git a/toolkit/components/promiseworker/tests/xpcshell/test_Promise.js b/toolkit/components/promiseworker/tests/xpcshell/test_Promise.js index 24f91bcc48d..eaeaba9689c 100644 --- a/toolkit/components/promiseworker/tests/xpcshell/test_Promise.js +++ b/toolkit/components/promiseworker/tests/xpcshell/test_Promise.js @@ -55,7 +55,9 @@ add_task(function* test_rejected_promise_args() { try { yield worker.post("bounce", message); do_throw("I shound have thrown an error by now"); - } catch (ex if ex == error) { + } catch (ex) { + if (ex != error) + throw ex; do_print("I threw the right error"); } }); diff --git a/toolkit/components/reader/ReaderMode.jsm b/toolkit/components/reader/ReaderMode.jsm index 67b27ae404a..2890e1ebe85 100644 --- a/toolkit/components/reader/ReaderMode.jsm +++ b/toolkit/components/reader/ReaderMode.jsm @@ -255,7 +255,9 @@ this.ReaderMode = { try { let array = yield OS.File.read(path); return JSON.parse(new TextDecoder().decode(array)); - } catch (e if e instanceof OS.File.Error && e.becauseNoSuchFile) { + } catch (e) { + if (!(e instanceof OS.File.Error) || !e.becauseNoSuchFile) + throw e; return null; } }), diff --git a/toolkit/components/search/tests/xpcshell/test_rel_searchform.js b/toolkit/components/search/tests/xpcshell/test_rel_searchform.js index e49ae47b1b0..79f217e0d42 100644 --- a/toolkit/components/search/tests/xpcshell/test_rel_searchform.js +++ b/toolkit/components/search/tests/xpcshell/test_rel_searchform.js @@ -26,7 +26,7 @@ add_task(function* test_rel_searchform() { // point of the ?search parameter is to avoid accidentally matching the value // returned as a last resort by Engine's searchForm getter, which is simply // the prePath of the engine's first HTML . - let items = [for (e of engineNames) { name: e, xmlFileName: e }]; + let items = engineNames.map(e => ({ name: e, xmlFileName: e })); for (let engine of yield addTestEngines(items)) { do_check_eq(engine.searchForm, "http://" + engine.name + "/?search"); } diff --git a/toolkit/components/social/test/xpcshell/head.js b/toolkit/components/social/test/xpcshell/head.js index 63fe4a3c938..e7a76ef7b75 100644 --- a/toolkit/components/social/test/xpcshell/head.js +++ b/toolkit/components/social/test/xpcshell/head.js @@ -113,23 +113,20 @@ AsyncRunner.prototype = { this._iteratorQueue.push(iter); }, - next: function next(/* ... */) { + next: function next(arg) { if (!this._iteratorQueue.length) { this.destroy(); this._callbacks.done(); return; } - // send() discards all arguments after the first, so there's no choice here - // but to send only one argument to the yielder. - let args = [arguments.length <= 1 ? arguments[0] : Array.slice(arguments)]; try { - var val = this._iteratorQueue[0].send.apply(this._iteratorQueue[0], args); - } - catch (err if err instanceof StopIteration) { - this._iteratorQueue.shift(); - this.next(); - return; + var { done, value: val } = this._iteratorQueue[0].next(arg); + if (done) { + this._iteratorQueue.shift(); + this.next(); + return; + } } catch (err) { this._callbacks.error(err); diff --git a/toolkit/components/social/test/xpcshell/test_SocialService.js b/toolkit/components/social/test/xpcshell/test_SocialService.js index 2cb4d14074c..6b91c617940 100644 --- a/toolkit/components/social/test/xpcshell/test_SocialService.js +++ b/toolkit/components/social/test/xpcshell/test_SocialService.js @@ -41,7 +41,7 @@ function run_test() { runner.next(); } -function testAddProviders(manifests, next) { +function* testAddProviders(manifests, next) { do_check_false(SocialService.enabled); let provider = yield SocialService.addProvider(manifests[0], next); do_check_true(SocialService.enabled); @@ -51,14 +51,14 @@ function testAddProviders(manifests, next) { do_check_false(provider.enabled); } -function testRemoveProviders(manifests, next) { +function* testRemoveProviders(manifests, next) { do_check_true(SocialService.enabled); yield SocialService.disableProvider(manifests[0].origin, next); yield SocialService.disableProvider(manifests[1].origin, next); do_check_false(SocialService.enabled); } -function testGetProvider(manifests, next) { +function* testGetProvider(manifests, next) { for (let i = 0; i < manifests.length; i++) { let manifest = manifests[i]; let provider = yield SocialService.getProvider(manifest.origin, next); @@ -70,7 +70,7 @@ function testGetProvider(manifests, next) { do_check_eq((yield SocialService.getProvider("bogus", next)), null); } -function testGetProviderList(manifests, next) { +function* testGetProviderList(manifests, next) { let providers = yield SocialService.getProviderList(next); do_check_true(providers.length >= manifests.length); for (let i = 0; i < manifests.length; i++) { @@ -83,7 +83,7 @@ function testGetProviderList(manifests, next) { } } -function testAddRemoveProvider(manifests, next) { +function* testAddRemoveProvider(manifests, next) { var threw; try { // Adding a provider whose origin already exists should fail @@ -116,7 +116,7 @@ function testAddRemoveProvider(manifests, next) { do_check_true(!newProvider); } -function testIsSameOrigin(manifests, next) { +function* testIsSameOrigin(manifests, next) { let providers = yield SocialService.getProviderList(next); let provider = providers[0]; // provider.origin is a string. @@ -134,7 +134,7 @@ function testIsSameOrigin(manifests, next) { do_check_false(provider.isSameOrigin(null)); } -function testResolveUri(manifests, next) { +function* testResolveUri(manifests, next) { let providers = yield SocialService.getProviderList(next); let provider = providers[0]; do_check_eq(provider.resolveUri(provider.origin).spec, provider.origin + "/"); @@ -144,7 +144,7 @@ function testResolveUri(manifests, next) { do_check_eq(provider.resolveUri("data:text/html,

hi").spec, "data:text/html,

hi"); } -function testOrderedProviders(manifests, next) { +function* testOrderedProviders(manifests, next) { let providers = yield SocialService.getProviderList(next); // add visits for only one of the providers diff --git a/toolkit/components/social/test/xpcshell/test_SocialServiceMigration21.js b/toolkit/components/social/test/xpcshell/test_SocialServiceMigration21.js index 5ee05974275..d2a996ddbbf 100644 --- a/toolkit/components/social/test/xpcshell/test_SocialServiceMigration21.js +++ b/toolkit/components/social/test/xpcshell/test_SocialServiceMigration21.js @@ -30,7 +30,7 @@ function run_test() { runner.next(); } -function testMigration(manifest, next) { +function* testMigration(manifest, next) { // look at social.activeProviders, we should have migrated into that, and // we should be set as a user level pref after migration do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin)); diff --git a/toolkit/components/social/test/xpcshell/test_SocialServiceMigration22.js b/toolkit/components/social/test/xpcshell/test_SocialServiceMigration22.js index 2ba505583a7..a0e80e9083d 100644 --- a/toolkit/components/social/test/xpcshell/test_SocialServiceMigration22.js +++ b/toolkit/components/social/test/xpcshell/test_SocialServiceMigration22.js @@ -40,7 +40,7 @@ function run_test() { runner.next(); } -function testMigration(manifest, next) { +function* testMigration(manifest, next) { // look at social.activeProviders, we should have migrated into that, and // we should be set as a user level pref after migration do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin)); diff --git a/toolkit/components/social/test/xpcshell/test_SocialServiceMigration29.js b/toolkit/components/social/test/xpcshell/test_SocialServiceMigration29.js index e1ee1be64cb..37d61d75f02 100644 --- a/toolkit/components/social/test/xpcshell/test_SocialServiceMigration29.js +++ b/toolkit/components/social/test/xpcshell/test_SocialServiceMigration29.js @@ -41,7 +41,7 @@ function run_test() { runner.next(); } -function testMigration(manifest, next) { +function* testMigration(manifest, next) { // look at social.activeProviders, we should have migrated into that, and // we should be set as a user level pref after migration do_check_true(Services.prefs.prefHasUserValue("social.enabled")); diff --git a/toolkit/components/startup/tests/unit/test_startup_crash.js b/toolkit/components/startup/tests/unit/test_startup_crash.js index 454e0547f4d..28363308665 100644 --- a/toolkit/components/startup/tests/unit/test_startup_crash.js +++ b/toolkit/components/startup/tests/unit/test_startup_crash.js @@ -297,4 +297,4 @@ function test_maxResumed() { // should remain the same since the last startup was not a crash do_check_eq(max_resumed + 2, prefService.getIntPref(pref_recent_crashes)); do_check_false(appStartup.automaticSafeModeNecessary); -} \ No newline at end of file +} diff --git a/toolkit/components/terminator/nsTerminatorTelemetry.js b/toolkit/components/terminator/nsTerminatorTelemetry.js index 9978c816334..73956d8a3fe 100644 --- a/toolkit/components/terminator/nsTerminatorTelemetry.js +++ b/toolkit/components/terminator/nsTerminatorTelemetry.js @@ -64,7 +64,10 @@ nsTerminatorTelemetry.prototype = { let raw; try { raw = yield OS.File.read(PATH, { encoding: "utf-8" }); - } catch (ex if ex.becauseNoSuchFile) { + } catch (ex) { + if (!ex.becauseNoSuchFile) { + throw ex; + } return; } // Let other errors be reported by Promise's error-reporting. diff --git a/toolkit/components/viewsource/test/browser/browser_contextmenu.js b/toolkit/components/viewsource/test/browser/browser_contextmenu.js index b87495e3849..4919170a1a4 100644 --- a/toolkit/components/viewsource/test/browser/browser_contextmenu.js +++ b/toolkit/components/viewsource/test/browser/browser_contextmenu.js @@ -77,7 +77,7 @@ function* onViewSourceWindowOpen(aWindow, aIsTab) { expectedData.push(["span", false, false, null]); } -function checkMenuItems(contextMenu, isTab, selector, copyLinkExpected, copyEmailExpected, expectedClipboardContent) { +function* checkMenuItems(contextMenu, isTab, selector, copyLinkExpected, copyEmailExpected, expectedClipboardContent) { let browser = isTab ? gBrowser.selectedBrowser : gViewSourceWindow.gBrowser; yield ContentTask.spawn(browser, { selector: selector }, function* (arg) { diff --git a/toolkit/components/workerloader/tests/moduleB-dependency.js b/toolkit/components/workerloader/tests/moduleB-dependency.js index eaa97fd5b16..5c9831fc3a6 100644 --- a/toolkit/components/workerloader/tests/moduleB-dependency.js +++ b/toolkit/components/workerloader/tests/moduleB-dependency.js @@ -8,4 +8,4 @@ exports.foo = "foo"; if ("loadedB" in self) { throw new Error("B has been evaluted twice"); } -self.loadedB = true; \ No newline at end of file +self.loadedB = true; diff --git a/toolkit/components/workerloader/tests/moduleC-circular.js b/toolkit/components/workerloader/tests/moduleC-circular.js index 2fa1af13f57..5dc14259a4d 100644 --- a/toolkit/components/workerloader/tests/moduleC-circular.js +++ b/toolkit/components/workerloader/tests/moduleC-circular.js @@ -15,4 +15,4 @@ var D = require("chrome://mochitests/content/chrome/toolkit/components/workerloa exports.copiedFromD = JSON.parse(JSON.stringify(D)); // exportedFromD.copiedFromC should have all the fields defined in |exports| exports.exportedFromD = D; -exports.finishedC = true; \ No newline at end of file +exports.finishedC = true; diff --git a/toolkit/components/workerloader/tests/moduleD-circular.js b/toolkit/components/workerloader/tests/moduleD-circular.js index bd334dc45db..d77bdc74dba 100644 --- a/toolkit/components/workerloader/tests/moduleD-circular.js +++ b/toolkit/components/workerloader/tests/moduleD-circular.js @@ -8,4 +8,4 @@ exports.enteredD = true; var C = require("chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleC-circular.js"); exports.copiedFromC = JSON.parse(JSON.stringify(C)); exports.exportedFromC = C; -exports.finishedD = true; \ No newline at end of file +exports.finishedD = true; diff --git a/toolkit/components/workerloader/tests/moduleE-throws-during-require.js b/toolkit/components/workerloader/tests/moduleE-throws-during-require.js index 38f9a31584f..b0be0449f95 100644 --- a/toolkit/components/workerloader/tests/moduleE-throws-during-require.js +++ b/toolkit/components/workerloader/tests/moduleE-throws-during-require.js @@ -7,4 +7,4 @@ // 7 // 8 // 9 -throw new Error("Let's see if this error is obtained with the right origin"); \ No newline at end of file +throw new Error("Let's see if this error is obtained with the right origin"); diff --git a/toolkit/components/workerloader/tests/moduleG-throws-later.js b/toolkit/components/workerloader/tests/moduleG-throws-later.js index 92fc010d224..8a24bc7e469 100644 --- a/toolkit/components/workerloader/tests/moduleG-throws-later.js +++ b/toolkit/components/workerloader/tests/moduleG-throws-later.js @@ -9,4 +9,4 @@ // 9 exports.doThrow = function doThrow() { Array.prototype.sort.apply("foo"); // This will raise a native TypeError -}; \ No newline at end of file +}; diff --git a/toolkit/crashreporter/content/crashes.js b/toolkit/crashreporter/content/crashes.js index 81d9334f4d0..23ac32312df 100644 --- a/toolkit/crashreporter/content/crashes.js +++ b/toolkit/crashreporter/content/crashes.js @@ -139,7 +139,10 @@ var clearReports = Task.async(function*() { yield OS.File.remove(aEntry.path); } })); - } catch (e if e instanceof OS.File.Error && e.becauseNoSuchFile) { + } catch (e) { + if (!(e instanceof OS.File.Error) || !e.becauseNoSuchFile) { + throw e; + } } finally { iterator.close(); } diff --git a/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js b/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js index 419d80bfddc..0704f40bc66 100644 --- a/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js +++ b/toolkit/crashreporter/test/unit_ipc/test_content_annotation.js @@ -19,4 +19,4 @@ function run_test() do_check_true('ProcessType' in extra); do_check_neq(extra.Notes.indexOf("!!!foo!!!"), -1); }); -} \ No newline at end of file +} diff --git a/toolkit/forgetaboutsite/ForgetAboutSite.jsm b/toolkit/forgetaboutsite/ForgetAboutSite.jsm index 2e20c08d461..22fc1cc1411 100644 --- a/toolkit/forgetaboutsite/ForgetAboutSite.jsm +++ b/toolkit/forgetaboutsite/ForgetAboutSite.jsm @@ -125,7 +125,11 @@ this.ForgetAboutSite = { } // XXXehsan: is there a better way to do this rather than this // hacky comparison? - catch (ex if ex.message.indexOf("User canceled Master Password entry") != -1) { } + catch (ex) { + if (ex.message.indexOf("User canceled Master Password entry") == -1) { + throw ex; + } + } // Clear any "do not save for this site" for this domain let disabledHosts = lm.getAllDisabledHosts(); diff --git a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js index a19233caf38..92198101d18 100644 --- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js +++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js @@ -254,7 +254,7 @@ function preference_exists(aURI) //// Test Functions // History -function test_history_cleared_with_direct_match() +function* test_history_cleared_with_direct_match() { const TEST_URI = uri("http://mozilla.org/foo"); do_check_false(yield promiseIsURIVisited(TEST_URI)); @@ -264,7 +264,7 @@ function test_history_cleared_with_direct_match() do_check_false(yield promiseIsURIVisited(TEST_URI)); } -function test_history_cleared_with_subdomain() +function* test_history_cleared_with_subdomain() { const TEST_URI = uri("http://www.mozilla.org/foo"); do_check_false(yield promiseIsURIVisited(TEST_URI)); @@ -274,7 +274,7 @@ function test_history_cleared_with_subdomain() do_check_false(yield promiseIsURIVisited(TEST_URI)); } -function test_history_not_cleared_with_uri_contains_domain() +function* test_history_not_cleared_with_uri_contains_domain() { const TEST_URI = uri("http://ilovemozilla.org/foo"); do_check_false(yield promiseIsURIVisited(TEST_URI)); @@ -424,7 +424,7 @@ function waitForPurgeNotification() { } // Content Preferences -function test_content_preferences_cleared_with_direct_match() +function* test_content_preferences_cleared_with_direct_match() { const TEST_URI = uri("http://mozilla.org"); do_check_false(yield preference_exists(TEST_URI)); @@ -435,7 +435,7 @@ function test_content_preferences_cleared_with_direct_match() do_check_false(yield preference_exists(TEST_URI)); } -function test_content_preferences_cleared_with_subdomain() +function* test_content_preferences_cleared_with_subdomain() { const TEST_URI = uri("http://www.mozilla.org"); do_check_false(yield preference_exists(TEST_URI)); @@ -446,7 +446,7 @@ function test_content_preferences_cleared_with_subdomain() do_check_false(yield preference_exists(TEST_URI)); } -function test_content_preferences_not_cleared_with_uri_contains_domain() +function* test_content_preferences_not_cleared_with_uri_contains_domain() { const TEST_URI = uri("http://ilovemozilla.org"); do_check_false(yield preference_exists(TEST_URI)); @@ -463,7 +463,7 @@ function test_content_preferences_not_cleared_with_uri_contains_domain() } // Push -function test_push_cleared() +function* test_push_cleared() { let ps; try { @@ -550,7 +550,7 @@ function test_cache_cleared() do_test_pending(); } -function test_storage_cleared() +function* test_storage_cleared() { function getStorageForURI(aURI) { diff --git a/toolkit/profile/content/createProfileWizard.js b/toolkit/profile/content/createProfileWizard.js index 3dee92608cd..e4184629486 100644 --- a/toolkit/profile/content/createProfileWizard.js +++ b/toolkit/profile/content/createProfileWizard.js @@ -5,6 +5,8 @@ const C = Components.classes; const I = Components.interfaces; +Components.utils.import("resource://gre/modules/AppConstants.jsm"); + const ToolkitProfileService = "@mozilla.org/toolkit/profile-service;1"; var gProfileService; @@ -117,11 +119,12 @@ function checkCurrentInput(currentInput) if (!errorMessage) { finishText.className = ""; -#ifndef XP_MACOSX - finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishText"); -#else - finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishTextMac"); -#endif + if (AppConstants.platform == "macosx") { + finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishText"); + } + else { + finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishTextMac"); + } canAdvance = true; } else { diff --git a/toolkit/profile/content/profileSelection.js b/toolkit/profile/content/profileSelection.js index 9594ac46280..85c65e4a98d 100644 --- a/toolkit/profile/content/profileSelection.js +++ b/toolkit/profile/content/profileSelection.js @@ -4,6 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +Components.utils.import("resource://gre/modules/AppConstants.jsm"); Components.utils.import("resource://gre/modules/Services.jsm"); const C = Components.classes; @@ -131,12 +132,12 @@ function updateStartupPrefs() // handle key event on listboxes function onProfilesKey(aEvent) { - switch( aEvent.keyCode ) + switch( aEvent.keyCode ) { - case KeyEvent.DOM_VK_DELETE: -#ifdef XP_MACOSX case KeyEvent.DOM_VK_BACK_SPACE: -#endif + if (AppConstants.platform != "macosx") + break; + case KeyEvent.DOM_VK_DELETE: ConfirmDelete(); break; case KeyEvent.DOM_VK_F2: diff --git a/toolkit/profile/jar.mn b/toolkit/profile/jar.mn index 1c4afac4ca8..9b7c22266eb 100644 --- a/toolkit/profile/jar.mn +++ b/toolkit/profile/jar.mn @@ -3,7 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. toolkit.jar: -* content/mozapps/profile/createProfileWizard.js (content/createProfileWizard.js) + content/mozapps/profile/createProfileWizard.js (content/createProfileWizard.js) * content/mozapps/profile/createProfileWizard.xul (content/createProfileWizard.xul) -* content/mozapps/profile/profileSelection.js (content/profileSelection.js) + content/mozapps/profile/profileSelection.js (content/profileSelection.js) content/mozapps/profile/profileSelection.xul (content/profileSelection.xul)