Bug 1298559 - Enable eslint for /browser/base/content/test/ r=mattn

MozReview-Commit-ID: BZlkPTcLJMB
This commit is contained in:
Jared Wein 2016-08-31 12:53:24 -04:00
parent 5dd9ac0f8c
commit a182a61bce
132 changed files with 2222 additions and 2218 deletions

View file

@ -60,7 +60,8 @@ browser/app/**
browser/base/content/browser-social.js
browser/base/content/nsContextMenu.js
browser/base/content/sanitizeDialog.js
browser/base/content/test/**
browser/base/content/test/general/file_csp_block_all_mixedcontent.html
browser/base/content/test/urlbar/file_blank_but_not_blank.html
browser/base/content/newtab/**
browser/components/downloads/**
browser/components/feeds/**

View file

@ -415,7 +415,7 @@ function test()
{
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
for (let test of gTests) {
info(test.desc);
try {

View file

@ -45,7 +45,7 @@ function fakeTelemetryNow(...args) {
return date;
}
function setupPingArchive() {
function* setupPingArchive() {
let scope = {};
Cu.import("resource://gre/modules/TelemetryController.jsm", scope);
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
@ -103,7 +103,7 @@ function test()
// xxxmpc leaving this here until we resolve bug 854038 and bug 854060
requestLongerTimeout(10);
Task.spawn(function () {
Task.spawn(function* () {
for (let test of gTests) {
info(test.desc);
yield test.setup();

View file

@ -4,8 +4,8 @@ function* wait_for_tab_playing_event(tab, expectPlaying) {
if (tab.soundPlaying == expectPlaying) {
ok(true, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
return true;
} else {
yield BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false, (event) => {
}
return yield BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false, (event) => {
if (event.detail.changed.indexOf("soundplaying") >= 0) {
is(tab.hasAttribute("soundplaying"), expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
is(tab.soundPlaying, expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing");
@ -14,7 +14,6 @@ function* wait_for_tab_playing_event(tab, expectPlaying) {
return false;
});
}
}
function* play(tab) {
let browser = tab.linkedBrowser;
@ -230,6 +229,7 @@ function* test_swapped_browser_while_playing(oldTab, newBrowser) {
if (event.detail.changed.indexOf("soundplaying") >= 0) {
return (++receivedSoundPlaying == 2);
}
return false;
});
ok(newTab.hasAttribute("muted"), "Expected the correct muted attribute on the new tab");

View file

@ -81,7 +81,7 @@ function errorPageLoaded() {
return BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
}).then(pinningRemovalLoaded);
});
};
}
// After the pinning information has been removed (successful load) proceed
// to load again with the invalid pin domain.
@ -89,7 +89,7 @@ function pinningRemovalLoaded() {
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "https://" + kBadPinningDomain).then(function() {
return BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
}).then(badPinningPageLoaded);
};
}
// Finally, we should successfully load
// https://bad.include-subdomains.pinning-dynamic.example.com.
@ -98,4 +98,4 @@ function badPinningPageLoaded() {
ok(true, "load complete");
finish();
});
};
}

View file

@ -10,7 +10,7 @@ var gTab1, gTab2, gLevel1;
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
gTab1 = gBrowser.addTab();
gTab2 = gBrowser.addTab();
@ -21,7 +21,7 @@ function test() {
}
function zoomTab1() {
Task.spawn(function () {
Task.spawn(function* () {
is(gBrowser.selectedTab, gTab1, "Tab 1 is selected");
FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
@ -43,7 +43,7 @@ function zoomTab1() {
}
function finishTest() {
Task.spawn(function () {
Task.spawn(function* () {
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
yield FullZoom.reset();
yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab1);

View file

@ -8,7 +8,7 @@ const FORWARD = 1;
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
gTab1 = gBrowser.addTab(gTestPage);
gTab2 = gBrowser.addTab();
gTab3 = gBrowser.addTab();
@ -20,7 +20,7 @@ function test() {
}
function secondPageLoaded() {
Task.spawn(function () {
Task.spawn(function* () {
FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
FullZoomHelper.zoomTest(gTab3, 1, "Initial zoom of tab 3 should be 1");
@ -39,7 +39,7 @@ function secondPageLoaded() {
}
function thirdPageLoaded() {
Task.spawn(function () {
Task.spawn(function* () {
FullZoomHelper.zoomTest(gTab1, gLevel, "Tab 1 should still be zoomed");
FullZoomHelper.zoomTest(gTab2, 1, "Tab 2 should still not be affected");
FullZoomHelper.zoomTest(gTab3, gLevel, "Tab 3 should have zoomed as it was loading in the background");
@ -55,7 +55,7 @@ function thirdPageLoaded() {
}
function imageLoaded() {
Task.spawn(function () {
Task.spawn(function* () {
FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 when image was loaded in the background");
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
FullZoomHelper.zoomTest(gTab1, 1, "Zoom should still be 1 when tab with image is selected");
@ -63,7 +63,7 @@ function imageLoaded() {
}
function imageZoomSwitch() {
Task.spawn(function () {
Task.spawn(function* () {
yield FullZoomHelper.navigate(BACK);
yield FullZoomHelper.navigate(FORWARD);
FullZoomHelper.zoomTest(gTab1, 1, "Tab 1 should not be zoomed when an image loads");
@ -75,7 +75,7 @@ function imageZoomSwitch() {
var finishTestStarted = false;
function finishTest() {
Task.spawn(function () {
Task.spawn(function* () {
ok(!finishTestStarted, "finishTest called more than once");
finishTestStarted = true;
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);

View file

@ -1,6 +1,6 @@
var tabElm, zoomLevel;
function start_test_prefNotSet() {
Task.spawn(function () {
Task.spawn(function* () {
is(ZoomManager.zoom, 1, "initial zoom level should be 1");
FullZoom.enlarge();
@ -13,7 +13,7 @@ function start_test_prefNotSet() {
}
function continue_test_prefNotSet () {
Task.spawn(function () {
Task.spawn(function* () {
is(ZoomManager.zoom, 1, "zoom level pref should not apply to an image");
yield FullZoom.reset();
@ -22,7 +22,7 @@ function continue_test_prefNotSet () {
}
function end_test_prefNotSet() {
Task.spawn(function () {
Task.spawn(function* () {
is(ZoomManager.zoom, zoomLevel, "the zoom level should have persisted");
// Reset the zoom so that other tests have a fresh zoom level
@ -35,7 +35,7 @@ function end_test_prefNotSet() {
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
tabElm = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tabElm);
yield FullZoomHelper.load(tabElm, "http://mochi.test:8888/browser/browser/base/content/test/general/zoom_test.html");

View file

@ -1,7 +1,7 @@
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
let testPage = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
let tab1 = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tab1);

View file

@ -13,7 +13,7 @@ function test() {
const TEST_PAGE_URL = 'data:text/html,<body><iframe src=""></iframe></body>';
const TEST_IFRAME_URL = "http://test2.example.org/";
Task.spawn(function () {
Task.spawn(function* () {
// Prepare the test tab
let tab = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tab);

View file

@ -703,7 +703,7 @@ function test_localfile() {
try {
var path = cr.convertChromeURL(makeURI(CHROMEROOT + "corrupt.xpi")).spec;
} catch (ex) {
var path = CHROMEROOT + "corrupt.xpi";
path = CHROMEROOT + "corrupt.xpi";
}
gBrowser.selectedTab = gBrowser.addTab("about:blank");
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
@ -1133,7 +1133,7 @@ function runNextTest() {
gTestStart = Date.now();
TESTS.shift()();
});
};
}
var XPInstallObserver = {
observe: function (aSubject, aTopic, aData) {

View file

@ -5,7 +5,7 @@ const TEST_PAGE = "/browser/browser/base/content/test/general/dummy_page.html";
var gTestTab, gBgTab, gTestZoom;
function testBackgroundLoad() {
Task.spawn(function () {
Task.spawn(function* () {
is(ZoomManager.zoom, gTestZoom, "opening a background tab should not change foreground zoom");
yield FullZoomHelper.removeTabAndWaitForLocationChange(gBgTab);
@ -17,7 +17,7 @@ function testBackgroundLoad() {
}
function testInitialZoom() {
Task.spawn(function () {
Task.spawn(function* () {
is(ZoomManager.zoom, 1, "initial zoom level should be 1");
FullZoom.enlarge();
@ -32,7 +32,7 @@ function testInitialZoom() {
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
gTestTab = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(gTestTab);
yield FullZoomHelper.load(gTestTab, "http://example.org" + TEST_PAGE);

View file

@ -12,7 +12,7 @@ function test() {
let uri = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
Task.spawn(function () {
Task.spawn(function* () {
tab = gBrowser.addTab();
yield FullZoomHelper.load(tab, uri);
@ -26,7 +26,7 @@ function test() {
// -------------
// Test clean-up
function endTest() {
Task.spawn(function () {
Task.spawn(function* () {
yield FullZoomHelper.removeTabAndWaitForLocationChange(tab);
tab = null;

View file

@ -9,7 +9,7 @@ function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
tab1 = gBrowser.addTab();
tab2 = gBrowser.addTab();
yield FullZoomHelper.selectTabAndWaitForLocationChange(tab1);

View file

@ -113,7 +113,7 @@ add_task(function* test_file() {
gBrowser.removeTab(newTab);
});
add_task(function test_resource_uri() {
add_task(function* test_resource_uri() {
let oldTab = gBrowser.selectedTab;
let dataURI = "resource://gre/modules/Services.jsm";
@ -130,7 +130,7 @@ add_task(function test_resource_uri() {
gBrowser.removeTab(newTab);
});
add_task(function test_data_uri() {
add_task(function* test_data_uri() {
let oldTab = gBrowser.selectedTab;
let dataURI = "data:text/html,hi"
@ -146,7 +146,7 @@ add_task(function test_data_uri() {
gBrowser.removeTab(newTab);
});
add_task(function test_about_uri() {
add_task(function* test_about_uri() {
let oldTab = gBrowser.selectedTab;
let aboutURI = "about:robots"

View file

@ -136,7 +136,7 @@ function runNextTest() {
info("Running " + TESTS[0].name);
TESTS.shift()();
});
};
}
function test() {
waitForExplicitFinish();

View file

@ -11,7 +11,7 @@ var gTab1, gTab2, gLevel1, gLevel2;
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
gTab1 = gBrowser.addTab();
gTab2 = gBrowser.addTab();
@ -22,7 +22,7 @@ function test() {
}
function zoomTab1() {
Task.spawn(function () {
Task.spawn(function* () {
is(gBrowser.selectedTab, gTab1, "Tab 1 is selected");
FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
@ -40,7 +40,7 @@ function zoomTab1() {
}
function zoomTab2() {
Task.spawn(function () {
Task.spawn(function* () {
is(gBrowser.selectedTab, gTab2, "Tab 2 is selected");
FullZoom.reduce();
@ -55,7 +55,7 @@ function zoomTab2() {
}
function testNavigation() {
Task.spawn(function () {
Task.spawn(function* () {
yield FullZoomHelper.load(gTab1, TEST_VIDEO);
FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 when a video was loaded");
yield waitForNextTurn(); // trying to fix orange bug 806046
@ -75,7 +75,7 @@ function waitForNextTurn() {
var finishTestStarted = false;
function finishTest() {
Task.spawn(function () {
Task.spawn(function* () {
ok(!finishTestStarted, "finishTest called more than once");
finishTestStarted = true;

View file

@ -125,17 +125,17 @@ function runMultipleEnginesTestAndFinalize() {
}
function searchDiscovery() {
var head = doc().getElementById("linkparent");
let head = doc().getElementById("linkparent");
if (searchDiscoveryTests.length) {
setHandlerFunc(runSearchDiscoveryTest);
var test = searchDiscoveryTests[0];
var link = doc().createElement("link");
let test = searchDiscoveryTests[0];
let link = doc().createElement("link");
var rel = test.rel || "search";
var href = test.href || "http://so.not.here.mozilla.com/search.xml";
var type = test.type || "application/opensearchdescription+xml";
var title = test.title || searchDiscoveryTests.length;
let rel = test.rel || "search";
let href = test.href || "http://so.not.here.mozilla.com/search.xml";
let type = test.type || "application/opensearchdescription+xml";
let title = test.title || searchDiscoveryTests.length;
if (test.pass == undefined)
test.pass = true;
@ -148,12 +148,12 @@ function searchDiscovery() {
setHandlerFunc(runMultipleEnginesTestAndFinalize);
setHandlerFunc(runMultipleEnginesTestAndFinalize);
// Test multiple engines with the same title
var link = doc().createElement("link");
let link = doc().createElement("link");
link.rel = "search";
link.href = "http://first.mozilla.com/search.xml";
link.type = "application/opensearchdescription+xml";
link.title = "Test Engine";
var link2 = link.cloneNode(false);
let link2 = link.cloneNode(false);
link2.href = "http://second.mozilla.com/search.xml";
head.appendChild(link);

View file

@ -308,7 +308,7 @@ function waitForTab(aCallback) {
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
const webchannelWhitelistPref = "webchannel.allowObject.urlWhitelist";
let origWhitelist = Services.prefs.getCharPref(webchannelWhitelistPref);
let newWhitelist = origWhitelist + " http://example.com";

View file

@ -198,7 +198,7 @@ function makeObserver(aObserveTopic, aObserveFunc) {
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
for (let test of gTests) {
info("Running: " + test.desc);
yield test.run();

View file

@ -41,7 +41,7 @@ function handleMessageEvents(event) {
var bodyInnerHTML = event.source.document.body.innerHTML;
}
catch (e) {
var bodyInnerHTML = "";
bodyInnerHTML = "";
}
if (cacheCount == 2 || bodyInnerHTML.includes("error")) {
clearInterval(intervalID);

View file

@ -134,7 +134,7 @@ add_task(function* test_reader_view_element_attribute_transform() {
triggerFn();
});
};
}
let command = document.getElementById("View:ReaderView");
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser);

View file

@ -18,7 +18,7 @@ function promiseChannelResponse(channelID, originOrPermission) {
resolve(data);
});
});
};
}
// Loads the specified URI in a new tab and waits for it to send us data on our
// test web-channel and resolves with that data.

View file

@ -85,7 +85,7 @@ function isBrowserAppTab(browser) {
var restart = Task.async(function*(browser) {
// If the tab isn't remote this would crash the main process so skip it
if (!browser.isRemoteBrowser)
return browser;
return;
// Make sure the main process has all of the current tab state before crashing
yield TabStateFlusher.flush(browser);

View file

@ -486,7 +486,7 @@ function setupHistory() {
return deferred.promise;
}
function setupFormHistory() {
function* setupFormHistory() {
function searchEntries(terms, params) {
let deferred = Promise.defer();
@ -616,7 +616,7 @@ function setupFormHistory() {
is(checks, 9, "9 checks made");
}
function setupDownloads() {
function* setupDownloads() {
let publicList = yield Downloads.getList(Downloads.PUBLIC);
@ -723,13 +723,10 @@ function setupDownloads() {
* @param aID
* The ids of the downloads to check.
*/
function downloadExists(list, path)
{
return Task.spawn(function() {
let downloadExists = Task.async(function* (list, path) {
let listArray = yield list.getAll();
throw new Task.Result(listArray.some(i => i.target.path == path));
return listArray.some(i => i.target.path == path);
});
}
function isToday(aDate) {
return aDate.getDate() == new Date().getDate();

View file

@ -361,7 +361,7 @@ add_task(function* test_cannot_clear_history() {
ok(cb.length == 1 && !cb[0].disabled, "There is formdata, checkbox to " +
"clear formdata should be enabled.");
var cb = this.win.document.querySelectorAll(
cb = this.win.document.querySelectorAll(
"#itemList > [preference='privacy.cpd.history']");
ok(cb.length == 1 && !cb[0].disabled, "There is history, checkbox to " +
"clear history should be enabled.");

View file

@ -142,12 +142,14 @@ function test() {
is(cookies, "foopy=1", "Cookie should be foopy=1");
gNumSet += 1;
info("gNumSet = " + gNumSet);
} catch (ex if ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
info("onExamineResponse caught NOTAVAIL" + ex);
} catch (ex) {
if (ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
info("onExamineResponse caught NOTAVAIL" + ex);
} else {
info("ionExamineResponse caught " + ex);
}
}
}
function onModifyRequest(subject) {
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
@ -162,12 +164,14 @@ function test() {
// cookie because we are making only 2 requests: one in public mode, and
// one in private mode.
throw "We should never send a cookie in this test";
} catch (ex if ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
info("onModifyRequest caught NOTAVAIL" + ex);
} catch (ex) {
if (ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
info("onModifyRequest caught NOTAVAIL" + ex);
} else {
info("ionModifyRequest caught " + ex);
}
}
}
Services.obs.addObserver(observer, "http-on-modify-request", false);
Services.obs.addObserver(observer, "http-on-examine-response", false);

View file

@ -106,7 +106,7 @@ function getChangeEvents()
});
}
function doSelectTests(contentType, dtd)
function* doSelectTests(contentType, dtd)
{
const pageUrl = "data:" + contentType + "," + escape(dtd + "\n" + PAGECONTENT);
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);

View file

@ -77,7 +77,7 @@ function* testSendReportAutomatically(testURL, suffix, errorURISuffix) {
// Cleanup.
gBrowser.removeTab(tab);
cleanup();
};
}
function* testSetAutomatic(testURL, suffix, errorURISuffix) {
Services.prefs.setBoolPref(PREF_REPORT_ENABLED, true);

View file

@ -137,7 +137,7 @@ function checkButtonsStatus(shouldBeActive) {
]) {
let elt = document.getElementById(eid);
if (shouldBeActive) {
Assert.equal(elt.getAttribute("syncstatus"), "active", `${eid} should be active`);;
Assert.equal(elt.getAttribute("syncstatus"), "active", `${eid} should be active`);
} else {
Assert.ok(!elt.hasAttribute("syncstatus"), `${eid} should have no status attr`);
}

View file

@ -12,7 +12,7 @@ function EventStore() {
this["main-window"] = [];
this["window1"] = [];
this["window2"] = [];
};
}
EventStore.prototype = {
"push": function (event) {
@ -56,12 +56,10 @@ function* getFocusedElementForBrowser(browser, dontCheckExtraFocus = false)
{ dontCheckExtraFocus : dontCheckExtraFocus });
});
}
else {
var focusedWindow = {};
var node = fm.getFocusedElementForWindow(browser.contentWindow, false, focusedWindow);
return "Focus is " + (node ? node.id : "<none>");
}
}
function focusInChild()
{

View file

@ -72,7 +72,7 @@ add_task(function*() {
observer.onDownloadFail = observer.onManyLinksChanged;
DirectoryLinksProvider.addObserver(observer);
return deferred.promise;
};
}
let gOrigDirectorySource = Services.prefs.getCharPref(PREF_NEWTAB_DIRECTORYSOURCE);
registerCleanupFunction(() => {

View file

@ -72,7 +72,7 @@ function test_eventMatchesKey() {
// Make sure to remove the event listener so future tests don't
// fail when they simulate key presses.
document.removeEventListener("keypress", checkEvent);
};
}
runNextTest();
}

View file

@ -402,7 +402,7 @@ var gTests = [
function test() {
waitForExplicitFinish();
Task.spawn(function () {
Task.spawn(function* () {
for (let test of gTests) {
info("Running: " + test.desc);
yield test.run();

View file

@ -156,7 +156,7 @@ function childFunction()
windowGotDeactivate = false;
});
content.addEventListener("activate", function() {
windowGotActivate = true;;
windowGotActivate = true;
});
content.addEventListener("deactivate", function() {

View file

@ -75,9 +75,9 @@ function updateTabContextMenu(tab, onOpened) {
yield onOpened();
onFinished();
});
} else {
onFinished();
}
onFinished();
return Promise.resolve();
}
function openToolbarCustomizationUI(aCallback, aBrowserWin) {
@ -1023,7 +1023,11 @@ function getPropertyBagValue(bag, key) {
try {
let val = bag.getProperty(key);
return val;
} catch(e if e.result == Cr.NS_ERROR_FAILURE) {}
} catch (e) {
if (e.result != Cr.NS_ERROR_FAILURE) {
throw e;
}
}
return null;
}
@ -1165,6 +1169,7 @@ function getCertExceptionDialog(aLocation) {
}
}
}
return undefined;
}
function setupRemoteClientsFixture(fixture) {

View file

@ -125,14 +125,10 @@ add_task(function* () {
return aLink2.frecency - aLink1.frecency ||
aLink2.lastVisitDate - aLink1.lastVisitDate;
}
else {
if (aLink2.type == "history") {
return 1;
}
else {
return -1;
}
}
};
// add a row of history tiles, directory tiles will be clipped off, hence no scrollbar

View file

@ -39,7 +39,7 @@ add_task(function* () {
});
var windowsToClose = [];
function testOnWindow(options) {
function* testOnWindow(options) {
let newWindowPromise = BrowserTestUtils.waitForNewWindow();
var win = OpenBrowserWindow(options);
windowsToClose.push(win);

View file

@ -109,7 +109,7 @@ function watchLinksChangeOnce() {
observer.onDownloadFail = observer.onManyLinksChanged;
DirectoryLinksProvider.addObserver(observer);
});
};
}
add_task(function* setup() {
registerCleanupFunction(function() {
@ -250,6 +250,7 @@ function setPinnedLinks(aLinks) {
return {url: "http://example" + (id != "-1" ? id : "") + ".com/",
title: "site#" + id,
type: "history"};
return undefined;
});
}

View file

@ -116,7 +116,7 @@ add_task(function*() {
// Make sure the UI matches our expectations...
let style = content.getComputedStyle(getUI("pleaseSubmit"));
if (style.display != "block") {
return Promise.reject(`Submission UI visibility is not correct. ` +
throw new Error(`Submission UI visibility is not correct. ` +
`Expected block style, got ${style.display}.`);
}
@ -125,7 +125,7 @@ add_task(function*() {
getUI("submitComment").value = "a test comment";
let optIn = getUI("submitURLOptIn");
if (!optIn.checked) {
return Promise.reject("URL opt-in should default to true.");
throw new Error("URL opt-in should default to true.");
}
// Submit the report.

View file

@ -41,7 +41,7 @@ add_task(function* () {
let plugin = content.document.getElementById("test");
if (!plugin) {
Assert.ok(false, "plugin element not available.");
return false;
return;
}
// We can't use MochiKit's routine
let style = content.getComputedStyle(plugin);

View file

@ -198,6 +198,10 @@ function getPropertyBagValue(bag, key) {
try {
var val = bag.getProperty(key);
}
catch (e if e.result == Cr.NS_ERROR_FAILURE) {}
catch (e) {
if (e.result != Cr.NS_ERROR_FAILURE) {
throw e;
}
}
return val;
}

View file

@ -10,7 +10,7 @@ function startSimpleClickTestCase(aTestNumber) {
});
clickTheLink(gTestWindow, "testlink", {});
};
}
function test() {
requestLongerTimeout(10); // slowwww shutdown on e10s

View file

@ -78,7 +78,7 @@ function test()
PopupNotifications.panel.removeAttribute("animate");
});
Task.spawn(function () {
Task.spawn(function* () {
for (let test of gTests) {
info(test.desc);

View file

@ -27,7 +27,7 @@ function removeProvider(provider) {
}
function postTestCleanup(callback) {
Task.spawn(function () {
Task.spawn(function* () {
// any tabs opened by the test.
for (let tab of tabsToRemove) {
yield BrowserTestUtils.removeTab(tab);
@ -92,7 +92,7 @@ function clickAddonRemoveButton(tab, aCallback) {
AddonManager.getAddonsByTypes(["service"], function(aAddons) {
let addon = aAddons[0];
let doc = tab.linkedBrowser.contentDocument;;
let doc = tab.linkedBrowser.contentDocument;
let list = doc.getElementById("addon-list");
let item = getAddonItemInList(addon.id, list);

View file

@ -61,14 +61,14 @@ function runSocialTestWithProvider(manifest, callback, finishcallback) {
let manifests = Array.isArray(manifest) ? manifest : [manifest];
// Check that none of the provider's content ends up in history.
function finishCleanUp() {
function* finishCleanUp() {
for (let i = 0; i < manifests.length; i++) {
let m = manifests[i];
for (let what of ['iconURL', 'shareURL']) {
if (m[what]) {
yield promiseSocialUrlNotRemembered(m[what]);
}
};
}
}
for (let i = 0; i < gURLsNotRemembered.length; i++) {
yield promiseSocialUrlNotRemembered(gURLsNotRemembered[i]);

View file

@ -203,7 +203,7 @@ function promiseCheckChildNoFocusedElement(browser)
{
if (!gMultiProcessBrowser) {
Assert.equal(Services.focus.focusedElement, null, "There should be no focused element");
return;
return null;
}
return ContentTask.spawn(browser, { }, function* () {

View file

@ -30,7 +30,7 @@ function promiseNewTabSwitched() {
});
}
function testURL(url, loadFunc, endFunc) {
function* testURL(url, loadFunc, endFunc) {
let tabSwitchedPromise = promiseNewTabSwitched();
let tab = gBrowser.selectedTab = gBrowser.addTab();
let browser = gBrowser.selectedBrowser;

View file

@ -7,7 +7,7 @@
add_task(function* () {
let baseURL = "https://example.org/browser/browser/base/content/test/urlbar/dummy_page.html";
let url = baseURL + "#foo";
yield BrowserTestUtils.withNewTab({ gBrowser, url }, function(browser) {
yield BrowserTestUtils.withNewTab({ gBrowser, url }, function*(browser) {
let identityBox = document.getElementById("identity-box");
let expectedURL = url;

View file

@ -7,7 +7,7 @@ add_task(function* prepare() {
let engine = yield promiseNewSearchEngine(TEST_ENGINE_BASENAME);
let oldCurrentEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
registerCleanupFunction(function () {
registerCleanupFunction(function* () {
Services.prefs.clearUserPref(SUGGEST_URLBAR_PREF);
Services.search.currentEngine = oldCurrentEngine;

View file

@ -15,7 +15,7 @@ var gTests = [
{
desc: "getUserMedia audio+video",
run: function checkAudioVideo() {
run: function* checkAudioVideo() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(true, true);
yield promise;
@ -44,7 +44,7 @@ var gTests = [
{
desc: "getUserMedia audio only",
run: function checkAudioOnly() {
run: function* checkAudioOnly() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(true);
yield promise;
@ -73,7 +73,7 @@ var gTests = [
{
desc: "getUserMedia video only",
run: function checkVideoOnly() {
run: function* checkVideoOnly() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(false, true);
yield promise;
@ -101,7 +101,7 @@ var gTests = [
{
desc: "getUserMedia audio+video, user clicks \"Don't Share\"",
run: function checkDontShare() {
run: function* checkDontShare() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(true, true);
yield promise;
@ -120,7 +120,7 @@ var gTests = [
{
desc: "getUserMedia audio+video: stop sharing",
run: function checkStopSharing() {
run: function* checkStopSharing() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(true, true);
yield promise;
@ -148,7 +148,7 @@ var gTests = [
{
desc: "getUserMedia audio+video: reloading the page removes all gUM UI",
run: function checkReloading() {
run: function* checkReloading() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(true, true);
yield promise;
@ -184,10 +184,10 @@ var gTests = [
{
desc: "getUserMedia prompt: Always/Never Share",
run: function checkRememberCheckbox() {
run: function* checkRememberCheckbox() {
let elt = id => document.getElementById(id);
function checkPerm(aRequestAudio, aRequestVideo,
function* checkPerm(aRequestAudio, aRequestVideo,
aExpectedAudioPerm, aExpectedVideoPerm, aNever) {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(aRequestAudio, aRequestVideo);
@ -261,8 +261,8 @@ var gTests = [
{
desc: "getUserMedia without prompt: use persistent permissions",
run: function checkUsePersistentPermissions() {
function usePerm(aAllowAudio, aAllowVideo, aRequestAudio, aRequestVideo,
run: function* checkUsePersistentPermissions() {
function* usePerm(aAllowAudio, aAllowVideo, aRequestAudio, aRequestVideo,
aExpectStream) {
let Perms = Services.perms;
let uri = gBrowser.selectedBrowser.documentURI;
@ -381,8 +381,8 @@ var gTests = [
{
desc: "Stop Sharing removes persistent permissions",
run: function checkStopSharingRemovesPersistentPermissions() {
function stopAndCheckPerm(aRequestAudio, aRequestVideo) {
run: function* checkStopSharingRemovesPersistentPermissions() {
function* stopAndCheckPerm(aRequestAudio, aRequestVideo) {
let Perms = Services.perms;
let uri = gBrowser.selectedBrowser.documentURI;
@ -435,7 +435,7 @@ var gTests = [
{
desc: "test showControlCenter",
run: function checkShowControlCenter() {
run: function* checkShowControlCenter() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(false, true);
yield promise;
@ -476,7 +476,7 @@ var gTests = [
{
desc: "'Always Allow' ignored and not shown on http pages",
run: function checkNoAlwaysOnHttp() {
run: function* checkNoAlwaysOnHttp() {
// Load an http page instead of the https version.
let browser = gBrowser.selectedBrowser;
browser.loadURI(browser.documentURI.spec.replace("https://", "http://"));
@ -532,7 +532,7 @@ function test() {
ok(gIdentityHandler._identityPopup.hidden,
"should start the test with the control center hidden");
Task.spawn(function () {
Task.spawn(function* () {
yield SpecialPowers.pushPrefEnv({"set": [[PREF_PERMISSION_FAKE, true]]});
for (let test of gTests) {

View file

@ -9,7 +9,7 @@ var gTests = [
{
desc: "device sharing animation on background tabs",
run: function checkAudioVideo() {
run: function* checkAudioVideo() {
function* getStreamAndCheckBackgroundAnim(aAudio, aVideo, aSharing) {
// Get a stream
let popupPromise = promisePopupNotificationShown("webRTC-shareDevices");
@ -85,7 +85,7 @@ function test() {
is(PopupNotifications._currentNotifications.length, 0,
"should start the test without any prior popup notification");
Task.spawn(function () {
Task.spawn(function* () {
yield SpecialPowers.pushPrefEnv({"set": [[PREF_PERMISSION_FAKE, true]]});
for (let test of gTests) {

View file

@ -16,7 +16,7 @@ var gTests = [
{
desc: "getUserMedia audio+video",
run: function checkAudioVideo() {
run: function* checkAudioVideo() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(true, true, "frame1");
yield promise;
@ -45,7 +45,7 @@ var gTests = [
{
desc: "getUserMedia audio+video: stop sharing",
run: function checkStopSharing() {
run: function* checkStopSharing() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(true, true, "frame1");
yield promise;
@ -86,7 +86,7 @@ var gTests = [
{
desc: "getUserMedia audio+video: reloading the frame removes all sharing UI",
run: function checkReloading() {
run: function* checkReloading() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(true, true, "frame1");
yield promise;
@ -121,7 +121,7 @@ var gTests = [
{
desc: "getUserMedia audio+video: reloading the frame removes prompts",
run: function checkReloadingRemovesPrompts() {
run: function* checkReloadingRemovesPrompts() {
let promise = promisePopupNotificationShown("webRTC-shareDevices");
yield promiseRequestDevice(true, true, "frame1");
yield promise;
@ -141,7 +141,7 @@ var gTests = [
{
desc: "getUserMedia audio+video: reloading a frame updates the sharing UI",
run: function checkUpdateWhenReloading() {
run: function* checkUpdateWhenReloading() {
// We'll share only the mic in the first frame, then share both in the
// second frame, then reload the second frame. After each step, we'll check
// the UI is in the correct state.
@ -216,7 +216,7 @@ function test() {
is(PopupNotifications._currentNotifications.length, 0,
"should start the test without any prior popup notification");
Task.spawn(function () {
Task.spawn(function* () {
yield SpecialPowers.pushPrefEnv({"set": [[PREF_PERMISSION_FAKE, true]]});
for (let test of gTests) {

View file

@ -71,7 +71,7 @@ function promiseIndicatorWindow() {
return promiseWindow("chrome://browser/content/webrtcIndicator.xul");
}
function assertWebRTCIndicatorStatus(expected) {
function* assertWebRTCIndicatorStatus(expected) {
let ui = Cu.import("resource:///modules/webrtcUI.jsm", {}).webrtcUI;
let expectedState = expected ? "visible" : "hidden";
let msg = "WebRTC indicator " + expectedState;
@ -436,8 +436,7 @@ function* checkSharingUI(aExpected) {
if (expected) {
is(icon.length, 1, "should show " + id + " icon in control center panel");
ok(icon[0].classList.contains("in-use"), "icon should have the in-use class");
} else {
if (!icon.length) {
} else if (!icon.length) {
ok(true, "should not show " + id + " icon in the control center panel");
} else {
// This will happen if there are persistent permissions set.
@ -446,7 +445,6 @@ function* checkSharingUI(aExpected) {
is(icon.length, 1, "should not show more than 1 " + id + " icon");
}
}
}
gIdentityHandler._identityPopup.hidden = true;
// Check the global indicators.