mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1353542 - smaller script-generated patch converting remaining generators that are likely tasks (actual generators were identified by hand and whitelisted), r=Mossop.
This commit is contained in:
parent
5e3539e504
commit
16530fa1e3
@ -17,13 +17,13 @@ let testCasesForBothSuccessAndAbort = [
|
||||
* The captive portal notification should be shown when the window is
|
||||
* opened, and closed automatically when the success event is fired.
|
||||
*/
|
||||
function* test_detectedWithNoBrowserWindow_Open(aSuccess) {
|
||||
yield portalDetected();
|
||||
let win = yield focusWindowAndWaitForPortalUI();
|
||||
yield freePortal(aSuccess);
|
||||
async function test_detectedWithNoBrowserWindow_Open(aSuccess) {
|
||||
await portalDetected();
|
||||
let win = await focusWindowAndWaitForPortalUI();
|
||||
await freePortal(aSuccess);
|
||||
ensureNoPortalTab(win);
|
||||
ensureNoPortalNotification(win);
|
||||
yield closeWindowAndWaitForXulWindowVisible(win);
|
||||
await closeWindowAndWaitForXulWindowVisible(win);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -70,13 +70,13 @@ let testCasesForBothSuccessAndAbort = [
|
||||
* The captive portal notification should be shown when the window is
|
||||
* opened, and closed automatically when the success event is fired.
|
||||
*/
|
||||
function* test_detectedWithNoBrowserWindow_LongRecheck(aSuccess) {
|
||||
yield portalDetected();
|
||||
let win = yield focusWindowAndWaitForPortalUI(true);
|
||||
yield freePortal(aSuccess);
|
||||
async function test_detectedWithNoBrowserWindow_LongRecheck(aSuccess) {
|
||||
await portalDetected();
|
||||
let win = await focusWindowAndWaitForPortalUI(true);
|
||||
await freePortal(aSuccess);
|
||||
ensureNoPortalTab(win);
|
||||
ensureNoPortalNotification(win);
|
||||
yield closeWindowAndWaitForXulWindowVisible(win);
|
||||
await closeWindowAndWaitForXulWindowVisible(win);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -101,19 +101,19 @@ let testCasesForBothSuccessAndAbort = [
|
||||
* A portal is detected when a browser window has focus. No portal tab should
|
||||
* be opened. A notification bar should be displayed in all browser windows.
|
||||
*/
|
||||
function* test_detectedWithFocus(aSuccess) {
|
||||
let win1 = yield openWindowAndWaitForFocus();
|
||||
let win2 = yield openWindowAndWaitForFocus();
|
||||
yield portalDetected();
|
||||
async function test_detectedWithFocus(aSuccess) {
|
||||
let win1 = await openWindowAndWaitForFocus();
|
||||
let win2 = await openWindowAndWaitForFocus();
|
||||
await portalDetected();
|
||||
ensureNoPortalTab(win1);
|
||||
ensureNoPortalTab(win2);
|
||||
ensurePortalNotification(win1);
|
||||
ensurePortalNotification(win2);
|
||||
yield freePortal(aSuccess);
|
||||
await freePortal(aSuccess);
|
||||
ensureNoPortalNotification(win1);
|
||||
ensureNoPortalNotification(win2);
|
||||
yield closeWindowAndWaitForXulWindowVisible(win2);
|
||||
yield closeWindowAndWaitForXulWindowVisible(win1);
|
||||
await closeWindowAndWaitForXulWindowVisible(win2);
|
||||
await closeWindowAndWaitForXulWindowVisible(win1);
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -42,10 +42,10 @@ let testcases = [
|
||||
}
|
||||
|
||||
let button = notification.querySelector("button.notification-button");
|
||||
function* clickButtonAndExpectNewPortalTab() {
|
||||
async function clickButtonAndExpectNewPortalTab() {
|
||||
let p = BrowserTestUtils.waitForNewTab(win.gBrowser, CANONICAL_URL);
|
||||
button.click();
|
||||
let tab = yield p;
|
||||
let tab = await p;
|
||||
is(win.gBrowser.selectedTab, tab, "The captive portal tab should be selected.");
|
||||
return tab;
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ const CANONICAL_URL = "data:text/plain;charset=utf-8," + CANONICAL_CONTENT;
|
||||
const CANONICAL_URL_REDIRECTED = "data:text/plain;charset=utf-8,redirected";
|
||||
const PORTAL_NOTIFICATION_VALUE = "captive-portal-detected";
|
||||
|
||||
function* setupPrefsAndRecentWindowBehavior() {
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
async function setupPrefsAndRecentWindowBehavior() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["captivedetect.canonicalURL", CANONICAL_URL],
|
||||
["captivedetect.canonicalContent", CANONICAL_CONTENT]],
|
||||
});
|
||||
|
@ -43,7 +43,7 @@ function fakeTelemetryNow(...args) {
|
||||
return date;
|
||||
}
|
||||
|
||||
function* setupPingArchive() {
|
||||
async function setupPingArchive() {
|
||||
let scope = {};
|
||||
Cu.import("resource://gre/modules/TelemetryController.jsm", scope);
|
||||
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
|
||||
@ -51,7 +51,7 @@ function* setupPingArchive() {
|
||||
|
||||
for (let p of scope.TEST_PINGS) {
|
||||
fakeTelemetryNow(p.date);
|
||||
p.id = yield scope.TelemetryController.submitExternalPing(p.type, p.payload);
|
||||
p.id = await scope.TelemetryController.submitExternalPing(p.type, p.payload);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,10 +109,10 @@ function leave_icon(icon) {
|
||||
disable_non_test_mouse(false);
|
||||
}
|
||||
|
||||
function* test_tooltip(icon, expectedTooltip, isActiveTab) {
|
||||
async function test_tooltip(icon, expectedTooltip, isActiveTab) {
|
||||
let tooltip = document.getElementById("tabbrowser-tab-tooltip");
|
||||
|
||||
yield hover_icon(icon, tooltip);
|
||||
await hover_icon(icon, tooltip);
|
||||
if (isActiveTab) {
|
||||
// The active tab should have the keybinding shortcut in the tooltip.
|
||||
// We check this by ensuring that the strings are not equal but the expected
|
||||
@ -147,14 +147,14 @@ function get_wait_for_mute_promise(tab, expectMuted) {
|
||||
});
|
||||
}
|
||||
|
||||
function* test_mute_tab(tab, icon, expectMuted) {
|
||||
async function test_mute_tab(tab, icon, expectMuted) {
|
||||
let mutedPromise = test_mute_keybinding(tab, expectMuted);
|
||||
|
||||
let activeTab = gBrowser.selectedTab;
|
||||
|
||||
let tooltip = document.getElementById("tabbrowser-tab-tooltip");
|
||||
|
||||
yield hover_icon(icon, tooltip);
|
||||
await hover_icon(icon, tooltip);
|
||||
EventUtils.synthesizeMouseAtCenter(icon, {button: 0});
|
||||
leave_icon(icon);
|
||||
|
||||
@ -162,9 +162,9 @@ function* test_mute_tab(tab, icon, expectMuted) {
|
||||
|
||||
// If the audio is playing, we should check whether clicking on icon affects
|
||||
// the media element's playing state.
|
||||
let isAudioPlaying = yield is_audio_playing(tab);
|
||||
let isAudioPlaying = await is_audio_playing(tab);
|
||||
if (isAudioPlaying) {
|
||||
yield wait_for_tab_playing_event(tab, !expectMuted);
|
||||
await wait_for_tab_playing_event(tab, !expectMuted);
|
||||
}
|
||||
|
||||
return mutedPromise;
|
||||
@ -210,53 +210,53 @@ async function test_muting_using_menu(tab, expectMuted) {
|
||||
await mutedPromise;
|
||||
}
|
||||
|
||||
function* test_playing_icon_on_tab(tab, browser, isPinned) {
|
||||
async function test_playing_icon_on_tab(tab, browser, isPinned) {
|
||||
let icon = document.getAnonymousElementByAttribute(tab, "anonid",
|
||||
isPinned ? "overlay-icon" : "soundplaying-icon");
|
||||
let isActiveTab = tab === gBrowser.selectedTab;
|
||||
|
||||
yield play(tab);
|
||||
await play(tab);
|
||||
|
||||
yield test_tooltip(icon, "Mute tab", isActiveTab);
|
||||
await test_tooltip(icon, "Mute tab", isActiveTab);
|
||||
|
||||
ok(!("muted" in get_tab_state(tab)), "No muted attribute should be persisted");
|
||||
ok(!("muteReason" in get_tab_state(tab)), "No muteReason property should be persisted");
|
||||
|
||||
yield test_mute_tab(tab, icon, true);
|
||||
await test_mute_tab(tab, icon, true);
|
||||
|
||||
ok("muted" in get_tab_state(tab), "Muted attribute should be persisted");
|
||||
ok("muteReason" in get_tab_state(tab), "muteReason property should be persisted");
|
||||
|
||||
yield test_tooltip(icon, "Unmute tab", isActiveTab);
|
||||
await test_tooltip(icon, "Unmute tab", isActiveTab);
|
||||
|
||||
yield test_mute_tab(tab, icon, false);
|
||||
await test_mute_tab(tab, icon, false);
|
||||
|
||||
ok(!("muted" in get_tab_state(tab)), "No muted attribute should be persisted");
|
||||
ok(!("muteReason" in get_tab_state(tab)), "No muteReason property should be persisted");
|
||||
|
||||
yield test_tooltip(icon, "Mute tab", isActiveTab);
|
||||
await test_tooltip(icon, "Mute tab", isActiveTab);
|
||||
|
||||
yield test_mute_tab(tab, icon, true);
|
||||
await test_mute_tab(tab, icon, true);
|
||||
|
||||
yield pause(tab);
|
||||
await pause(tab);
|
||||
|
||||
ok(tab.hasAttribute("muted") &&
|
||||
!tab.hasAttribute("soundplaying"), "Tab should still be muted but not playing");
|
||||
ok(tab.muted && !tab.soundPlaying, "Tab should still be muted but not playing");
|
||||
|
||||
yield test_tooltip(icon, "Unmute tab", isActiveTab);
|
||||
await test_tooltip(icon, "Unmute tab", isActiveTab);
|
||||
|
||||
yield test_mute_tab(tab, icon, false);
|
||||
await test_mute_tab(tab, icon, false);
|
||||
|
||||
ok(!tab.hasAttribute("muted") &&
|
||||
!tab.hasAttribute("soundplaying"), "Tab should not be be muted or playing");
|
||||
ok(!tab.muted && !tab.soundPlaying, "Tab should not be be muted or playing");
|
||||
|
||||
// Make sure it's possible to mute using the context menu.
|
||||
yield test_muting_using_menu(tab, false);
|
||||
await test_muting_using_menu(tab, false);
|
||||
|
||||
// Make sure it's possible to unmute using the context menu.
|
||||
yield test_muting_using_menu(tab, true);
|
||||
await test_muting_using_menu(tab, true);
|
||||
}
|
||||
|
||||
async function test_swapped_browser_while_playing(oldTab, newBrowser) {
|
||||
@ -349,7 +349,7 @@ async function test_browser_swapping(tab, browser) {
|
||||
}
|
||||
|
||||
async function test_click_on_pinned_tab_after_mute() {
|
||||
function* taskFn(browser) {
|
||||
async function taskFn(browser) {
|
||||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
|
||||
gBrowser.selectedTab = originallySelectedTab;
|
||||
@ -360,17 +360,17 @@ async function test_click_on_pinned_tab_after_mute() {
|
||||
gBrowser.pinTab(tab);
|
||||
|
||||
// Start playback and wait for it to finish.
|
||||
yield play(tab);
|
||||
await play(tab);
|
||||
|
||||
// Mute the tab.
|
||||
let icon = document.getAnonymousElementByAttribute(tab, "anonid", "overlay-icon");
|
||||
yield test_mute_tab(tab, icon, true);
|
||||
await test_mute_tab(tab, icon, true);
|
||||
|
||||
// Pause playback and wait for it to finish.
|
||||
yield pause(tab);
|
||||
await pause(tab);
|
||||
|
||||
// Unmute tab.
|
||||
yield test_mute_tab(tab, icon, false);
|
||||
await test_mute_tab(tab, icon, false);
|
||||
|
||||
// Now click on the tab.
|
||||
let image = document.getAnonymousElementByAttribute(tab, "anonid", "tab-icon-image");
|
||||
@ -428,32 +428,32 @@ async function test_mute_keybinding() {
|
||||
EventUtils.synthesizeKey("m", {ctrlKey: true});
|
||||
await mutedPromise;
|
||||
}
|
||||
function* taskFn(browser) {
|
||||
async function taskFn(browser) {
|
||||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
|
||||
// Make sure it's possible to mute before the tab is playing.
|
||||
yield test_muting_using_keyboard(tab);
|
||||
await test_muting_using_keyboard(tab);
|
||||
|
||||
// Start playback and wait for it to finish.
|
||||
yield play(tab);
|
||||
await play(tab);
|
||||
|
||||
// Make sure it's possible to mute after the tab is playing.
|
||||
yield test_muting_using_keyboard(tab);
|
||||
await test_muting_using_keyboard(tab);
|
||||
|
||||
// Pause playback and wait for it to finish.
|
||||
yield pause(tab);
|
||||
await pause(tab);
|
||||
|
||||
// Make sure things work if the tab is pinned.
|
||||
gBrowser.pinTab(tab);
|
||||
|
||||
// Make sure it's possible to mute before the tab is playing.
|
||||
yield test_muting_using_keyboard(tab);
|
||||
await test_muting_using_keyboard(tab);
|
||||
|
||||
// Start playback and wait for it to finish.
|
||||
yield play(tab);
|
||||
await play(tab);
|
||||
|
||||
// Make sure it's possible to mute after the tab is playing.
|
||||
yield test_muting_using_keyboard(tab);
|
||||
await test_muting_using_keyboard(tab);
|
||||
|
||||
gBrowser.unpinTab(tab);
|
||||
}
|
||||
@ -489,15 +489,15 @@ async function test_on_browser(browser) {
|
||||
}
|
||||
|
||||
async function test_delayed_tabattr_removal() {
|
||||
function* taskFn(browser) {
|
||||
async function taskFn(browser) {
|
||||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
yield play(tab);
|
||||
await play(tab);
|
||||
|
||||
// Extend the delay to guarantee the soundplaying attribute
|
||||
// is not removed from the tab when audio is stopped. Without
|
||||
// the extended delay the attribute could be removed in the
|
||||
// same tick and the test wouldn't catch that this broke.
|
||||
yield pause(tab, {extendedDelay: true});
|
||||
await pause(tab, {extendedDelay: true});
|
||||
}
|
||||
|
||||
await BrowserTestUtils.withNewTab({
|
||||
|
@ -9,13 +9,13 @@ add_task(async function test() {
|
||||
|
||||
// This function runs entirely in the content process. It doesn't have access
|
||||
// any free variables in this file.
|
||||
function* testBody(testRoot) {
|
||||
async function testBody(testRoot) {
|
||||
const gStyleSheet = "bug839103.css";
|
||||
|
||||
let loaded = ContentTaskUtils.waitForEvent(this, "load", true);
|
||||
content.location = testRoot + "test_bug839103.html";
|
||||
|
||||
yield loaded;
|
||||
await loaded;
|
||||
function unexpectedContentEvent(event) {
|
||||
ok(false, "Received a " + event.type + " event on content");
|
||||
}
|
||||
@ -42,7 +42,7 @@ function* testBody(testRoot) {
|
||||
ContentTaskUtils.waitForEvent(this, "StyleSheetApplicableStateChanged", true);
|
||||
doc.body.appendChild(link);
|
||||
|
||||
let evt = yield sheetAdded;
|
||||
let evt = await sheetAdded;
|
||||
info("received dynamic style sheet event");
|
||||
is(evt.type, "StyleSheetAdded", "evt.type has expected value");
|
||||
is(evt.target, doc, "event targets correct document");
|
||||
@ -50,7 +50,7 @@ function* testBody(testRoot) {
|
||||
ok(evt.stylesheet.toString().includes("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
|
||||
ok(evt.documentSheet, "style sheet is a document sheet");
|
||||
|
||||
evt = yield stateChanged;
|
||||
evt = await stateChanged;
|
||||
info("received dynamic style sheet applicable state change event");
|
||||
is(evt.type, "StyleSheetApplicableStateChanged", "evt.type has expected value");
|
||||
is(evt.target, doc, "event targets correct document");
|
||||
@ -61,7 +61,7 @@ function* testBody(testRoot) {
|
||||
ContentTaskUtils.waitForEvent(this, "StyleSheetApplicableStateChanged", true);
|
||||
link.disabled = true;
|
||||
|
||||
evt = yield stateChanged;
|
||||
evt = await stateChanged;
|
||||
is(evt.type, "StyleSheetApplicableStateChanged", "evt.type has expected value");
|
||||
info("received dynamic style sheet applicable state change event after media=\"\" changed");
|
||||
is(evt.target, doc, "event targets correct document");
|
||||
@ -72,7 +72,7 @@ function* testBody(testRoot) {
|
||||
ContentTaskUtils.waitForEvent(this, "StyleSheetRemoved", true);
|
||||
doc.body.removeChild(link);
|
||||
|
||||
evt = yield sheetRemoved;
|
||||
evt = await sheetRemoved;
|
||||
info("received dynamic style sheet removal");
|
||||
is(evt.type, "StyleSheetRemoved", "evt.type has expected value");
|
||||
is(evt.target, doc, "event targets correct document");
|
||||
@ -84,7 +84,7 @@ function* testBody(testRoot) {
|
||||
ContentTaskUtils.waitForEvent(this, "StyleRuleAdded", true);
|
||||
doc.querySelector("style").sheet.insertRule("*{color:black}", 0);
|
||||
|
||||
evt = yield ruleAdded;
|
||||
evt = await ruleAdded;
|
||||
info("received style rule added event");
|
||||
is(evt.type, "StyleRuleAdded", "evt.type has expected value");
|
||||
is(evt.target, doc, "event targets correct document");
|
||||
@ -97,7 +97,7 @@ function* testBody(testRoot) {
|
||||
ContentTaskUtils.waitForEvent(this, "StyleRuleChanged", true);
|
||||
evt.rule.style.cssText = "color:green";
|
||||
|
||||
evt = yield ruleChanged;
|
||||
evt = await ruleChanged;
|
||||
ok(true, "received style rule changed event");
|
||||
is(evt.type, "StyleRuleChanged", "evt.type has expected value");
|
||||
is(evt.target, doc, "event targets correct document");
|
||||
@ -110,7 +110,7 @@ function* testBody(testRoot) {
|
||||
ContentTaskUtils.waitForEvent(this, "StyleRuleRemoved", true);
|
||||
evt.stylesheet.deleteRule(0);
|
||||
|
||||
evt = yield ruleRemoved;
|
||||
evt = await ruleRemoved;
|
||||
info("received style rule removed event");
|
||||
is(evt.type, "StyleRuleRemoved", "evt.type has expected value");
|
||||
is(evt.target, doc, "event targets correct document");
|
||||
|
@ -662,8 +662,8 @@ add_task(async function test_select_text() {
|
||||
{
|
||||
offsetX: 6,
|
||||
offsetY: 6,
|
||||
*preCheckContextMenuFn() {
|
||||
yield selectText("#test-select-text");
|
||||
async preCheckContextMenuFn() {
|
||||
await selectText("#test-select-text");
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -691,8 +691,8 @@ add_task(async function test_select_text_link() {
|
||||
{
|
||||
offsetX: 6,
|
||||
offsetY: 6,
|
||||
*preCheckContextMenuFn() {
|
||||
yield selectText("#test-select-text-link");
|
||||
async preCheckContextMenuFn() {
|
||||
await selectText("#test-select-text-link");
|
||||
},
|
||||
async postCheckContextMenuFn() {
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
|
||||
@ -933,8 +933,8 @@ add_task(async function test_plaintext_sendpagetodevice() {
|
||||
];
|
||||
await test_contextmenu("#test-text", plainTextItemsWithSendPage, {
|
||||
maybeScreenshotsPresent: true,
|
||||
*onContextMenuShown() {
|
||||
yield openMenuItemSubmenu("context-sendpagetodevice");
|
||||
async onContextMenuShown() {
|
||||
await openMenuItemSubmenu("context-sendpagetodevice");
|
||||
}
|
||||
});
|
||||
|
||||
@ -970,8 +970,8 @@ add_task(async function test_link_sendlinktodevice() {
|
||||
"*All Devices", true], null,
|
||||
],
|
||||
{
|
||||
*onContextMenuShown() {
|
||||
yield openMenuItemSubmenu("context-sendlinktodevice");
|
||||
async onContextMenuShown() {
|
||||
await openMenuItemSubmenu("context-sendlinktodevice");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -148,7 +148,7 @@ add_task(async function() {
|
||||
});
|
||||
}
|
||||
|
||||
function* ctrlTabTest(tabsToSelect, tabTimes, expectedIndex) {
|
||||
async function ctrlTabTest(tabsToSelect, tabTimes, expectedIndex) {
|
||||
selectTabs(tabsToSelect);
|
||||
|
||||
var indexStart = gBrowser.tabContainer.selectedIndex;
|
||||
@ -158,7 +158,7 @@ add_task(async function() {
|
||||
normalized + " tabs back in most-recently-selected order";
|
||||
|
||||
for (let i = 0; i < tabTimes; i++) {
|
||||
yield pressCtrlTab();
|
||||
await pressCtrlTab();
|
||||
|
||||
if (tabCount > 2)
|
||||
is(gBrowser.tabContainer.selectedIndex, indexStart,
|
||||
@ -169,7 +169,7 @@ add_task(async function() {
|
||||
ok(isOpen(),
|
||||
"With " + tabCount + " tabs open, Ctrl+Tab opens the preview panel");
|
||||
|
||||
yield releaseCtrl();
|
||||
await releaseCtrl();
|
||||
|
||||
ok(!isOpen(),
|
||||
"Releasing Ctrl closes the preview panel");
|
||||
|
@ -18,11 +18,11 @@ add_task(async function findbar_test() {
|
||||
|
||||
gFindBar.open();
|
||||
|
||||
await new ContentTask.spawn(newTab.linkedBrowser, null, function* () {
|
||||
await new ContentTask.spawn(newTab.linkedBrowser, null, async function() {
|
||||
let iframe = content.document.getElementById("iframe");
|
||||
let awaitLoad = ContentTaskUtils.waitForEvent(iframe, "load", false);
|
||||
iframe.src = "http://example.org/";
|
||||
yield awaitLoad;
|
||||
await awaitLoad;
|
||||
});
|
||||
|
||||
ok(!gFindBar.hidden, "the Find bar isn't hidden after the location of a " +
|
||||
|
@ -114,15 +114,15 @@ add_task(async function test_getshortcutoruri() {
|
||||
var folder = null;
|
||||
var gAddedEngines = [];
|
||||
|
||||
function* setupKeywords() {
|
||||
folder = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||
async function setupKeywords() {
|
||||
folder = await PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||
type: PlacesUtils.bookmarks.TYPE_FOLDER,
|
||||
title: "keyword-test" });
|
||||
for (let item of testData) {
|
||||
let data = item[0];
|
||||
if (data instanceof bmKeywordData) {
|
||||
yield PlacesUtils.bookmarks.insert({ url: data.uri, parentGuid: folder.guid });
|
||||
yield PlacesUtils.keywords.insert({ keyword: data.keyword, url: data.uri.spec, postData: data.postData });
|
||||
await PlacesUtils.bookmarks.insert({ url: data.uri, parentGuid: folder.guid });
|
||||
await PlacesUtils.keywords.insert({ keyword: data.keyword, url: data.uri.spec, postData: data.postData });
|
||||
}
|
||||
|
||||
if (data instanceof searchKeywordData) {
|
||||
|
@ -5,9 +5,9 @@ add_task(async function test_keyword_bookmarklet() {
|
||||
title: "bookmarklet",
|
||||
url: "javascript:'1';" });
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||
registerCleanupFunction(function* () {
|
||||
registerCleanupFunction(async function() {
|
||||
gBrowser.removeTab(tab);
|
||||
yield PlacesUtils.bookmarks.remove(bm);
|
||||
await PlacesUtils.bookmarks.remove(bm);
|
||||
});
|
||||
await promisePageShow();
|
||||
let originalPrincipal = gBrowser.contentPrincipal;
|
||||
|
@ -486,7 +486,7 @@ function setupHistory() {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function* setupFormHistory() {
|
||||
async function setupFormHistory() {
|
||||
|
||||
function searchEntries(terms, params) {
|
||||
let deferred = Promise.defer();
|
||||
@ -514,7 +514,7 @@ function* setupFormHistory() {
|
||||
}
|
||||
|
||||
// Make sure we've got a clean DB to start with, then add the entries we'll be testing.
|
||||
yield update(
|
||||
await update(
|
||||
[{
|
||||
op: "remove"
|
||||
},
|
||||
@ -558,122 +558,122 @@ function* setupFormHistory() {
|
||||
|
||||
// Artifically age the entries to the proper vintage.
|
||||
let timestamp = now_uSec - 10 * kUsecPerMin;
|
||||
let results = yield searchEntries(["guid"], { fieldname: "10minutes" });
|
||||
yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
let results = await searchEntries(["guid"], { fieldname: "10minutes" });
|
||||
await update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
|
||||
timestamp = now_uSec - 45 * kUsecPerMin;
|
||||
results = yield searchEntries(["guid"], { fieldname: "1hour" });
|
||||
yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
results = await searchEntries(["guid"], { fieldname: "1hour" });
|
||||
await update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
|
||||
timestamp = now_uSec - 70 * kUsecPerMin;
|
||||
results = yield searchEntries(["guid"], { fieldname: "1hour10minutes" });
|
||||
yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
results = await searchEntries(["guid"], { fieldname: "1hour10minutes" });
|
||||
await update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
|
||||
timestamp = now_uSec - 90 * kUsecPerMin;
|
||||
results = yield searchEntries(["guid"], { fieldname: "2hour" });
|
||||
yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
results = await searchEntries(["guid"], { fieldname: "2hour" });
|
||||
await update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
|
||||
timestamp = now_uSec - 130 * kUsecPerMin;
|
||||
results = yield searchEntries(["guid"], { fieldname: "2hour10minutes" });
|
||||
yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
results = await searchEntries(["guid"], { fieldname: "2hour10minutes" });
|
||||
await update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
|
||||
timestamp = now_uSec - 180 * kUsecPerMin;
|
||||
results = yield searchEntries(["guid"], { fieldname: "4hour" });
|
||||
yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
results = await searchEntries(["guid"], { fieldname: "4hour" });
|
||||
await update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
|
||||
timestamp = now_uSec - 250 * kUsecPerMin;
|
||||
results = yield searchEntries(["guid"], { fieldname: "4hour10minutes" });
|
||||
yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
results = await searchEntries(["guid"], { fieldname: "4hour10minutes" });
|
||||
await update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
|
||||
let today = new Date();
|
||||
today.setHours(0);
|
||||
today.setMinutes(0);
|
||||
today.setSeconds(1);
|
||||
timestamp = today.getTime() * 1000;
|
||||
results = yield searchEntries(["guid"], { fieldname: "today" });
|
||||
yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
results = await searchEntries(["guid"], { fieldname: "today" });
|
||||
await update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
|
||||
let lastYear = new Date();
|
||||
lastYear.setFullYear(lastYear.getFullYear() - 1);
|
||||
timestamp = lastYear.getTime() * 1000;
|
||||
results = yield searchEntries(["guid"], { fieldname: "b4today" });
|
||||
yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
results = await searchEntries(["guid"], { fieldname: "b4today" });
|
||||
await update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
|
||||
|
||||
var checks = 0;
|
||||
let checkOne = function(num, message) { is(num, 1, message); checks++; }
|
||||
|
||||
// Sanity check.
|
||||
yield countEntries("10minutes", "Checking for 10minutes form history entry creation", checkOne);
|
||||
yield countEntries("1hour", "Checking for 1hour form history entry creation", checkOne);
|
||||
yield countEntries("1hour10minutes", "Checking for 1hour10minutes form history entry creation", checkOne);
|
||||
yield countEntries("2hour", "Checking for 2hour form history entry creation", checkOne);
|
||||
yield countEntries("2hour10minutes", "Checking for 2hour10minutes form history entry creation", checkOne);
|
||||
yield countEntries("4hour", "Checking for 4hour form history entry creation", checkOne);
|
||||
yield countEntries("4hour10minutes", "Checking for 4hour10minutes form history entry creation", checkOne);
|
||||
yield countEntries("today", "Checking for today form history entry creation", checkOne);
|
||||
yield countEntries("b4today", "Checking for b4today form history entry creation", checkOne);
|
||||
await countEntries("10minutes", "Checking for 10minutes form history entry creation", checkOne);
|
||||
await countEntries("1hour", "Checking for 1hour form history entry creation", checkOne);
|
||||
await countEntries("1hour10minutes", "Checking for 1hour10minutes form history entry creation", checkOne);
|
||||
await countEntries("2hour", "Checking for 2hour form history entry creation", checkOne);
|
||||
await countEntries("2hour10minutes", "Checking for 2hour10minutes form history entry creation", checkOne);
|
||||
await countEntries("4hour", "Checking for 4hour form history entry creation", checkOne);
|
||||
await countEntries("4hour10minutes", "Checking for 4hour10minutes form history entry creation", checkOne);
|
||||
await countEntries("today", "Checking for today form history entry creation", checkOne);
|
||||
await countEntries("b4today", "Checking for b4today form history entry creation", checkOne);
|
||||
is(checks, 9, "9 checks made");
|
||||
}
|
||||
|
||||
function* setupDownloads() {
|
||||
async function setupDownloads() {
|
||||
|
||||
let publicList = yield Downloads.getList(Downloads.PUBLIC);
|
||||
let publicList = await Downloads.getList(Downloads.PUBLIC);
|
||||
|
||||
let download = yield Downloads.createDownload({
|
||||
let download = await Downloads.createDownload({
|
||||
source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
|
||||
target: "fakefile-10-minutes"
|
||||
});
|
||||
download.startTime = new Date(now_mSec - 10 * kMsecPerMin), // 10 minutes ago
|
||||
download.canceled = true;
|
||||
yield publicList.add(download);
|
||||
await publicList.add(download);
|
||||
|
||||
download = yield Downloads.createDownload({
|
||||
download = await Downloads.createDownload({
|
||||
source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
|
||||
target: "fakefile-1-hour"
|
||||
});
|
||||
download.startTime = new Date(now_mSec - 45 * kMsecPerMin), // 45 minutes ago
|
||||
download.canceled = true;
|
||||
yield publicList.add(download);
|
||||
await publicList.add(download);
|
||||
|
||||
download = yield Downloads.createDownload({
|
||||
download = await Downloads.createDownload({
|
||||
source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
|
||||
target: "fakefile-1-hour-10-minutes"
|
||||
});
|
||||
download.startTime = new Date(now_mSec - 70 * kMsecPerMin), // 70 minutes ago
|
||||
download.canceled = true;
|
||||
yield publicList.add(download);
|
||||
await publicList.add(download);
|
||||
|
||||
download = yield Downloads.createDownload({
|
||||
download = await Downloads.createDownload({
|
||||
source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
|
||||
target: "fakefile-2-hour"
|
||||
});
|
||||
download.startTime = new Date(now_mSec - 90 * kMsecPerMin), // 90 minutes ago
|
||||
download.canceled = true;
|
||||
yield publicList.add(download);
|
||||
await publicList.add(download);
|
||||
|
||||
download = yield Downloads.createDownload({
|
||||
download = await Downloads.createDownload({
|
||||
source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
|
||||
target: "fakefile-2-hour-10-minutes"
|
||||
});
|
||||
download.startTime = new Date(now_mSec - 130 * kMsecPerMin), // 130 minutes ago
|
||||
download.canceled = true;
|
||||
yield publicList.add(download);
|
||||
await publicList.add(download);
|
||||
|
||||
download = yield Downloads.createDownload({
|
||||
download = await Downloads.createDownload({
|
||||
source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
|
||||
target: "fakefile-4-hour"
|
||||
});
|
||||
download.startTime = new Date(now_mSec - 180 * kMsecPerMin), // 180 minutes ago
|
||||
download.canceled = true;
|
||||
yield publicList.add(download);
|
||||
await publicList.add(download);
|
||||
|
||||
download = yield Downloads.createDownload({
|
||||
download = await Downloads.createDownload({
|
||||
source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
|
||||
target: "fakefile-4-hour-10-minutes"
|
||||
});
|
||||
download.startTime = new Date(now_mSec - 250 * kMsecPerMin), // 250 minutes ago
|
||||
download.canceled = true;
|
||||
yield publicList.add(download);
|
||||
await publicList.add(download);
|
||||
|
||||
// Add "today" download
|
||||
let today = new Date();
|
||||
@ -681,39 +681,39 @@ function* setupDownloads() {
|
||||
today.setMinutes(0);
|
||||
today.setSeconds(1);
|
||||
|
||||
download = yield Downloads.createDownload({
|
||||
download = await Downloads.createDownload({
|
||||
source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
|
||||
target: "fakefile-today"
|
||||
});
|
||||
download.startTime = today, // 12:00:01 AM this morning
|
||||
download.canceled = true;
|
||||
yield publicList.add(download);
|
||||
await publicList.add(download);
|
||||
|
||||
// Add "before today" download
|
||||
let lastYear = new Date();
|
||||
lastYear.setFullYear(lastYear.getFullYear() - 1);
|
||||
|
||||
download = yield Downloads.createDownload({
|
||||
download = await Downloads.createDownload({
|
||||
source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
|
||||
target: "fakefile-old"
|
||||
});
|
||||
download.startTime = lastYear,
|
||||
download.canceled = true;
|
||||
yield publicList.add(download);
|
||||
await publicList.add(download);
|
||||
|
||||
// Confirm everything worked
|
||||
let downloads = yield publicList.getAll();
|
||||
let downloads = await publicList.getAll();
|
||||
is(downloads.length, 9, "9 Pretend downloads added");
|
||||
|
||||
ok((yield downloadExists(publicList, "fakefile-old")), "Pretend download for everything case should exist");
|
||||
ok((yield downloadExists(publicList, "fakefile-10-minutes")), "Pretend download for 10-minutes case should exist");
|
||||
ok((yield downloadExists(publicList, "fakefile-1-hour")), "Pretend download for 1-hour case should exist");
|
||||
ok((yield downloadExists(publicList, "fakefile-1-hour-10-minutes")), "Pretend download for 1-hour-10-minutes case should exist");
|
||||
ok((yield downloadExists(publicList, "fakefile-2-hour")), "Pretend download for 2-hour case should exist");
|
||||
ok((yield downloadExists(publicList, "fakefile-2-hour-10-minutes")), "Pretend download for 2-hour-10-minutes case should exist");
|
||||
ok((yield downloadExists(publicList, "fakefile-4-hour")), "Pretend download for 4-hour case should exist");
|
||||
ok((yield downloadExists(publicList, "fakefile-4-hour-10-minutes")), "Pretend download for 4-hour-10-minutes case should exist");
|
||||
ok((yield downloadExists(publicList, "fakefile-today")), "Pretend download for Today case should exist");
|
||||
ok((await downloadExists(publicList, "fakefile-old")), "Pretend download for everything case should exist");
|
||||
ok((await downloadExists(publicList, "fakefile-10-minutes")), "Pretend download for 10-minutes case should exist");
|
||||
ok((await downloadExists(publicList, "fakefile-1-hour")), "Pretend download for 1-hour case should exist");
|
||||
ok((await downloadExists(publicList, "fakefile-1-hour-10-minutes")), "Pretend download for 1-hour-10-minutes case should exist");
|
||||
ok((await downloadExists(publicList, "fakefile-2-hour")), "Pretend download for 2-hour case should exist");
|
||||
ok((await downloadExists(publicList, "fakefile-2-hour-10-minutes")), "Pretend download for 2-hour-10-minutes case should exist");
|
||||
ok((await downloadExists(publicList, "fakefile-4-hour")), "Pretend download for 4-hour case should exist");
|
||||
ok((await downloadExists(publicList, "fakefile-4-hour-10-minutes")), "Pretend download for 4-hour-10-minutes case should exist");
|
||||
ok((await downloadExists(publicList, "fakefile-today")), "Pretend download for Today case should exist");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -861,11 +861,11 @@ function promiseSanitizationComplete() {
|
||||
* @param aMinutesAgo
|
||||
* The download will be downloaded this many minutes ago
|
||||
*/
|
||||
function* addDownloadWithMinutesAgo(aExpectedPathList, aMinutesAgo) {
|
||||
let publicList = yield Downloads.getList(Downloads.PUBLIC);
|
||||
async function addDownloadWithMinutesAgo(aExpectedPathList, aMinutesAgo) {
|
||||
let publicList = await Downloads.getList(Downloads.PUBLIC);
|
||||
|
||||
let name = "fakefile-" + aMinutesAgo + "-minutes-ago";
|
||||
let download = yield Downloads.createDownload({
|
||||
let download = await Downloads.createDownload({
|
||||
source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
|
||||
target: name
|
||||
});
|
||||
@ -873,7 +873,7 @@ function* addDownloadWithMinutesAgo(aExpectedPathList, aMinutesAgo) {
|
||||
download.canceled = true;
|
||||
publicList.add(download);
|
||||
|
||||
ok((yield downloadExists(name)),
|
||||
ok((await downloadExists(name)),
|
||||
"Sanity check: download " + name +
|
||||
" should exist after creating it");
|
||||
|
||||
@ -975,9 +975,9 @@ function boolPrefIs(aPrefName, aExpectedVal, aMsg) {
|
||||
* The path of the download to check
|
||||
* @return True if the download exists, false otherwise
|
||||
*/
|
||||
function* downloadExists(aPath) {
|
||||
let publicList = yield Downloads.getList(Downloads.PUBLIC);
|
||||
let listArray = yield publicList.getAll();
|
||||
async function downloadExists(aPath) {
|
||||
let publicList = await Downloads.getList(Downloads.PUBLIC);
|
||||
let listArray = await publicList.getAll();
|
||||
return listArray.some(i => i.target.path == aPath);
|
||||
}
|
||||
|
||||
@ -989,10 +989,10 @@ function* downloadExists(aPath) {
|
||||
* @param aShouldBeCleared
|
||||
* True if each download should be cleared, false otherwise
|
||||
*/
|
||||
function* ensureDownloadsClearedState(aDownloadIDs, aShouldBeCleared) {
|
||||
async function ensureDownloadsClearedState(aDownloadIDs, aShouldBeCleared) {
|
||||
let niceStr = aShouldBeCleared ? "no longer" : "still";
|
||||
for (let id of aDownloadIDs) {
|
||||
is((yield downloadExists(id)), !aShouldBeCleared,
|
||||
is((await downloadExists(id)), !aShouldBeCleared,
|
||||
"download " + id + " should " + niceStr + " exist");
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ add_task(async function test() {
|
||||
// Check the send tab to device menu item
|
||||
await ensureSyncReady();
|
||||
const oldGetter = setupRemoteClientsFixture(remoteClientsFixture);
|
||||
await updateTabContextMenu(origTab, function* () {
|
||||
yield openMenuItemSubmenu("context_sendTabToDevice");
|
||||
await updateTabContextMenu(origTab, async function() {
|
||||
await openMenuItemSubmenu("context_sendTabToDevice");
|
||||
});
|
||||
is(document.getElementById("context_sendTabToDevice").hidden, false, "Send tab to device is shown");
|
||||
let targets = document.getElementById("context_sendTabToDevicePopupMenu").childNodes;
|
||||
|
@ -17,19 +17,19 @@ function closeIdentityPopup() {
|
||||
}
|
||||
|
||||
add_task(async function testMainViewVisible() {
|
||||
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function*() {
|
||||
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function() {
|
||||
let permissionsList = document.getElementById("identity-popup-permission-list");
|
||||
let emptyLabel = permissionsList.nextSibling.nextSibling;
|
||||
|
||||
yield openIdentityPopup();
|
||||
await openIdentityPopup();
|
||||
|
||||
ok(!is_hidden(emptyLabel), "List of permissions is empty");
|
||||
|
||||
yield closeIdentityPopup();
|
||||
await closeIdentityPopup();
|
||||
|
||||
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.ALLOW);
|
||||
|
||||
yield openIdentityPopup();
|
||||
await openIdentityPopup();
|
||||
|
||||
ok(is_hidden(emptyLabel), "List of permissions is not empty");
|
||||
|
||||
@ -42,15 +42,15 @@ add_task(async function testMainViewVisible() {
|
||||
ok(img, "There is an image for the permissions");
|
||||
ok(img.classList.contains("camera-icon"), "proper class is in image class");
|
||||
|
||||
yield closeIdentityPopup();
|
||||
await closeIdentityPopup();
|
||||
|
||||
SitePermissions.remove(gBrowser.currentURI, "camera");
|
||||
|
||||
yield openIdentityPopup();
|
||||
await openIdentityPopup();
|
||||
|
||||
ok(!is_hidden(emptyLabel), "List of permissions is empty");
|
||||
|
||||
yield closeIdentityPopup();
|
||||
await closeIdentityPopup();
|
||||
});
|
||||
});
|
||||
|
||||
@ -83,14 +83,14 @@ add_task(async function testIdentityIcon() {
|
||||
});
|
||||
|
||||
add_task(async function testCancelPermission() {
|
||||
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function*() {
|
||||
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function() {
|
||||
let permissionsList = document.getElementById("identity-popup-permission-list");
|
||||
let emptyLabel = permissionsList.nextSibling.nextSibling;
|
||||
|
||||
SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.ALLOW);
|
||||
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.BLOCK);
|
||||
|
||||
yield openIdentityPopup();
|
||||
await openIdentityPopup();
|
||||
|
||||
ok(is_hidden(emptyLabel), "List of permissions is not empty");
|
||||
|
||||
@ -104,27 +104,27 @@ add_task(async function testCancelPermission() {
|
||||
labels = permissionsList.querySelectorAll(".identity-popup-permission-label");
|
||||
is(labels.length, 0, "One permission should be removed");
|
||||
|
||||
yield closeIdentityPopup();
|
||||
await closeIdentityPopup();
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function testPermissionHints() {
|
||||
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function*(browser) {
|
||||
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function(browser) {
|
||||
let permissionsList = document.getElementById("identity-popup-permission-list");
|
||||
let emptyHint = document.getElementById("identity-popup-permission-empty-hint");
|
||||
let reloadHint = document.getElementById("identity-popup-permission-reload-hint");
|
||||
|
||||
yield openIdentityPopup();
|
||||
await openIdentityPopup();
|
||||
|
||||
ok(!is_hidden(emptyHint), "Empty hint is visible");
|
||||
ok(is_hidden(reloadHint), "Reload hint is hidden");
|
||||
|
||||
yield closeIdentityPopup();
|
||||
await closeIdentityPopup();
|
||||
|
||||
SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.ALLOW);
|
||||
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.BLOCK);
|
||||
|
||||
yield openIdentityPopup();
|
||||
await openIdentityPopup();
|
||||
|
||||
ok(is_hidden(emptyHint), "Empty hint is hidden");
|
||||
ok(is_hidden(reloadHint), "Reload hint is hidden");
|
||||
@ -141,16 +141,16 @@ add_task(async function testPermissionHints() {
|
||||
ok(is_hidden(emptyHint), "Empty hint is hidden");
|
||||
ok(!is_hidden(reloadHint), "Reload hint is visible");
|
||||
|
||||
yield closeIdentityPopup();
|
||||
await closeIdentityPopup();
|
||||
let loaded = BrowserTestUtils.browserLoaded(browser);
|
||||
BrowserTestUtils.loadURI(browser, PERMISSIONS_PAGE);
|
||||
yield loaded;
|
||||
yield openIdentityPopup();
|
||||
await loaded;
|
||||
await openIdentityPopup();
|
||||
|
||||
ok(!is_hidden(emptyHint), "Empty hint is visible after reloading");
|
||||
ok(is_hidden(reloadHint), "Reload hint is hidden after reloading");
|
||||
|
||||
yield closeIdentityPopup();
|
||||
await closeIdentityPopup();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -341,8 +341,8 @@ var tests = [
|
||||
// Clicking the anchor of a dismissed notification should show it, even when
|
||||
// the currently displayed notification is a persistent one.
|
||||
{ id: "Test#11",
|
||||
*run() {
|
||||
yield SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]});
|
||||
async run() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]});
|
||||
|
||||
function clickAnchor(notifyObj) {
|
||||
let anchor = document.getElementById(notifyObj.anchorID);
|
||||
@ -357,7 +357,7 @@ var tests = [
|
||||
notifyObj1.options.persistent = true;
|
||||
let shown = waitForNotificationPanel();
|
||||
let notification1 = showNotification(notifyObj1);
|
||||
yield shown;
|
||||
await shown;
|
||||
checkPopup(popup, notifyObj1);
|
||||
ok(!notifyObj1.dismissalCallbackTriggered,
|
||||
"Should not have dismissed the notification");
|
||||
@ -387,7 +387,7 @@ var tests = [
|
||||
// first notification.
|
||||
shown = waitForNotificationPanel();
|
||||
clickAnchor(notifyObj2);
|
||||
yield shown;
|
||||
await shown;
|
||||
checkPopup(popup, notifyObj2);
|
||||
ok(notifyObj1.dismissalCallbackTriggered,
|
||||
"Should have dismissed the first notification");
|
||||
@ -395,7 +395,7 @@ var tests = [
|
||||
// Click the anchor of the first notification, it should be shown again.
|
||||
shown = waitForNotificationPanel();
|
||||
clickAnchor(notifyObj1);
|
||||
yield shown;
|
||||
await shown;
|
||||
checkPopup(popup, notifyObj1);
|
||||
ok(notifyObj2.dismissalCallbackTriggered,
|
||||
"Should have dismissed the second notification");
|
||||
|
@ -148,11 +148,11 @@ var tests = [
|
||||
EventUtils.synthesizeMouseAtCenter(checkbox, {});
|
||||
dismissNotification(popup);
|
||||
},
|
||||
*onHidden(popup) {
|
||||
async onHidden(popup) {
|
||||
let icon = document.getElementById("default-notification-icon");
|
||||
let shown = waitForNotificationPanel();
|
||||
EventUtils.synthesizeMouseAtCenter(icon, {});
|
||||
yield shown;
|
||||
await shown;
|
||||
let notification = popup.childNodes[0];
|
||||
let checkbox = notification.checkbox;
|
||||
checkCheckbox(checkbox, "This is a checkbox", true);
|
||||
|
@ -75,7 +75,7 @@ var tests = [
|
||||
// Test that you can switch between active notifications with the space key
|
||||
// and that the notification is focused on selection.
|
||||
{ id: "Test#4",
|
||||
*run() {
|
||||
async run() {
|
||||
let notifyObj1 = new BasicNotification(this.id);
|
||||
notifyObj1.id += "_1";
|
||||
notifyObj1.anchorID = "default-notification-icon";
|
||||
@ -88,7 +88,7 @@ var tests = [
|
||||
});
|
||||
let opened = waitForNotificationPanel();
|
||||
let notification1 = showNotification(notifyObj1);
|
||||
yield opened;
|
||||
await opened;
|
||||
|
||||
let notifyObj2 = new BasicNotification(this.id);
|
||||
notifyObj2.id += "_2";
|
||||
@ -98,7 +98,7 @@ var tests = [
|
||||
});
|
||||
opened = waitForNotificationPanel();
|
||||
let notification2 = showNotification(notifyObj2);
|
||||
let popup = yield opened;
|
||||
let popup = await opened;
|
||||
|
||||
// Make sure notification 2 is visible
|
||||
checkPopup(popup, notifyObj2);
|
||||
@ -109,7 +109,7 @@ var tests = [
|
||||
is(document.activeElement, anchor);
|
||||
opened = waitForNotificationPanel();
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
popup = yield opened;
|
||||
popup = await opened;
|
||||
checkPopup(popup, notifyObj1);
|
||||
|
||||
is(document.activeElement, popup.childNodes[0].checkbox);
|
||||
@ -120,7 +120,7 @@ var tests = [
|
||||
is(document.activeElement, anchor);
|
||||
opened = waitForNotificationPanel();
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
popup = yield opened;
|
||||
popup = await opened;
|
||||
checkPopup(popup, notifyObj2);
|
||||
|
||||
is(document.activeElement, popup.childNodes[0].closebutton);
|
||||
@ -151,7 +151,7 @@ var tests = [
|
||||
is(Services.focus.focusedElement, popup.childNodes[0].closebutton);
|
||||
dismissNotification(popup);
|
||||
},
|
||||
*onHidden() {
|
||||
async onHidden() {
|
||||
// Focus the urlbar to check that it stays focused.
|
||||
gURLBar.focus();
|
||||
|
||||
@ -162,7 +162,7 @@ var tests = [
|
||||
|
||||
let opened = waitForNotificationPanel();
|
||||
let notification = showNotification(notifyObj);
|
||||
let popup = yield opened;
|
||||
let popup = await opened;
|
||||
checkPopup(popup, notifyObj);
|
||||
|
||||
// Check that the urlbar is still focused.
|
||||
|
@ -106,14 +106,14 @@ var tests = [
|
||||
// location bar, anchored to the identity icon when the focus is moved away
|
||||
// from the location bar, and restored when the URL is reverted.
|
||||
{ id: "Test#4",
|
||||
*run() {
|
||||
async run() {
|
||||
for (let persistent of [false, true]) {
|
||||
let shown = waitForNotificationPanel();
|
||||
this.notifyObj = new BasicNotification(this.id);
|
||||
this.notifyObj.anchorID = "geo-notification-icon";
|
||||
this.notifyObj.addOptions({ persistent });
|
||||
this.notification = showNotification(this.notifyObj);
|
||||
yield shown;
|
||||
await shown;
|
||||
|
||||
checkPopup(PopupNotifications.panel, this.notifyObj);
|
||||
|
||||
@ -121,7 +121,7 @@ var tests = [
|
||||
let hidden = waitForNotificationPanelHidden();
|
||||
gURLBar.select();
|
||||
EventUtils.synthesizeKey("*", {});
|
||||
yield hidden;
|
||||
await hidden;
|
||||
|
||||
is(document.getElementById("geo-notification-icon").boxObject.width, 0,
|
||||
"geo anchor shouldn't be visible");
|
||||
@ -132,7 +132,7 @@ var tests = [
|
||||
shown = waitForNotificationPanel();
|
||||
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
|
||||
EventUtils.synthesizeKey("VK_TAB", {});
|
||||
yield shown;
|
||||
await shown;
|
||||
|
||||
is(PopupNotifications.panel.anchorNode.id, "identity-icon",
|
||||
"notification anchored to identity icon");
|
||||
@ -140,18 +140,18 @@ var tests = [
|
||||
// Moving focus to the location bar should hide the notification again.
|
||||
hidden = waitForNotificationPanelHidden();
|
||||
EventUtils.synthesizeKey("VK_TAB", { shiftKey: true });
|
||||
yield hidden;
|
||||
await hidden;
|
||||
|
||||
// Reverting the URL should show the notification again.
|
||||
shown = waitForNotificationPanel();
|
||||
EventUtils.synthesizeKey("VK_ESCAPE", {});
|
||||
yield shown;
|
||||
await shown;
|
||||
|
||||
checkPopup(PopupNotifications.panel, this.notifyObj);
|
||||
|
||||
hidden = waitForNotificationPanelHidden();
|
||||
this.notification.remove();
|
||||
yield hidden;
|
||||
await hidden;
|
||||
}
|
||||
goNext();
|
||||
}
|
||||
@ -159,7 +159,7 @@ var tests = [
|
||||
// Test that popupnotifications triggered while editing the URL in the
|
||||
// location bar are only shown later when the URL is reverted.
|
||||
{ id: "Test#5",
|
||||
*run() {
|
||||
async run() {
|
||||
for (let persistent of [false, true]) {
|
||||
// Start editing the URL, ensuring that the awesomebar popup is hidden.
|
||||
gURLBar.select();
|
||||
@ -172,18 +172,18 @@ var tests = [
|
||||
this.notifyObj.anchorID = "geo-notification-icon";
|
||||
this.notifyObj.addOptions({ persistent });
|
||||
this.notification = showNotification(this.notifyObj);
|
||||
yield notShowing;
|
||||
await notShowing;
|
||||
|
||||
// Reverting the URL should show the notification.
|
||||
let shown = waitForNotificationPanel();
|
||||
EventUtils.synthesizeKey("VK_ESCAPE", {});
|
||||
yield shown;
|
||||
await shown;
|
||||
|
||||
checkPopup(PopupNotifications.panel, this.notifyObj);
|
||||
|
||||
let hidden = waitForNotificationPanelHidden();
|
||||
this.notification.remove();
|
||||
yield hidden;
|
||||
await hidden;
|
||||
}
|
||||
|
||||
goNext();
|
||||
|
@ -82,7 +82,7 @@ function goNext() {
|
||||
executeSoon(() => executeSoon(Task.async(runNextTest)));
|
||||
}
|
||||
|
||||
function* runNextTest() {
|
||||
async function runNextTest() {
|
||||
if (tests.length == 0) {
|
||||
executeSoon(finish);
|
||||
return;
|
||||
@ -109,7 +109,7 @@ function* runNextTest() {
|
||||
}
|
||||
|
||||
info("[" + nextTest.id + "] running test");
|
||||
yield nextTest.run();
|
||||
await nextTest.run();
|
||||
}
|
||||
|
||||
function showNotification(notifyObj) {
|
||||
|
@ -112,11 +112,11 @@ add_task(async function test_initialize() {
|
||||
*/
|
||||
add_task(async function test_same_origin() {
|
||||
await doTest(HTTPS_TEST_ROOT_1 + "file_bug906190_1.html",
|
||||
HTTPS_TEST_ROOT_1 + "file_bug906190_2.html", function* () {
|
||||
HTTPS_TEST_ROOT_1 + "file_bug906190_2.html", async function() {
|
||||
// The doorhanger should appear but activeBlocked should be >> NOT << true,
|
||||
// because our decision of disabling the mixed content blocker is persistent
|
||||
// across tabs.
|
||||
yield assertMixedContentBlockingState(gBrowser, {
|
||||
await assertMixedContentBlockingState(gBrowser, {
|
||||
activeLoaded: true, activeBlocked: false, passiveLoaded: false,
|
||||
});
|
||||
|
||||
@ -133,11 +133,11 @@ add_task(async function test_same_origin() {
|
||||
*/
|
||||
add_task(async function test_different_origin() {
|
||||
await doTest(HTTPS_TEST_ROOT_1 + "file_bug906190_2.html",
|
||||
HTTPS_TEST_ROOT_2 + "file_bug906190_2.html", function* () {
|
||||
HTTPS_TEST_ROOT_2 + "file_bug906190_2.html", async function() {
|
||||
// The doorhanger should appear and activeBlocked should be >> TRUE <<,
|
||||
// because our decision of disabling the mixed content blocker should only
|
||||
// persist if pages are from the same domain.
|
||||
yield assertMixedContentBlockingState(gBrowser, {
|
||||
await assertMixedContentBlockingState(gBrowser, {
|
||||
activeLoaded: false, activeBlocked: true, passiveLoaded: false,
|
||||
});
|
||||
|
||||
@ -156,9 +156,9 @@ add_task(async function test_different_origin() {
|
||||
add_task(async function test_same_origin_metarefresh_same_origin() {
|
||||
// file_bug906190_3_4.html redirects to page test1.example.com/* using meta-refresh
|
||||
await doTest(HTTPS_TEST_ROOT_1 + "file_bug906190_1.html",
|
||||
HTTPS_TEST_ROOT_1 + "file_bug906190_3_4.html", function* () {
|
||||
HTTPS_TEST_ROOT_1 + "file_bug906190_3_4.html", async function() {
|
||||
// The doorhanger should appear but activeBlocked should be >> NOT << true!
|
||||
yield assertMixedContentBlockingState(gBrowser, {
|
||||
await assertMixedContentBlockingState(gBrowser, {
|
||||
activeLoaded: true, activeBlocked: false, passiveLoaded: false,
|
||||
});
|
||||
|
||||
@ -176,9 +176,9 @@ add_task(async function test_same_origin_metarefresh_same_origin() {
|
||||
*/
|
||||
add_task(async function test_same_origin_metarefresh_different_origin() {
|
||||
await doTest(HTTPS_TEST_ROOT_2 + "file_bug906190_1.html",
|
||||
HTTPS_TEST_ROOT_2 + "file_bug906190_3_4.html", function* () {
|
||||
HTTPS_TEST_ROOT_2 + "file_bug906190_3_4.html", async function() {
|
||||
// The doorhanger should appear and activeBlocked should be >> TRUE <<.
|
||||
yield assertMixedContentBlockingState(gBrowser, {
|
||||
await assertMixedContentBlockingState(gBrowser, {
|
||||
activeLoaded: false, activeBlocked: true, passiveLoaded: false,
|
||||
});
|
||||
|
||||
@ -216,9 +216,9 @@ add_task(async function test_same_origin_302redirect_same_origin() {
|
||||
add_task(async function test_same_origin_302redirect_different_origin() {
|
||||
// the sjs files returns a 302 redirect - note, different origins
|
||||
await doTest(HTTPS_TEST_ROOT_2 + "file_bug906190_1.html",
|
||||
HTTPS_TEST_ROOT_2 + "file_bug906190.sjs", function* () {
|
||||
HTTPS_TEST_ROOT_2 + "file_bug906190.sjs", async function() {
|
||||
// The doorhanger should appear and activeBlocked should be >> TRUE <<.
|
||||
yield assertMixedContentBlockingState(gBrowser, {
|
||||
await assertMixedContentBlockingState(gBrowser, {
|
||||
activeLoaded: false, activeBlocked: true, passiveLoaded: false,
|
||||
});
|
||||
|
||||
|
@ -15,10 +15,10 @@ function synthesizeKeyAndWaitForFocus(element, keyCode, options) {
|
||||
// to be focused if there are no active notification anchors.
|
||||
add_task(async function testWithoutNotifications() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]});
|
||||
await BrowserTestUtils.withNewTab("https://example.com", function*() {
|
||||
yield synthesizeKeyAndWaitForFocus(gURLBar, "l", {accelKey: true})
|
||||
await BrowserTestUtils.withNewTab("https://example.com", async function() {
|
||||
await synthesizeKeyAndWaitForFocus(gURLBar, "l", {accelKey: true})
|
||||
is(document.activeElement, gURLBar.inputField, "urlbar should be focused");
|
||||
yield synthesizeKeyAndWaitForFocus(gIdentityHandler._identityBox, "VK_TAB", {shiftKey: true})
|
||||
await synthesizeKeyAndWaitForFocus(gIdentityHandler._identityBox, "VK_TAB", {shiftKey: true})
|
||||
is(document.activeElement, gIdentityHandler._identityBox,
|
||||
"identity block should be focused");
|
||||
});
|
||||
@ -28,18 +28,18 @@ add_task(async function testWithoutNotifications() {
|
||||
// focus before the identity block.
|
||||
add_task(async function testWithoutNotifications() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]});
|
||||
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function*(browser) {
|
||||
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function(browser) {
|
||||
let popupshown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown");
|
||||
// Request a permission;
|
||||
BrowserTestUtils.synthesizeMouseAtCenter("#geo", {}, browser);
|
||||
yield popupshown;
|
||||
await popupshown;
|
||||
|
||||
yield synthesizeKeyAndWaitForFocus(gURLBar, "l", {accelKey: true})
|
||||
await synthesizeKeyAndWaitForFocus(gURLBar, "l", {accelKey: true})
|
||||
is(document.activeElement, gURLBar.inputField, "urlbar should be focused");
|
||||
let geoIcon = document.getElementById("geo-notification-icon");
|
||||
yield synthesizeKeyAndWaitForFocus(geoIcon, "VK_TAB", {shiftKey: true})
|
||||
await synthesizeKeyAndWaitForFocus(geoIcon, "VK_TAB", {shiftKey: true})
|
||||
is(document.activeElement, geoIcon, "notification anchor should be focused");
|
||||
yield synthesizeKeyAndWaitForFocus(gIdentityHandler._identityBox, "VK_TAB", {shiftKey: true})
|
||||
await synthesizeKeyAndWaitForFocus(gIdentityHandler._identityBox, "VK_TAB", {shiftKey: true})
|
||||
is(document.activeElement, gIdentityHandler._identityBox,
|
||||
"identity block should be focused");
|
||||
});
|
||||
@ -48,14 +48,14 @@ add_task(async function testWithoutNotifications() {
|
||||
// Checks that with invalid pageproxystate the identity block is ignored.
|
||||
add_task(async function testInvalidPageProxyState() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]});
|
||||
await BrowserTestUtils.withNewTab("about:blank", function*(browser) {
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(browser) {
|
||||
// Loading about:blank will automatically focus the urlbar, which, however, can
|
||||
// race with the test code. So we only send the shortcut if the urlbar isn't focused yet.
|
||||
if (document.activeElement != gURLBar.inputField) {
|
||||
yield synthesizeKeyAndWaitForFocus(gURLBar, "l", {accelKey: true})
|
||||
await synthesizeKeyAndWaitForFocus(gURLBar, "l", {accelKey: true})
|
||||
}
|
||||
is(document.activeElement, gURLBar.inputField, "urlbar should be focused");
|
||||
yield synthesizeKeyAndWaitForFocus(gBrowser.getTabForBrowser(browser), "VK_TAB", {shiftKey: true})
|
||||
await synthesizeKeyAndWaitForFocus(gBrowser.getTabForBrowser(browser), "VK_TAB", {shiftKey: true})
|
||||
isnot(document.activeElement, gIdentityHandler._identityBox,
|
||||
"identity block should not be focused");
|
||||
// Restore focus to the url bar.
|
||||
|
@ -3,10 +3,10 @@
|
||||
// Access the identity popup via mouseclick. Focus should not be moved inside.
|
||||
add_task(async function testIdentityPopupFocusClick() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]});
|
||||
await BrowserTestUtils.withNewTab("https://example.com", function*() {
|
||||
await BrowserTestUtils.withNewTab("https://example.com", async function() {
|
||||
let shown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
|
||||
EventUtils.synthesizeMouseAtCenter(gIdentityHandler._identityBox, {});
|
||||
yield shown;
|
||||
await shown;
|
||||
isnot(Services.focus.focusedElement, document.getElementById("identity-popup-security-expander"));
|
||||
});
|
||||
});
|
||||
@ -14,13 +14,13 @@ add_task(async function testIdentityPopupFocusClick() {
|
||||
// Access the identity popup via keyboard. Focus should be moved inside.
|
||||
add_task(async function testIdentityPopupFocusKeyboard() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]});
|
||||
await BrowserTestUtils.withNewTab("https://example.com", function*() {
|
||||
await BrowserTestUtils.withNewTab("https://example.com", async function() {
|
||||
let focused = BrowserTestUtils.waitForEvent(gIdentityHandler._identityBox, "focus");
|
||||
gIdentityHandler._identityBox.focus();
|
||||
yield focused;
|
||||
await focused;
|
||||
let shown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield shown;
|
||||
await shown;
|
||||
is(Services.focus.focusedElement, document.getElementById("identity-popup-security-expander"));
|
||||
});
|
||||
});
|
||||
|
@ -148,17 +148,17 @@ function testForErrors(filepath, key, str) {
|
||||
testForError(filepath, key, str, /\.\.\./, "ellipsis", "Strings with an ellipsis should use the Unicode \u2026 character instead of three periods.");
|
||||
}
|
||||
|
||||
function* getAllTheFiles(extension) {
|
||||
async function getAllTheFiles(extension) {
|
||||
let appDirGreD = Services.dirsvc.get("GreD", Ci.nsIFile);
|
||||
let appDirXCurProcD = Services.dirsvc.get("XCurProcD", Ci.nsIFile);
|
||||
if (appDirGreD.contains(appDirXCurProcD)) {
|
||||
return yield generateURIsFromDirTree(appDirGreD, [extension]);
|
||||
return await generateURIsFromDirTree(appDirGreD, [extension]);
|
||||
}
|
||||
if (appDirXCurProcD.contains(appDirGreD)) {
|
||||
return yield generateURIsFromDirTree(appDirXCurProcD, [extension]);
|
||||
return await generateURIsFromDirTree(appDirXCurProcD, [extension]);
|
||||
}
|
||||
let urisGreD = yield generateURIsFromDirTree(appDirGreD, [extension]);
|
||||
let urisXCurProcD = yield generateURIsFromDirTree(appDirXCurProcD, [extension]);
|
||||
let urisGreD = await generateURIsFromDirTree(appDirGreD, [extension]);
|
||||
let urisXCurProcD = await generateURIsFromDirTree(appDirXCurProcD, [extension]);
|
||||
return Array.from(new Set(urisGreD.concat(appDirXCurProcD)));
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,9 @@ registerCleanupFunction(function() {
|
||||
var gTests = [
|
||||
{
|
||||
desc: "Test the remote commands",
|
||||
*teardown() {
|
||||
async teardown() {
|
||||
gBrowser.removeCurrentTab();
|
||||
yield signOut();
|
||||
await signOut();
|
||||
},
|
||||
async run() {
|
||||
setPref("identity.fxaccounts.remote.signup.uri",
|
||||
@ -91,9 +91,9 @@ var gTests = [
|
||||
},
|
||||
{
|
||||
desc: "Test action=signin - user logged in",
|
||||
*teardown() {
|
||||
async teardown() {
|
||||
gBrowser.removeCurrentTab();
|
||||
yield signOut();
|
||||
await signOut();
|
||||
},
|
||||
async run() {
|
||||
// When this loads with a user logged-in, we expect the normal URL to
|
||||
@ -193,9 +193,9 @@ var gTests = [
|
||||
},
|
||||
{
|
||||
desc: "Test action=reauth",
|
||||
*teardown() {
|
||||
async teardown() {
|
||||
gBrowser.removeCurrentTab();
|
||||
yield signOut();
|
||||
await signOut();
|
||||
},
|
||||
async run() {
|
||||
const expected_url = "https://example.com/force_auth";
|
||||
@ -210,9 +210,9 @@ var gTests = [
|
||||
},
|
||||
{
|
||||
desc: "Test with migrateToDevEdition enabled (success)",
|
||||
*teardown() {
|
||||
async teardown() {
|
||||
gBrowser.removeCurrentTab();
|
||||
yield signOut();
|
||||
await signOut();
|
||||
},
|
||||
async run() {
|
||||
let fxAccountsCommon = {};
|
||||
@ -270,9 +270,9 @@ var gTests = [
|
||||
},
|
||||
{
|
||||
desc: "Test with migrateToDevEdition enabled (no user to migrate)",
|
||||
*teardown() {
|
||||
async teardown() {
|
||||
gBrowser.removeCurrentTab();
|
||||
yield signOut();
|
||||
await signOut();
|
||||
},
|
||||
async run() {
|
||||
const pref = "identity.fxaccounts.migrateToDevEdition";
|
||||
|
@ -81,11 +81,11 @@ const PROBE_TESTS = [
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
},
|
||||
|
||||
* doAction(browser) {
|
||||
async doAction(browser) {
|
||||
let pageShow =
|
||||
BrowserTestUtils.waitForContentEvent(browser, "pageshow");
|
||||
document.getElementById("Browser:Back").doCommand();
|
||||
yield pageShow;
|
||||
await pageShow;
|
||||
},
|
||||
},
|
||||
|
||||
@ -104,11 +104,11 @@ const PROBE_TESTS = [
|
||||
await pageShow;
|
||||
},
|
||||
|
||||
* doAction(browser) {
|
||||
async doAction(browser) {
|
||||
let pageShow =
|
||||
BrowserTestUtils.waitForContentEvent(browser, "pageshow");
|
||||
document.getElementById("Browser:Forward").doCommand();
|
||||
yield pageShow;
|
||||
await pageShow;
|
||||
},
|
||||
},
|
||||
|
||||
@ -126,11 +126,11 @@ const PROBE_TESTS = [
|
||||
await TabStateFlusher.flush(browser);
|
||||
},
|
||||
|
||||
* doAction(browser) {
|
||||
async doAction(browser) {
|
||||
let pageShow =
|
||||
BrowserTestUtils.waitForContentEvent(browser, "pageshow");
|
||||
synthesizeHistoryNavigationToIndex(0);
|
||||
yield pageShow;
|
||||
await pageShow;
|
||||
},
|
||||
},
|
||||
|
||||
@ -152,11 +152,11 @@ const PROBE_TESTS = [
|
||||
await TabStateFlusher.flush(browser);
|
||||
},
|
||||
|
||||
* doAction(browser) {
|
||||
async doAction(browser) {
|
||||
let pageShow =
|
||||
BrowserTestUtils.waitForContentEvent(browser, "pageshow");
|
||||
synthesizeHistoryNavigationToIndex(2);
|
||||
yield pageShow;
|
||||
await pageShow;
|
||||
},
|
||||
},
|
||||
|
||||
@ -264,11 +264,11 @@ add_task(async function test_probes() {
|
||||
await BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: "http://example.com",
|
||||
}, function*(browser) {
|
||||
}, async function(browser) {
|
||||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
info(`Test: "${probeTest.name}"`);
|
||||
|
||||
yield* probeTest.prepare(browser);
|
||||
await probeTest.prepare(browser);
|
||||
// Instead of trying to fiddle with network state or
|
||||
// anything, we'll just set this attribute to fool our
|
||||
// telemetry probes into thinking the browser is in the
|
||||
@ -276,7 +276,7 @@ add_task(async function test_probes() {
|
||||
tab.setAttribute("busy", true);
|
||||
|
||||
histogram.clear();
|
||||
yield* probeTest.doAction(browser);
|
||||
await probeTest.doAction(browser);
|
||||
let snapshot = histogram.snapshot();
|
||||
assertOnlyOneTypeSet(snapshot, probeTest.category);
|
||||
});
|
||||
|
@ -5,8 +5,8 @@ add_task(async function() {
|
||||
await PlacesUtils.keywords.insert({ keyword: "keyword",
|
||||
url: "http://example.com/?q=%s" })
|
||||
|
||||
registerCleanupFunction(function* () {
|
||||
yield PlacesUtils.bookmarks.remove(bm);
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.bookmarks.remove(bm);
|
||||
});
|
||||
|
||||
await promiseAutocompleteResultPopup("keyword search");
|
||||
|
@ -21,9 +21,9 @@ add_task(async function() {
|
||||
url: "http://example.com/keyword",
|
||||
title: "keyword abc" })));
|
||||
|
||||
registerCleanupFunction(function* () {
|
||||
registerCleanupFunction(async function() {
|
||||
for (let bm of bookmarks) {
|
||||
yield PlacesUtils.bookmarks.remove(bm);
|
||||
await PlacesUtils.bookmarks.remove(bm);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -3,8 +3,8 @@ add_task(async function() {
|
||||
url: "http://bug1105244.example.com/",
|
||||
title: "test" });
|
||||
|
||||
registerCleanupFunction(function* () {
|
||||
yield PlacesUtils.bookmarks.remove(bm);
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.bookmarks.remove(bm);
|
||||
});
|
||||
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, testDelete);
|
||||
|
@ -1,23 +1,23 @@
|
||||
const kURL = "http://example.org/browser/browser/base/content/test/urlbar/dummy_page.html";
|
||||
|
||||
function* addBookmark(bookmark) {
|
||||
async function addBookmark(bookmark) {
|
||||
if (bookmark.keyword) {
|
||||
yield PlacesUtils.keywords.insert({
|
||||
await PlacesUtils.keywords.insert({
|
||||
keyword: bookmark.keyword,
|
||||
url: bookmark.url,
|
||||
});
|
||||
}
|
||||
|
||||
let bm = yield PlacesUtils.bookmarks.insert({
|
||||
let bm = await PlacesUtils.bookmarks.insert({
|
||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||
url: bookmark.url,
|
||||
title: bookmark.title,
|
||||
});
|
||||
|
||||
registerCleanupFunction(function* () {
|
||||
yield PlacesUtils.bookmarks.remove(bm);
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.bookmarks.remove(bm);
|
||||
if (bookmark.keyword) {
|
||||
yield PlacesUtils.keywords.remove(bookmark.keyword);
|
||||
await PlacesUtils.keywords.remove(bookmark.keyword);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -8,14 +8,14 @@ add_task(async function prepare() {
|
||||
let engine = await promiseNewSearchEngine(TEST_ENGINE_BASENAME);
|
||||
let oldCurrentEngine = Services.search.currentEngine;
|
||||
Services.search.currentEngine = engine;
|
||||
registerCleanupFunction(function* () {
|
||||
registerCleanupFunction(async function() {
|
||||
Services.search.currentEngine = oldCurrentEngine;
|
||||
Services.prefs.clearUserPref(SUGGEST_ALL_PREF);
|
||||
Services.prefs.clearUserPref(SUGGEST_URLBAR_PREF);
|
||||
|
||||
// Disable the notification for future tests so it doesn't interfere with
|
||||
// them. clearUserPref() won't work because by default the pref is false.
|
||||
yield setUserMadeChoicePref(true);
|
||||
await setUserMadeChoicePref(true);
|
||||
|
||||
// Make sure the popup is closed for the next test.
|
||||
gURLBar.blur();
|
||||
|
@ -102,7 +102,7 @@ add_task(async function searchSuggestionKeyboard() {
|
||||
* @param clickCallback Use this to open the urlbar popup and choose and click a
|
||||
* result.
|
||||
*/
|
||||
function* compareCounts(clickCallback) {
|
||||
async function compareCounts(clickCallback) {
|
||||
// Search events triggered by clicks (not the Return key in the urlbar) are
|
||||
// recorded in three places:
|
||||
// * BrowserUITelemetry
|
||||
@ -145,7 +145,7 @@ function* compareCounts(clickCallback) {
|
||||
{ value: engineID });
|
||||
|
||||
gURLBar.focus();
|
||||
yield clickCallback();
|
||||
await clickCallback();
|
||||
|
||||
// Now get the new counts and compare them to the old.
|
||||
|
||||
|
@ -10,19 +10,19 @@ add_task(async function() {
|
||||
return;
|
||||
}
|
||||
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, function* () {
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, async function() {
|
||||
let popupopened = BrowserTestUtils.waitForEvent(gURLBar.popup, "popupshown");
|
||||
|
||||
gURLBar.focus();
|
||||
EventUtils.synthesizeKey("a", {});
|
||||
yield popupopened;
|
||||
await popupopened;
|
||||
|
||||
// Since the current tab is blank the preferences pane will load there
|
||||
let loaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
let popupclosed = BrowserTestUtils.waitForEvent(gURLBar.popup, "popuphidden");
|
||||
EventUtils.synthesizeMouseAtCenter(button, {});
|
||||
yield loaded;
|
||||
yield popupclosed;
|
||||
await loaded;
|
||||
await popupclosed;
|
||||
|
||||
is(gBrowser.selectedBrowser.currentURI.spec, "about:preferences#general",
|
||||
"Should have loaded the right page");
|
||||
|
@ -237,7 +237,7 @@ var gTests = [
|
||||
|
||||
{
|
||||
desc: "getUserMedia prompt: Always/Never Share",
|
||||
run: function* checkRememberCheckbox() {
|
||||
run: async function checkRememberCheckbox() {
|
||||
let elt = id => document.getElementById(id);
|
||||
|
||||
async function checkPerm(aRequestAudio, aRequestVideo,
|
||||
@ -294,25 +294,25 @@ var gTests = [
|
||||
|
||||
// 3 cases where the user accepts the device prompt.
|
||||
info("audio+video, user grants, expect both perms set to allow");
|
||||
yield checkPerm(true, true, true, true);
|
||||
await checkPerm(true, true, true, true);
|
||||
info("audio only, user grants, check audio perm set to allow, video perm not set");
|
||||
yield checkPerm(true, false, true, undefined);
|
||||
await checkPerm(true, false, true, undefined);
|
||||
info("video only, user grants, check video perm set to allow, audio perm not set");
|
||||
yield checkPerm(false, true, undefined, true);
|
||||
await checkPerm(false, true, undefined, true);
|
||||
|
||||
// 3 cases where the user rejects the device request by using 'Never Share'.
|
||||
info("audio only, user denies, expect audio perm set to deny, video not set");
|
||||
yield checkPerm(true, false, false, undefined, true);
|
||||
await checkPerm(true, false, false, undefined, true);
|
||||
info("video only, user denies, expect video perm set to deny, audio perm not set");
|
||||
yield checkPerm(false, true, undefined, false, true);
|
||||
await checkPerm(false, true, undefined, false, true);
|
||||
info("audio+video, user denies, expect both perms set to deny");
|
||||
yield checkPerm(true, true, false, false, true);
|
||||
await checkPerm(true, true, false, false, true);
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
desc: "getUserMedia without prompt: use persistent permissions",
|
||||
run: function* checkUsePersistentPermissions() {
|
||||
run: async function checkUsePersistentPermissions() {
|
||||
async function usePerm(aAllowAudio, aAllowVideo, aRequestAudio, aRequestVideo,
|
||||
aExpectStream) {
|
||||
let Perms = Services.perms;
|
||||
@ -377,63 +377,63 @@ var gTests = [
|
||||
|
||||
// Set both permissions identically
|
||||
info("allow audio+video, request audio+video, expect ok (audio+video)");
|
||||
yield usePerm(true, true, true, true, true);
|
||||
await usePerm(true, true, true, true, true);
|
||||
info("deny audio+video, request audio+video, expect denied");
|
||||
yield usePerm(false, false, true, true, false);
|
||||
await usePerm(false, false, true, true, false);
|
||||
|
||||
// Allow audio, deny video.
|
||||
info("allow audio, deny video, request audio+video, expect denied");
|
||||
yield usePerm(true, false, true, true, false);
|
||||
await usePerm(true, false, true, true, false);
|
||||
info("allow audio, deny video, request audio, expect ok (audio)");
|
||||
yield usePerm(true, false, true, false, true);
|
||||
await usePerm(true, false, true, false, true);
|
||||
info("allow audio, deny video, request video, expect denied");
|
||||
yield usePerm(true, false, false, true, false);
|
||||
await usePerm(true, false, false, true, false);
|
||||
|
||||
// Deny audio, allow video.
|
||||
info("deny audio, allow video, request audio+video, expect denied");
|
||||
yield usePerm(false, true, true, true, false);
|
||||
await usePerm(false, true, true, true, false);
|
||||
info("deny audio, allow video, request audio, expect denied");
|
||||
yield usePerm(false, true, true, false, false);
|
||||
await usePerm(false, true, true, false, false);
|
||||
info("deny audio, allow video, request video, expect ok (video)");
|
||||
yield usePerm(false, true, false, true, true);
|
||||
await usePerm(false, true, false, true, true);
|
||||
|
||||
// Allow audio, video not set.
|
||||
info("allow audio, request audio+video, expect prompt");
|
||||
yield usePerm(true, undefined, true, true, undefined);
|
||||
await usePerm(true, undefined, true, true, undefined);
|
||||
info("allow audio, request audio, expect ok (audio)");
|
||||
yield usePerm(true, undefined, true, false, true);
|
||||
await usePerm(true, undefined, true, false, true);
|
||||
info("allow audio, request video, expect prompt");
|
||||
yield usePerm(true, undefined, false, true, undefined);
|
||||
await usePerm(true, undefined, false, true, undefined);
|
||||
|
||||
// Deny audio, video not set.
|
||||
info("deny audio, request audio+video, expect denied");
|
||||
yield usePerm(false, undefined, true, true, false);
|
||||
await usePerm(false, undefined, true, true, false);
|
||||
info("deny audio, request audio, expect denied");
|
||||
yield usePerm(false, undefined, true, false, false);
|
||||
await usePerm(false, undefined, true, false, false);
|
||||
info("deny audio, request video, expect prompt");
|
||||
yield usePerm(false, undefined, false, true, undefined);
|
||||
await usePerm(false, undefined, false, true, undefined);
|
||||
|
||||
// Allow video, audio not set.
|
||||
info("allow video, request audio+video, expect prompt");
|
||||
yield usePerm(undefined, true, true, true, undefined);
|
||||
await usePerm(undefined, true, true, true, undefined);
|
||||
info("allow video, request audio, expect prompt");
|
||||
yield usePerm(undefined, true, true, false, undefined);
|
||||
await usePerm(undefined, true, true, false, undefined);
|
||||
info("allow video, request video, expect ok (video)");
|
||||
yield usePerm(undefined, true, false, true, true);
|
||||
await usePerm(undefined, true, false, true, true);
|
||||
|
||||
// Deny video, audio not set.
|
||||
info("deny video, request audio+video, expect denied");
|
||||
yield usePerm(undefined, false, true, true, false);
|
||||
await usePerm(undefined, false, true, true, false);
|
||||
info("deny video, request audio, expect prompt");
|
||||
yield usePerm(undefined, false, true, false, undefined);
|
||||
await usePerm(undefined, false, true, false, undefined);
|
||||
info("deny video, request video, expect denied");
|
||||
yield usePerm(undefined, false, false, true, false);
|
||||
await usePerm(undefined, false, false, true, false);
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
desc: "Stop Sharing removes persistent permissions",
|
||||
run: function* checkStopSharingRemovesPersistentPermissions() {
|
||||
run: async function checkStopSharingRemovesPersistentPermissions() {
|
||||
async function stopAndCheckPerm(aRequestAudio, aRequestVideo) {
|
||||
let Perms = Services.perms;
|
||||
let uri = gBrowser.selectedBrowser.documentURI;
|
||||
@ -477,11 +477,11 @@ var gTests = [
|
||||
}
|
||||
|
||||
info("request audio+video, stop sharing resets both");
|
||||
yield stopAndCheckPerm(true, true);
|
||||
await stopAndCheckPerm(true, true);
|
||||
info("request audio, stop sharing resets audio only");
|
||||
yield stopAndCheckPerm(true, false);
|
||||
await stopAndCheckPerm(true, false);
|
||||
info("request video, stop sharing resets video only");
|
||||
yield stopAndCheckPerm(false, true);
|
||||
await stopAndCheckPerm(false, true);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -5,7 +5,7 @@ var gTests = [
|
||||
|
||||
{
|
||||
desc: "device sharing animation on background tabs",
|
||||
run: function* checkAudioVideo() {
|
||||
run: async function checkAudioVideo() {
|
||||
async function getStreamAndCheckBackgroundAnim(aAudio, aVideo, aSharing) {
|
||||
// Get a stream
|
||||
let popupPromise = promisePopupNotificationShown("webRTC-shareDevices");
|
||||
@ -64,9 +64,9 @@ var gTests = [
|
||||
"the tab no longer has the 'sharing' attribute after closing the stream");
|
||||
}
|
||||
|
||||
yield getStreamAndCheckBackgroundAnim(true, true, "camera");
|
||||
yield getStreamAndCheckBackgroundAnim(false, true, "camera");
|
||||
yield getStreamAndCheckBackgroundAnim(true, false, "microphone");
|
||||
await getStreamAndCheckBackgroundAnim(true, true, "camera");
|
||||
await getStreamAndCheckBackgroundAnim(false, true, "camera");
|
||||
await getStreamAndCheckBackgroundAnim(true, false, "microphone");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ var gTests = [
|
||||
|
||||
{
|
||||
desc: "getUserMedia audio+video+screen: stop sharing",
|
||||
run: function* checkStopSharing() {
|
||||
run: async function checkStopSharing() {
|
||||
if (AppConstants.platform == "macosx") {
|
||||
todo(false, "Bug 1323481 - On Mac on treeherder, but not locally, requesting microphone + screen never makes the permission prompt appear, and so causes the test to timeout");
|
||||
return;
|
||||
@ -384,46 +384,46 @@ var gTests = [
|
||||
await expectObserverCalled("recording-device-events");
|
||||
}
|
||||
|
||||
function* check(expected = {}) {
|
||||
async function check(expected = {}) {
|
||||
let shared = Object.keys(expected).join(" and ");
|
||||
if (shared) {
|
||||
Assert.deepEqual((yield getMediaCaptureState()), expected,
|
||||
Assert.deepEqual((await getMediaCaptureState()), expected,
|
||||
"expected " + shared + " to be shared");
|
||||
yield checkSharingUI(expected);
|
||||
await checkSharingUI(expected);
|
||||
} else {
|
||||
yield checkNotSharing();
|
||||
await checkNotSharing();
|
||||
}
|
||||
}
|
||||
|
||||
info("Share screen and microphone");
|
||||
let indicator = promiseIndicatorWindow();
|
||||
yield share(true, false, true);
|
||||
yield indicator;
|
||||
yield check({audio: true, screen: "Screen"});
|
||||
await share(true, false, true);
|
||||
await indicator;
|
||||
await check({audio: true, screen: "Screen"});
|
||||
|
||||
info("Share camera");
|
||||
yield share(false, true);
|
||||
yield check({video: true, audio: true, screen: "Screen"});
|
||||
await share(false, true);
|
||||
await check({video: true, audio: true, screen: "Screen"});
|
||||
|
||||
info("Stop the screen share, mic+cam should continue");
|
||||
yield stopSharing("screen", true);
|
||||
yield check({video: true, audio: true});
|
||||
await stopSharing("screen", true);
|
||||
await check({video: true, audio: true});
|
||||
|
||||
info("Stop the camera, everything should stop.");
|
||||
yield stopSharing("camera");
|
||||
await stopSharing("camera");
|
||||
|
||||
info("Now, share only the screen...");
|
||||
indicator = promiseIndicatorWindow();
|
||||
yield share(false, false, true);
|
||||
yield indicator;
|
||||
yield check({screen: "Screen"});
|
||||
await share(false, false, true);
|
||||
await indicator;
|
||||
await check({screen: "Screen"});
|
||||
|
||||
info("... and add camera and microphone in a second request.");
|
||||
yield share(true, true);
|
||||
yield check({video: true, audio: true, screen: "Screen"});
|
||||
await share(true, true);
|
||||
await check({video: true, audio: true, screen: "Screen"});
|
||||
|
||||
info("Stop the camera, this should stop everything.");
|
||||
yield stopSharing("camera");
|
||||
await stopSharing("camera");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -70,10 +70,10 @@ const Events = {
|
||||
var gTests = [
|
||||
{
|
||||
desc: "Basic peer-request-allowed event",
|
||||
run: function* testPeerRequestEvent(browser) {
|
||||
run: async function testPeerRequestEvent(browser) {
|
||||
Events.on();
|
||||
|
||||
yield tryPeerConnection(browser);
|
||||
await tryPeerConnection(browser);
|
||||
|
||||
let details = Events.expect("peer-request-allowed");
|
||||
isnot(details.callID, undefined, "peer-request-allowed event includes callID");
|
||||
@ -85,7 +85,7 @@ var gTests = [
|
||||
|
||||
{
|
||||
desc: "Immediate peer connection blocker can allow",
|
||||
run: function* testBlocker(browser) {
|
||||
run: async function testBlocker(browser) {
|
||||
Events.on();
|
||||
|
||||
let blockerCalled = false;
|
||||
@ -97,7 +97,7 @@ var gTests = [
|
||||
|
||||
webrtcUI.addPeerConnectionBlocker(blocker);
|
||||
|
||||
yield tryPeerConnection(browser);
|
||||
await tryPeerConnection(browser);
|
||||
is(blockerCalled, true, "Blocker was called");
|
||||
Events.expect("peer-request-allowed");
|
||||
|
||||
@ -108,13 +108,13 @@ var gTests = [
|
||||
|
||||
{
|
||||
desc: "Deferred peer connection blocker can allow",
|
||||
run: function* testDeferredBlocker(browser) {
|
||||
run: async function testDeferredBlocker(browser) {
|
||||
Events.on();
|
||||
|
||||
let blocker = params => Promise.resolve("allow");
|
||||
webrtcUI.addPeerConnectionBlocker(blocker);
|
||||
|
||||
yield tryPeerConnection(browser);
|
||||
await tryPeerConnection(browser);
|
||||
Events.expect("peer-request-allowed");
|
||||
|
||||
webrtcUI.removePeerConnectionBlocker(blocker);
|
||||
@ -124,13 +124,13 @@ var gTests = [
|
||||
|
||||
{
|
||||
desc: "Immediate peer connection blocker can deny",
|
||||
run: function* testBlockerDeny(browser) {
|
||||
run: async function testBlockerDeny(browser) {
|
||||
Events.on();
|
||||
|
||||
let blocker = params => "deny";
|
||||
webrtcUI.addPeerConnectionBlocker(blocker);
|
||||
|
||||
yield tryPeerConnection(browser, "NotAllowedError");
|
||||
await tryPeerConnection(browser, "NotAllowedError");
|
||||
|
||||
Events.expect("peer-request-blocked");
|
||||
|
||||
@ -141,7 +141,7 @@ var gTests = [
|
||||
|
||||
{
|
||||
desc: "Multiple blockers work (both allow)",
|
||||
run: function* testMultipleAllowBlockers(browser) {
|
||||
run: async function testMultipleAllowBlockers(browser) {
|
||||
Events.on();
|
||||
|
||||
let blocker1Called = false, blocker1 = params => {
|
||||
@ -156,7 +156,7 @@ var gTests = [
|
||||
};
|
||||
webrtcUI.addPeerConnectionBlocker(blocker2);
|
||||
|
||||
yield tryPeerConnection(browser);
|
||||
await tryPeerConnection(browser);
|
||||
|
||||
Events.expect("peer-request-allowed");
|
||||
ok(blocker1Called, "First blocker was called");
|
||||
@ -170,7 +170,7 @@ var gTests = [
|
||||
|
||||
{
|
||||
desc: "Multiple blockers work (allow then deny)",
|
||||
run: function* testAllowDenyBlockers(browser) {
|
||||
run: async function testAllowDenyBlockers(browser) {
|
||||
Events.on();
|
||||
|
||||
let blocker1Called = false, blocker1 = params => {
|
||||
@ -185,7 +185,7 @@ var gTests = [
|
||||
};
|
||||
webrtcUI.addPeerConnectionBlocker(blocker2);
|
||||
|
||||
yield tryPeerConnection(browser, "NotAllowedError");
|
||||
await tryPeerConnection(browser, "NotAllowedError");
|
||||
|
||||
Events.expect("peer-request-blocked");
|
||||
ok(blocker1Called, "First blocker was called");
|
||||
@ -199,7 +199,7 @@ var gTests = [
|
||||
|
||||
{
|
||||
desc: "Multiple blockers work (deny first)",
|
||||
run: function* testDenyAllowBlockers(browser) {
|
||||
run: async function testDenyAllowBlockers(browser) {
|
||||
Events.on();
|
||||
|
||||
let blocker1Called = false, blocker1 = params => {
|
||||
@ -214,7 +214,7 @@ var gTests = [
|
||||
}
|
||||
webrtcUI.addPeerConnectionBlocker(blocker2);
|
||||
|
||||
yield tryPeerConnection(browser, "NotAllowedError");
|
||||
await tryPeerConnection(browser, "NotAllowedError");
|
||||
|
||||
Events.expect("peer-request-blocked");
|
||||
ok(blocker1Called, "First blocker was called");
|
||||
@ -228,7 +228,7 @@ var gTests = [
|
||||
|
||||
{
|
||||
desc: "Blockers may be removed",
|
||||
run: function* testRemoveBlocker(browser) {
|
||||
run: async function testRemoveBlocker(browser) {
|
||||
Events.on();
|
||||
|
||||
let blocker1Called = false, blocker1 = params => {
|
||||
@ -244,7 +244,7 @@ var gTests = [
|
||||
webrtcUI.addPeerConnectionBlocker(blocker2);
|
||||
webrtcUI.removePeerConnectionBlocker(blocker1);
|
||||
|
||||
yield tryPeerConnection(browser);
|
||||
await tryPeerConnection(browser);
|
||||
|
||||
Events.expect("peer-request-allowed");
|
||||
|
||||
@ -258,7 +258,7 @@ var gTests = [
|
||||
|
||||
{
|
||||
desc: "Blocker that throws is ignored",
|
||||
run: function* testBlockerThrows(browser) {
|
||||
run: async function testBlockerThrows(browser) {
|
||||
Events.on();
|
||||
let blocker1Called = false, blocker1 = params => {
|
||||
blocker1Called = true;
|
||||
@ -272,7 +272,7 @@ var gTests = [
|
||||
};
|
||||
webrtcUI.addPeerConnectionBlocker(blocker2);
|
||||
|
||||
yield tryPeerConnection(browser);
|
||||
await tryPeerConnection(browser);
|
||||
|
||||
Events.expect("peer-request-allowed");
|
||||
ok(blocker1Called, "First blocker was invoked");
|
||||
|
@ -441,7 +441,7 @@ function checkDeviceSelectors(aAudio, aVideo, aScreen) {
|
||||
|
||||
// aExpected is for the current tab,
|
||||
// aExpectedGlobal is for all tabs.
|
||||
function* checkSharingUI(aExpected, aWin = window, aExpectedGlobal = null) {
|
||||
async function checkSharingUI(aExpected, aWin = window, aExpectedGlobal = null) {
|
||||
let doc = aWin.document;
|
||||
// First check the icon above the control center (i) icon.
|
||||
let identityBox = doc.getElementById("identity-box");
|
||||
@ -485,17 +485,17 @@ function* checkSharingUI(aExpected, aWin = window, aExpectedGlobal = null) {
|
||||
aWin.gIdentityHandler._identityPopup.hidden = true;
|
||||
|
||||
// Check the global indicators.
|
||||
yield* assertWebRTCIndicatorStatus(aExpectedGlobal || aExpected);
|
||||
await assertWebRTCIndicatorStatus(aExpectedGlobal || aExpected);
|
||||
}
|
||||
|
||||
function* checkNotSharing() {
|
||||
Assert.deepEqual((yield getMediaCaptureState()), {},
|
||||
async function checkNotSharing() {
|
||||
Assert.deepEqual((await getMediaCaptureState()), {},
|
||||
"expected nothing to be shared");
|
||||
|
||||
ok(!document.getElementById("identity-box").hasAttribute("sharing"),
|
||||
"no sharing indicator on the control center icon");
|
||||
|
||||
yield* assertWebRTCIndicatorStatus(null);
|
||||
await assertWebRTCIndicatorStatus(null);
|
||||
}
|
||||
|
||||
function promiseReloadFrame(aFrameId) {
|
||||
|
@ -160,15 +160,15 @@ async function test_cookie_cleared() {
|
||||
}
|
||||
|
||||
// Cache
|
||||
function* test_cache_cleared() {
|
||||
async function test_cache_cleared() {
|
||||
// First, add some caches.
|
||||
for (let userContextId of Object.keys(USER_CONTEXTS)) {
|
||||
yield OpenCacheEntry("http://" + TEST_HOST + "/",
|
||||
await OpenCacheEntry("http://" + TEST_HOST + "/",
|
||||
"disk",
|
||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||
LoadContextInfo.custom(false, {userContextId}));
|
||||
|
||||
yield OpenCacheEntry("http://" + TEST_HOST + "/",
|
||||
await OpenCacheEntry("http://" + TEST_HOST + "/",
|
||||
"memory",
|
||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||
LoadContextInfo.custom(false, {userContextId}));
|
||||
@ -185,7 +185,7 @@ function* test_cache_cleared() {
|
||||
}
|
||||
|
||||
// Forget the site.
|
||||
yield ForgetAboutSite.removeDataFromDomain(TEST_HOST);
|
||||
await ForgetAboutSite.removeDataFromDomain(TEST_HOST);
|
||||
|
||||
// Check that do caches be removed or not?
|
||||
for (let userContextId of Object.keys(USER_CONTEXTS)) {
|
||||
|
@ -1039,7 +1039,7 @@ CustomizeMode.prototype = {
|
||||
return toolbarItem;
|
||||
},
|
||||
|
||||
*_wrapToolbarItem(aArea) {
|
||||
async _wrapToolbarItem(aArea) {
|
||||
let target = CustomizableUI.getCustomizeTargetForArea(aArea, this.window);
|
||||
if (!target || this.areas.has(target)) {
|
||||
return null;
|
||||
@ -1048,7 +1048,7 @@ CustomizeMode.prototype = {
|
||||
this._addDragHandlers(target);
|
||||
for (let child of target.children) {
|
||||
if (this.isCustomizableItem(child) && !this.isWrappedToolbarItem(child)) {
|
||||
yield this.deferredWrapToolbarItem(child, CustomizableUI.getPlaceForItem(child)).then(null, log.error);
|
||||
await this.deferredWrapToolbarItem(child, CustomizableUI.getPlaceForItem(child)).then(null, log.error);
|
||||
}
|
||||
}
|
||||
this.areas.add(target);
|
||||
@ -1076,9 +1076,9 @@ CustomizeMode.prototype = {
|
||||
return target;
|
||||
},
|
||||
|
||||
*_wrapToolbarItems() {
|
||||
async _wrapToolbarItems() {
|
||||
for (let area of CustomizableUI.areas) {
|
||||
yield this._wrapToolbarItem(area);
|
||||
await this._wrapToolbarItem(area);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -9,14 +9,14 @@ var globalClipboard;
|
||||
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({set: [["browser.photon.structure.enabled", false]]});
|
||||
await BrowserTestUtils.withNewTab({gBrowser, url: "about:blank"}, function*() {
|
||||
await BrowserTestUtils.withNewTab({gBrowser, url: "about:blank"}, async function() {
|
||||
info("Check copy button existence and functionality");
|
||||
|
||||
let testText = "copy text test";
|
||||
|
||||
gURLBar.focus();
|
||||
info("The URL bar was focused");
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
info("Menu panel was opened");
|
||||
|
||||
let copyButton = document.getElementById("copy-button");
|
||||
@ -27,7 +27,7 @@ add_task(async function() {
|
||||
gURLBar.value = testText;
|
||||
gURLBar.focus();
|
||||
gURLBar.select();
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
info("Menu panel was opened");
|
||||
|
||||
ok(!copyButton.hasAttribute("disabled"), "Copy button is enabled when selecting");
|
||||
|
@ -9,13 +9,13 @@ var globalClipboard;
|
||||
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({set: [["browser.photon.structure.enabled", false]]});
|
||||
await BrowserTestUtils.withNewTab({gBrowser, url: "about:blank"}, function*() {
|
||||
await BrowserTestUtils.withNewTab({gBrowser, url: "about:blank"}, async function() {
|
||||
info("Check cut button existence and functionality");
|
||||
|
||||
let testText = "cut text test";
|
||||
|
||||
gURLBar.focus();
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
info("Menu panel was opened");
|
||||
|
||||
let cutButton = document.getElementById("cut-button");
|
||||
@ -26,7 +26,7 @@ add_task(async function() {
|
||||
gURLBar.value = testText;
|
||||
gURLBar.focus();
|
||||
gURLBar.select();
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
info("Menu panel was opened");
|
||||
|
||||
ok(!cutButton.hasAttribute("disabled"), "Cut button is enabled when selecting");
|
||||
|
@ -9,13 +9,13 @@ var globalClipboard;
|
||||
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({set: [["browser.photon.structure.enabled", false]]});
|
||||
await BrowserTestUtils.withNewTab({gBrowser, url: "about:blank"}, function*() {
|
||||
await BrowserTestUtils.withNewTab({gBrowser, url: "about:blank"}, async function() {
|
||||
info("Check paste button existence and functionality");
|
||||
|
||||
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
|
||||
globalClipboard = Services.clipboard.kGlobalClipboard;
|
||||
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
info("Menu panel was opened");
|
||||
|
||||
let pasteButton = document.getElementById("paste-button");
|
||||
@ -27,7 +27,7 @@ add_task(async function() {
|
||||
|
||||
// test paste button by pasting text to URL bar
|
||||
gURLBar.focus();
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
info("Menu panel was opened");
|
||||
|
||||
ok(!pasteButton.hasAttribute("disabled"), "Paste button is enabled");
|
||||
|
@ -149,7 +149,7 @@ add_task(async function testSecondaryActionWorkflow() {
|
||||
url: "about:blank"
|
||||
};
|
||||
|
||||
await BrowserTestUtils.withNewTab(options, function*(browser) {
|
||||
await BrowserTestUtils.withNewTab(options, async function(browser) {
|
||||
let doc = browser.ownerDocument;
|
||||
|
||||
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is closed.");
|
||||
@ -173,16 +173,16 @@ add_task(async function testSecondaryActionWorkflow() {
|
||||
|
||||
is(PanelUI.menuButton.getAttribute("badge-status"), "update-manual", "Badge is displaying on PanelUI button.");
|
||||
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
isnot(PanelUI.menuButton.getAttribute("badge-status"), "update-manual", "Badge is hidden on PanelUI button.");
|
||||
let menuItem = PanelUI.mainView.querySelector(".panel-banner-item");
|
||||
is(menuItem.label, menuItem.getAttribute("label-update-manual"), "Showing correct label");
|
||||
is(menuItem.hidden, false, "update-manual menu item is showing.");
|
||||
|
||||
yield PanelUI.hide();
|
||||
await PanelUI.hide();
|
||||
is(PanelUI.menuButton.getAttribute("badge-status"), "update-manual", "Badge is shown on PanelUI button.");
|
||||
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
menuItem.click();
|
||||
ok(mainActionCalled, "Main action callback was called");
|
||||
|
||||
@ -197,7 +197,7 @@ add_task(async function testSecondaryActionWorkflow() {
|
||||
* then we display any other badges that are remaining.
|
||||
*/
|
||||
add_task(async function testInteractionWithBadges() {
|
||||
await BrowserTestUtils.withNewTab("about:blank", function*(browser) {
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(browser) {
|
||||
let doc = browser.ownerDocument;
|
||||
|
||||
PanelUI.showBadgeOnlyNotification("fxa-needs-authentication");
|
||||
@ -224,7 +224,7 @@ add_task(async function testInteractionWithBadges() {
|
||||
|
||||
is(PanelUI.menuButton.getAttribute("badge-status"), "update-manual", "Badge is displaying on PanelUI button.");
|
||||
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
isnot(PanelUI.menuButton.getAttribute("badge-status"), "update-manual", "Badge is hidden on PanelUI button.");
|
||||
let menuItem = PanelUI.mainView.querySelector(".panel-banner-item");
|
||||
is(menuItem.label, menuItem.getAttribute("label-update-manual"), "Showing correct label");
|
||||
@ -276,7 +276,7 @@ add_task(async function testAddingBadgeWhileDoorhangerIsShowing() {
|
||||
* Tests that badges operate like a stack.
|
||||
*/
|
||||
add_task(async function testMultipleBadges() {
|
||||
await BrowserTestUtils.withNewTab("about:blank", function*(browser) {
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(browser) {
|
||||
let doc = browser.ownerDocument;
|
||||
let menuButton = doc.getElementById("PanelUI-menu-button");
|
||||
|
||||
@ -307,7 +307,7 @@ add_task(async function testMultipleBadges() {
|
||||
PanelUI.removeNotification(/^fxa-/);
|
||||
is(menuButton.hasAttribute("badge-status"), false, "Should not have a badge status");
|
||||
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
is(menuButton.hasAttribute("badge-status"), false, "Should not have a badge status (Hamburger menu opened)");
|
||||
PanelUI.hide();
|
||||
|
||||
@ -322,7 +322,7 @@ add_task(async function testMultipleBadges() {
|
||||
* Tests that non-badges also operate like a stack.
|
||||
*/
|
||||
add_task(async function testMultipleNonBadges() {
|
||||
await BrowserTestUtils.withNewTab("about:blank", function*(browser) {
|
||||
await BrowserTestUtils.withNewTab("about:blank", async function(browser) {
|
||||
let doc = browser.ownerDocument;
|
||||
|
||||
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is closed.");
|
||||
@ -361,7 +361,7 @@ add_task(async function testMultipleNonBadges() {
|
||||
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is closed.");
|
||||
is(PanelUI.menuButton.getAttribute("badge-status"), "update-restart", "update-restart badge is displaying on PanelUI button.");
|
||||
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
isnot(PanelUI.menuButton.getAttribute("badge-status"), "update-restart", "update-restart badge is hidden on PanelUI button.");
|
||||
let menuItem = PanelUI.mainView.querySelector(".panel-banner-item");
|
||||
is(menuItem.label, menuItem.getAttribute("label-update-restart"), "Showing correct label");
|
||||
@ -373,7 +373,7 @@ add_task(async function testMultipleNonBadges() {
|
||||
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is closed.");
|
||||
is(PanelUI.menuButton.getAttribute("badge-status"), "update-manual", "update-manual badge is displaying on PanelUI button.");
|
||||
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
isnot(PanelUI.menuButton.getAttribute("badge-status"), "update-manual", "update-manual badge is hidden on PanelUI button.");
|
||||
is(menuItem.label, menuItem.getAttribute("label-update-manual"), "Showing correct label");
|
||||
is(menuItem.hidden, false, "update-manual menu item is showing.");
|
||||
|
@ -118,10 +118,10 @@ function panelUIHide() {
|
||||
return panelHidePromise;
|
||||
}
|
||||
|
||||
function* asyncCleanup() {
|
||||
async function asyncCleanup() {
|
||||
Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri");
|
||||
// reset the panel UI to the default state
|
||||
yield resetCustomization();
|
||||
await resetCustomization();
|
||||
ok(CustomizableUI.inDefaultState, "The panel UI is in default state again.");
|
||||
|
||||
// restore the tabs
|
||||
|
@ -3,8 +3,8 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
registerCleanupFunction(function*() {
|
||||
yield task_resetState();
|
||||
registerCleanupFunction(async function() {
|
||||
await task_resetState();
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
registerCleanupFunction(() => {});
|
||||
|
||||
function* assertDialogResult({ args, buttonToClick, expectedResult }) {
|
||||
async function assertDialogResult({ args, buttonToClick, expectedResult }) {
|
||||
promiseAlertDialogOpen(buttonToClick);
|
||||
is(yield DownloadsCommon.confirmUnblockDownload(args), expectedResult);
|
||||
is(await DownloadsCommon.confirmUnblockDownload(args), expectedResult);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -14,9 +14,9 @@ add_task(async function test_first_download_panel() {
|
||||
let oldPrefValue = Services.prefs.getBoolPref("browser.download.panel.shown");
|
||||
Services.prefs.setBoolPref("browser.download.panel.shown", false);
|
||||
|
||||
registerCleanupFunction(function*() {
|
||||
registerCleanupFunction(async function() {
|
||||
// Clean up when the test finishes.
|
||||
yield task_resetState();
|
||||
await task_resetState();
|
||||
|
||||
// Set the preference instead of clearing it afterwards to ensure the
|
||||
// right value is used no matter what the default was. This ensures the
|
||||
|
@ -6,9 +6,9 @@
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "HttpServer",
|
||||
"resource://testing-common/httpd.js");
|
||||
|
||||
registerCleanupFunction(function*() {
|
||||
yield task_resetState();
|
||||
yield task_clearHistory();
|
||||
registerCleanupFunction(async function() {
|
||||
await task_resetState();
|
||||
await task_clearHistory();
|
||||
});
|
||||
|
||||
add_task(async function test_indicatorDrop() {
|
||||
|
@ -6,9 +6,9 @@
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "HttpServer",
|
||||
"resource://testing-common/httpd.js");
|
||||
|
||||
registerCleanupFunction(function*() {
|
||||
yield task_resetState();
|
||||
yield task_clearHistory();
|
||||
registerCleanupFunction(async function() {
|
||||
await task_resetState();
|
||||
await task_clearHistory();
|
||||
});
|
||||
|
||||
add_task(async function test_indicatorDrop() {
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
registerCleanupFunction(function*() {
|
||||
registerCleanupFunction(async function() {
|
||||
// Clean up when the test finishes.
|
||||
yield task_resetState();
|
||||
await task_resetState();
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -147,10 +147,10 @@ async function task_resetState() {
|
||||
await promiseFocus();
|
||||
}
|
||||
|
||||
function* task_addDownloads(aItems) {
|
||||
async function task_addDownloads(aItems) {
|
||||
let startTimeMs = Date.now();
|
||||
|
||||
let publicList = yield Downloads.getList(Downloads.PUBLIC);
|
||||
let publicList = await Downloads.getList(Downloads.PUBLIC);
|
||||
for (let item of aItems) {
|
||||
let download = {
|
||||
source: {
|
||||
@ -172,7 +172,7 @@ function* task_addDownloads(aItems) {
|
||||
if (item.errorObj) {
|
||||
download.errorObj = item.errorObj;
|
||||
}
|
||||
yield publicList.add(yield Downloads.createDownload(download));
|
||||
await publicList.add(await Downloads.createDownload(download));
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ async function task_openPanel() {
|
||||
await promise;
|
||||
}
|
||||
|
||||
function* setDownloadDir() {
|
||||
async function setDownloadDir() {
|
||||
let tmpDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
|
||||
tmpDir.append("testsavedir");
|
||||
if (!tmpDir.exists()) {
|
||||
@ -198,7 +198,7 @@ function* setDownloadDir() {
|
||||
});
|
||||
}
|
||||
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
await SpecialPowers.pushPrefEnv({"set": [
|
||||
["browser.download.folderList", 2],
|
||||
["browser.download.dir", tmpDir, Ci.nsIFile],
|
||||
]});
|
||||
|
@ -9,7 +9,7 @@ var browserAreas = {
|
||||
"personaltoolbar": CustomizableUI.AREA_BOOKMARKS,
|
||||
};
|
||||
|
||||
function* testInArea(area) {
|
||||
async function testInArea(area) {
|
||||
let manifest = {
|
||||
"browser_action": {
|
||||
"browser_style": true,
|
||||
@ -21,11 +21,11 @@ function* testInArea(area) {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest,
|
||||
});
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
let widget = getBrowserActionWidget(extension);
|
||||
let placement = CustomizableUI.getPlacementOfWidget(widget.id);
|
||||
is(placement && placement.area, browserAreas[area || "navbar"], `widget located in correct area`);
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
add_task(async function testBrowserActionDefaultArea() {
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
function* runTests(options) {
|
||||
async function runTests(options) {
|
||||
async function background(getTests) {
|
||||
async function checkDetails(expecting, tabId) {
|
||||
let title = await browser.browserAction.getTitle({tabId});
|
||||
@ -137,11 +137,11 @@ function* runTests(options) {
|
||||
});
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield awaitFinish;
|
||||
await awaitFinish;
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
add_task(async function testTabSwitchContext() {
|
||||
|
@ -2,10 +2,10 @@
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
function* openPanel(extension, win = window, awaitLoad = false) {
|
||||
async function openPanel(extension, win = window, awaitLoad = false) {
|
||||
clickBrowserAction(extension, win);
|
||||
|
||||
return yield awaitExtensionPanel(extension, win, awaitLoad);
|
||||
return await awaitExtensionPanel(extension, win, awaitLoad);
|
||||
}
|
||||
|
||||
add_task(async function testBrowserActionPopupResize() {
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
function* testExecuteBrowserActionWithOptions(options = {}) {
|
||||
async function testExecuteBrowserActionWithOptions(options = {}) {
|
||||
// Make sure the mouse isn't hovering over the browserAction widget.
|
||||
EventUtils.synthesizeMouseAtCenter(gURLBar, {type: "mouseover"}, window);
|
||||
|
||||
@ -74,9 +74,9 @@ function* testExecuteBrowserActionWithOptions(options = {}) {
|
||||
EventUtils.synthesizeKey("j", {altKey: true, shiftKey: true});
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield SimpleTest.promiseFocus(window);
|
||||
await SimpleTest.promiseFocus(window);
|
||||
|
||||
if (options.inArea) {
|
||||
let widget = getBrowserActionWidget(extension);
|
||||
@ -86,16 +86,16 @@ function* testExecuteBrowserActionWithOptions(options = {}) {
|
||||
extension.sendMessage("withPopup", options.withPopup);
|
||||
|
||||
if (options.withPopup) {
|
||||
yield extension.awaitFinish("execute-browser-action-popup-opened");
|
||||
await extension.awaitFinish("execute-browser-action-popup-opened");
|
||||
|
||||
if (!getBrowserActionPopup(extension)) {
|
||||
yield awaitExtensionPanel(extension);
|
||||
await awaitExtensionPanel(extension);
|
||||
}
|
||||
yield closeBrowserAction(extension);
|
||||
await closeBrowserAction(extension);
|
||||
} else {
|
||||
yield extension.awaitFinish("execute-browser-action-on-clicked-fired");
|
||||
await extension.awaitFinish("execute-browser-action-on-clicked-fired");
|
||||
}
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
add_task(async function test_execute_browser_action_with_popup() {
|
||||
|
@ -229,13 +229,13 @@ add_task(async function test_user_defined_commands() {
|
||||
await extension.startup();
|
||||
await extension.awaitMessage("ready");
|
||||
|
||||
function* runTest(window) {
|
||||
async function runTest(window) {
|
||||
for (let testCommand of testCommands) {
|
||||
if (testCommand.shortcutMac && !testCommand.shortcut && !isMac) {
|
||||
continue;
|
||||
}
|
||||
EventUtils.synthesizeKey(testCommand.key, testCommand.modifiers, window);
|
||||
let message = yield extension.awaitMessage("oncommand");
|
||||
let message = await extension.awaitMessage("oncommand");
|
||||
is(message, testCommand.name, `Expected onCommand listener to fire with the correct name: ${testCommand.name}`);
|
||||
}
|
||||
}
|
||||
|
@ -317,15 +317,15 @@ add_task(async function testRemoveAllWithTwoExtensions() {
|
||||
await first.startup();
|
||||
await second.startup();
|
||||
|
||||
function* confirmMenuItems(...items) {
|
||||
async function confirmMenuItems(...items) {
|
||||
// Round-trip to extension to make sure that the context menu state has been
|
||||
// updated by the async contextMenus.create / contextMenus.removeAll calls.
|
||||
first.sendMessage("ping");
|
||||
second.sendMessage("ping");
|
||||
yield first.awaitMessage("pong-alpha");
|
||||
yield second.awaitMessage("pong-beta");
|
||||
await first.awaitMessage("pong-alpha");
|
||||
await second.awaitMessage("pong-beta");
|
||||
|
||||
const menu = yield openContextMenu();
|
||||
const menu = await openContextMenu();
|
||||
for (const id of ["alpha", "beta", "gamma"]) {
|
||||
const expected = items.includes(id);
|
||||
const found = menu.getElementsByAttribute("label", id);
|
||||
|
@ -161,11 +161,11 @@ add_task(async function test_onclick_frameid() {
|
||||
await extension.startup();
|
||||
await extension.awaitMessage("ready");
|
||||
|
||||
function* click(selectorOrId) {
|
||||
async function click(selectorOrId) {
|
||||
const func = (selectorOrId == "body") ? openContextMenu : openContextMenuInFrame;
|
||||
const menu = yield func(selectorOrId);
|
||||
const menu = await func(selectorOrId);
|
||||
const items = menu.getElementsByAttribute("label", "modify");
|
||||
yield closeExtensionContextMenu(items[0]);
|
||||
await closeExtensionContextMenu(items[0]);
|
||||
return extension.awaitMessage("click");
|
||||
}
|
||||
|
||||
|
@ -56,10 +56,10 @@ add_task(async function() {
|
||||
},
|
||||
});
|
||||
|
||||
function* testContext(id) {
|
||||
const menu = yield openExtensionContextMenu();
|
||||
async function testContext(id) {
|
||||
const menu = await openExtensionContextMenu();
|
||||
const items = menu.getElementsByAttribute("label", id);
|
||||
yield closeExtensionContextMenu(items[0]);
|
||||
await closeExtensionContextMenu(items[0]);
|
||||
return extension.awaitMessage("test-opened");
|
||||
}
|
||||
|
||||
|
@ -95,27 +95,27 @@ add_task(async function() {
|
||||
await extension.startup();
|
||||
await extension.awaitMessage("tab.html ready");
|
||||
|
||||
function* clickContextMenu() {
|
||||
async function clickContextMenu() {
|
||||
// Using openContextMenu instead of openExtensionContextMenu because the
|
||||
// test extension has only one context menu item.
|
||||
let extensionMenuRoot = yield openContextMenu();
|
||||
let extensionMenuRoot = await openContextMenu();
|
||||
let items = extensionMenuRoot.getElementsByAttribute("label", "tifier");
|
||||
is(items.length, 1, "Expected one context menu item");
|
||||
yield closeExtensionContextMenu(items[0]);
|
||||
await closeExtensionContextMenu(items[0]);
|
||||
// One of them is "tab", the other is "background".
|
||||
info(`onClicked from: ${yield extension.awaitMessage("onClicked-fired")}`);
|
||||
info(`onClicked from: ${yield extension.awaitMessage("onClicked-fired")}`);
|
||||
info(`onClicked from: ${await extension.awaitMessage("onClicked-fired")}`);
|
||||
info(`onClicked from: ${await extension.awaitMessage("onClicked-fired")}`);
|
||||
}
|
||||
|
||||
function* getCounts(page) {
|
||||
async function getCounts(page) {
|
||||
extension.sendMessage(page, "get-click-counts");
|
||||
return yield extension.awaitMessage("click-counts");
|
||||
return await extension.awaitMessage("click-counts");
|
||||
}
|
||||
function* resetCounts() {
|
||||
async function resetCounts() {
|
||||
extension.sendMessage("tab", "clear-click-counts");
|
||||
extension.sendMessage("background", "clear-click-counts");
|
||||
yield extension.awaitMessage("next");
|
||||
yield extension.awaitMessage("next");
|
||||
await extension.awaitMessage("next");
|
||||
await extension.awaitMessage("next");
|
||||
}
|
||||
|
||||
// During this test, at most one "onclick" attribute is expected at any time.
|
||||
@ -215,10 +215,10 @@ add_task(async function test_onclick_modifiers() {
|
||||
await extension.startup();
|
||||
await extension.awaitMessage("ready");
|
||||
|
||||
function* click(modifiers = {}) {
|
||||
const menu = yield openContextMenu();
|
||||
async function click(modifiers = {}) {
|
||||
const menu = await openContextMenu();
|
||||
const items = menu.getElementsByAttribute("label", "modify");
|
||||
yield closeExtensionContextMenu(items[0], modifiers);
|
||||
await closeExtensionContextMenu(items[0], modifiers);
|
||||
return extension.awaitMessage("click");
|
||||
}
|
||||
|
||||
|
@ -95,13 +95,13 @@ add_task(async function() {
|
||||
let winId1 = windowTracker.getId(win1);
|
||||
let winId2 = windowTracker.getId(win2);
|
||||
|
||||
function* checkWindow(kind, winId, name) {
|
||||
async function checkWindow(kind, winId, name) {
|
||||
extension.sendMessage(kind + "-check-current1");
|
||||
is((yield extension.awaitMessage("result")), winId, `${name} is on top (check 1) [${kind}]`);
|
||||
is((await extension.awaitMessage("result")), winId, `${name} is on top (check 1) [${kind}]`);
|
||||
extension.sendMessage(kind + "-check-current2");
|
||||
is((yield extension.awaitMessage("result")), winId, `${name} is on top (check 2) [${kind}]`);
|
||||
is((await extension.awaitMessage("result")), winId, `${name} is on top (check 2) [${kind}]`);
|
||||
extension.sendMessage(kind + "-check-current3");
|
||||
is((yield extension.awaitMessage("result")), winId, `${name} is on top (check 3) [${kind}]`);
|
||||
is((await extension.awaitMessage("result")), winId, `${name} is on top (check 3) [${kind}]`);
|
||||
}
|
||||
|
||||
await focusWindow(win1);
|
||||
@ -109,13 +109,13 @@ add_task(async function() {
|
||||
await focusWindow(win2);
|
||||
await checkWindow("background", winId2, "win2");
|
||||
|
||||
function* triggerPopup(win, callback) {
|
||||
yield clickBrowserAction(extension, win);
|
||||
yield awaitExtensionPanel(extension, win);
|
||||
async function triggerPopup(win, callback) {
|
||||
await clickBrowserAction(extension, win);
|
||||
await awaitExtensionPanel(extension, win);
|
||||
|
||||
yield extension.awaitMessage("popup-ready");
|
||||
await extension.awaitMessage("popup-ready");
|
||||
|
||||
yield callback();
|
||||
await callback();
|
||||
|
||||
closeBrowserAction(extension, win);
|
||||
}
|
||||
@ -123,20 +123,20 @@ add_task(async function() {
|
||||
// Set focus to some other window.
|
||||
await focusWindow(window);
|
||||
|
||||
await triggerPopup(win1, function* () {
|
||||
yield checkWindow("popup", winId1, "win1");
|
||||
await triggerPopup(win1, async function() {
|
||||
await checkWindow("popup", winId1, "win1");
|
||||
});
|
||||
|
||||
await triggerPopup(win2, function* () {
|
||||
yield checkWindow("popup", winId2, "win2");
|
||||
await triggerPopup(win2, async function() {
|
||||
await checkWindow("popup", winId2, "win2");
|
||||
});
|
||||
|
||||
function* triggerPage(winId, name) {
|
||||
async function triggerPage(winId, name) {
|
||||
extension.sendMessage("background-open-page", winId);
|
||||
yield extension.awaitMessage("page-ready");
|
||||
yield checkWindow("page", winId, name);
|
||||
await extension.awaitMessage("page-ready");
|
||||
await checkWindow("page", winId, name);
|
||||
extension.sendMessage("background-close-page", winId);
|
||||
yield extension.awaitMessage("closed");
|
||||
await extension.awaitMessage("closed");
|
||||
}
|
||||
|
||||
await triggerPage(winId1, "win1");
|
||||
|
@ -137,10 +137,10 @@ add_task(async function test_devtools_inspectedWindow_reload_ignore_cache() {
|
||||
await runReloadTestCase({
|
||||
urlParams: "test=cache",
|
||||
background, devtoolsPage,
|
||||
testCase: function* (extension) {
|
||||
testCase: async function(extension) {
|
||||
for (const testMessage of ["no-ignore-cache", "ignore-cache"]) {
|
||||
extension.sendMessage(testMessage);
|
||||
yield extension.awaitMessage("devtools_inspectedWindow_reload_checkIgnoreCache.done");
|
||||
await extension.awaitMessage("devtools_inspectedWindow_reload_checkIgnoreCache.done");
|
||||
}
|
||||
},
|
||||
});
|
||||
@ -217,14 +217,14 @@ add_task(async function test_devtools_inspectedWindow_reload_custom_user_agent()
|
||||
await runReloadTestCase({
|
||||
urlParams: "test=user-agent",
|
||||
background, devtoolsPage,
|
||||
testCase: function* (extension) {
|
||||
testCase: async function(extension) {
|
||||
extension.sendMessage("no-custom-user-agent");
|
||||
|
||||
yield extension.awaitMessage("devtools_inspectedWindow_reload_checkUserAgent.done");
|
||||
await extension.awaitMessage("devtools_inspectedWindow_reload_checkUserAgent.done");
|
||||
|
||||
extension.sendMessage("custom-user-agent");
|
||||
|
||||
yield extension.awaitMessage("devtools_inspectedWindow_reload_checkUserAgent.done");
|
||||
await extension.awaitMessage("devtools_inspectedWindow_reload_checkUserAgent.done");
|
||||
},
|
||||
});
|
||||
});
|
||||
@ -323,14 +323,14 @@ add_task(async function test_devtools_inspectedWindow_reload_injected_script() {
|
||||
await runReloadTestCase({
|
||||
urlParams: "test=injected-script&frames=3",
|
||||
background, devtoolsPage,
|
||||
testCase: function* (extension) {
|
||||
testCase: async function(extension) {
|
||||
extension.sendMessage("no-injected-script");
|
||||
|
||||
yield extension.awaitMessage("devtools_inspectedWindow_reload_injectedScript.done");
|
||||
await extension.awaitMessage("devtools_inspectedWindow_reload_injectedScript.done");
|
||||
|
||||
extension.sendMessage("injected-script");
|
||||
|
||||
yield extension.awaitMessage("devtools_inspectedWindow_reload_injectedScript.done");
|
||||
await extension.awaitMessage("devtools_inspectedWindow_reload_injectedScript.done");
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -109,14 +109,14 @@ add_task(async function() {
|
||||
let winId1 = windowTracker.getId(win1);
|
||||
let winId2 = windowTracker.getId(win2);
|
||||
|
||||
function* openTab(winId) {
|
||||
async function openTab(winId) {
|
||||
extension.sendMessage("background-open-tab", winId);
|
||||
yield extension.awaitMessage("tab-ready");
|
||||
await extension.awaitMessage("tab-ready");
|
||||
}
|
||||
|
||||
function* checkViews(kind, tabCount, popupCount, kindCount, windowId = undefined, windowCount = 0) {
|
||||
async function checkViews(kind, tabCount, popupCount, kindCount, windowId = undefined, windowCount = 0) {
|
||||
extension.sendMessage(kind + "-check-views", windowId);
|
||||
let counts = yield extension.awaitMessage("counts");
|
||||
let counts = await extension.awaitMessage("counts");
|
||||
is(counts.background, 1, "background count correct");
|
||||
is(counts.tab, tabCount, "tab count correct");
|
||||
is(counts.popup, popupCount, "popup count correct");
|
||||
@ -135,13 +135,13 @@ add_task(async function() {
|
||||
|
||||
await checkViews("background", 2, 0, 0, winId2, 1);
|
||||
|
||||
function* triggerPopup(win, callback) {
|
||||
yield clickBrowserAction(extension, win);
|
||||
yield awaitExtensionPanel(extension, win);
|
||||
async function triggerPopup(win, callback) {
|
||||
await clickBrowserAction(extension, win);
|
||||
await awaitExtensionPanel(extension, win);
|
||||
|
||||
yield extension.awaitMessage("popup-ready");
|
||||
await extension.awaitMessage("popup-ready");
|
||||
|
||||
yield callback();
|
||||
await callback();
|
||||
|
||||
closeBrowserAction(extension, win);
|
||||
}
|
||||
@ -152,14 +152,14 @@ add_task(async function() {
|
||||
// short timeout seems to consistently fix it.
|
||||
await new Promise(resolve => win1.setTimeout(resolve, 10));
|
||||
|
||||
await triggerPopup(win1, function* () {
|
||||
yield checkViews("background", 2, 1, 0, winId1, 2);
|
||||
yield checkViews("popup", 2, 1, 1);
|
||||
await triggerPopup(win1, async function() {
|
||||
await checkViews("background", 2, 1, 0, winId1, 2);
|
||||
await checkViews("popup", 2, 1, 1);
|
||||
});
|
||||
|
||||
await triggerPopup(win2, function* () {
|
||||
yield checkViews("background", 2, 1, 0, winId2, 2);
|
||||
yield checkViews("popup", 2, 1, 1);
|
||||
await triggerPopup(win2, async function() {
|
||||
await checkViews("background", 2, 1, 0, winId2, 2);
|
||||
await checkViews("popup", 2, 1, 1);
|
||||
});
|
||||
|
||||
info("checking counts after popups");
|
||||
@ -177,18 +177,18 @@ add_task(async function() {
|
||||
|
||||
info("opening win1 popup");
|
||||
|
||||
await triggerPopup(win1, function* () {
|
||||
yield checkViews("background", 1, 1, 0);
|
||||
yield checkViews("tab", 1, 1, 1);
|
||||
yield checkViews("popup", 1, 1, 1);
|
||||
await triggerPopup(win1, async function() {
|
||||
await checkViews("background", 1, 1, 0);
|
||||
await checkViews("tab", 1, 1, 1);
|
||||
await checkViews("popup", 1, 1, 1);
|
||||
});
|
||||
|
||||
info("opening win2 popup");
|
||||
|
||||
await triggerPopup(win2, function* () {
|
||||
yield checkViews("background", 1, 1, 0);
|
||||
yield checkViews("tab", 1, 1, 1);
|
||||
yield checkViews("popup", 1, 1, 1);
|
||||
await triggerPopup(win2, async function() {
|
||||
await checkViews("background", 1, 1, 0);
|
||||
await checkViews("tab", 1, 1, 1);
|
||||
await checkViews("popup", 1, 1, 1);
|
||||
});
|
||||
|
||||
await extension.unload();
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
function* sendMessage(options) {
|
||||
async function sendMessage(options) {
|
||||
function background(options) {
|
||||
browser.runtime.sendMessage(result => {
|
||||
browser.test.assertEq(undefined, result, "Argument value");
|
||||
@ -18,11 +18,11 @@ function* sendMessage(options) {
|
||||
background: `(${background})(${JSON.stringify(options)})`,
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield extension.awaitMessage("done");
|
||||
await extension.awaitMessage("done");
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
add_task(async function testLastError() {
|
||||
|
@ -81,8 +81,8 @@ add_task(async function() {
|
||||
},
|
||||
});
|
||||
|
||||
function* expectEvent(event, expected = {}) {
|
||||
let actual = yield extension.awaitMessage(event);
|
||||
async function expectEvent(event, expected = {}) {
|
||||
let actual = await extension.awaitMessage(event);
|
||||
if (expected.text) {
|
||||
is(actual.text, expected.text,
|
||||
`Expected "${event}" to have fired with text: "${expected.text}".`);
|
||||
@ -108,7 +108,7 @@ add_task(async function() {
|
||||
return "t";
|
||||
}
|
||||
|
||||
function* testInputEvents() {
|
||||
async function testInputEvents() {
|
||||
gURLBar.focus();
|
||||
|
||||
// Start an input session by typing in <keyword><space>.
|
||||
@ -116,18 +116,18 @@ add_task(async function() {
|
||||
EventUtils.synthesizeKey(letter, {});
|
||||
}
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield expectEvent("on-input-started-fired");
|
||||
await expectEvent("on-input-started-fired");
|
||||
|
||||
// Test canceling the input before any changed events fire.
|
||||
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
|
||||
yield expectEvent("on-input-cancelled-fired");
|
||||
await expectEvent("on-input-cancelled-fired");
|
||||
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield expectEvent("on-input-started-fired");
|
||||
await expectEvent("on-input-started-fired");
|
||||
|
||||
// Test submitting the input before any changed events fire.
|
||||
EventUtils.synthesizeKey("VK_RETURN", {});
|
||||
yield expectEvent("on-input-entered-fired");
|
||||
await expectEvent("on-input-entered-fired");
|
||||
|
||||
gURLBar.focus();
|
||||
|
||||
@ -136,52 +136,52 @@ add_task(async function() {
|
||||
EventUtils.synthesizeKey(letter, {});
|
||||
}
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield expectEvent("on-input-started-fired");
|
||||
await expectEvent("on-input-started-fired");
|
||||
|
||||
// We should expect input changed events now that the keyword is active.
|
||||
EventUtils.synthesizeKey("b", {});
|
||||
yield expectEvent("on-input-changed-fired", {text: "b"});
|
||||
await expectEvent("on-input-changed-fired", {text: "b"});
|
||||
|
||||
EventUtils.synthesizeKey("c", {});
|
||||
yield expectEvent("on-input-changed-fired", {text: "bc"});
|
||||
await expectEvent("on-input-changed-fired", {text: "bc"});
|
||||
|
||||
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
|
||||
yield expectEvent("on-input-changed-fired", {text: "b"});
|
||||
await expectEvent("on-input-changed-fired", {text: "b"});
|
||||
|
||||
// Even though the input is <keyword><space> We should not expect an
|
||||
// input started event to fire since the keyword is active.
|
||||
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
|
||||
yield expectEvent("on-input-changed-fired", {text: ""});
|
||||
await expectEvent("on-input-changed-fired", {text: ""});
|
||||
|
||||
// Make the keyword inactive by hitting backspace.
|
||||
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
|
||||
yield expectEvent("on-input-cancelled-fired");
|
||||
await expectEvent("on-input-cancelled-fired");
|
||||
|
||||
// Activate the keyword by typing a space.
|
||||
// Expect onInputStarted to fire.
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield expectEvent("on-input-started-fired");
|
||||
await expectEvent("on-input-started-fired");
|
||||
|
||||
// onInputChanged should fire even if a space is entered.
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield expectEvent("on-input-changed-fired", {text: " "});
|
||||
await expectEvent("on-input-changed-fired", {text: " "});
|
||||
|
||||
// The active session should cancel if the input blurs.
|
||||
gURLBar.blur();
|
||||
yield expectEvent("on-input-cancelled-fired");
|
||||
await expectEvent("on-input-cancelled-fired");
|
||||
}
|
||||
|
||||
function* testHeuristicResult(expectedText, setDefaultSuggestion) {
|
||||
async function testHeuristicResult(expectedText, setDefaultSuggestion) {
|
||||
if (setDefaultSuggestion) {
|
||||
extension.sendMessage("set-default-suggestion", {
|
||||
suggestion: {
|
||||
description: expectedText,
|
||||
},
|
||||
});
|
||||
yield extension.awaitMessage("default-suggestion-set");
|
||||
await extension.awaitMessage("default-suggestion-set");
|
||||
}
|
||||
|
||||
let text = yield startInputSession();
|
||||
let text = await startInputSession();
|
||||
|
||||
let item = gURLBar.popup.richlistbox.children[0];
|
||||
|
||||
@ -193,14 +193,14 @@ add_task(async function() {
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(item, {});
|
||||
|
||||
yield expectEvent("on-input-entered-fired", {
|
||||
await expectEvent("on-input-entered-fired", {
|
||||
text,
|
||||
disposition: "currentTab",
|
||||
});
|
||||
}
|
||||
|
||||
function* testDisposition(suggestionIndex, expectedDisposition, expectedText) {
|
||||
yield startInputSession();
|
||||
async function testDisposition(suggestionIndex, expectedDisposition, expectedText) {
|
||||
await startInputSession();
|
||||
|
||||
// Select the suggestion.
|
||||
for (let i = 0; i < suggestionIndex; i++) {
|
||||
@ -216,13 +216,13 @@ add_task(async function() {
|
||||
EventUtils.synthesizeMouseAtCenter(item, {shiftKey: true, accelKey: true});
|
||||
}
|
||||
|
||||
yield expectEvent("on-input-entered-fired", {
|
||||
await expectEvent("on-input-entered-fired", {
|
||||
text: expectedText,
|
||||
disposition: expectedDisposition,
|
||||
});
|
||||
}
|
||||
|
||||
function* testSuggestions(info) {
|
||||
async function testSuggestions(info) {
|
||||
extension.sendMessage("set-synchronous", {synchronous: false});
|
||||
|
||||
function expectSuggestion({content, description}, index) {
|
||||
@ -236,15 +236,15 @@ add_task(async function() {
|
||||
`Expected suggestion to have displayurl: "${keyword} ${content}".`);
|
||||
}
|
||||
|
||||
let text = yield startInputSession();
|
||||
let text = await startInputSession();
|
||||
|
||||
extension.sendMessage(info.test);
|
||||
yield extension.awaitMessage("test-ready");
|
||||
await extension.awaitMessage("test-ready");
|
||||
|
||||
info.suggestions.forEach(expectSuggestion);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(gURLBar.popup.richlistbox.children[0], {});
|
||||
yield expectEvent("on-input-entered-fired", {
|
||||
await expectEvent("on-input-entered-fired", {
|
||||
text,
|
||||
disposition: "currentTab",
|
||||
});
|
||||
|
@ -10,7 +10,7 @@ function add_tasks(task) {
|
||||
add_task(task.bind(null, {embedded: true}));
|
||||
}
|
||||
|
||||
function* loadExtension(options) {
|
||||
async function loadExtension(options) {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
useAddonManager: "temporary",
|
||||
|
||||
@ -43,7 +43,7 @@ function* loadExtension(options) {
|
||||
background: options.background,
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
return extension;
|
||||
}
|
||||
@ -251,10 +251,10 @@ add_tasks(async function test_tab_options(extraOptions) {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
add_tasks(function* test_options_no_manifest(extraOptions) {
|
||||
add_tasks(async function test_options_no_manifest(extraOptions) {
|
||||
info(`Test with no manifest key (${JSON.stringify(extraOptions)})`);
|
||||
|
||||
let extension = yield loadExtension(Object.assign({}, extraOptions, {
|
||||
let extension = await loadExtension(Object.assign({}, extraOptions, {
|
||||
manifest: {
|
||||
applications: {gecko: {id: "no_options@tests.mozilla.org"}},
|
||||
},
|
||||
@ -271,6 +271,6 @@ add_tasks(function* test_options_no_manifest(extraOptions) {
|
||||
},
|
||||
}));
|
||||
|
||||
yield extension.awaitFinish("options-no-manifest");
|
||||
yield extension.unload();
|
||||
await extension.awaitFinish("options-no-manifest");
|
||||
await extension.unload();
|
||||
});
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
function* loadExtension(options) {
|
||||
async function loadExtension(options) {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
useAddonManager: "temporary",
|
||||
|
||||
@ -32,7 +32,7 @@ function* loadExtension(options) {
|
||||
background: options.background,
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
return extension;
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ add_task(async function test_sessions_restore() {
|
||||
background,
|
||||
});
|
||||
|
||||
function* assertNotificationCount(expected) {
|
||||
let notificationCount = yield extension.awaitMessage("notificationCount");
|
||||
async function assertNotificationCount(expected) {
|
||||
let notificationCount = await extension.awaitMessage("notificationCount");
|
||||
is(notificationCount, expected, "the expected number of notifications was fired");
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.sidebar-button.shown", true]],
|
||||
});
|
||||
|
||||
function* runTests(options) {
|
||||
async function runTests(options) {
|
||||
async function background(getTests) {
|
||||
async function checkDetails(expecting, tabId) {
|
||||
let title = await browser.sidebarAction.getTitle({tabId});
|
||||
@ -120,9 +120,9 @@ function* runTests(options) {
|
||||
extension.sendMessage("runNextTest");
|
||||
}, {capture: true, once: true});
|
||||
|
||||
yield extension.startup();
|
||||
yield awaitFinish;
|
||||
yield extension.unload();
|
||||
await extension.startup();
|
||||
await awaitFinish;
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
let sidebar = `
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
function* testTabsCreateInvalidURL(tabsCreateURL) {
|
||||
async function testTabsCreateInvalidURL(tabsCreateURL) {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
@ -26,16 +26,16 @@ function* testTabsCreateInvalidURL(tabsCreateURL) {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
yield extension.awaitMessage("ready");
|
||||
await extension.awaitMessage("ready");
|
||||
|
||||
info(`test tab.create on invalid URL "${tabsCreateURL}"`);
|
||||
|
||||
extension.sendMessage("start", tabsCreateURL);
|
||||
yield extension.awaitMessage("done");
|
||||
await extension.awaitMessage("done");
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
// This is a pretty terrible hack, but it's the best we can do until we
|
||||
// support |executeScript| callbacks and |lastError|.
|
||||
function* testHasNoPermission(params) {
|
||||
async function testHasNoPermission(params) {
|
||||
let contentSetup = params.contentSetup || (() => Promise.resolve());
|
||||
|
||||
async function background(contentSetup) {
|
||||
@ -51,17 +51,17 @@ function* testHasNoPermission(params) {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitMessage("ready");
|
||||
await extension.startup();
|
||||
await extension.awaitMessage("ready");
|
||||
|
||||
if (params.setup) {
|
||||
yield params.setup(extension);
|
||||
await params.setup(extension);
|
||||
}
|
||||
|
||||
extension.sendMessage("execute-script");
|
||||
|
||||
yield extension.awaitFinish("executeScript");
|
||||
yield extension.unload();
|
||||
await extension.awaitFinish("executeScript");
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
add_task(async function testBadPermissions() {
|
||||
@ -98,9 +98,9 @@ add_task(async function testBadPermissions() {
|
||||
});
|
||||
return Promise.resolve();
|
||||
},
|
||||
setup: function* (extension) {
|
||||
yield EventUtils.synthesizeKey("k", {altKey: true, shiftKey: true});
|
||||
yield extension.awaitMessage("tabs-command-key-pressed");
|
||||
setup: async function(extension) {
|
||||
await EventUtils.synthesizeKey("k", {altKey: true, shiftKey: true});
|
||||
await extension.awaitMessage("tabs-command-key-pressed");
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
requestLongerTimeout(2);
|
||||
|
||||
function* testHasPermission(params) {
|
||||
async function testHasPermission(params) {
|
||||
let contentSetup = params.contentSetup || (() => Promise.resolve());
|
||||
|
||||
async function background(contentSetup) {
|
||||
@ -38,22 +38,22 @@ function* testHasPermission(params) {
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitMessage("ready");
|
||||
await extension.startup();
|
||||
await extension.awaitMessage("ready");
|
||||
|
||||
if (params.setup) {
|
||||
yield params.setup(extension);
|
||||
await params.setup(extension);
|
||||
}
|
||||
|
||||
extension.sendMessage("execute-script");
|
||||
|
||||
yield extension.awaitFinish("executeScript");
|
||||
await extension.awaitFinish("executeScript");
|
||||
|
||||
if (params.tearDown) {
|
||||
yield params.tearDown(extension);
|
||||
await params.tearDown(extension);
|
||||
}
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
add_task(async function testGoodPermissions() {
|
||||
@ -94,9 +94,9 @@ add_task(async function testGoodPermissions() {
|
||||
});
|
||||
return Promise.resolve();
|
||||
},
|
||||
setup: function* (extension) {
|
||||
yield EventUtils.synthesizeKey("k", {altKey: true, shiftKey: true});
|
||||
yield extension.awaitMessage("tabs-command-key-pressed");
|
||||
setup: async function(extension) {
|
||||
await EventUtils.synthesizeKey("k", {altKey: true, shiftKey: true});
|
||||
await extension.awaitMessage("tabs-command-key-pressed");
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -85,7 +85,7 @@ function checkButtons(icons, iconInfo, area) {
|
||||
}
|
||||
}
|
||||
|
||||
function* runTestWithIcons(icons) {
|
||||
async function runTestWithIcons(icons) {
|
||||
const FRAME_COLOR = [71, 105, 91];
|
||||
const TAB_TEXT_COLOR = [207, 221, 192, .9];
|
||||
let manifest = {
|
||||
@ -159,7 +159,7 @@ function* runTestWithIcons(icons) {
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({manifest, files});
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
checkButtons(icons, ICON_INFO, "toolbar");
|
||||
|
||||
@ -169,13 +169,13 @@ function* runTestWithIcons(icons) {
|
||||
}
|
||||
}
|
||||
|
||||
yield PanelUI.show();
|
||||
await PanelUI.show();
|
||||
|
||||
checkButtons(icons, ICON_INFO, "panel");
|
||||
|
||||
yield PanelUI.hide();
|
||||
await PanelUI.hide();
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
|
||||
for (let button of ICON_INFO) {
|
||||
verifyButtonWithoutCustomStyling(button[1],
|
||||
|
@ -10,7 +10,7 @@ add_task(async function setup() {
|
||||
* Helper function for testing a theme with invalid properties.
|
||||
* @param {object} invalidProps The invalid properties to load the theme with.
|
||||
*/
|
||||
function* testThemeWithInvalidProperties(invalidProps) {
|
||||
async function testThemeWithInvalidProperties(invalidProps) {
|
||||
let manifest = {
|
||||
"theme": {},
|
||||
};
|
||||
@ -41,10 +41,10 @@ function* testThemeWithInvalidProperties(invalidProps) {
|
||||
}]);
|
||||
});
|
||||
|
||||
yield Assert.rejects(extension.startup(), null, "Theme should fail to load if it contains invalid properties");
|
||||
await Assert.rejects(extension.startup(), null, "Theme should fail to load if it contains invalid properties");
|
||||
|
||||
SimpleTest.endMonitorConsole();
|
||||
yield waitForConsole;
|
||||
await waitForConsole;
|
||||
}
|
||||
|
||||
add_task(async function test_that_theme_with_invalid_properties_fails_to_load() {
|
||||
|
@ -21,22 +21,22 @@ async function promiseAutocompleteResultPopup(inputText) {
|
||||
});
|
||||
}
|
||||
|
||||
function* addBookmark(bookmark) {
|
||||
async function addBookmark(bookmark) {
|
||||
if (bookmark.keyword) {
|
||||
yield PlacesUtils.keywords.insert({
|
||||
await PlacesUtils.keywords.insert({
|
||||
keyword: bookmark.keyword,
|
||||
url: bookmark.url,
|
||||
});
|
||||
}
|
||||
|
||||
yield PlacesUtils.bookmarks.insert({
|
||||
await PlacesUtils.bookmarks.insert({
|
||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||
url: bookmark.url,
|
||||
title: bookmark.title,
|
||||
});
|
||||
|
||||
registerCleanupFunction(function* () {
|
||||
yield PlacesUtils.bookmarks.eraseEverything();
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
});
|
||||
}
|
||||
|
||||
@ -58,10 +58,10 @@ function addSearchEngine(basename) {
|
||||
});
|
||||
}
|
||||
|
||||
function* prepareSearchEngine() {
|
||||
async function prepareSearchEngine() {
|
||||
let oldCurrentEngine = Services.search.currentEngine;
|
||||
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
|
||||
let engine = yield addSearchEngine(TEST_ENGINE_BASENAME);
|
||||
let engine = await addSearchEngine(TEST_ENGINE_BASENAME);
|
||||
Services.search.currentEngine = engine;
|
||||
|
||||
registerCleanupFunction(async function() {
|
||||
|
@ -320,11 +320,11 @@ async function openChromeContextMenu(menuId, target, win = window) {
|
||||
return menu;
|
||||
}
|
||||
|
||||
function* openSubmenu(submenuItem, win = window) {
|
||||
async function openSubmenu(submenuItem, win = window) {
|
||||
const submenu = submenuItem.firstChild;
|
||||
const shown = BrowserTestUtils.waitForEvent(submenu, "popupshown");
|
||||
EventUtils.synthesizeMouseAtCenter(submenuItem, {}, win);
|
||||
yield shown;
|
||||
await shown;
|
||||
return submenu;
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
function* testKeyword(params) {
|
||||
let normalized = yield ExtensionTestUtils.normalizeManifest({
|
||||
async function testKeyword(params) {
|
||||
let normalized = await ExtensionTestUtils.normalizeManifest({
|
||||
"omnibox": {
|
||||
"keyword": params.keyword,
|
||||
},
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
/* globals chrome */
|
||||
|
||||
function* testPermission(options) {
|
||||
async function testPermission(options) {
|
||||
function background(bgOptions) {
|
||||
browser.test.sendMessage("typeof-namespace", {
|
||||
browser: typeof browser[bgOptions.namespace],
|
||||
@ -18,24 +18,24 @@ function* testPermission(options) {
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension(extensionDetails);
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
let types = yield extension.awaitMessage("typeof-namespace");
|
||||
let types = await extension.awaitMessage("typeof-namespace");
|
||||
equal(types.browser, "undefined", `Type of browser.${options.namespace} without manifest entry`);
|
||||
equal(types.chrome, "undefined", `Type of chrome.${options.namespace} without manifest entry`);
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
|
||||
extensionDetails.manifest = options.manifest;
|
||||
extension = ExtensionTestUtils.loadExtension(extensionDetails);
|
||||
|
||||
yield extension.startup();
|
||||
await extension.startup();
|
||||
|
||||
types = yield extension.awaitMessage("typeof-namespace");
|
||||
types = await extension.awaitMessage("typeof-namespace");
|
||||
equal(types.browser, "object", `Type of browser.${options.namespace} with manifest entry`);
|
||||
equal(types.chrome, "object", `Type of chrome.${options.namespace} with manifest entry`);
|
||||
|
||||
yield extension.unload();
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
add_task(async function test_browserAction() {
|
||||
|
@ -75,13 +75,13 @@ let worker_deblobify = (browser, blobURL) => workerIO(browser, SCRIPT_WORKER_DEB
|
||||
|
||||
function doTest(blobify, deblobify) {
|
||||
let blobURL = null;
|
||||
return function* (browser) {
|
||||
return async function(browser) {
|
||||
if (blobURL === null) {
|
||||
let input = Math.random().toString();
|
||||
blobURL = yield blobify(browser, input);
|
||||
blobURL = await blobify(browser, input);
|
||||
return input;
|
||||
}
|
||||
let result = yield deblobify(browser, blobURL);
|
||||
let result = await deblobify(browser, blobURL);
|
||||
blobURL = null;
|
||||
return result;
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ let stopObservingChannels;
|
||||
// The init function, which clears image and network caches, and generates
|
||||
// the random value for isolating video and audio elements across different
|
||||
// test runs.
|
||||
function* doInit(aMode) {
|
||||
yield SpecialPowers.pushPrefEnv({"set": [["network.predictor.enabled", false],
|
||||
async function doInit(aMode) {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["network.predictor.enabled", false],
|
||||
["network.predictor.enable-prefetch", false]]});
|
||||
clearAllImageCaches();
|
||||
|
||||
@ -219,20 +219,20 @@ async function doTest(aBrowser) {
|
||||
}
|
||||
|
||||
// The check function, which checks the number of cache entries.
|
||||
function* doCheck(aShouldIsolate, aInputA, aInputB) {
|
||||
async function doCheck(aShouldIsolate, aInputA, aInputB) {
|
||||
let expectedEntryCount = 1;
|
||||
let data = [];
|
||||
data = data.concat(yield cacheDataForContext(LoadContextInfo.default));
|
||||
data = data.concat(yield cacheDataForContext(LoadContextInfo.private));
|
||||
data = data.concat(yield cacheDataForContext(LoadContextInfo.custom(true, {})));
|
||||
data = data.concat(yield cacheDataForContext(LoadContextInfo.custom(false, { userContextId: 1 })));
|
||||
data = data.concat(yield cacheDataForContext(LoadContextInfo.custom(true, { userContextId: 1 })));
|
||||
data = data.concat(yield cacheDataForContext(LoadContextInfo.custom(false, { userContextId: 2 })));
|
||||
data = data.concat(yield cacheDataForContext(LoadContextInfo.custom(true, { userContextId: 2 })));
|
||||
data = data.concat(yield cacheDataForContext(LoadContextInfo.custom(false, { firstPartyDomain: "example.com" })));
|
||||
data = data.concat(yield cacheDataForContext(LoadContextInfo.custom(true, { firstPartyDomain: "example.com" })));
|
||||
data = data.concat(yield cacheDataForContext(LoadContextInfo.custom(false, { firstPartyDomain: "example.org" })));
|
||||
data = data.concat(yield cacheDataForContext(LoadContextInfo.custom(true, { firstPartyDomain: "example.org" })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.default));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.private));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, {})));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { userContextId: 1 })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { userContextId: 1 })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { userContextId: 2 })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { userContextId: 2 })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { firstPartyDomain: "example.com" })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { firstPartyDomain: "example.com" })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(false, { firstPartyDomain: "example.org" })));
|
||||
data = data.concat(await cacheDataForContext(LoadContextInfo.custom(true, { firstPartyDomain: "example.org" })));
|
||||
|
||||
if (aShouldIsolate) {
|
||||
expectedEntryCount = 2;
|
||||
|
@ -13,8 +13,8 @@ registerCleanupFunction(() => {
|
||||
Services.obs.removeObserver(onCertDialogLoaded, "cert-dialog-loaded");
|
||||
});
|
||||
|
||||
function* setup() {
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["security.default_personal_cert", "Ask Every Time"]]
|
||||
});
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ async function assignCookiesUnderFirstParty(aURL, aFirstParty, aCookieValue) {
|
||||
await BrowserTestUtils.removeTab(tabInfo.tab);
|
||||
}
|
||||
|
||||
function* generateCookies(aThirdParty) {
|
||||
async function generateCookies(aThirdParty) {
|
||||
// we generate two different cookies for two first party domains.
|
||||
let cookies = [];
|
||||
cookies.push(Math.random().toString());
|
||||
@ -204,8 +204,8 @@ function* generateCookies(aThirdParty) {
|
||||
secondSiteURL = TEST_SITE_TWO;
|
||||
}
|
||||
|
||||
yield assignCookiesUnderFirstParty(firstSiteURL, TEST_SITE_ONE, cookies[0]);
|
||||
yield assignCookiesUnderFirstParty(secondSiteURL, TEST_SITE_TWO, cookies[1]);
|
||||
await assignCookiesUnderFirstParty(firstSiteURL, TEST_SITE_ONE, cookies[0]);
|
||||
await assignCookiesUnderFirstParty(secondSiteURL, TEST_SITE_TWO, cookies[1]);
|
||||
|
||||
return cookies;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ function checkCookiesSanitized(aBrowser) {
|
||||
}
|
||||
|
||||
function checkCacheExists(aShouldExist) {
|
||||
return function* () {
|
||||
return async function() {
|
||||
let loadContextInfos = [
|
||||
LoadContextInfo.default,
|
||||
LoadContextInfo.custom(false, { userContextId: 1 }),
|
||||
@ -62,7 +62,7 @@ function checkCacheExists(aShouldExist) {
|
||||
];
|
||||
let i = 0;
|
||||
for (let loadContextInfo of loadContextInfos) {
|
||||
let cacheURIs = yield cacheDataForContext(loadContextInfo);
|
||||
let cacheURIs = await cacheDataForContext(loadContextInfo);
|
||||
is(cacheURIs.includes(TEST_DOMAIN), aShouldExist, TEST_DOMAIN + " should "
|
||||
+ (aShouldExist ? "not " : "") + "be cached for all origin attributes." + i++);
|
||||
}
|
||||
|
@ -536,13 +536,13 @@ var gEditItemOverlay = {
|
||||
return true;
|
||||
}
|
||||
|
||||
let setTags = function* () {
|
||||
let setTags = async function() {
|
||||
if (newTags.length > 0) {
|
||||
yield PlacesTransactions.Tag({ urls: aURIs, tags: newTags })
|
||||
await PlacesTransactions.Tag({ urls: aURIs, tags: newTags })
|
||||
.transact();
|
||||
}
|
||||
if (removedTags.length > 0) {
|
||||
yield PlacesTransactions.Untag({ urls: aURIs, tags: removedTags })
|
||||
await PlacesTransactions.Untag({ urls: aURIs, tags: removedTags })
|
||||
.transact();
|
||||
}
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ add_task(async function test_open_add_bookmark_for_frame() {
|
||||
|
||||
add_task(async function test_move_bookmark_whilst_add_bookmark_open() {
|
||||
info("Test moving a bookmark whilst the add bookmark for frame dialog is open.");
|
||||
await withAddBookmarkForFrame(function* test(dialogWin) {
|
||||
await withAddBookmarkForFrame(async function test(dialogWin) {
|
||||
let bookmarksMenuFolderName = PlacesUtils.getString("BookmarksMenuFolderTitle");
|
||||
let toolbarFolderName = PlacesUtils.getString("BookmarksToolbarFolderTitle");
|
||||
|
||||
@ -63,7 +63,7 @@ add_task(async function test_move_bookmark_whilst_add_bookmark_open() {
|
||||
bookmarksMenuFolderName, "The folder is the expected one.");
|
||||
|
||||
// Check the bookmark has been created as expected.
|
||||
let bookmark = yield PlacesUtils.bookmarks.fetch({url});
|
||||
let bookmark = await PlacesUtils.bookmarks.fetch({url});
|
||||
|
||||
Assert.equal(bookmark.parentGuid,
|
||||
PlacesUtils.bookmarks.menuGuid,
|
||||
@ -73,7 +73,7 @@ add_task(async function test_move_bookmark_whilst_add_bookmark_open() {
|
||||
bookmark.parentGuid = PlacesUtils.bookmarks.toolbarGuid;
|
||||
bookmark.index = PlacesUtils.bookmarks.DEFAULT_INDEX;
|
||||
|
||||
yield PlacesUtils.bookmarks.update(bookmark);
|
||||
await PlacesUtils.bookmarks.update(bookmark);
|
||||
|
||||
Assert.equal(folderPicker.selectedItem.label,
|
||||
toolbarFolderName, "The folder picker has changed to the new folder");
|
||||
|
@ -15,7 +15,7 @@ add_task(async function() {
|
||||
});
|
||||
let newBookmarkId = await PlacesUtils.promiseItemId(newBookmark.guid);
|
||||
|
||||
await withSidebarTree("bookmarks", function* (tree) {
|
||||
await withSidebarTree("bookmarks", async function(tree) {
|
||||
// Select the new bookmark in the sidebar.
|
||||
tree.selectItems([newBookmarkId]);
|
||||
ok(tree.controller.isCommandEnabled("placesCmd_new:folder"),
|
||||
@ -24,7 +24,7 @@ add_task(async function() {
|
||||
// Create a new folder. Since the new bookmark is selected, and new items
|
||||
// are inserted at the index of the currently selected item, the new folder
|
||||
// will be inserted at index 0.
|
||||
yield withBookmarksDialog(
|
||||
await withBookmarksDialog(
|
||||
false,
|
||||
function openDialog() {
|
||||
tree.controller.doCommand("placesCmd_new:folder");
|
||||
|
@ -6,11 +6,11 @@ add_task(async function() {
|
||||
await BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: TEST_URL,
|
||||
}, function* (browser) {
|
||||
}, async function(browser) {
|
||||
// We must wait for the context menu code to build metadata.
|
||||
yield openContextMenuForContentSelector(browser, '#form1 > input[name="search"]');
|
||||
await openContextMenuForContentSelector(browser, '#form1 > input[name="search"]');
|
||||
|
||||
yield withBookmarksDialog(true, AddKeywordForSearchField, async function(dialogWin) {
|
||||
await withBookmarksDialog(true, AddKeywordForSearchField, async function(dialogWin) {
|
||||
let acceptBtn = dialogWin.document.documentElement.getButton("accept");
|
||||
ok(acceptBtn.disabled, "Accept button is disabled");
|
||||
|
||||
@ -27,8 +27,8 @@ add_task(async function() {
|
||||
// After the notification, the keywords cache will update asynchronously.
|
||||
info("Check the keyword entry has been created");
|
||||
let entry;
|
||||
await waitForCondition(function* () {
|
||||
entry = yield PlacesUtils.keywords.fetch("kw");
|
||||
await waitForCondition(async function() {
|
||||
entry = await PlacesUtils.keywords.fetch("kw");
|
||||
return !!entry;
|
||||
}, "Unable to find the expected keyword");
|
||||
is(entry.keyword, "kw", "keyword is correct");
|
||||
@ -53,18 +53,18 @@ add_task(async function reopen_same_field() {
|
||||
keyword: "kw",
|
||||
postData: "accenti%3D%E0%E8%EC%F2%F9&search%3D%25s"
|
||||
});
|
||||
registerCleanupFunction(function* () {
|
||||
yield PlacesUtils.keywords.remove("kw");
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.keywords.remove("kw");
|
||||
});
|
||||
// Reopening on the same input field should show the existing keyword.
|
||||
await BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: TEST_URL,
|
||||
}, function* (browser) {
|
||||
}, async function(browser) {
|
||||
// We must wait for the context menu code to build metadata.
|
||||
yield openContextMenuForContentSelector(browser, '#form1 > input[name="search"]');
|
||||
await openContextMenuForContentSelector(browser, '#form1 > input[name="search"]');
|
||||
|
||||
yield withBookmarksDialog(true, AddKeywordForSearchField, function(dialogWin) {
|
||||
await withBookmarksDialog(true, AddKeywordForSearchField, function(dialogWin) {
|
||||
let acceptBtn = dialogWin.document.documentElement.getButton("accept");
|
||||
ok(acceptBtn.disabled, "Accept button is disabled");
|
||||
|
||||
@ -80,19 +80,19 @@ add_task(async function open_other_field() {
|
||||
keyword: "kw2",
|
||||
postData: "search%3D%25s"
|
||||
});
|
||||
registerCleanupFunction(function* () {
|
||||
yield PlacesUtils.keywords.remove("kw2");
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.keywords.remove("kw2");
|
||||
});
|
||||
// Reopening on another field of the same page that has different postData
|
||||
// should not show the existing keyword.
|
||||
await BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: TEST_URL,
|
||||
}, function* (browser) {
|
||||
}, async function(browser) {
|
||||
// We must wait for the context menu code to build metadata.
|
||||
yield openContextMenuForContentSelector(browser, '#form2 > input[name="search"]');
|
||||
await openContextMenuForContentSelector(browser, '#form2 > input[name="search"]');
|
||||
|
||||
yield withBookmarksDialog(true, AddKeywordForSearchField, function(dialogWin) {
|
||||
await withBookmarksDialog(true, AddKeywordForSearchField, function(dialogWin) {
|
||||
let acceptBtn = dialogWin.document.documentElement.getButton("accept");
|
||||
ok(acceptBtn.disabled, "Accept button is disabled");
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
add_task(async function() {
|
||||
info("Add a live bookmark editing its data");
|
||||
|
||||
await withSidebarTree("bookmarks", function* (tree) {
|
||||
await withSidebarTree("bookmarks", async function(tree) {
|
||||
let itemId = PlacesUIUtils.leftPaneQueries["UnfiledBookmarks"];
|
||||
tree.selectItems([itemId]);
|
||||
|
||||
yield withBookmarksDialog(
|
||||
await withBookmarksDialog(
|
||||
true,
|
||||
function openDialog() {
|
||||
PlacesCommandHook.addLiveBookmark("http://livemark.com/",
|
||||
|
@ -7,8 +7,8 @@ add_task(async function() {
|
||||
url: uri.spec,
|
||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
||||
});
|
||||
registerCleanupFunction(function* () {
|
||||
yield PlacesUtils.bookmarks.remove(bm);
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.bookmarks.remove(bm);
|
||||
});
|
||||
|
||||
PlacesUtils.tagging.tagURI(uri, ["tag1"]);
|
||||
|
@ -3,18 +3,18 @@
|
||||
add_task(async function() {
|
||||
info("Bug 479348 - Properties on a root should be read-only.");
|
||||
|
||||
await withSidebarTree("bookmarks", function* (tree) {
|
||||
await withSidebarTree("bookmarks", async function(tree) {
|
||||
let itemId = PlacesUIUtils.leftPaneQueries["UnfiledBookmarks"];
|
||||
tree.selectItems([itemId]);
|
||||
ok(tree.controller.isCommandEnabled("placesCmd_show:info"),
|
||||
"'placesCmd_show:info' on current selected node is enabled");
|
||||
|
||||
yield withBookmarksDialog(
|
||||
await withBookmarksDialog(
|
||||
true,
|
||||
function openDialog() {
|
||||
tree.controller.doCommand("placesCmd_show:info");
|
||||
},
|
||||
function* test(dialogWin) {
|
||||
async function test(dialogWin) {
|
||||
// Check that the dialog is read-only.
|
||||
ok(dialogWin.gEditItemOverlay.readOnly, "Dialog is read-only");
|
||||
// Check that accept button is disabled
|
||||
@ -33,7 +33,7 @@ add_task(async function() {
|
||||
PlacesUtils.bookmarks.getItemTitle(PlacesUtils.unfiledBookmarksFolderId),
|
||||
"Root title is correct");
|
||||
// Check the shortcut's title.
|
||||
let bookmark = yield PlacesUtils.bookmarks.fetch(tree.selectedNode.bookmarkGuid);
|
||||
let bookmark = await PlacesUtils.bookmarks.fetch(tree.selectedNode.bookmarkGuid);
|
||||
is(bookmark.title, null,
|
||||
"Shortcut title is null");
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ add_task(async function() {
|
||||
title: "test icon",
|
||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid
|
||||
});
|
||||
registerCleanupFunction(function* () {
|
||||
yield PlacesUtils.bookmarks.remove(bm);
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.bookmarks.remove(bm);
|
||||
});
|
||||
|
||||
// The icon is read asynchronously from the network, we don't have an easy way
|
||||
|
@ -8,7 +8,7 @@ add_task(async function() {
|
||||
|
||||
const tabURL = getRootDirectory(gTestPath) + "browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul";
|
||||
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: tabURL }, function* (browser) {
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: tabURL }, async function(browser) {
|
||||
let doc = browser.contentDocument;
|
||||
let container = doc.getElementById("container");
|
||||
|
||||
@ -16,14 +16,14 @@ add_task(async function() {
|
||||
let button = doc.getElementById("button");
|
||||
button.focus();
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield checkPageScrolling(container, "button");
|
||||
await checkPageScrolling(container, "button");
|
||||
|
||||
// Test checkbox
|
||||
let checkbox = doc.getElementById("checkbox");
|
||||
checkbox.focus();
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
ok(checkbox.checked, "Checkbox is checked");
|
||||
yield checkPageScrolling(container, "checkbox");
|
||||
await checkPageScrolling(container, "checkbox");
|
||||
|
||||
// Test listbox
|
||||
let listbox = doc.getElementById("listbox");
|
||||
@ -31,16 +31,16 @@ add_task(async function() {
|
||||
listbox.focus();
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
ok(listitem.selected, "Listitem is selected");
|
||||
yield checkPageScrolling(container, "listbox");
|
||||
await checkPageScrolling(container, "listbox");
|
||||
|
||||
// Test radio
|
||||
let radiogroup = doc.getElementById("radiogroup");
|
||||
radiogroup.focus();
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield checkPageScrolling(container, "radio");
|
||||
await checkPageScrolling(container, "radio");
|
||||
});
|
||||
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences#search" }, function* (browser) {
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences#search" }, async function(browser) {
|
||||
let doc = browser.contentDocument;
|
||||
let container = doc.getElementsByClassName("main-content")[0];
|
||||
|
||||
@ -50,7 +50,7 @@ add_task(async function() {
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
is(engineList.view.selection.currentIndex, 0, "Search engineList is selected");
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield checkPageScrolling(container, "search engineList");
|
||||
await checkPageScrolling(container, "search engineList");
|
||||
});
|
||||
|
||||
// Test session restore
|
||||
|
@ -5,7 +5,7 @@ const CHECK_DEFAULT_INITIAL = Services.prefs.getBoolPref("browser.shell.checkDef
|
||||
add_task(async function clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
|
||||
|
||||
await test_with_mock_shellservice({isDefault: false}, function*() {
|
||||
await test_with_mock_shellservice({isDefault: false}, async function() {
|
||||
let setDefaultPane = content.document.getElementById("setDefaultPane");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
@ -18,7 +18,7 @@ add_task(async function clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
setDefaultButton.click();
|
||||
content.window.gMainPane.updateSetDefaultBrowser();
|
||||
|
||||
yield ContentTaskUtils.waitForCondition(() => alwaysCheck.checked,
|
||||
await ContentTaskUtils.waitForCondition(() => alwaysCheck.checked,
|
||||
"'Always Check' checkbox should get checked after clicking the 'Set Default' button");
|
||||
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
@ -41,7 +41,7 @@ add_task(async function clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
Services.prefs.lockPref("browser.shell.checkDefaultBrowser");
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
|
||||
|
||||
await test_with_mock_shellservice({isDefault: false}, function*() {
|
||||
await test_with_mock_shellservice({isDefault: false}, async function() {
|
||||
let setDefaultPane = content.document.getElementById("setDefaultPane");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
@ -56,7 +56,7 @@ add_task(async function clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
setDefaultButton.click();
|
||||
content.window.gMainPane.updateSetDefaultBrowser();
|
||||
|
||||
yield ContentTaskUtils.waitForCondition(() => setDefaultPane.selectedIndex == "1",
|
||||
await ContentTaskUtils.waitForCondition(() => setDefaultPane.selectedIndex == "1",
|
||||
"Browser is now default");
|
||||
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
|
@ -8,7 +8,7 @@ add_task(async function() {
|
||||
|
||||
const tabURL = getRootDirectory(gTestPath) + "browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul";
|
||||
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: tabURL }, function* (browser) {
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: tabURL }, async function(browser) {
|
||||
let doc = browser.contentDocument;
|
||||
let container = doc.getElementById("container");
|
||||
|
||||
@ -16,14 +16,14 @@ add_task(async function() {
|
||||
let button = doc.getElementById("button");
|
||||
button.focus();
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield checkPageScrolling(container, "button");
|
||||
await checkPageScrolling(container, "button");
|
||||
|
||||
// Test checkbox
|
||||
let checkbox = doc.getElementById("checkbox");
|
||||
checkbox.focus();
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
ok(checkbox.checked, "Checkbox is checked");
|
||||
yield checkPageScrolling(container, "checkbox");
|
||||
await checkPageScrolling(container, "checkbox");
|
||||
|
||||
// Test listbox
|
||||
let listbox = doc.getElementById("listbox");
|
||||
@ -31,16 +31,16 @@ add_task(async function() {
|
||||
listbox.focus();
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
ok(listitem.selected, "Listitem is selected");
|
||||
yield checkPageScrolling(container, "listbox");
|
||||
await checkPageScrolling(container, "listbox");
|
||||
|
||||
// Test radio
|
||||
let radiogroup = doc.getElementById("radiogroup");
|
||||
radiogroup.focus();
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield checkPageScrolling(container, "radio");
|
||||
await checkPageScrolling(container, "radio");
|
||||
});
|
||||
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences" }, function* (browser) {
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences" }, async function(browser) {
|
||||
let doc = browser.contentDocument;
|
||||
let container = doc.getElementsByClassName("main-content")[0];
|
||||
|
||||
@ -50,7 +50,7 @@ add_task(async function() {
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
is(engineList.view.selection.currentIndex, 0, "Search engineList is selected");
|
||||
EventUtils.synthesizeKey(" ", {});
|
||||
yield checkPageScrolling(container, "search engineList");
|
||||
await checkPageScrolling(container, "search engineList");
|
||||
});
|
||||
|
||||
// Test session restore
|
||||
|
@ -5,7 +5,7 @@ const CHECK_DEFAULT_INITIAL = Services.prefs.getBoolPref("browser.shell.checkDef
|
||||
add_task(async function clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
|
||||
|
||||
await test_with_mock_shellservice({isDefault: false}, function*() {
|
||||
await test_with_mock_shellservice({isDefault: false}, async function() {
|
||||
let setDefaultPane = content.document.getElementById("setDefaultPane");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
@ -18,7 +18,7 @@ add_task(async function clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
setDefaultButton.click();
|
||||
content.window.gMainPane.updateSetDefaultBrowser();
|
||||
|
||||
yield ContentTaskUtils.waitForCondition(() => alwaysCheck.checked,
|
||||
await ContentTaskUtils.waitForCondition(() => alwaysCheck.checked,
|
||||
"'Always Check' checkbox should get checked after clicking the 'Set Default' button");
|
||||
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
@ -41,7 +41,7 @@ add_task(async function clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
Services.prefs.lockPref("browser.shell.checkDefaultBrowser");
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
|
||||
|
||||
await test_with_mock_shellservice({isDefault: false}, function*() {
|
||||
await test_with_mock_shellservice({isDefault: false}, async function() {
|
||||
let setDefaultPane = content.document.getElementById("setDefaultPane");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
@ -56,7 +56,7 @@ add_task(async function clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
setDefaultButton.click();
|
||||
content.window.gMainPane.updateSetDefaultBrowser();
|
||||
|
||||
yield ContentTaskUtils.waitForCondition(() => setDefaultPane.selectedIndex == "1",
|
||||
await ContentTaskUtils.waitForCondition(() => setDefaultPane.selectedIndex == "1",
|
||||
"Browser is now default");
|
||||
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
|
@ -11,8 +11,8 @@ add_task(async function test() {
|
||||
await BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: PAGE_URL
|
||||
}, function* handler(aBrowser) {
|
||||
yield TabStateFlusher.flush(aBrowser);
|
||||
}, async function handler(aBrowser) {
|
||||
await TabStateFlusher.flush(aBrowser);
|
||||
ok(true, "Flush didn't time out");
|
||||
});
|
||||
});
|
||||
|
@ -457,10 +457,10 @@ add_task(async function test_mac_notifications() {
|
||||
return;
|
||||
}
|
||||
|
||||
await setupTest({ denyFirst: true }, function*(newWin, obs) {
|
||||
let closed = yield closeWindowForRestoration(newWin);
|
||||
await setupTest({ denyFirst: true }, async function(newWin, obs) {
|
||||
let closed = await closeWindowForRestoration(newWin);
|
||||
ok(!closed, "First close attempt should be denied");
|
||||
closed = yield closeWindowForRestoration(newWin);
|
||||
closed = await closeWindowForRestoration(newWin);
|
||||
ok(closed, "Second close attempt should be granted");
|
||||
|
||||
// We tried closing once, and got denied. Then we tried again and
|
||||
|
@ -52,9 +52,9 @@ add_task(async function test_nested_about_sessionrestore() {
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
|
||||
function* checkState(prefix, tab) {
|
||||
async function checkState(prefix, tab) {
|
||||
// Flush and query tab state.
|
||||
yield TabStateFlusher.flush(tab.linkedBrowser);
|
||||
await TabStateFlusher.flush(tab.linkedBrowser);
|
||||
let {formdata} = JSON.parse(ss.getTabState(tab));
|
||||
|
||||
ok(formdata.id["sessionData"], prefix + ": we have form data for about:sessionrestore");
|
||||
|
@ -17,13 +17,13 @@ async function openWindow(url) {
|
||||
return win;
|
||||
}
|
||||
|
||||
function* closeWindow(win) {
|
||||
yield awaitNotification(() => BrowserTestUtils.closeWindow(win));
|
||||
async function closeWindow(win) {
|
||||
await awaitNotification(() => BrowserTestUtils.closeWindow(win));
|
||||
}
|
||||
|
||||
function* openAndCloseWindow(url) {
|
||||
let win = yield openWindow(url);
|
||||
yield closeWindow(win);
|
||||
async function openAndCloseWindow(url) {
|
||||
let win = await openWindow(url);
|
||||
await closeWindow(win);
|
||||
}
|
||||
|
||||
async function openTab(window, url) {
|
||||
@ -45,10 +45,10 @@ function assertNotificationCount(count) {
|
||||
is(notificationsCount, count, "The expected number of notifications was received.");
|
||||
}
|
||||
|
||||
function* awaitNotification(callback) {
|
||||
async function awaitNotification(callback) {
|
||||
let notification = TestUtils.topicObserved(TOPIC);
|
||||
executeSoon(callback);
|
||||
yield notification;
|
||||
await notification;
|
||||
}
|
||||
|
||||
add_task(async function test_closedObjectsChangedNotifications() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user