Bug 1315402: Make toolkit/mozapps/update pass no-undef. r=jaws

This is mostly using the import-globals-from rule to pull in globals when
the subscript loader is used. For a couple of files I've turned off no-undef
altogether, these are files that are loaded by the subscript loader and depend
on globals from the parent.

MozReview-Commit-ID: 2ZzgpCQTTuu

--HG--
extra : rebase_source : 6d2f20111ae27858811bd19db794dc9fb29183d0
This commit is contained in:
Dave Townsend 2016-11-04 17:03:01 -07:00
parent baee0ed159
commit 6365baa692
14 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,8 @@
// Parent config file for all marionette files.
module.exports = {
// All globals made available in the test environment.
"globals": {
"ok": false,
"is": false,
}
};

View File

@ -5,10 +5,13 @@
'use strict';
/* import-globals-from ../../../content/contentAreaUtils.js */
// Firefox's macBrowserOverlay.xul includes scripts that define Cc, Ci, and Cr
// so we have to use different names.
const {classes: CoC, interfaces: CoI, results: CoR, utils: CoU} = Components;
/* globals DownloadUtils, Services, AUSTLMY */
CoU.import("resource://gre/modules/DownloadUtils.jsm", this);
CoU.import("resource://gre/modules/Services.jsm", this);
CoU.import("resource://gre/modules/UpdateTelemetry.jsm", this);

View File

@ -69,6 +69,8 @@
'use strict';
/* globals TESTS, runTest, finishTest */
const { classes: Cc, interfaces: Ci, manager: Cm, results: Cr,
utils: Cu } = Components;
@ -146,6 +148,7 @@ var gUseTestUpdater = false;
var DEBUG_AUS_TEST = true;
const DATA_URI_SPEC = "chrome://mochitests/content/chrome/toolkit/mozapps/update/tests/data/";
/* import-globals-from ../data/shared.js */
Services.scriptloader.loadSubScript(DATA_URI_SPEC + "shared.js", this);
/**

View File

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Shared code for xpcshell and mochitests-chrome */
/* eslint-disable no-undef */
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@ -71,6 +72,7 @@ const DEFAULT_UPDATE_VERSION = "999999.0";
var gChannel;
/* import-globals-from ../data/sharedUpdateXML.js */
Services.scriptloader.loadSubScript(DATA_URI_SPEC + "sharedUpdateXML.js", this);
const PERMS_FILE = FileUtils.PERMS_FILE;

View File

@ -11,6 +11,8 @@
* features greater than JavaScript 1.7.
*/
/* eslint-disable no-undef */
const FILE_SIMPLE_MAR = "simple.mar";
const SIZE_SIMPLE_MAR = "1031";
const MD5_HASH_SIMPLE_MAR = "1f8c038577bb6845d94ccec4999113ee";

View File

@ -29,10 +29,15 @@
*/
'use strict';
/* eslint-disable no-undef */
const { classes: Cc, interfaces: Ci, manager: Cm, results: Cr,
utils: Cu } = Components;
/* global INSTALL_LOCALE, MOZ_APP_NAME, BIN_SUFFIX, MOZ_APP_VENDOR */
/* global MOZ_APP_BASENAME, APP_BIN_SUFFIX, APP_INFO_NAME, APP_INFO_VENDOR */
/* global IS_WIN, IS_MACOSX, IS_UNIX, IS_ANDROID, IS_TOOLKIT_GONK */
/* global MOZ_VERIFY_MAR_SIGNATURE, MOZ_VERIFY_MAR_SIGNATURE, IS_AUTHENTICODE_CHECK_ENABLED */
load("../data/xpcshellConstantsPP.js");
function getLogSuffix() {
@ -193,6 +198,7 @@ var gEnvLdLibraryPath;
var DEBUG_AUS_TEST = true;
const DATA_URI_SPEC = Services.io.newFileURI(do_get_file("../data", false)).spec;
/* import-globals-from ../data/shared.js */
Services.scriptloader.loadSubScript(DATA_URI_SPEC + "shared.js", this);
var gTestFiles = [];

View File

@ -0,0 +1,7 @@
"use strict";
module.exports = {
"extends": [
"../../../../../testing/marionette/marionette.eslintrc.js"
]
};

View File

@ -1,6 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* import-globals-from ../../../../../testing/marionette/harness/marionette/atoms/b2g_update_test.js */
function testSameVersion() {
let mozSettings = window.navigator.mozSettings;
let forceSent = false;

View File

@ -1,6 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* import-globals-from ../../../../../testing/marionette/harness/marionette/atoms/b2g_update_test.js */
/* globals Services */
function testForceCheck() {
addChromeEventListener("update-available", function(evt) {
isFinishUpdate(evt.detail);

View File

@ -1,6 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* import-globals-from ../../../../../testing/marionette/harness/marionette/atoms/b2g_update_test.js */
function testForceCheck() {
addChromeEventListener("update-available", function(evt) {
let update = evt.detail;

View File

@ -1,6 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* import-globals-from ../../../../../testing/marionette/harness/marionette/atoms/b2g_update_test.js */
const TEST_URL = "http://localhost";
setPref("b2g.update.apply-idle-timeout", 0);

View File

@ -4,4 +4,5 @@
const IS_SERVICE_TEST = false;
/* import-globals-from ../data/xpcshellUtilsAUS.js */
load("../data/xpcshellUtilsAUS.js");

View File

@ -4,4 +4,5 @@
const IS_SERVICE_TEST = false;
/* import-globals-from ../data/xpcshellUtilsAUS.js */
load("../data/xpcshellUtilsAUS.js");

View File

@ -4,4 +4,5 @@
const IS_SERVICE_TEST = true;
/* import-globals-from ../data/xpcshellUtilsAUS.js */
load("../data/xpcshellUtilsAUS.js");