--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -149,17 +149,21 @@ module.exports = {
// Error on newline where a semicolon is needed
"no-unexpected-multiline": "error",
// No unreachable statements
"no-unreachable": "error",
// No declaring variables that are never used
- // "no-unused-vars": ["error", {"vars": "all", "args": "none"}],
+ // "no-unused-vars": ["error", {
+ // "vars": "local",
+ // "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
+ // "args": "none",
+ // }],
// No using variables before defined
// "no-use-before-define": ["error", "nofunc"],
// No using with
"no-with": "error",
// Always require semicolon at end of statement
new file mode 100644
--- /dev/null
+++ b/toolkit/components/.eslintrc.js
@@ -0,0 +1,11 @@
+"use strict";
+
+module.exports = {
+ "rules": {
+ "no-unused-vars": ["error", {
+ "vars": "local",
+ "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
+ "args": "none",
+ }]
+ }
+};
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -1222,17 +1222,17 @@ function fillInTree(aRoot)
let kid = aT._kids[0];
let kidBytes = fillInNonLeafNodes(kid);
aT._unsafeName += '/' + kid._unsafeName;
if (kid._kids) {
aT._kids = kid._kids;
} else {
delete aT._kids;
}
- aT._amount = kid._amount;
+ aT._amount = kidBytes;
aT._description = kid._description;
if (kid._nMerged !== undefined) {
aT._nMerged = kid._nMerged
}
assert(!aT._hideKids && !kid._hideKids, "_hideKids set when merging");
} else {
// Non-leaf node with multiple children. Derive its _amount and
--- a/toolkit/components/aboutperformance/content/aboutPerformance.js
+++ b/toolkit/components/aboutperformance/content/aboutPerformance.js
@@ -564,17 +564,17 @@ var View = {
subset = subset.slice().sort(Delta.revCompare);
let watcherAlerts = null;
if (nature == "addons") {
watcherAlerts = AddonWatcher.alerts;
}
// Grab everything from the DOM before cleaning up
- let eltContainer = this._setupStructure(id);
+ this._setupStructure(id);
// An array of `cachedElements` that need to be added
let toAdd = [];
for (let delta of subset) {
if (!(delta instanceof Delta)) {
throw new TypeError();
}
let cachedElements = this._grabOrCreateElements(delta, nature);
@@ -644,17 +644,16 @@ var View = {
}
eltImpact.textContent = ` ${describeFrequency} ${describeImpact}`;
cachedElements.eltFPS.textContent = `Impact on framerate: ${delta.alerts[1] || 0} high-impacts, ${delta.alerts[0] || 0} medium-impact${jankSuffix}.`;
}
cachedElements.eltRoot.setAttribute("impact", Math.round(impact));
}
- let result = delta.diff.jank.totalCPUTime/delta.diff.deltaT;
cachedElements.eltCPU.textContent = `CPU usage: ${Math.ceil(delta.diff.jank.totalCPUTime/delta.diff.deltaT/10)}% (total ${delta.diff.jank.totalUserTime}ms).`;
cachedElements.eltSystem.textContent = `System usage: ${Math.ceil(delta.diff.jank.totalSystemTime/delta.diff.deltaT/10)}% (total ${delta.diff.jank.totalSystemTime}ms).`;
cachedElements.eltCPOW.textContent = `Blocking process calls: ${Math.ceil(delta.diff.cpow.totalCPOWTime/delta.diff.deltaT/10)}% (total ${delta.diff.cpow.totalCPOWTime}ms).`;
}
}
this._insertElements(toAdd, id);
},
--- a/toolkit/components/aboutperformance/tests/browser/browser_aboutperformance.js
+++ b/toolkit/components/aboutperformance/tests/browser/browser_aboutperformance.js
@@ -63,17 +63,16 @@ function frameScript() {
Services.obs.notifyObservers(null, "test-about:performance-test-driver", JSON.stringify(options));
});
addMessageListener("aboutperformance-test:checkSanity", ({data: options}) => {
let exn = null;
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) {
let elt = eltContainer.querySelector(selector);
if (!elt) {
throw new Error(`No item ${selector}`);
}
--- a/toolkit/components/addoncompat/Prefetcher.jsm
+++ b/toolkit/components/addoncompat/Prefetcher.jsm
@@ -158,17 +158,17 @@ PropertyOp.prototype.addObject = functio
database.cache(this.index, obj, has, propValue);
if (has && !isPrimitive(propValue) && this.outputTable) {
database.add(this.outputTable, propValue);
}
}
PropertyOp.prototype.makeCacheEntry = function(item, cache)
{
- let [index, obj, has, propValue] = item;
+ let [, obj, , propValue] = item;
let desc = { configurable: false, enumerable: true, writable: false, value: propValue };
if (!cache.has(obj)) {
cache.set(obj, new Map());
}
let propMap = cache.get(obj);
propMap.set(this.prop, desc);
@@ -196,17 +196,17 @@ MethodOp.prototype.addObject = function(
database.cache(this.index, obj, result);
if (!isPrimitive(result) && this.outputTable) {
database.add(this.outputTable, result);
}
}
MethodOp.prototype.makeCacheEntry = function(item, cache)
{
- let [index, obj, result] = item;
+ let [, obj, result] = item;
if (!cache.has(obj)) {
cache.set(obj, new Map());
}
let propMap = cache.get(obj);
let fallback = propMap.get(this.method);
let method = this.method;
@@ -251,17 +251,17 @@ CollectionOp.prototype.addObject = funct
if (!isPrimitive(elements[i]) && this.outputTable) {
database.add(this.outputTable, elements[i]);
}
}
}
CollectionOp.prototype.makeCacheEntry = function(item, cache)
{
- let [index, obj, ...elements] = item;
+ let [, obj, ...elements] = item;
if (!cache.has(obj)) {
cache.set(obj, new Map());
}
let propMap = cache.get(obj);
let lenDesc = { configurable: false, enumerable: true, writable: false, value: elements.length };
propMap.set("length", lenDesc);
--- a/toolkit/components/addoncompat/multiprocessShims.js
+++ b/toolkit/components/addoncompat/multiprocessShims.js
@@ -108,17 +108,16 @@ AddonInterpositionService.prototype = {
// When the interface is not known for a method call, this code
// determines the type of the target object.
getObjectTag: function(target) {
if (Cu.isCrossProcessWrapper(target)) {
return Cu.getCrossProcessWrapperTag(target);
}
- const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
if (target instanceof Ci.nsIDOMXULElement) {
if (target.localName == "browser" && target.isRemoteBrowser) {
return "RemoteBrowserElement";
}
if (target.localName == "tabbrowser") {
return "TabBrowserElement";
}
--- a/toolkit/components/alerts/test/test_alerts_requireinteraction.html
+++ b/toolkit/components/alerts/test/test_alerts_requireinteraction.html
@@ -93,17 +93,16 @@ add_task(function* test_require_interact
"first finished",
"third replacement show",
"second replacement finished",
"third replacement finished"
];
var actualSequence = [];
- var sequenceIdx = 0;
function createAlertListener(name, showCallback, finishCallback) {
return (subject, topic, data) => {
if (topic == "alertshow") {
actualSequence.push(name + " show");
if (showCallback) {
showCallback();
}
} else if (topic == "alertfinished") {
--- a/toolkit/components/alerts/test/test_image.html
+++ b/toolkit/components/alerts/test/test_image.html
@@ -46,17 +46,17 @@ function promiseImage(alert, timeout = 0
}
add_task(function* testContext() {
var inUserData = Cc["@mozilla.org/supports-PRInt64;1"]
.createInstance(Ci.nsISupportsPRInt64);
inUserData.data = 123;
var alert = makeAlert(null, imageServerURL + "?f=image.png");
- var [ready, request, userData] = yield promiseImage(alert, 0, inUserData);
+ var [ready, , userData] = yield promiseImage(alert, 0, inUserData);
ok(ready, "Should load requested image");
is(userData.QueryInterface(Ci.nsISupportsPRInt64).data, 123,
"Should pass user data for loaded image");
alert = makeAlert(null, imageServerURL + "?s=404");
[ready, userData] = yield promiseImage(alert, 0, inUserData);
ok(!ready, "Should not load missing image");
is(userData.QueryInterface(Ci.nsISupportsPRInt64).data, 123,
--- a/toolkit/components/asyncshutdown/AsyncShutdown.jsm
+++ b/toolkit/components/asyncshutdown/AsyncShutdown.jsm
@@ -520,17 +520,16 @@ Spinner.prototype = {
get name() {
return this._barrier.client.name;
},
// nsIObserver.observe
observe: function() {
let topic = this._topic;
debug(`Starting phase ${ topic }`);
- let barrier = this._barrier;
Services.obs.removeObserver(this, topic);
let satisfied = false; // |true| once we have satisfied all conditions
let promise;
try {
promise = this._barrier.wait({
warnAfterMS: DELAY_WARNING_MS,
crashAfterMS: DELAY_CRASH_MS
--- a/toolkit/components/autocomplete/tests/unit/test_immediate_search.js
+++ b/toolkit/components/autocomplete/tests/unit/test_immediate_search.js
@@ -30,17 +30,16 @@ AutoCompleteResult.prototype = Object.cr
function run_test() {
run_next_test();
}
/**
* An immediate search should be executed synchronously.
*/
add_test(function test_immediate_search() {
- let immediateResults = ["mozillaTest"];
let inputStr = "moz";
let immediateSearch = new AutoCompleteImmediateSearch(
"immediate", new AutoCompleteResult(["moz-immediate"], 0));
registerAutoCompleteSearch(immediateSearch);
let delayedSearch = new AutoCompleteDelayedSearch(
"delayed", new AutoCompleteResult(["moz-delayed"], 0));
registerAutoCompleteSearch(delayedSearch);
@@ -74,17 +73,16 @@ add_test(function test_immediate_search(
run_next_test();
};
});
/**
* An immediate search should be executed before any delayed search.
*/
add_test(function test_immediate_search_notimeout() {
- let immediateResults = ["mozillaTest"];
let inputStr = "moz";
let immediateSearch = new AutoCompleteImmediateSearch(
"immediate", new AutoCompleteResult(["moz-immediate"], 0));
registerAutoCompleteSearch(immediateSearch);
let delayedSearch = new AutoCompleteDelayedSearch(
"delayed", new AutoCompleteResult(["moz-delayed"], 0));
@@ -119,17 +117,16 @@ add_test(function test_immediate_search_
unregisterAutoCompleteSearch(delayedSearch);
run_next_test();
});
/**
* A delayed search should be executed synchronously with a zero timeout.
*/
add_test(function test_delayed_search_notimeout() {
- let immediateResults = ["mozillaTest"];
let inputStr = "moz";
let delayedSearch = new AutoCompleteDelayedSearch(
"delayed", new AutoCompleteResult(["moz-delayed"], 0));
registerAutoCompleteSearch(delayedSearch);
let controller = Cc["@mozilla.org/autocomplete/controller;1"].
getService(Ci.nsIAutoCompleteController);
--- a/toolkit/components/autocomplete/tests/unit/test_previousResult.js
+++ b/toolkit/components/autocomplete/tests/unit/test_previousResult.js
@@ -238,17 +238,16 @@ function run_test() {
var controller = Components.classes["@mozilla.org/autocomplete/controller;1"].
getService(Components.interfaces.nsIAutoCompleteController);
// Make an AutoCompleteInput that uses our search
// and confirms results on search complete
var input = new AutoCompleteInput([search1.name,
search2.name]);
var numSearchesStarted = 0;
- var previousResult = null;
input.onSearchBegin = function() {
numSearchesStarted++;
};
input.onSearchComplete = function() {
do_check_eq(controller.searchStatus,
Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH);
@@ -274,9 +273,8 @@ function run_test() {
controller.input = input;
// Search is asynchronous, so don't let the test finish immediately
do_test_pending();
controller.startSearch("test");
}
-
--- a/toolkit/components/cookie/content/cookieAcceptDialog.js
+++ b/toolkit/components/cookie/content/cookieAcceptDialog.js
@@ -54,17 +54,16 @@ function onload()
} else {
document.getElementById('disclosureButton').setAttribute("label", hideDetails);
}
document.getElementById('disclosureButton').setAttribute("accesskey", detailsAccessKey);
if ("arguments" in window && window.arguments.length >= 1 && window.arguments[0]) {
try {
params = window.arguments[0].QueryInterface(nsIDialogParamBlock);
- var objects = params.objects;
var cookie = params.objects.queryElementAt(0, nsICookie);
var cookiesFromHost = params.GetInt(nsICookieAcceptDialog.COOKIESFROMHOST);
var messageFormat;
if (params.GetInt(nsICookieAcceptDialog.CHANGINGCOOKIE))
messageFormat = 'permissionToModifyCookie';
else if (cookiesFromHost > 1)
messageFormat = 'permissionToSetAnotherCookie';
--- a/toolkit/components/crashes/CrashManager.jsm
+++ b/toolkit/components/crashes/CrashManager.jsm
@@ -1038,17 +1038,17 @@ CrashStore.prototype = Object.freeze({
/**
* All crashes tracked.
*
* This is an array of CrashRecord.
*/
get crashes() {
let crashes = [];
- for (let [id, crash] of this._data.crashes) {
+ for (let [, crash] of this._data.crashes) {
crashes.push(new CrashRecord(crash));
}
return crashes;
},
/**
* Obtain a particular crash from its ID.
--- a/toolkit/components/crashes/CrashService.js
+++ b/toolkit/components/crashes/CrashService.js
@@ -57,15 +57,15 @@ CrashService.prototype = Object.freeze({
Services.crashmanager.addCrash(processType, crashType, id, new Date());
},
observe: function (subject, topic, data) {
switch (topic) {
case "profile-after-change":
// Side-effect is the singleton is instantiated.
- let m = Services.crashmanager;
+ Services.crashmanager;
break;
}
},
});
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CrashService]);
--- a/toolkit/components/ctypes/tests/unit/test_finalizer_shouldfail.js
+++ b/toolkit/components/ctypes/tests/unit/test_finalizer_shouldfail.js
@@ -108,17 +108,17 @@ function test_double_dispose() {
* Test that nothing (too) bad happens when the finalizer is NULL
*/
function test_null_dispose()
{
let exception;
exception = false;
try {
- let v = ctypes.CDataFinalizer(acquire(0), null_dispose);
+ ctypes.CDataFinalizer(acquire(0), null_dispose);
} catch (x) {
exception = true;
}
do_check_true(exception);
}
/**
* Test that conversion of a disposed/forgotten CDataFinalizer to a C
--- a/toolkit/components/ctypes/tests/unit/test_jsctypes.js
+++ b/toolkit/components/ctypes/tests/unit/test_jsctypes.js
@@ -1432,17 +1432,16 @@ function run_StructType_tests() {
do_check_eq(g_t.toString(), "type " + name);
do_check_eq(g_t.toSource(),
"ctypes.StructType(\"g_t\", [{ \"a\": ctypes.int32_t }, { \"b\": ctypes.double }])");
do_check_true(g_t.ptr === ctypes.PointerType(g_t));
do_check_eq(g_t.array().name, name + "[]");
do_check_eq(g_t.array(5).name, name + "[5]");
- let h_t = ctypes.StructType("h_t", [{ a: ctypes.int32_t }, { b: ctypes.int16_t }]);
let s_t = new ctypes.StructType("s_t", [{ a: ctypes.int32_t }, { b: g_t }, { c: ctypes.int8_t }]);
let fields = [{ a: ctypes.int32_t }, { b: ctypes.int8_t }, { c: g_t }, { d: ctypes.int8_t }];
let t_t = new ctypes.StructType("t_t", fields);
do_check_eq(t_t.fields.length, 4);
do_check_true(t_t.fields[0].a === ctypes.int32_t);
do_check_true(t_t.fields[1].b === ctypes.int8_t);
do_check_true(t_t.fields[2].c === g_t);
@@ -1840,17 +1839,16 @@ function run_FunctionType_tests() {
do_check_throws(function() {
ctypes.FunctionType(ctypes.default_abi, ctypes.int32_t());
}, TypeError);
do_check_throws(function() {
ctypes.FunctionType(ctypes.void_t, ctypes.void_t);
}, Error);
let g_t = ctypes.StructType("g_t", [{ a: ctypes.int32_t }, { b: ctypes.double }]);
- let g = g_t(1, 2);
let f_t = ctypes.FunctionType(ctypes.default_abi, g_t);
let name = "g_t()";
do_check_eq(f_t.name, name);
do_check_eq(f_t.size, undefined);
do_check_true(f_t.abi === ctypes.default_abi);
do_check_true(f_t.returnType === g_t);
do_check_true(f_t.argTypes.length == 0);
@@ -2167,29 +2165,27 @@ function run_cast_tests() {
// Test casting to a type of undefined or larger size.
do_check_throws(function() { ctypes.cast(i, ctypes.void_t); }, TypeError);
do_check_throws(function() { ctypes.cast(i, ctypes.int32_t.array()); }, TypeError);
do_check_throws(function() { ctypes.cast(i, ctypes.int64_t); }, TypeError);
// Test casting between special types.
let g_t = ctypes.StructType("g_t", [{ a: ctypes.int32_t }, { b: ctypes.double }]);
let a_t = ctypes.ArrayType(g_t, 4);
- let p_t = ctypes.PointerType(g_t);
let f_t = ctypes.FunctionType(ctypes.default_abi, ctypes.void_t).ptr;
let a = a_t();
a[0] = { a: 5, b: 7.5 };
let g = ctypes.cast(a, g_t);
do_check_eq(ptrValue(a.address()), ptrValue(g.address()));
do_check_eq(a[0].a, g.a);
let a2 = ctypes.cast(g, g_t.array(1));
do_check_eq(ptrValue(a2.address()), ptrValue(g.address()));
do_check_eq(a2[0].a, g.a);
- let a3 = ctypes.cast(g, g_t.array(0));
let p = g.address();
let ip = ctypes.cast(p, ctypes.int32_t.ptr);
do_check_eq(ptrValue(ip), ptrValue(p));
do_check_eq(ptrValue(ip.address()), ptrValue(p.address()));
do_check_eq(ip.contents, g.a);
let f = f_t(0x5);
@@ -2210,17 +2206,17 @@ function run_void_tests(library) {
if ("winLastError" in ctypes) {
test_void_t = library.declare("test_void_t_stdcall", ctypes.stdcall_abi, ctypes.void_t);
do_check_eq(test_void_t(), undefined);
// Check that WINAPI symbol lookup for a regular stdcall function fails on
// Win32 (it's all the same on Win64 though).
if (ctypes.voidptr_t.size == 4) {
do_check_throws(function() {
- let test_winapi_t = library.declare("test_void_t_stdcall", ctypes.winapi_abi, ctypes.void_t);
+ library.declare("test_void_t_stdcall", ctypes.winapi_abi, ctypes.void_t);
}, Error);
}
}
}
function run_string_tests(library) {
let test_ansi_len = library.declare("test_ansi_len", ctypes.default_abi, ctypes.int32_t, ctypes.char.ptr);
do_check_eq(test_ansi_len(""), 0);
--- a/toolkit/components/downloads/test/unit/test_app_rep.js
+++ b/toolkit/components/downloads/test/unit/test_app_rep.js
@@ -182,18 +182,16 @@ add_test(function test_local_list() {
for (let i = 0; i < gTables[table].length; ++i) {
response += "u:" + gTables[table][i] + "\n";
}
}
do_print("Returning update response: " + response);
return response;
}
gHttpServ.registerPathHandler("/downloads", function(request, response) {
- let buf = NetUtil.readInputStreamToString(request.bodyInputStream,
- request.bodyInputStream.available());
let blob = processUpdateRequest();
response.setHeader("Content-Type",
"application/vnd.google.safebrowsing-update", false);
response.setStatusLine(request.httpVersion, 200, "OK");
response.bodyOutputStream.write(blob, blob.length);
});
let streamUpdater = Cc["@mozilla.org/url-classifier/streamupdater;1"]
--- a/toolkit/components/downloads/test/unit/test_app_rep_maclinux.js
+++ b/toolkit/components/downloads/test/unit/test_app_rep_maclinux.js
@@ -157,18 +157,16 @@ function processUpdateRequest() {
do_print("Returning update response: " + response);
return response;
}
// Set up the local whitelist.
function waitForUpdates() {
let deferred = Promise.defer();
gHttpServer.registerPathHandler("/downloads", function(request, response) {
- let buf = NetUtil.readInputStreamToString(request.bodyInputStream,
- request.bodyInputStream.available());
let blob = processUpdateRequest();
response.setHeader("Content-Type",
"application/vnd.google.safebrowsing-update", false);
response.setStatusLine(request.httpVersion, 200, "OK");
response.bodyOutputStream.write(blob, blob.length);
});
let streamUpdater = Cc["@mozilla.org/url-classifier/streamupdater;1"]
--- a/toolkit/components/downloads/test/unit/test_app_rep_windows.js
+++ b/toolkit/components/downloads/test/unit/test_app_rep_windows.js
@@ -257,18 +257,16 @@ function processUpdateRequest() {
do_print("Returning update response: " + response);
return response;
}
// Set up the local whitelist.
function waitForUpdates() {
let deferred = Promise.defer();
gHttpServer.registerPathHandler("/downloads", function(request, response) {
- let buf = NetUtil.readInputStreamToString(request.bodyInputStream,
- request.bodyInputStream.available());
let blob = processUpdateRequest();
response.setHeader("Content-Type",
"application/vnd.google.safebrowsing-update", false);
response.setStatusLine(request.httpVersion, 200, "OK");
response.bodyOutputStream.write(blob, blob.length);
});
let streamUpdater = Cc["@mozilla.org/url-classifier/streamupdater;1"]
--- a/toolkit/components/feeds/FeedProcessor.js
+++ b/toolkit/components/feeds/FeedProcessor.js
@@ -965,18 +965,16 @@ function ExtensionHandler(processor) {
ExtensionHandler.prototype = {
startDocument: function EH_startDocument() {
},
endDocument: function EH_endDocument() {
},
startElement: function EH_startElement(uri, localName, qName, attrs) {
++this._depth;
- var prefix = gNamespaces[uri] ? gNamespaces[uri] + ":" : "";
- var key = prefix + localName;
if (this._depth == 1) {
this._uri = uri;
this._localName = localName;
this._qName = qName;
this._attrs = attrs;
}
@@ -1493,17 +1491,17 @@ FeedProcessor.prototype = {
},
// end of nsISAXContentHandler
// Handle our more complicated elements--those that contain
// attributes and child elements.
_processComplexElement:
function FP__processComplexElement(elementInfo, attributes) {
- var obj, key, prefix;
+ var obj;
// If the container is an entry/item, it'll need to have its
// more esoteric properties put in the 'fields' property bag.
if (elementInfo.containerClass == Cc[ENTRY_CONTRACTID]) {
obj = elementInfo.containerClass.createInstance(Ci.nsIFeedEntry);
obj.baseURI = this._xmlBaseStack[this._xmlBaseStack.length - 1];
this._mapAttributes(obj.fields, attributes);
}
--- a/toolkit/components/filepicker/content/filepicker.js
+++ b/toolkit/components/filepicker/content/filepicker.js
@@ -656,19 +656,17 @@ function newDir() {
showErrorDialog("errorNewDirDoesExistTitle",
"errorNewDirDoesExistMessage",
file);
return false;
}
var parent = file.parent;
if (!(parent.exists() && parent.isDirectory() && parent.isWritable())) {
- var oldParent = parent;
while (!parent.exists()) {
- oldParent = parent;
parent = parent.parent;
}
if (parent.isFile()) {
showErrorDialog("errorCreateNewDirTitle",
"errorCreateNewDirIsFileMessage",
parent);
return false;
}
--- a/toolkit/components/filepicker/nsFilePicker.js
+++ b/toolkit/components/filepicker/nsFilePicker.js
@@ -265,27 +265,16 @@ nsFilePicker.prototype = {
var appShellService = Components.classes[APPSHELL_SERV_CONTRACTID].getService(nsIAppShellService);
parent = appShellService.hiddenDOMWindow;
} catch (ex) {
debug("Can't get parent. xpconnect hates me so we can't get one from the appShellService.\n");
debug(ex + "\n");
}
}
- var parentWin = null;
- try {
- parentWin = parent.QueryInterface(nsIInterfaceRequestor)
- .getInterface(nsIWebNavigation)
- .QueryInterface(nsIDocShellTreeItem)
- .treeOwner
- .QueryInterface(nsIInterfaceRequestor)
- .getInterface(nsIBaseWindow);
- } catch (ex) {
- dump("file picker couldn't get base window\n"+ex+"\n");
- }
try {
parent.openDialog("chrome://global/content/filepicker.xul",
"",
"chrome,modal,titlebar,resizable=yes,dependent=yes",
o);
this.mFilterIndex = o.retvals.filterIndex;
this.mFilesEnumerator = o.retvals.files;
@@ -323,9 +312,8 @@ function srGetStrBundle(path)
}
strBundle = strBundleService.createBundle(path);
if (!strBundle) {
dump("\n--** strBundle createInstance failed **--\n");
}
return strBundle;
}
-
--- a/toolkit/components/gfx/SanityTest.js
+++ b/toolkit/components/gfx/SanityTest.js
@@ -175,17 +175,16 @@ var listener = {
// Perform the compositor backbuffer test, which currently we use for
// actually deciding whether to enable hardware media decoding.
testCompositor(this.win, this.ctx);
this.endTest();
},
receiveMessage(message) {
- let data = message.data;
switch (message.name) {
case "gfxSanity:ContentLoaded":
this.runSanityTest();
break;
}
},
onWindowLoaded: function() {
@@ -239,17 +238,16 @@ function SanityTest() {}
SanityTest.prototype = {
classID: Components.ID("{f3a8ca4d-4c83-456b-aee2-6a2cbf11e9bd}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference]),
shouldRunTest: function() {
// Only test gfx features if firefox has updated, or if the user has a new
// gpu or drivers.
- var appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
var buildId = Services.appinfo.platformBuildID;
var gfxinfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
if (Preferences.get(RUNNING_PREF, false)) {
Preferences.set(DISABLE_VIDEO_PREF, true);
reportResult(TEST_CRASHED);
return false;
}
--- a/toolkit/components/jsdownloads/test/unit/common_test_Download.js
+++ b/toolkit/components/jsdownloads/test/unit/common_test_Download.js
@@ -2375,21 +2375,21 @@ add_task(function* test_platform_integra
targetFilePath = OS.Path.join(targetFilePath,
"test" + (Math.floor(Math.random() * 1000000)));
let targetFile = new FileUtils.File(targetFilePath);
downloadFiles.push(targetFile);
let download;
if (gUseLegacySaver) {
download = yield promiseStartLegacyDownload(httpUrl("source.txt"),
- { targetFile: targetFile });
+ { isPrivate, targetFile });
}
else {
download = yield Downloads.createDownload({
- source: httpUrl("source.txt"),
+ source: { url: httpUrl("source.txt"), isPrivate },
target: targetFile,
});
download.start().catch(() => {});
}
// Wait for the whenSucceeded promise to be resolved first.
// downloadDone should be called before the whenSucceeded promise is resolved.
yield download.whenSucceeded().then(function () {
--- a/toolkit/components/jsdownloads/test/unit/head.js
+++ b/toolkit/components/jsdownloads/test/unit/head.js
@@ -815,21 +815,16 @@ add_task(function test_common_initialize
// We have to invalidate the previously computed directory path.
this._downloadsDirectory = null;
},
_getDirectory(name) {
return super._getDirectory(this._allowDirectories ? name : "TmpD");
},
}));
- // Get a reference to nsIComponentRegistrar, and ensure that is is freed
- // before the XPCOM shutdown.
- let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
- do_register_cleanup(() => registrar = null);
-
// Make sure that downloads started using nsIExternalHelperAppService are
// saved to disk without asking for a destination interactively.
let mock = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIHelperAppLauncherDialog]),
promptForSaveToFileAsync(aLauncher,
aWindowContext,
aDefaultFileName,
aSuggestedFileExtension,
--- a/toolkit/components/jsdownloads/test/unit/test_DownloadIntegration.js
+++ b/toolkit/components/jsdownloads/test/unit/test_DownloadIntegration.js
@@ -403,17 +403,17 @@ add_task(function* test_suspend_resume()
add_task(function* test_exit_private_browsing()
{
mustInterruptResponses();
let privateList = yield promiseNewList(true);
let download1 = yield promiseNewDownload(httpUrl("source.txt"));
let download2 = yield promiseNewDownload(httpUrl("interruptible.txt"));
let promiseAttempt1 = download1.start();
- let promiseAttempt2 = download2.start();
+ download2.start();
// Add downloads to list.
yield privateList.add(download1);
yield privateList.add(download2);
// Complete the download.
yield promiseAttempt1;
--- a/toolkit/components/jsdownloads/test/unit/test_DownloadStore.js
+++ b/toolkit/components/jsdownloads/test/unit/test_DownloadStore.js
@@ -106,17 +106,17 @@ add_task(function* test_save_reload()
}
});
/**
* Checks that saving an empty list deletes any existing file.
*/
add_task(function* test_save_empty()
{
- let [list, store] = yield promiseNewListAndStore();
+ let [, store] = yield promiseNewListAndStore();
let createdFile = yield OS.File.open(store.path, { create: true });
yield createdFile.close();
yield store.save();
do_check_false(yield OS.File.exists(store.path));
--- a/toolkit/components/mediasniffer/test/unit/test_mediasniffer_ext.js
+++ b/toolkit/components/mediasniffer/test/unit/test_mediasniffer_ext.js
@@ -51,17 +51,17 @@ var listener = {
do_check_eq(request.QueryInterface(Ci.nsIChannel).contentType, tests[testRan].expected);
},
onDataAvailable: function(request, context, stream, offset, count) {
try {
var bis = Components.classes["@mozilla.org/binaryinputstream;1"]
.createInstance(Components.interfaces.nsIBinaryInputStream);
bis.setInputStream(stream);
- var array = bis.readByteArray(bis.available());
+ bis.readByteArray(bis.available());
} catch (ex) {
do_throw("Error in onDataAvailable: " + ex);
}
},
onStopRequest: function(request, context, status) {
testRan++;
runNext();
@@ -83,17 +83,16 @@ function runNext() {
do_test_finished();
return;
}
var channel = setupChannel("/");
channel.asyncOpen2(listener);
}
function getFileContents(aFile) {
- const PR_RDONLY = 0x01;
var fileStream = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
fileStream.init(aFile, 1, -1, null);
var bis = Components.classes["@mozilla.org/binaryinputstream;1"]
.createInstance(Components.interfaces.nsIBinaryInputStream);
bis.setInputStream(fileStream);
var data = bis.readByteArray(bis.available());
--- a/toolkit/components/perfmonitoring/tests/browser/browser_AddonWatcher.js
+++ b/toolkit/components/perfmonitoring/tests/browser/browser_AddonWatcher.js
@@ -36,25 +36,16 @@ add_task(function* init() {
yield ready;
registerCleanupFunction(() => {
info("Uninstalling test add-on");
addon.uninstall()
});
-
- let freezeThreshold = Preferences.get("browser.addon-watch.freeze-threshold-micros", /* 5 seconds */ 5000000);
- let jankThreshold = Preferences.get("browser.addon-watch.jank-threshold-micros", /* 256 ms == 8 frames*/ 256000);
- let occurrencesBetweenAlerts = Preferences.get("browser.addon-watch.occurrences-between-alerts", 3);
- let delayBetweenAlerts = Preferences.get("browser.addon-watch.delay-between-alerts-ms", 6 * 3600 * 1000 /* 6h */);
- let delayBetweenFreezeAlerts = Preferences.get("browser.addon-watch.delay-between-freeze-alerts-ms", 2 * 60 * 1000 /* 2 min */);
- let prescriptionDelay = Preferences.get("browser.addon-watch.prescription-delay", 5 * 60 * 1000 /* 5 minutes */);
- let highestNumberOfAddonsToReport = Preferences.get("browser.addon-watch.max-simultaneous-reports", 1);
-
Preferences.set("browser.addon-watch.warmup-ms", 0);
Preferences.set("browser.addon-watch.freeze-threshold-micros", 0);
Preferences.set("browser.addon-watch.jank-threshold-micros", 0);
Preferences.set("browser.addon-watch.occurrences-between-alerts", 0);
Preferences.set("browser.addon-watch.delay-between-alerts-ms", 0);
Preferences.set("browser.addon-watch.delay-between-freeze-alerts-ms", 0);
Preferences.set("browser.addon-watch.max-simultaneous-reports", 10000);
Preferences.set("browser.addon-watch.deactivate-after-idle-ms", 100000000);
--- a/toolkit/components/perfmonitoring/tests/browser/browser_compartments.js
+++ b/toolkit/components/perfmonitoring/tests/browser/browser_compartments.js
@@ -22,19 +22,16 @@ const PARENT_PID = Services.appinfo.proc
// This function is injected as source as a frameScript
function frameScript() {
try {
"use strict";
const { utils: Cu, classes: Cc, interfaces: Ci } = Components;
Cu.import("resource://gre/modules/PerformanceStats.jsm");
Cu.import("resource://gre/modules/Services.jsm");
- let performanceStatsService =
- Cc["@mozilla.org/toolkit/performance-stats-service;1"].
- getService(Ci.nsIPerformanceStatsService);
// Make sure that the stopwatch is now active.
let monitor = PerformanceStats.getMonitor(["jank", "cpow", "ticks", "compartments"]);
addMessageListener("compartments-test:getStatistics", () => {
try {
monitor.promiseSnapshot().then(snapshot => {
sendAsyncMessage("compartments-test:getStatistics", {snapshot, pid: Services.appinfo.processID});
--- a/toolkit/components/printing/content/printjoboptions.js
+++ b/toolkit/components/printing/content/printjoboptions.js
@@ -130,18 +130,16 @@ paperListElement.prototype =
// ---------------------------------------------------
function createPaperArrayFromDefaults()
{
var paperNames = ["letterSize", "legalSize", "exectiveSize", "a5Size", "a4Size", "a3Size", "a2Size", "a1Size", "a0Size"];
// var paperNames = ["&letterRadio.label;", "&legalRadio.label;", "&exectiveRadio.label;", "&a4Radio.label;", "&a3Radio.label;"];
var paperWidths = [ 8.5, 8.5, 7.25, 148.0, 210.0, 287.0, 420.0, 594.0, 841.0];
var paperHeights = [11.0, 14.0, 10.50, 210.0, 297.0, 420.0, 594.0, 841.0, 1189.0];
var paperInches = [true, true, true, false, false, false, false, false, false];
- // this is deprecated
- var paperEnums = [0, 1, 2, 3, 4, 5, 6, 7, 8];
gPaperArray = new Array();
for (var i=0;i<paperNames.length;i++) {
var obj = {};
obj.name = paperNames[i];
obj.width = paperWidths[i];
obj.height = paperHeights[i];
--- a/toolkit/components/promiseworker/PromiseWorker.jsm
+++ b/toolkit/components/promiseworker/PromiseWorker.jsm
@@ -300,24 +300,22 @@ this.BasePromiseWorker.prototype = {
throw ex;
}
let deferred = Promise.defer();
this._queue.push({deferred:deferred, closure: closure, id: id});
this.log("Message posted");
let reply;
- let isError = false;
try {
this.log("Expecting reply");
reply = yield deferred.promise;
} catch (error) {
this.log("Got error", error);
reply = error;
- isError = true;
if (error instanceof WorkerError) {
// We know how to deserialize most well-known errors
throw this.ExceptionHandlers[error.data.exn](error.data);
}
if (error instanceof ErrorEvent) {
// Other errors get propagated as instances of ErrorEvent
--- a/toolkit/components/prompts/content/selectDialog.js
+++ b/toolkit/components/prompts/content/selectDialog.js
@@ -51,17 +51,16 @@ function dialogOnLoad() {
try {
Cc["@mozilla.org/sound;1"].
createInstance(Ci.nsISound).
playEventSound(Ci.nsISound.EVENT_SELECT_DIALOG_OPEN);
} catch (e) { }
}
function dialogOK() {
- let selected = listBox.selectedIndex;
gArgs.setProperty("selected", listBox.selectedIndex);
gArgs.setProperty("ok", true);
return true;
}
function dialogDoubleClick() {
dialogOK();
window.close();
--- a/toolkit/components/prompts/content/tabprompts.xml
+++ b/toolkit/components/prompts/content/tabprompts.xml
@@ -295,17 +295,16 @@
<body>
<![CDATA[
if (event.defaultPrevented)
return;
event.stopPropagation();
if (action == "default") {
let bnum = this.args.defaultButtonNum || 0;
- let button = this.ui["button" + bnum];
this.onButtonClick(bnum);
} else { // action == "cancel"
this.onButtonClick(1); // Cancel button
}
]]>
</body>
</method>
</implementation>
--- a/toolkit/components/satchel/FormHistory.jsm
+++ b/toolkit/components/satchel/FormHistory.jsm
@@ -777,17 +777,16 @@ this.FormHistory = {
// if no terms selected, select everything
aSelectTerms = (aSelectTerms) ? aSelectTerms : validFields;
validateSearchData(aSearchData, "Search");
let stmt = makeSearchStatement(aSearchData, aSelectTerms);
let handlers = {
handleResult : function(aResultSet) {
- let formHistoryFields = dbSchema.tables.moz_formhistory;
for (let row = aResultSet.getNextRow(); row; row = aResultSet.getNextRow()) {
let result = {};
for (let field of aSelectTerms) {
result[field] = row.getResultByName(field);
}
if (aCallbacks && aCallbacks.handleResult) {
aCallbacks.handleResult(result);
--- a/toolkit/components/satchel/nsFormHistory.js
+++ b/toolkit/components/satchel/nsFormHistory.js
@@ -298,17 +298,17 @@ FormHistory.prototype = {
if (stmt) {
stmt.reset();
}
}
},
entryExists : function entryExists(name, value) {
this.log("entryExists for " + name + "=" + value);
- let [id, guid] = this.getExistingEntryID(name, value);
+ let [id] = this.getExistingEntryID(name, value);
this.log("entryExists: id=" + id);
return (id != -1);
},
removeEntriesByTimeframe : function removeEntriesByTimeframe(beginTime, endTime) {
this.log("removeEntriesByTimeframe for " + beginTime + " to " + endTime);
this.sendIntNotification("before-removeEntriesByTimeframe", beginTime, endTime);
--- a/toolkit/components/satchel/test/test_bug_511615.html
+++ b/toolkit/components/satchel/test/test_bug_511615.html
@@ -69,17 +69,17 @@ function checkSelectedIndexAfterResponse
}).then(popupState => {
is(popupState.open, true, "Popup should still be open.");
is(popupState.selectedIndex, expectedIndex, "Selected index should match.");
});
}
function doKeyUnprivileged(key) {
let keyName = "DOM_VK_" + key.toUpperCase();
- let keycode, charcode, alwaysVal;
+ let keycode, charcode;
if (key.length == 1) {
keycode = 0;
charcode = key.charCodeAt(0);
alwaysval = charcode;
} else {
keycode = KeyEvent[keyName];
if (!keycode)
--- a/toolkit/components/satchel/test/unit/test_notify.js
+++ b/toolkit/components/satchel/test/unit/test_notify.js
@@ -49,18 +49,16 @@ function next_test()
function* run_test_steps() {
try {
var testnum = 0;
var testdesc = "Setup of test form history entries";
var entry1 = ["entry1", "value1"];
-var entry2 = ["entry2", "value2"];
-
/* ========== 1 ========== */
testnum = 1;
testdesc = "Initial connection to storage module"
yield updateEntry("remove", null, null, next_test);
yield countEntries(null, null, function (num) { do_check_false(num, "Checking initial DB is empty"); next_test(); });
--- a/toolkit/components/search/tests/xpcshell/head_search.js
+++ b/toolkit/components/search/tests/xpcshell/head_search.js
@@ -54,18 +54,16 @@ function dumpn(text)
}
/**
* Configure preferences to load engines from
* chrome://testsearchplugin/locale/searchplugins/
*/
function configureToLoadJarEngines()
{
- let defaultBranch = Services.prefs.getDefaultBranch(null);
-
let url = "chrome://testsearchplugin/locale/searchplugins/";
let resProt = Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
resProt.setSubstitution("search-plugins",
Services.io.newURI(url, null, null));
// Ensure a test engine exists in the app dir anyway.
let dir = Services.dirsvc.get(NS_APP_SEARCH_DIR, Ci.nsIFile);
--- a/toolkit/components/search/tests/xpcshell/test_identifiers.js
+++ b/toolkit/components/search/tests/xpcshell/test_identifiers.js
@@ -26,17 +26,17 @@ add_test(function test_identifier() {
engineFile.append("searchplugins");
engineFile.append("test-search-engine.xml");
engineFile.parent.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
// Copy the test engine to the test profile.
let engineTemplateFile = do_get_file("data/engine.xml");
engineTemplateFile.copyTo(engineFile.parent, "test-search-engine.xml");
- let search = Services.search.init(function initComplete(aResult) {
+ Services.search.init(function initComplete(aResult) {
do_print("init'd search service");
do_check_true(Components.isSuccessCode(aResult));
let profileEngine = Services.search.getEngineByName("Test search engine");
let jarEngine = Services.search.getEngineByName("bug645970");
do_check_true(profileEngine instanceof Ci.nsISearchEngine);
do_check_true(jarEngine instanceof Ci.nsISearchEngine);
--- a/toolkit/components/search/tests/xpcshell/test_json_cache.js
+++ b/toolkit/components/search/tests/xpcshell/test_json_cache.js
@@ -53,17 +53,16 @@ function run_test() {
let engineTemplateFile = do_get_file("data/engine.xml");
engineTemplateFile.copyTo(engineFile.parent, "test-search-engine.xml");
// The list of visibleDefaultEngines needs to match or the cache will be ignored.
let chan = NetUtil.newChannel({
uri: "resource://search-plugins/list.json",
loadUsingSystemPrincipal: true
});
- let visibleDefaultEngines = [];
let sis = Cc["@mozilla.org/scriptableinputstream;1"].
createInstance(Ci.nsIScriptableInputStream);
sis.init(chan.open2());
let list = sis.read(sis.available());
let searchSettings = JSON.parse(list);
cacheTemplate.visibleDefaultEngines = searchSettings["default"]["visibleDefaultEngines"];
@@ -78,17 +77,17 @@ add_test(function prepare_test_data() {
});
/**
* Start the search service and confirm the engine properties match the expected values.
*/
add_test(function test_cached_engine_properties() {
do_print("init search service");
- let search = Services.search.init(function initComplete(aResult) {
+ Services.search.init(function initComplete(aResult) {
do_print("init'd search service");
do_check_true(Components.isSuccessCode(aResult));
let engines = Services.search.getEngines({});
let engine = engines[0];
do_check_true(engine instanceof Ci.nsISearchEngine);
isSubObjectOf(EXPECTED_ENGINE.engine, engine);
--- a/toolkit/components/search/tests/xpcshell/test_location_sync.js
+++ b/toolkit/components/search/tests/xpcshell/test_location_sync.js
@@ -50,17 +50,17 @@ add_task(function* test_simple() {
ok(!Services.search.isInitialized);
// setup a console listener for the timezone fallback message.
let promiseTzMessage = promiseTimezoneMessage();
// fetching the engines forces a sync init, and should have caused us to
// check the timezone.
- let engines = Services.search.getEngines();
+ Services.search.getEngines();
ok(Services.search.isInitialized);
// a little wait to check we didn't do the xhr thang.
yield new Promise(resolve => {
do_timeout(500, resolve);
});
let msg = yield promiseTzMessage;
--- a/toolkit/components/search/tests/xpcshell/test_sync_migration.js
+++ b/toolkit/components/search/tests/xpcshell/test_sync_migration.js
@@ -10,17 +10,17 @@ function run_test() {
do_get_file("data/metadata.json").copyTo(gProfD, "search-metadata.json");
run_next_test();
}
add_task(function* test_sync_metadata_migration() {
do_check_false(Services.search.isInitialized);
- let engines = Services.search.getEngines();
+ Services.search.getEngines();
do_check_true(Services.search.isInitialized);
yield promiseAfterCache();
// Check that the entries are placed as specified correctly
let metadata = yield promiseEngineMetadata();
do_check_eq(metadata["engine"].order, 1);
do_check_eq(metadata["engine"].alias, "foo");
--- a/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js
+++ b/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js
@@ -80,17 +80,17 @@ add_task(function*() {
Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, true);
yield TelemetryController.testSetup();
if (runningInParent) {
// Make sure we don't generate unexpected pings due to pref changes.
yield setEmptyPrefWatchlist();
}
// Run test in child, don't wait for it to finish.
- let childPromise = run_test_in_child("test_ChildHistograms.js");
+ run_test_in_child("test_ChildHistograms.js");
yield do_await_remote_message(MESSAGE_CHILD_TEST_DONE);
yield ContentTaskUtils.waitForCondition(() => {
let payload = TelemetrySession.getPayload("test-ping");
return payload &&
"processes" in payload &&
"content" in payload.processes &&
"histograms" in payload.processes.content &&
--- a/toolkit/components/telemetry/tests/unit/test_PingAPI.js
+++ b/toolkit/components/telemetry/tests/unit/test_PingAPI.js
@@ -101,17 +101,16 @@ add_task(function* test_archivedPings()
id: data.id,
type: data.type,
timestampCreated: data.dateCreated.getTime(),
});
Assert.deepEqual(list, expectedPingList, "Archived ping list should contain submitted pings");
}
// Check loading the archived pings.
- let ids = PINGS.map(p => p.id);
let checkLoadingPings = Task.async(function*() {
for (let data of PINGS) {
let ping = yield TelemetryArchive.promiseArchivedPingById(data.id);
Assert.equal(ping.id, data.id, "Archived ping should have matching id");
Assert.equal(ping.type, data.type, "Archived ping should have matching type");
Assert.equal(ping.creationDate, data.dateCreated.toISOString(),
"Archived ping should have matching creation date");
}
@@ -258,17 +257,17 @@ add_task(function* test_archiveCleanup()
// We expect all the pings we archived to be in this histogram.
h = Telemetry.getHistogramById("TELEMETRY_ARCHIVE_SESSION_PING_COUNT");
Assert.equal(h.snapshot().sum, 22, "All the pings must be live-accumulated in the histogram.");
// Reset the histogram that will be populated by the archive scan.
Telemetry.getHistogramById("TELEMETRY_ARCHIVE_EVICTED_OLD_DIRS").clear();
Telemetry.getHistogramById("TELEMETRY_ARCHIVE_OLDEST_DIRECTORY_AGE").clear();
// Move the current date 60 days ahead of the first ping.
- let now = fakeNow(futureDate(firstDate, 60 * MILLISECONDS_PER_DAY));
+ fakeNow(futureDate(firstDate, 60 * MILLISECONDS_PER_DAY));
// Reset TelemetryArchive and TelemetryController to start the startup cleanup.
yield TelemetryController.testReset();
// Wait for the cleanup to finish.
yield TelemetryStorage.testCleanupTaskPromise();
// Then scan the archived dir.
yield TelemetryArchive.promiseArchivedPingList();
// Check that the archive is in the correct state.
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryController.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryController.js
@@ -282,19 +282,16 @@ add_task(function* test_pingHasEnvironme
// Test a field in the environment build section.
Assert.equal(ping.application.buildId, ping.environment.build.buildId);
// Test that we have the correct clientId.
Assert.equal(ping.clientId, gClientID, "The correct clientId must be reported.");
});
add_task(function* test_archivePings() {
- const ARCHIVE_PATH =
- OS.Path.join(OS.Constants.Path.profileDir, "datareporting", "archived");
-
let now = new Date(2009, 10, 18, 12, 0, 0);
fakeNow(now);
// Disable ping upload so that pings don't get sent.
// With unified telemetry the FHR upload pref controls this,
// with non-unified telemetry the Telemetry enabled pref.
const isUnified = Preferences.get(PREF_UNIFIED, false);
const uploadPref = isUnified ? PREF_FHR_UPLOAD_ENABLED : PREF_ENABLED;
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
@@ -939,17 +939,16 @@ add_task(function* test_prefWatch_prefRe
});
add_task(function* test_addonsWatch_InterestingChange() {
const ADDON_INSTALL_URL = gDataRoot + "restartless.xpi";
const ADDON_ID = "tel-restartless-xpi@tests.mozilla.org";
// We only expect a single notification for each install, uninstall, enable, disable.
const EXPECTED_NOTIFICATIONS = 4;
- let deferred = PromiseUtils.defer();
let receivedNotifications = 0;
let registerCheckpointPromise = (aExpected) => {
return new Promise(resolve => TelemetryEnvironment.registerChangeListener(
"testWatchAddons_Changes" + aExpected, (reason, data) => {
Assert.equal(reason, "addons-changed");
receivedNotifications++;
resolve();
@@ -1261,17 +1260,16 @@ add_task(function* test_collectionWithbr
foreignInstall: false,
hasBinaryComponents: false,
installDay: ADDON_INSTALL_DATE,
updateDay: ADDON_INSTALL_DATE,
signedState: mozinfo.addon_signing ? AddonManager.SIGNEDSTATE_MISSING :
AddonManager.SIGNEDSTATE_NOT_REQUIRED,
};
- let deferred = PromiseUtils.defer();
let receivedNotifications = 0;
let registerCheckpointPromise = (aExpected) => {
return new Promise(resolve => TelemetryEnvironment.registerChangeListener(
"testBrokenAddon_collection" + aExpected, (reason, data) => {
Assert.equal(reason, "addons-changed");
receivedNotifications++;
resolve();
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js
@@ -187,17 +187,17 @@ add_task(function* test_userNotifiedOfCu
// Forcing a policy version should not automatically make the user notified.
Preferences.set(PREF_ACCEPTED_POLICY_VERSION,
TelemetryReportingPolicy.DEFAULT_DATAREPORTING_POLICY_VERSION);
Assert.ok(!TelemetryReportingPolicy.testIsUserNotified(),
"The default state of the date should have a time of 0 and it should therefore fail");
// Showing the notification bar should make the user notified.
- let now = fakeNow(2012, 11, 11);
+ fakeNow(2012, 11, 11);
TelemetryReportingPolicy.testInfobarShown();
Assert.ok(TelemetryReportingPolicy.testIsUserNotified(),
"Using the proper API causes user notification to report as true.");
// It is assumed that later versions of the policy will incorporate previous
// ones, therefore this should also return true.
let newVersion =
Preferences.get(PREF_CURRENT_POLICY_VERSION, 1) + 1;
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
@@ -172,17 +172,17 @@ add_task(function* test_sendPendingPings
Assert.equal(countByType.get(TEST_TYPE_A), 5, "Should have received the correct amount of type A pings");
yield TelemetrySend.testWaitOnOutgoingPings();
PingServer.resetPingHandler();
});
add_task(function* test_sendDateHeader() {
- let now = fakeNow(new Date(Date.UTC(2011, 1, 1, 11, 0, 0)));
+ fakeNow(new Date(Date.UTC(2011, 1, 1, 11, 0, 0)));
yield TelemetrySend.reset();
let pingId = yield TelemetryController.submitExternalPing("test-send-date-header", {});
let req = yield PingServer.promiseNextRequest();
let ping = decodeRequestPayload(req);
Assert.equal(req.getHeader("Date"), "Tue, 01 Feb 2011 11:00:00 GMT",
"Telemetry should send the correct Date header with requests.");
Assert.equal(ping.id, pingId, "Should have received the correct ping id.");
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js
@@ -173,17 +173,17 @@ add_task(function* setupEnvironment() {
yield TelemetryStorage.testClearPendingPings();
});
/**
* Test that really recent pings are sent on Telemetry initialization.
*/
add_task(function* test_recent_pings_sent() {
let pingTypes = [{ num: RECENT_PINGS }];
- let recentPings = yield createSavedPings(pingTypes);
+ yield createSavedPings(pingTypes);
yield TelemetryController.testReset();
yield TelemetrySend.testWaitOnOutgoingPings();
assertReceivedPings(RECENT_PINGS);
yield TelemetryStorage.testClearPendingPings();
});
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
@@ -1099,19 +1099,16 @@ add_task(function* test_dailyOverdue() {
});
add_task(function* test_environmentChange() {
if (gIsAndroid) {
// We don't split subsessions on environment changes yet on Android.
return;
}
- let timerCallback = null;
- let timerDelay = null;
-
yield TelemetryStorage.testClearPendingPings();
PingServer.clearRequests();
let now = fakeNow(2040, 1, 1, 12, 0, 0);
gMonotonicNow = fakeMonotonicNow(gMonotonicNow + 10 * MILLISECONDS_PER_MINUTE);
const PREF_TEST = "toolkit.telemetry.test.pref1";
Preferences.reset(PREF_TEST);
@@ -1240,18 +1237,18 @@ add_task(function* test_savedSessionData
// Start TelemetrySession so that it loads the session data file.
yield TelemetryController.testReset();
Assert.equal(0, getSnapshot("TELEMETRY_SESSIONDATA_FAILED_LOAD").sum);
Assert.equal(0, getSnapshot("TELEMETRY_SESSIONDATA_FAILED_PARSE").sum);
Assert.equal(0, getSnapshot("TELEMETRY_SESSIONDATA_FAILED_VALIDATION").sum);
// Watch a test preference, trigger and environment change and wait for it to propagate.
// _watchPreferences triggers a subsession notification
- let now = fakeNow(new Date(2050, 1, 1, 12, 0, 0));
gMonotonicNow = fakeMonotonicNow(gMonotonicNow + 10 * MILLISECONDS_PER_MINUTE);
+ fakeNow(new Date(2050, 1, 1, 12, 0, 0));
TelemetryEnvironment.testWatchPreferences(PREFS_TO_WATCH);
let changePromise = new Promise(resolve =>
TelemetryEnvironment.registerChangeListener("test_fake_change", resolve));
Preferences.set(PREF_TEST, 1);
yield changePromise;
TelemetryEnvironment.unregisterChangeListener("test_fake_change");
let payload = TelemetrySession.getPayload();
@@ -1463,17 +1460,17 @@ add_task(function* test_abortedSession_S
// Fake scheduler functions to control aborted-session flow in tests.
fakeSchedulerTimer(callback => schedulerTickCallback = callback, () => {});
yield TelemetryController.testReset();
Assert.ok((yield OS.File.exists(DATAREPORTING_PATH)),
"Telemetry must create the aborted session directory when starting.");
// Fake now again so that the scheduled aborted-session save takes place.
- now = fakeNow(futureDate(now, ABORTED_SESSION_UPDATE_INTERVAL_MS));
+ fakeNow(futureDate(now, ABORTED_SESSION_UPDATE_INTERVAL_MS));
// The first aborted session checkpoint must take place right after the initialisation.
Assert.ok(!!schedulerTickCallback);
// Execute one scheduler tick.
yield schedulerTickCallback();
// Check that the aborted session is due at the correct time.
Assert.ok((yield OS.File.exists(ABORTED_FILE)), "There must be an aborted session ping.");
// Remove the aborted session file and then shut down to make sure exceptions (e.g file
@@ -1614,17 +1611,17 @@ add_task(function* test_schedulerEnviron
let nowDate = fakeNow(2060, 10, 18, 0, 0, 0);
gMonotonicNow = fakeMonotonicNow(gMonotonicNow + 10 * MILLISECONDS_PER_MINUTE);
let schedulerTickCallback = null;
fakeSchedulerTimer(callback => schedulerTickCallback = callback, () => {});
yield TelemetryController.testReset();
TelemetryEnvironment.testWatchPreferences(PREFS_TO_WATCH);
// Set the current time at midnight.
- let future = fakeNow(futureDate(nowDate, MS_IN_ONE_DAY));
+ fakeNow(futureDate(nowDate, MS_IN_ONE_DAY));
gMonotonicNow = fakeMonotonicNow(gMonotonicNow + 10 * MILLISECONDS_PER_MINUTE);
// Trigger the environment change.
Preferences.set(PREF_TEST, 1);
// Wait for the environment-changed ping.
yield PingServer.promiseNextPing();
@@ -1901,17 +1898,17 @@ add_task(function* test_changeThrottling
// Set the Environment preferences to watch.
TelemetryEnvironment.testWatchPreferences(PREFS_TO_WATCH);
// The first pref change should not trigger a notification.
Preferences.set(PREF_TEST, 1);
Assert.equal(getSubsessionCount(), 1);
// We should get a change notification after the 5min throttling interval.
- now = fakeNow(futureDate(now, 5 * MILLISECONDS_PER_MINUTE + 1));
+ fakeNow(futureDate(now, 5 * MILLISECONDS_PER_MINUTE + 1));
gMonotonicNow = fakeMonotonicNow(gMonotonicNow + 5 * MILLISECONDS_PER_MINUTE + 1);
Preferences.set(PREF_TEST, 2);
Assert.equal(getSubsessionCount(), 2);
// After that, changes should be throttled again.
now = fakeNow(futureDate(now, 1 * MILLISECONDS_PER_MINUTE));
gMonotonicNow = fakeMonotonicNow(gMonotonicNow + 1 * MILLISECONDS_PER_MINUTE);
Preferences.set(PREF_TEST, 3);
--- a/toolkit/components/telemetry/tests/unit/test_nsITelemetry.js
+++ b/toolkit/components/telemetry/tests/unit/test_nsITelemetry.js
@@ -140,20 +140,18 @@ add_task(function* test_noSerialization(
do_check_false("NEWTAB_PAGE_PINNED_SITES_COUNT" in Telemetry.histogramSnapshots);
});
add_task(function* test_boolean_histogram() {
var h = Telemetry.getHistogramById("TELEMETRY_TEST_BOOLEAN");
var r = h.snapshot().ranges;
// boolean histograms ignore numeric parameters
do_check_eq(uneval(r), uneval([0, 1, 2]))
- var sum = 0
for (var i=0;i<r.length;i++) {
var v = r[i];
- sum += v;
h.add(v);
}
h.add(true);
h.add(false);
var s = h.snapshot();
do_check_eq(s.histogram_type, Telemetry.HISTOGRAM_BOOLEAN);
// last bucket should always be 0 since .add parameters are normalized to either 0 or 1
do_check_eq(s.counts[2], 0);
--- a/toolkit/components/thumbnails/PageThumbs.jsm
+++ b/toolkit/components/thumbnails/PageThumbs.jsm
@@ -847,17 +847,16 @@ var PageThumbsExpiration = {
if (typeof filter == "function")
filter(filterCallback)
else
filter.filterForThumbnailExpiration(filterCallback);
}
},
expireThumbnails: function Expiration_expireThumbnails(aURLsToKeep) {
- let path = this.path;
let keep = aURLsToKeep.map(url => PageThumbsStorage.getLeafNameForURL(url));
let msg = [
PageThumbsStorage.path,
keep,
EXPIRATION_MIN_CHUNK_SIZE
];
return PageThumbsWorker.post(
--- a/toolkit/components/thumbnails/test/browser_thumbnails_storage_migrate3.js
+++ b/toolkit/components/thumbnails/test/browser_thumbnails_storage_migrate3.js
@@ -17,24 +17,20 @@ XPCOMUtils.defineLazyServiceGetter(this,
"@mozilla.org/file/directory_service;1", "nsIProperties");
/**
* This test makes sure we correctly migrate to thumbnail storage version 3.
* This means copying existing thumbnails from the roaming to the local profile
* directory and should just apply to Linux.
*/
function* runTests() {
- let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
- .getService(Ci.nsIProperties);
-
// Prepare a local profile directory.
let localProfile = FileUtils.getDir("ProfD", ["local-test"], true);
changeLocation("ProfLD", localProfile);
- let local = FileUtils.getDir("ProfLD", [THUMBNAIL_DIRECTORY], true);
let roaming = FileUtils.getDir("ProfD", [THUMBNAIL_DIRECTORY], true);
// Set up some data in the roaming profile.
let name = PageThumbsStorage.getLeafNameForURL(URL);
let file = FileUtils.getFile("ProfD", [THUMBNAIL_DIRECTORY, name]);
writeDummyFile(file);
name = PageThumbsStorage.getLeafNameForURL(URL2);
--- a/toolkit/components/tooltiptext/tests/browser_bug581947.js
+++ b/toolkit/components/tooltiptext/tests/browser_bug581947.js
@@ -1,11 +1,10 @@
function check(aBrowser, aElementName, aBarred, aType) {
return ContentTask.spawn(aBrowser, [aElementName, aBarred, aType], function*([aElementName, aBarred, aType]) {
- let doc = content.document;
let e = content.document.createElement(aElementName);
let contentElement = content.document.getElementById('content');
contentElement.appendChild(e);
if (aType) {
e.type = aType;
}
@@ -34,17 +33,16 @@ function check(aBrowser, aElementName, a
contentElement.removeAttribute('novalidate');
e.remove();
});
}
function todo_check(aBrowser, aElementName, aBarred) {
return ContentTask.spawn(aBrowser, [aElementName, aBarred], function*([aElementName, aBarred]) {
- let doc = content.document;
let e = content.document.createElement(aElementName);
let contentElement = content.document.getElementById('content');
contentElement.appendChild(e);
let caught = false;
try {
e.setCustomValidity('foo');
} catch (e) {
@@ -82,9 +80,8 @@ add_task(function*() {
[ 'keygen', 'false' ],
];
for (let data of todo_testData) {
yield todo_check(browser, data[0], data[1]);
}
});
});
-
--- a/toolkit/components/viewsource/content/viewSource-content.js
+++ b/toolkit/components/viewsource/content/viewSource-content.js
@@ -232,18 +232,18 @@ var ViewSourceContent = {
.currentDescriptor;
} catch (e) {
// We couldn't get the page descriptor, so we'll probably end up re-retrieving
// this document off of the network.
}
let utils = requestor.getInterface(Ci.nsIDOMWindowUtils);
let doc = contentWindow.document;
- let forcedCharSet = utils.docCharsetIsForced ? doc.characterSet
- : null;
+ forcedCharSet = utils.docCharsetIsForced ? doc.characterSet
+ : null;
}
this.loadSource(URL, pageDescriptor, lineNumber, forcedCharSet);
},
/**
* Called when the parent is using the deprecated API for viewSource.xul.
* This function will throw if it's called on a remote browser.
@@ -284,17 +284,16 @@ var ViewSourceContent = {
* @param lineNumber (optional)
* The line number to focus as soon as the source has finished
* loading.
* @param forcedCharSet (optional)
* The document character set to use instead of the default one.
*/
loadSource(URL, pageDescriptor, lineNumber, forcedCharSet) {
const viewSrcURL = "view-source:" + URL;
- let loadFromURL = false;
if (forcedCharSet) {
docShell.charset = forcedCharSet;
}
if (lineNumber && lineNumber > 0) {
let doneLoading = (event) => {
// Ignore possible initial load of about:blank
--- a/toolkit/components/viewsource/content/viewSourceUtils.js
+++ b/toolkit/components/viewsource/content/viewSourceUtils.js
@@ -122,17 +122,16 @@ var gViewSourceUtils = {
let browserToOpenIn = aGetBrowserFn ? aGetBrowserFn() : null;
if (browserToOpenIn) {
let viewSourceBrowser = new ViewSourceBrowser(browserToOpenIn);
viewSourceBrowser.loadViewSourceFromSelection(message.data.uri, message.data.drawSelection,
message.data.baseURI);
}
else {
- let docUrl = null;
window.openDialog("chrome://global/content/viewPartialSource.xul",
"_blank", "all,dialog=no",
{
URI: message.data.uri,
drawSelection: message.data.drawSelection,
baseURI: message.data.baseURI,
partial: true,
});
--- a/toolkit/components/viewsource/test/browser/browser_gotoline.js
+++ b/toolkit/components/viewsource/test/browser/browser_gotoline.js
@@ -14,17 +14,16 @@ add_task(function*() {
win = yield loadViewSourceWindow("data:text/plain," + encodeURIComponent(content));
yield checkViewSource(win);
yield BrowserTestUtils.closeWindow(win);
});
var checkViewSource = Task.async(function* (aWindow) {
is(aWindow.gBrowser.contentDocument.body.textContent, content, "Correct content loaded");
- let selection = aWindow.gBrowser.contentWindow.getSelection();
let statusPanel = aWindow.document.getElementById("statusbar-line-col");
is(statusPanel.getAttribute("label"), "", "Correct status bar text");
for (let i = 1; i <= 3; i++) {
aWindow.viewSourceChrome.goToLine(i);
yield ContentTask.spawn(aWindow.gBrowser, i, function*(i) {
let selection = content.getSelection();
Assert.equal(selection.toString(), "line " + i, "Correct text selected");
--- a/toolkit/components/workerloader/require.js
+++ b/toolkit/components/workerloader/require.js
@@ -116,18 +116,16 @@
// Make module available immediately
// (necessary in case of circular dependencies)
if (modules.has(path)) {
return modules.get(path).exports;
}
modules.set(path, module);
- let name = ":" + path;
- let objectURL;
try {
// Load source of module, synchronously
let xhr = new XMLHttpRequest();
xhr.open("GET", uri, false);
xhr.responseType = "text";
xhr.send();