mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1314474 - Enable no-shadow rule for eslint for browser/ mochitests. r=mossop
MozReview-Commit-ID: 3QTChaVgCRP --HG-- extra : rebase_source : a7bd3f5b133a5dcecedbdf39ef3b1ce75a550970
This commit is contained in:
parent
0f170a1f9b
commit
8eae3ca20e
@ -406,12 +406,12 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,13 +104,13 @@ function test()
|
||||
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();
|
||||
}
|
||||
|
@ -317,12 +317,12 @@ function* test_browser_swapping(tab, browser) {
|
||||
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;
|
||||
@ -361,12 +361,12 @@ function* test_click_on_pinned_tab_after_mute() {
|
||||
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.
|
||||
@ -389,7 +389,7 @@ function* test_cross_process_load() {
|
||||
yield BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: PAGE
|
||||
}, test_on_browser);
|
||||
}, taskFn);
|
||||
}
|
||||
|
||||
function* test_mute_keybinding() {
|
||||
@ -401,7 +401,7 @@ function* test_mute_keybinding() {
|
||||
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.
|
||||
@ -434,7 +434,7 @@ function* test_mute_keybinding() {
|
||||
yield BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: PAGE
|
||||
}, test_on_browser);
|
||||
}, taskFn);
|
||||
}
|
||||
|
||||
function* test_on_browser(browser) {
|
||||
@ -462,7 +462,7 @@ function* test_on_browser(browser) {
|
||||
}
|
||||
|
||||
function* test_delayed_tabattr_removal() {
|
||||
function* test_on_browser(browser) {
|
||||
function* taskFn(browser) {
|
||||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
yield play(tab);
|
||||
|
||||
@ -476,7 +476,7 @@ function* test_delayed_tabattr_removal() {
|
||||
yield BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: PAGE
|
||||
}, test_on_browser);
|
||||
}, taskFn);
|
||||
}
|
||||
|
||||
add_task(function*() {
|
||||
|
@ -42,11 +42,11 @@ function* cutCurrentSelection(elementQueryString, property, browser) {
|
||||
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)`);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -11,16 +11,16 @@ function test() {
|
||||
|
||||
// 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();
|
||||
|
@ -13,8 +13,8 @@ const { REQUIRE_SIGNING } = Cu.import("resource://gre/modules/addons/AddonConsta
|
||||
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) {
|
||||
@ -455,8 +455,8 @@ function test_restartless() {
|
||||
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();
|
||||
@ -499,8 +499,8 @@ function test_multiple() {
|
||||
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();
|
||||
@ -676,8 +676,8 @@ function test_allUnverified() {
|
||||
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();
|
||||
@ -919,8 +919,8 @@ function test_theme() {
|
||||
"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.");
|
||||
@ -928,8 +928,8 @@ function test_theme() {
|
||||
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");
|
||||
|
@ -74,7 +74,7 @@ function* blurChildElement(browser)
|
||||
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;
|
||||
@ -82,8 +82,8 @@ function* checkChildFocus(browser, message)
|
||||
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");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ function test() {
|
||||
|
||||
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.");
|
||||
|
||||
|
@ -12,8 +12,8 @@ function test () {
|
||||
next();
|
||||
});
|
||||
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, link, link => {
|
||||
content.document.getElementById(link).click();
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, link, contentLink => {
|
||||
content.document.getElementById(contentLink).click();
|
||||
});
|
||||
}
|
||||
|
||||
@ -29,8 +29,8 @@ function test () {
|
||||
});
|
||||
});
|
||||
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, link, link => {
|
||||
content.document.getElementById(link).click();
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, link, contentLink => {
|
||||
content.document.getElementById(contentLink).click();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
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();
|
||||
@ -44,9 +44,9 @@ function zoomTab2() {
|
||||
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);
|
||||
|
@ -57,11 +57,11 @@ function test() {
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -64,8 +64,8 @@ function test() {
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
@ -32,12 +32,11 @@ add_task(function*() {
|
||||
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.
|
||||
@ -158,11 +157,10 @@ add_task(function*() {
|
||||
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.
|
||||
|
@ -666,12 +666,12 @@ function msg(type, data=null) {
|
||||
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;
|
||||
}
|
||||
@ -742,11 +742,11 @@ function promiseTab() {
|
||||
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;
|
||||
|
@ -888,11 +888,12 @@ add_task(function* test_plaintext_sendpagetodevice() {
|
||||
}
|
||||
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] : []),
|
||||
@ -909,7 +910,7 @@ add_task(function* test_plaintext_sendpagetodevice() {
|
||||
"context-viewsource", true,
|
||||
"context-viewinfo", true
|
||||
];
|
||||
yield test_contextmenu("#test-text", plainTextItems, {
|
||||
yield test_contextmenu("#test-text", plainTextItemsWithSendPage, {
|
||||
*onContextMenuShown() {
|
||||
yield openMenuItemSubmenu("context-sendpagetodevice");
|
||||
}
|
||||
@ -966,13 +967,13 @@ add_task(function* test_cleanup_html() {
|
||||
* 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);
|
||||
|
@ -5,10 +5,10 @@ function* test_decoder_doctor_notification(type, notificationMessage, options) {
|
||||
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"}));
|
||||
|
@ -36,13 +36,13 @@ var iconDiscoveryTests = [
|
||||
];
|
||||
|
||||
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();
|
||||
@ -55,16 +55,16 @@ function iconDiscovery() {
|
||||
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;
|
||||
@ -92,17 +92,17 @@ var searchDiscoveryTests = [
|
||||
];
|
||||
|
||||
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.
|
||||
@ -129,15 +129,15 @@ function searchDiscovery() {
|
||||
|
||||
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;
|
||||
|
@ -30,34 +30,34 @@ function* expectFocusOnF6(backward, expectedDocument, expectedElement, 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 });
|
||||
|
@ -131,8 +131,8 @@ function* loadURI(browser, uri) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -18,14 +18,14 @@ add_task(function* () {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,9 +20,9 @@ add_task(function* findbar_test() {
|
||||
|
||||
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 " +
|
||||
|
@ -49,9 +49,9 @@ var gTests = [
|
||||
];
|
||||
|
||||
function runNextTest () {
|
||||
let test = gTests.shift();
|
||||
if (test) {
|
||||
executeSoon(test);
|
||||
let testCase = gTests.shift();
|
||||
if (testCase) {
|
||||
executeSoon(testCase);
|
||||
}
|
||||
else {
|
||||
finish();
|
||||
|
@ -313,9 +313,9 @@ function test() {
|
||||
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);
|
||||
|
@ -199,9 +199,9 @@ 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);
|
||||
|
@ -183,10 +183,10 @@ function configureProfileURL(profile, responseStatus = 200) {
|
||||
|
||||
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);
|
||||
|
@ -50,8 +50,8 @@ add_task(function*() {
|
||||
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");
|
||||
@ -60,7 +60,7 @@ add_task(function*() {
|
||||
" 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;
|
||||
|
||||
@ -69,17 +69,17 @@ add_task(function*() {
|
||||
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;
|
||||
@ -87,7 +87,7 @@ add_task(function*() {
|
||||
throw "data-state attribute is missing or has invalid value";
|
||||
}
|
||||
});
|
||||
return validLinks;
|
||||
return contentValidLinks;
|
||||
});
|
||||
|
||||
ok(items.length, "At least one item in the menu");
|
||||
|
@ -53,7 +53,7 @@ function test() {
|
||||
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);
|
||||
|
||||
|
@ -17,12 +17,12 @@ const PREF = "accessibility.blockautorefresh";
|
||||
* @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) {
|
||||
|
@ -584,7 +584,7 @@ add_task(function* test_offline_cache() {
|
||||
|
||||
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";
|
||||
|
@ -64,9 +64,9 @@ function triggerSave(aWindow, aCallback) {
|
||||
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());
|
||||
}
|
||||
@ -86,10 +86,10 @@ function test() {
|
||||
|
||||
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");
|
||||
}
|
||||
@ -170,8 +170,8 @@ function test() {
|
||||
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();
|
||||
});
|
||||
|
@ -80,9 +80,9 @@ function triggerSave(aWindow, aCallback) {
|
||||
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);
|
||||
}
|
||||
@ -163,8 +163,8 @@ function test() {
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -270,17 +270,17 @@ add_task(function*() {
|
||||
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() {
|
||||
@ -288,7 +288,7 @@ add_task(function*() {
|
||||
resolve();
|
||||
});
|
||||
|
||||
elem.style = step[1];
|
||||
elem.style = contentStep[1];
|
||||
});
|
||||
});
|
||||
|
||||
@ -297,9 +297,9 @@ add_task(function*() {
|
||||
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);
|
||||
}
|
||||
@ -365,14 +365,12 @@ add_task(function* test_event_order() {
|
||||
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");
|
||||
@ -381,12 +379,12 @@ add_task(function* test_event_order() {
|
||||
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);
|
||||
}
|
||||
@ -450,9 +448,9 @@ function* performLargePopupTests(win)
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -44,9 +44,9 @@ function checkBroadcasterVisible(broadcasterId) {
|
||||
|
||||
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);
|
||||
});
|
||||
|
@ -63,7 +63,7 @@ function* getFocusedElementForBrowser(browser, dontCheckExtraFocus = false)
|
||||
|
||||
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)
|
||||
@ -91,24 +91,24 @@ function focusInChild()
|
||||
|
||||
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>";
|
||||
}
|
||||
}
|
||||
@ -160,7 +160,6 @@ add_task(function*() {
|
||||
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);
|
||||
@ -373,19 +372,19 @@ add_task(function*() {
|
||||
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.
|
||||
|
@ -130,19 +130,19 @@ var gTests = [
|
||||
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 {
|
||||
@ -403,9 +403,9 @@ 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);
|
||||
|
@ -30,17 +30,17 @@ addEventListener("DOMContentLoaded", function domContentLoaded(event) {
|
||||
}
|
||||
// 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);
|
||||
@ -72,9 +72,9 @@ addMessageListener("test:load-with-mocked-profile-path", function (message) {
|
||||
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);
|
||||
|
@ -258,13 +258,13 @@ function* test_contextmenu(selector, menuItems, options={}) {
|
||||
|
||||
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;
|
||||
@ -278,9 +278,9 @@ function* test_contextmenu(selector, menuItems, options={}) {
|
||||
|
||||
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");
|
||||
});
|
||||
|
@ -327,7 +327,7 @@ function waitForAsyncUpdates(aCallback, aScope, aArguments) {
|
||||
*/
|
||||
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);
|
||||
});
|
||||
|
||||
@ -373,9 +373,9 @@ function promiseHistoryClearedState(aURIs, aShouldBeCleared) {
|
||||
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();
|
||||
});
|
||||
});
|
||||
@ -400,7 +400,7 @@ function promiseHistoryClearedState(aURIs, aShouldBeCleared) {
|
||||
* @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);
|
||||
@ -428,7 +428,7 @@ function waitForDocLoadAndStopIt(aExpectedURL, aBrowser=gBrowser.selectedBrowser
|
||||
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"])
|
||||
@ -908,8 +908,8 @@ 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);
|
||||
});
|
||||
@ -1045,7 +1045,7 @@ 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!");
|
||||
|
@ -97,10 +97,10 @@
|
||||
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);
|
||||
@ -126,10 +126,10 @@
|
||||
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", () => {
|
||||
@ -182,10 +182,10 @@
|
||||
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));
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ module.exports = {
|
||||
rules: {
|
||||
"mozilla/import-headjs-globals": 1,
|
||||
"mozilla/mark-test-function-used": 1,
|
||||
"no-shadow": 2,
|
||||
},
|
||||
|
||||
"env": {
|
||||
|
@ -23,7 +23,7 @@ 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");
|
||||
|
@ -14,7 +14,7 @@ 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");
|
||||
@ -30,7 +30,7 @@ const chromeScript = SpecialPowers.loadChromeScript(_ => {
|
||||
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");
|
||||
|
@ -35,11 +35,11 @@ function promiseImage(alert, timeout = 0, userData = null) {
|
||||
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));
|
||||
});
|
||||
@ -85,10 +85,10 @@ 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);
|
||||
|
@ -14,13 +14,11 @@ 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() {
|
||||
@ -38,7 +36,7 @@ const chromeScript = SpecialPowers.loadChromeScript(_ => {
|
||||
|
||||
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);
|
||||
|
||||
|
@ -21,9 +21,7 @@ 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");
|
||||
|
@ -64,7 +64,7 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
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}`);
|
||||
|
@ -13,9 +13,8 @@
|
||||
"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 => {
|
||||
|
@ -36,10 +36,10 @@ add_task(function* test_uninstall() {
|
||||
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();
|
||||
};
|
||||
};
|
||||
@ -70,10 +70,10 @@ add_task(function* test_uninstall() {
|
||||
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);
|
||||
};
|
||||
|
@ -79,14 +79,14 @@ function* testPolicy(customCSP = null) {
|
||||
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({
|
||||
|
@ -19,7 +19,7 @@ function* testCookies(options) {
|
||||
// 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 => {
|
||||
@ -37,7 +37,7 @@ function* testCookies(options) {
|
||||
|
||||
|
||||
// Try to access some cookies in various ways.
|
||||
let {url, domain, secure} = options;
|
||||
let {url, domain, secure} = backgroundOptions;
|
||||
|
||||
let failures = 0;
|
||||
let tallyFailure = error => {
|
||||
@ -47,23 +47,23 @@ function* testCookies(options) {
|
||||
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");
|
||||
@ -82,7 +82,7 @@ function* testCookies(options) {
|
||||
|
||||
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");
|
||||
|
@ -130,8 +130,8 @@ add_task(function* test_i18n() {
|
||||
},
|
||||
},
|
||||
|
||||
"content.js": "new " + function(runTests) {
|
||||
runTests((...args) => {
|
||||
"content.js": "new " + function(runTestsFn) {
|
||||
runTestsFn((...args) => {
|
||||
browser.runtime.sendMessage(["assertEq", ...args]);
|
||||
});
|
||||
|
||||
@ -139,7 +139,7 @@ add_task(function* test_i18n() {
|
||||
} + `(${runTests})`,
|
||||
},
|
||||
|
||||
background: "new " + function(runTests) {
|
||||
background: "new " + function(runTestsFn) {
|
||||
browser.runtime.onMessage.addListener(([msg, ...args]) => {
|
||||
if (msg == "assertEq") {
|
||||
browser.test.assertEq(...args);
|
||||
@ -148,7 +148,7 @@ add_task(function* test_i18n() {
|
||||
}
|
||||
});
|
||||
|
||||
runTests(browser.test.assertEq.bind(browser.test));
|
||||
runTestsFn(browser.test.assertEq.bind(browser.test));
|
||||
} + `(${runTests})`,
|
||||
});
|
||||
|
||||
@ -248,7 +248,7 @@ add_task(function* test_get_ui_language() {
|
||||
};
|
||||
}
|
||||
|
||||
function background(getResults) {
|
||||
function background(getResultsFn) {
|
||||
function checkResults(source, results, expected) {
|
||||
browser.test.assertEq(
|
||||
expected,
|
||||
@ -267,7 +267,7 @@ add_task(function* test_get_ui_language() {
|
||||
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");
|
||||
});
|
||||
@ -279,9 +279,9 @@ add_task(function* test_get_ui_language() {
|
||||
});
|
||||
}
|
||||
|
||||
function content(getResults) {
|
||||
function content(getResultsFn) {
|
||||
browser.runtime.onMessage.addListener((msg, sender, respond) => {
|
||||
respond(getResults());
|
||||
respond(getResultsFn());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
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);
|
||||
@ -26,7 +26,7 @@ add_task(function* test_i18n_css() {
|
||||
});
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
|
@ -61,8 +61,8 @@ add_task(function* test_simple() {
|
||||
});
|
||||
}
|
||||
|
||||
function background(runTests) {
|
||||
runTests("bg").then(() => {
|
||||
function background(runTestsFn) {
|
||||
runTestsFn("bg").then(() => {
|
||||
browser.test.notifyPass("permission_xhr");
|
||||
});
|
||||
}
|
||||
@ -77,8 +77,8 @@ add_task(function* test_simple() {
|
||||
}],
|
||||
},
|
||||
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;
|
||||
|
||||
|
@ -35,9 +35,9 @@ function contentScript() {
|
||||
|
||||
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) {
|
||||
|
@ -40,8 +40,8 @@ add_task(function* test_multiple_pages() {
|
||||
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(() => {
|
||||
|
@ -209,9 +209,9 @@ add_task(function* test_web_accessible_resources_csp() {
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@ -301,9 +301,9 @@ add_task(function* test_web_accessible_resources_mixed_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);
|
||||
|
@ -46,8 +46,8 @@
|
||||
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];
|
||||
|
@ -5,7 +5,7 @@ const ids = {
|
||||
CHANGE_INPUT_ID: "input2",
|
||||
};
|
||||
|
||||
function task(ids) {
|
||||
function task(contentIds) {
|
||||
let resolve;
|
||||
let promise = new Promise(r => { resolve = r; });
|
||||
|
||||
@ -31,40 +31,40 @@ function task(ids) {
|
||||
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);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ const consts = {
|
||||
BODY_INPUT_ID: "input3",
|
||||
};
|
||||
|
||||
function task(consts) {
|
||||
function task(contentConsts) {
|
||||
let resolve;
|
||||
let promise = new Promise(r => { resolve = r; });
|
||||
|
||||
@ -30,26 +30,26 @@ function task(consts) {
|
||||
|
||||
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");
|
||||
@ -57,20 +57,20 @@ function task(consts) {
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -23,11 +23,11 @@ add_task(function* test_http_autofill() {
|
||||
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");
|
||||
@ -42,12 +42,12 @@ add_task(function* test_iframe_in_http_autofill() {
|
||||
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");
|
||||
@ -62,11 +62,11 @@ add_task(function* test_http_action_autofill() {
|
||||
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");
|
||||
|
@ -13,21 +13,21 @@ const WARNING_PATTERN = [{
|
||||
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);
|
||||
|
@ -40,11 +40,11 @@ add_task(function* test_save_change() {
|
||||
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;
|
||||
|
@ -81,10 +81,10 @@ add_task(function* test_edit_password() {
|
||||
"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;
|
||||
|
@ -78,10 +78,10 @@ function test() {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -89,10 +89,10 @@ function test() {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -115,24 +115,24 @@ function test() {
|
||||
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);
|
||||
});
|
||||
@ -151,9 +151,9 @@ function test() {
|
||||
}
|
||||
|
||||
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();
|
||||
|
@ -11,7 +11,7 @@ registerCleanupFunction(function* cleanup_removeAllLoginsAndResetRecipes() {
|
||||
// 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());
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -204,9 +204,9 @@ var contentPage = "http://mochi.test:8888/chrome/toolkit/components/passwordmgr/
|
||||
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);
|
||||
|
@ -64,7 +64,7 @@
|
||||
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();
|
||||
@ -78,43 +78,43 @@
|
||||
{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");
|
||||
});
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
<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.
|
||||
@ -80,7 +79,7 @@ runInParent(() => {
|
||||
});
|
||||
|
||||
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",
|
||||
@ -95,7 +94,7 @@ add_task(function* test_iframe() {
|
||||
focused : "textField",
|
||||
defButton : "button0",
|
||||
};
|
||||
action = {
|
||||
let action = {
|
||||
buttonClick : "ok",
|
||||
};
|
||||
promptDone = handlePrompt(state, action);
|
||||
|
@ -58,10 +58,10 @@ add_task(function* test_sandbox_xhr() {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -188,8 +188,8 @@ function registerRunTests() {
|
||||
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);
|
||||
@ -401,14 +401,13 @@ if (this.addMessageListener) {
|
||||
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");
|
||||
|
@ -73,15 +73,15 @@ addEventListener("message", () => {
|
||||
* 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);
|
||||
@ -107,7 +107,7 @@ function handleDialog(doc, testNum) {
|
||||
break;
|
||||
|
||||
default:
|
||||
ok(false, "Uhh, unhandled switch for testNum #" + testNum);
|
||||
ok(false, "Uhh, unhandled switch for testNum #" + testNumber);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -121,9 +121,9 @@ function handleDialog(doc, testNum) {
|
||||
dialog.cancelDialog();
|
||||
}
|
||||
|
||||
ok(true, "handleDialog done for test " + testNum);
|
||||
ok(true, "handleDialog done for test " + testNumber);
|
||||
|
||||
if (testNum == 4)
|
||||
if (testNumber == 4)
|
||||
checkTest4A();
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function doTest(testNum)
|
||||
function doTest(testNumber)
|
||||
{
|
||||
/*
|
||||
* These contentDocument variables are located here,
|
||||
@ -203,7 +203,7 @@
|
||||
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
|
||||
@ -356,11 +356,11 @@
|
||||
startCallbackTimer();
|
||||
}
|
||||
|
||||
function handleDialog(doc, testNum)
|
||||
function handleDialog(doc, testNumber)
|
||||
{
|
||||
var dialog = doc.getElementById("commonDialog");
|
||||
|
||||
switch (testNum)
|
||||
switch (testNumber)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
@ -403,14 +403,14 @@
|
||||
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;
|
||||
@ -418,7 +418,7 @@
|
||||
var authok1;
|
||||
var proxyok1;
|
||||
var footnote;
|
||||
switch (testNum)
|
||||
switch (testNumber)
|
||||
{
|
||||
case 1:
|
||||
ok(true, "doCheck testNum 1");
|
||||
@ -526,7 +526,7 @@
|
||||
break;
|
||||
|
||||
default:
|
||||
ok(false, "Unhandled testNum " + testNum + " in doCheck");
|
||||
ok(false, "Unhandled testNum " + testNumber + " in doCheck");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,10 +89,10 @@ function createLoginsFragment(url, content, elementQuery) {
|
||||
* 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);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ add_task(function* test_bookmarks() {
|
||||
|
||||
// get item title bad input
|
||||
try {
|
||||
let title = bs.getItemTitle(-3);
|
||||
bs.getItemTitle(-3);
|
||||
do_throw("getItemTitle accepted bad input");
|
||||
} catch (ex) {}
|
||||
|
||||
@ -370,8 +370,8 @@ add_task(function* test_bookmarks() {
|
||||
|
||||
// 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;
|
||||
@ -409,8 +409,8 @@ add_task(function* test_bookmarks() {
|
||||
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;
|
||||
@ -499,10 +499,10 @@ add_task(function* test_bookmarks() {
|
||||
|
||||
// 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;
|
||||
@ -521,10 +521,10 @@ add_task(function* test_bookmarks() {
|
||||
// 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;
|
||||
@ -548,8 +548,8 @@ add_task(function* test_bookmarks() {
|
||||
// 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;
|
||||
|
@ -136,12 +136,12 @@ function test() {
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -22,7 +22,6 @@ function test() {
|
||||
let favIconErrorPageURI =
|
||||
NetUtil.newURI("chrome://global/skin/icons/warning-16.png");
|
||||
let favIconsResultCount = 0;
|
||||
let pageURI;
|
||||
|
||||
function testOnWindow(aOptions, aCallback) {
|
||||
whenNewWindowLoaded(aOptions, function(aWin) {
|
||||
@ -228,20 +227,20 @@ function test() {
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
@ -30,11 +30,11 @@ add_task(function* () {
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
@ -64,8 +64,8 @@ function test() {
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
@ -288,7 +288,7 @@ function whenNewWindowLoaded(aOptions, aCallback) {
|
||||
*/
|
||||
function promiseIsURIVisited(aURI, aExpectedValue) {
|
||||
return new Promise(resolve => {
|
||||
PlacesUtils.asyncHistory.isURIVisited(aURI, function(aURI, aIsVisited) {
|
||||
PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
|
||||
resolve(aIsVisited);
|
||||
});
|
||||
});
|
||||
|
@ -82,7 +82,7 @@ add_task(function* test_annos_expire_policy() {
|
||||
// Expire all expirable pages.
|
||||
setMaxPages(0);
|
||||
|
||||
let now = getExpirablePRTime();
|
||||
now = 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/");
|
||||
|
@ -41,8 +41,6 @@ var tests = [
|
||||
|
||||
];
|
||||
|
||||
var currentTest;
|
||||
|
||||
add_task(function* test() {
|
||||
// The pref should not exist by default.
|
||||
Assert.throws(() => getInterval());
|
||||
|
@ -370,9 +370,9 @@ function check_no_bookmarks() {
|
||||
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);
|
||||
});
|
||||
}
|
||||
@ -821,7 +821,7 @@ NavHistoryResultObserver.prototype = {
|
||||
function promiseIsURIVisited(aURI) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
PlacesUtils.asyncHistory.isURIVisited(aURI, function(aURI, aIsVisited) {
|
||||
PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
|
||||
deferred.resolve(aIsVisited);
|
||||
});
|
||||
|
||||
|
@ -44,17 +44,17 @@ add_task(function* test_remove_single() {
|
||||
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 {
|
||||
|
@ -41,11 +41,11 @@ const olderthansixmonths = today - (DAY_MICROSEC * 31 * 7);
|
||||
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({
|
||||
@ -184,8 +184,8 @@ function* task_populateDB(aArray)
|
||||
});
|
||||
}
|
||||
} 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");
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ add_task(function* test_results_as_visit()
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ function ensure_tag_results(uris, searchTerm)
|
||||
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");
|
||||
|
@ -71,7 +71,7 @@ add_task(function* test_execute()
|
||||
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));
|
||||
|
@ -451,7 +451,7 @@ add_task(function* test_merge_create_folder_and_item() {
|
||||
, 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);
|
||||
@ -460,13 +460,13 @@ add_task(function* test_merge_create_folder_and_item() {
|
||||
});
|
||||
|
||||
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();
|
||||
};
|
||||
@ -491,7 +491,7 @@ add_task(function* test_move_items_to_folder() {
|
||||
, 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 =
|
||||
@ -503,14 +503,14 @@ add_task(function* test_move_items_to_folder() {
|
||||
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
|
||||
@ -519,7 +519,7 @@ add_task(function* test_move_items_to_folder() {
|
||||
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
|
||||
@ -596,8 +596,8 @@ add_task(function* test_move_items_to_folder() {
|
||||
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;
|
||||
@ -606,7 +606,7 @@ add_task(function* test_remove_folder() {
|
||||
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();
|
||||
|
||||
@ -614,13 +614,13 @@ add_task(function* test_remove_folder() {
|
||||
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();
|
||||
@ -628,14 +628,14 @@ add_task(function* test_remove_folder() {
|
||||
// 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();
|
||||
@ -643,14 +643,14 @@ add_task(function* test_remove_folder() {
|
||||
// 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);
|
||||
@ -659,20 +659,20 @@ add_task(function* test_remove_folder() {
|
||||
// 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();
|
||||
|
||||
|
@ -204,7 +204,7 @@ add_task(function* test_import_chromefavicon()
|
||||
|
||||
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," +
|
||||
|
@ -31,7 +31,7 @@ add_task(function* test_corrupt_database() {
|
||||
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 });
|
||||
}));
|
||||
|
@ -85,8 +85,8 @@ add_test(function test_dh_addRemoveDownload()
|
||||
// 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));
|
||||
@ -109,8 +109,8 @@ add_test(function test_dh_addMultiRemoveDownload()
|
||||
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);
|
||||
@ -132,8 +132,8 @@ add_test(function test_dh_addBookmarkRemoveDownload()
|
||||
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);
|
||||
@ -150,9 +150,9 @@ add_test(function test_dh_addDownload_referrer()
|
||||
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.
|
||||
|
@ -62,7 +62,7 @@ function* test_promisedHelper() {
|
||||
|
||||
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) { }
|
||||
|
@ -95,7 +95,7 @@ function ensure_tag_results(uris, searchTerm)
|
||||
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");
|
||||
|
@ -54,15 +54,15 @@ function* step()
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
@ -1052,11 +1052,11 @@ 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() {
|
||||
|
@ -486,11 +486,11 @@ 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() {
|
||||
|
@ -100,9 +100,9 @@
|
||||
<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);
|
||||
@ -115,9 +115,9 @@
|
||||
<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);
|
||||
@ -217,9 +217,9 @@
|
||||
<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);
|
||||
@ -233,9 +233,9 @@
|
||||
<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);
|
||||
@ -313,7 +313,7 @@ function startTest() {
|
||||
$_(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.
|
||||
@ -325,12 +325,12 @@ function startTest() {
|
||||
$_(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";
|
||||
@ -349,12 +349,12 @@ function startTest() {
|
||||
$_(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];
|
||||
}
|
||||
|
||||
@ -430,12 +430,12 @@ function checkSubmit(formNum) {
|
||||
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;
|
||||
|
@ -74,7 +74,7 @@ add_test(function test0() {
|
||||
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();
|
||||
|
@ -365,8 +365,8 @@ function compareEdge(anchor, popup, edge, offsetX, offsetY, testname)
|
||||
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;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user