forked from mirrors/gecko-dev
Bug 1506042 - Enable ESLint for docshell/resources and docshell/test/chrome (manual fixes). r=smaug
Depends on D11441 Differential Revision: https://phabricator.services.mozilla.com/D11442 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
ce1e7cce4b
commit
3a66c24aae
4 changed files with 20 additions and 24 deletions
|
|
@ -14,9 +14,7 @@ obj*/**
|
||||||
# We ignore all these directories by default, until we get them enabled.
|
# We ignore all these directories by default, until we get them enabled.
|
||||||
# If you are enabling a directory, please add directory specific exclusions
|
# If you are enabling a directory, please add directory specific exclusions
|
||||||
# below.
|
# below.
|
||||||
docshell/resources/**
|
|
||||||
docshell/test/browser/**
|
docshell/test/browser/**
|
||||||
docshell/test/chrome/**
|
|
||||||
docshell/test/iframesandbox/**
|
docshell/test/iframesandbox/**
|
||||||
docshell/test/mochitest/**
|
docshell/test/mochitest/**
|
||||||
extensions/cookie/**
|
extensions/cookie/**
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@ for (var name of imports) {
|
||||||
window[name] = window.opener.wrappedJSObject[name];
|
window[name] = window.opener.wrappedJSObject[name];
|
||||||
}
|
}
|
||||||
ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
|
ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
|
||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
// Some functions assume chrome-harness.js has been loaded.
|
||||||
|
/* import-globals-from ../../../testing/mochitest/chrome-harness.js */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define global constants and variables.
|
* Define global constants and variables.
|
||||||
|
|
@ -88,6 +92,7 @@ var gExtractedPath = null; // used to cache file path for extracting files from
|
||||||
* must contain an object for each pagehide and pageshow event which occurs as
|
* must contain an object for each pagehide and pageshow event which occurs as
|
||||||
* a result of this navigation.
|
* a result of this navigation.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line complexity
|
||||||
function doPageNavigation(params) {
|
function doPageNavigation(params) {
|
||||||
// Parse the parameters.
|
// Parse the parameters.
|
||||||
let back = params.back ? params.back : false;
|
let back = params.back ? params.back : false;
|
||||||
|
|
@ -340,9 +345,7 @@ function finish() {
|
||||||
// If the test changed the value of max_total_viewers via a call to
|
// If the test changed the value of max_total_viewers via a call to
|
||||||
// enableBFCache(), then restore it now.
|
// enableBFCache(), then restore it now.
|
||||||
if (typeof(gOrigMaxTotalViewers) != "undefined") {
|
if (typeof(gOrigMaxTotalViewers) != "undefined") {
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"]
|
Services.prefs.setIntPref("browser.sessionhistory.max_total_viewers",
|
||||||
.getService(Ci.nsIPrefBranch);
|
|
||||||
prefs.setIntPref("browser.sessionhistory.max_total_viewers",
|
|
||||||
gOrigMaxTotalViewers);
|
gOrigMaxTotalViewers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -351,11 +354,9 @@ function finish() {
|
||||||
let SimpleTest = opener.wrappedJSObject.SimpleTest;
|
let SimpleTest = opener.wrappedJSObject.SimpleTest;
|
||||||
|
|
||||||
// Wait for the window to be closed before finishing the test
|
// Wait for the window to be closed before finishing the test
|
||||||
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]
|
Services.ww.registerNotification(function observer(subject, topic, data) {
|
||||||
.getService(Ci.nsIWindowWatcher);
|
|
||||||
ww.registerNotification(function(subject, topic, data) {
|
|
||||||
if (topic == "domwindowclosed") {
|
if (topic == "domwindowclosed") {
|
||||||
ww.unregisterNotification(arguments.callee);
|
Services.ww.unregisterNotification(observer);
|
||||||
SimpleTest.waitForFocus(SimpleTest.finish, opener);
|
SimpleTest.waitForFocus(SimpleTest.finish, opener);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -424,24 +425,21 @@ function waitForNextPaint(cb) {
|
||||||
* to 0 (disabled), if a number, set it to that specific number
|
* to 0 (disabled), if a number, set it to that specific number
|
||||||
*/
|
*/
|
||||||
function enableBFCache(enable) {
|
function enableBFCache(enable) {
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"]
|
|
||||||
.getService(Ci.nsIPrefBranch);
|
|
||||||
|
|
||||||
// If this is the first time the test called enableBFCache(),
|
// If this is the first time the test called enableBFCache(),
|
||||||
// store the original value of max_total_viewers, so it can
|
// store the original value of max_total_viewers, so it can
|
||||||
// be restored at the end of the test.
|
// be restored at the end of the test.
|
||||||
if (typeof(gOrigMaxTotalViewers) == "undefined") {
|
if (typeof(gOrigMaxTotalViewers) == "undefined") {
|
||||||
gOrigMaxTotalViewers =
|
gOrigMaxTotalViewers =
|
||||||
prefs.getIntPref("browser.sessionhistory.max_total_viewers");
|
Services.prefs.getIntPref("browser.sessionhistory.max_total_viewers");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof(enable) == "boolean") {
|
if (typeof(enable) == "boolean") {
|
||||||
if (enable)
|
if (enable)
|
||||||
prefs.setIntPref("browser.sessionhistory.max_total_viewers", -1);
|
Services.prefs.setIntPref("browser.sessionhistory.max_total_viewers", -1);
|
||||||
else
|
else
|
||||||
prefs.setIntPref("browser.sessionhistory.max_total_viewers", 0);
|
Services.prefs.setIntPref("browser.sessionhistory.max_total_viewers", 0);
|
||||||
} else if (typeof(enable) == "number") {
|
} else if (typeof(enable) == "number") {
|
||||||
prefs.setIntPref("browser.sessionhistory.max_total_viewers", enable);
|
Services.prefs.setIntPref("browser.sessionhistory.max_total_viewers", enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ function test() {
|
||||||
|
|
||||||
// an nsIWebProgressListener that checks all requests made by the docShell
|
// an nsIWebProgressListener that checks all requests made by the docShell
|
||||||
// have the flags we expect.
|
// have the flags we expect.
|
||||||
RequestWatcher = {
|
var RequestWatcher = {
|
||||||
init(docShell, callback) {
|
init(docShell, callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.docShell = docShell;
|
this.docShell = docShell;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue