Bug 1385352 - Enable 'mozilla/no-arbitrary-setTimeout' eslint rule on browser-chrome tests, r=standard8

MozReview-Commit-ID: 5lO0uAjHMsw

--HG--
extra : rebase_source : 8607b3964da207a6076c79b6f1d75b40503cdd7d
This commit is contained in:
Andrew Halberstadt 2017-08-10 14:48:21 -04:00
parent 0ff5a4285d
commit d2109610fb
91 changed files with 99 additions and 6 deletions

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
// Bug 1318389 - This test does a lot of window and tab manipulation,

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
// This test tests <select> in a child process. This is different than
// single-process as a <menulist> is used to implement the dropdown list.

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
const PAGE = "https://example.com/browser/browser/base/content/test/general/file_mediaPlayback.html";
const TABATTR_REMOVAL_PREFNAME = "browser.tabs.delayHidingAudioPlayingIconMS";
const INITIAL_TABATTR_REMOVAL_DELAY_MS = Services.prefs.getIntPref(TABATTR_REMOVAL_PREFNAME);

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
function invokeUsingCtrlD(phase) {
switch (phase) {
case 1:

View File

@ -1,4 +1,5 @@
/* eslint-env mozilla/frame-script */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
const TEST_PAGE = "http://mochi.test:8888/browser/browser/base/content/test/general/file_double_close_tab.html";
var testTab;

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
// gBrowser.selectedTab.lastAccessed and Date.now() called from this test can't
// run concurrently, and therefore don't always match exactly.

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
function testExpected(expected, msg) {
is(document.getElementById("context-openlinkincurrent").hidden, expected, msg);
}

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* eslint-disable mozilla/no-arbitrary-setTimeout */
var secureURL = "https://example.com/browser/browser/base/content/test/general/browser_star_hsts.sjs";
var unsecureURL = "http://example.com/browser/browser/base/content/test/general/browser_star_hsts.sjs";

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* eslint-disable mozilla/no-arbitrary-setTimeout */
function notifyStoragePressure(usage = 100) {
let notifyPromise = TestUtils.topicObserved("QuotaManager::StoragePressure", () => true);

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
// Test for the docshell active state of local and remote browsers.

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
function test() {
waitForExplicitFinish();

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
function test() {
waitForExplicitFinish();

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
// The purpose of this test is to test the urlbar popup's add-on iframe. It has

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
var notificationObserver;

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
const SLOW_PAGE = "http://www.example.com/browser/browser/base/content/test/urlbar/slow-page.sjs";

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
const {AddonManagerPrivate} = Cu.import("resource://gre/modules/AddonManager.jsm", {});
const {AddonTestUtils} = Cu.import("resource://testing-common/AddonTestUtils.jsm", {});

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
const kWidgetId = "test-981418-widget-onbeforecreated";

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
add_task(async function mainTest() {

View File

@ -2,6 +2,7 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
/**
* Make sure the downloads panel only opens automatically on the first

View File

@ -1,5 +1,6 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
let scriptPage = url => `<html><head><meta charset="utf-8"><script src="${url}"></script></head><body>${url}</body></html>`;

View File

@ -1,5 +1,6 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
add_task(async function setup() {

View File

@ -1,5 +1,6 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
add_task(async function testPopupBackground() {

View File

@ -1,5 +1,6 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
add_task(async function test_popup_sendMessage_reply() {

View File

@ -1,5 +1,6 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
add_task(async function testTabEvents() {

View File

@ -1,5 +1,6 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
add_task(async function testWindowCreate() {

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
/**
* Tests Places views (toolbar, tree) for icons update.

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
// Test to make sure that the visited page titles do not get updated inside the
// private browsing mode.

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
// This test makes sure that the title of existing history entries does not
// change inside a private window.

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
// This test makes sure that the web pages can't register protocol handlers
// inside the private browsing mode.

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
XPCOMUtils.defineLazyModuleGetter(this, "FormHistory",
"resource://gre/modules/FormHistory.jsm");

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
function test() {
/** Test for Bug 459906 **/

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
function test() {
/** Test for Bug 506482 **/

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
var tabState = {
entries: [{

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
var tabState = {
entries: [{

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
/**
Ensure that frameset history works properly when restoring a tab,

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
/**

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
let NS_OSX_PICTURE_DOCUMENTS_DIR = "Pct";
let NS_MAC_USER_LIB_DIR = "ULibDir";

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
const FORM_URL = "http://mochi.test:8888/browser/browser/extensions/formautofill/test/browser/autocomplete_basic.html";

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
const FORM_URL = "http://mochi.test:8888/browser/browser/extensions/formautofill/test/browser/autocomplete_basic.html";

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
const FORM_URL = "http://mochi.test:8888/browser/browser/extensions/formautofill/test/browser/autocomplete_basic.html";

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
requestLongerTimeout(2);

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
// This is a test for PageActions.jsm, specifically the generalized parts that

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
// Avoid test timeouts that can occur while waiting for the "addon-console-works" message.

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,6 +1,7 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -2,6 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-env mozilla/frame-script */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
/*
* Test the password manager context menu interaction with autocomplete.
*/

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
const HOST = "https://example.com";
const URL = HOST + "/browser/toolkit/components/passwordmgr/test/browser/form_basic.html";
const TIMEOUT_PREF = "signon.masterPasswordReprompt.timeout_ms";

View File

@ -2,6 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-env mozilla/frame-script */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
/**

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* eslint-disable mozilla/no-arbitrary-setTimeout */
function test() {
function checkLastSuccess() {

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
let tempFile;
add_task(async function setup() {

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict"; // -*- js-indent-level: 2; indent-tabs-mode: nil -*-
var Cc = Components.classes;
var Ci = Components.interfaces;

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_multipleAudio.html";
var SuspendedType = {

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_nonAutoplayAudio.html";
var SuspendedType = {

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
// Test for bug 1170531
// https://bugzilla.mozilla.org/show_bug.cgi?id=1170531

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
Components.utils.import("resource://gre/modules/Timer.jsm", this);
const TEST_PAGE_URI = "data:text/html;charset=utf-8,The letter s.";

View File

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
Cu.import("resource://testing-common/BrowserTestUtils.jsm", this);

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* eslint-disable mozilla/no-arbitrary-setTimeout */
// Bug 587970 - Provide ability "Update all now" within 'Available Updates' screen

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* eslint-disable mozilla/no-arbitrary-setTimeout */
// Test that we can cancel the add-on compatibility check while it is
// in progress (bug 772484).

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* eslint-disable mozilla/no-arbitrary-setTimeout */
/* globals TestUtils */

View File

@ -60,6 +60,7 @@ module.exports = {
"rules": {
"mozilla/import-content-task-globals": "error",
"mozilla/import-headjs-globals": "warn",
"mozilla/mark-test-function-used": "warn"
"mozilla/mark-test-function-used": "warn",
"mozilla/no-arbitrary-setTimeout": "error"
}
};

View File

@ -13,6 +13,10 @@
// -----------------------------------------------------------------------------
var helpers = require("../helpers");
var testTypes = new Set([
"browser",
"xpcshell"
]);
module.exports = {
meta: {
@ -30,11 +34,11 @@ module.exports = {
create(context) {
return {
"CallExpression": function(node) {
// We don't want to run this on mochitests as mochitest already
// We don't want to run this on mochitest plain as it already
// prevents flaky setTimeout at runtime. This check is built-in
// to the rule itself as sometimes xpcshell tests can live
// alongside mochitests and so can't be configured via config.
if (helpers.getTestType(context) !== "xpcshell") {
// to the rule itself as sometimes other tests can live alongside
// plain mochitests and so it can't be configured via eslintrc.
if (!testTypes.has(helpers.getTestType(context))) {
return;
}

View File

@ -31,7 +31,7 @@ ruleTester.run("no-arbitrary-setTimeout", rule, {
valid: [
wrapCode("setTimeout(function() {}, 0);"),
wrapCode("setTimeout(function() {});"),
wrapCode("setTimeout(function() {}, 10);", "browser_test.js")
wrapCode("setTimeout(function() {}, 10);", "test_foo.js")
],
invalid: [
invalidCode("setTimeout(function() {}, 10);"),