mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1453881: Part 1a - Automatically write add_task(function*) to add_task(async function) r=ochameau
This was done using the script at:
bc5629735d/processors/add-task-async.jsm
MozReview-Commit-ID: KxuS9Cen87
--HG--
extra : rebase_source : c0028e0cd55ba1643610cd30c55c6f4bca7d6e58
extra : histedit_source : ebc84fdec9c2db6176632d62de4e7bdad2a7829d
This commit is contained in:
parent
78bac61f63
commit
0f40271841
@ -7,7 +7,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
/* global sinon */
|
||||
Services.scriptloader.loadSubScript("resource://testing-common/sinon-2.3.2.js");
|
||||
|
||||
registerCleanupFunction(function* () {
|
||||
registerCleanupFunction(async function() {
|
||||
// Cleanup window or the test runner will throw an error
|
||||
delete window.sinon;
|
||||
});
|
||||
|
@ -148,7 +148,7 @@ add_task(async function testExactHostMatch() {
|
||||
}
|
||||
});
|
||||
|
||||
add_task(function* testDefaultPrefs() {
|
||||
add_task(async function testDefaultPrefs() {
|
||||
let uri = Services.io.newURI("https://example.com");
|
||||
|
||||
// Check that without a pref the default return value is UNKNOWN.
|
||||
|
@ -5,7 +5,7 @@
|
||||
const { parseFileUri } =
|
||||
require("devtools/client/aboutdebugging/modules/addon");
|
||||
|
||||
add_task(function* testParseFileUri() {
|
||||
add_task(async function testParseFileUri() {
|
||||
equal(
|
||||
parseFileUri("file:///home/me/my-extension/"),
|
||||
"/home/me/my-extension/",
|
||||
|
@ -14,15 +14,15 @@ const SHEET_B = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetB.css";
|
||||
const SHEET_C = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetC.css";
|
||||
const SHEET_D = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetD.css";
|
||||
|
||||
add_task(function* () {
|
||||
let options = yield helpers.openTab(PAGE_3);
|
||||
yield helpers.openToolbar(options);
|
||||
add_task(async function() {
|
||||
let options = await helpers.openTab(PAGE_3);
|
||||
await helpers.openToolbar(options);
|
||||
|
||||
let usage = yield csscoverage.getUsage(options.target);
|
||||
let usage = await csscoverage.getUsage(options.target);
|
||||
|
||||
yield navigate(usage, options);
|
||||
yield checkPages(usage);
|
||||
yield checkEditorReport(usage);
|
||||
await navigate(usage, options);
|
||||
await checkPages(usage);
|
||||
await checkEditorReport(usage);
|
||||
// usage.createPageReport is not supported for usage.oneshot data as of
|
||||
// bug 1035300 because the page report assumed we have preload data which
|
||||
// oneshot can't gather. The ideal solution is to have a special no-preload
|
||||
@ -30,8 +30,8 @@ add_task(function* () {
|
||||
// function, we're currently not supporting page report for oneshot data
|
||||
// yield checkPageReport(usage);
|
||||
|
||||
yield helpers.closeToolbar(options);
|
||||
yield helpers.closeTab(options);
|
||||
await helpers.closeToolbar(options);
|
||||
await helpers.closeTab(options);
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -15,19 +15,19 @@ const SHEET_B = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetB.css";
|
||||
const SHEET_C = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetC.css";
|
||||
const SHEET_D = TEST_BASE_HTTPS + "browser_cmd_csscoverage_sheetD.css";
|
||||
|
||||
add_task(function* () {
|
||||
let options = yield helpers.openTab("about:blank");
|
||||
yield helpers.openToolbar(options);
|
||||
add_task(async function() {
|
||||
let options = await helpers.openTab("about:blank");
|
||||
await helpers.openToolbar(options);
|
||||
|
||||
let usage = yield csscoverage.getUsage(options.target);
|
||||
let usage = await csscoverage.getUsage(options.target);
|
||||
|
||||
yield navigate(usage, options);
|
||||
yield checkPages(usage);
|
||||
yield checkEditorReport(usage);
|
||||
yield checkPageReport(usage);
|
||||
await navigate(usage, options);
|
||||
await checkPages(usage);
|
||||
await checkEditorReport(usage);
|
||||
await checkPageReport(usage);
|
||||
|
||||
yield helpers.closeToolbar(options);
|
||||
yield helpers.closeTab(options);
|
||||
await helpers.closeToolbar(options);
|
||||
await helpers.closeTab(options);
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
const csscoverage = require("devtools/server/actors/csscoverage");
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
testDeconstructRuleId();
|
||||
});
|
||||
|
||||
|
@ -9,39 +9,39 @@
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function() {
|
||||
let options = {
|
||||
source: TAB_URL,
|
||||
line: 1
|
||||
};
|
||||
let [tab,, panel] = yield initDebugger(TAB_URL, options);
|
||||
let [tab,, panel] = await initDebugger(TAB_URL, options);
|
||||
let panelWin = panel.panelWin;
|
||||
let toolbox = panel._toolbox;
|
||||
let toolboxTab = toolbox.doc.getElementById("toolbox-tab-jsdebugger");
|
||||
|
||||
let newTab = yield addTab(TAB_URL);
|
||||
let newTab = await addTab(TAB_URL);
|
||||
isnot(newTab, tab,
|
||||
"The newly added tab is different from the debugger's tab.");
|
||||
is(gBrowser.selectedTab, newTab,
|
||||
"Debugger's tab is not the selected tab.");
|
||||
|
||||
info("Run tests against bottom host.");
|
||||
yield testPause();
|
||||
yield testResume();
|
||||
await testPause();
|
||||
await testResume();
|
||||
|
||||
// testResume selected the console, select back the debugger.
|
||||
yield toolbox.selectTool("jsdebugger");
|
||||
await toolbox.selectTool("jsdebugger");
|
||||
|
||||
info("Switching to a toolbox window host.");
|
||||
yield toolbox.switchHost(Toolbox.HostType.WINDOW);
|
||||
await toolbox.switchHost(Toolbox.HostType.WINDOW);
|
||||
|
||||
info("Run tests against window host.");
|
||||
yield testPause();
|
||||
yield testResume();
|
||||
await testPause();
|
||||
await testResume();
|
||||
|
||||
info("Cleanup after the test.");
|
||||
yield toolbox.switchHost(Toolbox.HostType.BOTTOM);
|
||||
yield closeDebuggerAndFinish(panel);
|
||||
await toolbox.switchHost(Toolbox.HostType.BOTTOM);
|
||||
await closeDebuggerAndFinish(panel);
|
||||
|
||||
function* testPause() {
|
||||
is(panelWin.gThreadClient.paused, false,
|
||||
|
@ -13,15 +13,15 @@ const FORM = "<form method=\"POST\"><input type=\"submit\"></form>";
|
||||
const GET_CONTENT = "<script>\"GET\";</script>" + FORM;
|
||||
const POST_CONTENT = "<script>\"POST\";</script>" + FORM;
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
// Disable rcwn to make cache behavior deterministic.
|
||||
yield pushPref("network.http.rcwn.enabled", false);
|
||||
await pushPref("network.http.rcwn.enabled", false);
|
||||
|
||||
let options = {
|
||||
source: TAB_URL,
|
||||
line: 1
|
||||
};
|
||||
let [tab,, panel] = yield initDebugger(TAB_URL, options);
|
||||
let [tab,, panel] = await initDebugger(TAB_URL, options);
|
||||
let win = panel.panelWin;
|
||||
let editor = win.DebuggerView.editor;
|
||||
let queries = win.require("./content/queries");
|
||||
@ -38,10 +38,10 @@ add_task(function* () {
|
||||
|
||||
// Submit the form and wait for debugger update
|
||||
let onSourceUpdated = waitForSourceShown(panel, TAB_URL);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, null, function () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, null, function () {
|
||||
content.document.querySelector("input[type=\"submit\"]").click();
|
||||
});
|
||||
yield onSourceUpdated;
|
||||
await onSourceUpdated;
|
||||
|
||||
// Verify that the source updates to the POST page content
|
||||
source = queries.getSelectedSource(getState());
|
||||
@ -52,5 +52,5 @@ add_task(function* () {
|
||||
is(editor.getText(), POST_CONTENT,
|
||||
"The currently shown source contains bacon. Mmm, delicious!");
|
||||
|
||||
yield closeDebuggerAndFinish(panel);
|
||||
await closeDebuggerAndFinish(panel);
|
||||
});
|
||||
|
@ -14,22 +14,22 @@ const IFRAME_URL = "data:text/html;charset=utf-8," +
|
||||
"<div onclick='fn()'>hello</div>";
|
||||
const TAB_URL = `data:text/html;charset=utf-8,<iframe src="${IFRAME_URL}"/>`;
|
||||
|
||||
add_task(function* () {
|
||||
let [,, panel] = yield initDebugger();
|
||||
add_task(async function() {
|
||||
let [,, panel] = await initDebugger();
|
||||
let dbg = panel.panelWin;
|
||||
let newSource;
|
||||
|
||||
newSource = waitForDebuggerEvents(panel, dbg.EVENTS.NEW_SOURCE);
|
||||
reload(panel, TAB_URL);
|
||||
yield newSource;
|
||||
await newSource;
|
||||
ok(true, "Source event fired on initial load");
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
newSource = waitForDebuggerEvents(panel, dbg.EVENTS.NEW_SOURCE);
|
||||
reload(panel);
|
||||
yield newSource;
|
||||
await newSource;
|
||||
ok(true, `Source event fired after ${i + 1} reloads`);
|
||||
}
|
||||
|
||||
yield closeDebuggerAndFinish(panel);
|
||||
await closeDebuggerAndFinish(panel);
|
||||
});
|
||||
|
@ -4,18 +4,18 @@
|
||||
var TAB_URL = EXAMPLE_URL + "doc_WorkerActor.attachThread-tab.html";
|
||||
var WORKER_URL = "code_WorkerActor.attachThread-worker.js";
|
||||
|
||||
add_task(function* testNormalExecution() {
|
||||
add_task(async function testNormalExecution() {
|
||||
let {client, tab, tabClient, workerClient, toolbox, gDebugger} =
|
||||
yield initWorkerDebugger(TAB_URL, WORKER_URL);
|
||||
await initWorkerDebugger(TAB_URL, WORKER_URL);
|
||||
|
||||
let jsterm = yield getSplitConsole(toolbox);
|
||||
let executed = yield jsterm.execute("this.location.toString()");
|
||||
let jsterm = await getSplitConsole(toolbox);
|
||||
let executed = await jsterm.execute("this.location.toString()");
|
||||
ok(executed.textContent.includes(WORKER_URL),
|
||||
"Evaluating the global's location works");
|
||||
|
||||
terminateWorkerInTab(tab, WORKER_URL);
|
||||
yield waitForWorkerClose(workerClient);
|
||||
yield gDevTools.closeToolbox(TargetFactory.forWorker(workerClient));
|
||||
yield close(client);
|
||||
yield removeTab(tab);
|
||||
await waitForWorkerClose(workerClient);
|
||||
await gDevTools.closeToolbox(TargetFactory.forWorker(workerClient));
|
||||
await close(client);
|
||||
await removeTab(tab);
|
||||
});
|
||||
|
@ -4,17 +4,17 @@
|
||||
var TAB_URL = EXAMPLE_URL + "doc_WorkerActor.attachThread-tab.html";
|
||||
var WORKER_URL = "code_WorkerActor.attachThread-worker.js";
|
||||
|
||||
add_task(function* testWhilePaused() {
|
||||
add_task(async function testWhilePaused() {
|
||||
let {client, tab, tabClient, workerClient, toolbox, gDebugger} =
|
||||
yield initWorkerDebugger(TAB_URL, WORKER_URL);
|
||||
await initWorkerDebugger(TAB_URL, WORKER_URL);
|
||||
|
||||
let gTarget = gDebugger.gTarget;
|
||||
let gResumeButton = gDebugger.document.getElementById("resume");
|
||||
let gResumeKey = gDebugger.document.getElementById("resumeKey");
|
||||
|
||||
// Execute some basic math to make sure evaluations are working.
|
||||
let jsterm = yield getSplitConsole(toolbox);
|
||||
let executed = yield jsterm.execute("10000+1");
|
||||
let jsterm = await getSplitConsole(toolbox);
|
||||
let executed = await jsterm.execute("10000+1");
|
||||
ok(executed.textContent.includes("10001"), "Text for message appeared correct");
|
||||
|
||||
// Pause the worker by waiting for next execution and then sending a message to
|
||||
@ -25,34 +25,34 @@ add_task(function* testWhilePaused() {
|
||||
info("Posting message to worker, then waiting for a pause");
|
||||
postMessageToWorkerInTab(tab, WORKER_URL, "ping");
|
||||
});
|
||||
yield oncePaused;
|
||||
await oncePaused;
|
||||
|
||||
let command1 = jsterm.execute("10000+2");
|
||||
let command2 = jsterm.execute("10000+3");
|
||||
let command3 = jsterm.execute("foobar"); // throw an error
|
||||
|
||||
info("Trying to get the result of command1");
|
||||
executed = yield command1;
|
||||
executed = await command1;
|
||||
ok(executed.textContent.includes("10002"),
|
||||
"command1 executed successfully");
|
||||
|
||||
info("Trying to get the result of command2");
|
||||
executed = yield command2;
|
||||
executed = await command2;
|
||||
ok(executed.textContent.includes("10003"),
|
||||
"command2 executed successfully");
|
||||
|
||||
info("Trying to get the result of command3");
|
||||
executed = yield command3;
|
||||
executed = await command3;
|
||||
ok(executed.textContent.includes("ReferenceError: foobar is not defined"),
|
||||
"command3 executed successfully");
|
||||
|
||||
let onceResumed = gTarget.once("thread-resumed");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
|
||||
yield onceResumed;
|
||||
await onceResumed;
|
||||
|
||||
terminateWorkerInTab(tab, WORKER_URL);
|
||||
yield waitForWorkerClose(workerClient);
|
||||
yield gDevTools.closeToolbox(TargetFactory.forWorker(workerClient));
|
||||
yield close(client);
|
||||
yield removeTab(tab);
|
||||
await waitForWorkerClose(workerClient);
|
||||
await gDevTools.closeToolbox(TargetFactory.forWorker(workerClient));
|
||||
await close(client);
|
||||
await removeTab(tab);
|
||||
});
|
||||
|
@ -5,16 +5,16 @@ var TAB_URL = EXAMPLE_URL + "doc_WorkerActor.attachThread-tab.html";
|
||||
var WORKER_URL = "code_WorkerActor.attachThread-worker.js";
|
||||
|
||||
// Test to see if creating the pause from the console works.
|
||||
add_task(function* testPausedByConsole() {
|
||||
add_task(async function testPausedByConsole() {
|
||||
let {client, tab, tabClient, workerClient, toolbox, gDebugger} =
|
||||
yield initWorkerDebugger(TAB_URL, WORKER_URL);
|
||||
await initWorkerDebugger(TAB_URL, WORKER_URL);
|
||||
|
||||
let gTarget = gDebugger.gTarget;
|
||||
let gResumeButton = gDebugger.document.getElementById("resume");
|
||||
let gResumeKey = gDebugger.document.getElementById("resumeKey");
|
||||
|
||||
let jsterm = yield getSplitConsole(toolbox);
|
||||
let executed = yield jsterm.execute("10000+1");
|
||||
let jsterm = await getSplitConsole(toolbox);
|
||||
let executed = await jsterm.execute("10000+1");
|
||||
ok(executed.textContent.includes("10001"),
|
||||
"Text for message appeared correct");
|
||||
|
||||
@ -23,24 +23,24 @@ add_task(function* testPausedByConsole() {
|
||||
let pausedExecution = jsterm.execute("10000+2");
|
||||
|
||||
info("Executed a command with 'break on next' active, waiting for pause");
|
||||
yield oncePaused;
|
||||
await oncePaused;
|
||||
|
||||
executed = yield jsterm.execute("10000+3");
|
||||
executed = await jsterm.execute("10000+3");
|
||||
ok(executed.textContent.includes("10003"),
|
||||
"Text for message appeared correct");
|
||||
|
||||
info("Waiting for a resume");
|
||||
let onceResumed = gTarget.once("thread-resumed");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);
|
||||
yield onceResumed;
|
||||
await onceResumed;
|
||||
|
||||
executed = yield pausedExecution;
|
||||
executed = await pausedExecution;
|
||||
ok(executed.textContent.includes("10002"),
|
||||
"Text for message appeared correct");
|
||||
|
||||
terminateWorkerInTab(tab, WORKER_URL);
|
||||
yield waitForWorkerClose(workerClient);
|
||||
yield gDevTools.closeToolbox(TargetFactory.forWorker(workerClient));
|
||||
yield close(client);
|
||||
yield removeTab(tab);
|
||||
await waitForWorkerClose(workerClient);
|
||||
await gDevTools.closeToolbox(TargetFactory.forWorker(workerClient));
|
||||
await close(client);
|
||||
await removeTab(tab);
|
||||
});
|
||||
|
@ -10,24 +10,24 @@ PromiseTestUtils.whitelistRejectionsGlobally(/connection just closed/);
|
||||
const TAB_URL = EXAMPLE_URL + "doc_WorkerActor.attachThread-tab.html";
|
||||
const WORKER_URL = "code_WorkerActor.attachThread-worker.js";
|
||||
|
||||
add_task(function* testPausedByConsole() {
|
||||
add_task(async function testPausedByConsole() {
|
||||
let {client, tab, workerClient, toolbox} =
|
||||
yield initWorkerDebugger(TAB_URL, WORKER_URL);
|
||||
await initWorkerDebugger(TAB_URL, WORKER_URL);
|
||||
|
||||
info("Check Date objects can be used in the console");
|
||||
let jsterm = yield getSplitConsole(toolbox);
|
||||
let executed = yield jsterm.execute("new Date(0)");
|
||||
let jsterm = await getSplitConsole(toolbox);
|
||||
let executed = await jsterm.execute("new Date(0)");
|
||||
ok(executed.textContent.includes("1970-01-01T00:00:00.000Z"),
|
||||
"Text for message appeared correct");
|
||||
|
||||
info("Check RegExp objects can be used in the console");
|
||||
executed = yield jsterm.execute("new RegExp('.*')");
|
||||
executed = await jsterm.execute("new RegExp('.*')");
|
||||
ok(executed.textContent.includes("/.*/"),
|
||||
"Text for message appeared correct");
|
||||
|
||||
terminateWorkerInTab(tab, WORKER_URL);
|
||||
yield waitForWorkerClose(workerClient);
|
||||
yield gDevTools.closeToolbox(TargetFactory.forWorker(workerClient));
|
||||
yield close(client);
|
||||
yield removeTab(tab);
|
||||
await waitForWorkerClose(workerClient);
|
||||
await gDevTools.closeToolbox(TargetFactory.forWorker(workerClient));
|
||||
await close(client);
|
||||
await removeTab(tab);
|
||||
});
|
||||
|
@ -11,33 +11,33 @@ PromiseTestUtils.expectUncaughtRejection(/[object Object]/);
|
||||
var TAB_URL = EXAMPLE_URL + "doc_WorkerActor.attachThread-tab.html";
|
||||
var WORKER_URL = "code_WorkerActor.attachThread-worker.js";
|
||||
|
||||
add_task(function* () {
|
||||
yield pushPrefs(["devtools.scratchpad.enabled", true]);
|
||||
add_task(async function() {
|
||||
await pushPrefs(["devtools.scratchpad.enabled", true]);
|
||||
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
yield connect(client);
|
||||
await connect(client);
|
||||
|
||||
let tab = yield addTab(TAB_URL);
|
||||
let { tabs } = yield listTabs(client);
|
||||
let [, tabClient] = yield attachTab(client, findTab(tabs, TAB_URL));
|
||||
let tab = await addTab(TAB_URL);
|
||||
let { tabs } = await listTabs(client);
|
||||
let [, tabClient] = await attachTab(client, findTab(tabs, TAB_URL));
|
||||
|
||||
yield listWorkers(tabClient);
|
||||
yield createWorkerInTab(tab, WORKER_URL);
|
||||
await listWorkers(tabClient);
|
||||
await createWorkerInTab(tab, WORKER_URL);
|
||||
|
||||
let { workers } = yield listWorkers(tabClient);
|
||||
let [, workerClient] = yield attachWorker(tabClient,
|
||||
let { workers } = await listWorkers(tabClient);
|
||||
let [, workerClient] = await attachWorker(tabClient,
|
||||
findWorker(workers, WORKER_URL));
|
||||
|
||||
let toolbox = yield gDevTools.showToolbox(TargetFactory.forWorker(workerClient),
|
||||
let toolbox = await gDevTools.showToolbox(TargetFactory.forWorker(workerClient),
|
||||
"jsdebugger",
|
||||
Toolbox.HostType.WINDOW);
|
||||
|
||||
is(toolbox.hostType, "window", "correct host");
|
||||
|
||||
yield new Promise(done => {
|
||||
await new Promise(done => {
|
||||
toolbox.win.parent.addEventListener("message", function onmessage(event) {
|
||||
if (event.data.name == "set-host-title") {
|
||||
toolbox.win.parent.removeEventListener("message", onmessage);
|
||||
@ -55,8 +55,8 @@ add_task(function* () {
|
||||
"Correct set of tools supported by worker");
|
||||
|
||||
terminateWorkerInTab(tab, WORKER_URL);
|
||||
yield waitForWorkerClose(workerClient);
|
||||
yield close(client);
|
||||
await waitForWorkerClose(workerClient);
|
||||
await close(client);
|
||||
|
||||
yield toolbox.destroy();
|
||||
await toolbox.destroy();
|
||||
});
|
||||
|
@ -35,7 +35,7 @@ const CHROME_URI = Services.io.newURI(CHROME_URL);
|
||||
|
||||
Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false);
|
||||
|
||||
registerCleanupFunction(function* () {
|
||||
registerCleanupFunction(async function() {
|
||||
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
|
||||
|
||||
info("finish() was called, cleaning up...");
|
||||
@ -44,7 +44,7 @@ registerCleanupFunction(function* () {
|
||||
while (gBrowser && gBrowser.tabs && gBrowser.tabs.length > 1) {
|
||||
info("Destroying toolbox.");
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
yield gDevTools.closeToolbox(target);
|
||||
await gDevTools.closeToolbox(target);
|
||||
|
||||
info("Removing tab.");
|
||||
gBrowser.removeCurrentTab();
|
||||
@ -55,7 +55,7 @@ registerCleanupFunction(function* () {
|
||||
|
||||
// Debugger tests use a lot of memory, so force a GC to help fragmentation.
|
||||
info("Forcing GC/CC after debugger test.");
|
||||
yield new Promise(resolve => {
|
||||
await new Promise(resolve => {
|
||||
Cu.forceGC();
|
||||
Cu.forceCC();
|
||||
Cu.schedulePreciseGC(resolve);
|
||||
|
@ -10,7 +10,7 @@ registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref(PREF_DEVTOOLS_THEME);
|
||||
});
|
||||
|
||||
add_task(function* testDevtoolsTheme() {
|
||||
add_task(async function testDevtoolsTheme() {
|
||||
info("Checking stylesheet and :root attributes based on devtools theme.");
|
||||
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
|
||||
is(document.getElementById("browser-bottombox").getAttribute("devtoolstheme"), "light",
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
let { setFilterString } = require("devtools/client/memory/actions/filter");
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let store = Store();
|
||||
const { getState, dispatch } = store;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
const { censusDisplays } = require("devtools/client/memory/constants");
|
||||
const { setCensusDisplay } = require("devtools/client/memory/actions/census-display");
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let store = Store();
|
||||
const { getState, dispatch } = store;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
const { drawBox } = require("devtools/client/memory/components/tree-map/draw");
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let fillRectValues, strokeRectValues;
|
||||
let ctx = {
|
||||
fillRect: (...args) => {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
const { drawText } = require("devtools/client/memory/components/tree-map/draw");
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
// Mock out the Canvas2dContext
|
||||
let ctx = {
|
||||
fillText: (...args) => fillTextValues.push(args),
|
||||
|
@ -13,7 +13,7 @@ let utils = require("devtools/client/memory/utils");
|
||||
let { snapshotState: states, viewState } = require("devtools/client/memory/constants");
|
||||
let { Preferences } = require("resource://gre/modules/Preferences.jsm");
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let s1 = utils.createSnapshot({ view: { state: viewState.CENSUS } });
|
||||
let s2 = utils.createSnapshot({ view: { state: viewState.CENSUS } });
|
||||
equal(s1.state, states.SAVING,
|
||||
|
@ -12,8 +12,8 @@ const ADD_HEADER = "Test-header: true";
|
||||
const ADD_UA_HEADER = "User-Agent: Custom-Agent";
|
||||
const ADD_POSTDATA = "&t3=t4";
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
|
||||
add_task(async function() {
|
||||
let { tab, monitor } = await initNetMonitor(POST_DATA_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire, connector } = monitor.panelWin;
|
||||
@ -26,7 +26,7 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
// Execute requests.
|
||||
yield performRequests(monitor, tab, 2);
|
||||
await performRequests(monitor, tab, 2);
|
||||
|
||||
let origItem = getSortedRequests(store.getState()).get(0);
|
||||
|
||||
@ -41,7 +41,7 @@ add_task(function* () {
|
||||
testCustomItem(customItem, origItem);
|
||||
|
||||
// edit the custom request
|
||||
yield editCustomForm();
|
||||
await editCustomForm();
|
||||
|
||||
// FIXME: reread the customItem, it's been replaced by a new object (immutable!)
|
||||
customItem = getSelectedRequest(store.getState());
|
||||
@ -50,19 +50,19 @@ add_task(function* () {
|
||||
// send the new request
|
||||
wait = waitForNetworkEvents(monitor, 1);
|
||||
store.dispatch(Actions.sendCustomRequest(connector));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let sentItem;
|
||||
// Testing sent request will require updated requestHeaders and requestPostData,
|
||||
// we must wait for both properties get updated before starting test.
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
sentItem = getSelectedRequest(store.getState());
|
||||
origItem = getSortedRequests(store.getState()).get(0);
|
||||
return sentItem.requestHeaders && sentItem.requestPostData &&
|
||||
origItem.requestHeaders && origItem.requestPostData;
|
||||
});
|
||||
|
||||
yield testSentRequest(sentItem, origItem);
|
||||
await testSentRequest(sentItem, origItem);
|
||||
|
||||
// Ensure the UI shows the new request, selected, and that the detail panel was closed.
|
||||
is(getSortedRequests(store.getState()).length, 3, "There are 3 requests shown");
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
const {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph");
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let hash1 = FlameGraphUtils._getStringHash("abc");
|
||||
let hash2 = FlameGraphUtils._getStringHash("acb");
|
||||
let hash3 = FlameGraphUtils._getStringHash(Array.from(Array(100000)).join("a"));
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
const {KeyCodes} = require("devtools/client/shared/keycodes");
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
for (let key in KeyCodes) {
|
||||
is(KeyCodes[key], KeyboardEvent[key], "checking value for " + key);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
const {getColor, getTheme, setTheme} = require("devtools/client/shared/theme");
|
||||
const {PrefObserver} = require("devtools/client/shared/prefs");
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
testGetTheme();
|
||||
testSetTheme();
|
||||
testGetColor();
|
||||
|
@ -20,7 +20,7 @@ const CONTENT_URLS = [
|
||||
];
|
||||
|
||||
// Test `sourceUtils.parseURL`
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let parsed = sourceUtils.parseURL("https://foo.com:8888/boo/bar.js?q=query");
|
||||
equal(parsed.fileName, "bar.js", "parseURL parsed valid fileName");
|
||||
equal(parsed.host, "foo.com:8888", "parseURL parsed valid host");
|
||||
@ -37,7 +37,7 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
// Test `sourceUtils.isContentScheme`.
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
for (let url of CHROME_URLS) {
|
||||
ok(!sourceUtils.isContentScheme(url),
|
||||
`${url} correctly identified as not content scheme`);
|
||||
@ -48,7 +48,7 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
// Test `sourceUtils.isChromeScheme`.
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
for (let url of CHROME_URLS) {
|
||||
ok(sourceUtils.isChromeScheme(url), `${url} correctly identified as chrome scheme`);
|
||||
}
|
||||
@ -59,14 +59,14 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
// Test `sourceUtils.isWASM`.
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
ok(sourceUtils.isWASM("wasm-function[66240] (?:13870536)"),
|
||||
"wasm function correctly identified");
|
||||
ok(!sourceUtils.isWASM(CHROME_URLS[0]), `A chrome url does not identify as wasm.`);
|
||||
});
|
||||
|
||||
// Test `sourceUtils.isDataScheme`.
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let dataURI = "data:text/html;charset=utf-8,<!DOCTYPE html></html>";
|
||||
ok(sourceUtils.isDataScheme(dataURI), `${dataURI} correctly identified as data scheme`);
|
||||
|
||||
@ -79,7 +79,7 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
// Test `sourceUtils.getSourceNames`.
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
testAbbreviation("http://example.com/foo/bar/baz/boo.js",
|
||||
"boo.js",
|
||||
"http://example.com/foo/bar/baz/boo.js",
|
||||
@ -87,7 +87,7 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
// Test `sourceUtils.isScratchpadTheme`
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
ok(sourceUtils.isScratchpadScheme("Scratchpad/1"),
|
||||
"Scratchpad/1 identified as scratchpad");
|
||||
ok(sourceUtils.isScratchpadScheme("Scratchpad/20"),
|
||||
@ -96,7 +96,7 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
// Test `sourceUtils.getSourceNames`.
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
// Check length
|
||||
let longMalformedURL = `example.com${new Array(100).fill("/a").join("")}/file.js`;
|
||||
ok(sourceUtils.getSourceNames(longMalformedURL).short.length <= 100,
|
||||
@ -162,7 +162,7 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
// Test for source mapped file name
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
const { getSourceMappedFile } = sourceUtils;
|
||||
const source = "baz.js";
|
||||
const output = getSourceMappedFile(source);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
const TESTPAGE = "storage-file-url.html";
|
||||
|
||||
// We need to load TESTPAGE using a file:// path so we need to get that from
|
||||
@ -23,7 +23,7 @@ add_task(function* () {
|
||||
const uriString = Services.io.newFileURI(dir).spec;
|
||||
|
||||
// Now we have a valid file:// URL pointing to TESTPAGE.
|
||||
yield openTabAndSetupStorage(uriString);
|
||||
await openTabAndSetupStorage(uriString);
|
||||
|
||||
// uriString points to the test inside objdir e.g.
|
||||
// `/path/to/fx/objDir/_tests/testing/mochitest/browser/devtools/client/
|
||||
@ -35,13 +35,13 @@ add_task(function* () {
|
||||
// The easiest way to get the actual path is to request it from the content
|
||||
// process.
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
let actualPath = yield ContentTask.spawn(browser, null, () => {
|
||||
let actualPath = await ContentTask.spawn(browser, null, () => {
|
||||
return content.document.location.href;
|
||||
});
|
||||
|
||||
const cookiePath = actualPath.substr(0, actualPath.lastIndexOf("/") + 1)
|
||||
.replace(/file:\/\//g, "");
|
||||
yield checkState([
|
||||
await checkState([
|
||||
[
|
||||
["cookies", actualPath],
|
||||
[
|
||||
@ -60,5 +60,5 @@ add_task(function* () {
|
||||
]
|
||||
]);
|
||||
|
||||
yield finishTests();
|
||||
await finishTests();
|
||||
});
|
||||
|
@ -8,17 +8,17 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-blank.html");
|
||||
yield selectTreeItem(["localStorage", "http://test1.example.org"]);
|
||||
add_task(async function() {
|
||||
await openTabAndSetupStorage(MAIN_DOMAIN + "storage-blank.html");
|
||||
await selectTreeItem(["localStorage", "http://test1.example.org"]);
|
||||
|
||||
ok(isTableEmpty(), "Table empty on init");
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
yield addRemove(`test${i}`);
|
||||
await addRemove(`test${i}`);
|
||||
}
|
||||
|
||||
yield finishTests();
|
||||
await finishTests();
|
||||
});
|
||||
|
||||
function* addRemove(name) {
|
||||
|
@ -23,7 +23,7 @@ add_task(async function() {
|
||||
// debugger still turned on
|
||||
Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", true);
|
||||
Services.prefs.setBoolPref("devtools.webconsole.filter.log", true);
|
||||
registerCleanupFunction(function* () {
|
||||
registerCleanupFunction(async function() {
|
||||
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
|
||||
Services.prefs.clearUserPref("devtools.webconsole.filter.log");
|
||||
});
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Test that the HeapAnalyses{Client,Worker} can send SavedFrame stacks from
|
||||
// by-allocation-stack reports from the worker.
|
||||
|
||||
add_task(function* test() {
|
||||
add_task(async function test() {
|
||||
const client = new HeapAnalysesClient();
|
||||
|
||||
// Track some allocation stacks.
|
||||
@ -40,13 +40,13 @@ add_task(function* test() {
|
||||
// Take a heap snapshot.
|
||||
|
||||
const snapshotFilePath = saveNewHeapSnapshot({ debugger: dbg });
|
||||
yield client.readHeapSnapshot(snapshotFilePath);
|
||||
await client.readHeapSnapshot(snapshotFilePath);
|
||||
ok(true, "Should have read the heap snapshot");
|
||||
|
||||
// Run a census broken down by class name -> allocation stack so we can grab
|
||||
// only the AllocationMarker objects we have complete control over.
|
||||
|
||||
const { report } = yield client.takeCensus(
|
||||
const { report } = await client.takeCensus(
|
||||
snapshotFilePath,
|
||||
{
|
||||
breakdown: {
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
const { localizeMarkup, LocalizationHelper } = require("devtools/shared/l10n");
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
info("Check that the strings used for this test are still valid");
|
||||
let STARTUP_L10N = new LocalizationHelper("devtools/client/locales/startup.properties");
|
||||
let TOOLBOX_L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
@ -47,45 +47,45 @@ function* checkBrowserAction(extension, id, tab) {
|
||||
is(clickedTab.id, tab.id, "Got the expected tab id in the browserAction.onClicked event");
|
||||
}
|
||||
|
||||
add_task(function* test_browserAction() {
|
||||
add_task(async function test_browserAction() {
|
||||
const extension = createExtension("BrowserAction Extension");
|
||||
yield extension.startup();
|
||||
const tab = yield extension.awaitMessage("ready");
|
||||
await extension.startup();
|
||||
const tab = await extension.awaitMessage("ready");
|
||||
let id = `{${extension.uuid}}`;
|
||||
yield checkBrowserAction(extension, id, tab);
|
||||
yield extension.unload();
|
||||
await checkBrowserAction(extension, id, tab);
|
||||
await extension.unload();
|
||||
|
||||
ok(!BrowserActions.isShown(id), "The BrowserAction should be removed after the extension unloads");
|
||||
});
|
||||
|
||||
add_task(function* test_multiple_browserActions() {
|
||||
add_task(async function test_multiple_browserActions() {
|
||||
const ext1 = createExtension("BrowserAction Extension 1");
|
||||
const ext2 = createExtension("BrowserAction Extension 2");
|
||||
|
||||
// Start the first extension and test its browser action.
|
||||
yield ext1.startup();
|
||||
const tab1 = yield ext1.awaitMessage("ready");
|
||||
await ext1.startup();
|
||||
const tab1 = await ext1.awaitMessage("ready");
|
||||
let id1 = `{${ext1.uuid}}`;
|
||||
yield checkBrowserAction(ext1, id1, tab1);
|
||||
await checkBrowserAction(ext1, id1, tab1);
|
||||
|
||||
// Start the second extension and test its browser action.
|
||||
yield ext2.startup();
|
||||
const tab2 = yield ext2.awaitMessage("ready");
|
||||
await ext2.startup();
|
||||
const tab2 = await ext2.awaitMessage("ready");
|
||||
let id2 = `{${ext2.uuid}}`;
|
||||
yield checkBrowserAction(ext2, id2, tab2);
|
||||
await checkBrowserAction(ext2, id2, tab2);
|
||||
|
||||
// Verify that the first browser action is still active.
|
||||
yield checkBrowserAction(ext1, id1, tab1);
|
||||
await checkBrowserAction(ext1, id1, tab1);
|
||||
|
||||
// Unload the first extension and verify that the browser action is removed.
|
||||
yield ext1.unload();
|
||||
await ext1.unload();
|
||||
ok(!BrowserActions.isShown(id1), "The first BrowserAction should be removed after ext1 unloads");
|
||||
|
||||
// Verify that the second browser action is still active.
|
||||
yield checkBrowserAction(ext2, id2, tab2);
|
||||
await checkBrowserAction(ext2, id2, tab2);
|
||||
|
||||
// Unload the second extension and verify that the browser action is removed.
|
||||
yield ext2.unload();
|
||||
await ext2.unload();
|
||||
ok(!BrowserActions.isShown(id2), "The second BrowserAction should be removed after ext2 unloads");
|
||||
});
|
||||
</script>
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let win = window.open("http://mochi.test:8888/");
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
@ -77,9 +77,9 @@ add_task(function* () {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish("tabRuntimeConnect.pass");
|
||||
yield extension.unload();
|
||||
await extension.startup();
|
||||
await extension.awaitFinish("tabRuntimeConnect.pass");
|
||||
await extension.unload();
|
||||
|
||||
win.close();
|
||||
});
|
||||
|
@ -133,17 +133,17 @@ function* runTest(options) {
|
||||
win.close();
|
||||
}
|
||||
|
||||
add_task(function* testCaptureVisibleTab() {
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
add_task(async function testCaptureVisibleTab() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.data_uri.block_toplevel_data_uri_navigations", false]],
|
||||
});
|
||||
|
||||
yield runTest({color: [0, 0, 0]});
|
||||
await runTest({color: [0, 0, 0]});
|
||||
|
||||
yield runTest({color: [255, 255, 255]});
|
||||
await runTest({color: [255, 255, 255]});
|
||||
});
|
||||
|
||||
add_task(function* testCaptureVisibleTabPermissions() {
|
||||
add_task(async function testCaptureVisibleTabPermissions() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
@ -156,11 +156,11 @@ add_task(function* testCaptureVisibleTabPermissions() {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield extension.awaitFinish("captureVisibleTabPermissions");
|
||||
await extension.awaitFinish("captureVisibleTabPermissions");
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
@ -129,9 +129,9 @@ add_task(function* () {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish("tabs.create");
|
||||
yield extension.unload();
|
||||
await extension.startup();
|
||||
await extension.awaitFinish("tabs.create");
|
||||
await extension.unload();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* testTabEvents() {
|
||||
add_task(async function testTabEvents() {
|
||||
async function background() {
|
||||
let events = [];
|
||||
let eventPromise;
|
||||
@ -98,12 +98,12 @@ add_task(function* testTabEvents() {
|
||||
background,
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish("tabs-events");
|
||||
yield extension.unload();
|
||||
await extension.startup();
|
||||
await extension.awaitFinish("tabs-events");
|
||||
await extension.unload();
|
||||
});
|
||||
|
||||
add_task(function* testTabRemovalEvent() {
|
||||
add_task(async function testTabRemovalEvent() {
|
||||
async function background() {
|
||||
function awaitLoad(tabId) {
|
||||
return new Promise(resolve => {
|
||||
@ -146,9 +146,9 @@ add_task(function* testTabRemovalEvent() {
|
||||
background,
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish("tabs-events");
|
||||
yield extension.unload();
|
||||
await extension.startup();
|
||||
await extension.awaitFinish("tabs-events");
|
||||
await extension.unload();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -13,12 +13,12 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* testExecuteScript() {
|
||||
add_task(async function testExecuteScript() {
|
||||
const BASE = "http://mochi.test:8888/tests/mobile/android/components/extensions/test/mochitest/";
|
||||
const URL = BASE + "file_iframe_document.html";
|
||||
|
||||
let win = window.open(URL);
|
||||
yield new Promise(resolve => win.addEventListener("load", resolve, {once: true}));
|
||||
await new Promise(resolve => win.addEventListener("load", resolve, {once: true}));
|
||||
|
||||
async function background() {
|
||||
try {
|
||||
@ -232,11 +232,11 @@ add_task(function* testExecuteScript() {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield extension.awaitFinish("executeScript");
|
||||
await extension.awaitFinish("executeScript");
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
|
||||
win.close();
|
||||
});
|
||||
|
@ -77,19 +77,19 @@ function* testHasNoPermission(params) {
|
||||
yield extension.unload();
|
||||
}
|
||||
|
||||
add_task(function* testBadPermissions() {
|
||||
add_task(async function testBadPermissions() {
|
||||
let win1 = window.open("http://example.com/");
|
||||
let win2 = window.open("http://mochi.test:8888/");
|
||||
|
||||
yield new Promise(resolve => setTimeout(resolve, 0));
|
||||
await new Promise(resolve => setTimeout(resolve, 0));
|
||||
|
||||
info("Test no special permissions");
|
||||
yield testHasNoPermission({
|
||||
await testHasNoPermission({
|
||||
manifest: {"permissions": ["http://example.com/"]},
|
||||
});
|
||||
|
||||
info("Test tabs permissions");
|
||||
yield testHasNoPermission({
|
||||
await testHasNoPermission({
|
||||
manifest: {"permissions": ["http://example.com/", "tabs"]},
|
||||
});
|
||||
|
||||
@ -97,7 +97,7 @@ add_task(function* testBadPermissions() {
|
||||
win1.close();
|
||||
});
|
||||
|
||||
add_task(function* testBadURL() {
|
||||
add_task(async function testBadURL() {
|
||||
async function background() {
|
||||
let promises = [
|
||||
new Promise(resolve => {
|
||||
@ -157,11 +157,11 @@ add_task(function* testBadURL() {
|
||||
background,
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield extension.awaitFinish("executeScript-lastError");
|
||||
await extension.awaitFinish("executeScript-lastError");
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
});
|
||||
|
||||
// TODO: Test that |executeScript| fails if the tab has navigated to a
|
||||
|
@ -65,21 +65,21 @@ function* testHasPermission(params) {
|
||||
yield extension.unload();
|
||||
}
|
||||
|
||||
add_task(function* testGoodPermissions() {
|
||||
add_task(async function testGoodPermissions() {
|
||||
let win = window.open("http://mochi.test:8888/");
|
||||
|
||||
info("Test explicit host permission");
|
||||
yield testHasPermission({
|
||||
await testHasPermission({
|
||||
manifest: {"permissions": ["http://mochi.test/"]},
|
||||
});
|
||||
|
||||
info("Test explicit host subdomain permission");
|
||||
yield testHasPermission({
|
||||
await testHasPermission({
|
||||
manifest: {"permissions": ["http://*.mochi.test/"]},
|
||||
});
|
||||
|
||||
info("Test explicit <all_urls> permission");
|
||||
yield testHasPermission({
|
||||
await testHasPermission({
|
||||
manifest: {"permissions": ["<all_urls>"]},
|
||||
});
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* testExecuteScriptAtOnUpdated() {
|
||||
add_task(async function testExecuteScriptAtOnUpdated() {
|
||||
const BASE = "http://mochi.test:8888/tests/mobile/android/components/extensions/test/mochitest/";
|
||||
const URL = BASE + "file_iframe_document.html";
|
||||
// This is a regression test for bug 1325830.
|
||||
@ -65,15 +65,15 @@ add_task(function* testExecuteScriptAtOnUpdated() {
|
||||
background,
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
extension.sendMessage(URL);
|
||||
yield extension.awaitMessage("open-test-tab");
|
||||
await extension.awaitMessage("open-test-tab");
|
||||
|
||||
let tab = window.open(URL);
|
||||
yield extension.awaitFinish("executeScript-at-onUpdated");
|
||||
await extension.awaitFinish("executeScript-at-onUpdated");
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
|
||||
tab.close();
|
||||
});
|
||||
|
@ -25,7 +25,7 @@
|
||||
* fail to load as early as expected, but don't load at any illegal time.
|
||||
*/
|
||||
|
||||
add_task(function* testExecuteScript() {
|
||||
add_task(async function testExecuteScript() {
|
||||
let win = window.open("about:blank");
|
||||
|
||||
async function background(DEBUG) {
|
||||
@ -115,11 +115,11 @@ add_task(function* testExecuteScript() {
|
||||
background: `(${background})(${AppConstants.DEBUG})`,
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield extension.awaitFinish("executeScript-runAt");
|
||||
await extension.awaitFinish("executeScript-runAt");
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
|
||||
win.close();
|
||||
});
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
@ -56,13 +56,13 @@ add_task(function* () {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield extension.awaitMessage("background-finished");
|
||||
yield extension.awaitMessage("tab-finished");
|
||||
await extension.awaitMessage("background-finished");
|
||||
await extension.awaitMessage("tab-finished");
|
||||
|
||||
// The extension tab is automatically closed when the extension unloads.
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* testExecuteScript() {
|
||||
add_task(async function testExecuteScript() {
|
||||
let win = window.open("http://mochi.test:8888/");
|
||||
|
||||
async function background() {
|
||||
@ -103,11 +103,11 @@ add_task(function* testExecuteScript() {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield extension.awaitFinish("insertCSS");
|
||||
await extension.awaitFinish("insertCSS");
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
|
||||
win.close();
|
||||
});
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* test_onUpdated() {
|
||||
add_task(async function test_onUpdated() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
@ -85,12 +85,12 @@ add_task(function* test_onUpdated() {
|
||||
},
|
||||
});
|
||||
|
||||
yield Promise.all([
|
||||
await Promise.all([
|
||||
extension.startup(),
|
||||
extension.awaitFinish("tabs.onUpdated"),
|
||||
]);
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
});
|
||||
|
||||
function* do_test_update(background, withPermissions = true) {
|
||||
@ -108,8 +108,8 @@ function* do_test_update(background, withPermissions = true) {
|
||||
yield extension.unload();
|
||||
}
|
||||
|
||||
add_task(function* test_url() {
|
||||
yield do_test_update(function background() {
|
||||
add_task(async function test_url() {
|
||||
await do_test_update(function background() {
|
||||
// Create a new tab for testing update.
|
||||
browser.tabs.create({}, function(tab) {
|
||||
browser.tabs.onUpdated.addListener(async function onUpdated(tabId, changeInfo) {
|
||||
@ -130,8 +130,8 @@ add_task(function* test_url() {
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function* test_title() {
|
||||
yield do_test_update(async function background() {
|
||||
add_task(async function test_title() {
|
||||
await do_test_update(async function background() {
|
||||
const url = "http://mochi.test:8888/tests/mobile/android/components/extensions/test/mochitest/context_tabs_onUpdated_page.html";
|
||||
const tab = await browser.tabs.create({url});
|
||||
|
||||
@ -150,8 +150,8 @@ add_task(function* test_title() {
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function* test_without_tabs_permission() {
|
||||
yield do_test_update(async function background() {
|
||||
add_task(async function test_without_tabs_permission() {
|
||||
await do_test_update(async function background() {
|
||||
const url = "http://mochi.test:8888/tests/mobile/android/components/extensions/test/mochitest/context_tabs_onUpdated_page.html";
|
||||
const tab = await browser.tabs.create({url});
|
||||
let count = 0;
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
@ -59,9 +59,9 @@ add_task(function* () {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish("tabs.reload");
|
||||
yield extension.unload();
|
||||
await extension.startup();
|
||||
await extension.awaitFinish("tabs.reload");
|
||||
await extension.unload();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs", "<all_urls>"],
|
||||
@ -63,9 +63,9 @@ add_task(function* () {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish("tabs.reload_bypass_cache");
|
||||
yield extension.unload();
|
||||
await extension.startup();
|
||||
await extension.awaitFinish("tabs.reload_bypass_cache");
|
||||
await extension.unload();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* tabsSendMessageReply() {
|
||||
add_task(async function tabsSendMessageReply() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
@ -115,15 +115,15 @@ add_task(function* tabsSendMessageReply() {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield extension.awaitFinish("sendMessage");
|
||||
await extension.awaitFinish("sendMessage");
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
});
|
||||
|
||||
|
||||
add_task(function* tabsSendHidden() {
|
||||
add_task(async function tabsSendHidden() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
@ -198,15 +198,15 @@ add_task(function* tabsSendHidden() {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield extension.awaitFinish("contentscript-bfcache-window");
|
||||
await extension.awaitFinish("contentscript-bfcache-window");
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
});
|
||||
|
||||
|
||||
add_task(function* tabsSendMessageNoExceptionOnNonExistentTab() {
|
||||
add_task(async function tabsSendMessageNoExceptionOnNonExistentTab() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
@ -229,12 +229,12 @@ add_task(function* tabsSendMessageNoExceptionOnNonExistentTab() {
|
||||
},
|
||||
});
|
||||
|
||||
yield Promise.all([
|
||||
await Promise.all([
|
||||
extension.startup(),
|
||||
extension.awaitFinish("tabs.sendMessage"),
|
||||
]);
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
});
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@ function* testTabsUpdateURL(existentTabURL, tabsUpdateURL, isErrorExpected) {
|
||||
yield extension.unload();
|
||||
}
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
info("Start testing tabs.update on javascript URLs");
|
||||
|
||||
let dataURLPage = `data:text/html,
|
||||
@ -114,7 +114,7 @@ add_task(function* () {
|
||||
.map((check) => Object.assign({}, check, {existentTabURL: "about:blank"}));
|
||||
|
||||
for (let {existentTabURL, tabsUpdateURL, isErrorExpected} of testCases) {
|
||||
yield* testTabsUpdateURL(existentTabURL, tabsUpdateURL, isErrorExpected);
|
||||
await testTabsUpdateURL(existentTabURL, tabsUpdateURL, isErrorExpected);
|
||||
}
|
||||
|
||||
info("done");
|
||||
|
@ -43,14 +43,14 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
Services.logins.addLogin(newLogin);
|
||||
}
|
||||
|
||||
add_task(function* test_passwords_list() {
|
||||
add_task(async function test_passwords_list() {
|
||||
add_login(LOGIN_FIELDS);
|
||||
|
||||
// Load about:logins.
|
||||
let BrowserApp = Services.wm.getMostRecentWindow("navigator:browser").BrowserApp;
|
||||
let browser = BrowserApp.addTab("about:logins", { selected: true, parentId: BrowserApp.selectedTab.id }).browser;
|
||||
|
||||
yield promiseBrowserEvent(browser, "load");
|
||||
await promiseBrowserEvent(browser, "load");
|
||||
|
||||
let logins_list_parent = browser.contentDocument.getElementById("logins-list").parentNode;
|
||||
|
||||
@ -73,7 +73,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
info("Now waiting for mutation to replace 'logins-list'");
|
||||
});
|
||||
|
||||
yield waitForLoginToBeAdded;
|
||||
await waitForLoginToBeAdded;
|
||||
|
||||
let logins_list = browser.contentDocument.getElementById("logins-list");
|
||||
|
||||
|
@ -15,10 +15,10 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Accounts.jsm");
|
||||
|
||||
add_task(function* () {
|
||||
let firefoxExists = yield Accounts.firefoxAccountsExist();
|
||||
add_task(async function() {
|
||||
let firefoxExists = await Accounts.firefoxAccountsExist();
|
||||
info("Firefox account exists? " + firefoxExists + "\n");
|
||||
let anyExists = yield Accounts.anySyncAccountsExist();
|
||||
let anyExists = await Accounts.anySyncAccountsExist();
|
||||
info("Any accounts exist? " + anyExists + "\n");
|
||||
|
||||
is(anyExists, firefoxExists, "sync/firefox account existence consistent with any existence");
|
||||
|
@ -21,14 +21,14 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
// Load a custom sjs script that echos our "User-Agent" header back at us
|
||||
const TestURI = Services.io.newURI("http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/desktopmode_user_agent.sjs");
|
||||
|
||||
add_task(function* test_desktopmode() {
|
||||
add_task(async function test_desktopmode() {
|
||||
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let BrowserApp = chromeWin.BrowserApp;
|
||||
|
||||
// Add a new 'desktop mode' tab with our test page
|
||||
let desktopTab = BrowserApp.addTab(TestURI.spec, { selected: true, parentId: BrowserApp.selectedTab.id, desktopMode: true });
|
||||
let desktopBrowser = desktopTab.browser;
|
||||
yield promiseBrowserEvent(desktopBrowser, "load");
|
||||
await promiseBrowserEvent(desktopBrowser, "load");
|
||||
|
||||
// Some debugging
|
||||
info("desktop: " + desktopBrowser.contentWindow.navigator.userAgent);
|
||||
@ -43,7 +43,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
// Add a new 'mobile mode' tab with our test page
|
||||
let mobileTab = BrowserApp.addTab(TestURI.spec, { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
let mobileBrowser = mobileTab.browser;
|
||||
yield promiseBrowserEvent(mobileBrowser, "load");
|
||||
await promiseBrowserEvent(mobileBrowser, "load");
|
||||
|
||||
// Some debugging
|
||||
info("mobile: " + mobileBrowser.contentWindow.navigator.userAgent);
|
||||
|
@ -60,34 +60,34 @@ const url1 = "http://example.org/tests/robocop/robocop_blank_01.html";
|
||||
const url2 = "http://example.org/tests/robocop/robocop_blank_03.html";
|
||||
const url3 = "http://example.org/tests/robocop/robocop_blank_02.html";
|
||||
|
||||
add_task(function* test_get_last_visited() {
|
||||
var v = yield get_last_visited("https://random.com/");
|
||||
add_task(async function test_get_last_visited() {
|
||||
var v = await get_last_visited("https://random.com/");
|
||||
is(v, 0, `Last visited timestamp is 0 for unknown prePath: ${v}`);
|
||||
|
||||
let prePath = Services.io.newURI(url1).prePath + "/";
|
||||
is(prePath, Services.io.newURI(url2).prePath + "/", "url1 and url2 have the same prePath");
|
||||
|
||||
let t0 = Date.now();
|
||||
yield add_history_visit(url1);
|
||||
v = yield get_last_visited(prePath);
|
||||
await add_history_visit(url1);
|
||||
v = await get_last_visited(prePath);
|
||||
let t1 = Date.now();
|
||||
ok(t0 <= v, `Last visited timestamp is after visit: ${t0} <= ${v}.`);
|
||||
ok(v <= t1, `Last visited timestamp is before present ${v} <= ${t1}.`);
|
||||
|
||||
let t2 = Date.now();
|
||||
yield add_history_visit(url1);
|
||||
v = yield get_last_visited(prePath);
|
||||
await add_history_visit(url1);
|
||||
v = await get_last_visited(prePath);
|
||||
ok(t2 <= v, `Last visited timestamp is updated after visit: ${t2} <= ${v}`);
|
||||
|
||||
let t3 = Date.now();
|
||||
yield add_history_visit(url2);
|
||||
v = yield get_last_visited(prePath);
|
||||
await add_history_visit(url2);
|
||||
v = await get_last_visited(prePath);
|
||||
ok(t3 <= v, `Last visited timestamp is updated after visit to URL with same prePath: ${t3} <= ${v}`);
|
||||
|
||||
// This whole system is flaky, so we wait for an unrelated visit, so that we
|
||||
// can witness "link-visited" events a little after the test completes
|
||||
// while debugging.
|
||||
yield add_history_visit(url3);
|
||||
await add_history_visit(url3);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -56,10 +56,10 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
});
|
||||
}
|
||||
|
||||
add_task(function* test_save_and_delete() {
|
||||
add_task(async function test_save_and_delete() {
|
||||
// Use the HomeProvider API to save some data.
|
||||
let storage = HomeProvider.getStorage(TEST_DATASET_ID);
|
||||
yield storage.save([{
|
||||
await storage.save([{
|
||||
title: TEST_TITLE,
|
||||
url: TEST_URL,
|
||||
background_url: TEST_BACKGROUND_URL,
|
||||
@ -67,13 +67,13 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
}]);
|
||||
|
||||
// Peek in the DB to make sure we have the right data.
|
||||
let db = yield Sqlite.openConnection({ path: DB_PATH });
|
||||
let db = await Sqlite.openConnection({ path: DB_PATH });
|
||||
|
||||
// Make sure the items table was created.
|
||||
ok((yield db.tableExists("items")), "items table exists");
|
||||
ok((await db.tableExists("items")), "items table exists");
|
||||
|
||||
// Make sure the correct values for the item ended up in there.
|
||||
let result = yield db.execute("SELECT * FROM items", null, function onRow(row) {
|
||||
let result = await db.execute("SELECT * FROM items", null, function onRow(row) {
|
||||
is(row.getResultByName("dataset_id"), TEST_DATASET_ID, "expected dataset ID");
|
||||
is(row.getResultByName("url"), TEST_URL, "expected test url");
|
||||
is(row.getResultByName("background_url"), TEST_BACKGROUND_URL, "expected background url");
|
||||
@ -81,16 +81,16 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
});
|
||||
|
||||
// Use the HomeProvider API to delete the data.
|
||||
yield storage.deleteAll();
|
||||
await storage.deleteAll();
|
||||
|
||||
// Make sure the data was deleted.
|
||||
result = yield db.execute("SELECT * FROM items");
|
||||
result = await db.execute("SELECT * FROM items");
|
||||
is(result.length, 0, "length is 0");
|
||||
|
||||
db.close();
|
||||
});
|
||||
|
||||
add_task(function* test_row_validation() {
|
||||
add_task(async function test_row_validation() {
|
||||
// Use the HomeProvider API to save some data.
|
||||
let storage = HomeProvider.getStorage(TEST_DATASET_ID);
|
||||
|
||||
@ -104,7 +104,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
// None of these save calls should save anything
|
||||
for (let row of invalidRows) {
|
||||
try {
|
||||
yield storage.save([row]);
|
||||
await storage.save([row]);
|
||||
} catch (e) {
|
||||
// Just catch and ignore validation errors
|
||||
if (!(e instanceof HomeProvider.ValidationError)) {
|
||||
@ -114,16 +114,16 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
}
|
||||
|
||||
// Peek in the DB to make sure we have the right data.
|
||||
let db = yield Sqlite.openConnection({ path: DB_PATH });
|
||||
let db = await Sqlite.openConnection({ path: DB_PATH });
|
||||
|
||||
// Make sure no data has been saved.
|
||||
let result = yield db.execute("SELECT * FROM items");
|
||||
let result = await db.execute("SELECT * FROM items");
|
||||
is(result.length, 0, "length is 0");
|
||||
|
||||
db.close();
|
||||
});
|
||||
|
||||
add_task(function* test_save_transaction() {
|
||||
add_task(async function test_save_transaction() {
|
||||
// Use the HomeProvider API to save some data.
|
||||
let storage = HomeProvider.getStorage(TEST_DATASET_ID);
|
||||
|
||||
@ -135,7 +135,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
|
||||
// Try to save all the rows at once
|
||||
try {
|
||||
yield storage.save(rows);
|
||||
await storage.save(rows);
|
||||
} catch (e) {
|
||||
// Just catch and ignore validation errors
|
||||
if (!(e instanceof HomeProvider.ValidationError)) {
|
||||
@ -144,10 +144,10 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
}
|
||||
|
||||
// Peek in the DB to make sure we have the right data.
|
||||
let db = yield Sqlite.openConnection({ path: DB_PATH });
|
||||
let db = await Sqlite.openConnection({ path: DB_PATH });
|
||||
|
||||
// Make sure no data has been saved.
|
||||
let result = yield db.execute("SELECT * FROM items");
|
||||
let result = await db.execute("SELECT * FROM items");
|
||||
is(result.length, 0, "length is 0");
|
||||
|
||||
db.close();
|
||||
|
@ -59,16 +59,16 @@ function setup_browser() {
|
||||
gBrowserApp = gChromeWin.BrowserApp;
|
||||
}
|
||||
|
||||
add_task(function* test_media_control() {
|
||||
add_task(async function test_media_control() {
|
||||
info("- open a new tab -");
|
||||
let tab = gBrowserApp.addTab(URL);
|
||||
let browser = tab.browser;
|
||||
|
||||
info("- wait for loading tab's content -");
|
||||
yield promiseBrowserEvent(browser, "load");
|
||||
await promiseBrowserEvent(browser, "load");
|
||||
|
||||
info("- check whether audio starts playing -");
|
||||
yield promiseTabEvent(browser, "DOMAudioPlaybackStarted");
|
||||
await promiseTabEvent(browser, "DOMAudioPlaybackStarted");
|
||||
ok(isAudioStarted(browser), "audio has started playing.");
|
||||
ok(tab.playingAudio, "tab is playing audio.");
|
||||
|
||||
@ -76,7 +76,7 @@ add_task(function* test_media_control() {
|
||||
Services.obs.notifyObservers(browser, "mediaControl", "mediaControlPaused");
|
||||
|
||||
info("- check whether audio stops playing -");
|
||||
yield promiseTabEvent(browser, "DOMAudioPlaybackStopped");
|
||||
await promiseTabEvent(browser, "DOMAudioPlaybackStopped");
|
||||
ok(!isAudioStarted(browser), "audio has stopped playing.");
|
||||
ok(!tab.playingAudio, "tab isn't playing audio.");
|
||||
|
||||
@ -84,7 +84,7 @@ add_task(function* test_media_control() {
|
||||
Services.obs.notifyObservers(browser, "mediaControl", "resumeMedia");
|
||||
|
||||
info("- check whether audio starts playing -");
|
||||
yield promiseTabEvent(browser, "DOMAudioPlaybackStarted");
|
||||
await promiseTabEvent(browser, "DOMAudioPlaybackStarted");
|
||||
ok(isAudioStarted(browser), "audio has started playing.");
|
||||
ok(tab.playingAudio, "tab is playing audio.");
|
||||
|
||||
@ -92,7 +92,7 @@ add_task(function* test_media_control() {
|
||||
Services.obs.notifyObservers(browser, "mediaControl", "mediaControlStopped");
|
||||
|
||||
info("- check whether audio stops playing -");
|
||||
yield promiseTabEvent(browser, "DOMAudioPlaybackStopped");
|
||||
await promiseTabEvent(browser, "DOMAudioPlaybackStopped");
|
||||
ok(!isAudioStarted(browser), "audio has stopped playing.");
|
||||
ok(!tab.playingAudio, "tab isn't playing audio.");
|
||||
|
||||
@ -100,16 +100,16 @@ add_task(function* test_media_control() {
|
||||
gBrowserApp.closeTab(tab);
|
||||
});
|
||||
|
||||
add_task(function* test_audio_focus() {
|
||||
add_task(async function test_audio_focus() {
|
||||
info("- open a new tab -");
|
||||
let tab = gBrowserApp.addTab(URL);
|
||||
let browser = tab.browser;
|
||||
|
||||
info("- wait for loading tab's content -");
|
||||
yield promiseBrowserEvent(browser, "load");
|
||||
await promiseBrowserEvent(browser, "load");
|
||||
|
||||
info("- check whether audio starts playing -");
|
||||
yield promiseTabEvent(browser, "DOMAudioPlaybackStarted");
|
||||
await promiseTabEvent(browser, "DOMAudioPlaybackStarted");
|
||||
ok(isAudioStarted(browser), "audio has started playing.");
|
||||
ok(tab.playingAudio, "tab is playing audio.");
|
||||
|
||||
@ -117,7 +117,7 @@ add_task(function* test_audio_focus() {
|
||||
Services.obs.notifyObservers(browser, "audioFocusChanged", "lostAudioFocusTransiently");
|
||||
|
||||
info("- check whether audio stops playing -");
|
||||
yield promiseTabEvent(browser, "DOMAudioPlaybackStopped");
|
||||
await promiseTabEvent(browser, "DOMAudioPlaybackStopped");
|
||||
ok(!isAudioStarted(browser), "audio has stopped playing.");
|
||||
ok(!tab.playingAudio, "tab isn't playing audio.");
|
||||
|
||||
@ -125,7 +125,7 @@ add_task(function* test_audio_focus() {
|
||||
Services.obs.notifyObservers(browser, "audioFocusChanged", "gainAudioFocus");
|
||||
|
||||
info("- check whether audio starts playing -");
|
||||
yield promiseTabEvent(browser, "DOMAudioPlaybackStarted");
|
||||
await promiseTabEvent(browser, "DOMAudioPlaybackStarted");
|
||||
ok(isAudioStarted(browser), "audio has started playing.");
|
||||
ok(tab.playingAudio, "tab is playing audio.");
|
||||
|
||||
@ -133,7 +133,7 @@ add_task(function* test_audio_focus() {
|
||||
Services.obs.notifyObservers(browser, "audioFocusChanged", "lostAudioFocus");
|
||||
|
||||
info("- check whether audio stops playing -");
|
||||
yield promiseTabEvent(browser, "DOMAudioPlaybackStopped");
|
||||
await promiseTabEvent(browser, "DOMAudioPlaybackStopped");
|
||||
ok(!isAudioStarted(browser), "audio has stopped playing.");
|
||||
ok(!tab.playingAudio, "tab isn't playing audio.");
|
||||
|
||||
|
@ -44,7 +44,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
|
||||
const kUniqueURI = Services.io.newURI("http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/video_controls.html");
|
||||
|
||||
add_task(function* test_offline() {
|
||||
add_task(async function test_offline() {
|
||||
// Tests always connect to localhost, and per bug 87717, localhost is now
|
||||
// reachable in offline mode. To avoid this, disable any proxy.
|
||||
proxyPrefValue = Services.prefs.getIntPref("network.proxy.type");
|
||||
@ -66,11 +66,11 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
});
|
||||
|
||||
// Go offline, expecting the error page.
|
||||
yield promiseOffline(true);
|
||||
await promiseOffline(true);
|
||||
|
||||
// Load our test web page
|
||||
browser.loadURI(kUniqueURI.spec, null, null);
|
||||
yield promiseBrowserEvent(browser, "DOMContentLoaded");
|
||||
await promiseBrowserEvent(browser, "DOMContentLoaded");
|
||||
|
||||
// This is an error page.
|
||||
is(browser.contentDocument.documentURI.substring(0, 27), "about:neterror?e=netOffline", "Document URI is the error page.");
|
||||
@ -81,13 +81,13 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
Services.prefs.setIntPref("network.proxy.type", proxyPrefValue);
|
||||
|
||||
// Go online and try to load the page again
|
||||
yield promiseOffline(false);
|
||||
await promiseOffline(false);
|
||||
|
||||
ok(browser.contentDocument.getElementById("errorTryAgain"), "The error page has got a #errorTryAgain element");
|
||||
|
||||
// Click "Try Again" button to start the page load
|
||||
browser.contentDocument.getElementById("errorTryAgain").click();
|
||||
yield promiseBrowserEvent(browser, "DOMContentLoaded");
|
||||
await promiseBrowserEvent(browser, "DOMContentLoaded");
|
||||
|
||||
// This is not an error page.
|
||||
is(browser.contentDocument.documentURI, kUniqueURI.spec, "Document URI is not the offline-error page, but the original URI.");
|
||||
|
@ -16,7 +16,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
add_task(function* test_reader_view_visibility() {
|
||||
add_task(async function test_reader_view_visibility() {
|
||||
let gWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let BrowserApp = gWin.BrowserApp;
|
||||
|
||||
@ -27,14 +27,14 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
|
||||
});
|
||||
|
||||
yield promiseBrowserEvent(browser, "load");
|
||||
await promiseBrowserEvent(browser, "load");
|
||||
|
||||
let doc = browser.contentDocument;
|
||||
let title = doc.querySelector(".reader-title");
|
||||
|
||||
// We need to wait for reader content to appear because AboutReader.jsm
|
||||
// asynchronously fetches the content after about:reader loads.
|
||||
yield promiseNotification("AboutReader:Ready");
|
||||
await promiseNotification("AboutReader:Ready");
|
||||
is(title.textContent, "Article title", "found expected content");
|
||||
});
|
||||
|
||||
|
@ -37,7 +37,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
let protocolHandler = Services.io
|
||||
.getProtocolHandler("resource")
|
||||
.QueryInterface(Ci.nsIResProtocolHandler);
|
||||
@ -45,7 +45,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
ok(protocolHandler.hasSubstitution("android"));
|
||||
|
||||
// This can be any file that we know exists in the root of every APK.
|
||||
let packageName = yield readChannel("resource://android/package-name.txt");
|
||||
let packageName = await readChannel("resource://android/package-name.txt");
|
||||
info(packageName);
|
||||
|
||||
// It's difficult to fish ANDROID_PACKAGE_NAME from JavaScript, so we test the
|
||||
|
@ -45,48 +45,48 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1216047
|
||||
|
||||
const kTestPage = "http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/basic_article.html";
|
||||
|
||||
add_task(function* test_selectOrAdd() {
|
||||
add_task(async function test_selectOrAdd() {
|
||||
// Add a new tab with a blank page
|
||||
tabBlank = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
|
||||
// Now, let's force the target tab to be added
|
||||
tabTest = BrowserApp.selectOrAddTab(kTestPage, { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
|
||||
// Check that basic_article is now selected
|
||||
is(BrowserApp.selectedBrowser, tabTest.browser, "Target tab is selected after being added.");
|
||||
|
||||
// Switch back to about:blank
|
||||
BrowserApp.selectTab(tabBlank);
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
|
||||
// Check that about:blank is selected
|
||||
is(BrowserApp.selectedTab, tabBlank, "about:blank is selected.");
|
||||
|
||||
// Use selectOrAddTab to select the existing tab
|
||||
BrowserApp.selectOrAddTab(kTestPage, { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
|
||||
// Check that basic_article is now selected
|
||||
is(BrowserApp.selectedTab, tabTest, "Target tab is selected.");
|
||||
|
||||
// Switch back to about:blank
|
||||
BrowserApp.selectTab(tabBlank);
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
|
||||
// Check that about:blank is selected
|
||||
is(BrowserApp.selectedTab, tabBlank, "about:blank is selected.");
|
||||
|
||||
// Use selectOrAddTab to select the existing tab using the startsWith flag
|
||||
BrowserApp.selectOrAddTab(kTestPage, { selected: true, parentId: BrowserApp.selectedTab.id }, { startsWith: kTestPage });
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
|
||||
// Check that basic_article is now selected
|
||||
is(BrowserApp.selectedTab, tabTest, "Target tab is selected.");
|
||||
|
||||
// Switch back to about:blank
|
||||
BrowserApp.selectTab(tabBlank);
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
|
||||
// Check that about:blank is selected
|
||||
is(BrowserApp.selectedTab, tabBlank, "about:blank is selected.");
|
||||
@ -100,7 +100,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1216047
|
||||
|
||||
// Use selectOrAddTab to select the existing tab
|
||||
BrowserApp.selectOrAddTab(kTestPage, { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
|
||||
// Check that basic_article is now selected
|
||||
is(BrowserApp.selectedTab, tabTest, "Target tab is selected.");
|
||||
|
@ -68,7 +68,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1343603
|
||||
// Outside of shutting down, clearing history will trigger an async delete
|
||||
// of the session files. To avoid any interference from that here, this test
|
||||
// therefore has to run first.
|
||||
add_task(function* test_sessionStoreClearFiles() {
|
||||
add_task(async function test_sessionStoreClearFiles() {
|
||||
// Temporarily set the session store to shutdown mode to test the
|
||||
// synchronous deletion code path.
|
||||
// This also means that nothing gets written to disk until explicitly
|
||||
@ -102,7 +102,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1343603
|
||||
let notification = promiseNotification("sessionstore-state-purge-complete");
|
||||
|
||||
BrowserApp.sanitize(sanitize);
|
||||
yield notification;
|
||||
await notification;
|
||||
|
||||
ok(!sessionFile.exists(), "session file was deleted");
|
||||
ok(!sessionFileBackup.exists(), "backup file was deleted");
|
||||
@ -113,19 +113,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1343603
|
||||
ss.setLoadState(STATE_RUNNING);
|
||||
});
|
||||
|
||||
add_task(function* test_sessionStoreClearTabHistory() {
|
||||
add_task(async function test_sessionStoreClearTabHistory() {
|
||||
// Add a new tab with some content
|
||||
tabTest = BrowserApp.addTab(url1, { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
|
||||
// Navigate to create some history
|
||||
tabTest.browser.loadURI(url2);
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
tabTest.browser.loadURI(url3);
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
is(tabTest.browser.canGoBack, true, "can go back");
|
||||
tabTest.browser.goBack();
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
|
||||
// Check that the session store has recorded this history
|
||||
let data = tabTest.browser.__SS_data;
|
||||
@ -138,7 +138,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1343603
|
||||
let notification = promiseNotification("sessionstore-state-purge-complete");
|
||||
|
||||
BrowserApp.sanitize(sanitize);
|
||||
yield notification;
|
||||
await notification;
|
||||
|
||||
// Only the current session history entry should remain
|
||||
data = tabTest.browser.__SS_data;
|
||||
@ -149,19 +149,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1343603
|
||||
cleanupTabs();
|
||||
});
|
||||
|
||||
add_task(function* test_sessionStoreClearZombieTabHistory() {
|
||||
add_task(async function test_sessionStoreClearZombieTabHistory() {
|
||||
// Add a new tab with some content
|
||||
tabTest = BrowserApp.addTab(url1, { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
|
||||
// Navigate to create some history
|
||||
tabTest.browser.loadURI(url2);
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
tabTest.browser.loadURI(url3);
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
is(tabTest.browser.canGoBack, true, "can go back");
|
||||
tabTest.browser.goBack();
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
|
||||
|
||||
// Check that the session store has recorded this history
|
||||
let data = tabTest.browser.__SS_data;
|
||||
@ -171,7 +171,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1343603
|
||||
|
||||
// Open a new tab and zombify the original one
|
||||
tabBlank = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabBlank, "Test tab is in background.");
|
||||
|
||||
// Zombify the backgrounded test tab
|
||||
@ -186,7 +186,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1343603
|
||||
let notification = promiseNotification("sessionstore-state-purge-complete");
|
||||
|
||||
BrowserApp.sanitize(sanitize);
|
||||
yield notification;
|
||||
await notification;
|
||||
|
||||
// Only the current session history entry should remain
|
||||
data = tabTest.browser.__SS_data;
|
||||
|
@ -81,7 +81,7 @@ function setup_browser() {
|
||||
* This test ensures that form data collection respects the privacy level as
|
||||
* set by the user.
|
||||
*/
|
||||
add_task(function* test_formdata() {
|
||||
add_task(async function test_formdata() {
|
||||
const URL = "http://example.org/chrome/mobile/android/tests/browser/chrome/session_formdata_sample.html";
|
||||
|
||||
const OUTER_VALUE = "browser_formdata_" + Math.random();
|
||||
@ -108,7 +108,7 @@ add_task(function* test_formdata() {
|
||||
});
|
||||
}
|
||||
|
||||
yield createAndRemoveTab();
|
||||
await createAndRemoveTab();
|
||||
let state = ss.getClosedTabs(gChromeWin);
|
||||
let [{formdata}] = state;
|
||||
is(formdata.id.txt, OUTER_VALUE, "outer value is correct");
|
||||
@ -117,7 +117,7 @@ add_task(function* test_formdata() {
|
||||
// Disable saving data for encrypted sites.
|
||||
Services.prefs.setIntPref("browser.sessionstore.privacy_level", 1);
|
||||
|
||||
yield createAndRemoveTab();
|
||||
await createAndRemoveTab();
|
||||
state = ss.getClosedTabs(gChromeWin);
|
||||
[{formdata}] = state;
|
||||
is(formdata.id.txt, OUTER_VALUE, "outer value is correct");
|
||||
@ -126,7 +126,7 @@ add_task(function* test_formdata() {
|
||||
// Disable saving data for any site.
|
||||
Services.prefs.setIntPref("browser.sessionstore.privacy_level", 2);
|
||||
|
||||
yield createAndRemoveTab();
|
||||
await createAndRemoveTab();
|
||||
state = ss.getClosedTabs(gChromeWin);
|
||||
[{formdata}] = state;
|
||||
ok(!formdata, "form data has *not* been stored");
|
||||
@ -138,7 +138,7 @@ add_task(function* test_formdata() {
|
||||
/**
|
||||
* This test ensures that form data collection restores correctly.
|
||||
*/
|
||||
add_task(function* test_formdata2() {
|
||||
add_task(async function test_formdata2() {
|
||||
const URL = "http://example.org/chrome/mobile/android/tests/browser/chrome/session_formdata_sample.html";
|
||||
|
||||
const OUTER_VALUE = "browser_formdata_" + Math.random();
|
||||
@ -164,7 +164,7 @@ add_task(function* test_formdata2() {
|
||||
});
|
||||
}
|
||||
|
||||
yield createAndRemoveTab();
|
||||
await createAndRemoveTab();
|
||||
let state = ss.getClosedTabs(gChromeWin);
|
||||
let [{formdata}] = state;
|
||||
is(formdata.id.txt, OUTER_VALUE, "outer value is correct");
|
||||
@ -173,7 +173,7 @@ add_task(function* test_formdata2() {
|
||||
// Restore the closed tab.
|
||||
let closedTabData = ss.getClosedTabs(gChromeWin)[0];
|
||||
let browser = ss.undoCloseTab(gChromeWin, closedTabData);
|
||||
yield promiseBrowserEvent(browser, "load", { resolveAtNextTick: true });
|
||||
await promiseBrowserEvent(browser, "load", { resolveAtNextTick: true });
|
||||
|
||||
// Check the form data.
|
||||
is(getInputValue(browser, {id: "txt"}), OUTER_VALUE, "outer value restored correctly");
|
||||
@ -187,7 +187,7 @@ add_task(function* test_formdata2() {
|
||||
* This test ensures that form data collection restores correctly even after
|
||||
* navigating to a different page and then returning via hitting back.
|
||||
*/
|
||||
add_task(function* test_formdata_navigation() {
|
||||
add_task(async function test_formdata_navigation() {
|
||||
const URL = "http://example.org/chrome/mobile/android/tests/browser/chrome/session_formdata_sample.html";
|
||||
const otherURL = "http://example.org/chrome/mobile/android/tests/browser/chrome/basic_article.html";
|
||||
|
||||
@ -244,7 +244,7 @@ add_task(function* test_formdata_navigation() {
|
||||
});
|
||||
}
|
||||
|
||||
yield createNavigateAndRemoveTab();
|
||||
await createNavigateAndRemoveTab();
|
||||
let state = ss.getClosedTabs(gChromeWin);
|
||||
let [{formdata}] = state;
|
||||
is(formdata.id.txt, OUTER_VALUE, "outer value is correct");
|
||||
@ -253,7 +253,7 @@ add_task(function* test_formdata_navigation() {
|
||||
// Restore the closed tab.
|
||||
let closedTabData = ss.getClosedTabs(gChromeWin)[0];
|
||||
let browser = ss.undoCloseTab(gChromeWin, closedTabData);
|
||||
yield promiseBrowserEvent(browser, "load", { resolveAtNextTick: true });
|
||||
await promiseBrowserEvent(browser, "load", { resolveAtNextTick: true });
|
||||
|
||||
// Check the form data.
|
||||
is(getInputValue(browser, {id: "txt"}), OUTER_VALUE, "outer value restored correctly");
|
||||
|
@ -51,60 +51,60 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1301160
|
||||
|
||||
const url = "data:text/html;charset=utf-8,It%20was%20a%20dark%20and%20stormy%20night.";
|
||||
|
||||
add_task(function* test_sessionStoreParentId() {
|
||||
add_task(async function test_sessionStoreParentId() {
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
cleanupTabs();
|
||||
});
|
||||
|
||||
// First, check that passing a parent tab ID works as expected
|
||||
tabParent = BrowserApp.addTab(url, { selected: true });
|
||||
yield promiseBrowserEvent(tabParent.browser, "DOMContentLoaded");
|
||||
await promiseBrowserEvent(tabParent.browser, "DOMContentLoaded");
|
||||
|
||||
// Open tabs without passing a parent tab ID
|
||||
tabChild1 = BrowserApp.addTab(url, { selected: false });
|
||||
tabChild2 = BrowserApp.addTab(url, { selected: true });
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabChild2, "2nd child tab is selected");
|
||||
|
||||
// After closing that tab, its neighbour should be selected
|
||||
BrowserApp.closeTab(tabChild2);
|
||||
tabChild2 = null;
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabChild1, "1st child tab is selected");
|
||||
|
||||
// Add a new tab and pass a parent tab ID this time
|
||||
tabChild2 = BrowserApp.addTab(url, { selected: true, parentId: tabParent.id });
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabChild2, "2nd child tab is selected");
|
||||
|
||||
// After closing that tab, its parent should be selected
|
||||
BrowserApp.closeTab(tabChild2);
|
||||
tabChild2 = null;
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabParent, "parent tab is selected");
|
||||
|
||||
// Reset selection and switch to the other child tab
|
||||
BrowserApp.selectTab(tabChild1);
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabChild1, "1st child tab is selected");
|
||||
|
||||
// Now check that this works even if the child tab is closed and subsequently restored
|
||||
tabChild2 = BrowserApp.addTab(url, { selected: false, parentId: tabParent.id });
|
||||
yield promiseTabEvent(tabChild2.browser, "SSTabDataUpdated");
|
||||
await promiseTabEvent(tabChild2.browser, "SSTabDataUpdated");
|
||||
BrowserApp.closeTab(tabChild2);
|
||||
yield promiseTabEvent(tabChild2.browser, "SSTabCloseProcessed");
|
||||
await promiseTabEvent(tabChild2.browser, "SSTabCloseProcessed");
|
||||
|
||||
// Restore the tab
|
||||
let closedTabData = ss.getClosedTabs(chromeWin)[0];
|
||||
let browser = ss.undoCloseTab(chromeWin, closedTabData);
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
tabChild2 = BrowserApp.getTabForBrowser(browser);
|
||||
is(BrowserApp.selectedTab, tabChild2, "restored 2nd child tab is selected");
|
||||
|
||||
// After closing that tab, its parent should be selected
|
||||
BrowserApp.closeTab(tabChild2);
|
||||
tabChild2 = null;
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabParent, "parent tab is selected after restoring");
|
||||
|
||||
cleanupTabs();
|
||||
|
@ -81,7 +81,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
|
||||
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||
|
||||
add_task(function* test_sessionStoreScrollPositionReaderMode() {
|
||||
add_task(async function test_sessionStoreScrollPositionReaderMode() {
|
||||
// Creates a tab, sets a scroll position and closes the tab.
|
||||
function createAndRemoveReaderTab() {
|
||||
return Task.spawn(function* () {
|
||||
@ -108,7 +108,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
|
||||
});
|
||||
}
|
||||
|
||||
yield createAndRemoveReaderTab();
|
||||
await createAndRemoveReaderTab();
|
||||
let state = ss.getClosedTabs(chromeWin);
|
||||
let [{scrolldata}] = state;
|
||||
is(scrolldata.scroll, SCROLL_STR_Y_ONLY, "stored scroll position is correct");
|
||||
@ -116,7 +116,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
|
||||
// Restore the closed tab.
|
||||
let closedTabData = ss.getClosedTabs(chromeWin)[0];
|
||||
let browser = ss.undoCloseTab(chromeWin, closedTabData);
|
||||
yield promiseBrowserEvent(browser, "AboutReaderContentReady");
|
||||
await promiseBrowserEvent(browser, "AboutReaderContentReady");
|
||||
|
||||
// Check the scroll position.
|
||||
let ifreq = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor);
|
||||
@ -130,7 +130,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
|
||||
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
|
||||
});
|
||||
|
||||
add_task(function* test_sessionStoreScrollPositionAndZoomLevel() {
|
||||
add_task(async function test_sessionStoreScrollPositionAndZoomLevel() {
|
||||
// Creates a tab, sets a scroll position and zoom level and closes the tab.
|
||||
function createAndRemoveTab() {
|
||||
return Task.spawn(function* () {
|
||||
@ -174,7 +174,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
|
||||
});
|
||||
}
|
||||
|
||||
yield createAndRemoveTab();
|
||||
await createAndRemoveTab();
|
||||
let state = ss.getClosedTabs(chromeWin);
|
||||
let [{scrolldata}] = state;
|
||||
is(scrolldata.scroll, SCROLL2_STR, "stored scroll position is correct");
|
||||
@ -185,8 +185,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
|
||||
let browser = ss.undoCloseTab(chromeWin, closedTabData);
|
||||
let pageshow = promiseBrowserEvent(browser, "pageshow");
|
||||
let scroll = promiseBrowserEvent(browser, "scroll");
|
||||
yield pageshow;
|
||||
yield scroll;
|
||||
await pageshow;
|
||||
await scroll;
|
||||
|
||||
// Check the scroll position and zoom level.
|
||||
let ifreq = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor);
|
||||
@ -204,8 +204,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
|
||||
pageshow = promiseBrowserEvent(browser, "pageshow");
|
||||
scroll = promiseBrowserEvent(browser, "scroll");
|
||||
browser.goBack();
|
||||
yield pageshow;
|
||||
yield scroll;
|
||||
await pageshow;
|
||||
await scroll;
|
||||
|
||||
utils.getResolution(zoom);
|
||||
utils.getScrollXY(false, scrollX, scrollY);
|
||||
@ -217,7 +217,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
|
||||
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
|
||||
});
|
||||
|
||||
add_task(function* test_sessionStoreZoomLevelRecalc() {
|
||||
add_task(async function test_sessionStoreZoomLevelRecalc() {
|
||||
// Creates a tab, sets a scroll position and zoom level and closes the tab.
|
||||
function createAndRemoveTab() {
|
||||
return Task.spawn(function* () {
|
||||
@ -247,7 +247,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
|
||||
});
|
||||
}
|
||||
|
||||
yield createAndRemoveTab();
|
||||
await createAndRemoveTab();
|
||||
let state = ss.getClosedTabs(chromeWin);
|
||||
let [{scrolldata}] = state;
|
||||
is(scrolldata.scroll, SCROLL_STR, "stored scroll position is correct");
|
||||
@ -262,7 +262,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
|
||||
|
||||
// Restore the closed tab.
|
||||
let browser = ss.undoCloseTab(chromeWin, closedTabData);
|
||||
yield promiseBrowserEvent(browser, "pageshow");
|
||||
await promiseBrowserEvent(browser, "pageshow");
|
||||
|
||||
// Check the scroll position and zoom level.
|
||||
let ifreq = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor);
|
||||
|
@ -45,14 +45,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1044556
|
||||
const url1 = "data:text/html;charset=utf-8,It%20was%20a%20dark%20and%20stormy%20night.";
|
||||
const url2 = "data:text/html;charset=utf-8,Suddenly%2C%20a%20tab%20was%20zombified.";
|
||||
|
||||
add_task(function* test_sessionStoreZombify() {
|
||||
add_task(async function test_sessionStoreZombify() {
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
cleanupTabs();
|
||||
});
|
||||
|
||||
// Add a new tab with some content
|
||||
tabTest = BrowserApp.addTab(url1, { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
|
||||
// Add a new tab with a blank page
|
||||
tabBlank = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
@ -66,19 +66,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1044556
|
||||
|
||||
// Switch back to the test tab and wait for it to reload
|
||||
BrowserApp.selectTab(tabTest);
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
|
||||
// Check that the test tab has loaded the correct url
|
||||
is(tabTest.browser.currentURI.spec, url1, "Test tab is showing the first URL.");
|
||||
|
||||
// Navigate to some other content
|
||||
BrowserApp.loadURI(url2, tabTest.browser);
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
is(tabTest.browser.currentURI.spec, url2, "Test tab is showing the second URL.");
|
||||
|
||||
// Switch to the other tab
|
||||
BrowserApp.selectTab(tabBlank);
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabBlank, "Test tab is in background.");
|
||||
|
||||
// Zombify the backgrounded test tab again
|
||||
@ -89,7 +89,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1044556
|
||||
|
||||
// Test that the tab's own function for unzombifying works as well
|
||||
tabTest.unzombify();
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
|
||||
// Check that the test tab has loaded the correct url
|
||||
is(tabTest.browser.currentURI.spec, url2, "Test tab is showing the second URL.");
|
||||
@ -97,7 +97,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1044556
|
||||
cleanupTabs();
|
||||
});
|
||||
|
||||
add_task(function* test_sessionStoreKeepAsZombie() {
|
||||
add_task(async function test_sessionStoreKeepAsZombie() {
|
||||
let observerService = Services.obs;
|
||||
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
@ -106,11 +106,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1044556
|
||||
|
||||
// Add a new tab with some content
|
||||
tabTest = BrowserApp.addTab(url1, { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
|
||||
// Add a new tab with a blank page
|
||||
tabBlank = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabBlank, "Test tab is in background.");
|
||||
|
||||
// Zombify the backgrounded test tab
|
||||
@ -125,18 +125,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1044556
|
||||
|
||||
// Switch back to the test tab and check that it remains zombified
|
||||
BrowserApp.selectTab(tabTest);
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabTest, "Test tab is selected.");
|
||||
ok(tabTest.browser.__SS_restore, "Test tab is still set for delay loading.");
|
||||
|
||||
// Switch to the other tab and back again
|
||||
BrowserApp.selectTab(tabBlank);
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabBlank, "Test tab is in background.");
|
||||
BrowserApp.selectTab(tabTest);
|
||||
|
||||
// "Tab:KeepZombified should be good for one TabSelect only
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
is(BrowserApp.selectedTab, tabTest, "Test tab is selected.");
|
||||
|
||||
// Check that the test tab is no longer a zombie and has loaded the correct url
|
||||
@ -145,7 +145,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1044556
|
||||
|
||||
// Zombify the test tab again
|
||||
BrowserApp.selectTab(tabBlank);
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabBlank, "Test tab is in background.");
|
||||
tabTest.zombify();
|
||||
ok(tabTest.browser.__SS_restore, "Test tab is set for delay loading.");
|
||||
@ -156,7 +156,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1044556
|
||||
|
||||
// Switch back to the test tab and check that it remains zombified
|
||||
BrowserApp.selectTab(tabTest);
|
||||
yield promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
await promiseTabEvent(BrowserApp.deck, "TabSelect");
|
||||
is(BrowserApp.selectedTab, tabTest, "Test tab is selected.");
|
||||
ok(tabTest.browser.__SS_restore, "Test tab is still set for delay loading.");
|
||||
|
||||
@ -164,7 +164,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1044556
|
||||
observerService.notifyObservers(null, "application-foreground");
|
||||
|
||||
// The test tab should now start reloading
|
||||
yield promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
|
||||
ok(!tabTest.browser.__SS_restore, "Test tab is no longer set for delay loading.");
|
||||
is(tabTest.browser.currentURI.spec, url1, "Test tab is showing the test URL.");
|
||||
|
||||
|
@ -73,7 +73,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
cleanupTabs();
|
||||
});
|
||||
|
||||
add_task(function* test_sysFontScaleScalesMobilePages() {
|
||||
add_task(async function test_sysFontScaleScalesMobilePages() {
|
||||
// Check that we're starting out with the default values
|
||||
is(sharedPrefs.getBoolPref(ANDROID_PREF), false, "System font size scaling is disabled");
|
||||
is(Services.prefs.getIntPref(GECKO_PREF_FONT_INFLATION), 0, "Gecko-side font inflation is disabled");
|
||||
@ -81,13 +81,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
// Check the system font scale factor and then enable it for testing
|
||||
is(getSystemFontScale(), 1.0, "system font scale is default");
|
||||
tab = BrowserApp.addTab(URL_mobile, { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
yield promiseBrowserEvent(tab.browser, "load");
|
||||
await promiseBrowserEvent(tab.browser, "load");
|
||||
is(tab.browser.markupDocumentViewer.effectiveTextZoom, 1.0,
|
||||
"text zoom is default value");
|
||||
|
||||
setSystemFontScale(2.0);
|
||||
tab.reloadWithMode(tab.desktopMode);
|
||||
yield promiseBrowserEvent(tab.browser, "load");
|
||||
await promiseBrowserEvent(tab.browser, "load");
|
||||
|
||||
is(getSystemFontScale(), 2.0, "system font scale is enabled");
|
||||
is(tab.browser.markupDocumentViewer.effectiveTextZoom, 2.0,
|
||||
@ -99,7 +99,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
is(getSystemFontScale(), 1.0, "system font scale is default");
|
||||
|
||||
tab.reloadWithMode(tab.desktopMode);
|
||||
yield promiseBrowserEvent(tab.browser, "load");
|
||||
await promiseBrowserEvent(tab.browser, "load");
|
||||
|
||||
is(tab.browser.markupDocumentViewer.effectiveTextZoom,
|
||||
1.0, "text zoom is back to default value");
|
||||
@ -108,14 +108,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
|
||||
// Now compare with a document that's been zoomed through CSS
|
||||
tab.browser.loadURI(URL_mobile_2x);
|
||||
yield promiseBrowserEvent(tab.browser, "load");
|
||||
await promiseBrowserEvent(tab.browser, "load");
|
||||
|
||||
let cssZoom = snapshotWindow(tab.browser.contentWindow);
|
||||
assertSnapshots(fontScaleOn, cssZoom, true, null, "fontScaleOn", "cssZoom");
|
||||
|
||||
// Load the original document and test normal text zooming
|
||||
tab.browser.loadURI(URL_mobile);
|
||||
yield promiseBrowserEvent(tab.browser, "load");
|
||||
await promiseBrowserEvent(tab.browser, "load");
|
||||
|
||||
tab.browser.textZoom = 2.0;
|
||||
is(tab.browser.markupDocumentViewer.effectiveTextZoom,
|
||||
@ -127,7 +127,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
cleanupTabs();
|
||||
});
|
||||
|
||||
add_task(function* test_fontInflationPrecedence() {
|
||||
add_task(async function test_fontInflationPrecedence() {
|
||||
// Check that we're starting out with the default values
|
||||
is(sharedPrefs.getBoolPref(ANDROID_PREF), false, "System font size scaling is disabled");
|
||||
is(Services.prefs.getIntPref(GECKO_PREF_FONT_INFLATION), 0, "Gecko-side font inflation is disabled");
|
||||
@ -135,7 +135,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
// Check the system font scale factor and then take a screenshot of this base state
|
||||
is(getSystemFontScale(), 1.0, "system font scale is default");
|
||||
tab = BrowserApp.addTab(URL_desktop, { selected: true, parentId: BrowserApp.selectedTab.id });
|
||||
yield promiseBrowserEvent(tab.browser, "load");
|
||||
await promiseBrowserEvent(tab.browser, "load");
|
||||
is(tab.browser.markupDocumentViewer.effectiveTextZoom,
|
||||
1.0, "text zoom is default value");
|
||||
|
||||
@ -145,7 +145,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
Services.prefs.setIntPref(GECKO_PREF_FONT_INFLATION, FONT_INFLATION_DEFAULT_VALUE);
|
||||
|
||||
tab.reloadWithMode(tab.desktopMode);
|
||||
yield promiseBrowserEvent(tab.browser, "load");
|
||||
await promiseBrowserEvent(tab.browser, "load");
|
||||
|
||||
let fontInflationOn = snapshotWindow(tab.browser.contentWindow);
|
||||
assertSnapshots(noZoom, fontInflationOn, false, null, "noZoom", "fontInflationOn");
|
||||
@ -153,7 +153,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
// Now enable the system font scale and make sure that this doesn't result in any visual change
|
||||
setSystemFontScale(2.0);
|
||||
tab.reloadWithMode(tab.desktopMode);
|
||||
yield promiseBrowserEvent(tab.browser, "load");
|
||||
await promiseBrowserEvent(tab.browser, "load");
|
||||
|
||||
is(getSystemFontScale(), 2.0, "system font scale is enabled");
|
||||
is(tab.browser.markupDocumentViewer.effectiveTextZoom,
|
||||
@ -164,7 +164,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
// Disable font inflation and check that system font scale zooming becomes active
|
||||
Services.prefs.setIntPref(GECKO_PREF_FONT_INFLATION, 0);
|
||||
tab.reloadWithMode(tab.desktopMode);
|
||||
yield promiseBrowserEvent(tab.browser, "load");
|
||||
await promiseBrowserEvent(tab.browser, "load");
|
||||
|
||||
is(tab.browser.markupDocumentViewer.effectiveTextZoom, 2.0,
|
||||
"text zoom set through system font scale zooming");
|
||||
@ -184,7 +184,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
// However as as long the test environment uses the default Android system font scale,
|
||||
// this won't impact other unrelated tests since we set "font.size.systemFontScale"
|
||||
// to 1.0 in that case, which already is the default value.
|
||||
add_task(function* test_androidPrefControlsFontInflation() {
|
||||
add_task(async function test_androidPrefControlsFontInflation() {
|
||||
// Check that we're starting out with the default values
|
||||
is(sharedPrefs.getBoolPref(ANDROID_PREF), false, "System font size scaling is disabled");
|
||||
is(Services.prefs.getIntPref(GECKO_PREF_FONT_INFLATION), 0, "Gecko-side font inflation is disabled");
|
||||
@ -196,7 +196,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
|
||||
try {
|
||||
sharedPrefs.setBoolPref(ANDROID_PREF, true);
|
||||
let result = yield observer.promise;
|
||||
let result = await observer.promise;
|
||||
|
||||
is(observer.count, 1, "Gecko pref should have changed only once");
|
||||
is(result.data, GECKO_PREF_FONT_INFLATION, "the correct pref has changed");
|
||||
@ -211,7 +211,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1328868
|
||||
|
||||
try {
|
||||
sharedPrefs.setBoolPref(ANDROID_PREF, false);
|
||||
let result = yield observer.promise;
|
||||
let result = await observer.promise;
|
||||
|
||||
is(observer.count, 1, "Gecko pref should have changed only once");
|
||||
is(result.data, GECKO_PREF_FONT_INFLATION, "the correct pref has changed");
|
||||
|
@ -20,7 +20,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
|
||||
let _observerId = 0;
|
||||
|
||||
add_task(function* test_get_set() {
|
||||
add_task(async function test_get_set() {
|
||||
let branch = SharedPreferences.forAndroid("test");
|
||||
|
||||
branch.setBoolPref("boolKey", true);
|
||||
@ -44,7 +44,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
is(typeof(branch.getIntPref("intKey")), "number");
|
||||
});
|
||||
|
||||
add_task(function* test_default() {
|
||||
add_task(async function test_default() {
|
||||
let branch = SharedPreferences.forAndroid();
|
||||
|
||||
branch.setBoolPref("boolKey", true);
|
||||
@ -68,7 +68,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
is(typeof(branch.getIntPref("intKey")), "number");
|
||||
});
|
||||
|
||||
add_task(function* test_multiple_branches() {
|
||||
add_task(async function test_multiple_branches() {
|
||||
let branch1 = SharedPreferences.forAndroid("test1");
|
||||
let branch2 = SharedPreferences.forAndroid("test2");
|
||||
|
||||
@ -85,7 +85,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
is(branch2.getCharPref("charKey"), "a different value");
|
||||
});
|
||||
|
||||
add_task(function* test_add_remove_observer() {
|
||||
add_task(async function test_add_remove_observer() {
|
||||
let branch = SharedPreferences.forAndroid("test");
|
||||
|
||||
branch.setBoolPref("boolKey", false);
|
||||
@ -98,7 +98,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
branch.setBoolPref("boolKey", true);
|
||||
is(branch.getBoolPref("boolKey"), true);
|
||||
|
||||
let value1 = yield obs1.promise;
|
||||
let value1 = await obs1.promise;
|
||||
is(obs1.count, 1);
|
||||
|
||||
is(value1.subject, obs1);
|
||||
@ -122,7 +122,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
branch.setBoolPref("boolKey", false);
|
||||
is(branch.getBoolPref("boolKey"), false);
|
||||
|
||||
let value2 = yield obs2.promise;
|
||||
let value2 = await obs2.promise;
|
||||
is(obs2.count, 1);
|
||||
|
||||
is(value2.subject, obs2);
|
||||
@ -137,7 +137,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
}
|
||||
});
|
||||
|
||||
add_task(function* test_observer_ignores() {
|
||||
add_task(async function test_observer_ignores() {
|
||||
let branch = SharedPreferences.forAndroid("test");
|
||||
|
||||
branch.setCharPref("charKey", "first value");
|
||||
@ -154,7 +154,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
branch.setIntPref("intKey", 4000);
|
||||
|
||||
branch.setCharPref("charKey", "a value");
|
||||
let value = yield obs.promise;
|
||||
let value = await obs.promise;
|
||||
|
||||
// Observer should have been notified exactly once.
|
||||
is(obs.count, 1);
|
||||
@ -168,7 +168,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
}
|
||||
});
|
||||
|
||||
add_task(function* test_observer_ignores_branches() {
|
||||
add_task(async function test_observer_ignores_branches() {
|
||||
let branch = SharedPreferences.forAndroid("test");
|
||||
|
||||
branch.setCharPref("charKey", "first value");
|
||||
@ -187,7 +187,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
// This should not be ignored.
|
||||
branch.setCharPref("charKey", "a value");
|
||||
|
||||
let value = yield obs.promise;
|
||||
let value = await obs.promise;
|
||||
|
||||
// Observer should have been notified exactly once.
|
||||
is(obs.count, 1);
|
||||
@ -201,7 +201,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
}
|
||||
});
|
||||
|
||||
add_task(function* test_scopes() {
|
||||
add_task(async function test_scopes() {
|
||||
let forApp = SharedPreferences.forApp();
|
||||
let forProfile = SharedPreferences.forProfile();
|
||||
let forProfileName = SharedPreferences.forProfileName("testProfile");
|
||||
|
@ -96,10 +96,10 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||
}
|
||||
]; // gTests
|
||||
|
||||
add_task(function* run_all() {
|
||||
add_task(async function run_all() {
|
||||
for (let test of gTests) {
|
||||
info("Running: " + test.desc);
|
||||
yield test.run();
|
||||
await test.run();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -152,12 +152,12 @@ function closeSelectionUI() {
|
||||
/**
|
||||
* Main test method.
|
||||
*/
|
||||
add_task(function* testAccessibleCarets() {
|
||||
add_task(async function testAccessibleCarets() {
|
||||
// Wait to start loading our test page until after the initial browser tab is
|
||||
// completely loaded. This allows each tab to complete its layer initialization,
|
||||
// importantly, its viewport and zoomContraints info.
|
||||
let BrowserApp = gChromeWin.BrowserApp;
|
||||
yield do_promiseTabChangeEvent(BrowserApp.selectedTab.id, TAB_STOP_EVENT);
|
||||
await do_promiseTabChangeEvent(BrowserApp.selectedTab.id, TAB_STOP_EVENT);
|
||||
|
||||
// Ensure Gecko Selection and Touch carets are enabled.
|
||||
Services.prefs.setBoolPref(ACCESSIBLECARET_PREF, true);
|
||||
@ -165,7 +165,7 @@ add_task(function* testAccessibleCarets() {
|
||||
// Load test page, wait for load completion, register cleanup.
|
||||
let browser = BrowserApp.addTab(BASE_TEST_URL).browser;
|
||||
let tab = BrowserApp.getTabForBrowser(browser);
|
||||
yield do_promiseTabChangeEvent(tab.id, TAB_STOP_EVENT);
|
||||
await do_promiseTabChangeEvent(tab.id, TAB_STOP_EVENT);
|
||||
|
||||
do_register_cleanup(function cleanup() {
|
||||
BrowserApp.closeTab(tab);
|
||||
@ -278,7 +278,7 @@ add_task(function* testAccessibleCarets() {
|
||||
/**
|
||||
* DesignMode test method.
|
||||
*/
|
||||
add_task(function* testAccessibleCarets_designMode() {
|
||||
add_task(async function testAccessibleCarets_designMode() {
|
||||
let BrowserApp = gChromeWin.BrowserApp;
|
||||
|
||||
// Pre-populate the clipboard to ensure PASTE action available.
|
||||
@ -288,7 +288,7 @@ add_task(function* testAccessibleCarets_designMode() {
|
||||
// Load test page, wait for load completion.
|
||||
let browser = BrowserApp.addTab(DESIGNMODE_TEST_URL).browser;
|
||||
let tab = BrowserApp.getTabForBrowser(browser, { selected: true });
|
||||
yield do_promiseTabChangeEvent(tab.id, TAB_STOP_EVENT);
|
||||
await do_promiseTabChangeEvent(tab.id, TAB_STOP_EVENT);
|
||||
|
||||
// References to test document elements, ActionBarHandler.
|
||||
let doc = browser.contentDocument;
|
||||
|
@ -63,26 +63,26 @@ function assertSelection(document, expectedSelection = false, expectedAnchorText
|
||||
}
|
||||
}
|
||||
|
||||
add_task(function* testFindInPage() {
|
||||
let browser = yield openTabWithUrl(TEST_URL);
|
||||
add_task(async function testFindInPage() {
|
||||
let browser = await openTabWithUrl(TEST_URL);
|
||||
let document = browser.contentDocument;
|
||||
|
||||
yield findInPage(browser, "Robocoop", 1);
|
||||
await findInPage(browser, "Robocoop", 1);
|
||||
assertSelection(document);
|
||||
|
||||
yield closeFindInPage(browser);
|
||||
await closeFindInPage(browser);
|
||||
assertSelection(document);
|
||||
|
||||
yield findInPage(browser, "Robocop", 1);
|
||||
await findInPage(browser, "Robocop", 1);
|
||||
assertSelection(document, "Robocop", " Robocop 1 ");
|
||||
|
||||
yield closeFindInPage(browser);
|
||||
await closeFindInPage(browser);
|
||||
assertSelection(document);
|
||||
|
||||
yield findInPage(browser, "Robocop", 3);
|
||||
await findInPage(browser, "Robocop", 3);
|
||||
assertSelection(document, "Robocop", " Robocop 3 ");
|
||||
|
||||
yield closeFindInPage(browser);
|
||||
await closeFindInPage(browser);
|
||||
assertSelection(document);
|
||||
});
|
||||
|
||||
|
@ -83,14 +83,14 @@ add_test(function setup_browser() {
|
||||
}, {capture: true, once: true});
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
// Wait for any initial page loads to be saved to history
|
||||
yield sleep(PENDING_VISIT_WAIT);
|
||||
await sleep(PENDING_VISIT_WAIT);
|
||||
|
||||
// Load a simple HTML page with no redirects
|
||||
gVisitURLs = [];
|
||||
yield promiseLoadEvent(gBrowser, "http://example.org/tests/robocop/robocop_blank_01.html");
|
||||
yield sleep(PENDING_VISIT_WAIT_LONG);
|
||||
await promiseLoadEvent(gBrowser, "http://example.org/tests/robocop/robocop_blank_01.html");
|
||||
await sleep(PENDING_VISIT_WAIT_LONG);
|
||||
|
||||
do_print("visit counts: " + gVisitURLs.length);
|
||||
ok(gVisitURLs.length == 1, "Simple visit makes 1 history item");
|
||||
@ -100,8 +100,8 @@ add_task(function* () {
|
||||
|
||||
// Load a simple HTML page via a 301 temporary redirect
|
||||
gVisitURLs = [];
|
||||
yield promiseLoadEvent(gBrowser, "http://example.org/tests/robocop/simple_redirect.sjs?http://example.org/tests/robocop/robocop_blank_02.html");
|
||||
yield sleep(PENDING_VISIT_WAIT);
|
||||
await promiseLoadEvent(gBrowser, "http://example.org/tests/robocop/simple_redirect.sjs?http://example.org/tests/robocop/robocop_blank_02.html");
|
||||
await sleep(PENDING_VISIT_WAIT);
|
||||
|
||||
do_print("visit counts: " + gVisitURLs.length);
|
||||
ok(gVisitURLs.length == 1, "Simple 301 redirect makes 1 history item");
|
||||
@ -111,8 +111,8 @@ add_task(function* () {
|
||||
|
||||
// Load a simple HTML page via a JavaScript redirect
|
||||
gVisitURLs = [];
|
||||
yield promiseLoadEvent(gBrowser, "http://example.org/tests/robocop/javascript_redirect.sjs?http://example.org/tests/robocop/robocop_blank_03.html");
|
||||
yield sleep(PENDING_VISIT_WAIT);
|
||||
await promiseLoadEvent(gBrowser, "http://example.org/tests/robocop/javascript_redirect.sjs?http://example.org/tests/robocop/robocop_blank_03.html");
|
||||
await sleep(PENDING_VISIT_WAIT);
|
||||
|
||||
do_print("visit counts: " + gVisitURLs.length);
|
||||
ok(gVisitURLs.length == 2, "JavaScript redirect makes 2 history items");
|
||||
|
@ -38,14 +38,14 @@ var TEST_PAGES = [
|
||||
},
|
||||
];
|
||||
|
||||
add_task(function* test_article_not_found() {
|
||||
let article = yield ReaderMode.getArticleFromCache(TEST_PAGES[0].url);
|
||||
add_task(async function test_article_not_found() {
|
||||
let article = await ReaderMode.getArticleFromCache(TEST_PAGES[0].url);
|
||||
do_check_eq(article, null);
|
||||
});
|
||||
|
||||
add_task(function* test_store_article() {
|
||||
add_task(async function test_store_article() {
|
||||
// Create an article object to store in the cache.
|
||||
yield ReaderMode.storeArticleInCache({
|
||||
await ReaderMode.storeArticleInCache({
|
||||
url: TEST_PAGES[0].url,
|
||||
content: "Lorem ipsum",
|
||||
title: TEST_PAGES[0].expected.title,
|
||||
@ -53,26 +53,26 @@ add_task(function* test_store_article() {
|
||||
excerpt: TEST_PAGES[0].expected.excerpt,
|
||||
});
|
||||
|
||||
let article = yield ReaderMode.getArticleFromCache(TEST_PAGES[0].url);
|
||||
let article = await ReaderMode.getArticleFromCache(TEST_PAGES[0].url);
|
||||
checkArticle(article, TEST_PAGES[0]);
|
||||
});
|
||||
|
||||
add_task(function* test_remove_article() {
|
||||
yield ReaderMode.removeArticleFromCache(TEST_PAGES[0].url);
|
||||
let article = yield ReaderMode.getArticleFromCache(TEST_PAGES[0].url);
|
||||
add_task(async function test_remove_article() {
|
||||
await ReaderMode.removeArticleFromCache(TEST_PAGES[0].url);
|
||||
let article = await ReaderMode.getArticleFromCache(TEST_PAGES[0].url);
|
||||
do_check_eq(article, null);
|
||||
});
|
||||
|
||||
add_task(function* test_parse_articles() {
|
||||
add_task(async function test_parse_articles() {
|
||||
for (let testcase of TEST_PAGES) {
|
||||
let article = yield ReaderMode.downloadAndParseDocument(testcase.url);
|
||||
let article = await ReaderMode.downloadAndParseDocument(testcase.url);
|
||||
checkArticle(article, testcase);
|
||||
}
|
||||
});
|
||||
|
||||
add_task(function* test_migrate_cache() {
|
||||
add_task(async function test_migrate_cache() {
|
||||
// Store an article in the old indexedDB reader mode cache.
|
||||
let cacheDB = yield new Promise((resolve, reject) => {
|
||||
let cacheDB = await new Promise((resolve, reject) => {
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let request = win.indexedDB.open("about:reader", 1);
|
||||
request.onerror = event => reject(request.error);
|
||||
@ -86,7 +86,7 @@ add_task(function* test_migrate_cache() {
|
||||
request.onsuccess = event => resolve(event.target.result);
|
||||
});
|
||||
|
||||
yield new Promise((resolve, reject) => {
|
||||
await new Promise((resolve, reject) => {
|
||||
let transaction = cacheDB.transaction(["articles"], "readwrite");
|
||||
let store = transaction.objectStore("articles");
|
||||
|
||||
@ -102,10 +102,10 @@ add_task(function* test_migrate_cache() {
|
||||
});
|
||||
|
||||
// Migrate the cache.
|
||||
yield Reader.migrateCache();
|
||||
await Reader.migrateCache();
|
||||
|
||||
// Check to make sure the article made it into the new cache.
|
||||
let article = yield ReaderMode.getArticleFromCache(TEST_PAGES[0].url);
|
||||
let article = await ReaderMode.getArticleFromCache(TEST_PAGES[0].url);
|
||||
checkArticle(article, TEST_PAGES[0]);
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "RuntimePermissions", "resource://gre/modules/RuntimePermissions.jsm");
|
||||
|
||||
add_task(function* test_snackbar_api() {
|
||||
add_task(async function test_snackbar_api() {
|
||||
RuntimePermissions.waitForPermissions([
|
||||
RuntimePermissions.CAMERA,
|
||||
RuntimePermissions.RECORD_AUDIO,
|
||||
|
@ -10,7 +10,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "EventDispatcher", "resource://gre/modules/Messaging.jsm");
|
||||
|
||||
add_task(function* test_snackbar_api() {
|
||||
add_task(async function test_snackbar_api() {
|
||||
Snackbars.show("This is a Snackbar", Snackbars.LENGTH_INDEFINITE, {
|
||||
action: {
|
||||
label: "Click me",
|
||||
@ -18,7 +18,7 @@ add_task(function* test_snackbar_api() {
|
||||
}
|
||||
});
|
||||
|
||||
yield EventDispatcher.instance.sendRequestForResult({
|
||||
await EventDispatcher.instance.sendRequestForResult({
|
||||
type: "Robocop:WaitOnUI"
|
||||
});
|
||||
});
|
||||
|
@ -87,10 +87,10 @@ var BrowserApp = Services.wm.getMostRecentWindow("navigator:browser").BrowserApp
|
||||
|
||||
// Tests the tracking protection UI in private browsing. By default, tracking protection is
|
||||
// enabled in private browsing ("privacy.trackingprotection.pbmode.enabled").
|
||||
add_task(function* test_tracking_pb() {
|
||||
add_task(async function test_tracking_pb() {
|
||||
// Load a blank page
|
||||
let browser = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id, isPrivate: true }).browser;
|
||||
yield new Promise((resolve, reject) => {
|
||||
await new Promise((resolve, reject) => {
|
||||
browser.addEventListener("load", function(event) {
|
||||
Services.tm.dispatchToMainThread(resolve);
|
||||
}, {capture: true, once: true});
|
||||
@ -98,19 +98,19 @@ add_task(function* test_tracking_pb() {
|
||||
|
||||
// Populate and use 'test-track-simple' for tracking protection lookups
|
||||
Services.prefs.setCharPref(TABLE, "test-track-simple");
|
||||
yield doUpdate();
|
||||
await doUpdate();
|
||||
|
||||
// Point tab to a test page NOT containing tracking elements
|
||||
yield promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_good.html");
|
||||
await promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_good.html");
|
||||
EventDispatcher.instance.sendRequest({ type: "Test:Expected", expected: "unknown" });
|
||||
|
||||
// Point tab to a test page containing tracking elements
|
||||
yield promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_bad.html");
|
||||
await promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_bad.html");
|
||||
EventDispatcher.instance.sendRequest({ type: "Test:Expected", expected: "tracking_content_blocked" });
|
||||
|
||||
// Simulate a click on the "Disable protection" button in the site identity popup.
|
||||
// We need to wait for a "load" event because "Session:Reload" will cause a full page reload.
|
||||
yield promiseLoadEvent(browser, undefined, undefined, () => {
|
||||
await promiseLoadEvent(browser, undefined, undefined, () => {
|
||||
EventDispatcher.instance.dispatch("Session:Reload", {
|
||||
allowContent: true,
|
||||
contentType: "tracking",
|
||||
@ -119,7 +119,7 @@ add_task(function* test_tracking_pb() {
|
||||
EventDispatcher.instance.sendRequest({ type: "Test:Expected", expected: "tracking_content_loaded" });
|
||||
|
||||
// Simulate a click on the "Enable protection" button in the site identity popup.
|
||||
yield promiseLoadEvent(browser, undefined, undefined, () => {
|
||||
await promiseLoadEvent(browser, undefined, undefined, () => {
|
||||
EventDispatcher.instance.dispatch("Session:Reload", {
|
||||
allowContent: false,
|
||||
contentType: "tracking",
|
||||
@ -131,39 +131,39 @@ add_task(function* test_tracking_pb() {
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.pbmode.enabled", false);
|
||||
|
||||
// Point tab to a test page containing tracking elements
|
||||
yield promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_bad.html");
|
||||
await promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_bad.html");
|
||||
EventDispatcher.instance.sendRequest({ type: "Test:Expected", expected: "unknown" });
|
||||
|
||||
// Point tab to a test page NOT containing tracking elements
|
||||
yield promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_good.html");
|
||||
await promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_good.html");
|
||||
EventDispatcher.instance.sendRequest({ type: "Test:Expected", expected: "unknown" });
|
||||
|
||||
// Reset the pref before the next testcase
|
||||
Services.prefs.clearUserPref("privacy.trackingprotection.pbmode.enabled");
|
||||
});
|
||||
|
||||
add_task(function* test_tracking_not_pb() {
|
||||
add_task(async function test_tracking_not_pb() {
|
||||
// Load a blank page
|
||||
let browser = BrowserApp.addTab("about:blank", { selected: true }).browser;
|
||||
yield new Promise((resolve, reject) => {
|
||||
await new Promise((resolve, reject) => {
|
||||
browser.addEventListener("load", function(event) {
|
||||
Services.tm.dispatchToMainThread(resolve);
|
||||
}, {capture: true, once: true});
|
||||
});
|
||||
|
||||
// Point tab to a test page NOT containing tracking elements
|
||||
yield promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_good.html");
|
||||
await promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_good.html");
|
||||
EventDispatcher.instance.sendRequest({ type: "Test:Expected", expected: "unknown" });
|
||||
|
||||
// Point tab to a test page containing tracking elements (tracking protection UI *should not* be shown)
|
||||
yield promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_bad.html");
|
||||
await promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_bad.html");
|
||||
EventDispatcher.instance.sendRequest({ type: "Test:Expected", expected: "unknown" });
|
||||
|
||||
// Enable tracking protection in normal tabs
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);
|
||||
|
||||
// Point tab to a test page containing tracking elements (tracking protection UI *should* be shown)
|
||||
yield promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_bad.html");
|
||||
await promiseLoadEvent(browser, "http://tracking.example.org/tests/robocop/tracking_bad.html");
|
||||
EventDispatcher.instance.sendRequest({ type: "Test:Expected", expected: "tracking_content_blocked" });
|
||||
});
|
||||
|
||||
|
@ -15,18 +15,18 @@
|
||||
|
||||
// Check that we can 'add_task' a few times and all tasks run asynchronously before test finishes.
|
||||
|
||||
add_task(function* () {
|
||||
var x = yield Promise.resolve(1);
|
||||
add_task(async function() {
|
||||
var x = await Promise.resolve(1);
|
||||
is(x, 1, "task yields Promise value as expected");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
var x = yield [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)];
|
||||
add_task(async function() {
|
||||
var x = await [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)];
|
||||
is(x.join(""), "123", "task yields Promise value as expected");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
var x = yield (function* () {
|
||||
add_task(async function() {
|
||||
var x = await (function* () {
|
||||
return 3;
|
||||
}());
|
||||
is(x, 3, "task yields generator function return value as expected");
|
||||
|
@ -15,18 +15,18 @@
|
||||
|
||||
// Check that we can 'add_task' a few times and all tasks run asynchronously before test finishes.
|
||||
|
||||
add_task(function* () {
|
||||
var x = yield Promise.resolve(1);
|
||||
add_task(async function() {
|
||||
var x = await Promise.resolve(1);
|
||||
is(x, 1, "task yields Promise value as expected");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
var x = yield [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)];
|
||||
add_task(async function() {
|
||||
var x = await [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)];
|
||||
is(x.join(""), "123", "task yields Promise value as expected");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
var x = yield (function* () {
|
||||
add_task(async function() {
|
||||
var x = await (function* () {
|
||||
return 3;
|
||||
}());
|
||||
is(x, 3, "task yields generator function return value as expected");
|
||||
|
@ -23,7 +23,7 @@
|
||||
const WIN_URL =
|
||||
"http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest/file_redirect_data_uri.html";
|
||||
|
||||
add_task(function* test_webRequest_redirect_data_uri() {
|
||||
add_task(async function test_webRequest_redirect_data_uri() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
permissions: [
|
||||
@ -71,11 +71,11 @@ add_task(function* test_webRequest_redirect_data_uri() {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
let win = window.open(WIN_URL);
|
||||
yield extension.awaitMessage("finished");
|
||||
await extension.awaitMessage("finished");
|
||||
win.close();
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* test_webRequest_upgrade() {
|
||||
add_task(async function test_webRequest_upgrade() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
permissions: [
|
||||
@ -46,14 +46,14 @@ add_task(function* test_webRequest_upgrade() {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
let win = window.open("http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest/file_mixed.html");
|
||||
yield extension.awaitMessage("finished");
|
||||
await extension.awaitMessage("finished");
|
||||
win.close();
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
});
|
||||
|
||||
add_task(function* test_webRequest_redirect_wins() {
|
||||
add_task(async function test_webRequest_redirect_wins() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
permissions: [
|
||||
@ -78,11 +78,11 @@ add_task(function* test_webRequest_redirect_wins() {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
let win = window.open("http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest/file_mixed.html");
|
||||
yield extension.awaitMessage("finished");
|
||||
await extension.awaitMessage("finished");
|
||||
win.close();
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -4,7 +4,7 @@ ChromeUtils.import("resource://normandy/lib/SandboxManager.jsm");
|
||||
|
||||
// wrapAsync should wrap privileged Promises with Promises that are usable by
|
||||
// the sandbox.
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
const manager = new SandboxManager();
|
||||
manager.addHold("testing");
|
||||
|
||||
@ -25,7 +25,7 @@ add_task(function* () {
|
||||
manager.addGlobal("ok", ok);
|
||||
manager.addGlobal("equal", equal);
|
||||
|
||||
const sandboxResult = yield new Promise(resolve => {
|
||||
const sandboxResult = await new Promise(resolve => {
|
||||
manager.addGlobal("resolve", result => resolve(result));
|
||||
manager.evalInSandbox(`
|
||||
// Unwrapped privileged promises are not accessible in the sandbox
|
||||
@ -45,7 +45,7 @@ add_task(function* () {
|
||||
});
|
||||
equal(sandboxResult, "wrapped", "wrapAsync methods return Promises that work in the sandbox");
|
||||
|
||||
yield manager.evalInSandbox(`
|
||||
await manager.evalInSandbox(`
|
||||
(async function sandboxTest() {
|
||||
equal(
|
||||
await driver.wrappedThis(),
|
||||
@ -59,7 +59,7 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
// wrapAsync cloning options
|
||||
add_task(function* () {
|
||||
add_task(async function() {
|
||||
const manager = new SandboxManager();
|
||||
manager.addHold("testing");
|
||||
|
||||
@ -80,7 +80,7 @@ add_task(function* () {
|
||||
manager.addGlobal("ok", ok);
|
||||
manager.addGlobal("deepEqual", deepEqual);
|
||||
|
||||
yield new Promise(resolve => {
|
||||
await new Promise(resolve => {
|
||||
manager.addGlobal("resolve", resolve);
|
||||
manager.evalInSandbox(`
|
||||
(async function() {
|
||||
|
@ -585,7 +585,7 @@ add_task(async function log_template_literal_message() {
|
||||
* Check that we format JS Errors reasonably.
|
||||
* This needs to stay a generator to exercise Task.jsm's stack rewriting.
|
||||
*/
|
||||
add_task(function* format_errors() {
|
||||
add_task(async function format_errors() {
|
||||
let pFormat = new Log.ParameterFormatter();
|
||||
|
||||
// Test that subclasses of Error are recognized as errors.
|
||||
@ -597,7 +597,7 @@ add_task(function* format_errors() {
|
||||
|
||||
// Test that JS-generated Errors are recognized and formatted.
|
||||
try {
|
||||
yield Promise.resolve(); // Scrambles the stack
|
||||
await Promise.resolve(); // Scrambles the stack
|
||||
// eslint-disable-next-line no-eval
|
||||
eval("javascript syntax error");
|
||||
} catch (e) {
|
||||
|
@ -97,10 +97,10 @@ add_task(async function test_snapshot() {
|
||||
webNavigation.close();
|
||||
});
|
||||
|
||||
add_task(function* test_snapshot_widget_layers() {
|
||||
add_task(async function test_snapshot_widget_layers() {
|
||||
let windowlessBrowser = Services.appShell.createWindowlessBrowser(false);
|
||||
let webNavigation = windowlessBrowser.QueryInterface(Ci.nsIWebNavigation);
|
||||
let contentWindow = yield loadContentWindow(webNavigation, HEADLESS_URL);
|
||||
let contentWindow = await loadContentWindow(webNavigation, HEADLESS_URL);
|
||||
const contentWidth = 1;
|
||||
const contentHeight = 2;
|
||||
// Verify dimensions.
|
||||
|
Loading…
Reference in New Issue
Block a user