--- a/browser/base/content/test/general/browser_aboutAccounts.js
+++ b/browser/base/content/test/general/browser_aboutAccounts.js
@@ -402,22 +402,22 @@ var gTests = [
},
]; // gTests
function test()
{
waitForExplicitFinish();
Task.spawn(function* () {
- for (let test of gTests) {
- info(test.desc);
+ for (let testCase of gTests) {
+ info(testCase.desc);
try {
- yield test.run();
+ yield testCase.run();
} finally {
- yield test.teardown();
+ yield testCase.teardown();
}
}
finish();
});
}
function promiseOneMessage(tab, messageName) {
--- a/browser/base/content/test/general/browser_aboutHealthReport.js
+++ b/browser/base/content/test/general/browser_aboutHealthReport.js
@@ -99,23 +99,23 @@ var gTests = [
function test()
{
waitForExplicitFinish();
// xxxmpc leaving this here until we resolve bug 854038 and bug 854060
requestLongerTimeout(10);
Task.spawn(function* () {
- for (let test of gTests) {
- info(test.desc);
- yield test.setup();
+ for (let testCase of gTests) {
+ info(testCase.desc);
+ yield testCase.setup();
let iframe = yield promiseNewTabLoadEvent("about:healthreport");
- yield test.run(iframe);
+ yield testCase.run(iframe);
gBrowser.removeCurrentTab();
}
finish();
});
}
--- a/browser/base/content/test/general/browser_audioTabIcon.js
+++ b/browser/base/content/test/general/browser_audioTabIcon.js
@@ -312,22 +312,22 @@ function* test_browser_swapping(tab, bro
// Now, test swapping with a muted but not playing tab.
// Note that the tab remains muted, so we only need to pause playback.
tab = gBrowser.getTabForBrowser(newBrowser);
yield pause(tab);
yield BrowserTestUtils.withNewTab({
gBrowser,
url: "about:blank",
- }, newBrowser => test_swapped_browser_while_not_playing(tab, newBrowser));
+ }, secondAboutBlankBrowser => test_swapped_browser_while_not_playing(tab, secondAboutBlankBrowser));
});
}
function* test_click_on_pinned_tab_after_mute() {
- function* test_on_browser(browser) {
+ function* taskFn(browser) {
let tab = gBrowser.getTabForBrowser(browser);
gBrowser.selectedTab = originallySelectedTab;
isnot(tab, gBrowser.selectedTab, "Sanity check, the tab should not be selected!");
// Steps to reproduce the bug:
// Pin the tab.
gBrowser.pinTab(tab);
@@ -356,22 +356,22 @@ function* test_click_on_pinned_tab_after
gBrowser.selectedTab = originallySelectedTab;
}
let originallySelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.withNewTab({
gBrowser,
url: PAGE
- }, test_on_browser);
+ }, taskFn);
}
// This test only does something useful in e10s!
function* test_cross_process_load() {
- function* test_on_browser(browser) {
+ function* taskFn(browser) {
let tab = gBrowser.getTabForBrowser(browser);
// Start playback and wait for it to finish.
yield play(tab);
let soundPlayingStoppedPromise = BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false,
event => event.detail.changed.includes("soundplaying")
);
@@ -384,29 +384,29 @@ function* test_cross_process_load() {
ok(!tab.hasAttribute("soundplaying"), "Tab should not be playing sound any more");
ok(!tab.soundPlaying, "Tab should not be playing sound any more");
}
yield BrowserTestUtils.withNewTab({
gBrowser,
url: PAGE
- }, test_on_browser);
+ }, taskFn);
}
function* test_mute_keybinding() {
function* test_muting_using_keyboard(tab) {
let mutedPromise = get_wait_for_mute_promise(tab, true);
EventUtils.synthesizeKey("m", {ctrlKey: true});
yield mutedPromise;
mutedPromise = get_wait_for_mute_promise(tab, false);
EventUtils.synthesizeKey("m", {ctrlKey: true});
yield mutedPromise;
}
- function* test_on_browser(browser) {
+ function* taskFn(browser) {
let tab = gBrowser.getTabForBrowser(browser);
// Make sure it's possible to mute before the tab is playing.
yield test_muting_using_keyboard(tab);
// Start playback and wait for it to finish.
yield play(tab);
@@ -429,17 +429,17 @@ function* test_mute_keybinding() {
yield test_muting_using_keyboard(tab);
gBrowser.unpinTab(tab);
}
yield BrowserTestUtils.withNewTab({
gBrowser,
url: PAGE
- }, test_on_browser);
+ }, taskFn);
}
function* test_on_browser(browser) {
let tab = gBrowser.getTabForBrowser(browser);
// Test the icon in a normal tab.
yield test_playing_icon_on_tab(tab, browser, false);
@@ -457,31 +457,31 @@ function* test_on_browser(browser) {
url: "data:text/html,test"
}, () => test_on_browser(browser));
} else {
yield test_browser_swapping(tab, browser);
}
}
function* test_delayed_tabattr_removal() {
- function* test_on_browser(browser) {
+ function* taskFn(browser) {
let tab = gBrowser.getTabForBrowser(browser);
yield play(tab);
// Extend the delay to guarantee the soundplaying attribute
// is not removed from the tab when audio is stopped. Without
// the extended delay the attribute could be removed in the
// same tick and the test wouldn't catch that this broke.
yield pause(tab, {extendedDelay: true});
}
yield BrowserTestUtils.withNewTab({
gBrowser,
url: PAGE
- }, test_on_browser);
+ }, taskFn);
}
add_task(function*() {
yield new Promise((resolve) => {
SpecialPowers.pushPrefEnv({"set": [
["browser.tabs.showAudioPlayingIcon", true],
]}, resolve);
});
--- a/browser/base/content/test/general/browser_bug1297539.js
+++ b/browser/base/content/test/general/browser_bug1297539.js
@@ -37,21 +37,21 @@ function getTransferableFromClipboard(as
return trans;
}
function* cutCurrentSelection(elementQueryString, property, browser) {
// Cut the current selection.
yield BrowserTestUtils.synthesizeKey("x", {accelKey: true}, browser);
// The editor should be empty after cut.
- yield ContentTask.spawn(browser, {elementQueryString, property},
- function* ({elementQueryString, property}) {
- let element = content.document.querySelector(elementQueryString);
- is(element[property], "",
- `${elementQueryString} should be empty after cut (superkey + x)`);
+ yield ContentTask.spawn(browser, [elementQueryString, property],
+ function* ([contentElementQueryString, contentProperty]) {
+ let element = content.document.querySelector(contentElementQueryString);
+ is(element[contentProperty], "",
+ `${contentElementQueryString} should be empty after cut (superkey + x)`);
});
}
// Test that you are able to pasteTransferable for plain text
// which is handled by TextEditor::PasteTransferable to paste into the editor.
add_task(function* test_paste_transferable_plain_text()
{
let testPage =
--- a/browser/base/content/test/general/browser_bug491431.js
+++ b/browser/base/content/test/general/browser_bug491431.js
@@ -6,26 +6,26 @@ var testPage = "data:text/plain,test bug
function test() {
waitForExplicitFinish();
let newWin, tabA, tabB;
// test normal close
tabA = gBrowser.addTab(testPage);
- gBrowser.tabContainer.addEventListener("TabClose", function(aEvent) {
+ gBrowser.tabContainer.addEventListener("TabClose", function(firstTabCloseEvent) {
gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true);
- ok(!aEvent.detail.adoptedBy, "This was a normal tab close");
+ ok(!firstTabCloseEvent.detail.adoptedBy, "This was a normal tab close");
// test tab close by moving
tabB = gBrowser.addTab(testPage);
- gBrowser.tabContainer.addEventListener("TabClose", function(aEvent) {
+ gBrowser.tabContainer.addEventListener("TabClose", function(secondTabCloseEvent) {
gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true);
executeSoon(function() {
- ok(aEvent.detail.adoptedBy, "This was a tab closed by moving");
+ ok(secondTabCloseEvent.detail.adoptedBy, "This was a tab closed by moving");
// cleanup
newWin.close();
executeSoon(finish);
});
}, true);
newWin = gBrowser.replaceTabWithWindow(tabB);
}, true);
--- a/browser/base/content/test/general/browser_bug553455.js
+++ b/browser/base/content/test/general/browser_bug553455.js
@@ -8,18 +8,18 @@ const SECUREROOT = "https://example.com/
const XPINSTALL_URL = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
const PREF_INSTALL_REQUIREBUILTINCERTS = "extensions.install.requireBuiltInCerts";
const PROGRESS_NOTIFICATION = "addon-progress";
const { REQUIRE_SIGNING } = Cu.import("resource://gre/modules/addons/AddonConstants.jsm", {});
const { Task } = Cu.import("resource://gre/modules/Task.jsm");
var rootDir = getRootDirectory(gTestPath);
-var path = rootDir.split('/');
-var chromeName = path[0] + '//' + path[2];
+var rootPath = rootDir.split('/');
+var chromeName = rootPath[0] + '//' + rootPath[2];
var croot = chromeName + "/content/browser/toolkit/mozapps/extensions/test/xpinstall/";
var jar = getJar(croot);
if (jar) {
var tmpdir = extractJarToTmp(jar);
croot = 'file://' + tmpdir.path + '/';
}
const CHROMEROOT = croot;
@@ -450,18 +450,18 @@ function test_restartless() {
is(notification.getAttribute("label"),
"XPI Test has been installed successfully.",
"Should have seen the right message");
let installs = yield getInstalls();
is(installs.length, 0, "Should be no pending installs");
let addon = yield new Promise(resolve => {
- AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", addon => {
- resolve(addon);
+ AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", result => {
+ resolve(result);
});
});
addon.uninstall();
Services.perms.remove(makeURI("http://example.com/"), "install");
let closePromise = waitForNotificationClose();
gBrowser.removeTab(gBrowser.selectedTab);
@@ -494,18 +494,18 @@ function test_multiple() {
"2 add-ons will be installed after you restart " + gApp + ".",
"Should have seen the right message");
let installs = yield getInstalls();
is(installs.length, 1, "Should be one pending install");
installs[0].cancel();
let addon = yield new Promise(resolve => {
- AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", function (addon) {
- resolve(addon);
+ AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", function (result) {
+ resolve(result);
});
});
addon.uninstall();
Services.perms.remove(makeURI("http://example.com/"), "install");
yield removeTab();
});
},
@@ -671,18 +671,18 @@ function test_allUnverified() {
is(container.childNodes[0].firstChild.getAttribute("value"), "XPI Test", "Should have the right add-on");
is(container.childNodes[0].childNodes.length, 1, "Shouldn't have the unverified marker");
let notificationPromise = waitForNotification("addon-install-complete");
acceptInstallDialog();
yield notificationPromise;
let addon = yield new Promise(resolve => {
- AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", function(addon) {
- resolve(addon);
+ AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", function(result) {
+ resolve(result);
});
});
addon.uninstall();
Services.perms.remove(makeURI("http://example.com/"), "install");
yield removeTab();
});
},
@@ -914,27 +914,27 @@ function test_theme() {
let notification = panel.childNodes[0];
is(notification.button.label, "Restart Now", "Should have seen the right button");
is(notification.getAttribute("label"),
"Theme Test will be installed after you restart " + gApp + ".",
"Should have seen the right message");
let addon = yield new Promise(resolve => {
- AddonManager.getAddonByID("{972ce4c6-7e08-4474-a285-3208198ce6fd}", function(addon) {
- resolve(addon);
+ AddonManager.getAddonByID("{972ce4c6-7e08-4474-a285-3208198ce6fd}", function(result) {
+ resolve(result);
});
});
ok(addon.userDisabled, "Should be switching away from the default theme.");
// Undo the pending theme switch
addon.userDisabled = false;
addon = yield new Promise(resolve => {
- AddonManager.getAddonByID("theme-xpi@tests.mozilla.org", function(addon) {
- resolve(addon);
+ AddonManager.getAddonByID("theme-xpi@tests.mozilla.org", function(result) {
+ resolve(result);
});
});
isnot(addon, null, "Test theme will have been installed");
addon.uninstall();
Services.perms.remove(makeURI("http://example.com/"), "install");
yield removeTab();
});
--- a/browser/base/content/test/general/browser_bug561636.js
+++ b/browser/base/content/test/general/browser_bug561636.js
@@ -69,26 +69,26 @@ function* blurChildElement(browser)
yield ContentTask.spawn(browser, {}, function* () {
content.document.getElementById('i').blur();
});
}
function* checkChildFocus(browser, message)
{
yield ContentTask.spawn(browser, [message, testId], function* (args) {
- let [msg, testId] = args;
+ let [msg, id] = args;
var focused = content.document.activeElement == content.document.getElementById('i');
var validMsg = true;
if (msg) {
validMsg = (msg == content.document.getElementById('i').validationMessage);
}
- Assert.equal(focused, true, "Test " + testId + " First invalid element should be focused");
- Assert.equal(validMsg, true, "Test " + testId + " The panel should show the message from validationMessage");
+ Assert.equal(focused, true, "Test " + id + " First invalid element should be focused");
+ Assert.equal(validMsg, true, "Test " + id + " The panel should show the message from validationMessage");
});
}
/**
* In this test, we check that no popup appears if the form is valid.
*/
add_task(function* ()
{
--- a/browser/base/content/test/general/browser_bug592338.js
+++ b/browser/base/content/test/general/browser_bug592338.js
@@ -139,17 +139,17 @@ function runNextTest() {
function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref("extensions.logging.enabled", true);
AddonManager.getInstallForURL(TESTROOT + "theme.xpi", function(aInstall) {
aInstall.addListener({
- onInstallEnded: function(aInstall, aAddon) {
+ onInstallEnded: function() {
AddonManager.getAddonByID("theme-xpi@tests.mozilla.org", function(aAddon) {
isnot(aAddon, null, "Should have installed the test theme.");
// In order to switch themes while the test is running we turn on dynamic
// theme switching. This means the test isn't exactly correct but should
// do some good
Services.prefs.setBoolPref("extensions.dss.enabled", true);
--- a/browser/base/content/test/general/browser_bug676619.js
+++ b/browser/base/content/test/general/browser_bug676619.js
@@ -7,35 +7,35 @@ function test () {
function loadListener() {
function testLocation(link, url, next) {
new TabOpenListener(url, function () {
gBrowser.removeTab(this.tab);
}, function () {
next();
});
- ContentTask.spawn(gBrowser.selectedBrowser, link, link => {
- content.document.getElementById(link).click();
+ ContentTask.spawn(gBrowser.selectedBrowser, link, contentLink => {
+ content.document.getElementById(contentLink).click();
});
}
function testLink(link, name, next) {
addWindowListener("chrome://mozapps/content/downloads/unknownContentType.xul", function (win) {
ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
Assert.equal(content.document.getElementById("unload-flag").textContent,
"Okay", "beforeunload shouldn't have fired");
}).then(() => {
is(win.document.getElementById("location").value, name, "file name should match");
win.close();
next();
});
});
- ContentTask.spawn(gBrowser.selectedBrowser, link, link => {
- content.document.getElementById(link).click();
+ ContentTask.spawn(gBrowser.selectedBrowser, link, contentLink => {
+ content.document.getElementById(contentLink).click();
});
}
testLink("link1", "test.txt",
testLink.bind(null, "link2", "video.ogg",
testLink.bind(null, "link3", "just some video",
testLink.bind(null, "link4", "with-target.txt",
testLink.bind(null, "link5", "javascript.txt",
--- a/browser/base/content/test/general/browser_bug719271.js
+++ b/browser/base/content/test/general/browser_bug719271.js
@@ -1,17 +1,17 @@
/* 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/. */
"use strict";
const TEST_PAGE = "http://example.org/browser/browser/base/content/test/general/zoom_test.html";
const TEST_VIDEO = "http://example.org/browser/browser/base/content/test/general/video.ogg";
-var gTab1, gTab2, gLevel1, gLevel2;
+var gTab1, gTab2, gLevel1;
function test() {
waitForExplicitFinish();
Task.spawn(function* () {
gTab1 = gBrowser.addTab();
gTab2 = gBrowser.addTab();
@@ -39,19 +39,19 @@ function zoomTab1() {
}).then(zoomTab2, FullZoomHelper.failAndContinue(finish));
}
function zoomTab2() {
Task.spawn(function* () {
is(gBrowser.selectedTab, gTab2, "Tab 2 is selected");
FullZoom.reduce();
- let gLevel2 = ZoomManager.getZoomForBrowser(gBrowser.getBrowserForTab(gTab2));
+ let level2 = ZoomManager.getZoomForBrowser(gBrowser.getBrowserForTab(gTab2));
- ok(gLevel2 < 1, "New zoom for tab 2 should be less than 1");
+ ok(level2 < 1, "New zoom for tab 2 should be less than 1");
FullZoomHelper.zoomTest(gTab1, gLevel1, "Zooming tab 2 should not affect tab 1");
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
FullZoomHelper.zoomTest(gTab1, gLevel1, "Tab 1 should have the same zoom after it's selected");
}).then(testNavigation, FullZoomHelper.failAndContinue(finish));
}
function testNavigation() {
--- a/browser/base/content/test/general/browser_bug763468_perwindowpb.js
+++ b/browser/base/content/test/general/browser_bug763468_perwindowpb.js
@@ -52,19 +52,19 @@ function test() {
aWin.close();
});
});
// test first when not on private mode
testOnWindow({}, function(aWin) {
doTest(false, aWin, function() {
// then test when on private mode
- testOnWindow({private: true}, function(aWin) {
- doTest(true, aWin, function() {
+ testOnWindow({private: true}, function(aWin2) {
+ doTest(true, aWin2, function() {
// then test again when not on private mode
- testOnWindow({}, function(aWin) {
- doTest(false, aWin, finish);
+ testOnWindow({}, function(aWin3) {
+ doTest(false, aWin3, finish);
});
});
});
});
});
}
--- a/browser/base/content/test/general/browser_bug767836_perwindowpb.js
+++ b/browser/base/content/test/general/browser_bug767836_perwindowpb.js
@@ -59,18 +59,18 @@ function test() {
// check whether any custom new tab url has been configured
ok(!aboutNewTabService.overridden, "No custom newtab url is set");
// test normal mode
testOnWindow(false, function(aWindow) {
doTest(false, aWindow, function() {
// test private mode
- testOnWindow(true, function(aWindow) {
- doTest(true, aWindow, function() {
+ testOnWindow(true, function(aWindow2) {
+ doTest(true, aWindow2, function() {
finish();
});
});
});
});
}
function openNewTab(aWindow, aCallback) {
--- a/browser/base/content/test/general/browser_clipboard.js
+++ b/browser/base/content/test/general/browser_clipboard.js
@@ -27,22 +27,21 @@ add_task(function*() {
yield ContentTask.spawn(browser, { modifier, htmlPrefix, htmlPostfix }, function* (arg) {
var doc = content.document;
var main = doc.getElementById("main");
main.focus();
const utils = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
- const modifier = arg.modifier;
function sendKey(key) {
- if (utils.sendKeyEvent("keydown", key, 0, modifier)) {
- utils.sendKeyEvent("keypress", key, key.charCodeAt(0), modifier);
+ if (utils.sendKeyEvent("keydown", key, 0, arg.modifier)) {
+ utils.sendKeyEvent("keypress", key, key.charCodeAt(0), arg.modifier);
}
- utils.sendKeyEvent("keyup", key, 0, modifier);
+ utils.sendKeyEvent("keyup", key, 0, arg.modifier);
}
// Select an area of the text.
let selection = doc.getSelection();
selection.modify("move", "left", "line");
selection.modify("move", "right", "character");
selection.modify("move", "right", "character");
selection.modify("move", "right", "character");
@@ -153,21 +152,20 @@ add_task(function*() {
reject('Clipboard Data did not contain an image, was ' + clipboardData.getData("text/html"));
}
resolve();
}, true)
const utils = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
- const modifier = arg.modifier;
- if (utils.sendKeyEvent("keydown", "v", 0, modifier)) {
- utils.sendKeyEvent("keypress", "v", "v".charCodeAt(0), modifier);
+ if (utils.sendKeyEvent("keydown", "v", 0, arg.modifier)) {
+ utils.sendKeyEvent("keypress", "v", "v".charCodeAt(0), arg.modifier);
}
- utils.sendKeyEvent("keyup", "v", 0, modifier);
+ utils.sendKeyEvent("keyup", "v", 0, arg.modifier);
});
// The new content should now include an image.
Assert.equal(main.innerHTML, '<i>Italic</i> <img id="img" tabindex="1" ' +
'src="http://example.org/browser/browser/base/content/test/general/moz.png">' +
'Test <b>Bold</b> After<b></b>', "Paste after copy image");
});
--- a/browser/base/content/test/general/browser_contentSearchUI.js
+++ b/browser/base/content/test/general/browser_contentSearchUI.js
@@ -661,22 +661,22 @@ function setUp(aNoEngine) {
}
function msg(type, data=null) {
gMsgMan.sendAsyncMessage(TEST_MSG, {
type: type,
data: data,
});
let deferred = Promise.defer();
- gMsgMan.addMessageListener(TEST_MSG, function onMsg(msg) {
- if (msg.data.type != type) {
+ gMsgMan.addMessageListener(TEST_MSG, function onMsg(msgObj) {
+ if (msgObj.data.type != type) {
return;
}
gMsgMan.removeMessageListener(TEST_MSG, onMsg);
- deferred.resolve(msg.data.data);
+ deferred.resolve(msgObj.data.data);
});
return deferred.promise;
}
function checkState(actualState, expectedInputVal, expectedSuggestions,
expectedSelectedIdx, expectedSelectedButtonIdx) {
expectedSuggestions = expectedSuggestions.map(sugg => {
return typeof(sugg) == "object" ? sugg : {
@@ -737,21 +737,21 @@ function promiseTab() {
}, true, true);
openUILinkIn(pageURL, "current");
return deferred.promise;
}
function promiseMsg(name, type, msgMan) {
let deferred = Promise.defer();
info("Waiting for " + name + " message " + type + "...");
- msgMan.addMessageListener(name, function onMsg(msg) {
- info("Received " + name + " message " + msg.data.type + "\n");
- if (msg.data.type == type) {
+ msgMan.addMessageListener(name, function onMsg(msgObj) {
+ info("Received " + name + " message " + msgObj.data.type + "\n");
+ if (msgObj.data.type == type) {
msgMan.removeMessageListener(name, onMsg);
- deferred.resolve(msg);
+ deferred.resolve(msgObj);
}
});
return deferred.promise;
}
function setUpEngines() {
return Task.spawn(function* () {
info("Removing default search engines");
--- a/browser/base/content/test/general/browser_contextmenu.js
+++ b/browser/base/content/test/general/browser_contextmenu.js
@@ -883,38 +883,39 @@ add_task(function* test_input_spell_fals
const remoteClientsFixture = [ { id: 1, name: "Foo"}, { id: 2, name: "Bar"} ];
add_task(function* test_plaintext_sendpagetodevice() {
if (!gFxAccounts.sendTabToDeviceEnabled) {
return;
}
const oldGetter = setupRemoteClientsFixture(remoteClientsFixture);
- let plainTextItems = ["context-navigation", null,
- ["context-back", false,
- "context-forward", false,
- "context-reload", true,
- "context-bookmarkpage", true], null,
+ let plainTextItemsWithSendPage =
+ ["context-navigation", null,
+ ["context-back", false,
+ "context-forward", false,
+ "context-reload", true,
+ "context-bookmarkpage", true], null,
"---", null,
"context-savepage", true,
...(hasPocket ? ["context-pocket", true] : []),
"---", null,
"context-sendpagetodevice", true,
["*Foo", true,
"*Bar", true,
"---", null,
"*All Devices", true], null,
"---", null,
"context-viewbgimage", false,
"context-selectall", true,
"---", null,
"context-viewsource", true,
"context-viewinfo", true
];
- yield test_contextmenu("#test-text", plainTextItems, {
+ yield test_contextmenu("#test-text", plainTextItemsWithSendPage, {
*onContextMenuShown() {
yield openMenuItemSubmenu("context-sendpagetodevice");
}
});
restoreRemoteClients(oldGetter);
});
@@ -961,21 +962,21 @@ add_task(function* test_cleanup_html() {
/**
* Selects the text of the element that matches the provided `selector`
*
* @param {String} selector
* A selector passed to querySelector to find
* the element that will be referenced.
*/
function* selectText(selector) {
- yield ContentTask.spawn(gBrowser.selectedBrowser, selector, function*(selector) {
- info(`Selecting text of ${selector}`);
+ yield ContentTask.spawn(gBrowser.selectedBrowser, selector, function*(contentSelector) {
+ info(`Selecting text of ${contentSelector}`);
let doc = content.document;
let win = doc.defaultView;
win.getSelection().removeAllRanges();
let div = doc.createRange();
- let element = doc.querySelector(selector);
+ let element = doc.querySelector(contentSelector);
Assert.ok(element, "Found element to select text from");
div.setStartBefore(element);
div.setEndAfter(element);
win.getSelection().addRange(div);
});
}
--- a/browser/base/content/test/general/browser_decoderDoctor.js
+++ b/browser/base/content/test/general/browser_decoderDoctor.js
@@ -1,19 +1,19 @@
"use strict";
function* test_decoder_doctor_notification(type, notificationMessage, options) {
yield BrowserTestUtils.withNewTab({ gBrowser }, function*(browser) {
let awaitNotificationBar =
BrowserTestUtils.waitForNotificationBar(gBrowser, browser, "decoder-doctor-notification");
- yield ContentTask.spawn(browser, type, function*(type) {
+ yield ContentTask.spawn(browser, type, function*(aType) {
Services.obs.notifyObservers(content.window,
"decoder-doctor-notification",
- JSON.stringify({type: type,
+ JSON.stringify({type: aType,
isSolved: false,
decoderDoctorReportId: "test",
formats: "test"}));
});
let notification;
try {
notification = yield awaitNotificationBar;
--- a/browser/base/content/test/general/browser_discovery.js
+++ b/browser/base/content/test/general/browser_discovery.js
@@ -31,45 +31,45 @@ var iconDiscoveryTests = [
{ rel: "shortcut-icon", pass: false, text: "rel shortcut-icon not discovered" },
{ href: "moz.png", text: "relative href works" },
{ href: "notthere.png", text: "404'd icon is removed properly" },
{ href: "data:image/x-icon,%00", type: "image/x-icon", text: "data: URIs work" },
{ type: "image/png; charset=utf-8", text: "type may have optional parameters (RFC2046)" }
];
function runIconDiscoveryTest() {
- var test = iconDiscoveryTests[0];
+ var testCase = iconDiscoveryTests[0];
var head = doc().getElementById("linkparent");
var hasSrc = gBrowser.getIcon() != null;
- if (test.pass)
- ok(hasSrc, test.text);
+ if (testCase.pass)
+ ok(hasSrc, testCase.text);
else
- ok(!hasSrc, test.text);
+ ok(!hasSrc, testCase.text);
head.removeChild(head.getElementsByTagName('link')[0]);
iconDiscoveryTests.shift();
iconDiscovery(); // Run the next test.
}
function iconDiscovery() {
if (iconDiscoveryTests.length) {
setHandlerFunc(runIconDiscoveryTest);
gBrowser.setIcon(gBrowser.selectedTab, null,
Services.scriptSecurityManager.getSystemPrincipal());
- var test = iconDiscoveryTests[0];
+ var testCase = iconDiscoveryTests[0];
var head = doc().getElementById("linkparent");
var link = doc().createElement("link");
var rootDir = getRootDirectory(gTestPath);
- var rel = test.rel || "icon";
- var href = test.href || rootDir + "moz.png";
- var type = test.type || "image/png";
- if (test.pass == undefined)
- test.pass = true;
+ var rel = testCase.rel || "icon";
+ var href = testCase.href || rootDir + "moz.png";
+ var type = testCase.type || "image/png";
+ if (testCase.pass == undefined)
+ testCase.pass = true;
link.rel = rel;
link.href = href;
link.type = type;
head.appendChild(link);
} else {
searchDiscovery();
}
@@ -87,27 +87,27 @@ var searchDiscoveryTests = [
{ type: "APPLICATION/OPENSEARCHDESCRIPTION+XML", text: "type is case insensitve" },
{ type: " application/opensearchdescription+xml ", text: "type may contain extra whitespace" },
{ type: "application/opensearchdescription+xml; charset=utf-8", text: "type may have optional parameters (RFC2046)" },
{ type: "aapplication/opensearchdescription+xml", pass: false, text: "type should not be loosely matched" },
{ rel: "search search search", count: 1, text: "only one engine should be added" }
];
function runSearchDiscoveryTest() {
- var test = searchDiscoveryTests[0];
- var title = test.title || searchDiscoveryTests.length;
+ var testCase = searchDiscoveryTests[0];
+ var title = testCase.title || searchDiscoveryTests.length;
if (browser.engines) {
- var hasEngine = (test.count) ? (browser.engines[0].title == title &&
- browser.engines.length == test.count) :
- (browser.engines[0].title == title);
- ok(hasEngine, test.text);
+ var hasEngine = (testCase.count) ? (browser.engines[0].title == title &&
+ browser.engines.length == testCase.count) :
+ (browser.engines[0].title == title);
+ ok(hasEngine, testCase.text);
browser.engines = null;
}
else
- ok(!test.pass, test.text);
+ ok(!testCase.pass, testCase.text);
searchDiscoveryTests.shift();
searchDiscovery(); // Run the next test.
}
// This handler is called twice, once for each added link element.
// Only want to check once the second link element has been added.
var ranOnce = false;
@@ -124,25 +124,25 @@ function runMultipleEnginesTestAndFinali
finish();
}
function searchDiscovery() {
let head = doc().getElementById("linkparent");
if (searchDiscoveryTests.length) {
setHandlerFunc(runSearchDiscoveryTest);
- let test = searchDiscoveryTests[0];
+ let testCase = searchDiscoveryTests[0];
let link = doc().createElement("link");
- let rel = test.rel || "search";
- let href = test.href || "http://so.not.here.mozilla.com/search.xml";
- let type = test.type || "application/opensearchdescription+xml";
- let title = test.title || searchDiscoveryTests.length;
- if (test.pass == undefined)
- test.pass = true;
+ let rel = testCase.rel || "search";
+ let href = testCase.href || "http://so.not.here.mozilla.com/search.xml";
+ let type = testCase.type || "application/opensearchdescription+xml";
+ let title = testCase.title || searchDiscoveryTests.length;
+ if (testCase.pass == undefined)
+ testCase.pass = true;
link.rel = rel;
link.href = href;
link.type = type;
link.title = title;
head.appendChild(link);
} else {
setHandlerFunc(runMultipleEnginesTestAndFinalize);
--- a/browser/base/content/test/general/browser_documentnavigation.js
+++ b/browser/base/content/test/general/browser_documentnavigation.js
@@ -25,44 +25,44 @@ function* expectFocusOnF6(backward, expe
is(msg.data.details, expected, desc + " child focus matches");
focusChangedInChildResolver();
}
if (onContent) {
messageManager.addMessageListener("BrowserTest:FocusChanged", focusChangedListener);
yield ContentTask.spawn(gBrowser.selectedBrowser, { expectedElementId: expectedElement }, function* (arg) {
- let expectedElement = content.document.getElementById(arg.expectedElementId);
- if (!expectedElement) {
+ let contentExpectedElement = content.document.getElementById(arg.expectedElementId);
+ if (!contentExpectedElement) {
// Element not found, so look in the child frames.
for (let f = 0; f < content.frames.length; f++) {
if (content.frames[f].document.getElementById(arg.expectedElementId)) {
- expectedElement = content.frames[f].document;
+ contentExpectedElement = content.frames[f].document;
break;
}
}
}
- else if (expectedElement.localName == "html") {
- expectedElement = expectedElement.ownerDocument;
+ else if (contentExpectedElement.localName == "html") {
+ contentExpectedElement = contentExpectedElement.ownerDocument;
}
- if (!expectedElement) {
+ if (!contentExpectedElement) {
sendSyncMessage("BrowserTest:FocusChanged",
{ details : "expected element " + arg.expectedElementId + " not found" });
return;
}
- expectedElement.addEventListener("focus", function focusReceived() {
- expectedElement.removeEventListener("focus", focusReceived, true);
+ contentExpectedElement.addEventListener("focus", function focusReceived() {
+ contentExpectedElement.removeEventListener("focus", focusReceived, true);
- const fm = Components.classes["@mozilla.org/focus-manager;1"].
- getService(Components.interfaces.nsIFocusManager);
- let details = fm.focusedWindow.document.documentElement.id;
- if (fm.focusedElement) {
- details += "," + fm.focusedElement.id;
+ const contentFM = Components.classes["@mozilla.org/focus-manager;1"].
+ getService(Components.interfaces.nsIFocusManager);
+ let details = contentFM.focusedWindow.document.documentElement.id;
+ if (contentFM.focusedElement) {
+ details += "," + contentFM.focusedElement.id;
}
sendSyncMessage("BrowserTest:FocusChanged", { details : details });
}, true);
});
}
EventUtils.synthesizeKey("VK_F6", { shiftKey: backward });
--- a/browser/base/content/test/general/browser_e10s_chrome_process.js
+++ b/browser/base/content/test/general/browser_e10s_chrome_process.js
@@ -126,18 +126,18 @@ function* loadURI(browser, uri) {
return true;
},
// Loads the new page by finding a link with the right href in the document and
// clicking it
function* clickLink(browser, uri) {
info("Clicking link");
- function frame_script(uri) {
- let link = content.document.querySelector("a[href='" + uri + "']");
+ function frame_script(frameUri) {
+ let link = content.document.querySelector("a[href='" + frameUri + "']");
link.click();
}
browser.messageManager.loadFrameScript("data:,(" + frame_script.toString() + ")(" + JSON.stringify(uri) + ");", false);
return false;
},
];
--- a/browser/base/content/test/general/browser_feed_discovery.js
+++ b/browser/base/content/test/general/browser_feed_discovery.js
@@ -13,21 +13,21 @@ add_task(function* () {
let discovered = browser.feeds;
ok(discovered.length > 0, "some feeds should be discovered");
let feeds = {};
for (let aFeed of discovered) {
feeds[aFeed.href] = true;
}
- yield ContentTask.spawn(browser, feeds, function* (feeds) {
+ yield ContentTask.spawn(browser, feeds, function* (contentFeeds) {
for (let aLink of content.document.getElementsByTagName("link")) {
// ignore real stylesheets, and anything without an href property
if (aLink.type != "text/css" && aLink.href) {
if (/bogus/i.test(aLink.title)) {
- ok(!feeds[aLink.href], "don't discover " + aLink.href);
+ ok(!contentFeeds[aLink.href], "don't discover " + aLink.href);
} else {
- ok(feeds[aLink.href], "should discover " + aLink.href);
+ ok(contentFeeds[aLink.href], "should discover " + aLink.href);
}
}
}
});
})
--- a/browser/base/content/test/general/browser_findbarClose.js
+++ b/browser/base/content/test/general/browser_findbarClose.js
@@ -15,19 +15,19 @@ add_task(function* findbar_test() {
newTab.linkedBrowser.loadURI("http://example.com/browser/" +
"browser/base/content/test/general/test_bug628179.html");
yield promise;
gFindBar.open();
yield new ContentTask.spawn(newTab.linkedBrowser, null, function* () {
let iframe = content.document.getElementById("iframe");
- let promise = ContentTaskUtils.waitForEvent(iframe, "load", false);
+ let awaitLoad = ContentTaskUtils.waitForEvent(iframe, "load", false);
iframe.src = "http://example.org/";
- yield promise;
+ yield awaitLoad;
});
ok(!gFindBar.hidden, "the Find bar isn't hidden after the location of a " +
"subdocument changes");
gFindBar.close();
gBrowser.removeTab(newTab);
finish();
--- a/browser/base/content/test/general/browser_fullscreen-window-open.js
+++ b/browser/base/content/test/general/browser_fullscreen-window-open.js
@@ -44,19 +44,19 @@ var gTests = [
test_open_with_innerSize,
test_open_with_dialog,
test_open_when_open_new_window_by_pref,
test_open_with_pref_to_disable_in_fullscreen,
test_open_from_chrome,
];
function runNextTest () {
- let test = gTests.shift();
- if (test) {
- executeSoon(test);
+ let testCase = gTests.shift();
+ if (testCase) {
+ executeSoon(testCase);
}
else {
finish();
}
}
// Test for window.open() with no feature.
--- a/browser/base/content/test/general/browser_fxa_oauth.js
+++ b/browser/base/content/test/general/browser_fxa_oauth.js
@@ -309,19 +309,19 @@ function test() {
waitForExplicitFinish();
Task.spawn(function* () {
const webchannelWhitelistPref = "webchannel.allowObject.urlWhitelist";
let origWhitelist = Services.prefs.getCharPref(webchannelWhitelistPref);
let newWhitelist = origWhitelist + " http://example.com";
Services.prefs.setCharPref(webchannelWhitelistPref, newWhitelist);
try {
- for (let test of gTests) {
- info("Running: " + test.desc);
- yield test.run();
+ for (let testCase of gTests) {
+ info("Running: " + testCase.desc);
+ yield testCase.run();
}
} finally {
Services.prefs.clearUserPref(webchannelWhitelistPref);
}
}).then(finish, ex => {
Assert.ok(false, "Unexpected Exception: " + ex);
finish();
});
--- a/browser/base/content/test/general/browser_fxa_web_channel.js
+++ b/browser/base/content/test/general/browser_fxa_web_channel.js
@@ -194,17 +194,17 @@ function makeObserver(aObserveTopic, aOb
Services.obs.addObserver(callback, aObserveTopic, false);
return removeMe;
}
function test() {
waitForExplicitFinish();
Task.spawn(function* () {
- for (let test of gTests) {
- info("Running: " + test.desc);
- yield test.run();
+ for (let testCase of gTests) {
+ info("Running: " + testCase.desc);
+ yield testCase.run();
}
}).then(finish, ex => {
Assert.ok(false, "Unexpected Exception: " + ex);
finish();
});
}
--- a/browser/base/content/test/general/browser_fxaccounts.js
+++ b/browser/base/content/test/general/browser_fxaccounts.js
@@ -178,20 +178,20 @@ function configureProfileURL(profile, re
// .sjs as part of the query string.
"&path=";
Services.prefs.setCharPref("identity.fxaccounts.remote.profile.uri", url);
}
function promiseObserver(topic, count = 1) {
return new Promise(resolve => {
- let obs = (subject, topic, data) => {
+ let obs = (aSubject, aTopic, aData) => {
if (--count == 0) {
- Services.obs.removeObserver(obs, topic);
- resolve(subject);
+ Services.obs.removeObserver(obs, aTopic);
+ resolve(aSubject);
}
}
Services.obs.addObserver(obs, topic, false);
});
}
// Stolen from browser_aboutHome.js
function promiseWaitForEvent(node, type, capturing) {
--- a/browser/base/content/test/general/browser_page_style_menu.js
+++ b/browser/base/content/test/general/browser_page_style_menu.js
@@ -45,53 +45,53 @@ add_task(function*() {
items.push(current);
}
items = items.map(el => ({
label: el.getAttribute("label"),
checked: el.getAttribute("checked") == "true",
}));
- let validLinks = yield ContentTask.spawn(gBrowser.selectedBrowser, items, function(items) {
- let validLinks = 0;
+ let validLinks = yield ContentTask.spawn(gBrowser.selectedBrowser, items, function(contentItems) {
+ let contentValidLinks = 0;
Array.forEach(content.document.querySelectorAll("link, style"), function (el) {
var title = el.getAttribute("title");
var rel = el.getAttribute("rel");
var media = el.getAttribute("media");
var idstring = el.nodeName + " " + (title ? title : "without title and") +
" with rel=\"" + rel + "\"" +
(media ? " and media=\"" + media + "\"" : "");
- var item = items.filter(item => item.label == title);
+ var item = contentItems.filter(aItem => aItem.label == title);
var found = item.length == 1;
var checked = found && item[0].checked;
switch (el.getAttribute("data-state")) {
case "0":
ok(!found, idstring + " should not show up in page style menu");
break;
case "0-todo":
- validLinks++;
+ contentValidLinks++;
todo(!found, idstring + " should not show up in page style menu");
ok(!checked, idstring + " should not be selected");
break;
case "1":
- validLinks++;
+ contentValidLinks++;
ok(found, idstring + " should show up in page style menu");
ok(!checked, idstring + " should not be selected");
break;
case "2":
- validLinks++;
+ contentValidLinks++;
ok(found, idstring + " should show up in page style menu");
ok(checked, idstring + " should be selected");
break;
default:
throw "data-state attribute is missing or has invalid value";
}
});
- return validLinks;
+ return contentValidLinks;
});
ok(items.length, "At least one item in the menu");
is(items.length, validLinks, "all valid links found");
yield BrowserTestUtils.removeTab(tab);
});
--- a/browser/base/content/test/general/browser_popup_blocker.js
+++ b/browser/base/content/test/general/browser_popup_blocker.js
@@ -48,17 +48,17 @@ function test() {
}
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen);
// Press the button.
let allow = menu.querySelector("[observes='blockedPopupAllowSite']");
allow.doCommand();
yield promiseWaitForCondition(() =>
popupTabs.length == 2 &&
- popupTabs.every(tab => tab.linkedBrowser.currentURI.spec != "about:blank"));
+ popupTabs.every(aTab => aTab.linkedBrowser.currentURI.spec != "about:blank"));
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen);
is(popupTabs[0].linkedBrowser.currentURI.spec, "data:text/plain;charset=utf-8,a", "Popup a");
is(popupTabs[1].linkedBrowser.currentURI.spec, "data:text/plain;charset=utf-8,b", "Popup b");
// Clean up.
gBrowser.removeTab(tab);
--- a/browser/base/content/test/general/browser_refreshBlocker.js
+++ b/browser/base/content/test/general/browser_refreshBlocker.js
@@ -12,22 +12,22 @@ const PREF = "accessibility.blockautoref
*
* @param browser (<xul:browser>)
* The browser to test for refreshing.
* @param expectRefresh (bool)
* Whether or not we expect the refresh attempt to succeed.
* @returns Promise
*/
function* attemptFakeRefresh(browser, expectRefresh) {
- yield ContentTask.spawn(browser, expectRefresh, function*(expectRefresh) {
+ yield ContentTask.spawn(browser, expectRefresh, function*(contentExpectRefresh) {
let URI = docShell.QueryInterface(Ci.nsIWebNavigation).currentURI;
let refresher = docShell.QueryInterface(Ci.nsIRefreshURI);
refresher.refreshURI(URI, 0, false, true);
- Assert.equal(refresher.refreshPending, expectRefresh,
+ Assert.equal(refresher.refreshPending, contentExpectRefresh,
"Got the right refreshPending state");
if (refresher.refreshPending) {
// Cancel the pending refresh
refresher.cancelRefreshURITimers();
}
// The RefreshBlocker will wait until onLocationChange has
--- a/browser/base/content/test/general/browser_sanitizeDialog.js
+++ b/browser/base/content/test/general/browser_sanitizeDialog.js
@@ -579,17 +579,17 @@ add_task(function* test_offline_cache()
};
storage.asyncVisitStorage(visitor, false);
// Offline cache visit happens synchronously, since it's forwarded to the old code
is(size, 0, "offline application cache entries evicted");
};
var cacheListener = {
onCacheEntryCheck: function() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; },
- onCacheEntryAvailable: function (entry, isnew, appcache, status) {
+ onCacheEntryAvailable: function (entry, isnew, unused, status) {
is(status, Cr.NS_OK);
var stream = entry.openOutputStream(0);
var content = "content";
stream.write(content, content.length);
stream.close();
entry.close();
wh.open();
}
--- a/browser/base/content/test/general/browser_save_link-perwindowpb.js
+++ b/browser/base/content/test/general/browser_save_link-perwindowpb.js
@@ -59,19 +59,19 @@ function triggerSave(aWindow, aCallback)
var saveLinkCommand = aWindow.document.getElementById("context-savelink");
info("saveLinkCommand: " + saveLinkCommand);
saveLinkCommand.doCommand();
event.target.hidePopup();
info("popup hidden");
}
- function onTransferComplete(aWindow, downloadSuccess, destDir) {
+ function onTransferComplete(aWindow2, downloadSuccess, destDir) {
ok(downloadSuccess, "Link should have been downloaded successfully");
- aWindow.close();
+ aWindow2.close();
executeSoon(() => aCallback());
}
}
function test() {
info("Start the test");
waitForExplicitFinish();
@@ -81,20 +81,20 @@ function test() {
info("testOnWindow(" + options + ")");
var win = OpenBrowserWindow(options);
info("got " + win);
whenDelayedStartupFinished(win, () => callback(win));
}
function whenDelayedStartupFinished(aWindow, aCallback) {
info("whenDelayedStartupFinished");
- Services.obs.addObserver(function observer(aSubject, aTopic) {
+ Services.obs.addObserver(function obs(aSubject, aTopic) {
info("whenDelayedStartupFinished, got topic: " + aTopic + ", got subject: " + aSubject + ", waiting for " + aWindow);
if (aWindow == aSubject) {
- Services.obs.removeObserver(observer, aTopic);
+ Services.obs.removeObserver(obs, aTopic);
executeSoon(aCallback);
info("whenDelayedStartupFinished found our window");
}
}, "browser-delayed-startup-finished", false);
}
mockTransferRegisterer.register();
@@ -165,18 +165,18 @@ function test() {
Services.obs.addObserver(observer, "http-on-examine-response", false);
testOnWindow(undefined, function(win) {
// The first save from a regular window sets a cookie.
triggerSave(win, function() {
is(gNumSet, 1, "1 cookie should be set");
// The second save from a private window also sets a cookie.
- testOnWindow({private: true}, function(win) {
- triggerSave(win, function() {
+ testOnWindow({private: true}, function(win2) {
+ triggerSave(win2, function() {
is(gNumSet, 2, "2 cookies should be set");
finish();
});
});
});
});
}
--- a/browser/base/content/test/general/browser_save_link_when_window_navigates.js
+++ b/browser/base/content/test/general/browser_save_link_when_window_navigates.js
@@ -75,19 +75,19 @@ function triggerSave(aWindow, aCallback)
win.document.documentElement._fireButtonEvent("accept");
win.close();
return;
}
}
ok(false, "No Unknown Content Type dialog yet?");
}
- function onTransferComplete(aWindow, downloadSuccess, destDir) {
+ function onTransferComplete(aWindow2, downloadSuccess) {
ok(downloadSuccess, "Link should have been downloaded successfully");
- aWindow.close();
+ aWindow2.close();
executeSoon(aCallback);
}
}
var windowObserver = {
setCallback: function(aCallback) {
@@ -158,16 +158,16 @@ function test() {
Services.prefs.setBoolPref(ALWAYS_DOWNLOAD_DIR_PREF, false);
testOnWindow(undefined, function(win) {
let windowGonePromise = promiseWindowWillBeClosed(win);
Services.prefs.setBoolPref(SAVE_PER_SITE_PREF, true);
triggerSave(win, function() {
windowGonePromise.then(function() {
Services.prefs.setBoolPref(SAVE_PER_SITE_PREF, false);
- testOnWindow(undefined, function(win) {
- triggerSave(win, finish);
+ testOnWindow(undefined, function(win2) {
+ triggerSave(win2, finish);
});
});
});
});
}
--- a/browser/base/content/test/general/browser_selectpopup.js
+++ b/browser/base/content/test/general/browser_selectpopup.js
@@ -265,46 +265,46 @@ add_task(function*() {
[ "frame", "border-top: 5px solid green; border-left: 10px solid red; border-right: 35px solid blue;", 10, 5 ],
[ "frame", "border: none; padding-left: 6px; padding-right: 12px; padding-top: 2px;", -4, -3 ],
[ "select", "margin: 9px; transform: translateY(-3px);", 9, 6 ],
];
for (let stepIndex = 0; stepIndex < steps.length; stepIndex++) {
let step = steps[stepIndex];
- yield ContentTask.spawn(gBrowser.selectedBrowser, step, function*(step) {
+ yield ContentTask.spawn(gBrowser.selectedBrowser, step, function*(contentStep) {
return new Promise(resolve => {
let changedWin = content;
let elem;
- if (step[0] == "select") {
+ if (contentStep[0] == "select") {
changedWin = content.document.getElementById("frame").contentWindow;
elem = changedWin.document.getElementById("select");
}
else {
- elem = content.document.getElementById(step[0]);
+ elem = content.document.getElementById(contentStep[0]);
}
changedWin.addEventListener("MozAfterPaint", function onPaint() {
changedWin.removeEventListener("MozAfterPaint", onPaint);
resolve();
});
- elem.style = step[1];
+ elem.style = contentStep[1];
});
});
yield openSelectPopup(selectPopup, false);
expectedX += step[2];
expectedY += step[3];
- let rect = selectPopup.getBoundingClientRect();
- is(rect.left, expectedX, "step " + (stepIndex + 1) + " x");
- is(rect.top, expectedY, "step " + (stepIndex + 1) + " y");
+ let popupRect = selectPopup.getBoundingClientRect();
+ is(popupRect.left, expectedX, "step " + (stepIndex + 1) + " x");
+ is(popupRect.top, expectedY, "step " + (stepIndex + 1) + " y");
yield hideSelectPopup(selectPopup);
}
yield BrowserTestUtils.removeTab(tab);
});
// Test that we get the right events when a select popup is changed.
@@ -360,38 +360,36 @@ add_task(function* test_event_order() {
targetIsOption: true,
},
];
for (let mode of ["enter", "click"]) {
let expected = mode == "enter" ? expectedEnter : expectedClick;
yield openSelectPopup(selectPopup, true, mode == "enter" ? "#one" : "#two");
- let eventsPromise = ContentTask.spawn(browser, { mode, expected }, function*(args) {
- let expected = args.expected;
-
+ let eventsPromise = ContentTask.spawn(browser, [mode, expected], function*([contentMode, contentExpected]) {
return new Promise((resolve) => {
function onEvent(event) {
select.removeEventListener(event.type, onEvent);
- Assert.ok(expected.length, "Unexpected event " + event.type);
- let expectation = expected.shift();
+ Assert.ok(contentExpected.length, "Unexpected event " + event.type);
+ let expectation = contentExpected.shift();
Assert.equal(event.type, expectation.type,
"Expected the right event order");
Assert.ok(event.bubbles, "All of these events should bubble");
Assert.equal(event.cancelable, expectation.cancelable,
"Cancellation property should match");
Assert.equal(event.target.localName,
expectation.targetIsOption ? "option" : "select",
"Target matches");
- if (!expected.length) {
+ if (!contentExpected.length) {
resolve();
}
}
- let select = content.document.getElementById(args.mode == "enter" ? "one" : "two");
+ let select = content.document.getElementById(contentMode == "enter" ? "one" : "two");
for (let event of ["input", "change", "mousedown", "mouseup", "click"]) {
select.addEventListener(event, onEvent);
}
});
});
EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
yield hideSelectPopup(selectPopup, mode);
@@ -445,19 +443,19 @@ function* performLargePopupTests(win)
yield hideSelectPopup(selectPopup, "enter", win);
position = positions.shift();
if (!position) {
break;
}
let contentPainted = BrowserTestUtils.contentPainted(browser);
- yield ContentTask.spawn(browser, position, function*(position) {
+ yield ContentTask.spawn(browser, position, function*(contentPosition) {
let select = content.document.getElementById("one");
- select.setAttribute("style", position);
+ select.setAttribute("style", contentPosition);
});
yield contentPainted;
}
}
// This test checks select elements with a large number of options to ensure that
// the popup appears within the browser area.
add_task(function* test_large_popup() {
--- a/browser/base/content/test/general/browser_syncui.js
+++ b/browser/base/content/test/general/browser_syncui.js
@@ -39,19 +39,19 @@ function checkBroadcasterVisible(broadca
for (let check of all) {
let eltHidden = document.getElementById(check).hidden;
Assert.equal(eltHidden, check == broadcasterId ? false : true, check);
}
}
function promiseObserver(topic) {
return new Promise(resolve => {
- let obs = (subject, topic, data) => {
- Services.obs.removeObserver(obs, topic);
- resolve(subject);
+ let obs = (aSubject, aTopic, aData) => {
+ Services.obs.removeObserver(obs, aTopic);
+ resolve(aSubject);
}
Services.obs.addObserver(obs, topic, false);
});
}
function checkButtonTooltips(stringPrefix) {
for (let butId of ["PanelUI-remotetabs-syncnow", "PanelUI-fxa-icon"]) {
let text = document.getElementById(butId).getAttribute("tooltiptext");
--- a/browser/base/content/test/general/browser_tabfocus.js
+++ b/browser/base/content/test/general/browser_tabfocus.js
@@ -58,17 +58,17 @@ function* getFocusedElementForBrowser(br
}
var focusedWindow = {};
var node = fm.getFocusedElementForWindow(browser.contentWindow, false, focusedWindow);
return "Focus is " + (node ? node.id : "<none>");
}
function focusInChild()
{
- var fm = Components.classes["@mozilla.org/focus-manager;1"].
+ var contentFM = Components.classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager);
function getWindowDocId(target)
{
return (String(target.location).indexOf("1") >= 0) ? "window1" : "window2";
}
function eventListener(event) {
@@ -86,34 +86,34 @@ function focusInChild()
addEventListener("blur", eventListener, true);
addMessageListener("Browser:ChangeFocus", function changeFocus(message) {
content.document.getElementById(message.data.id)[message.data.type]();
});
addMessageListener("Browser:GetFocusedElement", function getFocusedElement(message) {
var focusedWindow = {};
- var node = fm.getFocusedElementForWindow(content, false, focusedWindow);
+ var node = contentFM.getFocusedElementForWindow(content, false, focusedWindow);
var details = "Focus is " + (node ? node.id : "<none>");
/* Check focus manager properties. Add an error onto the string if they are
not what is expected which will cause matching to fail in the parent process. */
let doc = content.document;
if (!message.data.dontCheckExtraFocus) {
- if (fm.focusedElement != node) {
+ if (contentFM.focusedElement != node) {
details += "<ERROR: focusedElement doesn't match>";
}
- if (fm.focusedWindow && fm.focusedWindow != content) {
+ if (contentFM.focusedWindow && contentFM.focusedWindow != content) {
details += "<ERROR: focusedWindow doesn't match>";
}
- if ((fm.focusedWindow == content) != doc.hasFocus()) {
+ if ((contentFM.focusedWindow == content) != doc.hasFocus()) {
details += "<ERROR: child hasFocus() is not correct>";
}
- if ((fm.focusedElement && doc.activeElement != fm.focusedElement) ||
- (!fm.focusedElement && doc.activeElement != doc.body)) {
+ if ((contentFM.focusedElement && doc.activeElement != contentFM.focusedElement) ||
+ (!contentFM.focusedElement && doc.activeElement != doc.body)) {
details += "<ERROR: child activeElement is not correct>";
}
}
sendSyncMessage("Browser:GetCurrentFocus", { details : details });
});
}
@@ -155,17 +155,16 @@ add_task(function*() {
_lastfocus = "urlbar";
_lastfocuswindow = "main-window";
window.addEventListener("focus", _browser_tabfocus_test_eventOccured, true);
window.addEventListener("blur", _browser_tabfocus_test_eventOccured, true);
// make sure that the focus initially starts out blank
- var fm = Services.focus;
var focusedWindow = {};
let focused = yield getFocusedElementForBrowser(browser1);
is(focused, "Focus is <none>", "initial focus in tab 1");
focused = yield getFocusedElementForBrowser(browser2);
is(focused, "Focus is <none>", "initial focus in tab 2");
@@ -368,29 +367,29 @@ add_task(function*() {
window.removeEventListener("blur", _browser_tabfocus_test_eventOccured, true);
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
finish();
});
-function getWindowDocId(target)
-{
- if (target == browser1.contentWindow || target == browser1.contentDocument) {
- return "window1";
- }
- if (target == browser2.contentWindow || target == browser2.contentDocument) {
- return "window2";
- }
- return "main-window";
-}
-
function _browser_tabfocus_test_eventOccured(event)
{
+ function getWindowDocId(target)
+ {
+ if (target == browser1.contentWindow || target == browser1.contentDocument) {
+ return "window1";
+ }
+ if (target == browser2.contentWindow || target == browser2.contentDocument) {
+ return "window2";
+ }
+ return "main-window";
+ }
+
var id;
// Some focus events from the child bubble up? Ignore them.
if (Cu.isCrossProcessWrapper(event.originalTarget))
return;
if (event.target instanceof Window)
id = getWindowDocId(event.originalTarget) + "-window";
--- a/browser/base/content/test/general/browser_web_channel.js
+++ b/browser/base/content/test/general/browser_web_channel.js
@@ -125,29 +125,29 @@ var gTests = [
let preRedirectChannel = new WebChannel("pre_redirect", Services.io.newURI(HTTP_IFRAME_PATH, null, null));
let postRedirectChannel = new WebChannel("post_redirect", Services.io.newURI(HTTP_REDIRECTED_IFRAME_PATH, null, null));
let promiseTestDone = new Promise(function (resolve, reject) {
preRedirectChannel.listen(function (id, message, preRedirectSender) {
if (message.command === "redirecting") {
- postRedirectChannel.listen(function (id, message, postRedirectSender) {
- is(id, "post_redirect");
- isnot(message.command, "no_response_expected");
+ postRedirectChannel.listen(function (aId, aMessage, aPostRedirectSender) {
+ is(aId, "post_redirect");
+ isnot(aMessage.command, "no_response_expected");
- if (message.command === "loaded") {
+ if (aMessage.command === "loaded") {
// The message should not be received on the preRedirectChannel
// because the target window has redirected.
preRedirectChannel.send({ command: "no_response_expected" }, preRedirectSender);
- postRedirectChannel.send({ command: "done" }, postRedirectSender);
- } else if (message.command === "done") {
+ postRedirectChannel.send({ command: "done" }, aPostRedirectSender);
+ } else if (aMessage.command === "done") {
resolve();
} else {
- reject(new Error(`Unexpected command ${message.command}`));
+ reject(new Error(`Unexpected command ${aMessage.command}`));
}
});
} else {
reject(new Error(`Unexpected command ${message.command}`));
}
});
});
@@ -398,17 +398,17 @@ var gTests = [
}
}
]; // gTests
function test() {
waitForExplicitFinish();
Task.spawn(function* () {
- for (let test of gTests) {
- info("Running: " + test.desc);
- yield test.run();
+ for (let testCase of gTests) {
+ info("Running: " + testCase.desc);
+ yield testCase.run();
}
}).then(finish, ex => {
ok(false, "Unexpected Exception: " + ex);
finish();
});
}
--- a/browser/base/content/test/general/content_aboutAccounts.js
+++ b/browser/base/content/test/general/content_aboutAccounts.js
@@ -25,27 +25,27 @@ addEventListener("DOMContentLoaded", fun
removeEventListener("DOMContentLoaded", domContentLoaded, true);
let iframe = content.document.getElementById("remote");
if (!iframe) {
// at least one test initially loads about:blank - in that case, we are done.
return;
}
// We use DOMContentLoaded here as that fires for our iframe even when we've
// arranged for the URL in the iframe to cause an error.
- addEventListener("DOMContentLoaded", function iframeLoaded(event) {
+ addEventListener("DOMContentLoaded", function iframeLoaded(dclEvent) {
if (iframe.contentWindow.location.href == "about:blank" ||
- event.target != iframe.contentDocument) {
+ dclEvent.target != iframe.contentDocument) {
return;
}
removeEventListener("DOMContentLoaded", iframeLoaded, true);
sendAsyncMessage("test:iframe:load", {url: iframe.contentDocument.location.href});
// And an event listener for the test responses, which we send to the test
// via a message.
- iframe.contentWindow.addEventListener("FirefoxAccountsTestResponse", function (event) {
- sendAsyncMessage("test:response", {data: event.detail.data});
+ iframe.contentWindow.addEventListener("FirefoxAccountsTestResponse", function (fxAccountsEvent) {
+ sendAsyncMessage("test:response", {data: fxAccountsEvent.detail.data});
}, true);
}, true);
}, true);
// Return the visibility state of a list of ids.
addMessageListener("test:check-visibilities", function (message) {
let result = {};
for (let id of message.data.ids) {
@@ -67,19 +67,19 @@ addMessageListener("test:check-visibilit
});
addMessageListener("test:load-with-mocked-profile-path", function (message) {
addEventListener("DOMContentLoaded", function domContentLoaded(event) {
removeEventListener("DOMContentLoaded", domContentLoaded, true);
content.getDefaultProfilePath = () => message.data.profilePath;
// now wait for the iframe to load.
let iframe = content.document.getElementById("remote");
- iframe.addEventListener("load", function iframeLoaded(event) {
+ iframe.addEventListener("load", function iframeLoaded(loadEvent) {
if (iframe.contentWindow.location.href == "about:blank" ||
- event.target != iframe) {
+ loadEvent.target != iframe) {
return;
}
iframe.removeEventListener("load", iframeLoaded, true);
sendAsyncMessage("test:load-with-mocked-profile-path-response",
{url: iframe.contentDocument.location.href});
}, true);
});
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
--- a/browser/base/content/test/general/contextmenu_common.js
+++ b/browser/base/content/test/general/contextmenu_common.js
@@ -253,39 +253,39 @@ function* test_contextmenu(selector, men
// Default to centered if no positioning is defined.
if (!options.offsetX && !options.offsetY) {
options.centered = true;
}
if (!options.skipFocusChange) {
yield ContentTask.spawn(gBrowser.selectedBrowser,
- {lastElementSelector, selector},
- function*({lastElementSelector, selector}) {
- if (lastElementSelector) {
- let lastElement = content.document.querySelector(lastElementSelector);
- lastElement.blur();
+ [lastElementSelector, selector],
+ function*([contentLastElementSelector, contentSelector]) {
+ if (contentLastElementSelector) {
+ let contentLastElement = content.document.querySelector(contentLastElementSelector);
+ contentLastElement.blur();
}
- let element = content.document.querySelector(selector);
+ let element = content.document.querySelector(contentSelector);
element.focus();
});
lastElementSelector = selector;
info(`Moved focus to ${selector}`);
}
if (options.preCheckContextMenuFn) {
yield options.preCheckContextMenuFn();
info("Completed preCheckContextMenuFn");
}
if (options.waitForSpellCheck) {
info("Waiting for spell check");
- yield ContentTask.spawn(gBrowser.selectedBrowser, selector, function*(selector) {
+ yield ContentTask.spawn(gBrowser.selectedBrowser, selector, function*(contentSelector) {
let {onSpellCheck} = Cu.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm", {});
- let element = content.document.querySelector(selector);
+ let element = content.document.querySelector(contentSelector);
yield new Promise(resolve => onSpellCheck(element, resolve));
info("Spell check running");
});
}
let awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
yield BrowserTestUtils.synthesizeMouse(selector, options.offsetX || 0, options.offsetY || 0, {
type: "contextmenu",
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -322,17 +322,17 @@ function waitForAsyncUpdates(aCallback,
* @param aURI The URI.
* @param aExpectedValue The expected value.
* @return {Promise}
* @resolves When the check has been added successfully.
* @rejects JavaScript exception.
*/
function promiseIsURIVisited(aURI, aExpectedValue) {
let deferred = Promise.defer();
- PlacesUtils.asyncHistory.isURIVisited(aURI, function(aURI, aIsVisited) {
+ PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
deferred.resolve(aIsVisited);
});
return deferred.promise;
}
function whenNewTabLoaded(aWindow, aCallback) {
aWindow.BrowserOpenTab();
@@ -368,19 +368,19 @@ function promiseHistoryClearedState(aURI
let deferred = Promise.defer();
let callbackCount = 0;
let niceStr = aShouldBeCleared ? "no longer" : "still";
function callbackDone() {
if (++callbackCount == aURIs.length)
deferred.resolve();
}
aURIs.forEach(function (aURI) {
- PlacesUtils.asyncHistory.isURIVisited(aURI, function(aURI, aIsVisited) {
- is(aIsVisited, !aShouldBeCleared,
- "history visit " + aURI.spec + " should " + niceStr + " exist");
+ PlacesUtils.asyncHistory.isURIVisited(aURI, function(uri, isVisited) {
+ is(isVisited, !aShouldBeCleared,
+ "history visit " + uri.spec + " should " + niceStr + " exist");
callbackDone();
});
});
return deferred.promise;
}
/**
@@ -395,17 +395,17 @@ function promiseHistoryClearedState(aURI
* If you're using this method to avoid hitting the network, you want the default (true).
* However, the browser UI will behave differently for loads stopped directly from
* the progress listener (effectively in the middle of a call to loadURI) and so there
* are cases where you may want to avoid stopping the load directly from within the
* progress listener callback.
* @return promise
*/
function waitForDocLoadAndStopIt(aExpectedURL, aBrowser=gBrowser.selectedBrowser, aStopFromProgressListener=true) {
- function content_script(aStopFromProgressListener) {
+ function content_script(contentStopFromProgressListener) {
let { interfaces: Ci, utils: Cu } = Components;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
let wp = docShell.QueryInterface(Ci.nsIWebProgress);
function stopContent(now, uri) {
if (now) {
/* Hammer time. */
content.stop();
@@ -423,17 +423,17 @@ function waitForDocLoadAndStopIt(aExpect
if (webProgress.isTopLevel &&
flags & Ci.nsIWebProgressListener.STATE_START) {
wp.removeProgressListener(progressListener);
let chan = req.QueryInterface(Ci.nsIChannel);
dump(`waitForDocLoadAndStopIt: Document start: ${chan.URI.spec}\n`);
- stopContent(aStopFromProgressListener, chan.originalURI.spec);
+ stopContent(contentStopFromProgressListener, chan.originalURI.spec);
}
},
QueryInterface: XPCOMUtils.generateQI(["nsISupportsWeakReference"])
};
wp.addProgressListener(progressListener, wp.NOTIFY_STATE_WINDOW);
/**
* As |this| is undefined and we can't extend |docShell|, adding an unload
@@ -916,18 +916,18 @@ function promiseNotificationShown(notifi
* @resolves An object with subject and data properties from the observed
* notification.
* @rejects Never.
*/
function promiseTopicObserved(aTopic)
{
return new Promise((resolve) => {
Services.obs.addObserver(
- function PTO_observe(aSubject, aTopic, aData) {
- Services.obs.removeObserver(PTO_observe, aTopic);
+ function PTO_observe(aSubject, aTopic2, aData) {
+ Services.obs.removeObserver(PTO_observe, aTopic2);
resolve({subject: aSubject, data: aData});
}, aTopic, false);
});
}
function promiseNewSearchEngine(basename) {
return new Promise((resolve, reject) => {
info("Waiting for engine to be added: " + basename);
@@ -1053,17 +1053,17 @@ function getPropertyBagValue(bag, key) {
* will contain other extra information that is not
* compared against.
* @returns Promise
*/
function promiseCrashReport(expectedExtra={}) {
return Task.spawn(function*() {
info("Starting wait on crash-report-status");
let [subject, ] =
- yield TestUtils.topicObserved("crash-report-status", (subject, data) => {
+ yield TestUtils.topicObserved("crash-report-status", (unused, data) => {
return data == "success";
});
info("Topic observed!");
if (!(subject instanceof Ci.nsIPropertyBag2)) {
throw new Error("Subject was not a Ci.nsIPropertyBag2");
}
--- a/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing_perwindowpb.html
+++ b/security/manager/ssl/tests/mochitest/stricttransportsecurity/test_sts_privatebrowsing_perwindowpb.html
@@ -92,20 +92,20 @@
function startRound(win, isPrivate, round) {
currentround = round;
testsleftinround = NUM_TEST_FRAMES;
SimpleTest.info("TESTS LEFT IN ROUND " + currentround + ": " + testsleftinround);
let browser = win.gBrowser.selectedBrowser;
let src = "https://example.com" + STSPATH + "/" + round + "_bootstrap.html";
- ContentTask.spawn(browser, src, function* (src) {
+ ContentTask.spawn(browser, src, function* (contentSrc) {
let frame = content.document.createElement("iframe");
frame.setAttribute('id', 'ifr_bootstrap');
- frame.setAttribute('src', src);
+ frame.setAttribute('src', contentSrc);
return new Promise(resolve => {
frame.addEventListener("load", resolve);
content.document.body.appendChild(frame);
});
}).then(() => {
onMessageReceived(win, isPrivate, "BOOTSTRAP " + round);
});
@@ -121,20 +121,20 @@
});
}
function loadVerifyFrame(win, isPrivate, test, testName, aCallback) {
let id = 'ifr_' + testName;
let src = test.url + '?id=' + testName;
let browser = win.gBrowser.selectedBrowser;
- ContentTask.spawn(browser, [id, src], function* ([id, src]) {
+ ContentTask.spawn(browser, [id, src], function* ([contentId, contentSrc]) {
let frame = content.document.createElement("iframe");
- frame.setAttribute('id', id);
- frame.setAttribute('src', src);
+ frame.setAttribute('id', contentId);
+ frame.setAttribute('src', contentSrc);
return new Promise(resolve => {
frame.addEventListener("load", () => {
resolve(frame.contentDocument.location.protocol);
});
content.document.body.appendChild(frame);
});
@@ -177,20 +177,20 @@
", test " + result[1]);
testsleftinround--;
// if this round is complete...
if (testsleftinround < 1) {
SimpleTest.info("DONE WITH ROUND " + currentround);
// remove all the iframes in the document
let browser = win.gBrowser.selectedBrowser;
- ContentTask.spawn(browser, testframes, function* (testframes) {
+ ContentTask.spawn(browser, testframes, function* (contentTestFrames) {
content.document.body.removeChild(
content.document.getElementById('ifr_bootstrap'));
- for (let test in testframes) {
+ for (let test in contentTestFrames) {
content.document.body.removeChild(
content.document.getElementById('ifr_' + test));
}
}).then(() => {
currentround = "";
if (!isPrivate) {
clean_up_sts_state(isPrivate);
--- a/testing/mochitest/mochitest.eslintrc.js
+++ b/testing/mochitest/mochitest.eslintrc.js
@@ -1,13 +1,14 @@
// Parent config file for all mochitest files.
module.exports = {
rules: {
"mozilla/import-headjs-globals": 1,
"mozilla/mark-test-function-used": 1,
+ "no-shadow": 2,
},
"env": {
"browser": true,
},
// All globals made available in the test environment.
"globals": {
--- a/toolkit/components/alerts/test/test_alerts_noobserve.html
+++ b/toolkit/components/alerts/test/test_alerts_noobserve.html
@@ -18,17 +18,17 @@
<pre id="test">
<script class="testbody" type="text/javascript">
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
const chromeScript = SpecialPowers.loadChromeScript(_ => {
- const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+ const { utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Timer.jsm");
function anyXULAlertsVisible() {
var windows = Services.wm.getEnumerator("alert:alert");
return windows.hasMoreElements();
}
--- a/toolkit/components/alerts/test/test_alerts_requireinteraction.html
+++ b/toolkit/components/alerts/test/test_alerts_requireinteraction.html
@@ -9,33 +9,33 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
const chromeScript = SpecialPowers.loadChromeScript(_ => {
- const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+ const { utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Timer.jsm");
addMessageListener("waitForXULAlert", function() {
var timer = setTimeout(function() {
Services.ww.unregisterNotification(windowObserver);
sendAsyncMessage("waitForXULAlert", false);
}, 2000);
var windowObserver = function(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened") {
return;
}
- var win = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ var win = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad);
let windowType = win.document.documentElement.getAttribute("windowtype");
if (windowType == "alert:alert") {
clearTimeout(timer);
Services.ww.unregisterNotification(windowObserver);
sendAsyncMessage("waitForXULAlert", true);
--- a/toolkit/components/alerts/test/test_image.html
+++ b/toolkit/components/alerts/test/test_image.html
@@ -30,21 +30,21 @@ function promiseImage(alert, timeout = 0
return new Promise(resolve => {
var isDone = false;
function done(value) {
ok(!isDone, "Should call the image listener once");
isDone = true;
resolve(value);
}
alert.loadImage(timeout, SpecialPowers.wrapCallbackObject({
- onImageReady(userData, request) {
- done([true, request, userData]);
+ onImageReady(aUserData, aRequest) {
+ done([true, aRequest, aUserData]);
},
- onImageMissing(userData) {
- done([false, userData]);
+ onImageMissing(aUserData) {
+ done([false, aUserData]);
},
}), SpecialPowers.wrap(userData));
});
}
add_task(function* testContext() {
var inUserData = Cc["@mozilla.org/supports-PRInt64;1"]
.createInstance(Ci.nsISupportsPRInt64);
@@ -80,20 +80,20 @@ add_task(function* testAnimatedGIF() {
is(request.image.width, 256, "GIF width should be 256px");
is(request.image.height, 256, "GIF height should be 256px");
});
add_task(function* testCancel() {
var alert = makeAlert(null, imageServerURL + "?f=image.gif&t=180");
yield new Promise((resolve, reject) => {
var request = alert.loadImage(0, SpecialPowers.wrapCallbackObject({
- onImageReady(userData, request) {
+ onImageReady() {
reject(new Error("Should not load cancelled request"));
},
- onImageMissing(userData) {
+ onImageMissing() {
resolve();
},
}), null);
request.cancel(SpecialPowers.Cr.NS_BINDING_ABORTED);
});
});
add_task(function* testMixedContent() {
--- a/toolkit/components/alerts/test/test_multiple_alerts.html
+++ b/toolkit/components/alerts/test/test_multiple_alerts.html
@@ -9,23 +9,21 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
const chromeScript = SpecialPowers.loadChromeScript(_ => {
- const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+ Components.utils.import("resource://gre/modules/Services.jsm");
+ Components.utils.import("resource://gre/modules/Timer.jsm");
- Cu.import("resource://gre/modules/Services.jsm");
- Cu.import("resource://gre/modules/Timer.jsm");
-
- const alertService = Cc["@mozilla.org/alerts-service;1"]
- .getService(Ci.nsIAlertsService);
+ const alertService = Components.classes["@mozilla.org/alerts-service;1"]
+ .getService(Components.interfaces.nsIAlertsService);
addMessageListener("waitForPosition", function() {
var timer = setTimeout(function() {
Services.ww.unregisterNotification(windowObserver);
sendAsyncMessage("waitedForPosition", null);
}, 2000);
var windowObserver = function(aSubject, aTopic, aData) {
@@ -33,17 +31,17 @@ const chromeScript = SpecialPowers.loadC
return;
}
// Alerts are implemented using XUL.
clearTimeout(timer);
Services.ww.unregisterNotification(windowObserver);
- var win = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ var win = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
win.addEventListener("pageshow", function onPageShow() {
win.removeEventListener("pageshow", onPageShow, false);
var x = win.screenX;
var y = win.screenY;
win.addEventListener("pagehide", function onPageHide() {
win.removeEventListener("pagehide", onPageHide, false);
--- a/toolkit/components/alerts/test/test_principal.html
+++ b/toolkit/components/alerts/test/test_principal.html
@@ -16,19 +16,17 @@
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
const Services = SpecialPowers.Services;
const notifier = Cc["@mozilla.org/alerts-service;1"]
.getService(Ci.nsIAlertsService);
const chromeScript = SpecialPowers.loadChromeScript(_ => {
- const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-
- Cu.import("resource://gre/modules/Services.jsm");
+ Components.utils.import("resource://gre/modules/Services.jsm");
addMessageListener("anyXULAlertsVisible", function() {
var windows = Services.wm.getEnumerator("alert:alert");
return windows.hasMoreElements();
});
addMessageListener("getAlertSource", function() {
var alertWindows = Services.wm.getEnumerator("alert:alert");
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_background_debug_global.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_background_debug_global.html
@@ -59,17 +59,17 @@ add_task(function* () {
is("test!", context.testThing, "global context is the background script context");
resolve();
}
},
});
});
let addon = yield new Promise((resolve, reject) => {
- AddonManager.getAddonByID(ID, addon => addon ? resolve(addon) : reject());
+ AddonManager.getAddonByID(ID, aAddon => aAddon ? resolve(aAddon) : reject());
});
ok(addon, `Got the addon wrapper for ${addon.id}`);
function waitForDebugGlobalChanges(times, initialAddonInstanceID) {
return new Promise((resolve) => {
AddonManager.addAddonListener({
count: 0,
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_saveAs.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_saveAs.html
@@ -8,19 +8,18 @@
<link rel="stylesheet" href="chrome://mochikit/contents/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="text/javascript">
"use strict";
add_task(function* test_downloads_saveAs() {
-
function background() {
- const url = URL.createObjectURL(new Blob(['file content']));
+ const url = URL.createObjectURL(new Blob(["file content"]));
browser.test.onMessage.addListener(() =>
browser.downloads.download({url, saveAs: true})
.then(id => browser.downloads.onChanged.addListener(delta => {
if (delta.state.current === "complete") {
browser.test.sendMessage("done", {ok: true, id});
}
})).catch(({message}) => {
browser.test.sendMessage("done", {ok: false, message});
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_storage_cleanup.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_storage_cleanup.html
@@ -31,20 +31,20 @@ add_task(function* test_uninstall() {
db.createObjectStore("store", {keyPath: "name"});
};
req.onsuccess = e => {
let db = e.target.result;
let transaction = db.transaction("store", "readwrite");
let addreq = transaction.objectStore("store")
.add({name: "hello", value: "world"});
- addreq.onerror = e => {
- reject(new Error(`add to indexedDB failed with ${e.errorCode}`));
+ addreq.onerror = addreqError => {
+ reject(new Error(`add to indexedDB failed with ${addreqError.errorCode}`));
};
- addreq.onsuccess = e => {
+ addreq.onsuccess = () => {
resolve();
};
};
});
let browserStoragePromise = browser.storage.local.set({hello: "world"});
Promise.all([idbPromise, browserStoragePromise]).then(() => {
@@ -65,20 +65,20 @@ add_task(function* test_uninstall() {
// no database, data is not present
resolve(false);
};
req.onsuccess = e => {
let db = e.target.result;
let transaction = db.transaction("store", "readwrite");
let addreq = transaction.objectStore("store").get("hello");
- addreq.onerror = e => {
- reject(new Error(`read from indexedDB failed with ${e.errorCode}`));
+ addreq.onerror = addreqError => {
+ reject(new Error(`read from indexedDB failed with ${addreqError.errorCode}`));
};
- addreq.onsuccess = e => {
+ addreq.onsuccess = () => {
let match = (addreq.result.value == "world");
resolve(match);
};
};
});
let browserStoragePromise = browser.storage.local.get("hello").then(result => {
return (Object.keys(result).length == 1 && result.hello == "world");
--- a/toolkit/components/extensions/test/mochitest/test_ext_content_security_policy.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_content_security_policy.html
@@ -74,24 +74,24 @@ function* testPolicy(customCSP = null) {
}
function getCSP(window) {
let {cspJSON} = SpecialPowers.Cu.getObjectPrincipal(window);
return JSON.parse(cspJSON);
}
- function background(getCSP) {
+ function background(getCSPFn) {
browser.test.sendMessage("base-url", browser.extension.getURL("").replace(/\/$/, ""));
- browser.test.sendMessage("background-csp", getCSP(window));
+ browser.test.sendMessage("background-csp", getCSPFn(window));
}
- function tabScript(getCSP) {
- browser.test.sendMessage("tab-csp", getCSP(window));
+ function tabScript(getCSPFn) {
+ browser.test.sendMessage("tab-csp", getCSPFn(window));
}
let extension = ExtensionTestUtils.loadExtension({
background: `(${background})(${getCSP})`,
files: {
"tab.html": `<html><head><meta charset="utf-8">
<script src="tab.js"></${"script"}></head></html>`,
--- a/toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions.html
@@ -14,17 +14,17 @@
<script type="text/javascript">
"use strict";
function* testCookies(options) {
// Changing the options object is a bit of a hack, but it allows us to easily
// pass an expiration date to the background script.
options.expiry = Date.now() / 1000 + 3600;
- function background(options) {
+ function background(backgroundOptions) {
// Ask the parent scope to change some cookies we may or may not have
// permission for.
let awaitChanges = new Promise(resolve => {
browser.test.onMessage.addListener(msg => {
browser.test.assertEq("cookies-changed", msg, "browser.test.onMessage");
resolve();
});
});
@@ -32,43 +32,43 @@ function* testCookies(options) {
let changed = [];
browser.cookies.onChanged.addListener(event => {
changed.push(`${event.cookie.name}:${event.cause}`);
});
browser.test.sendMessage("change-cookies");
// Try to access some cookies in various ways.
- let {url, domain, secure} = options;
+ let {url, domain, secure} = backgroundOptions;
let failures = 0;
let tallyFailure = error => {
failures++;
};
awaitChanges.then(() => {
return browser.cookies.get({url, name: "foo"});
}).then(cookie => {
- browser.test.assertEq(options.shouldPass, cookie != null, "should pass == get cookie");
+ browser.test.assertEq(backgroundOptions.shouldPass, cookie != null, "should pass == get cookie");
return browser.cookies.getAll({domain});
}).then(cookies => {
- if (options.shouldPass) {
+ if (backgroundOptions.shouldPass) {
browser.test.assertEq(2, cookies.length, "expected number of cookies");
} else {
browser.test.assertEq(0, cookies.length, "expected number of cookies");
}
return Promise.all([
- browser.cookies.set({url, domain, secure, name: "foo", "value": "baz", expirationDate: options.expiry}).catch(tallyFailure),
- browser.cookies.set({url, domain, secure, name: "bar", "value": "quux", expirationDate: options.expiry}).catch(tallyFailure),
+ browser.cookies.set({url, domain, secure, name: "foo", "value": "baz", expirationDate: backgroundOptions.expiry}).catch(tallyFailure),
+ browser.cookies.set({url, domain, secure, name: "bar", "value": "quux", expirationDate: backgroundOptions.expiry}).catch(tallyFailure),
browser.cookies.remove({url, name: "deleted"}),
]);
}).then(() => {
- if (options.shouldPass) {
+ if (backgroundOptions.shouldPass) {
// The order of eviction events isn't guaranteed, so just check that
// it's there somewhere.
let evicted = changed.indexOf("evicted:evicted");
if (evicted < 0) {
browser.test.fail("got no eviction event");
} else {
browser.test.succeed("got eviction event");
changed.splice(evicted, 1);
@@ -77,17 +77,17 @@ function* testCookies(options) {
browser.test.assertEq("x:explicit,x:overwrite,x:explicit,x:explicit,foo:overwrite,foo:explicit,bar:explicit,deleted:explicit",
changed.join(","), "expected changes");
} else {
browser.test.assertEq("", changed.join(","), "expected no changes");
}
browser.test.notifyPass("cookie-permissions");
}).then(() => {
- if (!(options.shouldPass || options.shouldWrite)) {
+ if (!(backgroundOptions.shouldPass || backgroundOptions.shouldWrite)) {
browser.test.assertEq(2, failures, "Expected failures");
} else {
browser.test.assertEq(0, failures, "Expected no failures");
}
}).catch(error => {
browser.test.fail(`Error: ${error} :: ${error.stack}`);
});
}
--- a/toolkit/components/extensions/test/mochitest/test_ext_i18n.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_i18n.html
@@ -125,35 +125,35 @@ add_task(function* test_i18n() {
},
"bar": {
"message": "(bar)",
"description": "bar",
},
},
- "content.js": "new " + function(runTests) {
- runTests((...args) => {
+ "content.js": "new " + function(runTestsFn) {
+ runTestsFn((...args) => {
browser.runtime.sendMessage(["assertEq", ...args]);
});
browser.runtime.sendMessage(["content-script-finished"]);
} + `(${runTests})`,
},
- background: "new " + function(runTests) {
+ background: "new " + function(runTestsFn) {
browser.runtime.onMessage.addListener(([msg, ...args]) => {
if (msg == "assertEq") {
browser.test.assertEq(...args);
} else {
browser.test.sendMessage(msg, ...args);
}
});
- runTests(browser.test.assertEq.bind(browser.test));
+ runTestsFn(browser.test.assertEq.bind(browser.test));
} + `(${runTests})`,
});
yield extension.startup();
let win = window.open("file_sample.html");
yield extension.awaitMessage("content-script-finished");
win.close();
@@ -243,17 +243,17 @@ add_task(function* test_get_accept_langu
add_task(function* test_get_ui_language() {
function getResults() {
return {
getUILanguage: browser.i18n.getUILanguage(),
getMessage: browser.i18n.getMessage("@@ui_locale"),
};
}
- function background(getResults) {
+ function background(getResultsFn) {
function checkResults(source, results, expected) {
browser.test.assertEq(
expected,
results.getUILanguage,
`Got expected getUILanguage result in ${source}`
);
browser.test.assertEq(
expected,
@@ -262,31 +262,31 @@ add_task(function* test_get_ui_language(
);
}
let tabId;
browser.test.onMessage.addListener(([msg, expected]) => {
browser.tabs.sendMessage(tabId, "get-results", result => {
checkResults("contentScript", result, expected);
- checkResults("background", getResults(), expected);
+ checkResults("background", getResultsFn(), expected);
browser.test.sendMessage("done");
});
});
browser.tabs.query({currentWindow: true, active: true}, tabs => {
tabId = tabs[0].id;
browser.test.sendMessage("ready");
});
}
- function content(getResults) {
+ function content(getResultsFn) {
browser.runtime.onMessage.addListener((msg, sender, respond) => {
- respond(getResults());
+ respond(getResultsFn());
});
}
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"content_scripts": [{
"matches": ["http://mochi.test/*/file_sample.html"],
"run_at": "document_start",
--- a/toolkit/components/extensions/test/mochitest/test_ext_i18n_css.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_i18n_css.html
@@ -11,27 +11,27 @@
<body>
<script type="text/javascript">
"use strict";
add_task(function* test_i18n_css() {
let extension = ExtensionTestUtils.loadExtension({
background: function() {
- function fetch(url) {
+ function backgroundFetch(url) {
return new Promise((resolve, reject) => {
let xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.onload = () => { resolve(xhr.responseText); };
xhr.onerror = reject;
xhr.send();
});
}
- Promise.all([fetch("foo.css"), fetch("bar.CsS?x#y"), fetch("foo.txt")]).then(results => {
+ Promise.all([backgroundFetch("foo.css"), backgroundFetch("bar.CsS?x#y"), backgroundFetch("foo.txt")]).then(results => {
browser.test.assertEq("body { max-width: 42px; }", results[0], "CSS file localized");
browser.test.assertEq("body { max-width: 42px; }", results[1], "CSS file localized");
browser.test.assertEq("body { __MSG_foo__; }", results[2], "Text file not localized");
browser.test.notifyPass("i18n-css");
});
--- a/toolkit/components/extensions/test/mochitest/test_ext_permission_xhr.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_permission_xhr.html
@@ -56,34 +56,34 @@ add_task(function* test_simple() {
.then(() => run(true, window.fetch))
.then(() => run(false, window.fetch))
.catch(err => {
browser.test.fail(`Error: ${err} :: ${err.stack}`);
browser.test.notifyFail("permission_xhr");
});
}
- function background(runTests) {
- runTests("bg").then(() => {
+ function background(runTestsFn) {
+ runTestsFn("bg").then(() => {
browser.test.notifyPass("permission_xhr");
});
}
let extensionData = {
background: `(${background})(${runTests})`,
manifest: {
permissions: ["http://example.com/"],
content_scripts: [{
"matches": ["http://mochi.test/*/file_permission_xhr.html"],
"js": ["content.js"],
}],
},
files: {
- "content.js": "new " + function(runTests) {
- runTests("content").then(() => {
+ "content.js": "new " + function(runTestsFn) {
+ runTestsFn("content").then(() => {
window.wrappedJSObject.privilegedFetch = fetch;
window.wrappedJSObject.privilegedXHR = XMLHttpRequest;
window.addEventListener("message", function rcv({data}) {
switch (data.msg) {
case "test":
break;
--- a/toolkit/components/extensions/test/mochitest/test_ext_storage_content.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_storage_content.html
@@ -30,19 +30,19 @@ function contentScript() {
return storage.get({[prop]: undefined});
}).then(data => {
browser.test.assertEq(value, data[prop], "object getter worked for " + prop);
});
}
let globalChanges = {};
- browser.storage.onChanged.addListener((changes, storage) => {
- browser.test.assertEq("local", storage, "storage is local");
- Object.assign(globalChanges, changes);
+ browser.storage.onChanged.addListener((aChanges, aStorage) => {
+ browser.test.assertEq("local", aStorage, "storage is local");
+ Object.assign(globalChanges, aChanges);
});
function checkChanges(changes) {
function checkSub(obj1, obj2) {
for (let prop in obj1) {
browser.test.assertEq(obj1[prop].oldValue, obj2[prop].oldValue);
browser.test.assertEq(obj1[prop].newValue, obj2[prop].newValue);
}
--- a/toolkit/components/extensions/test/mochitest/test_ext_storage_tab.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_storage_tab.html
@@ -35,18 +35,18 @@ add_task(function* test_multiple_pages()
setTimeout(resolve, 0);
}
});
});
let storage = browser.storage.local;
browser.test.log("create");
- browser.tabs.create({url: "tab.html"}).then(tab => {
- tabId = tab.id;
+ browser.tabs.create({url: "tab.html"}).then(tabObj => {
+ tabId = tabObj.id;
return tabReady;
}).then(() => {
return storage.get("key");
}).then(result => {
browser.test.assertEq(undefined, result.key, "Key should be undefined");
return browser.runtime.sendMessage("tab-set-key");
--- a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html
@@ -204,19 +204,19 @@ add_task(function* test_web_accessible_r
function content() {
window.addEventListener("message", function rcv(event) {
browser.runtime.sendMessage("script-ran");
window.removeEventListener("message", rcv, false);
}, false);
testImageLoading(browser.extension.getURL("image.png"), "loaded");
- let testScript = document.createElement("script");
- testScript.setAttribute("src", browser.extension.getURL("test_script.js"));
- document.head.appendChild(testScript);
+ let testScriptElement = document.createElement("script");
+ testScriptElement.setAttribute("src", browser.extension.getURL("test_script.js"));
+ document.head.appendChild(testScriptElement);
browser.runtime.sendMessage("script-loaded");
}
function testScript() {
window.postMessage("test-script-loaded", "*");
}
let extension = ExtensionTestUtils.loadExtension({
@@ -296,19 +296,19 @@ add_task(function* test_web_accessible_r
browser.test.sendMessage("background-ready");
}
function content() {
testImageLoading("http://example.com/tests/toolkit/components/extensions/test/mochitest/file_image_bad.png", "blocked");
testImageLoading(browser.extension.getURL("image.png"), "loaded");
- let testScript = document.createElement("script");
- testScript.setAttribute("src", browser.extension.getURL("test_script.js"));
- document.head.appendChild(testScript);
+ let testScriptElement = document.createElement("script");
+ testScriptElement.setAttribute("src", browser.extension.getURL("test_script.js"));
+ document.head.appendChild(testScriptElement);
window.addEventListener("message", event => {
browser.runtime.sendMessage(event.data);
});
}
function testScript() {
window.postMessage("accessible-script-loaded", "*");
--- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_upload.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_upload.html
@@ -41,18 +41,18 @@
<input type="text" name="textInput" value="value2">
</form>
<script>
"use strict";
let files, testFile, blob, file, uploads;
add_task(function* test_setup() {
files = yield new Promise(resolve => {
- SpecialPowers.createFiles([{name: "testFile.pdf", data: "Not really a PDF file :)", "type": "application/x-pdf"}], (files) => {
- resolve(files);
+ SpecialPowers.createFiles([{name: "testFile.pdf", data: "Not really a PDF file :)", "type": "application/x-pdf"}], (result) => {
+ resolve(result);
});
});
testFile = files[0];
blob = {
name: "blobAsFile",
content: new Blob(["A blob sent as a file"], {type: "text/csv"}),
fileName: "blobAsFile.csv",
};
--- a/toolkit/components/passwordmgr/test/browser/browser_DOMFormHasPassword.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_DOMFormHasPassword.js
@@ -1,16 +1,16 @@
const ids = {
INPUT_ID: "input1",
FORM1_ID: "form1",
FORM2_ID: "form2",
CHANGE_INPUT_ID: "input2",
};
-function task(ids) {
+function task(contentIds) {
let resolve;
let promise = new Promise(r => { resolve = r; });
function unexpectedContentEvent(evt) {
ok(false, "Received a " + evt.type + " event on content");
}
var gDoc = null;
@@ -26,50 +26,50 @@ function task(ids) {
gDoc.addEventListener("DOMFormHasPassword", unexpectedContentEvent, false);
gDoc.defaultView.setTimeout(test_inputAdd, 0);
}
function test_inputAdd() {
addEventListener("DOMFormHasPassword", test_inputAddHandler, false);
let input = gDoc.createElementNS("http://www.w3.org/1999/xhtml", "input");
input.setAttribute("type", "password");
- input.setAttribute("id", ids.INPUT_ID);
+ input.setAttribute("id", contentIds.INPUT_ID);
input.setAttribute("data-test", "unique-attribute");
- gDoc.getElementById(ids.FORM1_ID).appendChild(input);
+ gDoc.getElementById(contentIds.FORM1_ID).appendChild(input);
}
function test_inputAddHandler(evt) {
removeEventListener(evt.type, test_inputAddHandler, false);
- is(evt.target.id, ids.FORM1_ID,
+ is(evt.target.id, contentIds.FORM1_ID,
evt.type + " event targets correct form element (added password element)");
gDoc.defaultView.setTimeout(test_inputChangeForm, 0);
}
function test_inputChangeForm() {
addEventListener("DOMFormHasPassword", test_inputChangeFormHandler, false);
- let input = gDoc.getElementById(ids.INPUT_ID);
- input.setAttribute("form", ids.FORM2_ID);
+ let input = gDoc.getElementById(contentIds.INPUT_ID);
+ input.setAttribute("form", contentIds.FORM2_ID);
}
function test_inputChangeFormHandler(evt) {
removeEventListener(evt.type, test_inputChangeFormHandler, false);
- is(evt.target.id, ids.FORM2_ID,
+ is(evt.target.id, contentIds.FORM2_ID,
evt.type + " event targets correct form element (changed form)");
gDoc.defaultView.setTimeout(test_inputChangesType, 0);
}
function test_inputChangesType() {
addEventListener("DOMFormHasPassword", test_inputChangesTypeHandler, false);
- let input = gDoc.getElementById(ids.CHANGE_INPUT_ID);
+ let input = gDoc.getElementById(contentIds.CHANGE_INPUT_ID);
input.setAttribute("type", "password");
}
function test_inputChangesTypeHandler(evt) {
removeEventListener(evt.type, test_inputChangesTypeHandler, false);
- is(evt.target.id, ids.FORM1_ID,
+ is(evt.target.id, contentIds.FORM1_ID,
evt.type + " event targets correct form element (changed type)");
gDoc.defaultView.setTimeout(finish, 0);
}
function finish() {
gDoc.removeEventListener("DOMFormHasPassword", unexpectedContentEvent, false);
resolve();
}
--- a/toolkit/components/passwordmgr/test/browser/browser_DOMInputPasswordAdded.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_DOMInputPasswordAdded.js
@@ -3,17 +3,17 @@ const consts = {
INPUT_ID: "input1",
FORM1_ID: "form1",
FORM2_ID: "form2",
CHANGE_INPUT_ID: "input2",
BODY_INPUT_ID: "input3",
};
-function task(consts) {
+function task(contentConsts) {
let resolve;
let promise = new Promise(r => { resolve = r; });
function unexpectedContentEvent(evt) {
Assert.ok(false, "Received a " + evt.type + " event on content");
}
var gDoc = null;
@@ -25,57 +25,57 @@ function task(consts) {
gDoc = content.document;
// These events shouldn't escape to content.
gDoc.addEventListener("DOMInputPasswordAdded", unexpectedContentEvent, false);
gDoc.defaultView.setTimeout(test_inputAdd, 0);
}
function test_inputAdd() {
addEventListener("DOMInputPasswordAdded", test_inputAddHandler, false);
- let input = gDoc.createElementNS(consts.HTML_NS, "input");
+ let input = gDoc.createElementNS(contentConsts.HTML_NS, "input");
input.setAttribute("type", "password");
- input.setAttribute("id", consts.INPUT_ID);
+ input.setAttribute("id", contentConsts.INPUT_ID);
input.setAttribute("data-test", "unique-attribute");
- gDoc.getElementById(consts.FORM1_ID).appendChild(input);
+ gDoc.getElementById(contentConsts.FORM1_ID).appendChild(input);
info("Done appending the input element");
}
function test_inputAddHandler(evt) {
removeEventListener(evt.type, test_inputAddHandler, false);
- Assert.equal(evt.target.id, consts.INPUT_ID,
+ Assert.equal(evt.target.id, contentConsts.INPUT_ID,
evt.type + " event targets correct input element (added password element)");
gDoc.defaultView.setTimeout(test_inputAddOutsideForm, 0);
}
function test_inputAddOutsideForm() {
addEventListener("DOMInputPasswordAdded", test_inputAddOutsideFormHandler, false);
- let input = gDoc.createElementNS(consts.HTML_NS, "input");
+ let input = gDoc.createElementNS(contentConsts.HTML_NS, "input");
input.setAttribute("type", "password");
- input.setAttribute("id", consts.BODY_INPUT_ID);
+ input.setAttribute("id", contentConsts.BODY_INPUT_ID);
input.setAttribute("data-test", "unique-attribute");
gDoc.body.appendChild(input);
info("Done appending the input element to the body");
}
function test_inputAddOutsideFormHandler(evt) {
removeEventListener(evt.type, test_inputAddOutsideFormHandler, false);
- Assert.equal(evt.target.id, consts.BODY_INPUT_ID,
+ Assert.equal(evt.target.id, contentConsts.BODY_INPUT_ID,
evt.type + " event targets correct input element (added password element outside form)");
gDoc.defaultView.setTimeout(test_inputChangesType, 0);
}
function test_inputChangesType() {
addEventListener("DOMInputPasswordAdded", test_inputChangesTypeHandler, false);
- let input = gDoc.getElementById(consts.CHANGE_INPUT_ID);
+ let input = gDoc.getElementById(contentConsts.CHANGE_INPUT_ID);
input.setAttribute("type", "password");
}
function test_inputChangesTypeHandler(evt) {
removeEventListener(evt.type, test_inputChangesTypeHandler, false);
- Assert.equal(evt.target.id, consts.CHANGE_INPUT_ID,
+ Assert.equal(evt.target.id, contentConsts.CHANGE_INPUT_ID,
evt.type + " event targets correct input element (changed type)");
gDoc.defaultView.setTimeout(completeTest, 0);
}
function completeTest() {
Assert.ok(true, "Test completed");
gDoc.removeEventListener("DOMInputPasswordAdded", unexpectedContentEvent, false);
resolve();
--- a/toolkit/components/passwordmgr/test/browser/browser_http_autofill.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_http_autofill.js
@@ -18,60 +18,60 @@ add_task(function* setup() {
yield SpecialPowers.pushPrefEnv({ "set": [["signon.autofillForms.http", false]] });
});
add_task(function* test_http_autofill() {
for (let scheme of ["http", "https"]) {
let tab = yield BrowserTestUtils
.openNewForegroundTab(gBrowser, `${scheme}${TEST_URL_PATH}form_basic.html`);
- let {username, password} = yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
+ let [username, password] = yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
let doc = content.document;
- let username = doc.getElementById("form-basic-username").value;
- let password = doc.getElementById("form-basic-password").value;
- return { username, password };
+ let contentUsername = doc.getElementById("form-basic-username").value;
+ let contentPassword = doc.getElementById("form-basic-password").value;
+ return [contentUsername, contentPassword];
});
is(username, scheme == "http" ? "" : "username", "Username filled correctly");
is(password, scheme == "http" ? "" : "password", "Password filled correctly");
gBrowser.removeTab(tab);
}
});
add_task(function* test_iframe_in_http_autofill() {
for (let scheme of ["http", "https"]) {
let tab = yield BrowserTestUtils
.openNewForegroundTab(gBrowser, `${scheme}${TEST_URL_PATH}form_basic_iframe.html`);
- let {username, password} = yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
+ let [username, password] = yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
let doc = content.document;
let iframe = doc.getElementById("test-iframe");
- let username = iframe.contentWindow.document.getElementById("form-basic-username").value;
- let password = iframe.contentWindow.document.getElementById("form-basic-password").value;
- return { username, password };
+ let contentUsername = iframe.contentWindow.document.getElementById("form-basic-username").value;
+ let contentPassword = iframe.contentWindow.document.getElementById("form-basic-password").value;
+ return [contentUsername, contentPassword];
});
is(username, scheme == "http" ? "" : "username", "Username filled correctly");
is(password, scheme == "http" ? "" : "password", "Password filled correctly");
gBrowser.removeTab(tab);
}
});
add_task(function* test_http_action_autofill() {
for (let type of ["insecure", "secure"]) {
let tab = yield BrowserTestUtils
.openNewForegroundTab(gBrowser, `https${TEST_URL_PATH}form_cross_origin_${type}_action.html`);
- let {username, password} = yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
+ let [username, password] = yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
let doc = content.document;
- let username = doc.getElementById("form-basic-username").value;
- let password = doc.getElementById("form-basic-password").value;
- return { username, password };
+ let contentUsername = doc.getElementById("form-basic-username").value;
+ let contentPassword = doc.getElementById("form-basic-password").value;
+ return [contentUsername, contentPassword];
});
is(username, type == "insecure" ? "" : "username", "Username filled correctly");
is(password, type == "insecure" ? "" : "password", "Password filled correctly");
gBrowser.removeTab(tab);
}
});
--- a/toolkit/components/passwordmgr/test/browser/browser_insecurePasswordWarning.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_insecurePasswordWarning.js
@@ -8,31 +8,31 @@ const WARNING_PATTERN = [{
}, {
key: "INSECURE_PAGE",
msg: 'JavaScript Warning: "Password fields present on an insecure (http://) page. This is a security risk that allows user login credentials to be stolen."'
}];
add_task(function* testInsecurePasswordWarning() {
let warningPatternHandler;
- function messageHandler(msg) {
+ function messageHandler(msgObj) {
function findWarningPattern(msg) {
return WARNING_PATTERN.find(patternPair => {
return msg.indexOf(patternPair.msg) !== -1;
});
}
- let warning = findWarningPattern(msg.message);
+ let warning = findWarningPattern(msgObj.message);
// Only handle the insecure password related warning messages.
if (warning) {
// Prevent any unexpected or redundant matched warning message coming after
// the test case is ended.
ok(warningPatternHandler, "Invoke a valid warning message handler");
- warningPatternHandler(warning, msg.message);
+ warningPatternHandler(warning, msgObj.message);
}
}
Services.console.registerListener(messageHandler);
registerCleanupFunction(function() {
Services.console.unregisterListener(messageHandler);
});
for (let [origin, testFile, expectWarnings] of [
--- a/toolkit/components/passwordmgr/test/browser/browser_notifications.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_notifications.js
@@ -35,21 +35,21 @@ add_task(function* test_save_change() {
url: "https://example.com/browser/toolkit/components/" +
"passwordmgr/test/browser/form_basic.html",
}, function* (browser) {
// Submit the form in the content page with the credentials from the test
// case. This will cause the doorhanger notification to be displayed.
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"popupshown",
(event) => event.target == PopupNotifications.panel);
- yield ContentTask.spawn(browser, { username, password },
- function* ({ username, password }) {
+ yield ContentTask.spawn(browser, [username, password],
+ function* ([contentUsername, contentPassword]) {
let doc = content.document;
- doc.getElementById("form-basic-username").value = username;
- doc.getElementById("form-basic-password").value = password;
+ doc.getElementById("form-basic-username").value = contentUsername;
+ doc.getElementById("form-basic-password").value = contentPassword;
doc.getElementById("form-basic").submit();
});
yield promiseShown;
let notificationElement = PopupNotifications.panel.childNodes[0];
// Style flush to make sure binding is attached
notificationElement.querySelector("#password-notification-password").clientTop;
// Check the actual content of the popup notification.
--- a/toolkit/components/passwordmgr/test/browser/browser_notifications_password.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_notifications_password.js
@@ -76,20 +76,20 @@ add_task(function* test_edit_password()
"passwordmgr/test/browser/form_basic.html",
}, function* (browser) {
// Submit the form in the content page with the credentials from the test
// case. This will cause the doorhanger notification to be displayed.
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"popupshown",
(event) => event.target == PopupNotifications.panel);
yield ContentTask.spawn(browser, testCase,
- function* (testCase) {
+ function* (contentTestCase) {
let doc = content.document;
- doc.getElementById("form-basic-username").value = testCase.usernameInPage;
- doc.getElementById("form-basic-password").value = testCase.passwordInPage;
+ doc.getElementById("form-basic-username").value = contentTestCase.usernameInPage;
+ doc.getElementById("form-basic-password").value = contentTestCase.passwordInPage;
doc.getElementById("form-basic").submit();
});
yield promiseShown;
let notificationElement = PopupNotifications.panel.childNodes[0];
// Style flush to make sure binding is attached
notificationElement.querySelector("#password-notification-password").clientTop;
// Modify the username in the dialog if requested.
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
@@ -73,20 +73,20 @@ function test() {
let showMode = (toggleCalls++ % 2) == 0;
// only watch for a confirmation dialog every other time being called
if (showMode) {
Services.ww.registerNotification(function (aSubject, aTopic, aData) {
if (aTopic == "domwindowclosed")
Services.ww.unregisterNotification(arguments.callee);
else if (aTopic == "domwindowopened") {
- let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
+ let targetWin = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
SimpleTest.waitForFocus(function() {
- EventUtils.sendKey("RETURN", win);
- }, win);
+ EventUtils.sendKey("RETURN", targetWin);
+ }, targetWin);
}
});
}
Services.obs.addObserver(function (aSubject, aTopic, aData) {
if (aTopic == "passwordmgr-password-toggle-complete") {
Services.obs.removeObserver(arguments.callee, aTopic);
func();
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgrdlg.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgrdlg.js
@@ -84,20 +84,20 @@ function test() {
let showMode = (toggleCalls++ % 2) == 0;
// only watch for a confirmation dialog every other time being called
if (showMode) {
Services.ww.registerNotification(function (aSubject, aTopic, aData) {
if (aTopic == "domwindowclosed")
Services.ww.unregisterNotification(arguments.callee);
else if (aTopic == "domwindowopened") {
- let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
+ let targetWin = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
SimpleTest.waitForFocus(function() {
- EventUtils.sendKey("RETURN", win);
- }, win);
+ EventUtils.sendKey("RETURN", targetWin);
+ }, targetWin);
}
});
}
Services.obs.addObserver(function (aSubject, aTopic, aData) {
if (aTopic == "passwordmgr-password-toggle-complete") {
Services.obs.removeObserver(arguments.callee, aTopic);
func();
@@ -110,34 +110,34 @@ function test() {
function runTests(mode, endFunction) {
let testCounter = 0;
function setFilter(string) {
filter.value = string;
filter.doCommand();
}
- function runOneTest(test) {
+ function runOneTest(testCase) {
function tester() {
- is(view.rowCount, expected, expected + " logins should match '" + test.filter + "'");
+ is(view.rowCount, expected, expected + " logins should match '" + testCase.filter + "'");
}
let expected;
switch (mode) {
case 1: // without showing passwords
- expected = test.count;
+ expected = testCase.count;
break;
case 2: // showing passwords
- expected = ("count2" in test) ? test.count2 : test.count;
+ expected = ("count2" in testCase) ? testCase.count2 : testCase.count;
break;
case 3: // toggle
- expected = test.count;
+ expected = testCase.count;
tester();
toggleShowPasswords(function () {
- expected = ("count2" in test) ? test.count2 : test.count;
+ expected = ("count2" in testCase) ? testCase.count2 : testCase.count;
tester();
toggleShowPasswords(proceed);
});
return;
}
tester();
proceed();
}
@@ -146,19 +146,19 @@ function test() {
// run the next test if necessary or proceed with the tests
if (testCounter != tests.length)
runNextTest();
else
endFunction();
}
function runNextTest() {
- let test = tests[testCounter++];
- setFilter(test.filter);
- setTimeout(runOneTest, 0, test);
+ let testCase = tests[testCounter++];
+ setFilter(testCase.filter);
+ setTimeout(runOneTest, 0, testCase);
}
runNextTest();
}
function step1() {
runTests(1, step2);
}
--- a/toolkit/components/passwordmgr/test/browser/head.js
+++ b/toolkit/components/passwordmgr/test/browser/head.js
@@ -6,17 +6,17 @@ Cu.import("resource://testing-common/Con
registerCleanupFunction(function* cleanup_removeAllLoginsAndResetRecipes() {
Services.logins.removeAllLogins();
let recipeParent = LoginTestUtils.recipes.getRecipeParent();
if (!recipeParent) {
// No need to reset the recipes if the recipe module wasn't even loaded.
return;
}
- yield recipeParent.then(recipeParent => recipeParent.reset());
+ yield recipeParent.then(recipeParentResult => recipeParentResult.reset());
});
/**
* Loads a test page in `DIRECTORY_URL` which automatically submits to formsubmit.sjs and returns a
* promise resolving with the field values when the optional `aTaskFn` is done.
*
* @param {String} aPageFile - test page file name which auto-submits to formsubmit.sjs
* @param {Function} aTaskFn - task which can be run before the tab closes.
--- a/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
+++ b/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
@@ -199,19 +199,19 @@ var mainWindow = window.QueryInterface(C
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
var contentPage = "http://mochi.test:8888/chrome/toolkit/components/passwordmgr/test/chrome/privbrowsing_perwindowpb_iframe.html";
var testWindows = [];
function whenDelayedStartupFinished(aWindow, aCallback) {
- Services.obs.addObserver(function observer(aSubject, aTopic) {
+ Services.obs.addObserver(function obs(aSubject, aTopic) {
if (aWindow == aSubject) {
- Services.obs.removeObserver(observer, aTopic);
+ Services.obs.removeObserver(obs, aTopic);
setTimeout(aCallback, 0);
}
}, "browser-delayed-startup-finished", false);
}
function testOnWindow(aIsPrivate, aCallback) {
var win = mainWindow.OpenBrowserWindow({private: aIsPrivate});
win.addEventListener("load", function onLoad() {
--- a/toolkit/components/passwordmgr/test/mochitest/test_bug_627616.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_bug_627616.html
@@ -59,67 +59,67 @@
mm.addMessageListener("prepareForNextTestDone", function prepared(msg) {
mm.removeMessageListener("prepareForNextTestDone", prepared);
if (pendingTests.length > 0) {
({expectedDialogs: gExpectedDialogs,
test: gCurrentTest} = pendingTests.shift());
gCurrentTest.call(this);
} else {
mm.sendAsyncMessage("cleanup");
- mm.addMessageListener("cleanupDone", msg => {
+ mm.addMessageListener("cleanupDone", () => {
// mm.destroy() is called as a cleanup function by runInParent(), no
// need to do it here.
SimpleTest.finish();
});
}
});
}
var pendingTests = [{expectedDialogs: 2, test: testNonAnonymousCredentials},
{expectedDialogs: 1, test: testAnonymousCredentials},
{expectedDialogs: 0, test: testAnonymousNoAuth}];
let mm = runInParent(() => {
- const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+ const { classes: parentCc, interfaces: parentCi, utils: parentCu } = Components;
- Cu.import("resource://gre/modules/Services.jsm");
- Cu.import("resource://gre/modules/NetUtil.jsm");
- Cu.import("resource://gre/modules/Timer.jsm");
- Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+ parentCu.import("resource://gre/modules/Services.jsm");
+ parentCu.import("resource://gre/modules/NetUtil.jsm");
+ parentCu.import("resource://gre/modules/Timer.jsm");
+ parentCu.import("resource://gre/modules/XPCOMUtils.jsm");
let channel = NetUtil.newChannel({
uri: "http://example.com",
loadUsingSystemPrincipal: true
});
- let pps = Cc["@mozilla.org/network/protocol-proxy-service;1"].
- getService(Ci.nsIProtocolProxyService);
+ let pps = parentCc["@mozilla.org/network/protocol-proxy-service;1"].
+ getService(parentCi.nsIProtocolProxyService);
pps.asyncResolve(channel, 0, {
onProxyAvailable(req, uri, pi, status) {
let mozproxy = "moz-proxy://" + pi.host + ":" + pi.port;
- let login = Cc["@mozilla.org/login-manager/loginInfo;1"].
- createInstance(Ci.nsILoginInfo);
+ let login = parentCc["@mozilla.org/login-manager/loginInfo;1"].
+ createInstance(parentCi.nsILoginInfo);
login.init(mozproxy, null, "proxy_realm", "proxy_user", "proxy_pass",
"", "");
Services.logins.addLogin(login);
- let login2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
- createInstance(Ci.nsILoginInfo);
+ let login2 = parentCc["@mozilla.org/login-manager/loginInfo;1"].
+ createInstance(parentCi.nsILoginInfo);
login2.init("http://mochi.test:8888", null, "mochirealm", "user1name",
"user1pass", "", "");
Services.logins.addLogin(login2);
sendAsyncMessage("setupDone");
},
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolProxyCallback]),
+ QueryInterface: XPCOMUtils.generateQI([parentCi.nsIProtocolProxyCallback]),
});
addMessageListener("prepareForNextTest", message => {
- Cc["@mozilla.org/network/http-auth-manager;1"].
- getService(Ci.nsIHttpAuthManager).
+ parentCc["@mozilla.org/network/http-auth-manager;1"].
+ getService(parentCi.nsIHttpAuthManager).
clearAll();
sendAsyncMessage("prepareForNextTestDone");
});
let dialogObserverTopic = "common-dialog-loaded";
function dialogObserver(subj, topic, data) {
subj.Dialog.ui.prompt.document.documentElement.acceptDialog();
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_http.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_http.html
@@ -13,17 +13,16 @@
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="iframe"></iframe>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
-var state, action;
var iframe = document.getElementById("iframe");
// Force parent to not look for tab-modal prompts, as they're not used for auth prompts.
isTabModal = false;
const AUTHENTICATE_PATH = new URL("authenticate.sjs", window.location.href).pathname;
let chromeScript = runInParent(SimpleTest.getTestFileURL("pwmgr_common.js"));
@@ -75,32 +74,32 @@ runInParent(() => {
pwmgr.addLogin(login4);
pwmgr.addLogin(httpUpgradeLogin);
pwmgr.addLogin(httpsDowngradeLogin);
pwmgr.addLogin(dedupeHttpUpgradeLogin);
pwmgr.addLogin(dedupeHttpsUpgradeLogin);
});
add_task(function* test_iframe() {
- state = {
+ let state = {
msg : "http://mochi.test:8888 is requesting your username and password. The site says: “mochitest”",
title : "Authentication Required",
textValue : "mochiuser1",
passValue : "mochipass1",
iconClass : "authentication-icon question-icon",
titleHidden : true,
textHidden : false,
passHidden : false,
checkHidden : true,
checkMsg : "",
checked : false,
focused : "textField",
defButton : "button0",
};
- action = {
+ let action = {
buttonClick : "ok",
};
promptDone = handlePrompt(state, action);
// The following tests are driven by iframe loads
var iframeLoaded = onloadPromiseFor("iframe");
iframe.src = "authenticate.sjs?user=mochiuser1&pass=mochipass1";
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_noWindow.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_noWindow.html
@@ -53,20 +53,20 @@ add_task(function* test_sandbox_xhr() {
let action = {
buttonClick : "ok",
};
let promptDone = handlePrompt(state, action);
let url = new URL("authenticate.sjs?user=mochiuser1&pass=mochipass1", window.location.href);
let sandboxConstructor = SpecialPowers.Cu.Sandbox;
let sandbox = new sandboxConstructor(this, {wantXrays: true});
- function sandboxedRequest(url) {
+ function sandboxedRequest(sandboxedUrl) {
let req = SpecialPowers.Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(SpecialPowers.Ci.nsIXMLHttpRequest);
- req.open("GET", url, true);
+ req.open("GET", sandboxedUrl, true);
req.send(null);
}
let loginModifiedPromise = promiseStorageChanged(["modifyLogin"]);
sandbox.sandboxedRequest = sandboxedRequest(url);
info("send the XHR request in the sandbox");
SpecialPowers.Cu.evalInSandbox("sandboxedRequest;", sandbox);
--- a/toolkit/components/passwordmgr/test/pwmgr_common.js
+++ b/toolkit/components/passwordmgr/test/pwmgr_common.js
@@ -183,18 +183,18 @@ function registerRunTests() {
var observer = SpecialPowers.wrapCallback(function(subject, topic, data) {
var formLikeRoot = subject.QueryInterface(SpecialPowers.Ci.nsIDOMNode);
if (formLikeRoot.id !== 'observerforcer')
return;
SpecialPowers.removeObserver(observer, "passwordmgr-processed-form");
formLikeRoot.remove();
SimpleTest.executeSoon(() => {
- var event = new Event("runTests");
- window.dispatchEvent(event);
+ var runTestEvent = new Event("runTests");
+ window.dispatchEvent(runTestEvent);
});
});
SpecialPowers.addObserver(observer, "passwordmgr-processed-form", false);
document.body.appendChild(form);
});
}
@@ -396,24 +396,23 @@ if (this.addMessageListener) {
// Force LoginManagerParent to init for the tests since it's normally delayed
// by apps such as on Android.
LoginManagerParent.init();
commonInit(selfFilling);
sendAsyncMessage("doneSetup");
});
- addMessageListener("loadRecipes", Task.async(function* loadRecipes(recipes) {
-
+ addMessageListener("loadRecipes", Task.async(function*(recipes) {
var recipeParent = yield LoginManagerParent.recipeParentPromise;
yield recipeParent.load(recipes);
sendAsyncMessage("loadedRecipes", recipes);
}));
- addMessageListener("resetRecipes", Task.async(function* resetRecipes() {
+ addMessageListener("resetRecipes", Task.async(function*() {
let recipeParent = yield LoginManagerParent.recipeParentPromise;
yield recipeParent.reset();
sendAsyncMessage("recipesReset");
}));
addMessageListener("proxyLoginManager", msg => {
// Recreate nsILoginInfo objects from vanilla JS objects.
let recreatedArgs = msg.args.map((arg, index) => {
--- a/toolkit/components/passwordmgr/test/test_master_password.html
+++ b/toolkit/components/passwordmgr/test/test_master_password.html
@@ -68,25 +68,25 @@ addEventListener("message", () => {
/*
* handleDialog
*
* Invoked a short period of time after calling startCallbackTimer(), and
* allows testing the actual auth dialog while it's being displayed. Tests
* should call startCallbackTimer() each time the auth dialog is expected (the
* timer is a one-shot).
*/
-function handleDialog(doc, testNum) {
- ok(true, "handleDialog running for test " + testNum);
+function handleDialog(doc, testNumber) {
+ ok(true, "handleDialog running for test " + testNumber);
var clickOK = true;
var doNothing = false;
var passfield = doc.getElementById("password1Textbox");
var dialog = doc.getElementById("commonDialog");
- switch (testNum) {
+ switch (testNumber) {
case 1:
is(passfield.getAttribute("value"), "", "Checking empty prompt");
passfield.setAttribute("value", masterPassword);
is(passfield.getAttribute("value"), masterPassword, "Checking filled prompt");
break;
case 2:
clickOK = false;
@@ -102,33 +102,33 @@ function handleDialog(doc, testNum) {
break;
case 5:
is(passfield.getAttribute("value"), "", "Checking empty prompt");
passfield.setAttribute("value", masterPassword);
break;
default:
- ok(false, "Uhh, unhandled switch for testNum #" + testNum);
+ ok(false, "Uhh, unhandled switch for testNum #" + testNumber);
break;
}
didDialog = true;
if (!doNothing) {
SpecialPowers.addObserver(outerWindowObserver, "outer-window-destroyed", false);
if (clickOK)
dialog.acceptDialog();
else
dialog.cancelDialog();
}
- ok(true, "handleDialog done for test " + testNum);
+ ok(true, "handleDialog done for test " + testNumber);
- if (testNum == 4)
+ if (testNumber == 4)
checkTest4A();
}
var outerWindowObserver = {
observe: function(id) {
SpecialPowers.removeObserver(outerWindowObserver, "outer-window-destroyed");
var func;
if (testNum == 1)
--- a/toolkit/components/passwordmgr/test/test_prompt_async.html
+++ b/toolkit/components/passwordmgr/test/test_prompt_async.html
@@ -184,31 +184,31 @@
doCheck(testNum);
monitor.reset();
testNum++;
doTest(testNum);
}
}
- function doTest(testNum)
+ function doTest(testNumber)
{
/*
* These contentDocument variables are located here,
* rather than in the global scope, because SpecialPowers threw
* errors (complaining that the objects were deleted)
* when these were in the global scope.
*/
var iframe1Doc = SpecialPowers.wrap(iframe1).contentDocument;
var iframe2aDoc = SpecialPowers.wrap(iframe2a).contentDocument;
var iframe2bDoc = SpecialPowers.wrap(iframe2b).contentDocument;
var exampleCom = "http://example.com/tests/toolkit/components/passwordmgr/test/";
var exampleOrg = "http://example.org/tests/toolkit/components/passwordmgr/test/";
- switch (testNum)
+ switch (testNumber)
{
case 1:
// Load through a single proxy with authentication required 3 different
// pages, first with one login, other two with their own different login.
// We expect to show just a single dialog for proxy authentication and
// then two dialogs to authenticate to login 1 and then login 2.
ok(true, "doTest testNum 1");
expectedLoads = 3;
@@ -351,21 +351,21 @@
case 9:
finishTest();
return;
}
startCallbackTimer();
}
- function handleDialog(doc, testNum)
+ function handleDialog(doc, testNumber)
{
var dialog = doc.getElementById("commonDialog");
- switch (testNum)
+ switch (testNumber)
{
case 1:
case 2:
dialog.acceptDialog();
break;
case 3:
dialog.cancelDialog();
@@ -398,32 +398,32 @@
case 8:
if (expectedDialogs == 3 || expectedDialogs == 1)
dialog.acceptDialog();
else
dialog.cancelDialog();
break;
default:
- ok(false, "Unhandled testNum " + testNum + " in handleDialog");
+ ok(false, "Unhandled testNum " + testNumber + " in handleDialog");
}
if (--expectedDialogs > 0)
startCallbackTimer();
}
- function doCheck(testNum)
+ function doCheck(testNumber)
{
var iframe1Doc = SpecialPowers.wrap(iframe1).contentDocument;
var iframe2aDoc = SpecialPowers.wrap(iframe2a).contentDocument;
var iframe2bDoc = SpecialPowers.wrap(iframe2b).contentDocument;
var authok1;
var proxyok1;
var footnote;
- switch (testNum)
+ switch (testNumber)
{
case 1:
ok(true, "doCheck testNum 1");
is(monitor.windowsRegistered, 3, "Registered 3 open dialogs");
authok1 = iframe1Doc.getElementById("ok").textContent;
proxyok1 = iframe1Doc.getElementById("proxy").textContent;
@@ -521,17 +521,17 @@
is(authok1, "PASS", "WWW Authorization OK, frame1");
is(proxyok1, "PASS", "Proxy Authorization OK, frame1");
is(footnote, "This is a footnote after the huge content fill",
"Footnote present and loaded completely");
break;
default:
- ok(false, "Unhandled testNum " + testNum + " in doCheck");
+ ok(false, "Unhandled testNum " + testNumber + " in doCheck");
}
}
</script>
</head>
<body>
<iframe id="iframe1"></iframe>
<iframe id="iframe2a"></iframe>
--- a/toolkit/components/passwordmgr/test/unit/test_context_menu.js
+++ b/toolkit/components/passwordmgr/test/unit/test_context_menu.js
@@ -84,20 +84,20 @@ function createLoginsFragment(url, conte
};
}
/**
* Check if every login have it's corresponding menuitem.
* Duplicates and empty usernames have a date appended.
*/
function checkLoginItems(logins, items) {
- function findDuplicates(loginList) {
+ function findDuplicates(unfilteredLoginList) {
var seen = new Set();
var duplicates = new Set();
- for (let login of loginList) {
+ for (let login of unfilteredLoginList) {
if (seen.has(login.username)) {
duplicates.add(login.username);
}
seen.add(login.username);
}
return duplicates;
}
let duplicates = findDuplicates(logins);
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks.js
@@ -180,17 +180,17 @@ add_task(function* test_bookmarks() {
let title = bs.getItemTitle(newId);
do_check_eq(title, "Google");
// test getItemType for bookmarks
do_check_eq(bs.getItemType(newId), bs.TYPE_BOOKMARK);
// get item title bad input
try {
- let title = bs.getItemTitle(-3);
+ bs.getItemTitle(-3);
do_throw("getItemTitle accepted bad input");
} catch (ex) {}
// get the folder that the bookmark is in
let folderId = bs.getFolderIdForItem(newId);
do_check_eq(folderId, testRoot);
// test getItemIndex for bookmarks
@@ -365,18 +365,18 @@ add_task(function* test_bookmarks() {
} catch (ex) {
do_throw("removeFolderChildren(): " + ex);
}
// XXX - test folderReadOnly
// test bookmark id in query output
try {
- let options = hs.getNewQueryOptions();
- let query = hs.getNewQuery();
+ options = hs.getNewQueryOptions();
+ query = hs.getNewQuery();
query.setFolders([testRoot], 1);
let result = hs.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let cc = rootNode.childCount;
do_print("bookmark itemId test: CC = " + cc);
do_check_true(cc > 0);
for (let i=0; i < cc; ++i) {
@@ -404,18 +404,18 @@ add_task(function* test_bookmarks() {
let mURI = uri("http://multiple.uris.in.query");
let testFolder = bs.createFolder(testRoot, "test Folder", bs.DEFAULT_INDEX);
// add 2 bookmarks
bs.insertBookmark(testFolder, mURI, bs.DEFAULT_INDEX, "title 1");
bs.insertBookmark(testFolder, mURI, bs.DEFAULT_INDEX, "title 2");
// query
- let options = hs.getNewQueryOptions();
- let query = hs.getNewQuery();
+ options = hs.getNewQueryOptions();
+ query = hs.getNewQuery();
query.setFolders([testFolder], 1);
let result = hs.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let cc = rootNode.childCount;
do_check_eq(cc, 2);
do_check_eq(rootNode.getChild(0).title, "title 1");
do_check_eq(rootNode.getChild(1).title, "title 2");
@@ -494,20 +494,20 @@ add_task(function* test_bookmarks() {
anno.setItemAnnotation(newId3, "test-annotation", "foo", 0, 0);
do_check_eq(bookmarksObserver._itemChangedId, newId3);
do_check_eq(bookmarksObserver._itemChangedProperty, "test-annotation");
do_check_true(bookmarksObserver._itemChanged_isAnnotationProperty);
do_check_eq(bookmarksObserver._itemChangedValue, "");
// test search on bookmark title ZZZXXXYYY
try {
- let options = hs.getNewQueryOptions();
+ options = hs.getNewQueryOptions();
options.excludeQueries = 1;
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
- let query = hs.getNewQuery();
+ query = hs.getNewQuery();
query.searchTerms = "ZZZXXXYYY";
let result = hs.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let cc = rootNode.childCount;
do_check_eq(cc, 1);
let node = rootNode.getChild(0);
do_check_eq(node.title, "ZZZXXXYYY");
@@ -516,20 +516,20 @@ add_task(function* test_bookmarks() {
}
catch (ex) {
do_throw("bookmarks query: " + ex);
}
// test dateAdded and lastModified properties
// for a search query
try {
- let options = hs.getNewQueryOptions();
+ options = hs.getNewQueryOptions();
options.excludeQueries = 1;
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
- let query = hs.getNewQuery();
+ query = hs.getNewQuery();
query.searchTerms = "ZZZXXXYYY";
let result = hs.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let cc = rootNode.childCount;
do_check_eq(cc, 1);
let node = rootNode.getChild(0);
@@ -543,18 +543,18 @@ add_task(function* test_bookmarks() {
}
catch (ex) {
do_throw("bookmarks query: " + ex);
}
// test dateAdded and lastModified properties
// for a folder query
try {
- let options = hs.getNewQueryOptions();
- let query = hs.getNewQuery();
+ options = hs.getNewQueryOptions();
+ query = hs.getNewQuery();
query.setFolders([testRoot], 1);
let result = hs.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let cc = rootNode.childCount;
do_check_true(cc > 0);
for (let i = 0; i < cc; i++) {
let node = rootNode.getChild(i);
--- a/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage.js
+++ b/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage.js
@@ -131,22 +131,22 @@ function test() {
// we can set the preference back to true immediately. We don't clear the
// preference because not all products enable Places by default.
aWindow.Services.prefs.setBoolPref("places.history.enabled", true);
}
getIconFile(function () {
testOnWindow({}, function(aWin) {
testNormal(aWin, function () {
- testOnWindow({}, function(aWin) {
- testAboutURIBookmarked(aWin, function () {
- testOnWindow({private: true}, function(aWin) {
- testPrivateBrowsingBookmarked(aWin, function () {
- testOnWindow({}, function(aWin) {
- testDisabledHistoryBookmarked(aWin, finish);
+ testOnWindow({}, function(aWin2) {
+ testAboutURIBookmarked(aWin2, function () {
+ testOnWindow({private: true}, function(aWin3) {
+ testPrivateBrowsingBookmarked(aWin3, function () {
+ testOnWindow({}, function(aWin4) {
+ testDisabledHistoryBookmarked(aWin4, finish);
});
});
});
});
});
});
});
});
--- a/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage_failures.js
+++ b/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage_failures.js
@@ -17,17 +17,16 @@ function test() {
let favIcon16URI = NetUtil.newURI(favIcon16Location);
let favIcon32URI = NetUtil.newURI(favIcon32Location);
let lastPageURI = NetUtil.newURI("http://example.com/verification");
// This error icon must stay in sync with FAVICON_ERRORPAGE_URL in
// nsIFaviconService.idl, aboutCertError.xhtml and netError.xhtml.
let favIconErrorPageURI =
NetUtil.newURI("chrome://global/skin/icons/warning-16.png");
let favIconsResultCount = 0;
- let pageURI;
function testOnWindow(aOptions, aCallback) {
whenNewWindowLoaded(aOptions, function(aWin) {
windowsToClose.push(aWin);
executeSoon(() => aCallback(aWin));
});
}
@@ -223,30 +222,30 @@ function test() {
aWindow.PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, null,
Services.scriptSecurityManager.getSystemPrincipal());
});
}
checkFavIconsDBCount(function () {
testOnWindow({}, function(aWin) {
testNullPageURI(aWin, function () {
- testOnWindow({}, function(aWin) {
- testNullFavIconURI(aWin, function() {
- testOnWindow({}, function(aWin) {
- testAboutURI(aWin, function() {
- testOnWindow({private: true}, function(aWin) {
- testPrivateBrowsingNonBookmarkedURI(aWin, function () {
- testOnWindow({}, function(aWin) {
- testDisabledHistory(aWin, function () {
- testOnWindow({}, function(aWin) {
- testErrorIcon(aWin, function() {
- testOnWindow({}, function(aWin) {
- testNonExistingPage(aWin, function() {
- testOnWindow({}, function(aWin) {
- testFinalVerification(aWin, function() {
+ testOnWindow({}, function(aWin2) {
+ testNullFavIconURI(aWin2, function() {
+ testOnWindow({}, function(aWin3) {
+ testAboutURI(aWin3, function() {
+ testOnWindow({private: true}, function(aWin4) {
+ testPrivateBrowsingNonBookmarkedURI(aWin4, function () {
+ testOnWindow({}, function(aWin5) {
+ testDisabledHistory(aWin5, function () {
+ testOnWindow({}, function(aWin6) {
+ testErrorIcon(aWin6, function() {
+ testOnWindow({}, function(aWin7) {
+ testNonExistingPage(aWin7, function() {
+ testOnWindow({}, function(aWin8) {
+ testFinalVerification(aWin8, function() {
finish();
});
});
});
});
});
});
});
--- a/toolkit/components/places/tests/browser/browser_redirect.js
+++ b/toolkit/components/places/tests/browser/browser_redirect.js
@@ -25,21 +25,21 @@ add_task(function* () {
ok(this._redirectNotified, "The redirect should have been notified");
fieldForUrl(REDIRECT_URI, "frecency", function (aFrecency) {
ok(aFrecency != 0, "Frecency or the redirecting page should not be 0");
fieldForUrl(REDIRECT_URI, "hidden", function (aHidden) {
is(aHidden, 1, "The redirecting page should be hidden");
- fieldForUrl(TARGET_URI, "frecency", function (aFrecency) {
- ok(aFrecency != 0, "Frecency of the target page should not be 0");
+ fieldForUrl(TARGET_URI, "frecency", function (aFrecency2) {
+ ok(aFrecency2 != 0, "Frecency of the target page should not be 0");
- fieldForUrl(TARGET_URI, "hidden", function (aHidden) {
- is(aHidden, 0, "The target page should not be hidden");
+ fieldForUrl(TARGET_URI, "hidden", function (aHidden2) {
+ is(aHidden2, 0, "The target page should not be hidden");
resolve();
});
});
});
});
},
onBeginUpdateBatch: function () {},
onEndUpdateBatch: function () {},
--- a/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing_perwindowpb.js
+++ b/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing_perwindowpb.js
@@ -59,16 +59,16 @@ function test() {
aWin.close();
});
});
// test first when on private mode
testOnWindow({private: true}, function(aWin) {
doTest(true, aWin, initialURL, function() {
// then test when not on private mode
- testOnWindow({}, function(aWin) {
- doTest(false, aWin, finalURL, function () {
+ testOnWindow({}, function(aWin2) {
+ doTest(false, aWin2, finalURL, function () {
PlacesTestUtils.clearHistory().then(finish);
});
});
});
});
}
--- a/toolkit/components/places/tests/browser/head.js
+++ b/toolkit/components/places/tests/browser/head.js
@@ -283,17 +283,17 @@ function whenNewWindowLoaded(aOptions, a
* @param aURI The URI.
* @param aExpectedValue The expected value.
* @return {Promise}
* @resolves When the check has been added successfully.
* @rejects JavaScript exception.
*/
function promiseIsURIVisited(aURI, aExpectedValue) {
return new Promise(resolve => {
- PlacesUtils.asyncHistory.isURIVisited(aURI, function(aURI, aIsVisited) {
+ PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
resolve(aIsVisited);
});
});
}
function waitForCondition(condition, nextTest, errorMsg) {
let tries = 0;
let interval = setInterval(function() {
--- a/toolkit/components/places/tests/expiration/test_annos_expire_policy.js
+++ b/toolkit/components/places/tests/expiration/test_annos_expire_policy.js
@@ -77,21 +77,21 @@ function run_test() {
add_task(function* test_annos_expire_policy() {
// Set interval to a large value so we don't expire on it.
setInterval(3600); // 1h
// Expire all expirable pages.
setMaxPages(0);
- let now = getExpirablePRTime();
+ let now_specific_to_test = getExpirablePRTime();
// Add some bookmarked page and timed annotations for each.
for (let i = 0; i < 5; i++) {
let pageURI = uri("http://item_anno." + i + ".mozilla.org/");
- yield PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now++ });
+ yield PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now_specific_to_test++ });
let bm = yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: pageURI,
title: null
});
let id = yield PlacesUtils.promiseItemId(bm.guid);
// Add a 6 days old anno.
add_old_anno(id, "persist_days", "test", as.EXPIRE_DAYS, 6);
@@ -134,17 +134,17 @@ add_task(function* test_annos_expire_pol
add_old_anno(pageURI, "persist_lm_months", "test", as.EXPIRE_MONTHS, 181, 179);
// Add a 181 days old anno.
add_old_anno(pageURI, "expire_months", "test", as.EXPIRE_MONTHS, 181);
}
// Add some visited page and timed annotations for each.
for (let i = 0; i < 5; i++) {
let pageURI = uri("http://page_anno." + i + ".mozilla.org/");
- yield PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now++ });
+ yield PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now_specific_to_test++ });
// Add a 6 days old anno.
add_old_anno(pageURI, "persist_days", "test", as.EXPIRE_DAYS, 6);
// Add a 8 days old anno, modified 5 days ago.
add_old_anno(pageURI, "persist_lm_days", "test", as.EXPIRE_DAYS, 8, 6);
// Add a 8 days old anno.
add_old_anno(pageURI, "expire_days", "test", as.EXPIRE_DAYS, 8);
// Add a 29 days old anno.
--- a/toolkit/components/places/tests/expiration/test_pref_interval.js
+++ b/toolkit/components/places/tests/expiration/test_pref_interval.js
@@ -36,18 +36,16 @@ var tests = [
{ desc: "Set interval to a large value.",
interval: 100,
expectedTimerDelay: 100
},
];
-var currentTest;
-
add_task(function* test() {
// The pref should not exist by default.
Assert.throws(() => getInterval());
// Force the component, so it will start observing preferences.
force_expiration_start();
for (let currentTest of tests) {
--- a/toolkit/components/places/tests/head_common.js
+++ b/toolkit/components/places/tests/head_common.js
@@ -365,19 +365,19 @@ function check_no_bookmarks() {
*
* @return {Promise}
* @resolves The array [aSubject, aData] from the observed notification.
* @rejects Never.
*/
function promiseTopicObserved(aTopic)
{
return new Promise(resolve => {
- Services.obs.addObserver(function observe(aSubject, aTopic, aData) {
- Services.obs.removeObserver(observe, aTopic);
- resolve([aSubject, aData]);
+ Services.obs.addObserver(function observe(aObsSubject, aObsTopic, aObsData) {
+ Services.obs.removeObserver(observe, aObsTopic);
+ resolve([aObsSubject, aObsData]);
}, aTopic, false);
});
}
/**
* Simulates a Places shutdown.
*/
var shutdownPlaces = function() {
@@ -816,17 +816,17 @@ NavHistoryResultObserver.prototype = {
* @param aURI The URI.
* @return {Promise}
* @resolves When the check has been added successfully.
* @rejects JavaScript exception.
*/
function promiseIsURIVisited(aURI) {
let deferred = Promise.defer();
- PlacesUtils.asyncHistory.isURIVisited(aURI, function(aURI, aIsVisited) {
+ PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
deferred.resolve(aIsVisited);
});
return deferred.promise;
}
/**
* Asynchronously set the favicon associated with a page.
--- a/toolkit/components/places/tests/history/test_remove.js
+++ b/toolkit/components/places/tests/history/test_remove.js
@@ -39,27 +39,27 @@ add_task(function* test_remove_single()
}
let shouldRemove = !options.addBookmark;
let observer;
let promiseObserved = new Promise((resolve, reject) => {
observer = {
onBeginUpdateBatch: function() {},
onEndUpdateBatch: function() {},
- onVisit: function(uri) {
- reject(new Error("Unexpected call to onVisit " + uri.spec));
+ onVisit: function(aUri) {
+ reject(new Error("Unexpected call to onVisit " + aUri.spec));
},
- onTitleChanged: function(uri) {
- reject(new Error("Unexpected call to onTitleChanged " + uri.spec));
+ onTitleChanged: function(aUri) {
+ reject(new Error("Unexpected call to onTitleChanged " + aUri.spec));
},
onClearHistory: function() {
reject("Unexpected call to onClearHistory");
},
- onPageChanged: function(uri) {
- reject(new Error("Unexpected call to onPageChanged " + uri.spec));
+ onPageChanged: function(aUri) {
+ reject(new Error("Unexpected call to onPageChanged " + aUri.spec));
},
onFrecencyChanged: function(aURI) {
try {
Assert.ok(!shouldRemove, "Observing onFrecencyChanged");
Assert.equal(aURI.spec, uri.spec, "Observing effect on the right uri");
} finally {
resolve();
}
--- a/toolkit/components/places/tests/queries/head_queries.js
+++ b/toolkit/components/places/tests/queries/head_queries.js
@@ -36,21 +36,21 @@ const olderthansixmonths = today - (DAY_
* Generalized function to pull in an array of objects of data and push it into
* the database. It does NOT do any checking to see that the input is
* appropriate. This function is an asynchronous task, it can be called using
* "Task.spawn" or using the "yield" function inside another task.
*/
function* task_populateDB(aArray)
{
// Iterate over aArray and execute all instructions.
- for (let data of aArray) {
+ for (let arrayItem of aArray) {
try {
// make the data object into a query data object in order to create proper
// default values for anything left unspecified
- var qdata = new queryData(data);
+ var qdata = new queryData(arrayItem);
if (qdata.isVisit) {
// Then we should add a visit for this node
yield PlacesTestUtils.addVisits({
uri: uri(qdata.uri),
transition: qdata.transType,
visitDate: qdata.lastVisit,
referrer: qdata.referrer ? uri(qdata.referrer) : null,
title: qdata.title
@@ -179,18 +179,18 @@ function* task_populateDB(aArray)
if (qdata.isSeparator) {
yield PlacesUtils.bookmarks.insert({
parentGuid: qdata.parentGuid,
type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
index: qdata.index
});
}
} catch (ex) {
- // use the data object here in case instantiation of qdata failed
- do_print("Problem with this URI: " + data.uri);
+ // use the arrayItem object here in case instantiation of qdata failed
+ do_print("Problem with this URI: " + arrayItem.uri);
do_throw("Error creating database: " + ex + "\n");
}
}
}
/**
* The Query Data Object - this object encapsulates data for our queries and is
--- a/toolkit/components/places/tests/queries/test_results-as-visit.js
+++ b/toolkit/components/places/tests/queries/test_results-as-visit.js
@@ -56,17 +56,17 @@ add_task(function* test_results_as_visit
options.resultType = options.RESULTS_AS_VISIT;
// Results
var result = PlacesUtils.history.executeQuery(query, options);
var root = result.root;
root.containerOpen = true;
do_print("Number of items in result set: " + root.childCount);
- for (var i=0; i < root.childCount; ++i) {
+ for (let i=0; i < root.childCount; ++i) {
do_print("result: " + root.getChild(i).uri + " Title: " + root.getChild(i).title);
}
// Check our inital result set
compareArrayToResult(testData, root);
// If that passes, check liveupdate
// Add to the query set
--- a/toolkit/components/places/tests/unit/test_408221.js
+++ b/toolkit/components/places/tests/unit/test_408221.js
@@ -87,17 +87,17 @@ function ensure_tag_results(uris, search
};
input.onSearchComplete = function() {
do_check_eq(numSearchesStarted, 1);
do_check_eq(controller.searchStatus,
Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH);
do_check_eq(controller.matchCount, uris.length);
let vals = [];
- for (var i=0; i<controller.matchCount; i++) {
+ for (let i=0; i<controller.matchCount; i++) {
// Keep the URL for later because order of tag results is undefined
vals.push(controller.getValueAt(i));
do_check_eq(controller.getStyleAt(i), "bookmark-tag");
}
// Sort the results then check if we have the right items
vals.sort().forEach((val, i) => do_check_eq(val, uris[i].spec))
if (current_test < (tests.length - 1)) {
--- a/toolkit/components/places/tests/unit/test_415757.js
+++ b/toolkit/components/places/tests/unit/test_415757.js
@@ -66,17 +66,17 @@ add_task(function* test_execute()
testAnnoRetainedName,
testAnnoRetainedValue, 0,
PlacesUtils.annotations.EXPIRE_WITH_HISTORY);
// remove pages from www.test.com
PlacesUtils.history.removePagesFromHost("www.test.com", false);
// check that all pages in www.test.com have been removed
- for (var i = 0; i < TOTAL_SITES; i++) {
+ for (let i = 0; i < TOTAL_SITES; i++) {
let site = "http://www.test.com/" + i + "/";
let testURI = uri(site);
do_check_false(uri_in_db(testURI));
}
// check that all pages in www.test-X.com have NOT been removed
for (let i = 0; i < TOTAL_SITES; i++) {
let site = "http://www.test-" + i + ".com/";
--- a/toolkit/components/places/tests/unit/test_async_transactions.js
+++ b/toolkit/components/places/tests/unit/test_async_transactions.js
@@ -446,32 +446,32 @@ add_task(function* test_new_bookmark() {
});
add_task(function* test_merge_create_folder_and_item() {
let folder_info = createTestFolderInfo();
let bm_info = { url: NetUtil.newURI("http://test_create_item_to_folder.com")
, title: "Test Bookmark"
, index: bmStartIndex };
- let { folderTxn, bkmTxn } = yield PT.batch(function* () {
+ let [folderTxnResult, bkmTxnResult] = yield PT.batch(function* () {
let folderTxn = PT.NewFolder(folder_info);
folder_info.guid = bm_info.parentGuid = yield folderTxn.transact();
let bkmTxn = PT.NewBookmark(bm_info);
bm_info.guid = yield bkmTxn.transact();
- return { folderTxn, bkmTxn };
+ return [folderTxn, bkmTxn];
});
let ensureDo = function* () {
- ensureUndoState([[bkmTxn, folderTxn]], 0);
+ ensureUndoState([[bkmTxnResult, folderTxnResult]], 0);
yield ensureItemsAdded(folder_info, bm_info);
observer.reset();
};
let ensureUndo = () => {
- ensureUndoState([[bkmTxn, folderTxn]], 1);
+ ensureUndoState([[bkmTxnResult, folderTxnResult]], 1);
ensureItemsRemoved(folder_info, bm_info);
observer.reset();
};
yield ensureDo();
yield PT.undo();
ensureUndo();
yield PT.redo();
@@ -486,45 +486,45 @@ add_task(function* test_merge_create_fol
add_task(function* test_move_items_to_folder() {
let folder_a_info = createTestFolderInfo("Folder A");
let bkm_a_info = { url: new URL("http://test_move_items.com")
, title: "Bookmark A" };
let bkm_b_info = { url: NetUtil.newURI("http://test_move_items.com")
, title: "Bookmark B" };
// Test moving items within the same folder.
- let [folder_a_txn, bkm_a_txn, bkm_b_txn] = yield PT.batch(function* () {
+ let [folder_a_txn_result, bkm_a_txn_result, bkm_b_txn_result] = yield PT.batch(function* () {
let folder_a_txn = PT.NewFolder(folder_a_info);
folder_a_info.guid = bkm_a_info.parentGuid = bkm_b_info.parentGuid =
yield folder_a_txn.transact();
let bkm_a_txn = PT.NewBookmark(bkm_a_info);
bkm_a_info.guid = yield bkm_a_txn.transact();
let bkm_b_txn = PT.NewBookmark(bkm_b_info);
bkm_b_info.guid = yield bkm_b_txn.transact();
return [folder_a_txn, bkm_a_txn, bkm_b_txn];
});
- ensureUndoState([[bkm_b_txn, bkm_a_txn, folder_a_txn]], 0);
+ ensureUndoState([[bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 0);
let moveTxn = PT.Move({ guid: bkm_a_info.guid
, newParentGuid: folder_a_info.guid });
yield moveTxn.transact();
let ensureDo = () => {
- ensureUndoState([[moveTxn], [bkm_b_txn, bkm_a_txn, folder_a_txn]], 0);
+ ensureUndoState([[moveTxn], [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 0);
ensureItemsMoved({ guid: bkm_a_info.guid
, oldParentGuid: folder_a_info.guid
, newParentGuid: folder_a_info.guid
, oldIndex: 0
, newIndex: 1 });
observer.reset();
};
let ensureUndo = () => {
- ensureUndoState([[moveTxn], [bkm_b_txn, bkm_a_txn, folder_a_txn]], 1);
+ ensureUndoState([[moveTxn], [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 1);
ensureItemsMoved({ guid: bkm_a_info.guid
, oldParentGuid: folder_a_info.guid
, newParentGuid: folder_a_info.guid
, oldIndex: 1
, newIndex: 0 });
observer.reset();
};
@@ -532,45 +532,45 @@ add_task(function* test_move_items_to_fo
yield PT.undo();
ensureUndo();
yield PT.redo();
ensureDo();
yield PT.undo();
ensureUndo();
yield PT.clearTransactionsHistory(false, true);
- ensureUndoState([[bkm_b_txn, bkm_a_txn, folder_a_txn]], 0);
+ ensureUndoState([[bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 0);
// Test moving items between folders.
let folder_b_info = createTestFolderInfo("Folder B");
let folder_b_txn = PT.NewFolder(folder_b_info);
folder_b_info.guid = yield folder_b_txn.transact();
ensureUndoState([ [folder_b_txn]
- , [bkm_b_txn, bkm_a_txn, folder_a_txn] ], 0);
+ , [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 0);
moveTxn = PT.Move({ guid: bkm_a_info.guid
, newParentGuid: folder_b_info.guid
, newIndex: bmsvc.DEFAULT_INDEX });
yield moveTxn.transact();
ensureDo = () => {
ensureUndoState([ [moveTxn]
, [folder_b_txn]
- , [bkm_b_txn, bkm_a_txn, folder_a_txn] ], 0);
+ , [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 0);
ensureItemsMoved({ guid: bkm_a_info.guid
, oldParentGuid: folder_a_info.guid
, newParentGuid: folder_b_info.guid
, oldIndex: 0
, newIndex: 0 });
observer.reset();
};
ensureUndo = () => {
ensureUndoState([ [moveTxn]
, [folder_b_txn]
- , [bkm_b_txn, bkm_a_txn, folder_a_txn] ], 1);
+ , [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 1);
ensureItemsMoved({ guid: bkm_a_info.guid
, oldParentGuid: folder_b_info.guid
, newParentGuid: folder_a_info.guid
, oldIndex: 0
, newIndex: 0 });
observer.reset();
};
@@ -583,101 +583,101 @@ add_task(function* test_move_items_to_fo
ensureUndo();
// Clean up
yield PT.undo(); // folder_b_txn
yield PT.undo(); // folder_a_txn + the bookmarks;
do_check_eq(observer.itemsRemoved.size, 4);
ensureUndoState([ [moveTxn]
, [folder_b_txn]
- , [bkm_b_txn, bkm_a_txn, folder_a_txn] ], 3);
+ , [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 3);
yield PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(function* test_remove_folder() {
let folder_level_1_info = createTestFolderInfo("Folder Level 1");
let folder_level_2_info = { title: "Folder Level 2" };
- let [folder_level_1_txn,
- folder_level_2_txn] = yield PT.batch(function* () {
+ let [folder_level_1_txn_result,
+ folder_level_2_txn_result] = yield PT.batch(function* () {
let folder_level_1_txn = PT.NewFolder(folder_level_1_info);
folder_level_1_info.guid = yield folder_level_1_txn.transact();
folder_level_2_info.parentGuid = folder_level_1_info.guid;
let folder_level_2_txn = PT.NewFolder(folder_level_2_info);
folder_level_2_info.guid = yield folder_level_2_txn.transact();
return [folder_level_1_txn, folder_level_2_txn];
});
- ensureUndoState([[folder_level_2_txn, folder_level_1_txn]]);
+ ensureUndoState([[folder_level_2_txn_result, folder_level_1_txn_result]]);
yield ensureItemsAdded(folder_level_1_info, folder_level_2_info);
observer.reset();
let remove_folder_2_txn = PT.Remove(folder_level_2_info);
yield remove_folder_2_txn.transact();
ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn, folder_level_1_txn] ]);
+ , [folder_level_2_txn_result, folder_level_1_txn_result] ]);
yield ensureItemsRemoved(folder_level_2_info);
// Undo Remove "Folder Level 2"
yield PT.undo();
ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn, folder_level_1_txn] ], 1);
+ , [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
yield ensureItemsAdded(folder_level_2_info);
ensureTimestampsUpdated(folder_level_2_info.guid, true);
observer.reset();
// Redo Remove "Folder Level 2"
yield PT.redo();
ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn, folder_level_1_txn] ]);
+ , [folder_level_2_txn_result, folder_level_1_txn_result] ]);
yield ensureItemsRemoved(folder_level_2_info);
observer.reset();
// Undo it again
yield PT.undo();
ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn, folder_level_1_txn] ], 1);
+ , [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
yield ensureItemsAdded(folder_level_2_info);
ensureTimestampsUpdated(folder_level_2_info.guid, true);
observer.reset();
// Undo the creation of both folders
yield PT.undo();
ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn, folder_level_1_txn] ], 2);
+ , [folder_level_2_txn_result, folder_level_1_txn_result] ], 2);
yield ensureItemsRemoved(folder_level_2_info, folder_level_1_info);
observer.reset();
// Redo the creation of both folders
yield PT.redo();
ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn, folder_level_1_txn] ], 1);
+ , [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
yield ensureItemsAdded(folder_level_1_info, folder_level_2_info);
ensureTimestampsUpdated(folder_level_1_info.guid, true);
ensureTimestampsUpdated(folder_level_2_info.guid, true);
observer.reset();
// Redo Remove "Folder Level 2"
yield PT.redo();
ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn, folder_level_1_txn] ]);
+ , [folder_level_2_txn_result, folder_level_1_txn_result] ]);
yield ensureItemsRemoved(folder_level_2_info);
observer.reset();
// Undo everything one last time
yield PT.undo();
ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn, folder_level_1_txn] ], 1);
+ , [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
yield ensureItemsAdded(folder_level_2_info);
observer.reset();
yield PT.undo();
ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn, folder_level_1_txn] ], 2);
+ , [folder_level_2_txn_result, folder_level_1_txn_result] ], 2);
yield ensureItemsRemoved(folder_level_2_info, folder_level_2_info);
observer.reset();
yield PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(function* test_add_and_remove_bookmarks_with_additional_info() {
--- a/toolkit/components/places/tests/unit/test_bookmarks_html.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_html.js
@@ -199,17 +199,17 @@ add_task(function* test_import_chromefav
PlacesUtils.favicons.setAndFetchFaviconForPage(
PAGE_URI, CHROME_FAVICON_URI, true,
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
resolve, Services.scriptSecurityManager.getSystemPrincipal());
});
let data = yield new Promise(resolve => {
PlacesUtils.favicons.getFaviconDataForPage(
- PAGE_URI, (uri, dataLen, data, mimeType) => resolve(data));
+ PAGE_URI, (uri, dataLen, faviconData, mimeType) => resolve(faviconData));
});
let base64Icon = "data:image/png;base64," +
base64EncodeString(String.fromCharCode.apply(String, data));
test_bookmarks.unfiled.push(
{ title: "Test", url: PAGE_URI.spec, icon: base64Icon });
--- a/toolkit/components/places/tests/unit/test_bookmarks_html_corrupt.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_html_corrupt.js
@@ -26,17 +26,17 @@ add_task(function* test_corrupt_file() {
yield database_check();
});
add_task(function* test_corrupt_database() {
// Create corruption in the database, then export.
let corruptBookmark = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.toolbarGuid,
url: "http://test.mozilla.org",
title: "We love belugas" });
- let db = yield PlacesUtils.withConnectionWrapper("test", Task.async(function*(db) {
+ yield PlacesUtils.withConnectionWrapper("test", Task.async(function*(db) {
yield db.execute("UPDATE moz_bookmarks SET fk = NULL WHERE guid = :guid",
{ guid: corruptBookmark.guid });
}));
let bookmarksFile = OS.Path.join(OS.Constants.Path.profileDir, "bookmarks.exported.html");
if ((yield OS.File.exists(bookmarksFile)))
yield OS.File.remove(bookmarksFile);
yield BookmarkHTMLUtils.exportToFile(bookmarksFile);
--- a/toolkit/components/places/tests/unit/test_download_history.js
+++ b/toolkit/components/places/tests/unit/test_download_history.js
@@ -80,18 +80,18 @@ add_test(function test_dh_is_from_places
add_test(function test_dh_addRemoveDownload()
{
waitForOnVisit(function DHAD_onVisit(aURI) {
do_check_true(aURI.equals(DOWNLOAD_URI));
// Verify that the URI is already available in results at this time.
do_check_true(!!page_in_database(DOWNLOAD_URI));
- waitForOnDeleteURI(function DHRAD_onDeleteURI(aURI) {
- do_check_true(aURI.equals(DOWNLOAD_URI));
+ waitForOnDeleteURI(function DHRAD_onDeleteURI(aDeletedURI) {
+ do_check_true(aDeletedURI.equals(DOWNLOAD_URI));
// Verify that the URI is already available in results at this time.
do_check_false(!!page_in_database(DOWNLOAD_URI));
run_next_test();
});
gDownloadHistory.removeAllDownloads();
});
@@ -104,18 +104,18 @@ add_test(function test_dh_addMultiRemove
PlacesTestUtils.addVisits({
uri: DOWNLOAD_URI,
transition: TRANSITION_TYPED
}).then(function () {
waitForOnVisit(function DHAD_onVisit(aURI) {
do_check_true(aURI.equals(DOWNLOAD_URI));
do_check_true(!!page_in_database(DOWNLOAD_URI));
- waitForOnDeleteVisits(function DHRAD_onDeleteVisits(aURI) {
- do_check_true(aURI.equals(DOWNLOAD_URI));
+ waitForOnDeleteVisits(function DHRAD_onDeleteVisits(aDeletedURI) {
+ do_check_true(aDeletedURI.equals(DOWNLOAD_URI));
do_check_true(!!page_in_database(DOWNLOAD_URI));
PlacesTestUtils.clearHistory().then(run_next_test);
});
gDownloadHistory.removeAllDownloads();
});
gDownloadHistory.addDownload(DOWNLOAD_URI, null, Date.now() * 1000);
@@ -127,37 +127,37 @@ add_test(function test_dh_addBookmarkRem
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
DOWNLOAD_URI,
PlacesUtils.bookmarks.DEFAULT_INDEX,
"A bookmark");
waitForOnVisit(function DHAD_onVisit(aURI) {
do_check_true(aURI.equals(DOWNLOAD_URI));
do_check_true(!!page_in_database(DOWNLOAD_URI));
- waitForOnDeleteVisits(function DHRAD_onDeleteVisits(aURI) {
- do_check_true(aURI.equals(DOWNLOAD_URI));
+ waitForOnDeleteVisits(function DHRAD_onDeleteVisits(aDeletedURI) {
+ do_check_true(aDeletedURI.equals(DOWNLOAD_URI));
do_check_true(!!page_in_database(DOWNLOAD_URI));
PlacesTestUtils.clearHistory().then(run_next_test);
});
gDownloadHistory.removeAllDownloads();
});
gDownloadHistory.addDownload(DOWNLOAD_URI, null, Date.now() * 1000);
});
add_test(function test_dh_addDownload_referrer()
{
waitForOnVisit(function DHAD_prepareReferrer(aURI, aVisitID) {
do_check_true(aURI.equals(REFERRER_URI));
let referrerVisitId = aVisitID;
- waitForOnVisit(function DHAD_onVisit(aURI, aVisitID, aTime, aSessionID,
- aReferringID) {
- do_check_true(aURI.equals(DOWNLOAD_URI));
+ waitForOnVisit(function DHAD_onVisit(aVisitedURI, unused, unused2, unused3,
+ aReferringID) {
+ do_check_true(aVisitedURI.equals(DOWNLOAD_URI));
do_check_eq(aReferringID, referrerVisitId);
// Verify that the URI is already available in results at this time.
do_check_true(!!page_in_database(DOWNLOAD_URI));
PlacesTestUtils.clearHistory().then(run_next_test);
});
--- a/toolkit/components/places/tests/unit/test_getPlacesInfo.js
+++ b/toolkit/components/places/tests/unit/test_getPlacesInfo.js
@@ -57,17 +57,17 @@ add_task(test_getPlacesInfoNonExistentPl
function* test_promisedHelper() {
let uri = NetUtil.newURI("http://www.helper_existent_example.tld");
yield PlacesTestUtils.addVisits(uri);
let placeInfo = yield PlacesUtils.promisePlaceInfo(uri);
do_check_true(placeInfo instanceof Ci.mozIPlaceInfo);
uri = NetUtil.newURI("http://www.helper_non_existent_example.tld");
try {
- let placeInfo = yield PlacesUtils.promisePlaceInfo(uri);
+ yield PlacesUtils.promisePlaceInfo(uri);
do_throw("PlacesUtils.promisePlaceInfo should have rejected the promise");
}
catch (ex) { }
}
add_task(test_promisedHelper);
function* test_infoByGUID() {
let testURI = NetUtil.newURI("http://www.guid_example.tld");
--- a/toolkit/components/places/tests/unit/test_history_autocomplete_tags.js
+++ b/toolkit/components/places/tests/unit/test_history_autocomplete_tags.js
@@ -90,17 +90,17 @@ function ensure_tag_results(uris, search
input.onSearchComplete = function() {
do_check_eq(numSearchesStarted, 1);
do_check_eq(controller.searchStatus,
uris.length ?
Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH :
Ci.nsIAutoCompleteController.STATUS_COMPLETE_NO_MATCH);
do_check_eq(controller.matchCount, uris.length);
let vals = [];
- for (var i=0; i<controller.matchCount; i++) {
+ for (let i=0; i<controller.matchCount; i++) {
// Keep the URL for later because order of tag results is undefined
vals.push(controller.getValueAt(i));
do_check_eq(controller.getStyleAt(i), "bookmark-tag");
}
// Sort the results then check if we have the right items
vals.sort().forEach((val, i) => do_check_eq(val, uris[i].spec))
if (current_test < (tests.length - 1)) {
--- a/toolkit/components/places/tests/unit/test_isURIVisited.js
+++ b/toolkit/components/places/tests/unit/test_isURIVisited.js
@@ -49,25 +49,25 @@ function* step()
do_check_false(aIsVisited);
let callback = {
handleError: function () {},
handleResult: function () {},
handleCompletion: function () {
do_print("Added visit to " + uri.spec);
- history.isURIVisited(uri, function (aURI, aIsVisited) {
- do_check_true(uri.equals(aURI));
+ history.isURIVisited(uri, function (aURI2, aIsVisited2) {
+ do_check_true(uri.equals(aURI2));
let checker = SCHEMES[scheme] ? do_check_true : do_check_false;
- checker(aIsVisited);
+ checker(aIsVisited2);
PlacesTestUtils.clearHistory().then(function () {
- history.isURIVisited(uri, function(aURI, aIsVisited) {
- do_check_true(uri.equals(aURI));
- do_check_false(aIsVisited);
+ history.isURIVisited(uri, function(aURI3, aIsVisited3) {
+ do_check_true(uri.equals(aURI3));
+ do_check_false(aIsVisited3);
gRunner.next();
});
});
});
},
};
history.updatePlaces({ uri: uri
--- a/toolkit/components/satchel/test/test_form_autocomplete.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete.html
@@ -1047,21 +1047,21 @@ function waitForScroll()
}, false);
}
function waitForMenuChange(expectedCount, expectedFirstValue)
{
notifyMenuChanged(expectedCount, expectedFirstValue, runTest);
}
-function checkMenuEntries(expectedValues, testNum) {
+function checkMenuEntries(expectedValues, testNumber) {
var actualValues = getMenuEntries();
- is(actualValues.length, expectedValues.length, testNum + " Checking length of expected menu");
+ is(actualValues.length, expectedValues.length, testNumber + " Checking length of expected menu");
for (var i = 0; i < expectedValues.length; i++)
- is(actualValues[i], expectedValues[i], testNum + " Checking menu entry #"+i);
+ is(actualValues[i], expectedValues[i], testNumber + " Checking menu entry #"+i);
}
function startTest() {
setupFormHistory(function() {
runTest();
});
}
--- a/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
@@ -481,21 +481,21 @@ function runTest() {
return;
}
}
function waitForMenuChange(expectedCount) {
notifyMenuChanged(expectedCount, null, runTest);
}
-function checkMenuEntries(expectedValues, testNum) {
+function checkMenuEntries(expectedValues, testNumber) {
var actualValues = getMenuEntries();
- is(actualValues.length, expectedValues.length, testNum + " Checking length of expected menu");
+ is(actualValues.length, expectedValues.length, testNumber + " Checking length of expected menu");
for (var i = 0; i < expectedValues.length; i++)
- is(actualValues[i], expectedValues[i], testNum + " Checking menu entry #"+i);
+ is(actualValues[i], expectedValues[i], testNumber + " Checking menu entry #"+i);
}
function startTest() {
setupFormHistory(runTest);
}
window.onload = startTest;
--- a/toolkit/components/satchel/test/test_form_submission.html
+++ b/toolkit/components/satchel/test/test_form_submission.html
@@ -95,34 +95,34 @@
<input type="text" name="test1">
<button type="submit">Submit</button>
</form>
<!-- input with sensitive data (16 digit credit card number) -->
<form id="form15" onsubmit="return checkSubmit(15)">
<script type="text/javascript">
var form = document.getElementById('form15');
- for (var i = 0; i != 10; i++)
+ for (let i = 0; i != 10; i++)
{
- var input = document.createElement('input');
+ let input = document.createElement('input');
input.type = 'text';
input.name = 'test' + (i + 1);
form.appendChild(input);
}
</script>
<button type="submit">Submit</button>
</form>
<!-- input with sensitive data (15 digit credit card number) -->
<form id="form16" onsubmit="return checkSubmit(16)">
<script type="text/javascript">
form = document.getElementById('form16');
- for (i = 0; i != 10; i++)
+ for (let i = 0; i != 10; i++)
{
- input = document.createElement('input');
+ let input = document.createElement('input');
input.type = 'text';
input.name = 'test' + (i + 1);
form.appendChild(input);
}
</script>
<button type="submit">Submit</button>
</form>
@@ -212,35 +212,35 @@
<button type="submit">Submit</button>
</form>
<!-- input that looks like sensitive data but doesn't
satisfy the requirements (Luhn check fails for 16 chars) -->
<form id="form107" onsubmit="return checkSubmit(107)">
<script type="text/javascript">
form = document.getElementById('form107');
- for (i = 0; i != 10; i++)
+ for (let i = 0; i != 10; i++)
{
- input = document.createElement('input');
+ let input = document.createElement('input');
input.type = 'text';
input.name = 'test7_' + (i + 1);
form.appendChild(input);
}
</script>
<button type="submit">Submit</button>
</form>
<!-- input that looks like sensitive data but doesn't
satisfy the requirements (Luhn check fails for 15 chars) -->
<form id="form108" onsubmit="return checkSubmit(108)">
<script type="text/javascript">
form = document.getElementById('form108');
- for (i = 0; i != 10; i++)
+ for (let i = 0; i != 10; i++)
{
- input = document.createElement('input');
+ let input = document.createElement('input');
input.type = 'text';
input.name = 'test8_' + (i + 1);
form.appendChild(input);
}
</script>
<button type="submit">Submit</button>
</form>
@@ -308,34 +308,34 @@ function startTest() {
$_(1, "test1").value = "dontSaveThis";
$_(2, "test1").value = "dontSaveThis";
$_(3, "test1").value = "dontSaveThis";
$_(4, "test1").value = "dontSaveThis";
$_(5, "test1").value = "";
$_(6, "test1").value = "dontSaveThis";
// Form 7 deliberately left untouched.
// Form 8 has an input with no name or input attribute.
- var input = document.getElementById("form8").elements[0];
+ let input = document.getElementById("form8").elements[0];
is(input.type, "text", "checking we got unidentified input");
input.value = "dontSaveThis";
// Form 9 has nothing to modify.
$_(10, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890").value = "dontSaveThis";
$_(11, "test1").value = "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
$_(12, "test1").value = " ";
$_(13, "test1").value = "dontSaveThis";
$_(14, "test1").type = "password";
$_(14, "test1").value = "dontSaveThis";
var testData = ccNumbers.valid16;
- for (var i = 0; i != testData.length; i++) {
+ for (let i = 0; i != testData.length; i++) {
$_(15, "test" + (i + 1)).value = testData[i];
}
testData = ccNumbers.valid15;
- for (i = 0; i != testData.length; i++) {
+ for (let i = 0; i != testData.length; i++) {
$_(16, "test" + (i + 1)).value = testData[i];
}
$_(17, "test1").value = "001064088";
$_(18, "test1").value = "0000-0000-0080-4609";
$_(19, "test1").value = "0000 0000 0222 331";
$_(20, "test1").value = "dontSaveThis";
$_(22, "test1").value = "dontSaveThis";
$_(23, "test1").value = "dontSaveThis";
@@ -344,22 +344,22 @@ function startTest() {
$_(101, "test1").value = "savedValue";
$_(102, "test2").value = "savedValue";
$_(103, "test3").value = "savedValue";
$_(104, "test4").value = " trimTrailingAndLeadingSpace ";
$_(105, "test5").value = "\t trimTrailingAndLeadingWhitespace\t ";
$_(106, "test6").value = "00000000109181";
testData = ccNumbers.invalid16;
- for (i = 0; i != testData.length; i++) {
+ for (let i = 0; i != testData.length; i++) {
$_(107, "test7_" + (i + 1)).value = testData[i];
}
testData = ccNumbers.invalid15;
- for (i = 0; i != testData.length; i++) {
+ for (let i = 0; i != testData.length; i++) {
$_(108, "test8_" + (i + 1)).value = testData[i];
}
$_(109, "test9").value = "savedValue";
$_(110, "test10").value = "savedValue";
// submit the first form.
var button = getFormSubmitButton(1);
@@ -425,22 +425,22 @@ function checkSubmit(formNum) {
break;
case 105:
checkForSave("test5", "trimTrailingAndLeadingWhitespace", "checking saved value is trimmed on both sides");
break;
case 106:
checkForSave("test6", "00000000109181", "checking saved value");
break;
case 107:
- for (var i = 0; i != ccNumbers.invalid16.length; i++) {
+ for (let i = 0; i != ccNumbers.invalid16.length; i++) {
checkForSave("test7_" + (i + 1), ccNumbers.invalid16[i], "checking saved value");
}
break;
case 108:
- for (i = 0; i != ccNumbers.invalid15.length; i++) {
+ for (let i = 0; i != ccNumbers.invalid15.length; i++) {
checkForSave("test8_" + (i + 1), ccNumbers.invalid15[i], "checking saved value");
}
break;
case 109:
checkForSave("test9", "savedValue", "checking saved value");
break;
case 110:
checkForSave("test10", "savedValue", "checking saved value");
--- a/toolkit/components/satchel/test/unit/test_autocomplete.js
+++ b/toolkit/components/satchel/test/unit/test_autocomplete.js
@@ -69,17 +69,17 @@ add_test(function test0() {
}
updateFormHistory(changes, run_next_test);
});
add_test(function test1() {
do_log_info("Check initial state is as expected");
- countEntries(null, null, function (count) {
+ countEntries(null, null, function () {
countEntries("field1", null, function (count) {
do_check_true(count > 0);
run_next_test();
});
});
});
add_test(function test2() {
--- a/toolkit/content/tests/widgets/popup_shared.js
+++ b/toolkit/content/tests/widgets/popup_shared.js
@@ -360,18 +360,18 @@ function compareEdge(anchor, popup, edge
else {
is(Math.round(popuprect.width), gPopupWidth, testname + " width");
is(Math.round(popuprect.height), gPopupHeight, testname + " height");
}
var spaceIdx = edge.indexOf(" ");
if (spaceIdx > 0) {
let cornerX, cornerY;
- let [anchor, align] = edge.split(" ");
- switch (anchor) {
+ let [position, align] = edge.split(" ");
+ switch (position) {
case "topleft": cornerX = anchorrect.left; cornerY = anchorrect.top; break;
case "topcenter": cornerX = anchorrect.left + anchorrect.width / 2; cornerY = anchorrect.top; break;
case "topright": cornerX = anchorrect.right; cornerY = anchorrect.top; break;
case "leftcenter": cornerX = anchorrect.left; cornerY = anchorrect.top + anchorrect.height / 2; break;
case "rightcenter": cornerX = anchorrect.right; cornerY = anchorrect.top + anchorrect.height / 2; break;
case "bottomleft": cornerX = anchorrect.left; cornerY = anchorrect.bottom; break;
case "bottomcenter": cornerX = anchorrect.left + anchorrect.width / 2; cornerY = anchorrect.bottom; break;
case "bottomright": cornerX = anchorrect.right; cornerY = anchorrect.bottom; break;
--- a/toolkit/content/tests/widgets/tree_shared.js
+++ b/toolkit/content/tests/widgets/tree_shared.js
@@ -1098,17 +1098,17 @@ function testtag_tree_column_reorder()
if (testframe) {
testframe.scrollIntoView();
}
var tree = document.getElementById("tree-column-reorder");
var numColumns = tree.columns.count;
var reference = [];
- for (var i = 0; i < numColumns; i++) {
+ for (let i = 0; i < numColumns; i++) {
reference.push("col_" + i);
}
// Drag the first column to each position
for (let i = 0; i < numColumns - 1; i++) {
synthesizeColumnDrag(tree, i, i + 1, true);
arrayMove(reference, i, i + 1, true);
checkColumns(tree, reference, "drag first column right");
@@ -1276,27 +1276,27 @@ function arrayMove(aArray, aFrom, aTo, a
}
aArray.splice(aTo, 0, o);
}
function getSortedColumnArray(aTree)
{
var columns = aTree.columns;
- var a = [];
- for (var i = 0; i < columns.length; i++) {
- a.push(columns.getColumnAt(i));
+ var array = [];
+ for (let i = 0; i < columns.length; i++) {
+ array.push(columns.getColumnAt(i));
}
- a.sort(function(a, b) {
+ array.sort(function(a, b) {
var o1 = parseInt(a.element.getAttribute("ordinal"));
var o2 = parseInt(b.element.getAttribute("ordinal"));
return o1 - o2;
});
- return a;
+ return array;
}
function checkColumns(aTree, aReference, aMessage)
{
var columns = getSortedColumnArray(aTree);
var ids = [];
columns.forEach(function(e) {
ids.push(e.element.id);
@@ -1313,17 +1313,17 @@ function mouseOnCell(tree, row, column,
function mouseClickOnColumnHeader(aColumns, aColumnIndex, aButton, aClickCount)
{
var columnHeader = aColumns[aColumnIndex].element;
var columnHeaderRect = columnHeader.getBoundingClientRect();
var columnWidth = columnHeaderRect.right - columnHeaderRect.left;
// For multiple click we send separate click events, with increasing
// clickCount. This simulates the common behavior of multiple clicks.
- for (var i = 1; i <= aClickCount; i++) {
+ for (let i = 1; i <= aClickCount; i++) {
// Target the middle of the column header.
synthesizeMouse(columnHeader, columnWidth / 2, 3,
{ button: aButton,
clickCount: i }, null);
}
}
function mouseDblClickOnCell(tree, row, column, testname)
@@ -1339,29 +1339,29 @@ function mouseDblClickOnCell(tree, row,
synthesizeMouse(tree.body, rect.x, rect.y, { clickCount: 2 }, null);
}
function compareArrays(arr1, arr2)
{
if (arr1.length != arr2.length)
return false;
- for (var i = 0; i < arr1.length; i++) {
+ for (let i = 0; i < arr1.length; i++) {
if (arr1[i] != arr2[i])
return false;
}
return true;
}
function convertProperties(arr)
{
var results = [];
var count = arr.Count();
- for (var i = 0; i < count; i++)
+ for (let i = 0; i < count; i++)
results.push(arr.GetElementAt(i).QueryInterface(Components.interfaces.nsIAtom).toString());
results.sort();
return results.join(" ");
}
function convertDOMtoTreeRowInfo(treechildren, level, rowidx)
{