Bug 1311345 - Enable eslint of browser/components/privatebrowsing/ - Initial changes; r?standard8
MozReview-Commit-ID: AD112cmtsk3
--- a/.eslintignore
+++ b/.eslintignore
@@ -57,17 +57,16 @@ browser/app/**
browser/branding/**/firefox-branding.js
browser/base/content/browser-social.js
browser/base/content/nsContextMenu.js
browser/base/content/sanitizeDialog.js
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/privatebrowsing/**
browser/components/sessionstore/**
browser/components/tabview/**
# generated files in cld2
browser/components/translation/cld2/cld-worker.js
browser/extensions/pdfjs/content/build**
browser/extensions/pdfjs/content/web**
# generated or library files in pocket
browser/extensions/pocket/content/panels/js/tmpl.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js
@@ -17,17 +17,17 @@ add_task(function* setup() {
});
});
add_task(function* test() {
let prefix = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html';
function getElts(browser) {
return browser.contentTitle.split('|');
- };
+ }
// Step 1
let non_private_browser = gBrowser.selectedBrowser;
non_private_browser.loadURI(prefix + '?action=set&name=test&value=value&initial=true');
yield BrowserTestUtils.browserLoaded(non_private_browser);
// Step 2
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html
@@ -1,20 +1,20 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
- var oGetVars = {};
-
- if (window.location.search.length > 1) {
+ var oGetVars = {};
+
+ if (window.location.search.length > 1) {
for (var aItKey, nKeyId = 0, aCouples = window.location.search.substr(1).split("&");
nKeyId < aCouples.length;
- nKeyId++) {
- aItKey = aCouples[nKeyId].split("=");
- oGetVars[unescape(aItKey[0])] = aItKey.length > 1 ? unescape(aItKey[1]) : "";
- }
+ nKeyId++) {
+ aItKey = aCouples[nKeyId].split("=");
+ oGetVars[unescape(aItKey[0])] = aItKey.length > 1 ? unescape(aItKey[1]) : "";
+ }
}
if (oGetVars.initial == 'true') {
localStorage.clear();
}
if (oGetVars.action == 'set') {
localStorage.setItem(oGetVars.name, oGetVars.value);
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_crh.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_crh.js
@@ -1,25 +1,25 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-// This test makes sure that the Clear Recent History menu item and command
+// This test makes sure that the Clear Recent History menu item and command
// is disabled inside the private browsing mode.
add_task(function* test() {
function checkDisableOption(aPrivateMode, aWindow) {
let crhCommand = aWindow.document.getElementById("Tools:Sanitize");
ok(crhCommand, "The clear recent history command should exist");
is(PrivateBrowsingUtils.isWindowPrivate(aWindow), aPrivateMode,
"PrivateBrowsingUtils should report the correct per-window private browsing status");
is(crhCommand.hasAttribute("disabled"), aPrivateMode,
"Clear Recent History command should be disabled according to the private browsing mode");
- };
+ }
let testURI = "http://mochi.test:8888/";
let privateWin = yield BrowserTestUtils.openNewBrowserWindow({private: true});
let privateBrowser = privateWin.gBrowser.selectedBrowser;
privateBrowser.loadURI(testURI);
yield BrowserTestUtils.browserLoaded(privateBrowser);
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_favicon.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_favicon.js
@@ -157,17 +157,17 @@ function waitOnFaviconLoaded(aFaviconURL
}
},
};
PlacesUtils.history.addObserver(observer, false);
});
}
-function* assignCookies(aBrowser, aURL, aCookieValue){
+function* assignCookies(aBrowser, aURL, aCookieValue) {
let tabInfo = yield openTab(aBrowser, aURL);
yield ContentTask.spawn(tabInfo.browser, aCookieValue, function* (value) {
content.document.cookie = value;
});
yield BrowserTestUtils.removeTab(tabInfo.tab);
}
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt.js
@@ -12,32 +12,32 @@ add_task(function* test() {
function checkGeolocation(aPrivateMode, aWindow) {
return Task.spawn(function* () {
aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab(testPageURL);
yield BrowserTestUtils.browserLoaded(aWindow.gBrowser.selectedBrowser);
let notification = aWindow.PopupNotifications.getNotification("geolocation");
// Wait until the notification is available.
- while (!notification){
+ while (!notification) {
yield new Promise(resolve => { executeSoon(resolve); });
let notification = aWindow.PopupNotifications.getNotification("geolocation");
}
if (aPrivateMode) {
// Make sure the notification is correctly displayed without a remember control
ok(!notification.options.checkbox.show, "Secondary actions should exist (always/never remember)");
} else {
ok(notification.options.checkbox.show, "Secondary actions should exist (always/never remember)");
}
notification.remove();
aWindow.gBrowser.removeCurrentTab();
});
- };
+ }
let win = yield BrowserTestUtils.openNewBrowserWindow();
let browser = win.gBrowser.selectedBrowser;
browser.loadURI(testPageURL);
yield BrowserTestUtils.browserLoaded(browser);
yield checkGeolocation(false, win);
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_opendir.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_opendir.js
@@ -76,17 +76,17 @@ function test() {
setupCleanSlate(privateWindow);
// Test 2: the user first tries to open a file inside the private browsing mode
// test the private window
ok(!privateWindow.gLastOpenDirectory.path,
"No original path should exist inside the private browsing mode");
privateWindow.gLastOpenDirectory.path = dir1;
- is(privateWindow.gLastOpenDirectory.path.path, dir1.path,
+ is(privateWindow.gLastOpenDirectory.path.path, dir1.path,
"The path should be successfully set inside the private browsing mode");
// test the non-private window
ok(!nonPrivateWindow.gLastOpenDirectory.path,
"The path set inside the private browsing mode should not leak when leaving that mode");
setupCleanSlate(nonPrivateWindow);
setupCleanSlate(privateWindow);
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
@@ -29,17 +29,17 @@ add_task(function* test() {
onClearHistory: function () {},
onPageChanged: function () {},
onDeleteVisits: function() {},
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver])
};
PlacesUtils.history.addObserver(historyObserver, false);
});
- };
+ }
yield PlacesTestUtils.clearHistory();
let tabToClose = gBrowser.selectedTab = gBrowser.addTab(TEST_URL);
yield waitForTitleChanged();
is(PlacesUtils.history.getPageTitle(TEST_URI), TITLE_1, "The title matches the orignal title after first visit");
let place = {
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js
@@ -28,41 +28,41 @@ function test() {
is(PrivateBrowsingUtils.isWindowPrivate(aWindow), aIsPrivateMode,
"PrivateBrowsingUtils should report the correct per-window private browsing status (privateBrowsing should be " +
aIsPrivateMode + ")");
aCallback();
}, {capture: true, once: true});
aWindow.gBrowser.selectedBrowser.loadURI(testURI);
- };
+ }
function openPrivateBrowsingModeByUI(aWindow, aCallback) {
Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
aSubject.addEventListener("load", function() {
Services.obs.removeObserver(observer, "domwindowopened");
windowsToClose.push(aSubject);
aCallback(aSubject);
}, {once: true});
}, "domwindowopened", false);
cmd = aWindow.document.getElementById("Tools:PrivateBrowsing");
var func = new Function("", cmd.getAttribute("oncommand"));
func.call(cmd);
- };
+ }
function testOnWindow(aOptions, aCallback) {
whenNewWindowLoaded(aOptions, function(aWin) {
windowsToClose.push(aWin);
// execute should only be called when need, like when you are opening
// web pages on the test. If calling executeSoon() is not necesary, then
// call whenNewWindowLoaded() instead of testOnWindow() on your test.
executeSoon(() => aCallback(aWin));
});
- };
+ }
// this function is called after calling finish() on the test.
registerCleanupFunction(function() {
windowsToClose.forEach(function(aWin) {
aWin.close();
});
});