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

@ -66,7 +66,7 @@ var gTests = [
deferred.resolve();
}
});
} catch(e) {
} catch (e) {
ok(false, "Failed to get all commands");
deferred.reject();
}
@ -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)
@ -86,7 +86,7 @@ var gTests = [
}
}, true);
} catch(e) {
} catch (e) {
ok(false, "Failed to get all commands");
deferred.reject();
}
@ -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,16 +4,15 @@ 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) => {
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");
return true;
}
return false;
});
}
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");
return true;
}
return false;
});
}
function* play(tab) {
@ -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

@ -10,12 +10,12 @@ var gTests = [
{ desc: "Urlbar strips newlines and surrounding whitespace",
element: gURLBar,
expected: kTestString.replace(/\s*\n\s*/g,'')
expected: kTestString.replace(/\s*\n\s*/g, '')
},
{ desc: "Searchbar replaces newlines with spaces",
element: document.getElementById('searchbar'),
expected: kTestString.replace(/\n/g,' ')
expected: kTestString.replace(/\n/g, ' ')
},
];

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

@ -17,7 +17,7 @@ function test() {
gBrowser.removeCurrentTab({animate: true});
try {
gBrowser.tabContainer.advanceSelectedTab(-1, false);
} catch(err) {
} catch (err) {
ok(false, "Shouldn't throw");
}

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

@ -20,7 +20,7 @@ function test() {
try {
gFindBar.close();
ok(true, "findbar.close should not throw an exception");
} catch(e) {
} catch (e) {
ok(false, "findbar.close threw exception: " + e);
}
finish();

View file

@ -55,7 +55,7 @@ function MixedTest1B() {
waitForCondition(() => content.document.getElementById('p1').innerHTML == "hello", MixedTest1C, "Waited too long for mixed script to run in Test 1");
}
function MixedTest1C() {
ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 1");
ok(content.document.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 1");
gTestBrowser.removeEventListener("load", MixedTest1B, true);
MixedTest2();
}
@ -95,8 +95,8 @@ function MixedTest3C() {
waitForCondition(() => content.document.getElementById('p2').innerHTML == "bye", MixedTest3D, "Waited too long for mixed image to load in Test 3");
}
function MixedTest3D() {
ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 3");
ok(content.document.getElementById('p2').innerHTML == "bye","Mixed image didn't load in Test 3");
ok(content.document.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 3");
ok(content.document.getElementById('p2').innerHTML == "bye", "Mixed image didn't load in Test 3");
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: true});
MixedTest4();
}
@ -129,7 +129,7 @@ function MixedTest4C() {
waitForCondition(() => content.document.getElementById('p1').innerHTML == "", MixedTest4D, "Mixed script loaded in test 4 after location change!");
}
function MixedTest4D() {
ok(content.document.getElementById('p1').innerHTML == "","p1.innerHTML changed; mixed script loaded after location change in Test 4");
ok(content.document.getElementById('p1').innerHTML == "", "p1.innerHTML changed; mixed script loaded after location change in Test 4");
MixedTest5();
}
@ -153,7 +153,7 @@ function MixedTest5B() {
waitForCondition(() => content.document.getElementById('p1').innerHTML == "hello", MixedTest5C, "Waited too long for mixed script to run in Test 5");
}
function MixedTest5C() {
ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 5");
ok(content.document.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 5");
MixedTest6();
}
@ -190,7 +190,7 @@ function MixedTest6C() {
}, MixedTest6D, "Waited too long for mixed script to run in Test 6");
}
function MixedTest6D() {
ok(content.document.getElementById('f1').contentDocument.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 6");
ok(content.document.getElementById('f1').contentDocument.getElementById('p1').innerHTML == "hello", "Mixed script didn't load in Test 6");
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: false});
MixedTestsCompleted();
}

View file

@ -4,7 +4,7 @@
* Tests that the identity-box shows the chromeUI styling
* when viewing about:home in a new window.
*/
add_task(function*(){
add_task(function*() {
let homepage = "about:home";
yield SpecialPowers.pushPrefEnv({
"set": [

View file

@ -17,7 +17,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");
function setup(){
function setup() {
gPrefService.setBoolPref("browser.altClickSave", true);
let testPage =
@ -52,7 +52,7 @@ add_task(function* test_alt_click()
let downloads = [];
let downloadView;
// When 1 download has been attempted then resolve the promise.
let finishedAllDownloads = new Promise( (resolve)=> {
let finishedAllDownloads = new Promise( (resolve) => {
downloadView = {
onDownloadAdded: function (aDownload) {
downloads.push(aDownload);
@ -81,7 +81,7 @@ add_task(function* test_alt_click_on_xlinks()
let downloads = [];
let downloadView;
// When all 2 downloads have been attempted then resolve the promise.
let finishedAllDownloads = new Promise( (resolve)=> {
let finishedAllDownloads = new Promise( (resolve) => {
downloadView = {
onDownloadAdded: function (aDownload) {
downloads.push(aDownload);

View file

@ -690,17 +690,17 @@ add_task(function* test_select_input_text() {
return;
yield test_contextmenu("#test-select-input-text",
["context-undo", false,
"---", null,
"context-cut", true,
"context-copy", true,
"context-paste", null, // ignore clipboard state
"context-delete", true,
"---", null,
"context-selectall", true,
"context-searchselect",true,
"---", null,
"spell-check-enabled", true
["context-undo", false,
"---", null,
"context-cut", true,
"context-copy", true,
"context-paste", null, // ignore clipboard state
"context-delete", true,
"---", null,
"context-selectall", true,
"context-searchselect", true,
"---", null,
"spell-check-enabled", true
].concat(LOGIN_FILL_ITEMS),
{
*preCheckContextMenuFn() {

View file

@ -7,9 +7,9 @@ add_task(function* () {
checkTabs(4);
yield ctrlTabTest([2] , 1, 0);
yield ctrlTabTest([2], 1, 0);
yield ctrlTabTest([2, 3, 1], 2, 2);
yield ctrlTabTest([] , 4, 2);
yield ctrlTabTest([], 4, 2);
{
let selectedIndex = gBrowser.tabContainer.selectedIndex;

View file

@ -96,7 +96,7 @@ var checkInfobarButton = Task.async(function* (aNotification) {
yield promiseNextTick();
});
add_task(function* setup(){
add_task(function* setup() {
const bypassNotification = Preferences.get(PREF_BYPASS_NOTIFICATION, true);
const currentPolicyVersion = Preferences.get(PREF_CURRENT_POLICY_VERSION, 1);
@ -120,7 +120,7 @@ function clearAcceptedPolicy() {
Preferences.reset(PREF_ACCEPTED_POLICY_DATE);
}
add_task(function* test_single_window(){
add_task(function* test_single_window() {
clearAcceptedPolicy();
// Close all the notifications, then try to trigger the data choices infobar.
@ -164,7 +164,7 @@ add_task(function* test_single_window(){
"Date pref set.");
});
add_task(function* test_multiple_windows(){
add_task(function* test_multiple_windows() {
clearAcceptedPolicy();
// Close all the notifications, then try to trigger the data choices infobar.
@ -211,7 +211,7 @@ add_task(function* test_multiple_windows(){
yield BrowserTestUtils.closeWindow(otherWindow);
// Check that we are clear to upload and that the policy data us saved.
Assert.ok(TelemetryReportingPolicy.canUpload(),"User should be allowed to upload now.");
Assert.ok(TelemetryReportingPolicy.canUpload(), "User should be allowed to upload now.");
Assert.equal(TelemetryReportingPolicy.testIsUserNotified(), true,
"User notified about datareporting policy.");
Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_VERSION, 0), TEST_POLICY_VERSION,

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

@ -27,7 +27,7 @@ function test () {
});
}
registerCleanupFunction(function(){
registerCleanupFunction(function() {
// Exit browser fullscreen mode.
BrowserFullScreen();
@ -331,7 +331,7 @@ WindowListener.prototype = {
// wait for trasition to fullscreen on OSX Lion later
if (isOSX) {
setTimeout(function(){
setTimeout(function() {
domwindow.close();
executeSoon(this.callBack_onFinalize);
}.bind(this), 3000);

View file

@ -6,7 +6,7 @@
</head>
<body>
<script>
window.onload = function(){
window.onload = function() {
var event = new window.CustomEvent("WebChannelMessageToChrome", {
// Note: This intentionally sends an object instead of a string, to ensure both work
// (see browser_fxa_oauth_with_keys.html for the other test)

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

@ -6,7 +6,7 @@
</head>
<body>
<script>
window.onload = function(){
window.onload = function() {
var event = new window.CustomEvent("WebChannelMessageToChrome", {
// Note: This intentionally sends a string instead of an object, to ensure both work
// (see browser_fxa_oauth.html for the other test)

View file

@ -8,10 +8,10 @@
<script>
var webChannelId = "account_updates_test";
window.onload = function(){
window.onload = function() {
var testName = window.location.search.replace(/^\?/, "");
switch(testName) {
switch (testName) {
case "profile_change":
test_profile_change();
break;

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

@ -24,7 +24,7 @@ add_task(function *() {
}, resolve);
});
let url = gHttpTestUrl
yield BrowserTestUtils.withNewTab({gBrowser, url}, function*(){
yield BrowserTestUtils.withNewTab({gBrowser, url}, function*() {
gTestBrowser = gBrowser.selectedBrowser;
// check security state is insecure
isSecurityState("insecure");

View file

@ -16,7 +16,7 @@ const gHttpsTestRoot2 = "https://test2.example.com/browser/browser/base/content/
var gTestBrowser = null;
add_task(function *() {
let url = gHttpTestRoot1 + "file_mixedContentFromOnunload.html";
yield BrowserTestUtils.withNewTab({gBrowser, url}, function*(){
yield BrowserTestUtils.withNewTab({gBrowser, url}, function*() {
yield new Promise(resolve => {
SpecialPowers.pushPrefEnv({
"set": [

View file

@ -118,7 +118,7 @@ add_task(function* test_reader_view_element_attribute_transform() {
let observer = new MutationObserver((mutations) => {
mutations.forEach( mu => {
let muValue = element.getAttribute(attribute);
if(element.getAttribute(attribute) !== mu.oldValue) {
if (element.getAttribute(attribute) !== mu.oldValue) {
checkFn();
resolve();
observer.disconnect();
@ -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 listArray = yield list.getAll();
throw new Task.Result(listArray.some(i => i.target.path == path));
});
}
let downloadExists = Task.async(function* (list, path) {
let listArray = yield list.getAll();
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.");
@ -644,7 +644,7 @@ var now_uSec = now_mSec * 1000;
*/
function WindowHelper(aWin) {
this.win = aWin;
this.promiseClosed = new Promise(resolve => {this._resolveClosed = resolve});
this.promiseClosed = new Promise(resolve => { this._resolveClosed = resolve });
}
WindowHelper.prototype = {

View file

@ -142,10 +142,12 @@ 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) {
info("ionExamineResponse caught " + ex);
if (ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
info("onExamineResponse caught NOTAVAIL" + ex);
} else {
info("ionExamineResponse caught " + ex);
}
}
}
@ -162,10 +164,12 @@ 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) {
info("ionModifyRequest caught " + ex);
if (ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {
info("onModifyRequest caught NOTAVAIL" + ex);
} else {
info("ionModifyRequest caught " + ex);
}
}
}

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,11 +56,9 @@ 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>");
}
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

@ -137,9 +137,9 @@ add_task(function* testPrivateBrowsing() {
yield tabReloadPromise;
// Sum up all the counts to make sure that nothing got logged
is(getEnabledCounts().reduce((p,c)=>p+c), 0, "Telemetry logging off in PB mode");
is(getEventCounts().reduce((p,c)=>p+c), 0, "Telemetry logging off in PB mode");
is(getShieldCounts().reduce((p,c)=>p+c), 0, "Telemetry logging off in PB mode");
is(getEnabledCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
is(getEventCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
is(getShieldCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
yield promiseWindowClosed(privateWin);
});

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

@ -11,7 +11,7 @@
window.onload = function() {
var testName = window.location.search.replace(/^\?/, "");
switch(testName) {
switch (testName) {
case "generic":
test_generic();
break;

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

@ -10,7 +10,7 @@
window.onload = function() {
var testName = window.location.search.replace(/^\?/, "");
switch(testName) {
switch (testName) {
case "iframe":
test_iframe();
break;

View file

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

View file

@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=822367
<script>
function createDoc()
{
var doc=document.open("text/html","replace");
var doc=document.open("text/html", "replace");
doc.write('<!DOCTYPE html><html><body><p id="p1">This is some content</p><script src="http://example.com/browser/browser/base/content/test/general/file_bug822367_1.js">\<\/script\>\<\/body>\<\/html>');
doc.close();
}

View file

@ -75,9 +75,9 @@ function updateTabContextMenu(tab, onOpened) {
yield onOpened();
onFinished();
});
} else {
onFinished();
}
onFinished();
return Promise.resolve();
}
function openToolbarCustomizationUI(aCallback, aBrowserWin) {
@ -692,7 +692,7 @@ function assertMixedContentBlockingState(tabbrowser, states = {}) {
throw new Error("assertMixedContentBlockingState requires a browser and a states object");
}
let {passiveLoaded,activeLoaded,activeBlocked} = states;
let {passiveLoaded, activeLoaded, activeBlocked} = states;
let {gIdentityHandler} = tabbrowser.ownerGlobal;
let doc = tabbrowser.ownerDocument;
let identityBox = gIdentityHandler._identityBox;
@ -837,7 +837,7 @@ function is_hidden(element) {
if (style.visibility != "visible")
return true;
if (style.display == "-moz-popup")
return ["hiding","closed"].indexOf(element.state) != -1;
return ["hiding", "closed"].indexOf(element.state) != -1;
// Hiding a parent element will hide all its children
if (element.parentNode != element.ownerDocument)
@ -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;
}
if (aLink2.type == "history") {
return 1;
}
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

@ -18,7 +18,7 @@ const PLUGIN_SMALL_PAGE = gTestRoot + "plugin_small.html";
function convertPropertyBag(aBag) {
let result = {};
let enumerator = aBag.enumerator;
while(enumerator.hasMoreElements()) {
while (enumerator.hasMoreElements()) {
let { name, value } = enumerator.getNext().QueryInterface(Ci.nsIProperty);
if (value instanceof Ci.nsIPropertyBag) {
value = convertPropertyBag(value);
@ -95,7 +95,7 @@ add_task(function*() {
try {
Components.utils.waiveXrays(plugin).crash();
} catch(e) {
} catch (e) {
}
let doc = plugin.ownerDocument;
@ -116,8 +116,8 @@ 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. ` +
`Expected block style, got ${style.display}.`);
throw new Error(`Submission UI visibility is not correct. ` +
`Expected block style, got ${style.display}.`);
}
// Fill the crash report in with some test values that we'll test for in
@ -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.
@ -197,7 +197,7 @@ add_task(function*() {
try {
Components.utils.waiveXrays(plugin).crash();
} catch(e) {}
} catch (e) {}
});
// Wait for the notification bar to be displayed.

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

@ -78,7 +78,7 @@ add_task(function* () {
yield promiseUpdatePluginBindings(gTestBrowser);
ok(stored(["foo.com","bar.com","baz.com","qux.com"]),
ok(stored(["foo.com", "bar.com", "baz.com", "qux.com"]),
"Data stored for sites");
// Clear 20 seconds ago
@ -86,7 +86,7 @@ add_task(function* () {
sanitizer.range = [now_uSec - 20*1000000, now_uSec];
yield sanitizer.sanitize();
ok(stored(["bar.com","qux.com"]), "Data stored for sites");
ok(stored(["bar.com", "qux.com"]), "Data stored for sites");
ok(!stored(["foo.com"]), "Data cleared for foo.com");
ok(!stored(["baz.com"]), "Data cleared for baz.com");
@ -109,7 +109,7 @@ add_task(function* () {
yield promiseUpdatePluginBindings(gTestBrowser);
ok(stored(["foo.com","bar.com","baz.com","qux.com"]),
ok(stored(["foo.com", "bar.com", "baz.com", "qux.com"]),
"Data stored for sites");
// Attempt to clear 20 seconds ago. The plugin will throw

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

@ -23,7 +23,7 @@ function prepareTest(nextTest, url, browser) {
if (!browser)
browser = gTestBrowser;
ContentTask.spawn(browser, url, function(url){
ContentTask.spawn(browser, url, function(url) {
content.location = url;
});
}

View file

@ -98,7 +98,7 @@ function* runNextTest() {
shownState = true;
info("[" + nextTest.id + "] popup shown");
Task.spawn(() => nextTest.onShown(this))
.then(undefined , ex => Assert.ok(false, "onShown failed: " + ex));
.then(undefined, ex => Assert.ok(false, "onShown failed: " + ex));
});
onPopupEvent("popuphidden", function () {
info("[" + nextTest.id + "] popup hidden");

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

@ -92,12 +92,12 @@ var tests = {
ok(true, "added and removed provider");
finishTest(true);
});
} catch(e) {
} catch (e) {
ok(false, "SocialService.disableProvider threw exception: " + e);
finishTest(false);
}
});
} catch(e) {
} catch (e) {
ok(false, "SocialService.addProvider threw exception: " + e);
finishTest(false);
}
@ -118,7 +118,7 @@ var tests = {
finishTest(false);
});
});
} catch(e) {
} catch (e) {
ok(true, "SocialService.addProvider should throw blocklist exception: " + e);
finishTest(true);
}
@ -143,7 +143,7 @@ var tests = {
Social.installProvider(data, function(addonManifest) {
finishTest(false);
});
} catch(e) {
} catch (e) {
finishTest(true);
}
});
@ -203,7 +203,7 @@ var tests = {
// to fire.
setAndUpdateBlocklist(blocklistURL);
});
} catch(e) {
} catch (e) {
ok(false, "unable to add provider " + e);
next();
}

View file

@ -198,7 +198,7 @@ var tests = {
BrowserTestUtils.removeTab(testTab).then(() => {
hasoptions(testData.options, JSON.parse(msg.data));
testData = corpus[testIndex++];
BrowserTestUtils.waitForCondition(() => { return SocialShare.currentShare == null; },"share panel closed").then(() => {
BrowserTestUtils.waitForCondition(() => { return SocialShare.currentShare == null; }, "share panel closed").then(() => {
if (testData) {
runOneTest();
} else {

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]);
@ -153,10 +153,10 @@ function runSocialTests(tests, cbPreTest, cbPostTest, cbFinish) {
if (cbPreTest === undefined) {
cbPreTest = function(cb) {cb()};
cbPreTest = function(cb) { cb() };
}
if (cbPostTest === undefined) {
cbPostTest = function(cb) {cb()};
cbPostTest = function(cb) { cb() };
}
function runNextTest() {
@ -213,7 +213,7 @@ function setManifestPref(name, manifest) {
function getManifestPrefname(aManifest) {
// is same as the generated name in SocialServiceInternal.getManifestPrefname
let originUri = Services.io.newURI(aManifest.origin, null, null);
return "social.manifest." + originUri.hostPort.replace('.','-');
return "social.manifest." + originUri.hostPort.replace('.', '-');
}
function ensureFrameLoaded(frame, uri) {

View file

@ -26,7 +26,7 @@ add_task(function*() {
is(specificPanel.state, "open", "specificPanel has been opened");
let generalPanelPromise = BrowserTestUtils.waitForEvent(generalPanel, "popupshown");
generalPanel.openPopupAtScreen(510,510);
generalPanel.openPopupAtScreen(510, 510);
yield generalPanelPromise;
is(generalPanel.state, "open", "generalPanel has been opened");

View file

@ -27,13 +27,13 @@ add_task(function*() {
is(result._actionText.textContent, "", "Action text should be empty");
info("During override");
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keydown" });
EventUtils.synthesizeKey("VK_SHIFT", { type: "keydown" });
is_element_visible(titleHbox, "Title element should be visible");
is_element_hidden(urlHbox, "URL element should be hidden");
is_element_visible(actionHbox, "Action element should be visible");
is(result._actionText.textContent, "", "Action text should be empty");
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keyup" });
EventUtils.synthesizeKey("VK_SHIFT", { type: "keyup" });
gURLBar.popup.hidePopup();
yield promisePopupHidden(gURLBar.popup);

View file

@ -15,7 +15,7 @@ add_task(function* () {
try {
gBrowser.removeTab(tab);
} catch(ex) { /* tab may have already been closed in case of failure */ }
} catch (ex) { /* tab may have already been closed in case of failure */ }
return PlacesTestUtils.clearHistory();
});

View file

@ -16,7 +16,7 @@ add_task(function* () {
try {
gBrowser.removeTab(tab);
} catch(ex) { /* tab may have already been closed in case of failure */ }
} catch (ex) { /* tab may have already been closed in case of failure */ }
return PlacesTestUtils.clearHistory();
});
@ -28,7 +28,7 @@ add_task(function* () {
ok(result.getAttribute("image") === engine.iconURI.spec,
"Image attribute should have the search engine's icon");
EventUtils.synthesizeKey("VK_RETURN" , { });
EventUtils.synthesizeKey("VK_RETURN", { });
yield promiseTabLoaded(gBrowser.selectedTab);
is(gBrowser.selectedBrowser.currentURI.spec, "http://example.com/?q=open+a+search");

View file

@ -17,7 +17,7 @@ add_task(function* test_switchtab_override() {
try {
gBrowser.removeTab(tab);
gBrowser.removeTab(secondTab);
} catch(ex) { /* tabs may have already been closed in case of failure */ }
} catch (ex) { /* tabs may have already been closed in case of failure */ }
});
info("Wait for autocomplete")
@ -34,11 +34,11 @@ add_task(function* test_switchtab_override() {
gURLBar.focus();
gURLBar.value = "dummy_pag";
EventUtils.synthesizeKey("e" , {});
EventUtils.synthesizeKey("e", {});
yield deferred.promise;
info("Select second autocomplete popup entry");
EventUtils.synthesizeKey("VK_DOWN" , {});
EventUtils.synthesizeKey("VK_DOWN", {});
ok(/moz-action:switchtab/.test(gURLBar.value), "switch to tab entry found");
info("Override switch-to-tab");
@ -54,10 +54,10 @@ add_task(function* test_switchtab_override() {
// Otherwise it would load the page.
whenTabLoaded(secondTab, deferred.resolve);
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keydown" });
EventUtils.synthesizeKey("VK_RETURN" , { });
EventUtils.synthesizeKey("VK_SHIFT", { type: "keydown" });
EventUtils.synthesizeKey("VK_RETURN", { });
info(`gURLBar.value = ${gURLBar.value}`);
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keyup" });
EventUtils.synthesizeKey("VK_SHIFT", { type: "keyup" });
yield deferred.promise;
yield PlacesTestUtils.clearHistory();

View file

@ -17,24 +17,24 @@ add_task(function* test_switchtab_override_keynav() {
try {
gBrowser.removeTab(tab);
gBrowser.removeTab(secondTab);
} catch(ex) { /* tabs may have already been closed in case of failure */ }
} catch (ex) { /* tabs may have already been closed in case of failure */ }
return PlacesTestUtils.clearHistory();
});
gURLBar.focus();
gURLBar.value = "dummy_pag";
EventUtils.synthesizeKey("e" , {});
EventUtils.synthesizeKey("e", {});
yield promiseSearchComplete();
info("Select second autocomplete popup entry");
EventUtils.synthesizeKey("VK_DOWN" , {});
EventUtils.synthesizeKey("VK_DOWN", {});
ok(/moz-action:switchtab/.test(gURLBar.value), "switch to tab entry found");
info("Shift+left on switch-to-tab entry");
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keydown" });
EventUtils.synthesizeKey("VK_SHIFT", { type: "keydown" });
EventUtils.synthesizeKey("VK_LEFT", { shiftKey: true });
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keyup" });
EventUtils.synthesizeKey("VK_SHIFT", { type: "keyup" });
ok(!/moz-action:switchtab/.test(gURLBar.inputField.value), "switch to tab should be hidden");
});

View file

@ -10,7 +10,7 @@ add_task(function* test_switchtab_decodeuri() {
yield promiseAutocompleteResultPopup("dummy_page");
info("Select autocomplete popup entry");
EventUtils.synthesizeKey("VK_DOWN" , {});
EventUtils.synthesizeKey("VK_DOWN", {});
ok(gURLBar.value.startsWith("moz-action:switchtab"), "switch to tab entry found");
info("switch-to-tab");
@ -21,7 +21,7 @@ add_task(function* test_switchtab_decodeuri() {
is(gBrowser.selectedTab, tab, "Should have switched to the right tab");
resolve();
}, false);
EventUtils.synthesizeKey("VK_RETURN" , { });
EventUtils.synthesizeKey("VK_RETURN", { });
});
gBrowser.removeCurrentTab();

View file

@ -63,7 +63,7 @@ add_task(function*() {
yield Promise.all([focusEventPromise, messagePromise]);
gURLBar.inputField.value = inputValue.slice(0, -1);
EventUtils.synthesizeKey(inputValue.slice(-1) , {});
EventUtils.synthesizeKey(inputValue.slice(-1), {});
EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true });
yield stoppedLoadPromise;
}

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,14 +7,14 @@
add_task(function* injectJSON() {
let inputStrs = [
'http://example.com/ ", "url": "bar' ,
'http://example.com/\\' ,
'http://example.com/"' ,
'http://example.com/","url":"evil.com' ,
'http://mozilla.org/\\u0020' ,
'http://www.mozilla.org/","url":1e6,"some-key":"foo' ,
'http://www.mozilla.org/","url":null,"some-key":"foo' ,
'http://www.mozilla.org/","url":["foo","bar"],"some-key":"foo' ,
'http://example.com/ ", "url": "bar',
'http://example.com/\\',
'http://example.com/"',
'http://example.com/","url":"evil.com',
'http://mozilla.org/\\u0020',
'http://www.mozilla.org/","url":1e6,"some-key":"foo',
'http://www.mozilla.org/","url":null,"some-key":"foo',
'http://www.mozilla.org/","url":["foo","bar"],"some-key":"foo',
];
for (let inputStr of inputStrs) {
yield checkInput(inputStr);
@ -84,12 +84,12 @@ function* checkInput(inputStr) {
let expectedURL = "moz-action:" + type + "," + JSON.stringify(params);
Assert.equal(item.getAttribute("url"), expectedURL, "url");
Assert.equal(item.getAttribute("title"), inputStr.replace("\\","/"), "title");
Assert.equal(item.getAttribute("title"), inputStr.replace("\\", "/"), "title");
Assert.equal(item.getAttribute("text"), inputStr, "text");
let itemType = item.getAttribute("type");
Assert.equal(itemType, "visiturl");
Assert.equal(item._titleText.textContent, inputStr.replace("\\","/"), "Visible title");
Assert.equal(item._titleText.textContent, inputStr.replace("\\", "/"), "Visible title");
Assert.equal(item._actionText.textContent, "Visit", "Visible action");
}

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

@ -256,7 +256,7 @@ function is_hidden(element) {
if (style.visibility != "visible")
return true;
if (style.display == "-moz-popup")
return ["hiding","closed"].indexOf(element.state) != -1;
return ["hiding", "closed"].indexOf(element.state) != -1;
// Hiding a parent element will hide all its children
if (element.parentNode != element.ownerDocument)

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,15 +436,13 @@ 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) {
ok(true, "should not show " + id + " icon in the control center panel");
} 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.
ok(!icon[0].classList.contains("in-use"),
"if shown, the " + id + " icon should not have the in-use class");
is(icon.length, 1, "should not show more than 1 " + id + " icon");
}
// This will happen if there are persistent permissions set.
ok(!icon[0].classList.contains("in-use"),
"if shown, the " + id + " icon should not have the in-use class");
is(icon.length, 1, "should not show more than 1 " + id + " icon");
}
}
gIdentityHandler._identityPopup.hidden = true;