Backed out changeset 3e5b6df276a9 from bug 1245916 for causing test failures.

MozReview-Commit-ID: CbsTB3xqGC6
This commit is contained in:
Dave Townsend 2016-02-15 11:36:23 -08:00
parent a20101f7bf
commit c56db4025e
51 changed files with 49 additions and 92 deletions

View File

@ -1,6 +0,0 @@
{
"rules": {
// No using undeclared variables
"no-undef": 2,
}
}

View File

@ -977,7 +977,7 @@ var AddonManagerInternal = {
// Support for remote about:plugins. Note that this module isn't loaded
// at the top because Services.appinfo is defined late in tests.
let { RemotePages } = Cu.import("resource://gre/modules/RemotePageManager.jsm", {});
Cu.import("resource://gre/modules/RemotePageManager.jsm");
gPluginPageListener = new RemotePages("about:plugins");
gPluginPageListener.addMessageListener("RequestPlugins", this.requestPlugins);
@ -1145,7 +1145,7 @@ var AddonManagerInternal = {
provider[aMethod].apply(provider, aArgs);
}
catch (e) {
reportProviderError(provider, aMethod, e);
reportProviderError(aProvider, aMethod, e);
}
}
},

View File

@ -9,7 +9,6 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/osfile.jsm");
/*globals OS*/
Cu.import("resource://gre/modules/Promise.jsm");
// Make it possible to mock out timers for testing

View File

@ -11,7 +11,6 @@ const Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
/*globals AddonManagerPrivate*/
Components.utils.import("resource://gre/modules/Services.jsm");
const ID_SUFFIX = "@personas.mozilla.org";

View File

@ -36,7 +36,6 @@ var gParentMM = null;
function amManager() {
Cu.import("resource://gre/modules/AddonManager.jsm");
/*globals AddonManagerPrivate*/
let globalMM = Cc["@mozilla.org/globalmessagemanager;1"]
.getService(Ci.nsIMessageListenerManager);

View File

@ -6,8 +6,6 @@
"use strict";
/* import-globals-from ../../../content/contentAreaUtils.js */
var Cu = Components.utils;
Cu.import("resource://gre/modules/AddonManager.jsm");

View File

@ -4,9 +4,6 @@
"use strict";
/* import-globals-from ../../../content/contentAreaUtils.js */
/*globals XMLStylesheetProcessingInstruction*/
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;

View File

@ -9,8 +9,6 @@
%extensionsDTD;
]>
<!-- import-globals-from extensions.js -->
<bindings id="addonBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"

View File

@ -8,8 +8,6 @@
%extensionsDTD;
]>
<!-- import-globals-from extensions.js -->
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"

View File

@ -11,7 +11,6 @@ const Cr = Components.results;
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
/*globals AddonManagerPrivate*/
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
@ -429,8 +428,7 @@ AddonSearchResult.prototype = {
toJSON: function() {
let json = {};
for (let property of Object.keys(this)) {
let value = this[property];
for (let [property, value] of Iterator(this)) {
if (property.startsWith("_") ||
typeof(value) === "function")
continue;
@ -453,8 +451,7 @@ AddonSearchResult.prototype = {
}
}
for (let property of Object.keys(this._unsupportedProperties)) {
let value = this._unsupportedProperties[property];
for (let [property, value] of Iterator(this._unsupportedProperties)) {
if (!property.startsWith("_"))
json[property] = value;
}
@ -1836,7 +1833,7 @@ var AddonDatabase = {
let addon = new AddonSearchResult(id);
for (let expectedProperty of Object.keys(AddonSearchResult.prototype)) {
for (let [expectedProperty,] of Iterator(AddonSearchResult.prototype)) {
if (!(expectedProperty in aObj) ||
typeof(aObj[expectedProperty]) === "function")
continue;
@ -1884,8 +1881,8 @@ var AddonDatabase = {
case "icons":
if (!addon.icons) addon.icons = {};
for (let size of Object.keys(aObj.icons)) {
addon.icons[size] = aObj.icons[size];
for (let [size, url] of Iterator(aObj.icons)) {
addon.icons[size] = url;
}
break;

View File

@ -10,7 +10,6 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
/*globals AddonManagerPrivate*/
Cu.import("resource://gre/modules/FileUtils.jsm");
const KEY_PROFILEDIR = "ProfD";

View File

@ -274,8 +274,7 @@ function sanitizeUpdateURL(aUpdate, aRequest, aHashPattern, aHashString) {
*/
function parseRDFManifest(aId, aUpdateKey, aRequest, aManifestData) {
if (aManifestData.documentElement.namespaceURI != PREFIX_NS_RDF) {
throw Components.Exception("Update manifest had an unrecognised namespace: " +
aManifestData.documentElement.namespaceURI);
throw Components.Exception("Update manifest had an unrecognised namespace: " + xml.documentElement.namespaceURI);
return undefined;
}

View File

@ -2,8 +2,6 @@
* 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/. */
/*globals addMessageListener*/
"use strict";
(function() {

View File

@ -12,15 +12,12 @@ this.EXPORTED_SYMBOLS = [];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
/*globals AddonManagerPrivate*/
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
/*globals OS*/
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/GMPUtils.jsm");
/*globals EME_ADOBE_ID, GMP_PLUGIN_IDS, GMPPrefs, GMPUtils, OPEN_H264_ID*/
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/UpdateUtils.jsm");

View File

@ -22,7 +22,7 @@ const ORIGIN_BOTTOM_LEFT = 2;
this.LightweightThemeImageOptimizer = {
optimize: function(aThemeData, aScreen) {
let data = Object.assign({}, aThemeData);
let data = Utils.createCopy(aThemeData);
if (!data.headerURL) {
return data;
}
@ -178,3 +178,12 @@ var ImageTools = {
XPCOMUtils.defineLazyServiceGetter(ImageTools, "_imgTools",
"@mozilla.org/image/tools;1", "imgITools");
var Utils = {
createCopy: function(aData) {
let copy = {};
for (let [k, v] in Iterator(aData)) {
copy[k] = v;
}
return copy;
}
};

View File

@ -11,7 +11,6 @@ const Cu = Components.utils;
this.EXPORTED_SYMBOLS = [];
Cu.import("resource://gre/modules/AddonManager.jsm");
/*globals AddonManagerPrivate*/
Cu.import("resource://gre/modules/Services.jsm");
const URI_EXTENSION_STRINGS = "chrome://mozapps/locale/extensions/extensions.properties";

View File

@ -11,11 +11,9 @@ this.EXPORTED_SYMBOLS = [ "ProductAddonChecker" ];
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://gre/modules/CertUtils.jsm");
/*globals checkCert, BadCertHandler*/
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
/*globals OS*/
var logger = Log.repository.getLogger("addons.productaddons");

View File

@ -18,7 +18,6 @@ const { ADDON_SIGNING, REQUIRE_SIGNING } = CONSTANTS
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
/*globals AddonManagerPrivate*/
Cu.import("resource://gre/modules/Preferences.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository",
@ -277,7 +276,6 @@ const LOGGER_ID = "addons.xpi";
var logger = Log.repository.getLogger(LOGGER_ID);
const LAZY_OBJECTS = ["XPIDatabase", "XPIDatabaseReconcile"];
/*globals XPIDatabase, XPIDatabaseReconcile*/
var gLazyObjectsLoaded = false;
@ -576,7 +574,7 @@ SafeInstallOperation.prototype = {
while (this._installedFiles.length > 0) {
let move = this._installedFiles.pop();
if (move.isMoveTo) {
move.newFile.moveTo(move.oldDir.parent, move.oldDir.leafName);
move.newFile.moveTo(oldDir.parent, oldDir.leafName);
}
else if (move.newFile.isDirectory()) {
let oldDir = move.oldFile.parent.clone();
@ -3635,8 +3633,8 @@ this.XPIProvider = {
// When upgrading remove the old extensions cache to force older
// versions to rescan the entire list of extensions
let oldCache = FileUtils.getFile(KEY_PROFILEDIR, [FILE_OLD_CACHE], true);
try {
let oldCache = FileUtils.getFile(KEY_PROFILEDIR, [FILE_OLD_CACHE], true);
if (oldCache.exists())
oldCache.remove(true);
}

View File

@ -4,12 +4,6 @@
"use strict";
// These are injected from XPIProvider.jsm
/*globals ADDON_SIGNING, SIGNED_TYPES, BOOTSTRAP_REASONS, DB_SCHEMA,
AddonInternal, XPIProvider, XPIStates, syncLoadManifestFromFile,
isUsableAddon, recordAddonTelemetry, applyBlocklistChanges,
flushStartupCache, canRunInSafeMode*/
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cr = Components.results;
@ -18,7 +12,6 @@ var Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
/*globals AddonManagerPrivate*/
Cu.import("resource://gre/modules/Preferences.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository",

View File

@ -19,7 +19,6 @@ try {
// process. We're used in the child process (for now), so guard against
// this.
Components.utils.import("resource://gre/modules/AddonManager.jsm");
/*globals AddonManagerPrivate*/
} catch (e) {
}

View File

@ -1 +1 @@
var active = true;
active = true;

View File

@ -10,7 +10,6 @@ const SEARCH_URL = TESTROOT + "browser_bug593535.xml";
const QUERY = "NOTFOUND";
var gProvider;
var gManagerWindow;
function test() {
waitForExplicitFinish();

View File

@ -1,7 +1,6 @@
<html>
<head>
<script type="text/javascript">
/*globals InstallTrigger*/
function install() {
InstallTrigger.install({
"Test Add-on": {

View File

@ -1,7 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/*globals end_test*/
Components.utils.import("resource://gre/modules/NetUtil.jsm");
@ -1344,7 +1343,7 @@ MockInstall.prototype = {
break;
case AddonManager.STATE_DOWNLOADING:
case AddonManager.STATE_CHECKING:
case AddonManager.STATE_INSTALLING:
case AddonManger.STATE_INSTALLING:
// Installation is already running
return;
default:

View File

@ -37,7 +37,7 @@ Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
Components.utils.import("resource://gre/modules/Promise.jsm");
Components.utils.import("resource://gre/modules/Task.jsm");
const { OS } = Components.utils.import("resource://gre/modules/osfile.jsm", {});
Components.utils.import("resource://gre/modules/osfile.jsm");
Components.utils.import("resource://gre/modules/AsyncShutdown.jsm");
Components.utils.import("resource://testing-common/MockRegistrar.jsm");
@ -47,9 +47,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "HttpServer",
"resource://testing-common/httpd.js");
// We need some internal bits of AddonManager
var AMscope = Components.utils.import("resource://gre/modules/AddonManager.jsm", {});
var { AddonManager, AddonManagerInternal, AddonManagerPrivate } = AMscope;
var AMscope = Components.utils.import("resource://gre/modules/AddonManager.jsm");
var AddonManager = AMscope.AddonManager;
var AddonManagerInternal = AMscope.AddonManagerInternal;
// Mock out AddonManager's reference to the AsyncShutdown module so we can shut
// down AddonManager from the test
var MockAsyncShutdown = {
@ -469,7 +469,7 @@ function overrideCertDB(handler) {
let certDBFactory = {
createInstance: function(outer, iid) {
if (outer != null) {
throw Components.results.NS_ERROR_NO_AGGREGATION;
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return fakeCertDB.QueryInterface(iid);
}
@ -1794,7 +1794,7 @@ if ("nsIWindowsRegKey" in AM_Ci) {
case AM_Ci.nsIWindowsRegKey.ROOT_KEY_CLASSES_ROOT:
return MockRegistry.CLASSES_ROOT;
default:
do_throw("Unknown root " + aRoot);
do_throw("Unknown root " + aRootKey);
return null;
}
},

View File

@ -1,3 +1,2 @@
/*globals Services, TEST_UNPACKED: true*/
Services.prefs.setBoolPref("extensions.alwaysUnpack", true);
TEST_UNPACKED = true;

View File

@ -303,6 +303,7 @@ add_task(function* dirty_while_writing() {
// A write callback for the OS.File.writeAtomic mock that rejects write attempts
function disabled_write_callback(aTester) {
do_throw("Should not have written during clean flush");
deferred.reject(new Error("Write during supposedly clean flush"));
}
// special write callback that disables itself to make sure

View File

@ -258,7 +258,7 @@ function run_test() {
startupManager();
AddonManager.getAddonsByIDs(addonIDs, function(addons) {
for (let addon of addons) {
for (addon of addons) {
do_check_eq(addon.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
}
run_test_1();

View File

@ -125,7 +125,7 @@ function run_test() {
startupManager();
AddonManager.getAddonsByIDs(addonIDs, function(addons) {
for (let addon of addons) {
for (addon of addons) {
do_check_eq(addon.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
}
run_test_1();

View File

@ -35,7 +35,7 @@ function check_test() {
do_check_true(addon.isActive);
// Tests that chrome.manifest is registered when the addon is installed.
var target = { };
var target = { active: false };
Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target);
do_check_true(target.active);

View File

@ -141,7 +141,6 @@ function run_test() {
});
}
var gLastEvent;
function onGenericEvent(event) {
gLastEvent = event.type;
}

View File

@ -2,8 +2,6 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var { classes: Cc, interfaces: Ci } = Components;
// Test whether the blacklist succesfully adds and removes the prefs that store
// its decisions when the remote blacklist is changed.
// Uses test_gfxBlacklist.xml and test_gfxBlacklist2.xml

View File

@ -33,7 +33,7 @@ TestProvider.prototype = {
if (aURI.spec === this.uri.spec) {
return this.id;
}
throw Components.Exception("Not mapped", this.result);
throw Components.Exception("Not mapped", result);
}
};

View File

@ -31,7 +31,7 @@ PluginTag.prototype = {
}
};
const PLUGINS = [
PLUGINS = [
// A standalone plugin
new PluginTag("Java", "A mock Java plugin"),
@ -40,7 +40,7 @@ const PLUGINS = [
new PluginTag("Flash", "A mock Flash plugin")
];
const gPluginHost = {
gPluginHost = {
// nsIPluginHost
getPluginTags: function(count) {
count.value = PLUGINS.length;

View File

@ -18,7 +18,7 @@ function mockAddonProvider(name) {
},
getAddonByID(id, callback) {
if (this.hasShutdown) {
this.unsafeAccess = true;
unsafeAccess = true;
}
callback(null);
},

View File

@ -17,7 +17,7 @@ function mockAddonProvider(name) {
},
getAddonByID(id, callback) {
if (!this.hasStarted) {
this.unsafeAccess = true;
unsafeAccess = true;
}
callback(null);
},

View File

@ -109,7 +109,7 @@ add_task(function*() {
do_check_false(addon.seen);
// Updating through the API shouldn't change the state
let install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_2"), resolve));
install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_2"), resolve));
yield promiseCompleteAllInstalls([install]);
do_check_eq(install.state, AddonManager.STATE_INSTALLED);
do_check_false(hasFlag(install.addon.pendingOperations, AddonManager.PENDING_INSTALL));
@ -190,7 +190,7 @@ add_task(function*() {
do_check_true(addon.seen);
// Updating through the API shouldn't change the state
let install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_2"), resolve));
install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_2"), resolve));
yield promiseCompleteAllInstalls([install]);
do_check_eq(install.state, AddonManager.STATE_INSTALLED);
do_check_false(hasFlag(install.addon.pendingOperations, AddonManager.PENDING_INSTALL));

View File

@ -350,7 +350,7 @@ add_task(function* cancelUninstallOfRestartless() {
yield promiseInstallAllFiles([do_get_addon("test_undouninstall1")]);
ensure_test_completed();
let a1 = yield promiseAddonByID(ID);
a1 = yield promiseAddonByID(ID);
do_check_neq(a1, null);
BootstrapMonitor.checkAddonInstalled(ID, "1.0");

View File

@ -52,6 +52,7 @@ function makeCancelListener() {
// Set up the HTTP server so that we can control when it responds
var httpReceived = Promise.defer();
function dataHandler(aRequest, aResponse) {
asyncResponse = aResponse;
aResponse.processAsync();
httpReceived.resolve([aRequest, aResponse]);
}

View File

@ -48,7 +48,7 @@ add_task(function*() {
let uri = do_get_addon_root_uri(profileDir, ID);
let addon = yield promiseAddonByID(ID);
addon = yield promiseAddonByID(ID);
do_check_neq(addon, null);
function check_icons(addon) {

View File

@ -2,7 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var gWindowWatcher = null;
gWindowWatcher = null;
function test() {
Harness.installConfirmCallback = confirm_install;

View File

@ -1,12 +1,13 @@
// Test that having two frames that request installs at the same time doesn't
// cause callback ID conflicts (discussed in bug 926712)
var {Promise} = Cu.import("resource://gre/modules/Promise.jsm");
var gConcurrentTabs = [];
var gQueuedForInstall = [];
var gResults = [];
function frame_script() {
/*globals addMessageListener, sendAsyncMessage*/
addMessageListener("Test:StartInstall", () => {
content.document.getElementById("installnow").click()
});

View File

@ -1,7 +1,7 @@
// ----------------------------------------------------------------------------
// Tests installing an unsigned add-on through a navigation. Should not be
// blocked since the referer is whitelisted.
var url = TESTROOT2 + "navigate.html?" + encodeURIComponent(TESTROOT + "unsigned.xpi");
var URL = TESTROOT2 + "navigate.html?" + encodeURIComponent(TESTROOT + "unsigned.xpi");
function test() {
Harness.installConfirmCallback = confirm_install;
@ -12,7 +12,7 @@ function test() {
pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION);
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(url);
gBrowser.loadURI(URL);
}
function confirm_install(window) {

View File

@ -1,7 +1,7 @@
// ----------------------------------------------------------------------------
// Tests installing an unsigned add-on through a navigation. Should be
// blocked since the referer is not whitelisted even though the target is.
var url = TESTROOT2 + "navigate.html?" + encodeURIComponent(TESTROOT + "unsigned.xpi");
var URL = TESTROOT2 + "navigate.html?" + encodeURIComponent(TESTROOT + "unsigned.xpi");
function test() {
Harness.installBlockedCallback = allow_blocked;
@ -12,7 +12,7 @@ function test() {
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(url);
gBrowser.loadURI(URL);
}
function allow_blocked(installInfo) {

View File

@ -6,7 +6,6 @@
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/*globals InstallTrigger*/
function startInstall() {
var whiteUrl = "https://example.org/";

View File

@ -7,7 +7,6 @@
<meta charset="utf-8">
<title>Concurrent InstallTrigger tests</title>
<script type="text/javascript">
/*globals InstallTrigger*/
function installCallback(url, status) {
document.getElementById("status").textContent = status;

View File

@ -8,7 +8,6 @@
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/*globals InstallTrigger*/
function init() {
document.getElementById("enabled").textContent = InstallTrigger.enabled() ? "true" : "false";
dump("Sending PageLoaded\n");

View File

@ -8,7 +8,6 @@
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/*globals InstallTrigger*/
function startInstall() {
InstallTrigger.installChrome(InstallTrigger.SKIN,
decodeURIComponent(document.location.search.substring(1)),

View File

@ -8,7 +8,6 @@
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/*globals InstallTrigger*/
function installCallback(url, status) {
document.getElementById("status").textContent = status;

View File

@ -8,7 +8,6 @@
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/*globals InstallTrigger*/
function startInstall() {
InstallTrigger.startSoftwareUpdate(decodeURIComponent(document.location.search.substring(1)));
}

View File

@ -8,7 +8,6 @@
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/*globals InstallTrigger*/
function installCallback(url, status) {
document.location = "#foo";