Bug 1229519: Fix miscellaneous parts of toolkit to pass eslint checks. r=MattN

This commit is contained in:
Dave Townsend 2015-12-03 10:02:45 -08:00
parent a219e32852
commit 625465b938
33 changed files with 156 additions and 126 deletions

View File

@ -44,29 +44,6 @@ services/**
startupcache/** startupcache/**
storage/** storage/**
testing/** 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/** tools/**
uriloader/** uriloader/**
view/** view/**
@ -196,3 +173,34 @@ mobile/android/components/Snippets.js
# Bug 1178739: Ignore this file as a quick fix for "Illegal yield expression" # Bug 1178739: Ignore this file as a quick fix for "Illegal yield expression"
mobile/android/modules/HomeProvider.jsm 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/**

View File

@ -561,7 +561,7 @@ var View = {
cachedElements.eltName.textContent = `Full name: ${delta.fullName}.`; cachedElements.eltName.textContent = `Full name: ${delta.fullName}.`;
cachedElements.eltLoaded.textContent = `Measure start: ${Math.round(delta.age/1000)} seconds ago.` 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(", ")}`; cachedElements.eltProcess.textContent = `Processes: ${processes.join(", ")}`;
let jankSuffix = ""; let jankSuffix = "";
let cpowSuffix = ""; let cpowSuffix = "";

View File

@ -164,8 +164,8 @@ function frameScript() {
return; return;
} }
let addonTitles = [for (eltContent of eltAddons.querySelectorAll("span.title")) eltContent.textContent]; let addonTitles = Array.from(eltAddons.querySelectorAll("span.title"), elt => elt.textContent);
let webTitles = [for (eltContent of eltWeb.querySelectorAll("span.title")) eltContent.textContent]; let webTitles = Array.from(eltWeb.querySelectorAll("span.title"), elt => elt.textContent);
hasTitleInAddons = addonTitles.includes(title); hasTitleInAddons = addonTitles.includes(title);
hasTitleInWebpages = webTitles.includes(title); hasTitleInWebpages = webTitles.includes(title);

View File

@ -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
# This Source Code Form is subject to the terms of the Mozilla Public * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
# 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() {}; function AppPicker() {};
@ -117,20 +117,19 @@ AppPicker.prototype =
* Retrieve the pretty description from the file * Retrieve the pretty description from the file
*/ */
getFileDisplayName: function getFileDisplayName(file) { getFileDisplayName: function getFileDisplayName(file) {
#ifdef XP_WIN if (AppConstants.platform == "win") {
if (file instanceof Components.interfaces.nsILocalFileWin) { if (file instanceof Components.interfaces.nsILocalFileWin) {
try { try {
return file.getVersionInfoField("FileDescription"); return file.getVersionInfoField("FileDescription");
} catch (e) {} } 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; return file.leafName;
}, },
@ -186,15 +185,13 @@ AppPicker.prototype =
var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"] var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties); .getService(Components.interfaces.nsIProperties);
var startLocation; var startLocation;
#ifdef XP_WIN if (AppConstants.platform == "win") {
startLocation = "ProgF"; // Program Files startLocation = "ProgF"; // Program Files
#else } else if (AppConstants.platform == "macosx") {
#ifdef XP_MACOSX startLocation = "LocApp"; // Local Applications
startLocation = "LocApp"; // Local Applications } else {
#else startLocation = "Home";
startLocation = "Home"; }
#endif
#endif
fp.displayDirectory = fp.displayDirectory =
fileLoc.get(startLocation, Components.interfaces.nsILocalFile); fileLoc.get(startLocation, Components.interfaces.nsILocalFile);

View File

@ -4,5 +4,5 @@
toolkit.jar: toolkit.jar:
content/global/appPicker.xul (content/appPicker.xul) content/global/appPicker.xul (content/appPicker.xul)
* content/global/appPicker.js (content/appPicker.js) content/global/appPicker.js (content/appPicker.js)

View File

@ -29,14 +29,18 @@ add_task(function* test_null_args_addPath() {
// Check for error when passing a null first argument // Check for error when passing a null first argument
try { try {
watcher.addPath(testPath, null, dummyFunc); 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."); do_print("Initialisation thrown NS_ERROR_NULL_POINTER as expected.");
} }
// Check for error when passing both null arguments // Check for error when passing both null arguments
try { try {
watcher.addPath(testPath, null, null); 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."); 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 // Check for error when passing a null first argument
try { try {
watcher.removePath(testPath, null, dummyFunc); 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."); do_print("Initialisation thrown NS_ERROR_NULL_POINTER as expected.");
} }
// Check for error when passing both null arguments // Check for error when passing both null arguments
try { try {
watcher.removePath(testPath, null, null); 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."); do_print("Initialisation thrown NS_ERROR_NULL_POINTER as expected.");
} }
}); });

View File

@ -13,7 +13,7 @@ function compare_arrays(a, b) {
return Array.prototype.join.call(a) == Array.prototype.join.call(a); 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 path = OS.Path.join("data", "compression.lz");
let data = yield OS.File.read(path); let data = yield OS.File.read(path);
let decompressed = Lz4.decompressFileContent(data); let decompressed = Lz4.decompressFileContent(data);
@ -21,7 +21,7 @@ add_task(function() {
do_check_eq(text, "Hello, lz4"); do_check_eq(text, "Hello, lz4");
}); });
add_task(function() { add_task(function*() {
for (let length of [0, 1, 1024]) { for (let length of [0, 1, 1024]) {
let array = new Uint8Array(length); let array = new Uint8Array(length);
for (let i = 0; i < length; ++i) { for (let i = 0; i < length; ++i) {

View File

@ -9,7 +9,7 @@ this.Microformats = {
list: [], list: [],
/* Custom iterator so that microformats can be enumerated as */ /* Custom iterator so that microformats can be enumerated as */
/* for (i in Microformats) */ /* for (i in Microformats) */
__iterator__: function () { __iterator__: function* () {
for (let i=0; i < this.list.length; i++) { for (let i=0; i < this.list.length; i++) {
yield this.list[i]; yield this.list[i];
} }

View File

@ -403,7 +403,7 @@ PerformanceMonitor.prototype = {
* The names of probes activated in this monitor. * The names of probes activated in this monitor.
*/ */
get probeNames() { 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) { promiseSnapshot: function(options = null) {
let probes = this._checkBeforeSnapshot(options); let probes = this._checkBeforeSnapshot(options);
return Task.spawn(function*() { 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(); let xpcom = performanceStatsService.getSnapshot();
return new ApplicationSnapshot({ return new ApplicationSnapshot({
xpcom, xpcom,
@ -752,7 +752,7 @@ function PerformanceDiff(current, old = null) {
// The stats don't contain data from this probe. // The stats don't contain data from this probe.
continue; continue;
} }
let data = [for (item of this._all) item[k]]; let data = this._all.map(item => item[k]);
let probe = Probes[k]; let probe = Probes[k];
this[k] = probe.compose(data); this[k] = probe.compose(data);
} }
@ -762,10 +762,10 @@ PerformanceDiff.prototype = {
return `[PerformanceDiff] ${this.key}`; return `[PerformanceDiff] ${this.key}`;
}, },
get windowIds() { 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() { get groupIds() {
return [for (item of this._all) item.groupId]; return this._all.map(item => item.groupId);
}, },
get key() { get key() {
if (this.addonId) { if (this.addonId) {
@ -777,10 +777,10 @@ PerformanceDiff.prototype = {
return this._all[0].groupId; return this._all[0].groupId;
}, },
get names() { get names() {
return [for (item of this._all) item.name]; return this._all.map(item => item.name);
}, },
get processes() { 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}));
} }
}; };

View File

@ -290,11 +290,13 @@ this.BasePromiseWorker.prototype = {
this.log("Posting message", message); this.log("Posting message", message);
try { try {
this._worker.postMessage(message, ...[transfers]); 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) { } 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); this.log("Could not post message", message, "due to error", ex);
throw ex; throw ex;
} }

View File

@ -55,7 +55,9 @@ add_task(function* test_rejected_promise_args() {
try { try {
yield worker.post("bounce", message); yield worker.post("bounce", message);
do_throw("I shound have thrown an error by now"); 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"); do_print("I threw the right error");
} }
}); });

View File

@ -255,7 +255,9 @@ this.ReaderMode = {
try { try {
let array = yield OS.File.read(path); let array = yield OS.File.read(path);
return JSON.parse(new TextDecoder().decode(array)); 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; return null;
} }
}), }),

View File

@ -26,7 +26,7 @@ add_task(function* test_rel_searchform() {
// point of the ?search parameter is to avoid accidentally matching the value // 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 // returned as a last resort by Engine's searchForm getter, which is simply
// the prePath of the engine's first HTML <Url>. // the prePath of the engine's first HTML <Url>.
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)) { for (let engine of yield addTestEngines(items)) {
do_check_eq(engine.searchForm, "http://" + engine.name + "/?search"); do_check_eq(engine.searchForm, "http://" + engine.name + "/?search");
} }

View File

@ -113,23 +113,20 @@ AsyncRunner.prototype = {
this._iteratorQueue.push(iter); this._iteratorQueue.push(iter);
}, },
next: function next(/* ... */) { next: function next(arg) {
if (!this._iteratorQueue.length) { if (!this._iteratorQueue.length) {
this.destroy(); this.destroy();
this._callbacks.done(); this._callbacks.done();
return; 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 { try {
var val = this._iteratorQueue[0].send.apply(this._iteratorQueue[0], args); var { done, value: val } = this._iteratorQueue[0].next(arg);
} if (done) {
catch (err if err instanceof StopIteration) { this._iteratorQueue.shift();
this._iteratorQueue.shift(); this.next();
this.next(); return;
return; }
} }
catch (err) { catch (err) {
this._callbacks.error(err); this._callbacks.error(err);

View File

@ -41,7 +41,7 @@ function run_test() {
runner.next(); runner.next();
} }
function testAddProviders(manifests, next) { function* testAddProviders(manifests, next) {
do_check_false(SocialService.enabled); do_check_false(SocialService.enabled);
let provider = yield SocialService.addProvider(manifests[0], next); let provider = yield SocialService.addProvider(manifests[0], next);
do_check_true(SocialService.enabled); do_check_true(SocialService.enabled);
@ -51,14 +51,14 @@ function testAddProviders(manifests, next) {
do_check_false(provider.enabled); do_check_false(provider.enabled);
} }
function testRemoveProviders(manifests, next) { function* testRemoveProviders(manifests, next) {
do_check_true(SocialService.enabled); do_check_true(SocialService.enabled);
yield SocialService.disableProvider(manifests[0].origin, next); yield SocialService.disableProvider(manifests[0].origin, next);
yield SocialService.disableProvider(manifests[1].origin, next); yield SocialService.disableProvider(manifests[1].origin, next);
do_check_false(SocialService.enabled); do_check_false(SocialService.enabled);
} }
function testGetProvider(manifests, next) { function* testGetProvider(manifests, next) {
for (let i = 0; i < manifests.length; i++) { for (let i = 0; i < manifests.length; i++) {
let manifest = manifests[i]; let manifest = manifests[i];
let provider = yield SocialService.getProvider(manifest.origin, next); 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); do_check_eq((yield SocialService.getProvider("bogus", next)), null);
} }
function testGetProviderList(manifests, next) { function* testGetProviderList(manifests, next) {
let providers = yield SocialService.getProviderList(next); let providers = yield SocialService.getProviderList(next);
do_check_true(providers.length >= manifests.length); do_check_true(providers.length >= manifests.length);
for (let i = 0; i < manifests.length; i++) { 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; var threw;
try { try {
// Adding a provider whose origin already exists should fail // Adding a provider whose origin already exists should fail
@ -116,7 +116,7 @@ function testAddRemoveProvider(manifests, next) {
do_check_true(!newProvider); do_check_true(!newProvider);
} }
function testIsSameOrigin(manifests, next) { function* testIsSameOrigin(manifests, next) {
let providers = yield SocialService.getProviderList(next); let providers = yield SocialService.getProviderList(next);
let provider = providers[0]; let provider = providers[0];
// provider.origin is a string. // provider.origin is a string.
@ -134,7 +134,7 @@ function testIsSameOrigin(manifests, next) {
do_check_false(provider.isSameOrigin(null)); do_check_false(provider.isSameOrigin(null));
} }
function testResolveUri(manifests, next) { function* testResolveUri(manifests, next) {
let providers = yield SocialService.getProviderList(next); let providers = yield SocialService.getProviderList(next);
let provider = providers[0]; let provider = providers[0];
do_check_eq(provider.resolveUri(provider.origin).spec, provider.origin + "/"); 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,<p>hi").spec, "data:text/html,<p>hi"); do_check_eq(provider.resolveUri("data:text/html,<p>hi").spec, "data:text/html,<p>hi");
} }
function testOrderedProviders(manifests, next) { function* testOrderedProviders(manifests, next) {
let providers = yield SocialService.getProviderList(next); let providers = yield SocialService.getProviderList(next);
// add visits for only one of the providers // add visits for only one of the providers

View File

@ -30,7 +30,7 @@ function run_test() {
runner.next(); runner.next();
} }
function testMigration(manifest, next) { function* testMigration(manifest, next) {
// look at social.activeProviders, we should have migrated into that, and // look at social.activeProviders, we should have migrated into that, and
// we should be set as a user level pref after migration // we should be set as a user level pref after migration
do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin)); do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin));

View File

@ -40,7 +40,7 @@ function run_test() {
runner.next(); runner.next();
} }
function testMigration(manifest, next) { function* testMigration(manifest, next) {
// look at social.activeProviders, we should have migrated into that, and // look at social.activeProviders, we should have migrated into that, and
// we should be set as a user level pref after migration // we should be set as a user level pref after migration
do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin)); do_check_false(MANIFEST_PREFS.prefHasUserValue(manifest.origin));

View File

@ -41,7 +41,7 @@ function run_test() {
runner.next(); runner.next();
} }
function testMigration(manifest, next) { function* testMigration(manifest, next) {
// look at social.activeProviders, we should have migrated into that, and // look at social.activeProviders, we should have migrated into that, and
// we should be set as a user level pref after migration // we should be set as a user level pref after migration
do_check_true(Services.prefs.prefHasUserValue("social.enabled")); do_check_true(Services.prefs.prefHasUserValue("social.enabled"));

View File

@ -297,4 +297,4 @@ function test_maxResumed() {
// should remain the same since the last startup was not a crash // 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_eq(max_resumed + 2, prefService.getIntPref(pref_recent_crashes));
do_check_false(appStartup.automaticSafeModeNecessary); do_check_false(appStartup.automaticSafeModeNecessary);
} }

View File

@ -64,7 +64,10 @@ nsTerminatorTelemetry.prototype = {
let raw; let raw;
try { try {
raw = yield OS.File.read(PATH, { encoding: "utf-8" }); raw = yield OS.File.read(PATH, { encoding: "utf-8" });
} catch (ex if ex.becauseNoSuchFile) { } catch (ex) {
if (!ex.becauseNoSuchFile) {
throw ex;
}
return; return;
} }
// Let other errors be reported by Promise's error-reporting. // Let other errors be reported by Promise's error-reporting.

View File

@ -77,7 +77,7 @@ function* onViewSourceWindowOpen(aWindow, aIsTab) {
expectedData.push(["span", false, false, null]); 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; let browser = isTab ? gBrowser.selectedBrowser : gViewSourceWindow.gBrowser;
yield ContentTask.spawn(browser, { selector: selector }, function* (arg) { yield ContentTask.spawn(browser, { selector: selector }, function* (arg) {

View File

@ -8,4 +8,4 @@ exports.foo = "foo";
if ("loadedB" in self) { if ("loadedB" in self) {
throw new Error("B has been evaluted twice"); throw new Error("B has been evaluted twice");
} }
self.loadedB = true; self.loadedB = true;

View File

@ -15,4 +15,4 @@ var D = require("chrome://mochitests/content/chrome/toolkit/components/workerloa
exports.copiedFromD = JSON.parse(JSON.stringify(D)); exports.copiedFromD = JSON.parse(JSON.stringify(D));
// exportedFromD.copiedFromC should have all the fields defined in |exports| // exportedFromD.copiedFromC should have all the fields defined in |exports|
exports.exportedFromD = D; exports.exportedFromD = D;
exports.finishedC = true; exports.finishedC = true;

View File

@ -8,4 +8,4 @@ exports.enteredD = true;
var C = require("chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleC-circular.js"); var C = require("chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleC-circular.js");
exports.copiedFromC = JSON.parse(JSON.stringify(C)); exports.copiedFromC = JSON.parse(JSON.stringify(C));
exports.exportedFromC = C; exports.exportedFromC = C;
exports.finishedD = true; exports.finishedD = true;

View File

@ -7,4 +7,4 @@
// 7 // 7
// 8 // 8
// 9 // 9
throw new Error("Let's see if this error is obtained with the right origin"); throw new Error("Let's see if this error is obtained with the right origin");

View File

@ -9,4 +9,4 @@
// 9 // 9
exports.doThrow = function doThrow() { exports.doThrow = function doThrow() {
Array.prototype.sort.apply("foo"); // This will raise a native TypeError Array.prototype.sort.apply("foo"); // This will raise a native TypeError
}; };

View File

@ -139,7 +139,10 @@ var clearReports = Task.async(function*() {
yield OS.File.remove(aEntry.path); 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 { } finally {
iterator.close(); iterator.close();
} }

View File

@ -19,4 +19,4 @@ function run_test()
do_check_true('ProcessType' in extra); do_check_true('ProcessType' in extra);
do_check_neq(extra.Notes.indexOf("!!!foo!!!"), -1); do_check_neq(extra.Notes.indexOf("!!!foo!!!"), -1);
}); });
} }

View File

@ -125,7 +125,11 @@ this.ForgetAboutSite = {
} }
// XXXehsan: is there a better way to do this rather than this // XXXehsan: is there a better way to do this rather than this
// hacky comparison? // 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 // Clear any "do not save for this site" for this domain
let disabledHosts = lm.getAllDisabledHosts(); let disabledHosts = lm.getAllDisabledHosts();

View File

@ -254,7 +254,7 @@ function preference_exists(aURI)
//// Test Functions //// Test Functions
// History // History
function test_history_cleared_with_direct_match() function* test_history_cleared_with_direct_match()
{ {
const TEST_URI = uri("http://mozilla.org/foo"); const TEST_URI = uri("http://mozilla.org/foo");
do_check_false(yield promiseIsURIVisited(TEST_URI)); 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)); 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"); const TEST_URI = uri("http://www.mozilla.org/foo");
do_check_false(yield promiseIsURIVisited(TEST_URI)); do_check_false(yield promiseIsURIVisited(TEST_URI));
@ -274,7 +274,7 @@ function test_history_cleared_with_subdomain()
do_check_false(yield promiseIsURIVisited(TEST_URI)); 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"); const TEST_URI = uri("http://ilovemozilla.org/foo");
do_check_false(yield promiseIsURIVisited(TEST_URI)); do_check_false(yield promiseIsURIVisited(TEST_URI));
@ -424,7 +424,7 @@ function waitForPurgeNotification() {
} }
// Content Preferences // 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"); const TEST_URI = uri("http://mozilla.org");
do_check_false(yield preference_exists(TEST_URI)); 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)); 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"); const TEST_URI = uri("http://www.mozilla.org");
do_check_false(yield preference_exists(TEST_URI)); 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)); 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"); const TEST_URI = uri("http://ilovemozilla.org");
do_check_false(yield preference_exists(TEST_URI)); do_check_false(yield preference_exists(TEST_URI));
@ -463,7 +463,7 @@ function test_content_preferences_not_cleared_with_uri_contains_domain()
} }
// Push // Push
function test_push_cleared() function* test_push_cleared()
{ {
let ps; let ps;
try { try {
@ -550,7 +550,7 @@ function test_cache_cleared()
do_test_pending(); do_test_pending();
} }
function test_storage_cleared() function* test_storage_cleared()
{ {
function getStorageForURI(aURI) function getStorageForURI(aURI)
{ {

View File

@ -5,6 +5,8 @@
const C = Components.classes; const C = Components.classes;
const I = Components.interfaces; const I = Components.interfaces;
Components.utils.import("resource://gre/modules/AppConstants.jsm");
const ToolkitProfileService = "@mozilla.org/toolkit/profile-service;1"; const ToolkitProfileService = "@mozilla.org/toolkit/profile-service;1";
var gProfileService; var gProfileService;
@ -117,11 +119,12 @@ function checkCurrentInput(currentInput)
if (!errorMessage) { if (!errorMessage) {
finishText.className = ""; finishText.className = "";
#ifndef XP_MACOSX if (AppConstants.platform == "macosx") {
finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishText"); finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishText");
#else }
finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishTextMac"); else {
#endif finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishTextMac");
}
canAdvance = true; canAdvance = true;
} }
else { else {

View File

@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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"); Components.utils.import("resource://gre/modules/Services.jsm");
const C = Components.classes; const C = Components.classes;
@ -131,12 +132,12 @@ function updateStartupPrefs()
// handle key event on listboxes // handle key event on listboxes
function onProfilesKey(aEvent) function onProfilesKey(aEvent)
{ {
switch( aEvent.keyCode ) switch( aEvent.keyCode )
{ {
case KeyEvent.DOM_VK_DELETE:
#ifdef XP_MACOSX
case KeyEvent.DOM_VK_BACK_SPACE: case KeyEvent.DOM_VK_BACK_SPACE:
#endif if (AppConstants.platform != "macosx")
break;
case KeyEvent.DOM_VK_DELETE:
ConfirmDelete(); ConfirmDelete();
break; break;
case KeyEvent.DOM_VK_F2: case KeyEvent.DOM_VK_F2:

View File

@ -3,7 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
toolkit.jar: 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/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) content/mozapps/profile/profileSelection.xul (content/profileSelection.xul)