зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1328338 - Fix more no-undef eslint issues in toolkit/ and browser/. r=mossop
MozReview-Commit-ID: 78dXLYVW1gC --HG-- extra : rebase_source : 4d2c50697307177c76a71ca7989863f01b05290b
This commit is contained in:
Родитель
e8cc185f9d
Коммит
39df62d9dc
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"../../../../../testing/mochitest/browser.eslintrc.js"
|
||||
]
|
||||
};
|
|
@ -16,6 +16,7 @@ let hasContainers = Services.prefs.getBoolPref("privacy.userContext.enabled");
|
|||
const example_base = "http://example.com/browser/browser/base/content/test/general/";
|
||||
const chrome_base = "chrome://mochitests/content/browser/browser/base/content/test/general/";
|
||||
|
||||
/* import-globals-from contextmenu_common.js */
|
||||
Services.scriptloader.loadSubScript(chrome_base + "contextmenu_common.js", this);
|
||||
|
||||
// Below are test cases for XUL element
|
||||
|
|
|
@ -10,6 +10,7 @@ add_task(function* test_setup() {
|
|||
|
||||
const chrome_base = "chrome://mochitests/content/browser/browser/base/content/test/general/";
|
||||
const contextmenu_common = chrome_base + "contextmenu_common.js";
|
||||
/* import-globals-from contextmenu_common.js */
|
||||
Services.scriptloader.loadSubScript(contextmenu_common, this);
|
||||
});
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@ function test() {
|
|||
});
|
||||
}
|
||||
|
||||
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
|
||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader)
|
||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||
|
|
|
@ -8,6 +8,7 @@ const SAVE_PER_SITE_PREF = "browser.download.lastDir.savePerSite";
|
|||
const ALWAYS_DOWNLOAD_DIR_PREF = "browser.download.useDownloadDir";
|
||||
const UCT_URI = "chrome://mozapps/content/downloads/unknownContentType.xul";
|
||||
|
||||
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
|
||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader)
|
||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||
|
@ -170,4 +171,3 @@ function test() {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -107,6 +107,7 @@ add_task(function* () {
|
|||
yield BrowserTestUtils.closeWindow(privateWindow);
|
||||
});
|
||||
|
||||
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
|
||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader)
|
||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||
|
|
|
@ -70,7 +70,7 @@ add_task(function* () {
|
|||
yield transferCompletePromise;
|
||||
});
|
||||
|
||||
|
||||
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
|
||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader)
|
||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||
|
|
|
@ -7,6 +7,7 @@ const VIDEO_URL = "http://mochi.test:8888/browser/browser/base/content/test/gene
|
|||
* mockTransfer.js provides a utility that lets us mock out
|
||||
* the "Save File" dialog.
|
||||
*/
|
||||
/* import-globals-from ../../../../../toolkit/content/tests/browser/common/mockTransfer.js */
|
||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader)
|
||||
.loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
|
||||
|
|
|
@ -25,7 +25,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462856
|
|||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/* import-globals-from offlineByDefault.js */
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const Cc = SpecialPowers.Cc;
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
|||
XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
|
||||
"resource://gre/modules/PromiseUtils.jsm");
|
||||
|
||||
// Various tests in this directory may define gTestBrowser, to use as the
|
||||
// default browser under test in some of the functions below.
|
||||
/* global gTestBrowser */
|
||||
|
||||
// The blocklist shim running in the content process does not initialize at
|
||||
// start up, so it's not active until we load content that needs to do a
|
||||
// check. This helper bypasses the delay to get the svc up and running
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"../../../../../testing/mochitest/browser.eslintrc.js"
|
||||
]
|
||||
};
|
|
@ -908,7 +908,7 @@ WebContentConverterRegistrarContent.prototype = {
|
|||
.sort();
|
||||
|
||||
// now register them
|
||||
for (num of nums) {
|
||||
for (let num of nums) {
|
||||
let branch = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH + num + ".");
|
||||
try {
|
||||
this._registerContentHandlerHavingBranch(branch);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
/* import-globals-from ../../../../../testing/modules/sinon-1.16.1.js */
|
||||
Services.scriptloader.loadSubScript("resource://testing-common/sinon-1.16.1.js");
|
||||
|
||||
const TEST_HOST = "example.com";
|
||||
|
|
|
@ -7,6 +7,7 @@ if (jar) {
|
|||
let tmpdir = extractJarToTmp(jar);
|
||||
rootDir = "file://" + tmpdir.path + '/';
|
||||
}
|
||||
/* import-globals-from privacypane_tests_perwindow.js */
|
||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||
|
||||
run_test_subset([
|
||||
|
|
|
@ -6,6 +6,7 @@ if (jar) {
|
|||
let tmpdir = extractJarToTmp(jar);
|
||||
rootDir = "file://" + tmpdir.path + '/';
|
||||
}
|
||||
/* import-globals-from privacypane_tests_perwindow.js */
|
||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||
|
||||
run_test_subset([
|
||||
|
|
|
@ -8,6 +8,7 @@ if (jar) {
|
|||
let tmpdir = extractJarToTmp(jar);
|
||||
rootDir = "file://" + tmpdir.path + '/';
|
||||
}
|
||||
/* import-globals-from privacypane_tests_perwindow.js */
|
||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||
let runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ if (jar) {
|
|||
let tmpdir = extractJarToTmp(jar);
|
||||
rootDir = "file://" + tmpdir.path + '/';
|
||||
}
|
||||
/* import-globals-from privacypane_tests_perwindow.js */
|
||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||
|
||||
run_test_subset([
|
||||
|
|
|
@ -6,6 +6,7 @@ if (jar) {
|
|||
let tmpdir = extractJarToTmp(jar);
|
||||
rootDir = "file://" + tmpdir.path + '/';
|
||||
}
|
||||
/* import-globals-from privacypane_tests_perwindow.js */
|
||||
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
|
||||
|
||||
run_test_subset([
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
* 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/. */
|
||||
|
||||
// Imported via permissions.xul.
|
||||
/* import-globals-from ../../../toolkit/content/treeUtils.js */
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
* 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/. */
|
||||
|
||||
// These globals are imported via placesOverlay.xul.
|
||||
/* globals PlacesUIUtils, PlacesUtils, NS_ASSERT */
|
||||
|
||||
/**
|
||||
* SelectBookmarkDialog controls the user interface for the "Use Bookmark for
|
||||
* Home Page" dialog.
|
||||
|
|
|
@ -14,6 +14,7 @@ module.exports = {
|
|||
// All globals made available in the test environment.
|
||||
"globals": {
|
||||
"add_task": false,
|
||||
"addLoadEvent": false,
|
||||
"Assert": false,
|
||||
"BrowserTestUtils": false,
|
||||
"content": false,
|
||||
|
@ -34,6 +35,7 @@ module.exports = {
|
|||
"is": false,
|
||||
"isnot": false,
|
||||
"ok": false,
|
||||
"privateNoteIntentionalCrash": false,
|
||||
"registerCleanupFunction": false,
|
||||
"requestLongerTimeout": false,
|
||||
"SimpleTest": false,
|
||||
|
|
|
@ -12,6 +12,7 @@ module.exports = {
|
|||
// All globals made available in the test environment.
|
||||
"globals": {
|
||||
"add_task": false,
|
||||
"addLoadEvent": false,
|
||||
"Assert": false,
|
||||
"EventUtils": false,
|
||||
"executeSoon": false,
|
||||
|
@ -24,6 +25,7 @@ module.exports = {
|
|||
"is": false,
|
||||
"isnot": false,
|
||||
"ok": false,
|
||||
"privateNoteIntentionalCrash": false,
|
||||
"promise": false,
|
||||
"registerCleanupFunction": false,
|
||||
"requestLongerTimeout": false,
|
||||
|
|
|
@ -15,6 +15,7 @@ module.exports = {
|
|||
// $ is defined in SimpleTest.js
|
||||
"$": false,
|
||||
"add_task": false,
|
||||
"addLoadEvent": false,
|
||||
"Assert": false,
|
||||
"EventUtils": false,
|
||||
"executeSoon": false,
|
||||
|
|
|
@ -16,6 +16,7 @@ module.exports = {
|
|||
"do_await_remote_message": false,
|
||||
"do_check_eq": false,
|
||||
"do_check_false": false,
|
||||
"do_check_instanceof": false,
|
||||
"do_check_matches": false,
|
||||
"do_check_neq": false,
|
||||
"do_check_null": false,
|
||||
|
@ -26,6 +27,7 @@ module.exports = {
|
|||
"do_get_idle": false,
|
||||
"do_get_profile": false,
|
||||
"do_get_tempdir": false,
|
||||
"do_load_child_test_harness": false,
|
||||
"do_load_manifest": false,
|
||||
"do_load_module": false,
|
||||
"do_parse_document": false,
|
||||
|
@ -52,6 +54,8 @@ module.exports = {
|
|||
"run_next_test": false,
|
||||
"run_test": false,
|
||||
"run_test_in_child": false,
|
||||
// Defined in XPCShellImpl.
|
||||
"sendCommand": false,
|
||||
"strictEqual": false,
|
||||
"throws": false,
|
||||
"todo": false,
|
||||
|
|
|
@ -207,10 +207,13 @@ module.exports = {
|
|||
"browser": true,
|
||||
},
|
||||
"globals": {
|
||||
"ChromeWorker": false,
|
||||
"ChromeUtils": false,
|
||||
"Components": false,
|
||||
"dump": true,
|
||||
"KeyEvent": false,
|
||||
"openDialog": false,
|
||||
"sizeToContent": false,
|
||||
"ChromeWorker": false,
|
||||
"SharedArrayBuffer": false,
|
||||
}
|
||||
};
|
||||
|
|
|
@ -68,6 +68,7 @@ function frameScript() {
|
|||
try {
|
||||
let reFullname = /Full name: (.+)/;
|
||||
let reFps = /Impact on framerate: (\d+)\/10( \((\d+) alerts\))?/;
|
||||
let reCPU = /CPU usage: (\d+)%/;
|
||||
let reCpow = /Blocking process calls: (\d+)%( \((\d+) alerts\))?/;
|
||||
|
||||
let getContentOfSelector = function(eltContainer, selector, re) {
|
||||
|
|
|
@ -142,6 +142,11 @@ function exitPBMode() {
|
|||
|
||||
ContentPrefTest.deleteDatabase();
|
||||
|
||||
do_register_cleanup(function() {
|
||||
ContentPrefTest.deleteDatabase();
|
||||
ContentPrefTest.__dirSvc = null;
|
||||
});
|
||||
|
||||
function inChildProcess() {
|
||||
var appInfo = Cc["@mozilla.org/xre/app-info;1"];
|
||||
if (!appInfo || appInfo.getService(Ci.nsIXULRuntime).processType ==
|
||||
|
@ -159,4 +164,3 @@ if (!inChildProcess()) {
|
|||
getService(Ci.nsIPrefBranch);
|
||||
prefBranch.setBoolPref("browser.preferences.content.log", true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +0,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/. */
|
||||
|
||||
ContentPrefTest.deleteDatabase();
|
||||
ContentPrefTest.__dirSvc = null;
|
|
@ -1,6 +1,6 @@
|
|||
[DEFAULT]
|
||||
head = head_contentPrefs.js
|
||||
tail = tail_contentPrefs.js
|
||||
tail =
|
||||
|
||||
[test_bug248970.js]
|
||||
[test_bug503971.js]
|
||||
|
|
|
@ -584,4 +584,3 @@ add_task(function* test_setRemoteCrashID() {
|
|||
Assert.ok(s.setRemoteCrashID("crash1", "bp-1"));
|
||||
Assert.equal(s.crashes[0].remoteID, "bp-1");
|
||||
});
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* global ThreadSafeChromeUtils */
|
||||
|
||||
try {
|
||||
// We might be running without privileges, in which case it's up to the
|
||||
// harness to give us the 'ctypes' object.
|
||||
|
@ -112,11 +114,14 @@ function trigger_gc() {
|
|||
Components.utils.forceGC();
|
||||
}
|
||||
|
||||
function must_throw(f) {
|
||||
function must_throw(f, expected) {
|
||||
let has_thrown = false;
|
||||
try {
|
||||
f();
|
||||
} catch (x) {
|
||||
if (expected) {
|
||||
do_check_eq(x.toString(), expected);
|
||||
}
|
||||
has_thrown = true;
|
||||
}
|
||||
do_check_true(has_thrown);
|
||||
|
|
|
@ -63,20 +63,23 @@ function test_finalize_bad_construction() {
|
|||
must_throw(function() { ctypes.CDataFinalizer(dispose, dispose); });
|
||||
|
||||
// Not enough arguments
|
||||
must_throw(function() { ctypes.CDataFinalizer(init(0)); });
|
||||
must_throw(function() { ctypes.CDataFinalizer(dispose); },
|
||||
"TypeError: CDataFinalizer constructor takes two arguments");
|
||||
|
||||
// Too many arguments
|
||||
must_throw(function() { ctypes.CDataFinalizer(init(0), dispose, dispose); });
|
||||
must_throw(function() { ctypes.CDataFinalizer(dispose, dispose, dispose); },
|
||||
"TypeError: CDataFinalizer constructor takes two arguments");
|
||||
|
||||
// Second argument is null
|
||||
must_throw(function() { ctypes.CDataFinalizer(init(0), null); });
|
||||
must_throw(function() { ctypes.CDataFinalizer(dispose, null); },
|
||||
"TypeError: expected _a CData object_ of a function pointer type, got null");
|
||||
|
||||
// Second argument is undefined
|
||||
must_throw(function() {
|
||||
let a;
|
||||
ctypes.CDataFinalizer(init(0), a);
|
||||
});
|
||||
|
||||
ctypes.CDataFinalizer(dispose, a);
|
||||
},
|
||||
"TypeError: expected _a CData object_ of a function pointer type, got undefined");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -949,7 +949,7 @@ function run_float_tests(library, t, name, size) {
|
|||
// Check that values roundtrip through toSource() correctly.
|
||||
function test_roundtrip(tFn, val) {
|
||||
let f1 = tFn(val);
|
||||
eval("var f2 = " + f1.toSource());
|
||||
var f2 = eval(f1.toSource());
|
||||
do_check_eq(f1.value, f2.value);
|
||||
}
|
||||
vals = [Infinity, -Infinity, -0, 0, 1, -1, 1 / 3, -1 / 3, 1 / 4, -1 / 4,
|
||||
|
@ -1543,7 +1543,7 @@ function run_StructType_tests() {
|
|||
|
||||
do_check_eq(s.toSource(), "s_t(4, {\"a\": 7, \"b\": 2}, 10)");
|
||||
do_check_eq(s.toSource(), s.toString());
|
||||
eval("var s2 = " + s.toSource());
|
||||
var s2 = eval(s.toSource());
|
||||
do_check_true(s2.constructor === s_t);
|
||||
do_check_eq(s.b.b, s2.b.b);
|
||||
|
||||
|
@ -2041,7 +2041,7 @@ function run_ArrayType_tests() {
|
|||
c.value = [1, 2, 3, 4, 5, 6];
|
||||
do_check_eq(c.toSource(), "ctypes.int32_t.array(6)([1, 2, 3, 4, 5, 6])");
|
||||
do_check_eq(c.toSource(), c.toString());
|
||||
eval("var c2 = " + c.toSource());
|
||||
var c2 = eval(c.toSource());
|
||||
do_check_eq(c2.constructor.name, "int32_t[6]");
|
||||
do_check_eq(c2.length, 6);
|
||||
do_check_eq(c2[3], c[3]);
|
||||
|
|
|
@ -16,6 +16,8 @@ Cu.import("resource://gre/modules/Services.jsm");
|
|||
Cu.import("resource://testing-common/httpd.js");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/Promise.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
|
||||
function createURI(aObj) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
/**
|
||||
* Provides infrastructure for automated download components tests.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
// Termination functions common to all tests
|
||||
|
||||
add_task(function* test_common_terminate() {
|
||||
// Stop the HTTP server. We must do this inside a task in "tail.js" until the
|
||||
// xpcshell testing framework supports asynchronous termination functions.
|
||||
let deferred = Promise.defer();
|
||||
gHttpServer.stop(deferred.resolve);
|
||||
yield deferred.promise;
|
||||
});
|
||||
|
|
@ -89,6 +89,14 @@ add_task(function* test_setup() {
|
|||
do_throw("This test should never make a remote lookup");
|
||||
});
|
||||
gHttpServ.start(4444);
|
||||
|
||||
do_register_cleanup(function() {
|
||||
return Task.spawn(function* () {
|
||||
yield new Promise(resolve => {
|
||||
gHttpServ.stop(resolve);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -141,6 +141,14 @@ add_task(function test_setup() {
|
|||
});
|
||||
|
||||
gHttpServer.start(4444);
|
||||
|
||||
do_register_cleanup(function() {
|
||||
return Task.spawn(function* () {
|
||||
yield new Promise(resolve => {
|
||||
gHttpServer.stop(resolve);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Construct a response with redirect urls.
|
||||
|
|
|
@ -18,8 +18,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
|||
"resource://gre/modules/NetUtil.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/Promise.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
|
||||
const BackgroundFileSaverOutputStream = Components.Constructor(
|
||||
"@mozilla.org/network/background-file-saver;1?mode=outputstream",
|
||||
|
@ -122,7 +120,7 @@ function promiseCopyToSaver(aSourceString, aSaverOutputStream, aCloseWhenDone) {
|
|||
if (Components.isSuccessCode(aStatusCode)) {
|
||||
deferred.resolve();
|
||||
} else {
|
||||
deferred.reject(new Components.Exception(aResult));
|
||||
deferred.reject(new Components.Exception(aStatusCode));
|
||||
}
|
||||
},
|
||||
}, null);
|
||||
|
@ -238,6 +236,14 @@ add_task(function* test_setup() {
|
|||
});
|
||||
|
||||
gHttpServer.start(4444);
|
||||
|
||||
do_register_cleanup(function() {
|
||||
return Task.spawn(function* () {
|
||||
yield new Promise(resolve => {
|
||||
gHttpServer.stop(resolve);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Construct a response with redirect urls.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
[DEFAULT]
|
||||
head = head_download_manager.js
|
||||
tail = tail_download_manager.js
|
||||
skip-if = toolkit == 'android'
|
||||
support-files =
|
||||
data/digest.chunk
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"../../../../testing/mochitest/browser.eslintrc.js"
|
||||
]
|
||||
};
|
|
@ -5,6 +5,8 @@
|
|||
* Initialization specific to Form Autofill mochitest-browser tests.
|
||||
*/
|
||||
|
||||
/* import-globals-from loader.js */
|
||||
|
||||
"use strict";
|
||||
|
||||
// We cannot start initialization from "loader.js" like we do in the xpcshell
|
||||
|
|
|
@ -12,6 +12,12 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
|
||||
Cu.import("resource://gre/modules/Services.jsm", this);
|
||||
|
||||
/* import-globals-from ../loader_common.js */
|
||||
Services.scriptloader.loadSubScript(getRootDirectory(gTestPath) +
|
||||
"loader_common.js", this);
|
||||
|
||||
|
@ -31,6 +37,7 @@ var add_task_in_parent_process = add_task;
|
|||
var add_task_in_child_process = function() {};
|
||||
var add_task_in_both_processes = add_task;
|
||||
|
||||
/* import-globals-from ../head_common.js */
|
||||
Services.scriptloader.loadSubScript(getRootDirectory(gTestPath) +
|
||||
"head_common.js", this);
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* This file is loaded by "loader.js".
|
||||
*/
|
||||
|
||||
/* import-globals-from loader.js */
|
||||
|
||||
"use strict";
|
||||
|
||||
// The testing framework is fully initialized at this point, you can add
|
||||
|
|
|
@ -20,6 +20,7 @@ Cu.import("resource://gre/modules/Services.jsm", this);
|
|||
Services.scriptloader.loadSubScript(
|
||||
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js", this);
|
||||
|
||||
/* import-globals-from ../loader_common.js */
|
||||
var sharedUrl = SimpleTest.getTestFileURL("loader_common.js");
|
||||
Services.scriptloader.loadSubScript(sharedUrl, this);
|
||||
|
||||
|
@ -100,6 +101,7 @@ add_task(function* wait_loading_in_parent_process() {
|
|||
yield promiseParentInitFinished;
|
||||
});
|
||||
|
||||
/* import-globals-from ../head_common.js */
|
||||
var headUrl = SimpleTest.getTestFileURL("head_common.js");
|
||||
Services.scriptloader.loadSubScript(headUrl, this);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
|||
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
|
||||
Cu.import("resource://gre/modules/Services.jsm", this);
|
||||
|
||||
/* import-globals-from ../loader_common.js */
|
||||
var sharedUrl = "chrome://mochitests/content/chrome/" +
|
||||
"toolkit/components/formautofill/test/chrome/loader_common.js";
|
||||
Services.scriptloader.loadSubScript(sharedUrl, this);
|
||||
|
@ -60,6 +61,7 @@ var add_task_in_both_processes = add_task_in_parent_process;
|
|||
var context = this;
|
||||
addMessageListener("start_load_in_parent", function(message) {
|
||||
Output.print("Starting loading infrastructure in parent process.");
|
||||
/* import-globals-from ../head_common.js */
|
||||
let headUrl = "chrome://mochitests/content/chrome/" +
|
||||
"toolkit/components/formautofill/test/chrome/head_common.js";
|
||||
Services.scriptloader.loadSubScript(headUrl, context);
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/* import-globals-from loader.js */
|
||||
|
||||
/**
|
||||
* Tests the truth assertion function.
|
||||
*/
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/* import-globals-from loader.js */
|
||||
|
||||
/**
|
||||
* The requestAutocomplete UI will not be displayed during these tests.
|
||||
*/
|
||||
|
|
|
@ -7,8 +7,14 @@
|
|||
* A copy of this file is installed in each of the framework subfolders, this
|
||||
* means it becomes a sibling of the test files in the final layout. This is
|
||||
* determined by how manifest "support-files" installation works.
|
||||
*
|
||||
* This file expects the globals below to be defined in the scope it is
|
||||
* imported into.
|
||||
*/
|
||||
|
||||
/* global add_termination_task, add_task_in_both_processes,
|
||||
add_task_in_parent_process, Output */
|
||||
|
||||
"use strict";
|
||||
|
||||
// The requestAutocomplete framework is available at this point, you can add
|
||||
|
|
|
@ -11,10 +11,15 @@
|
|||
* Unless you are adding new features to the framework, you shouldn't have to
|
||||
* modify this file. Use "head_common.js" or the "head.js" file of each
|
||||
* framework for shared code.
|
||||
*
|
||||
* This file expects Services & XPCOMUtils to be defined in the scope it is imported
|
||||
* into. Additionally, it expects "Output" to be defined as well.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/* global XPCOMUtils, Services, Output */
|
||||
|
||||
/*
|
||||
* --------------------
|
||||
* FRAMEWORK OVERVIEW
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
* 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/. */
|
||||
|
||||
// It is expected that the test files importing this file define Cu etc.
|
||||
/* global Cu, Ci, Cc, Cr */
|
||||
|
||||
const CURRENT_SCHEMA_VERSION = 36;
|
||||
const FIRST_UPGRADABLE_SCHEMA_VERSION = 11;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ var gPrintSettings = null;
|
|||
var gPrintSettingsInterface = Components.interfaces.nsIPrintSettings;
|
||||
var gPaperArray;
|
||||
var gPrefs;
|
||||
var gParamBlock;
|
||||
|
||||
var gPrintSetInterface = Components.interfaces.nsIPrintSettings;
|
||||
var doDebug = true;
|
||||
|
@ -310,15 +311,15 @@ function onLoad() {
|
|||
initDialog();
|
||||
|
||||
gPrintSettings = window.arguments[0].QueryInterface(gPrintSetInterface);
|
||||
paramBlock = window.arguments[1].QueryInterface(Components.interfaces.nsIDialogParamBlock);
|
||||
gParamBlock = window.arguments[1].QueryInterface(Components.interfaces.nsIDialogParamBlock);
|
||||
|
||||
if (doDebug) {
|
||||
if (gPrintSettings == null) alert("PrintSettings is null!");
|
||||
if (paramBlock == null) alert("nsIDialogParam is null!");
|
||||
if (gParamBlock == null) alert("nsIDialogParam is null!");
|
||||
}
|
||||
|
||||
// default return value is "cancel"
|
||||
paramBlock.SetInt(0, 0);
|
||||
gParamBlock.SetInt(0, 0);
|
||||
|
||||
loadDialog();
|
||||
}
|
||||
|
@ -368,9 +369,9 @@ function onAccept() {
|
|||
dump("************ onAccept gPrintSettings: " + gPrintSettings + "\n");
|
||||
}
|
||||
|
||||
if (paramBlock) {
|
||||
if (gParamBlock) {
|
||||
// set return value to "ok"
|
||||
paramBlock.SetInt(0, 1);
|
||||
gParamBlock.SetInt(0, 1);
|
||||
} else {
|
||||
dump("*** FATAL ERROR: paramBlock missing\n");
|
||||
}
|
||||
|
|
|
@ -4,6 +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/. */
|
||||
|
||||
/* import-globals-from viewSource.js */
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function onLoadViewPartialSource() {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"../../../../testing/mochitest/mochitest.eslintrc.js"
|
||||
]
|
||||
};
|
|
@ -156,6 +156,9 @@ function do_content_crash(setup, callback) {
|
|||
.getService(Components.interfaces.nsICrashReporter);
|
||||
crashReporter.minidumpPath = do_get_tempdir();
|
||||
|
||||
/* import-globals-from ../unit/crasher_subprocess_head.js */
|
||||
/* import-globals-from ../unit/crasher_subprocess_tail.js */
|
||||
|
||||
let headfile = do_get_file("../unit/crasher_subprocess_head.js");
|
||||
let tailfile = do_get_file("../unit/crasher_subprocess_tail.js");
|
||||
if (setup) {
|
||||
|
|
|
@ -3,7 +3,11 @@
|
|||
|
||||
// Test that AsyncShutdown report errors correctly
|
||||
|
||||
// Note: these functions are evaluated in their own process, hence the need
|
||||
// to import modules into each function.
|
||||
|
||||
function setup_crash() {
|
||||
/* global AsyncShutdown */
|
||||
Components.utils.import("resource://gre/modules/AsyncShutdown.jsm", this);
|
||||
Components.utils.import("resource://gre/modules/Services.jsm", this);
|
||||
Components.utils.import("resource://gre/modules/Promise.jsm", this);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* import-globals-from ../unit/head_crashreporter.js */
|
||||
load("../unit/head_crashreporter.js");
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* import-globals-from ../unit/head_crashreporter.js */
|
||||
load("../unit/head_crashreporter.js");
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
/* import-globals-from ../unit/head_crashreporter.js */
|
||||
load("../unit/head_crashreporter.js");
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* import-globals-from ../unit/head_crashreporter.js */
|
||||
load("../unit/head_crashreporter.js");
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -185,7 +185,7 @@ this.ForgetAboutSite = {
|
|||
np.reset();
|
||||
|
||||
// Push notifications.
|
||||
promises.push(new Promise(resolve => {
|
||||
promises.push(new Promise((resolve, reject) => {
|
||||
var push = Cc["@mozilla.org/push/Service;1"]
|
||||
.getService(Ci.nsIPushService);
|
||||
push.clearForDomain(aDomain, status => {
|
||||
|
|
|
@ -2,6 +2,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/. */
|
||||
|
||||
/* import-globals-from ../../../../dom/push/test/xpcshell/head.js */
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
|
|
|
@ -97,7 +97,7 @@ this.Log = {
|
|||
enumerateInterfaces: function Log_enumerateInterfaces(aObject) {
|
||||
let interfaces = [];
|
||||
|
||||
for (i in Ci) {
|
||||
for (let i in Ci) {
|
||||
try {
|
||||
aObject.QueryInterface(Ci[i]);
|
||||
interfaces.push(i);
|
||||
|
@ -113,7 +113,7 @@ this.Log = {
|
|||
enumerateProperties(aObject, aExcludeComplexTypes) {
|
||||
let properties = [];
|
||||
|
||||
for (p in aObject) {
|
||||
for (let p in aObject) {
|
||||
try {
|
||||
if (aExcludeComplexTypes &&
|
||||
(typeof(aObject[p]) == "object" || typeof(aObject[p]) == "function"))
|
||||
|
@ -961,4 +961,3 @@ BoundedFileAppender.prototype = {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ const Cc = Components.classes;
|
|||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu["import"]("resource://gre/modules/Services.jsm", this);
|
||||
Cu.import("resource://gre/modules/Services.jsm", this);
|
||||
|
||||
var eventListenerService = Cc["@mozilla.org/eventlistenerservice;1"]
|
||||
.getService(Ci.nsIEventListenerService);
|
||||
|
|
|
@ -297,7 +297,7 @@ add_task(function* test_beforeSave_rejects() {
|
|||
storeForSave.saveSoon();
|
||||
});
|
||||
|
||||
yield rejects(promiseSave, function(ex) {
|
||||
yield Assert.rejects(promiseSave, function(ex) {
|
||||
return ex.message == "oops";
|
||||
});
|
||||
});
|
||||
|
|
|
@ -505,7 +505,7 @@ add_task(function* test_log_err_only() {
|
|||
eval("javascript syntax error");
|
||||
} catch (e) {
|
||||
log.error(e);
|
||||
msg = appender.messages.pop();
|
||||
let msg = appender.messages.pop();
|
||||
do_check_eq(msg.message, null);
|
||||
do_check_eq(msg.params, e);
|
||||
}
|
||||
|
@ -567,8 +567,8 @@ add_task(function* format_errors() {
|
|||
let pFormat = new Log.ParameterFormatter();
|
||||
|
||||
// Test that subclasses of Error are recognized as errors.
|
||||
err = new ReferenceError("Ref Error", "ERROR_FILE", 28);
|
||||
str = pFormat.format(err);
|
||||
let err = new ReferenceError("Ref Error", "ERROR_FILE", 28);
|
||||
let str = pFormat.format(err);
|
||||
do_check_true(str.includes("ReferenceError"));
|
||||
do_check_true(str.includes("ERROR_FILE:28"));
|
||||
do_check_true(str.includes("Ref Error"));
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
var z;
|
||||
z = x / y;
|
||||
|
||||
for (i = 0 + x; i < 1000; ++i)
|
||||
for (let i = 0 + x; i < 1000; ++i)
|
||||
z = y / x;
|
||||
|
||||
z = x / y;
|
||||
|
|
Загрузка…
Ссылка в новой задаче