Bug 1207491 - Part 14: Remove use of expression closure from browser/components/privatebrowsing/. r=Gijs

This commit is contained in:
Tooru Fujisawa 2015-09-23 18:36:22 +09:00
parent f71022623f
commit 85e6a99282
8 changed files with 17 additions and 17 deletions

View File

@ -44,7 +44,7 @@ function setFile(downloadLastDir, aURI, aValue) {
function clearHistoryAndWait() {
clearHistory();
executeSoon(function() executeSoon(moveAlong));
executeSoon(() => executeSoon(moveAlong));
}
/*
@ -73,7 +73,7 @@ function runTest() {
registerCleanupFunction(function () {
Services.prefs.clearUserPref("browser.download.lastDir.savePerSite");
Services.prefs.clearUserPref("browser.download.lastDir");
[dir1, dir2, dir3].forEach(function(dir) dir.remove(true));
[dir1, dir2, dir3].forEach(dir => dir.remove(true));
win.close();
pbWin.close();
});

View File

@ -33,7 +33,7 @@ function test() {
// cleanup functions registration
registerCleanupFunction(function () {
Services.prefs.clearUserPref("browser.download.lastDir");
[dir1, dir2, dir3].forEach(function(dir) dir.remove(true));
[dir1, dir2, dir3].forEach(dir => dir.remove(true));
MockFilePicker.cleanup();
});
prefs.setComplexValue("lastDir", Ci.nsIFile, tmpDir);

View File

@ -28,13 +28,13 @@ function test() {
// cleanup function registration
registerCleanupFunction(function () {
Services.prefs.clearUserPref("browser.download.lastDir");
[dir1, dir2, dir3].forEach(function(dir) dir.remove(true));
[dir1, dir2, dir3].forEach(dir => dir.remove(true));
MockFilePicker.cleanup();
validateFileName = validateFileNameToRestore;
});
// Overwrite validateFileName to validate everything
validateFileName = function(foo) foo;
validateFileName = foo => foo;
let params = {
fileInfo: new FileInfo("test.txt", "test.txt", "test", "txt", "http://mozilla.org/test.txt"),

View File

@ -51,7 +51,7 @@ add_task(function* test() {
}]
};
PlacesUtils.asyncHistory.updatePlaces(place, {
handleError: function () ok(false, "Unexpected error in adding visit."),
handleError: () => ok(false, "Unexpected error in adding visit."),
handleResult: function () { },
handleCompletion: function () {}
});

View File

@ -44,44 +44,44 @@ function test() {
return w;
}
function closeCachedWindows () {
windowCache.forEach(function(w) w.close());
windowCache.forEach(w => w.close());
}
// Part 1: NON PRIVATE WINDOW -> PRIVATE WINDOW
openWindow(window, {}, 1).
then(cacheWindow).
then(openSidebar).
then(function(win) openWindow(win, { private: true })).
then(win => openWindow(win, { private: true })).
then(cacheWindow).
then(function({ document }) {
let sidebarBox = document.getElementById("sidebar-box");
is(sidebarBox.hidden, true, 'Opening a private window from reg window does not open the sidebar');
}).
// Part 2: NON PRIVATE WINDOW -> NON PRIVATE WINDOW
then(function() openWindow(window)).
then(() => openWindow(window)).
then(cacheWindow).
then(openSidebar).
then(function(win) openWindow(win)).
then(win => openWindow(win)).
then(cacheWindow).
then(function({ document }) {
let sidebarBox = document.getElementById("sidebar-box");
is(sidebarBox.hidden, false, 'Opening a reg window from reg window does open the sidebar');
}).
// Part 3: PRIVATE WINDOW -> NON PRIVATE WINDOW
then(function() openWindow(window, { private: true })).
then(() => openWindow(window, { private: true })).
then(cacheWindow).
then(openSidebar).
then(function(win) openWindow(win)).
then(win => openWindow(win)).
then(cacheWindow).
then(function({ document }) {
let sidebarBox = document.getElementById("sidebar-box");
is(sidebarBox.hidden, true, 'Opening a reg window from a private window does not open the sidebar');
}).
// Part 4: PRIVATE WINDOW -> PRIVATE WINDOW
then(function() openWindow(window, { private: true })).
then(() => openWindow(window, { private: true })).
then(cacheWindow).
then(openSidebar).
then(function(win) openWindow(win, { private: true })).
then(win => openWindow(win, { private: true })).
then(cacheWindow).
then(function({ document }) {
let sidebarBox = document.getElementById("sidebar-box");

View File

@ -11,7 +11,7 @@ function testOnWindow(options, callback) {
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
windowsToClose.push(win);
executeSoon(function() callback(win));
executeSoon(() => callback(win));
}, false);
}

View File

@ -58,7 +58,7 @@ function test() {
// 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(function() aCallback(aWin));
executeSoon(() => aCallback(aWin));
});
};

View File

@ -57,7 +57,7 @@ function clearHistory() {
function _initTest() {
// Don't use about:home as the homepage for new windows
Services.prefs.setIntPref("browser.startup.page", 0);
registerCleanupFunction(function() Services.prefs.clearUserPref("browser.startup.page"));
registerCleanupFunction(() => Services.prefs.clearUserPref("browser.startup.page"));
}
_initTest();