зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1596918: Part 3b - Run code formatters on files changed by previous patch. r=mccr8,remote-protocol-reviewers,ato
Differential Revision: https://phabricator.services.mozilla.com/D53741 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
16a9b29848
Коммит
3ca78ce8e3
|
@ -53,7 +53,9 @@ add_task(async function checkPermanentExceptionPref() {
|
|||
let loaded = BrowserTestUtils.browserLoaded(browser, false, BAD_CERT);
|
||||
info("Clicking the exceptionDialogButton in advanced panel");
|
||||
let securityInfoAsString = await SpecialPowers.spawn(
|
||||
browser, [], async function() {
|
||||
browser,
|
||||
[],
|
||||
async function() {
|
||||
let doc = content.document;
|
||||
let exceptionButton = doc.getElementById("exceptionDialogButton");
|
||||
exceptionButton.click();
|
||||
|
@ -128,7 +130,9 @@ add_task(async function checkBadStsCert() {
|
|||
});
|
||||
|
||||
let message = await SpecialPowers.spawn(
|
||||
browser, [{ frame: useFrame }], async function({ frame }) {
|
||||
browser,
|
||||
[{ frame: useFrame }],
|
||||
async function({ frame }) {
|
||||
let doc = frame
|
||||
? content.document.querySelector("iframe").contentDocument
|
||||
: content.document;
|
||||
|
|
|
@ -58,7 +58,9 @@ add_task(async function checkUntrustedCertError() {
|
|||
let browser = tab.linkedBrowser;
|
||||
info("Clicking the exceptionDialogButton in advanced panel");
|
||||
let badCertTechnicalInfoText = await SpecialPowers.spawn(
|
||||
browser, [], checkAdvancedAndGetTechnicalInfoText
|
||||
browser,
|
||||
[],
|
||||
checkAdvancedAndGetTechnicalInfoText
|
||||
);
|
||||
checkCorrectMessages(badCertTechnicalInfoText, browser);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
|
|
|
@ -25,7 +25,9 @@ add_task(async function() {
|
|||
]);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{ expectedName: engine.name }], async function(args) {
|
||||
browser,
|
||||
[{ expectedName: engine.name }],
|
||||
async function(args) {
|
||||
let engineName =
|
||||
content.wrappedJSObject.gContentSearchController.defaultEngine.name;
|
||||
is(
|
||||
|
|
|
@ -8,7 +8,9 @@ add_task(async function() {
|
|||
{ gBrowser, url: "about:support" },
|
||||
async function(browser) {
|
||||
let keyLocationServiceGoogleStatus = await SpecialPowers.spawn(
|
||||
browser, [], async function() {
|
||||
browser,
|
||||
[],
|
||||
async function() {
|
||||
let textBox = content.document.getElementById(
|
||||
"key-location-service-google-box"
|
||||
);
|
||||
|
@ -25,7 +27,9 @@ add_task(async function() {
|
|||
);
|
||||
|
||||
let keySafebrowsingGoogleStatus = await SpecialPowers.spawn(
|
||||
browser, [], async function() {
|
||||
browser,
|
||||
[],
|
||||
async function() {
|
||||
let textBox = content.document.getElementById(
|
||||
"key-safebrowsing-google-box"
|
||||
);
|
||||
|
@ -42,7 +46,9 @@ add_task(async function() {
|
|||
);
|
||||
|
||||
let keyMozillaStatus = await SpecialPowers.spawn(
|
||||
browser, [], async function() {
|
||||
browser,
|
||||
[],
|
||||
async function() {
|
||||
let textBox = content.document.getElementById("key-mozilla-box");
|
||||
await ContentTaskUtils.waitForCondition(
|
||||
() => content.document.l10n.getAttributes(textBox).id,
|
||||
|
|
|
@ -161,7 +161,9 @@ function promiseTabLoadEvent(tab, url) {
|
|||
* Wait for the search engine to change.
|
||||
*/
|
||||
function promiseContentSearchChange(browser, newEngineName) {
|
||||
return SpecialPowers.spawn(browser, [{ newEngineName }], async function(args) {
|
||||
return SpecialPowers.spawn(browser, [{ newEngineName }], async function(
|
||||
args
|
||||
) {
|
||||
return new Promise(resolve => {
|
||||
content.addEventListener("ContentSearchService", function listener(
|
||||
aEvent
|
||||
|
|
|
@ -1243,7 +1243,9 @@ add_task(async function test_pagemenu() {
|
|||
ok(item, "Got generated XUL menu item");
|
||||
item.doCommand();
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], async function() {
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let pagemenu = content.document.getElementById("test-pagemenu");
|
||||
Assert.ok(
|
||||
!pagemenu.hasAttribute("hopeless"),
|
||||
|
@ -1312,7 +1314,9 @@ add_task(async function test_dom_full_screen() {
|
|||
["full-screen-api.transition-duration.leave", "0 0"]
|
||||
);
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], async function() {
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let doc = content.document;
|
||||
let win = doc.defaultView;
|
||||
let full_screen_element = doc.getElementById(
|
||||
|
@ -1329,7 +1333,9 @@ add_task(async function test_dom_full_screen() {
|
|||
},
|
||||
async postCheckContextMenuFn() {
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], async function() {
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let win = content.document.defaultView;
|
||||
let awaitFullScreenChange = ContentTaskUtils.waitForEvent(
|
||||
win,
|
||||
|
@ -1465,7 +1471,9 @@ add_task(async function test_select_text_link() {
|
|||
},
|
||||
async postCheckContextMenuFn() {
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], async function() {
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let win = content.document.defaultView;
|
||||
win.getSelection().removeAllRanges();
|
||||
}
|
||||
|
@ -1968,18 +1976,20 @@ add_task(async function test_cleanup_html() {
|
|||
* the element that will be referenced.
|
||||
*/
|
||||
async function selectText(selector) {
|
||||
await SpecialPowers.spawn(gBrowser.selectedBrowser, [selector], async 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(contentSelector);
|
||||
Assert.ok(element, "Found element to select text from");
|
||||
div.setStartBefore(element);
|
||||
div.setEndAfter(element);
|
||||
win.getSelection().addRange(div);
|
||||
});
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[selector],
|
||||
async 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(contentSelector);
|
||||
Assert.ok(element, "Found element to select text from");
|
||||
div.setStartBefore(element);
|
||||
div.setEndAfter(element);
|
||||
win.getSelection().addRange(div);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,9 @@ add_task(async function test_text_input_spellcheck() {
|
|||
// and will add fill-login context menu items.
|
||||
async preCheckContextMenuFn() {
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], async function() {
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let doc = content.document;
|
||||
let input = doc.getElementById("input_spellcheck_no_value");
|
||||
input.setAttribute("spellcheck", "true");
|
||||
|
@ -264,7 +266,9 @@ add_task(async function test_password_input() {
|
|||
// and will add fill-login context menu items.
|
||||
async preCheckContextMenuFn() {
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], async function() {
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let doc = content.document;
|
||||
let input = doc.getElementById("input_password");
|
||||
input.type = "password";
|
||||
|
@ -274,7 +278,9 @@ add_task(async function test_password_input() {
|
|||
},
|
||||
async postCheckContextMenuFn() {
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], async function() {
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let doc = content.document;
|
||||
let input = doc.getElementById("input_password");
|
||||
input.type = "text";
|
||||
|
|
|
@ -362,7 +362,9 @@ async function test_contextmenu(selector, menuItems, options = {}) {
|
|||
|
||||
if (!options.skipFocusChange) {
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [[lastElementSelector, selector]], async function([contentLastElementSelector, contentSelector]) {
|
||||
gBrowser.selectedBrowser,
|
||||
[[lastElementSelector, selector]],
|
||||
async function([contentLastElementSelector, contentSelector]) {
|
||||
if (contentLastElementSelector) {
|
||||
let contentLastElement = content.document.querySelector(
|
||||
contentLastElementSelector
|
||||
|
@ -384,16 +386,18 @@ async function test_contextmenu(selector, menuItems, options = {}) {
|
|||
|
||||
if (options.waitForSpellCheck) {
|
||||
info("Waiting for spell check");
|
||||
await SpecialPowers.spawn(gBrowser.selectedBrowser, [selector], async function(
|
||||
contentSelector
|
||||
) {
|
||||
let { onSpellCheck } = ChromeUtils.import(
|
||||
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
|
||||
);
|
||||
let element = content.document.querySelector(contentSelector);
|
||||
await new Promise(resolve => onSpellCheck(element, resolve));
|
||||
info("Spell check running");
|
||||
});
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[selector],
|
||||
async function(contentSelector) {
|
||||
let { onSpellCheck } = ChromeUtils.import(
|
||||
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
|
||||
);
|
||||
let element = content.document.querySelector(contentSelector);
|
||||
await new Promise(resolve => onSpellCheck(element, resolve));
|
||||
info("Spell check running");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
let awaitPopupShown = BrowserTestUtils.waitForEvent(
|
||||
|
|
|
@ -97,7 +97,9 @@ add_task(async function() {
|
|||
let iconPromise = waitForFaviconMessage(!testCase.richIcon, expectedIcon);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [[testCase.icons, ROOTURI + ICON]], ([icons, defaultIcon]) => {
|
||||
gBrowser.selectedBrowser,
|
||||
[[testCase.icons, ROOTURI + ICON]],
|
||||
([icons, defaultIcon]) => {
|
||||
let doc = content.document;
|
||||
let head = doc.head;
|
||||
|
||||
|
|
|
@ -551,7 +551,9 @@ add_task(async function test_event_order() {
|
|||
);
|
||||
|
||||
let eventsPromise = SpecialPowers.spawn(
|
||||
browser, [[mode, expected]], async function([contentMode, contentExpected]) {
|
||||
browser,
|
||||
[[mode, expected]],
|
||||
async function([contentMode, contentExpected]) {
|
||||
return new Promise(resolve => {
|
||||
function onEvent(event) {
|
||||
select.removeEventListener(event.type, onEvent);
|
||||
|
@ -827,7 +829,9 @@ async function performLargePopupTests(win) {
|
|||
browser,
|
||||
"MozAfterPaint"
|
||||
);
|
||||
await SpecialPowers.spawn(browser, [position], async function(contentPosition) {
|
||||
await SpecialPowers.spawn(browser, [position], async function(
|
||||
contentPosition
|
||||
) {
|
||||
let select = content.document.getElementById("one");
|
||||
select.setAttribute("style", contentPosition || "");
|
||||
select.getBoundingClientRect();
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
const { ContentTaskUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/ContentTaskUtils.jsm"
|
||||
);
|
||||
;
|
||||
|
||||
function waitForFullScreenState(browser, state) {
|
||||
info("inside waitforfullscreenstate");
|
||||
return new Promise(resolve => {
|
||||
|
|
|
@ -30,7 +30,9 @@ add_task(async function() {
|
|||
);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [{ action, param, method, id }], async function(args) {
|
||||
tab.linkedBrowser,
|
||||
[{ action, param, method, id }],
|
||||
async function(args) {
|
||||
let doc = content.document;
|
||||
let form = doc.createElement("form");
|
||||
form.id = args.id;
|
||||
|
|
|
@ -41,7 +41,9 @@ async function cutCurrentSelection(elementQueryString, property, browser) {
|
|||
|
||||
// The editor should be empty after cut.
|
||||
await SpecialPowers.spawn(
|
||||
browser, [[elementQueryString, property]], async function([contentElementQueryString, contentProperty]) {
|
||||
browser,
|
||||
[[elementQueryString, property]],
|
||||
async function([contentElementQueryString, contentProperty]) {
|
||||
let element = content.document.querySelector(contentElementQueryString);
|
||||
is(
|
||||
element[contentProperty],
|
||||
|
|
|
@ -26,7 +26,9 @@ add_task(async function() {
|
|||
let test = tests[index];
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [{ element: test.element, type: test.type, index }], async function(arg) {
|
||||
gBrowser.selectedBrowser,
|
||||
[{ element: test.element, type: test.type, index }],
|
||||
async function(arg) {
|
||||
let element = content.document.createElement(arg.element);
|
||||
element.id = "element" + arg.index;
|
||||
if (arg.type) {
|
||||
|
|
|
@ -95,7 +95,9 @@ async function testLink(
|
|||
href = link.href;
|
||||
} else {
|
||||
href = await SpecialPowers.spawn(
|
||||
browser, [[testSubFrame, aLinkIndexOrFunction]], function([subFrame, index]) {
|
||||
browser,
|
||||
[[testSubFrame, aLinkIndexOrFunction]],
|
||||
function([subFrame, index]) {
|
||||
let doc = subFrame
|
||||
? content.document.querySelector("iframe").contentDocument
|
||||
: content.document;
|
||||
|
|
|
@ -24,7 +24,9 @@ add_task(async function() {
|
|||
element: "body",
|
||||
go() {
|
||||
return SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [{ writeDomainURL }], async function(arg) {
|
||||
gBrowser.selectedBrowser,
|
||||
[{ writeDomainURL }],
|
||||
async function(arg) {
|
||||
let contentBody = content.document.body;
|
||||
contentBody.style.backgroundImage =
|
||||
"url('" + arg.writeDomainURL + "')";
|
||||
|
@ -50,7 +52,9 @@ add_task(async function() {
|
|||
element: "img",
|
||||
go() {
|
||||
return SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [{ writeDomainURL }], async function(arg) {
|
||||
gBrowser.selectedBrowser,
|
||||
[{ writeDomainURL }],
|
||||
async function(arg) {
|
||||
let doc = content.document;
|
||||
let img = doc.createElement("img");
|
||||
img.height = 100;
|
||||
|
@ -80,7 +84,9 @@ add_task(async function() {
|
|||
frameIndex: 0,
|
||||
go() {
|
||||
return SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [{ writeDomainURL }], async function(arg) {
|
||||
gBrowser.selectedBrowser,
|
||||
[{ writeDomainURL }],
|
||||
async function(arg) {
|
||||
let doc = content.document;
|
||||
let iframe = doc.createElement("iframe");
|
||||
iframe.setAttribute("src", arg.writeDomainURL);
|
||||
|
|
|
@ -52,10 +52,14 @@ async function openNewTab(aWindow, aExpectedURL) {
|
|||
false,
|
||||
aExpectedURL
|
||||
);
|
||||
let alreadyLoaded = await SpecialPowers.spawn(browser, [aExpectedURL], url => {
|
||||
let doc = content.document;
|
||||
return doc && doc.readyState === "complete" && doc.location.href == url;
|
||||
});
|
||||
let alreadyLoaded = await SpecialPowers.spawn(
|
||||
browser,
|
||||
[aExpectedURL],
|
||||
url => {
|
||||
let doc = content.document;
|
||||
return doc && doc.readyState === "complete" && doc.location.href == url;
|
||||
}
|
||||
);
|
||||
if (!alreadyLoaded) {
|
||||
await loadPromise;
|
||||
}
|
||||
|
|
|
@ -71,10 +71,14 @@ async function openNewTab(aWindow, aExpectedURL) {
|
|||
false,
|
||||
aExpectedURL
|
||||
);
|
||||
let alreadyLoaded = await SpecialPowers.spawn(browser, [aExpectedURL], url => {
|
||||
let doc = content.document;
|
||||
return doc && doc.readyState === "complete" && doc.location.href == url;
|
||||
});
|
||||
let alreadyLoaded = await SpecialPowers.spawn(
|
||||
browser,
|
||||
[aExpectedURL],
|
||||
url => {
|
||||
let doc = content.document;
|
||||
return doc && doc.readyState === "complete" && doc.location.href == url;
|
||||
}
|
||||
);
|
||||
if (!alreadyLoaded) {
|
||||
await loadPromise;
|
||||
}
|
||||
|
|
|
@ -277,7 +277,9 @@ function waitForWindowOpen(aOptions) {
|
|||
|
||||
function executeWindowOpenInContent(aParam) {
|
||||
SpecialPowers.spawn(
|
||||
newBrowser.selectedBrowser, [JSON.stringify(aParam)], async function(dataTestParam) {
|
||||
newBrowser.selectedBrowser,
|
||||
[JSON.stringify(aParam)],
|
||||
async function(dataTestParam) {
|
||||
let testElm = content.document.getElementById("test");
|
||||
testElm.setAttribute("data-test-param", dataTestParam);
|
||||
testElm.click();
|
||||
|
|
|
@ -33,7 +33,9 @@ add_task(async function() {
|
|||
}));
|
||||
|
||||
let validLinks = await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [items], function(contentItems) {
|
||||
gBrowser.selectedBrowser,
|
||||
[items],
|
||||
function(contentItems) {
|
||||
let contentValidLinks = 0;
|
||||
Array.prototype.forEach.call(
|
||||
content.document.querySelectorAll("link, style"),
|
||||
|
|
|
@ -174,7 +174,9 @@ add_task(async function() {
|
|||
|
||||
for (let testid = 0; testid < checks.length; testid++) {
|
||||
let menuPosition = await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [{ testid }], async function(arg) {
|
||||
gBrowser.selectedBrowser,
|
||||
[{ testid }],
|
||||
async function(arg) {
|
||||
let range = content.tests[arg.testid]();
|
||||
|
||||
// Get the range of the selection and determine its coordinates. These
|
||||
|
|
|
@ -240,7 +240,11 @@ async function withNewTabInput(grantPermission, browser) {
|
|||
await popupHidden;
|
||||
is(testPermission(), Services.perms.DENY_ACTION, "permission denied");
|
||||
}
|
||||
await SpecialPowers.spawn(browser, [grantPermission], extractCanvasDataUserInput);
|
||||
await SpecialPowers.spawn(
|
||||
browser,
|
||||
[grantPermission],
|
||||
extractCanvasDataUserInput
|
||||
);
|
||||
await SpecialPowers.popPrefEnv();
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,9 @@ add_task(async function test_backspace() {
|
|||
EventUtils.synthesizeKey("KEY_Backspace", {});
|
||||
|
||||
let fieldValue = await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [], async function() {
|
||||
tab.linkedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
return content.keysPromise;
|
||||
}
|
||||
);
|
||||
|
|
|
@ -182,7 +182,9 @@ add_task(async function testTempPermissionOnNavigation() {
|
|||
|
||||
// Navigate to another domain.
|
||||
await SpecialPowers.spawn(
|
||||
browser, [], () => (content.document.location = "https://example.org/")
|
||||
browser,
|
||||
[],
|
||||
() => (content.document.location = "https://example.org/")
|
||||
);
|
||||
|
||||
await loaded;
|
||||
|
@ -200,7 +202,9 @@ add_task(async function testTempPermissionOnNavigation() {
|
|||
|
||||
// Navigate to the original domain.
|
||||
await SpecialPowers.spawn(
|
||||
browser, [], () => (content.document.location = "https://example.com/")
|
||||
browser,
|
||||
[],
|
||||
() => (content.document.location = "https://example.com/")
|
||||
);
|
||||
|
||||
await loaded;
|
||||
|
|
|
@ -125,7 +125,9 @@ add_task(async function() {
|
|||
ok(!pluginInfo.activated, "plugin should not be activated");
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
gNewWindow.gBrowser.selectedBrowser, [], async function() {
|
||||
gNewWindow.gBrowser.selectedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let bounds = plugin.getBoundingClientRect();
|
||||
|
|
|
@ -68,7 +68,9 @@ add_task(async function() {
|
|||
);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [testcase.name], async function testPlugins(name) {
|
||||
tab.linkedBrowser,
|
||||
[testcase.name],
|
||||
async function testPlugins(name) {
|
||||
let testcaseDiv = content.document.getElementById(`testcase_${name}`);
|
||||
let ctpPlugins = testcaseDiv.querySelectorAll(".expected_ctp");
|
||||
|
||||
|
|
|
@ -80,7 +80,9 @@ add_task(async function() {
|
|||
// Work around for delayed PluginBindingAttached
|
||||
await promiseUpdatePluginBindings(gTestBrowser);
|
||||
|
||||
await SpecialPowers.spawn(gTestBrowser, [gTestcases], async function(testcases) {
|
||||
await SpecialPowers.spawn(gTestBrowser, [gTestcases], async function(
|
||||
testcases
|
||||
) {
|
||||
let doc = content.document;
|
||||
|
||||
for (let testcaseId of Object.keys(testcases)) {
|
||||
|
|
|
@ -18,7 +18,9 @@ async function isEmePersistentStateSupported(mode) {
|
|||
let win = await BrowserTestUtils.openNewBrowserWindow(mode);
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(win.gBrowser, TEST_URL);
|
||||
let persistentStateSupported = await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [], async function() {
|
||||
tab.linkedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
try {
|
||||
let config = [
|
||||
{
|
||||
|
|
|
@ -52,7 +52,9 @@ add_task(async function test_plugin_accessible_in_subframe() {
|
|||
},
|
||||
async function(browser) {
|
||||
await SpecialPowers.spawn(
|
||||
browser, [[TEST_PLUGIN_NAME, DOMAIN_2]], async function([pluginName, domain2]) {
|
||||
browser,
|
||||
[[TEST_PLUGIN_NAME, DOMAIN_2]],
|
||||
async function([pluginName, domain2]) {
|
||||
Assert.ok(
|
||||
content.navigator.plugins[pluginName],
|
||||
"Top-level document should find Test Plugin"
|
||||
|
@ -71,7 +73,11 @@ add_task(async function test_plugin_accessible_in_subframe() {
|
|||
"HiddenPlugin",
|
||||
function onHiddenPlugin(e) {
|
||||
sawEvent = true;
|
||||
docShell.chromeEventHandler.removeEventListener("HiddenPlugin", onHiddenPlugin, true);
|
||||
docShell.chromeEventHandler.removeEventListener(
|
||||
"HiddenPlugin",
|
||||
onHiddenPlugin,
|
||||
true
|
||||
);
|
||||
},
|
||||
true
|
||||
);
|
||||
|
|
|
@ -20,7 +20,9 @@ add_task(async function test_opening_blocked_popups() {
|
|||
);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [baseURL + "popup_blocker.html"], uri => {
|
||||
tab.linkedBrowser,
|
||||
[baseURL + "popup_blocker.html"],
|
||||
uri => {
|
||||
let iframe = content.document.createElement("iframe");
|
||||
iframe.id = "popupframe";
|
||||
iframe.src = uri;
|
||||
|
@ -80,7 +82,9 @@ add_task(async function test_opening_blocked_popups() {
|
|||
|
||||
// Remove the frame and add another one:
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [baseURL + "popup_blocker.html"], uri => {
|
||||
tab.linkedBrowser,
|
||||
[baseURL + "popup_blocker.html"],
|
||||
uri => {
|
||||
content.document.getElementById("popupframe").remove();
|
||||
let iframe = content.document.createElement("iframe");
|
||||
iframe.id = "popupframe";
|
||||
|
|
|
@ -50,7 +50,9 @@ async function doTest(
|
|||
|
||||
// Wait for the script in the page to update the contents of the test div.
|
||||
await SpecialPowers.spawn(
|
||||
browser, [childTabSpec], async childTabSpecContent => {
|
||||
browser,
|
||||
[childTabSpec],
|
||||
async childTabSpecContent => {
|
||||
let testDiv = content.document.getElementById("mctestdiv");
|
||||
await ContentTaskUtils.waitForCondition(
|
||||
() => testDiv.innerHTML == "Mixed Content Blocker disabled"
|
||||
|
|
|
@ -54,7 +54,9 @@ add_task(async function test1() {
|
|||
"Verifying MCB does not trigger warning/error for an http page ";
|
||||
expected += "with https css that includes http image";
|
||||
|
||||
await SpecialPowers.spawn(gTestBrowser, [expected], async function(condition) {
|
||||
await SpecialPowers.spawn(gTestBrowser, [expected], async function(
|
||||
condition
|
||||
) {
|
||||
await ContentTaskUtils.waitForCondition(
|
||||
() => content.document.getElementById("testDiv").innerHTML == condition,
|
||||
"Waited too long for status in Test 1!"
|
||||
|
@ -77,7 +79,9 @@ add_task(async function test2() {
|
|||
"Verifying MCB does not trigger warning/error for an http page ";
|
||||
expected += "with https css that includes http font";
|
||||
|
||||
await SpecialPowers.spawn(gTestBrowser, [expected], async function(condition) {
|
||||
await SpecialPowers.spawn(gTestBrowser, [expected], async function(
|
||||
condition
|
||||
) {
|
||||
await ContentTaskUtils.waitForCondition(
|
||||
() => content.document.getElementById("testDiv").innerHTML == condition,
|
||||
"Waited too long for status in Test 2!"
|
||||
|
@ -100,7 +104,9 @@ add_task(async function test3() {
|
|||
expected +=
|
||||
"with https css that imports another http css which includes http font";
|
||||
|
||||
await SpecialPowers.spawn(gTestBrowser, [expected], async function(condition) {
|
||||
await SpecialPowers.spawn(gTestBrowser, [expected], async function(
|
||||
condition
|
||||
) {
|
||||
await ContentTaskUtils.waitForCondition(
|
||||
() => content.document.getElementById("testDiv").innerHTML == condition,
|
||||
"Waited too long for status in Test 3!"
|
||||
|
|
|
@ -39,7 +39,9 @@ add_task(async function() {
|
|||
BrowserTestUtils.removeTab(viewSourceTab);
|
||||
});
|
||||
await SpecialPowers.spawn(
|
||||
viewSourceTab.linkedBrowser, [DATA_URI_SOURCE], uri => {
|
||||
viewSourceTab.linkedBrowser,
|
||||
[DATA_URI_SOURCE],
|
||||
uri => {
|
||||
is(
|
||||
content.document.documentURI,
|
||||
uri,
|
||||
|
|
|
@ -7,7 +7,9 @@ async function installTrigger(filename) {
|
|||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
||||
SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [`${BASE}/${filename}`], async function(url) {
|
||||
gBrowser.selectedBrowser,
|
||||
[`${BASE}/${filename}`],
|
||||
async function(url) {
|
||||
content.wrappedJSObject.installTrigger(url);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -7,7 +7,9 @@ async function installMozAM(filename) {
|
|||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [`${BASE}/${filename}`], async function(url) {
|
||||
gBrowser.selectedBrowser,
|
||||
[`${BASE}/${filename}`],
|
||||
async function(url) {
|
||||
await content.wrappedJSObject.installMozAM(url);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -24,7 +24,9 @@ add_task(async function test_unsigned() {
|
|||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
||||
SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [`${BASE}/browser_webext_unsigned.xpi`], async function(url) {
|
||||
gBrowser.selectedBrowser,
|
||||
[`${BASE}/browser_webext_unsigned.xpi`],
|
||||
async function(url) {
|
||||
content.wrappedJSObject.installTrigger(url);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -2,55 +2,61 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function setTrackEnabled(audio, video) {
|
||||
return SpecialPowers.spawn(gBrowser.selectedBrowser, [{ audio, video }], function(
|
||||
args
|
||||
) {
|
||||
let stream = content.wrappedJSObject.gStreams[0];
|
||||
if (args.audio != null) {
|
||||
stream.getAudioTracks()[0].enabled = args.audio;
|
||||
return SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[{ audio, video }],
|
||||
function(args) {
|
||||
let stream = content.wrappedJSObject.gStreams[0];
|
||||
if (args.audio != null) {
|
||||
stream.getAudioTracks()[0].enabled = args.audio;
|
||||
}
|
||||
if (args.video != null) {
|
||||
stream.getVideoTracks()[0].enabled = args.video;
|
||||
}
|
||||
}
|
||||
if (args.video != null) {
|
||||
stream.getVideoTracks()[0].enabled = args.video;
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
function cloneTracks(audio, video) {
|
||||
return SpecialPowers.spawn(gBrowser.selectedBrowser, [{ audio, video }], function(
|
||||
args
|
||||
) {
|
||||
if (!content.wrappedJSObject.gClones) {
|
||||
content.wrappedJSObject.gClones = [];
|
||||
return SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[{ audio, video }],
|
||||
function(args) {
|
||||
if (!content.wrappedJSObject.gClones) {
|
||||
content.wrappedJSObject.gClones = [];
|
||||
}
|
||||
let clones = content.wrappedJSObject.gClones;
|
||||
let stream = content.wrappedJSObject.gStreams[0];
|
||||
if (args.audio != null) {
|
||||
clones.push(stream.getAudioTracks()[0].clone());
|
||||
}
|
||||
if (args.video != null) {
|
||||
clones.push(stream.getVideoTracks()[0].clone());
|
||||
}
|
||||
}
|
||||
let clones = content.wrappedJSObject.gClones;
|
||||
let stream = content.wrappedJSObject.gStreams[0];
|
||||
if (args.audio != null) {
|
||||
clones.push(stream.getAudioTracks()[0].clone());
|
||||
}
|
||||
if (args.video != null) {
|
||||
clones.push(stream.getVideoTracks()[0].clone());
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
function stopClonedTracks(audio, video) {
|
||||
return SpecialPowers.spawn(gBrowser.selectedBrowser, [{ audio, video }], function(
|
||||
args
|
||||
) {
|
||||
let clones = content.wrappedJSObject.gClones || [];
|
||||
if (args.audio != null) {
|
||||
clones.filter(t => t.kind == "audio").forEach(t => t.stop());
|
||||
return SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[{ audio, video }],
|
||||
function(args) {
|
||||
let clones = content.wrappedJSObject.gClones || [];
|
||||
if (args.audio != null) {
|
||||
clones.filter(t => t.kind == "audio").forEach(t => t.stop());
|
||||
}
|
||||
if (args.video != null) {
|
||||
clones.filter(t => t.kind == "video").forEach(t => t.stop());
|
||||
}
|
||||
let liveClones = clones.filter(t => t.readyState == "live");
|
||||
if (!liveClones.length) {
|
||||
delete content.wrappedJSObject.gClones;
|
||||
} else {
|
||||
content.wrappedJSObject.gClones = liveClones;
|
||||
}
|
||||
}
|
||||
if (args.video != null) {
|
||||
clones.filter(t => t.kind == "video").forEach(t => t.stop());
|
||||
}
|
||||
let liveClones = clones.filter(t => t.readyState == "live");
|
||||
if (!liveClones.length) {
|
||||
delete content.wrappedJSObject.gClones;
|
||||
} else {
|
||||
content.wrappedJSObject.gClones = liveClones;
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
var gTests = [
|
||||
|
|
|
@ -276,7 +276,9 @@ function expectObserverCalledOnClose(
|
|||
|
||||
function promiseMessage(aMessage, aAction, aCount = 1) {
|
||||
let promise = SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [[aMessage, aCount]], async function([expectedMessage, expectedCount]) {
|
||||
gBrowser.selectedBrowser,
|
||||
[[aMessage, aCount]],
|
||||
async function([expectedMessage, expectedCount]) {
|
||||
return new Promise(resolve => {
|
||||
function listenForMessage({ data }) {
|
||||
if (
|
||||
|
@ -444,7 +446,9 @@ function promiseRequestDevice(
|
|||
) {
|
||||
info("requesting devices");
|
||||
return SpecialPowers.spawn(
|
||||
aBrowser, [{ aRequestAudio, aRequestVideo, aFrameId, aType, aBadDevice }], async function(args) {
|
||||
aBrowser,
|
||||
[{ aRequestAudio, aRequestVideo, aFrameId, aType, aBadDevice }],
|
||||
async function(args) {
|
||||
let global = content.wrappedJSObject;
|
||||
if (args.aFrameId) {
|
||||
global = global.document.getElementById(args.aFrameId).contentWindow;
|
||||
|
@ -479,15 +483,17 @@ async function closeStream(
|
|||
}
|
||||
|
||||
info("closing the stream");
|
||||
await SpecialPowers.spawn(gBrowser.selectedBrowser, [aFrameId], async function(
|
||||
contentFrameId
|
||||
) {
|
||||
let global = content.wrappedJSObject;
|
||||
if (contentFrameId) {
|
||||
global = global.document.getElementById(contentFrameId).contentWindow;
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[aFrameId],
|
||||
async function(contentFrameId) {
|
||||
let global = content.wrappedJSObject;
|
||||
if (contentFrameId) {
|
||||
global = global.document.getElementById(contentFrameId).contentWindow;
|
||||
}
|
||||
global.closeStream();
|
||||
}
|
||||
global.closeStream();
|
||||
});
|
||||
);
|
||||
|
||||
await Promise.all(observerPromises);
|
||||
|
||||
|
@ -503,7 +509,9 @@ async function reloadAndAssertClosedStreams() {
|
|||
|
||||
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], "() => content.location.reload()"
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
"() => content.location.reload()"
|
||||
);
|
||||
|
||||
await loadedPromise;
|
||||
|
|
|
@ -37,24 +37,30 @@ add_task(async function test_added_login_shows_breach_warning() {
|
|||
});
|
||||
|
||||
TEST_LOGIN3 = await addLogin(TEST_LOGIN3);
|
||||
await SpecialPowers.spawn(browser, [TEST_LOGIN3.guid], async aTestLogin3Guid => {
|
||||
let loginList = Cu.waiveXrays(content.document.querySelector("login-list"));
|
||||
is(
|
||||
loginList._loginGuidsSortedOrder.length,
|
||||
1,
|
||||
"one login should be in the list"
|
||||
);
|
||||
let breachedLoginListItems;
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
breachedLoginListItems = loginList._list.querySelectorAll(
|
||||
".login-list-item[data-guid].breached"
|
||||
await SpecialPowers.spawn(
|
||||
browser,
|
||||
[TEST_LOGIN3.guid],
|
||||
async aTestLogin3Guid => {
|
||||
let loginList = Cu.waiveXrays(
|
||||
content.document.querySelector("login-list")
|
||||
);
|
||||
return breachedLoginListItems.length == 1;
|
||||
}, "waiting for the login to get marked as breached");
|
||||
is(
|
||||
breachedLoginListItems[0].dataset.guid,
|
||||
aTestLogin3Guid,
|
||||
"the breached login should be login3"
|
||||
);
|
||||
});
|
||||
is(
|
||||
loginList._loginGuidsSortedOrder.length,
|
||||
1,
|
||||
"one login should be in the list"
|
||||
);
|
||||
let breachedLoginListItems;
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
breachedLoginListItems = loginList._list.querySelectorAll(
|
||||
".login-list-item[data-guid].breached"
|
||||
);
|
||||
return breachedLoginListItems.length == 1;
|
||||
}, "waiting for the login to get marked as breached");
|
||||
is(
|
||||
breachedLoginListItems[0].dataset.guid,
|
||||
aTestLogin3Guid,
|
||||
"the breached login should be login3"
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
@ -31,7 +31,9 @@ const gTests = [
|
|||
async setup(browser) {
|
||||
// load up the edit login view
|
||||
await SpecialPowers.spawn(
|
||||
browser, [LoginHelper.loginToVanillaObject(TEST_LOGIN1)], async login => {
|
||||
browser,
|
||||
[LoginHelper.loginToVanillaObject(TEST_LOGIN1)],
|
||||
async login => {
|
||||
let loginList = content.document.querySelector("login-list");
|
||||
let loginListItem = loginList.shadowRoot.querySelector(
|
||||
".login-list-item[data-guid]:not([hidden])"
|
||||
|
|
|
@ -50,7 +50,9 @@ add_task(async function test() {
|
|||
await SimpleTest.promiseClipboardChange(
|
||||
testObj.expectedValue,
|
||||
async () => {
|
||||
await SpecialPowers.spawn(browser, [testObj], async function(aTestObj) {
|
||||
await SpecialPowers.spawn(browser, [testObj], async function(
|
||||
aTestObj
|
||||
) {
|
||||
let loginItem = content.document.querySelector("login-item");
|
||||
let copyButton = loginItem.shadowRoot.querySelector(
|
||||
aTestObj.copyButtonSelector
|
||||
|
|
|
@ -52,7 +52,9 @@ add_task(async function test_create_login() {
|
|||
);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [[originTuple, i]], async ([aOriginTuple, index]) => {
|
||||
browser,
|
||||
[[originTuple, i]],
|
||||
async ([aOriginTuple, index]) => {
|
||||
let loginList = Cu.waiveXrays(
|
||||
content.document.querySelector("login-list")
|
||||
);
|
||||
|
@ -239,14 +241,20 @@ add_task(async function test_create_login() {
|
|||
});
|
||||
}
|
||||
|
||||
await SpecialPowers.spawn(browser, [testCases.length], async testCasesLength => {
|
||||
let loginList = Cu.waiveXrays(content.document.querySelector("login-list"));
|
||||
is(
|
||||
loginList._loginGuidsSortedOrder.length,
|
||||
5,
|
||||
"login list should have a login per testcase"
|
||||
);
|
||||
});
|
||||
await SpecialPowers.spawn(
|
||||
browser,
|
||||
[testCases.length],
|
||||
async testCasesLength => {
|
||||
let loginList = Cu.waiveXrays(
|
||||
content.document.querySelector("login-list")
|
||||
);
|
||||
is(
|
||||
loginList._loginGuidsSortedOrder.length,
|
||||
5,
|
||||
"login list should have a login per testcase"
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
add_task(async function test_cancel_create_login() {
|
||||
|
|
|
@ -17,7 +17,9 @@ add_task(async function test_show_logins() {
|
|||
let browser = gBrowser.selectedBrowser;
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [[TEST_LOGIN1.guid, TEST_LOGIN2.guid]], async loginGuids => {
|
||||
browser,
|
||||
[[TEST_LOGIN1.guid, TEST_LOGIN2.guid]],
|
||||
async loginGuids => {
|
||||
let loginList = Cu.waiveXrays(
|
||||
content.document.querySelector("login-list")
|
||||
);
|
||||
|
|
|
@ -131,7 +131,9 @@ add_task(async function test_login_syncing_enabled() {
|
|||
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
await SpecialPowers.spawn(
|
||||
browser, [[TEST_EMAIL, TEST_AVATAR_URL]], async ([expectedEmail, expectedAvatarURL]) => {
|
||||
browser,
|
||||
[[TEST_EMAIL, TEST_AVATAR_URL]],
|
||||
async ([expectedEmail, expectedAvatarURL]) => {
|
||||
let fxAccountsButton = content.document.querySelector(
|
||||
"fxaccounts-button"
|
||||
);
|
||||
|
|
|
@ -25,7 +25,9 @@ add_task(async function test_showLoginItemErrors() {
|
|||
EXPECTED_ERROR_MESSAGE = "This login already exists.";
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [LoginHelper.loginToVanillaObject(LOGIN_TO_UPDATE)], async loginToUpdate => {
|
||||
browser,
|
||||
[LoginHelper.loginToVanillaObject(LOGIN_TO_UPDATE)],
|
||||
async loginToUpdate => {
|
||||
const loginItem = Cu.waiveXrays(
|
||||
content.document.querySelector("login-item")
|
||||
);
|
||||
|
|
|
@ -24,7 +24,9 @@ add_task(async function test_sort_order_persisted() {
|
|||
},
|
||||
async function(browser) {
|
||||
await SpecialPowers.spawn(
|
||||
browser, [[TEST_LOGIN1, TEST_LOGIN2]], async function([testLogin1, testLogin2]) {
|
||||
browser,
|
||||
[[TEST_LOGIN1, TEST_LOGIN2]],
|
||||
async function([testLogin1, testLogin2]) {
|
||||
let loginList = Cu.waiveXrays(
|
||||
content.document.querySelector("login-list")
|
||||
);
|
||||
|
@ -63,7 +65,9 @@ add_task(async function test_sort_order_persisted() {
|
|||
url: "about:logins",
|
||||
},
|
||||
async function(browser) {
|
||||
await SpecialPowers.spawn(browser, [TEST_LOGIN1], async function(testLogin1) {
|
||||
await SpecialPowers.spawn(browser, [TEST_LOGIN1], async function(
|
||||
testLogin1
|
||||
) {
|
||||
let loginList = Cu.waiveXrays(
|
||||
content.document.querySelector("login-list")
|
||||
);
|
||||
|
|
|
@ -30,13 +30,19 @@ function waitForMPDialog(action) {
|
|||
}
|
||||
|
||||
function waitForLoginCountToReach(browser, loginCount) {
|
||||
return SpecialPowers.spawn(browser, [loginCount], async expectedLoginCount => {
|
||||
let loginList = Cu.waiveXrays(content.document.querySelector("login-list"));
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
return loginList._loginGuidsSortedOrder.length == expectedLoginCount;
|
||||
});
|
||||
return loginList._loginGuidsSortedOrder.length;
|
||||
});
|
||||
return SpecialPowers.spawn(
|
||||
browser,
|
||||
[loginCount],
|
||||
async expectedLoginCount => {
|
||||
let loginList = Cu.waiveXrays(
|
||||
content.document.querySelector("login-list")
|
||||
);
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
return loginList._loginGuidsSortedOrder.length == expectedLoginCount;
|
||||
});
|
||||
return loginList._loginGuidsSortedOrder.length;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
add_task(async function test() {
|
||||
|
|
|
@ -14,7 +14,9 @@ add_task(async function setup() {
|
|||
add_task(async function test_no_logins_class() {
|
||||
let { platform } = AppConstants;
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [platform], async aPlatform => {
|
||||
gBrowser.selectedBrowser,
|
||||
[platform],
|
||||
async aPlatform => {
|
||||
let loginList = content.document.querySelector("login-list");
|
||||
|
||||
ok(
|
||||
|
@ -130,7 +132,9 @@ add_task(
|
|||
TEST_LOGIN1 = await addLogin(TEST_LOGIN1);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [TEST_LOGIN1.guid], async testLogin1Guid => {
|
||||
gBrowser.selectedBrowser,
|
||||
[TEST_LOGIN1.guid],
|
||||
async testLogin1Guid => {
|
||||
let loginList = content.document.querySelector("login-list");
|
||||
let loginItem = content.document.querySelector("login-item");
|
||||
let loginIntro = content.document.querySelector("login-intro");
|
||||
|
|
|
@ -59,7 +59,9 @@ add_task(async function test_open_feedback() {
|
|||
// when trying to call element.ownerGlobal on the targeted shadow DOM node. This is
|
||||
// on file as bug 1557489. As a workaround, this manually calculates the position to click.
|
||||
let { x, y } = await SpecialPowers.spawn(
|
||||
browser, [selector], async menuItemSelector => {
|
||||
browser,
|
||||
[selector],
|
||||
async menuItemSelector => {
|
||||
let menuButton = Cu.waiveXrays(
|
||||
content.document.querySelector("menu-button")
|
||||
);
|
||||
|
|
|
@ -30,7 +30,9 @@ add_task(async function test_show_logins() {
|
|||
add_task(async function test_login_item() {
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
await SpecialPowers.spawn(
|
||||
browser, [LoginHelper.loginToVanillaObject(TEST_LOGIN1)], async login => {
|
||||
browser,
|
||||
[LoginHelper.loginToVanillaObject(TEST_LOGIN1)],
|
||||
async login => {
|
||||
let loginList = Cu.waiveXrays(
|
||||
content.document.querySelector("login-list")
|
||||
);
|
||||
|
|
|
@ -83,7 +83,9 @@ async function runTestForReceiver(receiver) {
|
|||
// then send a message from a tab in the same user context
|
||||
for (let sender of [sender1, sender2]) {
|
||||
await SpecialPowers.spawn(
|
||||
sender.browser, [{ name: channelName, message: sender.message }], function(opts) {
|
||||
sender.browser,
|
||||
[{ name: channelName, message: sender.message }],
|
||||
function(opts) {
|
||||
let bc = new content.window.BroadcastChannel(opts.name);
|
||||
bc.postMessage(opts.message);
|
||||
}
|
||||
|
|
|
@ -114,7 +114,9 @@ add_task(async function test() {
|
|||
|
||||
// Update the media key for the default container.
|
||||
let result = await SpecialPowers.spawn(
|
||||
defaultContainer.browser, [keyInfo], async function(aKeyInfo) {
|
||||
defaultContainer.browser,
|
||||
[keyInfo],
|
||||
async function(aKeyInfo) {
|
||||
let access = await content.navigator.requestMediaKeySystemAccess(
|
||||
"org.w3.clearkey",
|
||||
[
|
||||
|
@ -180,32 +182,38 @@ add_task(async function test() {
|
|||
USER_ID_PERSONAL
|
||||
);
|
||||
|
||||
await SpecialPowers.spawn(personalContainer.browser, [keyInfo], async function(
|
||||
aKeyInfo
|
||||
) {
|
||||
let access = await content.navigator.requestMediaKeySystemAccess(
|
||||
"org.w3.clearkey",
|
||||
[
|
||||
{
|
||||
initDataTypes: [aKeyInfo.initDataType],
|
||||
videoCapabilities: [{ contentType: "video/webm" }],
|
||||
sessionTypes: ["persistent-license"],
|
||||
persistentState: "required",
|
||||
},
|
||||
]
|
||||
);
|
||||
let mediaKeys = await access.createMediaKeys();
|
||||
let session = mediaKeys.createSession(aKeyInfo.sessionType);
|
||||
await SpecialPowers.spawn(
|
||||
personalContainer.browser,
|
||||
[keyInfo],
|
||||
async function(aKeyInfo) {
|
||||
let access = await content.navigator.requestMediaKeySystemAccess(
|
||||
"org.w3.clearkey",
|
||||
[
|
||||
{
|
||||
initDataTypes: [aKeyInfo.initDataType],
|
||||
videoCapabilities: [{ contentType: "video/webm" }],
|
||||
sessionTypes: ["persistent-license"],
|
||||
persistentState: "required",
|
||||
},
|
||||
]
|
||||
);
|
||||
let mediaKeys = await access.createMediaKeys();
|
||||
let session = mediaKeys.createSession(aKeyInfo.sessionType);
|
||||
|
||||
// First, load the session to check that mediakeys do not share with
|
||||
// default container.
|
||||
await session.load(aKeyInfo.sessionId);
|
||||
// First, load the session to check that mediakeys do not share with
|
||||
// default container.
|
||||
await session.load(aKeyInfo.sessionId);
|
||||
|
||||
let map = session.keyStatuses;
|
||||
let map = session.keyStatuses;
|
||||
|
||||
// Check that there is no media key here.
|
||||
is(map.size, 0, "No media key should be here for the personal container.");
|
||||
});
|
||||
// Check that there is no media key here.
|
||||
is(
|
||||
map.size,
|
||||
0,
|
||||
"No media key should be here for the personal container."
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// Close default container tab.
|
||||
BrowserTestUtils.removeTab(defaultContainer.tab);
|
||||
|
|
|
@ -120,7 +120,9 @@ add_task(async function test() {
|
|||
|
||||
// Write a cookie according to the userContext.
|
||||
await SpecialPowers.spawn(
|
||||
tabInfo.browser, [{ userContext: USER_CONTEXTS[userContextId] }], function(arg) {
|
||||
tabInfo.browser,
|
||||
[{ userContext: USER_CONTEXTS[userContextId] }],
|
||||
function(arg) {
|
||||
content.document.cookie = "userContext=" + arg.userContext;
|
||||
}
|
||||
);
|
||||
|
|
|
@ -31,50 +31,52 @@ async function openTabInUserContext(uri, userContextId) {
|
|||
|
||||
// Setup an entry for the indexedDB.
|
||||
async function setupIndexedDB(browser) {
|
||||
await SpecialPowers.spawn(browser, [{ input: "TestForgetAPIs" }], async function(
|
||||
arg
|
||||
) {
|
||||
let request = content.indexedDB.open("idb", 1);
|
||||
await SpecialPowers.spawn(
|
||||
browser,
|
||||
[{ input: "TestForgetAPIs" }],
|
||||
async function(arg) {
|
||||
let request = content.indexedDB.open("idb", 1);
|
||||
|
||||
request.onerror = function() {
|
||||
throw new Error("error opening db connection");
|
||||
};
|
||||
|
||||
request.onupgradeneeded = event => {
|
||||
let db = event.target.result;
|
||||
let store = db.createObjectStore("obj", { keyPath: "id" });
|
||||
store.createIndex("userContext", "userContext", { unique: false });
|
||||
};
|
||||
|
||||
let db = await new Promise(resolve => {
|
||||
request.onsuccess = event => {
|
||||
resolve(event.target.result);
|
||||
request.onerror = function() {
|
||||
throw new Error("error opening db connection");
|
||||
};
|
||||
});
|
||||
|
||||
// Add an entry into the indexedDB.
|
||||
let transaction = db.transaction(["obj"], "readwrite");
|
||||
let store = transaction.objectStore("obj");
|
||||
store.add({ id: 1, userContext: arg.input });
|
||||
|
||||
await new Promise(resolve => {
|
||||
transaction.oncomplete = () => {
|
||||
resolve();
|
||||
request.onupgradeneeded = event => {
|
||||
let db = event.target.result;
|
||||
let store = db.createObjectStore("obj", { keyPath: "id" });
|
||||
store.createIndex("userContext", "userContext", { unique: false });
|
||||
};
|
||||
});
|
||||
|
||||
// Check the indexedDB has been set properly.
|
||||
transaction = db.transaction(["obj"], "readonly");
|
||||
store = transaction.objectStore("obj");
|
||||
let getRequest = store.get(1);
|
||||
await new Promise(resolve => {
|
||||
getRequest.onsuccess = () => {
|
||||
let res = getRequest.result;
|
||||
is(res.userContext, arg.input, "Check the indexedDB value");
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
});
|
||||
let db = await new Promise(resolve => {
|
||||
request.onsuccess = event => {
|
||||
resolve(event.target.result);
|
||||
};
|
||||
});
|
||||
|
||||
// Add an entry into the indexedDB.
|
||||
let transaction = db.transaction(["obj"], "readwrite");
|
||||
let store = transaction.objectStore("obj");
|
||||
store.add({ id: 1, userContext: arg.input });
|
||||
|
||||
await new Promise(resolve => {
|
||||
transaction.oncomplete = () => {
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
|
||||
// Check the indexedDB has been set properly.
|
||||
transaction = db.transaction(["obj"], "readonly");
|
||||
store = transaction.objectStore("obj");
|
||||
let getRequest = store.get(1);
|
||||
await new Promise(resolve => {
|
||||
getRequest.onsuccess = () => {
|
||||
let res = getRequest.result;
|
||||
is(res.userContext, arg.input, "Check the indexedDB value");
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Check whether the indexedDB has been cleared.
|
||||
|
|
|
@ -295,7 +295,9 @@ async function test_storage_cleared() {
|
|||
|
||||
// Check that the storages has been set correctly.
|
||||
await SpecialPowers.spawn(
|
||||
tabInfo.browser, [{ userContext: USER_CONTEXTS[userContextId] }], async function(arg) {
|
||||
tabInfo.browser,
|
||||
[{ userContext: USER_CONTEXTS[userContextId] }],
|
||||
async function(arg) {
|
||||
// Check that the local storage has been set correctly.
|
||||
Assert.equal(
|
||||
content.localStorage.getItem("userContext"),
|
||||
|
|
|
@ -40,16 +40,18 @@ add_task(async function test() {
|
|||
|
||||
// Let's try to open a window from tab1 with a name 'tab-2'.
|
||||
info("Opening a window from the first tab...");
|
||||
await SpecialPowers.spawn(browser1, [{ url: BASE_URI + "?new" }], async function(
|
||||
opts
|
||||
) {
|
||||
await new content.window.wrappedJSObject.Promise(resolve => {
|
||||
let w = content.window.wrappedJSObject.open(opts.url, "tab-2");
|
||||
w.onload = function() {
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
});
|
||||
await SpecialPowers.spawn(
|
||||
browser1,
|
||||
[{ url: BASE_URI + "?new" }],
|
||||
async function(opts) {
|
||||
await new content.window.wrappedJSObject.Promise(resolve => {
|
||||
let w = content.window.wrappedJSObject.open(opts.url, "tab-2");
|
||||
w.onload = function() {
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
is(browser1.contentTitle, "?old", "Tab1 title must be 'old'");
|
||||
is(browser1.contentPrincipal.userContextId, 1, "Tab1 UCI must be 1");
|
||||
|
|
|
@ -126,7 +126,9 @@ async function test_cookie_settings({
|
|||
);
|
||||
await tab.linkedBrowser.contentWindow.gotoPref("panePrivacy");
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [{ cookiesEnabled, cookieSettingsLocked }], async function({ cookiesEnabled, cookieSettingsLocked }) {
|
||||
tab.linkedBrowser,
|
||||
[{ cookiesEnabled, cookieSettingsLocked }],
|
||||
async function({ cookiesEnabled, cookieSettingsLocked }) {
|
||||
let deleteOnCloseCheckbox = content.document.getElementById(
|
||||
"deleteOnClose"
|
||||
);
|
||||
|
|
|
@ -34,7 +34,9 @@ async function test_popup_blocker_disabled({ disabled, locked }) {
|
|||
"about:preferences#privacy"
|
||||
);
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [{ disabled, locked }], async function({ disabled, locked }) {
|
||||
tab.linkedBrowser,
|
||||
[{ disabled, locked }],
|
||||
async function({ disabled, locked }) {
|
||||
let checkbox = content.document.getElementById("popupPolicy");
|
||||
is(
|
||||
checkbox.checked,
|
||||
|
|
|
@ -131,7 +131,9 @@ add_task(async function test_install_source_blocked_direct() {
|
|||
});
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [{ baseUrl: BASE_URL }], async function({ baseUrl }) {
|
||||
tab.linkedBrowser,
|
||||
[{ baseUrl: BASE_URL }],
|
||||
async function({ baseUrl }) {
|
||||
content.document.location.href = baseUrl + "policytest_v0.1.xpi";
|
||||
}
|
||||
);
|
||||
|
@ -229,7 +231,9 @@ add_task(async function test_install_source_allowed_direct() {
|
|||
});
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [{ baseUrl: BASE_URL }], async function({ baseUrl }) {
|
||||
tab.linkedBrowser,
|
||||
[{ baseUrl: BASE_URL }],
|
||||
async function({ baseUrl }) {
|
||||
content.document.location.href = baseUrl + "policytest_v0.1.xpi";
|
||||
}
|
||||
);
|
||||
|
|
|
@ -281,7 +281,9 @@ add_task(async function test_AddSearchProvider() {
|
|||
"http://example.com"
|
||||
);
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [{ engineURL }], async function(args) {
|
||||
gBrowser.selectedBrowser,
|
||||
[{ engineURL }],
|
||||
async function(args) {
|
||||
content.window.external.AddSearchProvider(args.engineURL);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -53,7 +53,9 @@ async function checkBlockedPage(url, expectedBlocked) {
|
|||
async function() {
|
||||
await BrowserTestUtils.waitForCondition(async function() {
|
||||
let blocked = await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], async function() {
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
return content.document.documentURI.startsWith("about:neterror");
|
||||
}
|
||||
);
|
||||
|
|
|
@ -455,7 +455,9 @@ add_task(async function test_show_hide_frame() {
|
|||
},
|
||||
async doOpenMenu() {
|
||||
frameId = await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], function() {
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
function() {
|
||||
const { WebNavigationFrames } = ChromeUtils.import(
|
||||
"resource://gre/modules/WebNavigationFrames.jsm"
|
||||
);
|
||||
|
@ -594,7 +596,9 @@ add_task(async function test_show_hide_editable_selection() {
|
|||
async doOpenMenu() {
|
||||
// Select lots of text in the test page before opening the menu.
|
||||
selectionText = await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], function() {
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
function() {
|
||||
let node = content.document.getElementById("editabletext");
|
||||
node.select();
|
||||
node.focus();
|
||||
|
|
|
@ -188,7 +188,9 @@ add_task(async function overrideContext_permissions() {
|
|||
|
||||
// permissions.request requires user input, export helper.
|
||||
await SpecialPowers.spawn(
|
||||
SidebarUI.browser.contentDocument.getElementById("webext-panels-browser"), [], () => {
|
||||
SidebarUI.browser.contentDocument.getElementById("webext-panels-browser"),
|
||||
[],
|
||||
() => {
|
||||
let { withHandlingUserInput } = ChromeUtils.import(
|
||||
"resource://gre/modules/ExtensionCommon.jsm",
|
||||
{}
|
||||
|
|
|
@ -166,18 +166,22 @@ add_task(async function test_pageAction_icon_on_subframe_navigation() {
|
|||
info("Create a sub-frame");
|
||||
|
||||
let subframeURL = `${BASE}#subframe-url-1`;
|
||||
await SpecialPowers.spawn(gBrowser.selectedBrowser, [subframeURL], async url => {
|
||||
const iframe = this.content.document.createElement("iframe");
|
||||
iframe.setAttribute("id", "test-subframe");
|
||||
iframe.setAttribute("src", url);
|
||||
iframe.setAttribute("style", "height: 200px; width: 200px");
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[subframeURL],
|
||||
async url => {
|
||||
const iframe = this.content.document.createElement("iframe");
|
||||
iframe.setAttribute("id", "test-subframe");
|
||||
iframe.setAttribute("src", url);
|
||||
iframe.setAttribute("style", "height: 200px; width: 200px");
|
||||
|
||||
// Await the initial url to be loaded in the subframe.
|
||||
await new Promise(resolve => {
|
||||
iframe.onload = resolve;
|
||||
this.content.document.body.appendChild(iframe);
|
||||
});
|
||||
});
|
||||
// Await the initial url to be loaded in the subframe.
|
||||
await new Promise(resolve => {
|
||||
iframe.onload = resolve;
|
||||
this.content.document.body.appendChild(iframe);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
await BrowserTestUtils.waitForCondition(() => {
|
||||
return document.getElementById(pageActionId);
|
||||
|
@ -186,15 +190,21 @@ add_task(async function test_pageAction_icon_on_subframe_navigation() {
|
|||
info("Navigating the sub-frame");
|
||||
|
||||
subframeURL = `${BASE}/file_dummy.html#subframe-url-2`;
|
||||
await SpecialPowers.spawn(gBrowser.selectedBrowser, [subframeURL], async url => {
|
||||
const iframe = this.content.document.querySelector("iframe#test-subframe");
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[subframeURL],
|
||||
async url => {
|
||||
const iframe = this.content.document.querySelector(
|
||||
"iframe#test-subframe"
|
||||
);
|
||||
|
||||
// Await the subframe navigation.
|
||||
await new Promise(resolve => {
|
||||
iframe.onload = resolve;
|
||||
iframe.setAttribute("src", url);
|
||||
});
|
||||
});
|
||||
// Await the subframe navigation.
|
||||
await new Promise(resolve => {
|
||||
iframe.onload = resolve;
|
||||
iframe.setAttribute("src", url);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
info("Subframe location changed");
|
||||
|
||||
|
|
|
@ -194,7 +194,9 @@ add_task(async function testInsertCSS_cleanup() {
|
|||
};
|
||||
|
||||
const appliedStyles = await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [], getTabContentComputedStyle
|
||||
tab.linkedBrowser,
|
||||
[],
|
||||
getTabContentComputedStyle
|
||||
);
|
||||
|
||||
is(
|
||||
|
@ -211,7 +213,9 @@ add_task(async function testInsertCSS_cleanup() {
|
|||
await extension.unload();
|
||||
|
||||
const unloadedStyles = await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [], getTabContentComputedStyle
|
||||
tab.linkedBrowser,
|
||||
[],
|
||||
getTabContentComputedStyle
|
||||
);
|
||||
|
||||
is(
|
||||
|
|
|
@ -39,7 +39,9 @@ async function test_trailhead_branch(
|
|||
let browser = tab.linkedBrowser;
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{ expectedSelectors, branchName, unexpectedSelectors }], async ({
|
||||
browser,
|
||||
[{ expectedSelectors, branchName, unexpectedSelectors }],
|
||||
async ({
|
||||
expectedSelectors: expected,
|
||||
branchName: branch,
|
||||
unexpectedSelectors: unexpected,
|
||||
|
|
|
@ -16,7 +16,9 @@ async function checkNewtabLoads(selector, message) {
|
|||
|
||||
// check what the content task thinks has been loaded.
|
||||
let found = await SpecialPowers.spawn(
|
||||
browser, [selector], arg => content.document.querySelector(arg) !== null
|
||||
browser,
|
||||
[selector],
|
||||
arg => content.document.querySelector(arg) !== null
|
||||
);
|
||||
ok(found, message);
|
||||
|
||||
|
|
|
@ -48,7 +48,9 @@ async function clearHistoryAndBookmarks() {
|
|||
*/
|
||||
async function waitForPreloaded(browser) {
|
||||
let readyState = await SpecialPowers.spawn(
|
||||
browser, [], () => content.document.readyState
|
||||
browser,
|
||||
[],
|
||||
() => content.document.readyState
|
||||
);
|
||||
if (readyState !== "complete") {
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
|
@ -178,7 +180,9 @@ function test_newtab(testInfo) {
|
|||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
SpecialPowers.spawn(
|
||||
browser, [], () => content.document.getElementById("root").children.length
|
||||
browser,
|
||||
[],
|
||||
() => content.document.getElementById("root").children.length
|
||||
),
|
||||
"Should render activity stream content"
|
||||
);
|
||||
|
@ -187,7 +191,9 @@ function test_newtab(testInfo) {
|
|||
try {
|
||||
let contentArg = await before({ pushPrefs: scopedPushPrefs, tab });
|
||||
let contentResult = await SpecialPowers.spawn(
|
||||
browser, [contentArg], contentTask
|
||||
browser,
|
||||
[contentArg],
|
||||
contentTask
|
||||
);
|
||||
await after(contentResult);
|
||||
} finally {
|
||||
|
|
|
@ -78,9 +78,13 @@ add_task(async function test_add_link() {
|
|||
|
||||
for (let options of testOptions) {
|
||||
let shippingAddressChangePromise = SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
await manuallyAddShippingAddress(frame, newAddress, options);
|
||||
|
@ -147,9 +151,13 @@ add_task(async function test_edit_link() {
|
|||
});
|
||||
|
||||
let shippingAddressChangePromise = SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
const EXPECTED_ADDRESS = {
|
||||
|
@ -788,9 +796,13 @@ add_task(async function test_private_persist_addresses() {
|
|||
|
||||
info("awaiting the shippingaddresschange event");
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
await spawnPaymentDialogTask(
|
||||
|
@ -854,7 +866,9 @@ add_task(async function test_private_persist_addresses() {
|
|||
// Add a handler to complete the payment above.
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let result = await SpecialPowers.spawn(
|
||||
browser, [], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
|
||||
// Verify response has the expected properties
|
||||
|
|
|
@ -49,9 +49,13 @@ add_task(async function test_hiddenFieldNotSaved() {
|
|||
newAddress["given-name"] = "hiddenFields";
|
||||
|
||||
let shippingAddressChangePromise = SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
let options = {
|
||||
|
@ -138,9 +142,13 @@ add_task(async function test_hiddenFieldRemovedWhenCountryChanged() {
|
|||
});
|
||||
|
||||
let shippingAddressChangePromise = SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
await spawnPaymentDialogTask(frame, async args => {
|
||||
|
|
|
@ -345,9 +345,13 @@ async function add_link(aOptions = {}) {
|
|||
);
|
||||
|
||||
SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "paymentmethodchange",
|
||||
}], PTU.ContentTasks.promisePaymentRequestEvent
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "paymentmethodchange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.promisePaymentRequestEvent
|
||||
);
|
||||
info("added paymentmethodchange handler");
|
||||
|
||||
|
@ -358,9 +362,13 @@ async function add_link(aOptions = {}) {
|
|||
|
||||
info("waiting for paymentmethodchange event");
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "paymentmethodchange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "paymentmethodchange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
await spawnPaymentDialogTask(frame, async function waitForSummaryPage(
|
||||
|
@ -467,7 +475,9 @@ async function add_link(aOptions = {}) {
|
|||
// Add a handler to complete the payment above.
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let result = await SpecialPowers.spawn(
|
||||
browser, [], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
|
||||
// Verify response has the expected properties
|
||||
|
|
|
@ -98,10 +98,14 @@ add_task(async function test_change_shipping() {
|
|||
PTU.Details.additionalDisplayItemsEUR
|
||||
);
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
details: paymentDetails,
|
||||
}], PTU.ContentTasks.updateWith
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
details: paymentDetails,
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.updateWith
|
||||
);
|
||||
info("added shipping change handler to change to EUR");
|
||||
|
||||
|
@ -109,9 +113,13 @@ add_task(async function test_change_shipping() {
|
|||
info("changed shipping address to DE country");
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
info("got shippingaddresschange event");
|
||||
|
||||
|
@ -198,7 +206,9 @@ add_task(async function test_change_shipping() {
|
|||
// Add a handler to complete the payment above.
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let result = await SpecialPowers.spawn(
|
||||
browser, [], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
is(result.response.methodName, "basic-card", "Check methodName");
|
||||
|
||||
|
@ -279,13 +289,17 @@ add_task(async function test_default_shippingOptions_noneSelected() {
|
|||
);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
shippingOptionDetailsEUR,
|
||||
PTU.Details.total1pt75EUR
|
||||
),
|
||||
}], PTU.ContentTasks.updateWith
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
shippingOptionDetailsEUR,
|
||||
PTU.Details.total1pt75EUR
|
||||
),
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.updateWith
|
||||
);
|
||||
info("added shipping change handler to change to EUR");
|
||||
|
||||
|
@ -293,9 +307,13 @@ add_task(async function test_default_shippingOptions_noneSelected() {
|
|||
info("changed shipping address to DE country");
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
info("got shippingaddresschange event");
|
||||
|
||||
|
@ -378,13 +396,17 @@ add_task(async function test_default_shippingOptions_allSelected() {
|
|||
});
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
shippingOptionDetailsEUR,
|
||||
PTU.Details.total1pt75EUR
|
||||
),
|
||||
}], PTU.ContentTasks.updateWith
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
shippingOptionDetailsEUR,
|
||||
PTU.Details.total1pt75EUR
|
||||
),
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.updateWith
|
||||
);
|
||||
info("added shipping change handler to change to EUR");
|
||||
|
||||
|
@ -392,9 +414,13 @@ add_task(async function test_default_shippingOptions_allSelected() {
|
|||
info("changed shipping address to DE country");
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
info("got shippingaddresschange event");
|
||||
|
||||
|
@ -465,9 +491,13 @@ add_task(async function test_no_shippingchange_without_shipping() {
|
|||
);
|
||||
|
||||
SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.ensureNoPaymentRequestEvent
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.ensureNoPaymentRequestEvent
|
||||
);
|
||||
info("added shipping change handler");
|
||||
|
||||
|
@ -485,7 +515,9 @@ add_task(async function test_no_shippingchange_without_shipping() {
|
|||
// Add a handler to complete the payment above.
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let result = await SpecialPowers.spawn(
|
||||
browser, [], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
is(result.response.methodName, "basic-card", "Check methodName");
|
||||
|
||||
|
@ -540,18 +572,26 @@ add_task(async function test_address_edit() {
|
|||
is(selectedIndex, -1, "No address should be selected initially");
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.promisePaymentRequestEvent
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.promisePaymentRequestEvent
|
||||
);
|
||||
|
||||
info("selecting the US address");
|
||||
await selectPaymentDialogShippingAddressByCountry(frame, "US");
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
addressOptions = await spawnPaymentDialogTask(
|
||||
|
@ -657,9 +697,13 @@ add_task(async function test_address_removal() {
|
|||
await formAutofillStorage.addresses.remove(selectedAddressGuid);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.promisePaymentRequestEvent
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.promisePaymentRequestEvent
|
||||
);
|
||||
|
||||
addressOptions = await spawnPaymentDialogTask(
|
||||
|
|
|
@ -59,7 +59,9 @@ add_task(async function test_complete_success() {
|
|||
// Add a handler to complete the payment above.
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let { completeException } = await SpecialPowers.spawn(
|
||||
browser, [{ result: "success" }], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[{ result: "success" }],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
|
||||
ok(
|
||||
|
@ -120,7 +122,9 @@ add_task(async function test_complete_fail() {
|
|||
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let { completeException } = await SpecialPowers.spawn(
|
||||
browser, [{ result: "fail" }], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[{ result: "fail" }],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
ok(
|
||||
!completeException,
|
||||
|
@ -186,7 +190,9 @@ add_task(async function test_complete_timeout() {
|
|||
|
||||
info("acknowledging the completion from the merchant page after a delay");
|
||||
let { completeException } = await SpecialPowers.spawn(
|
||||
browser, [{ result: "fail", delayMs: 1000 }], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[{ result: "fail", delayMs: 1000 }],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
ok(
|
||||
completeException,
|
||||
|
|
|
@ -116,12 +116,16 @@ add_task(async function test_retry_with_genericError() {
|
|||
// Add a handler to retry the payment above.
|
||||
info("Tell merchant page to retry with an error string");
|
||||
let retryPromise = SpecialPowers.spawn(
|
||||
browser, [{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
error: "My generic error",
|
||||
browser,
|
||||
[
|
||||
{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
error: "My generic error",
|
||||
},
|
||||
},
|
||||
}], PTU.ContentTasks.addRetryHandler
|
||||
],
|
||||
PTU.ContentTasks.addRetryHandler
|
||||
);
|
||||
|
||||
await retryUpdatePromise;
|
||||
|
@ -137,7 +141,9 @@ add_task(async function test_retry_with_genericError() {
|
|||
// Add a handler to complete the payment above.
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let result = await SpecialPowers.spawn(
|
||||
browser, [], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
|
||||
// Verify response has the expected properties
|
||||
|
|
|
@ -147,14 +147,18 @@ add_task(async function test_retry_with_shippingAddressErrors() {
|
|||
// Add a handler to retry the payment above.
|
||||
info("Tell merchant page to retry with a country error string");
|
||||
let retryPromise = SpecialPowers.spawn(
|
||||
browser, [{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
shippingAddress: {
|
||||
country: "Can only ship to USA",
|
||||
browser,
|
||||
[
|
||||
{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
shippingAddress: {
|
||||
country: "Can only ship to USA",
|
||||
},
|
||||
},
|
||||
},
|
||||
}], PTU.ContentTasks.addRetryHandler
|
||||
],
|
||||
PTU.ContentTasks.addRetryHandler
|
||||
);
|
||||
|
||||
await retryUpdatePromise;
|
||||
|
@ -164,14 +168,18 @@ add_task(async function test_retry_with_shippingAddressErrors() {
|
|||
|
||||
info("Tell merchant page to retry with a regionCode error string");
|
||||
let retryPromise2 = SpecialPowers.spawn(
|
||||
browser, [{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
shippingAddress: {
|
||||
regionCode: "Can only ship to California",
|
||||
browser,
|
||||
[
|
||||
{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
shippingAddress: {
|
||||
regionCode: "Can only ship to California",
|
||||
},
|
||||
},
|
||||
},
|
||||
}], PTU.ContentTasks.addRetryHandler
|
||||
],
|
||||
PTU.ContentTasks.addRetryHandler
|
||||
);
|
||||
|
||||
await loginAndCompletePayment(frame);
|
||||
|
@ -238,7 +246,9 @@ add_task(async function test_retry_with_shippingAddressErrors() {
|
|||
// Add a handler to complete the payment above.
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let result = await SpecialPowers.spawn(
|
||||
browser, [], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
|
||||
// Verify response has the expected properties
|
||||
|
@ -377,14 +387,18 @@ add_task(async function test_retry_with_payerErrors() {
|
|||
// Add a handler to retry the payment above.
|
||||
info("Tell merchant page to retry with a country error string");
|
||||
let retryPromise = SpecialPowers.spawn(
|
||||
browser, [{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
payer: {
|
||||
email: "You must use your employee email address",
|
||||
browser,
|
||||
[
|
||||
{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
payer: {
|
||||
email: "You must use your employee email address",
|
||||
},
|
||||
},
|
||||
},
|
||||
}], PTU.ContentTasks.addRetryHandler
|
||||
],
|
||||
PTU.ContentTasks.addRetryHandler
|
||||
);
|
||||
|
||||
await retryUpdatePromise;
|
||||
|
@ -398,14 +412,18 @@ add_task(async function test_retry_with_payerErrors() {
|
|||
|
||||
info("Tell merchant page to retry with a phone error string");
|
||||
let retryPromise2 = SpecialPowers.spawn(
|
||||
browser, [{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
payer: {
|
||||
phone: "Your phone number isn't valid",
|
||||
browser,
|
||||
[
|
||||
{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
payer: {
|
||||
phone: "Your phone number isn't valid",
|
||||
},
|
||||
},
|
||||
},
|
||||
}], PTU.ContentTasks.addRetryHandler
|
||||
],
|
||||
PTU.ContentTasks.addRetryHandler
|
||||
);
|
||||
|
||||
await loginAndCompletePayment(frame);
|
||||
|
@ -458,17 +476,25 @@ add_task(async function test_retry_with_payerErrors() {
|
|||
await fillInPayerAddressForm(frame, { tel: newPhoneNumber });
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "payerdetailchange",
|
||||
}], PTU.ContentTasks.promisePaymentResponseEvent
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "payerdetailchange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.promisePaymentResponseEvent
|
||||
);
|
||||
|
||||
await submitAddressForm(frame, null, { isEditing: true });
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "payerdetailchange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "payerdetailchange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
await loginAndCompletePayment(frame);
|
||||
|
@ -489,7 +515,9 @@ add_task(async function test_retry_with_payerErrors() {
|
|||
// Add a handler to complete the payment above.
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let result = await SpecialPowers.spawn(
|
||||
browser, [], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
|
||||
// Verify response has the expected properties
|
||||
|
@ -636,14 +664,18 @@ add_task(async function test_retry_with_paymentMethodErrors() {
|
|||
// Add a handler to retry the payment above.
|
||||
info("Tell merchant page to retry with a cardSecurityCode error string");
|
||||
let retryPromise = SpecialPowers.spawn(
|
||||
browser, [{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
paymentMethod: {
|
||||
cardSecurityCode: "Your CVV is incorrect",
|
||||
browser,
|
||||
[
|
||||
{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
paymentMethod: {
|
||||
cardSecurityCode: "Your CVV is incorrect",
|
||||
},
|
||||
},
|
||||
},
|
||||
}], PTU.ContentTasks.addRetryHandler
|
||||
],
|
||||
PTU.ContentTasks.addRetryHandler
|
||||
);
|
||||
|
||||
await retryUpdatePromise;
|
||||
|
@ -659,16 +691,20 @@ add_task(async function test_retry_with_paymentMethodErrors() {
|
|||
"Tell merchant page to retry with a billing postalCode error string"
|
||||
);
|
||||
let retryPromise2 = SpecialPowers.spawn(
|
||||
browser, [{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
paymentMethod: {
|
||||
billingAddress: {
|
||||
postalCode: "Your postal code isn't valid",
|
||||
browser,
|
||||
[
|
||||
{
|
||||
delayMs: 1000,
|
||||
validationErrors: {
|
||||
paymentMethod: {
|
||||
billingAddress: {
|
||||
postalCode: "Your postal code isn't valid",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}], PTU.ContentTasks.addRetryHandler
|
||||
],
|
||||
PTU.ContentTasks.addRetryHandler
|
||||
);
|
||||
|
||||
await loginAndCompletePayment(frame);
|
||||
|
@ -733,9 +769,13 @@ add_task(async function test_retry_with_paymentMethodErrors() {
|
|||
await fillInBillingAddressForm(frame, { "postal-code": newPostalCode });
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "paymentmethodchange",
|
||||
}], PTU.ContentTasks.promisePaymentResponseEvent
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "paymentmethodchange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.promisePaymentResponseEvent
|
||||
);
|
||||
|
||||
await submitAddressForm(frame, null, {
|
||||
|
@ -778,9 +818,13 @@ add_task(async function test_retry_with_paymentMethodErrors() {
|
|||
|
||||
// TODO: Add an `await` here after bug 1477113.
|
||||
SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "paymentmethodchange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "paymentmethodchange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
await loginAndCompletePayment(frame);
|
||||
|
@ -801,7 +845,9 @@ add_task(async function test_retry_with_paymentMethodErrors() {
|
|||
// Add a handler to complete the payment above.
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let result = await SpecialPowers.spawn(
|
||||
browser, [], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
|
||||
// Verify response has the expected properties
|
||||
|
|
|
@ -24,15 +24,19 @@ add_task(async function test_show_error_on_addresschange() {
|
|||
|
||||
info("setting up the event handler for shippingoptionchange");
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingoptionchange",
|
||||
details: Object.assign(
|
||||
{},
|
||||
PTU.Details.genericShippingError,
|
||||
PTU.Details.noShippingOptions,
|
||||
PTU.Details.total2USD
|
||||
),
|
||||
}], PTU.ContentTasks.updateWith
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingoptionchange",
|
||||
details: Object.assign(
|
||||
{},
|
||||
PTU.Details.genericShippingError,
|
||||
PTU.Details.noShippingOptions,
|
||||
PTU.Details.total2USD
|
||||
),
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.updateWith
|
||||
);
|
||||
|
||||
await spawnPaymentDialogTask(
|
||||
|
@ -43,9 +47,13 @@ add_task(async function test_show_error_on_addresschange() {
|
|||
|
||||
info("awaiting the shippingoptionchange event");
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingoptionchange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingoptionchange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
await spawnPaymentDialogTask(
|
||||
|
@ -64,24 +72,32 @@ add_task(async function test_show_error_on_addresschange() {
|
|||
|
||||
info("setting up the event handler for shippingaddresschange");
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
{},
|
||||
PTU.Details.noError,
|
||||
PTU.Details.twoShippingOptions,
|
||||
PTU.Details.total2USD
|
||||
),
|
||||
}], PTU.ContentTasks.updateWith
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
{},
|
||||
PTU.Details.noError,
|
||||
PTU.Details.twoShippingOptions,
|
||||
PTU.Details.total2USD
|
||||
),
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.updateWith
|
||||
);
|
||||
|
||||
await selectPaymentDialogShippingAddressByCountry(frame, "DE");
|
||||
|
||||
info("awaiting the shippingaddresschange event");
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
await spawnPaymentDialogTask(frame, () => {
|
||||
|
@ -121,15 +137,19 @@ add_task(async function test_show_field_specific_error_on_addresschange() {
|
|||
|
||||
info("setting up the event handler for shippingaddresschange");
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
{},
|
||||
PTU.Details.fieldSpecificErrors,
|
||||
PTU.Details.noShippingOptions,
|
||||
PTU.Details.total2USD
|
||||
),
|
||||
}], PTU.ContentTasks.updateWith
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
{},
|
||||
PTU.Details.fieldSpecificErrors,
|
||||
PTU.Details.noShippingOptions,
|
||||
PTU.Details.total2USD
|
||||
),
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.updateWith
|
||||
);
|
||||
|
||||
spawnPaymentDialogTask(
|
||||
|
@ -140,9 +160,13 @@ add_task(async function test_show_field_specific_error_on_addresschange() {
|
|||
|
||||
info("awaiting the shippingaddresschange event");
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
|
||||
await spawnPaymentDialogTask(frame, async () => {
|
||||
|
@ -243,19 +267,23 @@ add_task(async function test_show_field_specific_error_on_addresschange() {
|
|||
"setting up the event handler for a 2nd shippingaddresschange with a different error"
|
||||
);
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
{},
|
||||
{
|
||||
shippingAddressErrors: {
|
||||
phone: "Invalid phone number",
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
{},
|
||||
{
|
||||
shippingAddressErrors: {
|
||||
phone: "Invalid phone number",
|
||||
},
|
||||
},
|
||||
},
|
||||
PTU.Details.noShippingOptions,
|
||||
PTU.Details.total2USD
|
||||
),
|
||||
}], PTU.ContentTasks.updateWith
|
||||
PTU.Details.noShippingOptions,
|
||||
PTU.Details.total2USD
|
||||
),
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.updateWith
|
||||
);
|
||||
|
||||
await spawnPaymentDialogTask(
|
||||
|
@ -317,14 +345,18 @@ add_task(async function test_show_field_specific_error_on_addresschange() {
|
|||
|
||||
info("setup updateWith to clear errors");
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
{},
|
||||
PTU.Details.twoShippingOptions,
|
||||
PTU.Details.total2USD
|
||||
),
|
||||
}], PTU.ContentTasks.updateWith
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingaddresschange",
|
||||
details: Object.assign(
|
||||
{},
|
||||
PTU.Details.twoShippingOptions,
|
||||
PTU.Details.total2USD
|
||||
),
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.updateWith
|
||||
);
|
||||
|
||||
await spawnPaymentDialogTask(
|
||||
|
|
|
@ -117,7 +117,9 @@ add_task(async function test_show_completePayment() {
|
|||
// Add a handler to complete the payment above.
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let result = await SpecialPowers.spawn(
|
||||
browser, [], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
|
||||
let { shippingAddress } = result.response;
|
||||
|
@ -177,9 +179,13 @@ add_task(async function test_show_completePayment2() {
|
|||
});
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingoptionchange",
|
||||
}], PTU.ContentTasks.promisePaymentRequestEvent
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingoptionchange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.promisePaymentRequestEvent
|
||||
);
|
||||
|
||||
info(
|
||||
|
@ -192,9 +198,13 @@ add_task(async function test_show_completePayment2() {
|
|||
);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
eventName: "shippingoptionchange",
|
||||
}], PTU.ContentTasks.awaitPaymentEventPromise
|
||||
browser,
|
||||
[
|
||||
{
|
||||
eventName: "shippingoptionchange",
|
||||
},
|
||||
],
|
||||
PTU.ContentTasks.awaitPaymentEventPromise
|
||||
);
|
||||
info("got shippingoptionchange event");
|
||||
|
||||
|
@ -226,7 +236,9 @@ add_task(async function test_show_completePayment2() {
|
|||
// Add a handler to complete the payment above.
|
||||
info("acknowledging the completion from the merchant page");
|
||||
let result = await SpecialPowers.spawn(
|
||||
browser, [], PTU.ContentTasks.addCompletionHandler
|
||||
browser,
|
||||
[],
|
||||
PTU.ContentTasks.addCompletionHandler
|
||||
);
|
||||
|
||||
is(result.response.shippingOption, "1", "Check shipping option");
|
||||
|
|
|
@ -317,11 +317,15 @@ async function setupPaymentDialog(
|
|||
) {
|
||||
let dialogReadyPromise = waitForWidgetReady();
|
||||
let { requestId } = await SpecialPowers.spawn(
|
||||
browser, [{
|
||||
methodData,
|
||||
details,
|
||||
options,
|
||||
}], merchantTaskFn
|
||||
browser,
|
||||
[
|
||||
{
|
||||
methodData,
|
||||
details,
|
||||
options,
|
||||
},
|
||||
],
|
||||
merchantTaskFn
|
||||
);
|
||||
ok(requestId, "requestId should be defined");
|
||||
|
||||
|
|
|
@ -26,7 +26,9 @@ add_task(async function testRestoreDefaultsBtn_visible() {
|
|||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
SpecialPowers.spawn(
|
||||
browser, [], () =>
|
||||
browser,
|
||||
[],
|
||||
() =>
|
||||
content.document.getElementById("restoreDefaultHomePageBtn") !== null
|
||||
),
|
||||
"Wait for the button to be added to the page"
|
||||
|
@ -35,7 +37,9 @@ add_task(async function testRestoreDefaultsBtn_visible() {
|
|||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
SpecialPowers.spawn(
|
||||
browser, [], () =>
|
||||
browser,
|
||||
[],
|
||||
() =>
|
||||
content.document.querySelector(
|
||||
"[data-subcategory='topsites'] checkbox"
|
||||
) !== null
|
||||
|
@ -46,7 +50,9 @@ add_task(async function testRestoreDefaultsBtn_visible() {
|
|||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
SpecialPowers.spawn(
|
||||
browser, [], () =>
|
||||
browser,
|
||||
[],
|
||||
() =>
|
||||
content.document.getElementById("restoreDefaultHomePageBtn")
|
||||
.hidden === false
|
||||
),
|
||||
|
@ -60,7 +66,9 @@ add_task(async function testRestoreDefaultsBtn_visible() {
|
|||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
SpecialPowers.spawn(
|
||||
browser, [], () =>
|
||||
browser,
|
||||
[],
|
||||
() =>
|
||||
content.document.querySelector(
|
||||
"[data-subcategory='topsites'] checkbox"
|
||||
).checked
|
||||
|
@ -71,7 +79,9 @@ add_task(async function testRestoreDefaultsBtn_visible() {
|
|||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
SpecialPowers.spawn(
|
||||
browser, [], () =>
|
||||
browser,
|
||||
[],
|
||||
() =>
|
||||
content.document.getElementById("restoreDefaultHomePageBtn").style
|
||||
.visibility === "hidden"
|
||||
),
|
||||
|
@ -113,7 +123,9 @@ add_task(async function testRestoreDefaultsBtn_hidden() {
|
|||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
SpecialPowers.spawn(
|
||||
browser, [], () =>
|
||||
browser,
|
||||
[],
|
||||
() =>
|
||||
content.document.getElementById("restoreDefaultHomePageBtn") !== null
|
||||
),
|
||||
"Wait for the button to be added to the page"
|
||||
|
@ -122,7 +134,9 @@ add_task(async function testRestoreDefaultsBtn_hidden() {
|
|||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
SpecialPowers.spawn(
|
||||
browser, [], () =>
|
||||
browser,
|
||||
[],
|
||||
() =>
|
||||
content.document.querySelector(
|
||||
"[data-subcategory='topsites'] checkbox"
|
||||
) !== null
|
||||
|
@ -131,7 +145,9 @@ add_task(async function testRestoreDefaultsBtn_hidden() {
|
|||
);
|
||||
|
||||
const btnDefault = await SpecialPowers.spawn(
|
||||
browser, [], () =>
|
||||
browser,
|
||||
[],
|
||||
() =>
|
||||
content.document.getElementById("restoreDefaultHomePageBtn").style
|
||||
.visibility
|
||||
);
|
||||
|
@ -144,7 +160,9 @@ add_task(async function testRestoreDefaultsBtn_hidden() {
|
|||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
SpecialPowers.spawn(
|
||||
browser, [], () =>
|
||||
browser,
|
||||
[],
|
||||
() =>
|
||||
content.document.querySelector(
|
||||
"[data-subcategory='topsites'] checkbox"
|
||||
).checked
|
||||
|
@ -162,7 +180,9 @@ add_task(async function testRestoreDefaultsBtn_hidden() {
|
|||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
SpecialPowers.spawn(
|
||||
browser, [], () =>
|
||||
browser,
|
||||
[],
|
||||
() =>
|
||||
!content.document.querySelector(
|
||||
"[data-subcategory='topsites'] checkbox"
|
||||
).checked
|
||||
|
@ -173,7 +193,9 @@ add_task(async function testRestoreDefaultsBtn_hidden() {
|
|||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
SpecialPowers.spawn(
|
||||
browser, [], () =>
|
||||
browser,
|
||||
[],
|
||||
() =>
|
||||
content.document.getElementById("restoreDefaultHomePageBtn").style
|
||||
.visibility === "visible"
|
||||
),
|
||||
|
|
|
@ -19,7 +19,9 @@ function open_subdialog_and_test_generic_start_state(
|
|||
? "(" + domcontentloadedFn.toString() + ")()"
|
||||
: "";
|
||||
return SpecialPowers.spawn(
|
||||
browser, [{ url, domcontentloadedFnStr }], async function(args) {
|
||||
browser,
|
||||
[{ url, domcontentloadedFnStr }],
|
||||
async function(args) {
|
||||
let rv = { acceptCount: 0 };
|
||||
let win = content.window;
|
||||
content.gSubDialog.open(args.url, null, rv);
|
||||
|
@ -100,16 +102,22 @@ async function close_subdialog_and_test_generic_end_state(
|
|||
) {
|
||||
let getDialogsCount = () => {
|
||||
return SpecialPowers.spawn(
|
||||
browser, [], () => content.window.gSubDialog._dialogs.length
|
||||
browser,
|
||||
[],
|
||||
() => content.window.gSubDialog._dialogs.length
|
||||
);
|
||||
};
|
||||
let getStackChildrenCount = () => {
|
||||
return SpecialPowers.spawn(
|
||||
browser, [], () => content.window.gSubDialog._dialogStack.children.length
|
||||
browser,
|
||||
[],
|
||||
() => content.window.gSubDialog._dialogStack.children.length
|
||||
);
|
||||
};
|
||||
let dialogclosingPromise = SpecialPowers.spawn(
|
||||
browser, [{ closingButton, acceptCount }], async function(expectations) {
|
||||
browser,
|
||||
[{ closingButton, acceptCount }],
|
||||
async function(expectations) {
|
||||
let win = content.window;
|
||||
let subdialog = win.gSubDialog._topDialog;
|
||||
let frame = subdialog._frame;
|
||||
|
|
|
@ -52,7 +52,9 @@ async function testClearData(clearSiteData, clearCache) {
|
|||
Assert.greater(totalUsage, 0, "The total usage should not be 0");
|
||||
|
||||
let initialSizeLabelValue = await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [], async function() {
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let sizeLabel = content.document.getElementById("totalSiteDataSize");
|
||||
return sizeLabel.textContent;
|
||||
}
|
||||
|
@ -170,7 +172,9 @@ async function testClearData(clearSiteData, clearCache) {
|
|||
if (clearCache || clearSiteData) {
|
||||
// Check that the size label in about:preferences updates after we cleared data.
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [{ initialSizeLabelValue }], async function(opts) {
|
||||
gBrowser.selectedBrowser,
|
||||
[{ initialSizeLabelValue }],
|
||||
async function(opts) {
|
||||
let sizeLabel = content.document.getElementById("totalSiteDataSize");
|
||||
await ContentTaskUtils.waitForCondition(
|
||||
() => sizeLabel.textContent != opts.initialSizeLabelValue,
|
||||
|
|
|
@ -164,21 +164,25 @@ add_task(async function() {
|
|||
await openSiteDataSettingsDialog();
|
||||
let acceptRemovePromise = BrowserTestUtils.promiseAlertDialogOpen("accept");
|
||||
let updatePromise = promiseSiteDataManagerSitesUpdated();
|
||||
SpecialPowers.spawn(gBrowser.selectedBrowser, [{ TEST_OFFLINE_HOST }], args => {
|
||||
let host = args.TEST_OFFLINE_HOST;
|
||||
let frameDoc = content.gSubDialog._topDialog._frame.contentDocument;
|
||||
let sitesList = frameDoc.getElementById("sitesList");
|
||||
let site = sitesList.querySelector(`richlistitem[host="${host}"]`);
|
||||
if (site) {
|
||||
let removeBtn = frameDoc.getElementById("removeSelected");
|
||||
let saveBtn = frameDoc.getElementById("save");
|
||||
site.click();
|
||||
removeBtn.doCommand();
|
||||
saveBtn.doCommand();
|
||||
} else {
|
||||
ok(false, `Should have one site of ${host}`);
|
||||
SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[{ TEST_OFFLINE_HOST }],
|
||||
args => {
|
||||
let host = args.TEST_OFFLINE_HOST;
|
||||
let frameDoc = content.gSubDialog._topDialog._frame.contentDocument;
|
||||
let sitesList = frameDoc.getElementById("sitesList");
|
||||
let site = sitesList.querySelector(`richlistitem[host="${host}"]`);
|
||||
if (site) {
|
||||
let removeBtn = frameDoc.getElementById("removeSelected");
|
||||
let saveBtn = frameDoc.getElementById("save");
|
||||
site.click();
|
||||
removeBtn.doCommand();
|
||||
saveBtn.doCommand();
|
||||
} else {
|
||||
ok(false, `Should have one site of ${host}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
await acceptRemovePromise;
|
||||
await updatePromise;
|
||||
await promiseServiceWorkersCleared();
|
||||
|
@ -268,10 +272,14 @@ add_task(async function() {
|
|||
REMOVE_DIALOG_URL
|
||||
);
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [{
|
||||
creationDate1Formatted,
|
||||
creationDate2Formatted,
|
||||
}], function(args) {
|
||||
gBrowser.selectedBrowser,
|
||||
[
|
||||
{
|
||||
creationDate1Formatted,
|
||||
creationDate2Formatted,
|
||||
},
|
||||
],
|
||||
function(args) {
|
||||
let frameDoc = content.gSubDialog._topDialog._frame.contentDocument;
|
||||
|
||||
let siteItems = frameDoc.getElementsByTagName("richlistitem");
|
||||
|
@ -335,7 +343,9 @@ add_task(async function() {
|
|||
await openSiteDataSettingsDialog();
|
||||
let acceptRemovePromise = BrowserTestUtils.promiseAlertDialogOpen("accept");
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [{ creationDate1Formatted }], function(args) {
|
||||
gBrowser.selectedBrowser,
|
||||
[{ creationDate1Formatted }],
|
||||
function(args) {
|
||||
let frameDoc = content.gSubDialog._topDialog._frame.contentDocument;
|
||||
|
||||
let siteItems = frameDoc.getElementsByTagName("richlistitem");
|
||||
|
|
|
@ -248,7 +248,9 @@ async function loadServiceWorkerTestPage(url) {
|
|||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
|
||||
await BrowserTestUtils.waitForCondition(() => {
|
||||
return SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [], () =>
|
||||
tab.linkedBrowser,
|
||||
[],
|
||||
() =>
|
||||
content.document.body.getAttribute(
|
||||
"data-test-service-worker-registered"
|
||||
) === "true"
|
||||
|
|
|
@ -27,7 +27,11 @@ add_task(
|
|||
);
|
||||
let privateWin = await promiseNewWindow;
|
||||
|
||||
await SpecialPowers.spawn(privateWin.gBrowser.selectedBrowser, [{DUMMY_PAGE, TEST_PAGE}], async function({DUMMY_PAGE, TEST_PAGE}) { // eslint-disable-line
|
||||
await SpecialPowers.spawn(
|
||||
privateWin.gBrowser.selectedBrowser,
|
||||
[{ DUMMY_PAGE, TEST_PAGE }],
|
||||
async function({ DUMMY_PAGE, TEST_PAGE }) {
|
||||
// eslint-disable-line
|
||||
|
||||
let channel = content.docShell.currentDocumentChannel;
|
||||
is(
|
||||
|
|
|
@ -31,7 +31,9 @@ function assertWindowIsPrivate(win) {
|
|||
);
|
||||
|
||||
return SpecialPowers.spawn(
|
||||
win.gBrowser.selectedBrowser, [], async function() {
|
||||
win.gBrowser.selectedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let contentLoadContext = docShell.QueryInterface(Ci.nsILoadContext);
|
||||
Assert.ok(
|
||||
contentLoadContext.usePrivateBrowsing,
|
||||
|
|
|
@ -176,7 +176,9 @@ function waitOnFaviconLoaded(aFaviconURL) {
|
|||
async function assignCookies(aBrowser, aURL, aCookieValue) {
|
||||
let tabInfo = await openTab(aBrowser, aURL);
|
||||
|
||||
await SpecialPowers.spawn(tabInfo.browser, [aCookieValue], async function(value) {
|
||||
await SpecialPowers.spawn(tabInfo.browser, [aCookieValue], async function(
|
||||
value
|
||||
) {
|
||||
content.document.cookie = value;
|
||||
});
|
||||
|
||||
|
|
|
@ -87,7 +87,9 @@ add_task(async function() {
|
|||
|
||||
async function checkProxyCardVisibility(tab, shouldBeHidden) {
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [{ _shouldBeHidden: shouldBeHidden }], async function({ _shouldBeHidden }) {
|
||||
tab.linkedBrowser,
|
||||
[{ _shouldBeHidden: shouldBeHidden }],
|
||||
async function({ _shouldBeHidden }) {
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
const proxyCard = content.document.querySelector(".proxy-card");
|
||||
return ContentTaskUtils.is_hidden(proxyCard) === _shouldBeHidden;
|
||||
|
|
|
@ -189,7 +189,9 @@ async function test_dynamical_window_rounding(aWindow, aCheckFunc) {
|
|||
info(caseString + "Get innerWidth/Height from the content.");
|
||||
await BrowserTestUtils.waitForCondition(async () => {
|
||||
let { contentWidth, contentHeight } = await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [], () => {
|
||||
tab.linkedBrowser,
|
||||
[],
|
||||
() => {
|
||||
return {
|
||||
contentWidth: content.innerWidth,
|
||||
contentHeight: content.innerHeight,
|
||||
|
|
|
@ -101,12 +101,16 @@ let setupTest = async function(
|
|||
expectedPrecision = expectedPrecision < 100 ? 100 : expectedPrecision;
|
||||
}
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [{
|
||||
list: PERFORMANCE_TIMINGS,
|
||||
precision: expectedPrecision,
|
||||
isRoundedFunc: isRounded.toString(),
|
||||
workerCall,
|
||||
}], runTests
|
||||
tab.linkedBrowser,
|
||||
[
|
||||
{
|
||||
list: PERFORMANCE_TIMINGS,
|
||||
precision: expectedPrecision,
|
||||
isRoundedFunc: isRounded.toString(),
|
||||
workerCall,
|
||||
},
|
||||
],
|
||||
runTests
|
||||
);
|
||||
};
|
||||
// ================================================================================================
|
||||
|
|
|
@ -35,7 +35,9 @@ add_task(async function test_new_window() {
|
|||
);
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [{ gMaxAvailWidth, gMaxAvailHeight }], async function(input) {
|
||||
tab.linkedBrowser,
|
||||
[{ gMaxAvailWidth, gMaxAvailHeight }],
|
||||
async function(input) {
|
||||
is(
|
||||
content.screen.width,
|
||||
input.gMaxAvailWidth,
|
||||
|
|
|
@ -1987,7 +1987,9 @@ async function testKeyEvent(aTab, aTestCase) {
|
|||
|
||||
for (let testEvent of testEvents) {
|
||||
let keyEventPromise = SpecialPowers.spawn(
|
||||
aTab.linkedBrowser, [{ testEvent, result: aTestCase.result, kSameKeyCodeAndCharCodeValue }], async aInput => {
|
||||
aTab.linkedBrowser,
|
||||
[{ testEvent, result: aTestCase.result, kSameKeyCodeAndCharCodeValue }],
|
||||
async aInput => {
|
||||
function verifyKeyboardEvent(
|
||||
aEvent,
|
||||
aResult,
|
||||
|
@ -2216,7 +2218,9 @@ add_task(async function runTestForSuppressModifierKeys() {
|
|||
for (let eventType of ["keydown", "keyup"]) {
|
||||
for (let modifierKey of ["Alt", "Shift", "Control"]) {
|
||||
let testPromise = SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [eventType], async aEventType => {
|
||||
tab.linkedBrowser,
|
||||
[eventType],
|
||||
async aEventType => {
|
||||
let inputBox = content.document.getElementById("test");
|
||||
|
||||
// First, try to focus on the input box.
|
||||
|
|
|
@ -23,7 +23,9 @@ async function calcMaximumAvailSize(aChromeWidth, aChromeHeight) {
|
|||
);
|
||||
|
||||
let contentSize = await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [], async function() {
|
||||
tab.linkedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let result = {
|
||||
width: content.innerWidth,
|
||||
height: content.innerHeight,
|
||||
|
@ -81,7 +83,9 @@ async function calcPopUpWindowChromeUISize() {
|
|||
);
|
||||
|
||||
let result = await SpecialPowers.spawn(
|
||||
tab.linkedBrowser, [], async function() {
|
||||
tab.linkedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
let win;
|
||||
|
||||
await new Promise(resolve => {
|
||||
|
|
|
@ -142,7 +142,9 @@ add_task(async function() {
|
|||
}
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [{ selectElement: test.isSelected ? test.id : null }], async function(arg) {
|
||||
gBrowser.selectedBrowser,
|
||||
[{ selectElement: test.isSelected ? test.id : null }],
|
||||
async function(arg) {
|
||||
let selection = content.getSelection();
|
||||
selection.removeAllRanges();
|
||||
|
||||
|
|
|
@ -7,7 +7,9 @@ const REFERRER3 = "http://example.org/?" + Math.random();
|
|||
add_task(async function() {
|
||||
async function checkDocumentReferrer(referrer, msg) {
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [{ referrer, msg }], async function(args) {
|
||||
gBrowser.selectedBrowser,
|
||||
[{ referrer, msg }],
|
||||
async function(args) {
|
||||
Assert.equal(content.document.referrer, args.referrer, args.msg);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -38,7 +38,8 @@ add_task(async function test() {
|
|||
|
||||
await loadedPromise;
|
||||
|
||||
await SpecialPowers.spawn(browser, [], function( {}) { // eslint-disable-line
|
||||
await SpecialPowers.spawn(browser, [], function({}) {
|
||||
// eslint-disable-line
|
||||
// the data: URI inherits the CSP and the inline script needs to be blocked
|
||||
is(
|
||||
content.document.getElementById("test_id2").value,
|
||||
|
@ -55,7 +56,8 @@ add_task(async function test() {
|
|||
await promiseTabRestored(tab);
|
||||
browser = tab.linkedBrowser;
|
||||
|
||||
await SpecialPowers.spawn(browser, [], function({}) { // eslint-disable-line
|
||||
await SpecialPowers.spawn(browser, [], function({}) {
|
||||
// eslint-disable-line
|
||||
// the data: URI should be restored including the inherited CSP and the
|
||||
// inline script should be blocked.
|
||||
is(
|
||||
|
|
|
@ -18,10 +18,16 @@ add_task(async function test_duplicate() {
|
|||
// Click the link to navigate, this will add second shistory entry.
|
||||
await SpecialPowers.spawn(browser, [], async function() {
|
||||
return new Promise(resolve => {
|
||||
docShell.chromeEventHandler.addEventListener("hashchange", function onHashChange() {
|
||||
docShell.chromeEventHandler.removeEventListener("hashchange", onHashChange);
|
||||
resolve();
|
||||
});
|
||||
docShell.chromeEventHandler.addEventListener(
|
||||
"hashchange",
|
||||
function onHashChange() {
|
||||
docShell.chromeEventHandler.removeEventListener(
|
||||
"hashchange",
|
||||
onHashChange
|
||||
);
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
|
||||
// Click the link.
|
||||
content.document.querySelector("a").click();
|
||||
|
@ -56,10 +62,16 @@ add_task(async function test_duplicate_remove() {
|
|||
// Click the link to navigate, this will add second shistory entry.
|
||||
await SpecialPowers.spawn(browser, [], async function() {
|
||||
return new Promise(resolve => {
|
||||
docShell.chromeEventHandler.addEventListener("hashchange", function onHashChange() {
|
||||
docShell.chromeEventHandler.removeEventListener("hashchange", onHashChange);
|
||||
resolve();
|
||||
});
|
||||
docShell.chromeEventHandler.addEventListener(
|
||||
"hashchange",
|
||||
function onHashChange() {
|
||||
docShell.chromeEventHandler.removeEventListener(
|
||||
"hashchange",
|
||||
onHashChange
|
||||
);
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
|
||||
// Click the link.
|
||||
content.document.querySelector("a").click();
|
||||
|
|
|
@ -22,10 +22,16 @@ add_task(async function test_flush() {
|
|||
// Click the link to navigate, this will add second shistory entry.
|
||||
await SpecialPowers.spawn(browser, [], async function() {
|
||||
return new Promise(resolve => {
|
||||
docShell.chromeEventHandler.addEventListener("hashchange", function onHashChange() {
|
||||
docShell.chromeEventHandler.removeEventListener("hashchange", onHashChange);
|
||||
resolve();
|
||||
});
|
||||
docShell.chromeEventHandler.addEventListener(
|
||||
"hashchange",
|
||||
function onHashChange() {
|
||||
docShell.chromeEventHandler.removeEventListener(
|
||||
"hashchange",
|
||||
onHashChange
|
||||
);
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
|
||||
// Click the link.
|
||||
content.document.querySelector("a").click();
|
||||
|
@ -60,10 +66,16 @@ add_task(async function test_crash() {
|
|||
// Click the link to navigate.
|
||||
await SpecialPowers.spawn(browser, [], async function() {
|
||||
return new Promise(resolve => {
|
||||
docShell.chromeEventHandler.addEventListener("hashchange", function onHashChange() {
|
||||
docShell.chromeEventHandler.removeEventListener("hashchange", onHashChange);
|
||||
resolve();
|
||||
});
|
||||
docShell.chromeEventHandler.addEventListener(
|
||||
"hashchange",
|
||||
function onHashChange() {
|
||||
docShell.chromeEventHandler.removeEventListener(
|
||||
"hashchange",
|
||||
onHashChange
|
||||
);
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
|
||||
// Click the link.
|
||||
content.document.querySelector("a").click();
|
||||
|
@ -102,10 +114,16 @@ add_task(async function test_remove() {
|
|||
// Click the link to navigate.
|
||||
await SpecialPowers.spawn(browser, [], async function() {
|
||||
return new Promise(resolve => {
|
||||
docShell.chromeEventHandler.addEventListener("hashchange", function onHashChange() {
|
||||
docShell.chromeEventHandler.removeEventListener("hashchange", onHashChange);
|
||||
resolve();
|
||||
});
|
||||
docShell.chromeEventHandler.addEventListener(
|
||||
"hashchange",
|
||||
function onHashChange() {
|
||||
docShell.chromeEventHandler.removeEventListener(
|
||||
"hashchange",
|
||||
onHashChange
|
||||
);
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
|
||||
// Click the link.
|
||||
content.document.querySelector("a").click();
|
||||
|
|
|
@ -5,7 +5,9 @@ function promiseSetCookie(cookie) {
|
|||
return Promise.all([
|
||||
waitForCookieChanged(),
|
||||
SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser, [cookie], passedCookie => (content.document.cookie = passedCookie)
|
||||
gBrowser.selectedBrowser,
|
||||
[cookie],
|
||||
passedCookie => (content.document.cookie = passedCookie)
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -31,10 +31,16 @@ add_task(async function() {
|
|||
// Set a new title.
|
||||
await SpecialPowers.spawn(browser, [], async function() {
|
||||
return new Promise(resolve => {
|
||||
docShell.chromeEventHandler.addEventListener("DOMTitleChanged", function onTitleChanged() {
|
||||
docShell.chromeEventHandler.removeEventListener("DOMTitleChanged", onTitleChanged);
|
||||
resolve();
|
||||
});
|
||||
docShell.chromeEventHandler.addEventListener(
|
||||
"DOMTitleChanged",
|
||||
function onTitleChanged() {
|
||||
docShell.chromeEventHandler.removeEventListener(
|
||||
"DOMTitleChanged",
|
||||
onTitleChanged
|
||||
);
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
|
||||
content.document.title = "new title";
|
||||
});
|
||||
|
|
|
@ -18,7 +18,9 @@ add_task(async function() {
|
|||
let browser2 = tab2.linkedBrowser;
|
||||
await promiseTabRestored(tab2);
|
||||
|
||||
await SpecialPowers.spawn(browser2, [{ expectedId: i }], async function(args) {
|
||||
await SpecialPowers.spawn(browser2, [{ expectedId: i }], async function(
|
||||
args
|
||||
) {
|
||||
let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
|
||||
Assert.equal(
|
||||
loadContext.originAttributes.userContextId,
|
||||
|
@ -46,7 +48,9 @@ add_task(async function() {
|
|||
let browser2 = tab2.linkedBrowser;
|
||||
await promiseTabRestored(tab2);
|
||||
|
||||
await SpecialPowers.spawn(browser2, [{ expectedId: 1 }], async function(args) {
|
||||
await SpecialPowers.spawn(browser2, [{ expectedId: 1 }], async function(
|
||||
args
|
||||
) {
|
||||
Assert.equal(
|
||||
docShell.getOriginAttributes().userContextId,
|
||||
args.expectedId,
|
||||
|
@ -71,15 +75,17 @@ add_task(async function() {
|
|||
let tab2 = ss.undoCloseTab(window, 0);
|
||||
Assert.equal(tab2.getAttribute("usercontextid"), 1);
|
||||
await promiseTabRestored(tab2);
|
||||
await SpecialPowers.spawn(tab2.linkedBrowser, [{ expectedId: 1 }], async function(
|
||||
args
|
||||
) {
|
||||
Assert.equal(
|
||||
docShell.getOriginAttributes().userContextId,
|
||||
args.expectedId,
|
||||
"The docShell has the correct userContextId"
|
||||
);
|
||||
});
|
||||
await SpecialPowers.spawn(
|
||||
tab2.linkedBrowser,
|
||||
[{ expectedId: 1 }],
|
||||
async function(args) {
|
||||
Assert.equal(
|
||||
docShell.getOriginAttributes().userContextId,
|
||||
args.expectedId,
|
||||
"The docShell has the correct userContextId"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
BrowserTestUtils.removeTab(tab2);
|
||||
});
|
||||
|
@ -137,7 +143,9 @@ add_task(async function test() {
|
|||
await Promise.all([
|
||||
waitForNewCookie(),
|
||||
SpecialPowers.spawn(
|
||||
browser, [cookie], passedCookie => (content.document.cookie = passedCookie)
|
||||
browser,
|
||||
[cookie],
|
||||
passedCookie => (content.document.cookie = passedCookie)
|
||||
),
|
||||
]);
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче