Merge inbound to mozilla-central. a=merge

This commit is contained in:
Bogdan Tara 2018-03-17 12:29:57 +02:00
commit 4785e99532
384 changed files with 16907 additions and 20455 deletions

View File

@ -9,7 +9,6 @@ module.exports = {
},
"rules": {
"mozilla/no-aArgs": "error",
"mozilla/no-cpows-in-tests": "error",
"mozilla/reject-importGlobalProperties": "error",
"mozilla/var-only-at-top-level": "error",

View File

@ -5,7 +5,6 @@ module.exports = {
"plugin:mozilla/mochitest-test"
],
"rules": {
"mozilla/no-cpows-in-tests": "error",
"mozilla/reject-importGlobalProperties": "error",
// XXX These are rules that are enabled in the recommended configuration, but

View File

@ -8,9 +8,6 @@
var TabsInTitlebar = {
init() {
if (this._initialized) {
return;
}
this._readPref();
Services.prefs.addObserver(this._prefName, this);
@ -45,13 +42,7 @@ var TabsInTitlebar = {
addEventListener("resolutionchange", this, false);
this._initialized = true;
if (this._updateOnInit) {
// We don't need to call this with 'true', even if original calls
// (before init()) did, because this will be the first call and so
// we will update anyway.
this._update();
}
this._update(true, true);
},
allowedBy(condition, allow) {
@ -85,6 +76,11 @@ var TabsInTitlebar = {
}
},
onDOMContentLoaded() {
this._domLoaded = true;
this._update(true);
},
_onMenuMutate(aMutations) {
for (let mutation of aMutations) {
if (mutation.attributeName == "inactive" ||
@ -95,18 +91,17 @@ var TabsInTitlebar = {
}
},
_initialized: false,
_updateOnInit: false,
_disallowed: {},
_prefName: "browser.tabs.drawInTitlebar",
_lastSizeMode: null,
_domLoaded: false,
_readPref() {
this.allowedBy("pref",
Services.prefs.getBoolPref(this._prefName));
},
_update(aForce = false) {
_update(aForce = false, aFromInit = false) {
let $ = id => document.getElementById(id);
let rect = ele => ele.getBoundingClientRect();
let verticalMargins = cstyle => parseFloat(cstyle.marginBottom) + parseFloat(cstyle.marginTop);
@ -114,10 +109,11 @@ var TabsInTitlebar = {
if (window.fullScreen)
return;
// In some edgecases it is possible for this to fire before we've initialized.
// Don't run now, but don't forget to run it when we do initialize.
if (!this._initialized) {
this._updateOnInit = true;
// We want to do this from initialization anyway, so that the
// "chromemargin" attributes are all correctly setup, but we don't want to
// do this before the DOM loads again, to prevent spurious reflows that
// will be superseded by the one on onDOMContentLoaded.
if (!this._domLoaded && !aFromInit) {
return;
}
@ -277,7 +273,6 @@ var TabsInTitlebar = {
},
uninit() {
this._initialized = false;
removeEventListener("resolutionchange", this);
Services.prefs.removeObserver(this._prefName, this);
this._menuObserver.disconnect();

View File

@ -1190,7 +1190,14 @@ function RedirectLoad({ target: browser, data }) {
}
if (document.documentElement.getAttribute("windowtype") == "navigator:browser") {
addEventListener("DOMContentLoaded", function() {
window.addEventListener("MozBeforeInitialXULLayout", () => {
gBrowserInit.onBeforeInitialXULLayout();
}, { once: true });
// The listener of DOMContentLoaded must be set on window, rather than
// document, because the window can go away before the event is fired.
// In that case, we don't want to initialize anything, otherwise we
// may be leaking things because they will never be destroyed after.
window.addEventListener("DOMContentLoaded", () => {
gBrowserInit.onDOMContentLoaded();
}, { once: true });
}
@ -1203,6 +1210,29 @@ var delayedStartupPromise = new Promise(resolve => {
var gBrowserInit = {
delayedStartupFinished: false,
onBeforeInitialXULLayout() {
// Set a sane starting width/height for all resolutions on new profiles.
if (Services.prefs.getBoolPref("privacy.resistFingerprinting")) {
// When the fingerprinting resistance is enabled, making sure that we don't
// have a maximum window to interfere with generating rounded window dimensions.
document.documentElement.setAttribute("sizemode", "normal");
} else if (!document.documentElement.hasAttribute("width")) {
const TARGET_WIDTH = 1280;
const TARGET_HEIGHT = 1040;
let width = Math.min(screen.availWidth * .9, TARGET_WIDTH);
let height = Math.min(screen.availHeight * .9, TARGET_HEIGHT);
document.documentElement.setAttribute("width", width);
document.documentElement.setAttribute("height", height);
if (width < TARGET_WIDTH && height < TARGET_HEIGHT) {
document.documentElement.setAttribute("sizemode", "maximized");
}
}
TabsInTitlebar.init();
},
onDOMContentLoaded() {
gBrowser = window._gBrowser;
delete window._gBrowser;
@ -1246,25 +1276,6 @@ var gBrowserInit = {
initBrowser.removeAttribute("blank");
}
// Set a sane starting width/height for all resolutions on new profiles.
if (Services.prefs.getBoolPref("privacy.resistFingerprinting")) {
// When the fingerprinting resistance is enabled, making sure that we don't
// have a maximum window to interfere with generating rounded window dimensions.
document.documentElement.setAttribute("sizemode", "normal");
} else if (!document.documentElement.hasAttribute("width")) {
const TARGET_WIDTH = 1280;
const TARGET_HEIGHT = 1040;
let width = Math.min(screen.availWidth * .9, TARGET_WIDTH);
let height = Math.min(screen.availHeight * .9, TARGET_HEIGHT);
document.documentElement.setAttribute("width", width);
document.documentElement.setAttribute("height", height);
if (width < TARGET_WIDTH && height < TARGET_HEIGHT) {
document.documentElement.setAttribute("sizemode", "maximized");
}
}
gBrowser.updateBrowserRemoteness(initBrowser, isRemote, {
remoteType, sameProcessAsFrameLoader
});
@ -1286,6 +1297,9 @@ var gBrowserInit = {
});
this._setInitialFocus();
gBrowser.tabContainer.updateVisibility();
TabsInTitlebar.onDOMContentLoaded();
},
onLoad() {

View File

@ -127,7 +127,7 @@ window._gBrowser = {
_browserBindingProperties: [
"canGoBack", "canGoForward", "goBack", "goForward", "permitUnload",
"reload", "reloadWithFlags", "stop", "loadURI", "loadURIWithFlags",
"goHome", "homePage", "gotoIndex", "currentURI", "documentURI",
"gotoIndex", "currentURI", "documentURI",
"preferences", "imageDocument", "isRemoteBrowser", "messageManager",
"getTabBrowser", "finder", "fastFind", "sessionHistory", "contentTitle",
"characterSet", "fullZoom", "textZoom", "webProgress",
@ -368,23 +368,10 @@ window._gBrowser = {
return this.selectedBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData);
},
goHome() {
return this.selectedBrowser.goHome();
},
gotoIndex(aIndex) {
return this.selectedBrowser.gotoIndex(aIndex);
},
set homePage(val) {
this.selectedBrowser.homePage = val;
return val;
},
get homePage() {
return this.selectedBrowser.homePage;
},
get currentURI() {
return this.selectedBrowser.currentURI;
},

View File

@ -124,7 +124,6 @@
tab.setAttribute("onerror", "this.removeAttribute('image');");
window.addEventListener("resize", this);
window.addEventListener("DOMContentLoaded", this);
Services.prefs.addObserver("privacy.userContext", this);
this.observe(null, "nsPref:changed", "privacy.userContext.enabled");
@ -754,10 +753,6 @@
<parameter name="aEvent"/>
<body><![CDATA[
switch (aEvent.type) {
case "DOMContentLoaded":
this.updateVisibility();
TabsInTitlebar.init();
break;
case "resize":
if (aEvent.target != window)
break;

View File

@ -84,7 +84,6 @@ function test2Setup() {
}
function testOpenFrameInTab() {
/* eslint-disable mozilla/no-cpows-in-tests */
if (gBrowser.contentDocument.location.href == "about:blank")
// Wait another cycle
return;
@ -93,7 +92,6 @@ function testOpenFrameInTab() {
// We should now have the error page in a new, active tab.
is(gBrowser.contentDocument.location.href, invalidPage, "New tab should have page url, not about:neterror");
/* eslint-enable mozilla/no-cpows-in-tests */
// Clear up the new tab, and punt to test 3
gBrowser.removeCurrentTab();

View File

@ -74,7 +74,6 @@ async function testLink(aLinkIndexOrFunction, pinTab, expectNewTab, testSubFrame
let href;
if (typeof aLinkIndexOrFunction === "function") {
ok(!browser.isRemoteBrowser, "don't pass a function for a remote browser");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let link = aLinkIndexOrFunction(browser.contentDocument);
info("Clicking " + link.textContent);
link.click();

View File

@ -36,7 +36,6 @@ function test() {
function load(aTab, aUrl, aCallback) {
aTab.linkedBrowser.addEventListener("load", function(aEvent) {
// eslint-disable-next-line mozilla/no-cpows-in-tests
waitForFocus(aCallback, content);
}, {capture: true, once: true});
aTab.linkedBrowser.loadURI(aUrl);

View File

@ -75,7 +75,6 @@ function openNewTab(aWindow, aCallback) {
aWindow.BrowserOpenTab();
let browser = aWindow.gBrowser.selectedBrowser;
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocumentAsCPOW;
if (doc && doc.readyState === "complete") {
executeSoon(aCallback);

View File

@ -16,7 +16,6 @@ add_task(async function test_principal_click() {
await kAboutPagesRegistered;
await BrowserTestUtils.withNewTab("about:test-about-principal-parent", async function(browser) {
let loadPromise = BrowserTestUtils.browserLoaded(browser, false, "about:test-about-principal-child");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let myLink = browser.contentDocument.getElementById("aboutchildprincipal");
myLink.click();
await loadPromise;

View File

@ -67,7 +67,6 @@ function doTest() {
info("Running test: " + gCurrTest.name);
waitForLoad(function() {
// eslint-disable-next-line mozilla/no-cpows-in-tests
let loadedText = gBrowser.contentDocumentAsCPOW.body.textContent;
ok(loadedText, "search page loaded");
let needle = "searchterms=" + gCurrTest.expectText;

View File

@ -88,7 +88,6 @@ function focusInChild() {
content.document.getElementById(message.data.id)[message.data.type]();
});
/* eslint-disable mozilla/no-cpows-in-tests */
addMessageListener("Browser:GetFocusedElement", function getFocusedElement(message) {
var focusedWindow = {};
var node = Services.focus.getFocusedElementForWindow(content, false, focusedWindow);
@ -126,7 +125,6 @@ function focusElementInChild(elementid, type) {
browser.contentDocument.getElementById(elementid)[type]();
}
}
/* eslint-enable mozilla/no-cpows-in-tests */
add_task(async function() {
tab1 = BrowserTestUtils.addTab(gBrowser);

View File

@ -25,7 +25,6 @@ function test() {
let uriToWaitFor = URI.replace(/ /g, "%20");
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false,
uriToWaitFor).then(function() {
// eslint-disable-next-line mozilla/no-cpows-in-tests
var doc = gBrowser.contentDocumentAsCPOW;
var testImg = doc.getElementById("test-image");
var pageInfo = BrowserPageInfo(gBrowser.selectedBrowser.currentURI.spec,

View File

@ -22,16 +22,16 @@ add_task(async function() {
let frame = frames[i], previousFrame = frames[i - 1];
let rects = compareFrames(frame, previousFrame);
// The first screenshot we get shows an unfocused browser window for some
// reason. This is likely due to the test harness, so we want to ignore it.
// The first screenshot we get in OSX / Windows shows an unfocused browser
// window for some reason. See bug 1445161.
//
// We'll assume the changes we are seeing are due to this focus change if
// there are at least 5 areas that changed near the top of the screen, but
// will only ignore this once (hence the alreadyFocused variable).
if (!alreadyFocused && rects.length > 5 && rects.every(r => r.y2 < 100)) {
alreadyFocused = true;
// This is likely an issue caused by the test harness, but log it anyway.
todo(false,
"the window should be focused at first paint, " + rects.toSource());
"bug 1445161 - the window should be focused at first paint, " + rects.toSource());
continue;
}

View File

@ -61,6 +61,7 @@ const whitelist = [
{
file: "chrome://browser/skin/chevron.svg",
platforms: ["win", "linux", "macosx"],
intermittentShown: ["win"],
},
{

View File

@ -71,17 +71,25 @@ add_task(async function() {
win.removeEventListener("MozAfterPaint", afterPaintListener);
let unexpectedRects = 0;
let ignoreTinyPaint = true;
let alreadyFocused = false;
for (let i = 1; i < frames.length; ++i) {
let frame = frames[i], previousFrame = frames[i - 1];
if (ignoreTinyPaint &&
previousFrame.width == 1 && previousFrame.height == 1) {
todo(false, "shouldn't initially paint a 1x1px window");
let rects = compareFrames(frame, previousFrame);
// The first screenshot we get in OSX / Windows shows an unfocused browser
// window for some reason. See bug 1445161.
//
// We'll assume the changes we are seeing are due to this focus change if
// there are at least 5 areas that changed near the top of the screen, but
// will only ignore this once (hence the alreadyFocused variable).
if (!alreadyFocused && rects.length > 5 && rects.every(r => r.y2 < 100)) {
alreadyFocused = true;
todo(false,
"bug 1445161 - the window should be focused at first paint, " + rects.toSource());
continue;
}
ignoreTinyPaint = false;
let rects = compareFrames(frame, previousFrame).filter(rect => {
rects = rects.filter(rect => {
let inRange = (val, min, max) => min <= val && val <= max;
let width = frame.width;

View File

@ -24,8 +24,8 @@ if (Services.appinfo.OS == "WINNT") {
stack: [
"verticalMargins@chrome://browser/content/browser-tabsintitlebar.js",
"_update@chrome://browser/content/browser-tabsintitlebar.js",
"init@chrome://browser/content/browser-tabsintitlebar.js",
"handleEvent@chrome://browser/content/tabbrowser.xml",
"onDOMContentLoaded@chrome://browser/content/browser-tabsintitlebar.js",
"onDOMContentLoaded@chrome://browser/content/browser.js",
],
maxCount: 2, // This number should only ever go down - never up.
},
@ -38,8 +38,8 @@ if (Services.appinfo.OS == "WINNT" || Services.appinfo.OS == "Darwin") {
stack: [
"rect@chrome://browser/content/browser-tabsintitlebar.js",
"_update@chrome://browser/content/browser-tabsintitlebar.js",
"init@chrome://browser/content/browser-tabsintitlebar.js",
"handleEvent@chrome://browser/content/tabbrowser.xml",
"onDOMContentLoaded@chrome://browser/content/browser-tabsintitlebar.js",
"onDOMContentLoaded@chrome://browser/content/browser.js",
],
// These numbers should only ever go down - never up.
maxCount: Services.appinfo.OS == "WINNT" ? 5 : 4,
@ -62,12 +62,8 @@ add_task(async function() {
let win = OpenBrowserWindow();
await withReflowObserver(async function() {
let resizeEvent = BrowserTestUtils.waitForEvent(win, "resize");
let delayedStartup =
TestUtils.topicObserved("browser-delayed-startup-finished",
subject => subject == win);
await resizeEvent;
await delayedStartup;
await TestUtils.topicObserved("browser-delayed-startup-finished",
subject => subject == win);
}, EXPECTED_REFLOWS, win);
await BrowserTestUtils.closeWindow(win);

View File

@ -192,7 +192,6 @@ var tests = [
if (gMultiProcessBrowser) {
is(Services.focus.focusedElement, browser);
} else {
// eslint-disable-next-line mozilla/no-cpows-in-tests
is(Services.focus.focusedElement, browser.contentDocument.getElementById("test-input"));
}

View File

@ -37,11 +37,9 @@ function runTest(event) {
sidebar.contentDocument.removeEventListener("load", delayedRunTest, true);
var browser = sidebar.contentDocument.getElementById("web-panels-browser");
// eslint-disable-next-line mozilla/no-cpows-in-tests
var div = browser && browser.contentDocument.getElementById("test_bug409481");
ok(div && div.textContent == "Content!", "Sidebar content loaded");
// eslint-disable-next-line mozilla/no-cpows-in-tests
var link = browser && browser.contentDocument.getElementById("link");
sidebar.contentDocument.addEventListener("popupshown", contextMenuOpened);
@ -62,7 +60,6 @@ function copyLinkCommandExecuted(event) {
var sidebar = document.getElementById("sidebar");
var browser = sidebar.contentDocument.getElementById("web-panels-browser");
// eslint-disable-next-line mozilla/no-cpows-in-tests
var textbox = browser && browser.contentDocument.getElementById("textbox");
textbox.focus();
document.commandDispatcher.getControllerForCommand("cmd_paste").doCommand("cmd_paste");

View File

@ -34,18 +34,15 @@ async function doTest(parentTabSpec, childTabSpec, testTaskFn, waitForMetaRefres
await promiseReloaded;
// Wait for the script in the page to update the contents of the test div.
// eslint-disable-next-line mozilla/no-cpows-in-tests
let testDiv = gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv");
await BrowserTestUtils.waitForCondition(
() => testDiv.innerHTML == "Mixed Content Blocker disabled");
// Add the link for the child tab to the page.
// eslint-disable-next-line mozilla/no-cpows-in-tests
let mainDiv = gBrowser.contentDocumentAsCPOW.createElement("div");
// eslint-disable-next-line no-unsanitized/property
mainDiv.innerHTML =
'<p><a id="linkToOpenInNewTab" href="' + childTabSpec + '">Link</a></p>';
// eslint-disable-next-line mozilla/no-cpows-in-tests
gBrowser.contentDocumentAsCPOW.body.appendChild(mainDiv);
// Execute the test in the child tabs with the two methods to open it.
@ -119,7 +116,6 @@ add_task(async function test_same_origin() {
activeLoaded: true, activeBlocked: false, passiveLoaded: false,
});
// eslint-disable-next-line mozilla/no-cpows-in-tests
is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML,
"Mixed Content Blocker disabled", "OK: Executed mixed script");
});
@ -141,7 +137,6 @@ add_task(async function test_different_origin() {
activeLoaded: false, activeBlocked: true, passiveLoaded: false,
});
// eslint-disable-next-line mozilla/no-cpows-in-tests
is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML,
"Mixed Content Blocker enabled", "OK: Blocked mixed script");
});
@ -163,7 +158,6 @@ add_task(async function test_same_origin_metarefresh_same_origin() {
activeLoaded: true, activeBlocked: false, passiveLoaded: false,
});
// eslint-disable-next-line mozilla/no-cpows-in-tests
is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML,
"Mixed Content Blocker disabled", "OK: Executed mixed script");
}, true);
@ -184,7 +178,6 @@ add_task(async function test_same_origin_metarefresh_different_origin() {
activeLoaded: false, activeBlocked: true, passiveLoaded: false,
});
// eslint-disable-next-line mozilla/no-cpows-in-tests
is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML,
"Mixed Content Blocker enabled", "OK: Blocked mixed script");
}, true);
@ -205,7 +198,6 @@ add_task(async function test_same_origin_302redirect_same_origin() {
ok(!gIdentityHandler._identityBox.classList.contains("mixedActiveBlocked"),
"OK: Mixed Content is NOT being blocked");
// eslint-disable-next-line mozilla/no-cpows-in-tests
is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML,
"Mixed Content Blocker disabled", "OK: Executed mixed script");
});
@ -226,7 +218,6 @@ add_task(async function test_same_origin_302redirect_different_origin() {
activeLoaded: false, activeBlocked: true, passiveLoaded: false,
});
// eslint-disable-next-line mozilla/no-cpows-in-tests
is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML,
"Mixed Content Blocker enabled", "OK: Blocked mixed script");
});

View File

@ -3,12 +3,14 @@
# Since the specific flavor doesn't matter from a correctness standpoint,
# just skip the tests on ASAN and debug builds. Also known to be flaky on
# Linux32 (bug 1172468, bug 1349307), so skip them there as well.
skip-if = asan || debug || (os == 'linux' && bits == 32)
#
# Temporarily disable tests on all 32 bit OSes due to OOM failures after
# landing bug 1373708.
skip-if = asan || debug || (bits == 32)
support-files =
head.js
[browser_all_files_referenced.js]
skip-if = (os == 'win' && bits == 32)
[browser_misused_characters_in_strings.js]
support-files =
bug1262648_string_with_newlines.dtd

View File

@ -32,7 +32,6 @@ add_task(async function test_show_form() {
// Now crash the browser.
await BrowserTestUtils.crashBrowser(browser);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
// Ensure the request is visible. We can safely reach into
@ -77,7 +76,6 @@ add_task(async function test_show_form() {
// Now crash the browser.
await BrowserTestUtils.crashBrowser(browser);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
// Ensure the request is NOT visible. We can safely reach into
@ -122,7 +120,6 @@ add_task(async function test_no_offer() {
// Now crash the browser.
await BrowserTestUtils.crashBrowser(browser);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
// Ensure the request to autosubmit is invisible, since there's no report.

View File

@ -37,7 +37,6 @@ add_task(async function test_clear_email() {
await BrowserTestUtils.crashBrowser(browser,
/* shouldShowTabCrashPage */ true,
/* shouldClearMinidumps */ false);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
// Since about:tabcrashed will run in the parent process, we can safely
@ -49,7 +48,6 @@ add_task(async function test_clear_email() {
Email: "",
});
// eslint-disable-next-line mozilla/no-cpows-in-tests
let restoreTab = browser.contentDocument.getElementById("restoreTab");
restoreTab.click();
await BrowserTestUtils.waitForEvent(tab, "SSTabRestored");

View File

@ -26,7 +26,6 @@ add_task(async function test_show_form() {
// Now crash the browser.
await BrowserTestUtils.crashBrowser(browser);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
// Ensure the checkbox is checked. We can safely reach into

View File

@ -56,7 +56,6 @@ function crashTabTestHelper(fieldValues, expectedExtra) {
let tab = gBrowser.getTabForBrowser(browser);
await BrowserTestUtils.crashBrowser(browser);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
// Since about:tabcrashed will run in the parent process, we can safely
@ -83,7 +82,6 @@ function crashTabTestHelper(fieldValues, expectedExtra) {
}
let crashReport = promiseCrashReport(expectedExtra);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let restoreTab = browser.contentDocument.getElementById("restoreTab");
restoreTab.click();
await BrowserTestUtils.waitForEvent(tab, "SSTabRestored");

View File

@ -10,7 +10,6 @@ add_task(async function() {
let browser = tab.linkedBrowser;
// NB: CPOW usage because new tab pages can be preloaded, in which case no
// load events fire.
// eslint-disable-next-line mozilla/no-cpows-in-tests
await BrowserTestUtils.waitForCondition(() => browser.contentDocumentAsCPOW && !browser.contentDocumentAsCPOW.hidden);
let errorPageLoaded = BrowserTestUtils.waitForErrorPage(tab.linkedBrowser);
gURLBar.value = input;
@ -35,7 +34,6 @@ add_task(async function() {
let browser = tab.linkedBrowser;
// NB: CPOW usage because new tab pages can be preloaded, in which case no
// load events fire.
// eslint-disable-next-line mozilla/no-cpows-in-tests
await BrowserTestUtils.waitForCondition(() => browser.contentDocumentAsCPOW && !browser.contentDocumentAsCPOW.hidden);
let errorPageLoaded = BrowserTestUtils.waitForErrorPage(tab.linkedBrowser);
gURLBar.value = input;

View File

@ -136,7 +136,6 @@ add_task(async function() {
is(gBrowser.currentURI.spec, "about:addons", "Foreground tab is at about:addons");
const VIEW = "addons://list/extension";
// eslint-disable-next-line mozilla/no-cpows-in-tests
let win = gBrowser.selectedBrowser.contentWindow;
ok(!win.gViewController.isLoading, "about:addons view is fully loaded");
is(win.gViewController.currentViewId, VIEW, "about:addons is at extensions list");
@ -172,7 +171,6 @@ add_task(async function() {
// Again we should be at the extentions list in about:addons
is(gBrowser.currentURI.spec, "about:addons", "Foreground tab is at about:addons");
// eslint-disable-next-line mozilla/no-cpows-in-tests
win = gBrowser.selectedBrowser.contentWindow;
ok(!win.gViewController.isLoading, "about:addons view is fully loaded");
is(win.gViewController.currentViewId, VIEW, "about:addons is at extensions list");

View File

@ -69,7 +69,6 @@ add_task(async function test() {
await BrowserTestUtils.browserLoaded(browser);
// get the title
// eslint-disable-next-line mozilla/no-cpows-in-tests
let title = browser.contentDocumentAsCPOW.title.trim().split("|");
// check each item in the title and validate it meets expectatations

View File

@ -24,7 +24,6 @@ add_task(async function() {
await waitForCondition(() => gBrowser.currentURI &&
gBrowser.currentURI.spec == "about:addons");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let addonsPage = gBrowser.selectedBrowser.contentWindow.document.
getElementById("addons-page");
ok(addonsPage, "Add-ons page was opened");

View File

@ -263,6 +263,18 @@ var Policies = {
}
},
"EnableTrackingProtection": {
onBeforeUIStartup(manager, param) {
if (param.Locked) {
setAndLockPref("privacy.trackingprotection.enabled", param.Value);
setAndLockPref("privacy.trackingprotection.pbmode.enabled", param.Value);
} else {
setDefaultPref("privacy.trackingprotection.enabled", param.Value);
setDefaultPref("privacy.trackingprotection.pbmode.enabled", param.Value);
}
}
},
"FlashPlugin": {
onBeforeUIStartup(manager, param) {
addAllowDenyPermissions("plugin:flash", param.Allow, param.Block);
@ -299,6 +311,14 @@ var Policies = {
}
},
"NoDefaultBookmarks": {
onProfileAfterChange(manager, param) {
if (param) {
manager.disallowFeature("defaultBookmarks");
}
}
},
"Popups": {
onBeforeUIStartup(manager, param) {
addAllowDenyPermissions("popup", param.Allow, null);
@ -338,6 +358,23 @@ function setAndLockPref(prefName, prefValue) {
Services.prefs.unlockPref(prefName);
}
setDefaultPref(prefName, prefValue);
Services.prefs.lockPref(prefName);
}
/**
* setDefaultPref
*
* Sets the _default_ value of a pref.
* The value is only changed in memory, and not stored to disk.
*
* @param {string} prefName
* The pref to be changed
* @param {boolean,number,string} prefValue
* The value to set
*/
function setDefaultPref(prefName, prefValue) {
let defaults = Services.prefs.getDefaultBranch("");
switch (typeof(prefValue)) {
@ -357,8 +394,6 @@ function setAndLockPref(prefName, prefValue) {
defaults.setStringPref(prefName, prefValue);
break;
}
Services.prefs.lockPref(prefName);
}
/**

View File

@ -207,6 +207,22 @@
"type": "boolean"
},
"EnableTrackingProtection": {
"description": "Enables or disables tracking protection and optionally locks it.",
"first_available": "60.0",
"type": "object",
"properties": {
"Value": {
"type": "boolean"
},
"Locked": {
"type": "boolean"
}
},
"required": ["Value"]
},
"FlashPlugin": {
"description": "Allow or deny flash plugin usage.",
"first_available": "60.0",
@ -267,6 +283,14 @@
}
},
"NoDefaultBookmarks": {
"description": "Don't create the default bookmarks bundled with Firefox, nor the Smart Bookmarks (Most Visited, Recent Tags). Note: this policy is only effective if used before the first run of the profile.",
"first_available": "60.0",
"type": "boolean",
"enum": [true]
},
"Popups": {
"description": "Allow or deny popup usage.",
"first_available": "60.0",

View File

@ -36,5 +36,6 @@ support-files =
[browser_policy_disable_shield.js]
[browser_policy_display_bookmarks.js]
[browser_policy_display_menu.js]
[browser_policy_enable_tracking_protection.js]
[browser_policy_remember_passwords.js]
[browser_policy_set_homepage.js]

View File

@ -9,7 +9,6 @@ add_task(async function test_notice_in_aboutprefences() {
});
await BrowserTestUtils.withNewTab("about:preferences", async browser => {
// eslint-disable-next-line mozilla/no-cpows-in-tests
ok(!browser.contentDocument.getElementById("policies-container").hidden,
"The Policies notice was made visible in about:preferences");
});

View File

@ -37,7 +37,6 @@ async function checkDeviceManager({buttonIsDisabled}) {
async function checkAboutPreferences({checkboxIsDisabled}) {
await BrowserTestUtils.withNewTab("about:preferences#privacy", async browser => {
// eslint-disable-next-line mozilla/no-cpows-in-tests
is(browser.contentDocument.getElementById("useMasterPassword").disabled, checkboxIsDisabled,
"Master Password checkbox is in the correct state: " + checkboxIsDisabled);
});

View File

@ -0,0 +1,36 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_policy_enable_tracking_protection1() {
await setupPolicyEngineWithJson({
"policies": {
"EnableTrackingProtection": {
"Value": true
}
}
});
is(Services.prefs.getBoolPref("privacy.trackingprotection.enabled"), true, "Tracking protection has been enabled by default.");
is(Services.prefs.getBoolPref("privacy.trackingprotection.pbmode.enabled"), true, "Tracking protection has been enabled by default in private browsing mode.");
is(Services.prefs.prefIsLocked("privacy.trackingprotection.enabled"), false, "Tracking protection pref is not locked.");
});
add_task(async function test_policy_enable_tracking_protection_locked() {
await setupPolicyEngineWithJson({
"policies": {
"EnableTrackingProtection": {
"Value": false,
"Locked": true
}
}
});
is(Services.prefs.getBoolPref("privacy.trackingprotection.enabled"), false, "Tracking protection has been disabled by default.");
is(Services.prefs.getBoolPref("privacy.trackingprotection.pbmode.enabled"), false, "Tracking protection has been disabled by default in private browsing mode.");
is(Services.prefs.prefIsLocked("privacy.trackingprotection.enabled"), true, "Tracking protection pref is locked.");
Services.prefs.unlockPref("privacy.trackingprotection.enabled");
Services.prefs.unlockPref("privacy.trackingprotection.pbmode.enabled");
});

View File

@ -0,0 +1,5 @@
{
"policies": {
"NoDefaultBookmarks": true
}
}

View File

@ -0,0 +1,8 @@
[DEFAULT]
prefs =
browser.policies.enabled=true
browser.policies.alternatePath='<test-root>/browser/components/enterprisepolicies/tests/browser/disable_default_bookmarks/bookmarks_policies.json'
support-files =
bookmarks_policies.json
[browser_policy_no_default_bookmarks.js]

View File

@ -0,0 +1,20 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// This test must run in a separate folder because the
// No Default Bookmarks policy needs to be present on
// the first run of the profile, and not dinamically loaded
// like most of the policies tested in the main test folder.
add_task(async function test_no_default_bookmarks() {
let firstBookmarkOnToolbar =
await PlacesUtils.bookmarks.fetch({parentGuid: PlacesUtils.bookmarks.toolbarGuid, index: 0});
let firstBookmarkOnMenu =
await PlacesUtils.bookmarks.fetch({parentGuid: PlacesUtils.bookmarks.menuGuid, index: 0});
is(firstBookmarkOnToolbar, null, "No bookmarks on toolbar");
is(firstBookmarkOnMenu, null, "No bookmarks on menu");
});

View File

@ -10,6 +10,7 @@ with Files("**"):
BROWSER_CHROME_MANIFESTS += [
'browser/browser.ini',
'browser/disable_app_update/browser.ini',
'browser/disable_default_bookmarks/browser.ini',
'browser/disable_developer_tools/browser.ini',
]

View File

@ -180,14 +180,10 @@ this.windows = class extends ExtensionAPI {
return new Promise(resolve => {
window.addEventListener("load", function() {
if (["maximized", "normal"].includes(createData.state)) {
window.document.documentElement.setAttribute("sizemode", createData.state);
}
resolve(promiseObserved("browser-delayed-startup-finished", win => win == window));
}, {once: true});
}).then(() => {
// Some states only work after delayed-startup-finished
if (["minimized", "fullscreen", "docked"].includes(createData.state)) {
if (["minimized", "fullscreen", "docked", "normal", "maximized"].includes(createData.state)) {
win.state = createData.state;
}
if (allowScriptsToClose) {

View File

@ -41,12 +41,10 @@ add_task(async function testBrowserActionPopupResize() {
"Panel body should be wide enough to fit its contents");
}
/* eslint-disable mozilla/no-cpows-in-tests */
function setSize(size) {
content.document.body.style.height = `${size}px`;
content.document.body.style.width = `${size}px`;
}
/* eslint-enable mozilla/no-cpows-in-tests */
let sizes = [
200,
@ -115,8 +113,6 @@ async function testPopupSize(standardsMode, browserWin = window, arrowSide = "to
await extension.startup();
/* eslint-disable mozilla/no-cpows-in-tests */
if (arrowSide == "top") {
// Test the standalone panel for a toolbar button.
let browser = await openPanel(extension, browserWin, true);

View File

@ -1,7 +1,6 @@
/* global browser */
"use strict";
/* eslint-disable mozilla/no-cpows-in-tests */
function frameScript() {
function getSelectedText() {
let frame = this.content.frames[0].frames[1];
@ -29,7 +28,6 @@ function frameScript() {
}
getSelectedText();
}
/* eslint-enable mozilla/no-cpows-in-tests */
function waitForMessage(messageManager, topic) {
return new Promise(resolve => {

View File

@ -2,12 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The no-cpows-in-tests check isn't very smart, simply warning if it finds
// a variable named `content`. For Chrome compatibility, the Omnibox API uses
// that name for setting the text of a suggestion, and that's all this test uses
// it for, so we can disable it for this test.
/* eslint-disable mozilla/no-cpows-in-tests */
add_task(async function() {
let keyword = "test";

View File

@ -51,13 +51,11 @@ add_task(async function testPageActionPopupResize() {
"Panel body should be wide enough to fit its contents");
}
/* eslint-disable mozilla/no-cpows-in-tests */
function setSize(size) {
let elem = content.document.body.firstChild;
elem.style.height = `${size}px`;
elem.style.width = `${size}px`;
}
/* eslint-enable mozilla/no-cpows-in-tests */
let sizes = [
200,
@ -124,11 +122,9 @@ add_task(async function testPageActionPopupReflow() {
browser = await awaitExtensionPanel(extension);
/* eslint-disable mozilla/no-cpows-in-tests */
function setSize(size) {
content.document.body.style.fontSize = `${size}px`;
}
/* eslint-enable mozilla/no-cpows-in-tests */
let dims = await alterContent(browser, setSize, 18);

View File

@ -59,11 +59,9 @@ add_task(async function testPopupBackground() {
});
}
/* eslint-disable mozilla/no-cpows-in-tests */
let setBackground = color => {
content.document.body.style.backgroundColor = color;
};
/* eslint-enable mozilla/no-cpows-in-tests */
await new Promise(resolve => setTimeout(resolve, 100));

View File

@ -46,13 +46,11 @@ add_task(async function testPopupBorderRadius() {
let props = ["borderTopLeftRadius", "borderTopRightRadius",
"borderBottomRightRadius", "borderBottomLeftRadius"];
/* eslint-disable mozilla/no-cpows-in-tests */
let bodyStyle = await ContentTask.spawn(browser, props, async function(props) {
let bodyStyle = content.getComputedStyle(content.document.body);
return new Map(props.map(prop => [prop, bodyStyle[prop]]));
});
/* eslint-enable mozilla/no-cpows-in-tests */
for (let prop of props) {
if (standAlone) {

View File

@ -122,7 +122,7 @@ add_task(async function test_on_created_navigation_target_from_mouse_click_subfr
BrowserTestUtils.synthesizeMouseAtCenter(function() {
// This code runs as a framescript in the child process and it returns the
// target link in the subframe.
return this.content.frames[0].document // eslint-disable-line mozilla/no-cpows-in-tests
return this.content.frames[0].document
.querySelector("#test-create-new-tab-from-mouse-click-subframe");
}, {ctrlKey: true, metaKey: true}, tab.linkedBrowser);
},
@ -141,7 +141,7 @@ add_task(async function test_on_created_navigation_target_from_mouse_click_subfr
BrowserTestUtils.synthesizeMouseAtCenter(function() {
// This code runs as a framescript in the child process and it returns the
// target link in the subframe.
return this.content.frames[0].document // eslint-disable-line mozilla/no-cpows-in-tests
return this.content.frames[0].document
.querySelector("#test-create-new-window-from-mouse-click-subframe");
}, {shiftKey: true}, tab.linkedBrowser);
},
@ -160,7 +160,7 @@ add_task(async function test_on_created_navigation_target_from_mouse_click_subfr
BrowserTestUtils.synthesizeMouseAtCenter(function() {
// This code runs as a framescript in the child process and it returns the
// target link in the subframe.
return this.content.frames[0].document // eslint-disable-line mozilla/no-cpows-in-tests
return this.content.frames[0].document
.querySelector("#test-create-new-tab-from-targetblank-click-subframe");
}, {}, tab.linkedBrowser);
},

View File

@ -117,7 +117,7 @@ add_task(async function test_on_created_navigation_target_from_context_menu_subf
pageElementSelector: function() {
// This code runs as a framescript in the child process and it returns the
// target link in the subframe.
return this.content.frames[0] // eslint-disable-line mozilla/no-cpows-in-tests
return this.content.frames[0]
.document.querySelector("#test-create-new-tab-from-context-menu-subframe");
},
contextMenuItemLabel: "Open Link in New Tab",
@ -139,7 +139,7 @@ add_task(async function test_on_created_navigation_target_from_context_menu_subf
pageElementSelector: function() {
// This code runs as a framescript in the child process and it returns the
// target link in the subframe.
return this.content.frames[0] // eslint-disable-line mozilla/no-cpows-in-tests
return this.content.frames[0]
.document.querySelector("#test-create-new-window-from-context-menu-subframe");
},
contextMenuItemLabel: "Open Link in New Window",

View File

@ -103,7 +103,7 @@ add_task(async function testWindowCreate() {
windowState = latestWindow.STATE_FULLSCREEN;
}
if (expected.state == "STATE_NORMAL" && AppConstants.platform == "macosx") {
if (expected.state == "STATE_NORMAL") {
ok(windowState == window.STATE_NORMAL || windowState == window.STATE_MAXIMIZED,
`Expected windowState (currently ${windowState}) to be STATE_NORMAL but will accept STATE_MAXIMIZED`);
} else {

View File

@ -360,7 +360,8 @@ var MigratorPrototype = {
}
};
if (MigrationUtils.isStartupMigration && !this.startupOnlyMigrator) {
if (MigrationUtils.isStartupMigration && !this.startupOnlyMigrator &&
Services.policies.isAllowed("defaultBookmarks")) {
MigrationUtils.profileStartup.doStartup();
// First import the default bookmarks.
// Note: We do not need to do so for the Firefox migrator

View File

@ -1652,10 +1652,12 @@ BrowserGlue.prototype = {
if (bookmarksUrl) {
// Import from bookmarks.html file.
try {
await BookmarkHTMLUtils.importFromURL(bookmarksUrl, {
replace: true,
source: PlacesUtils.bookmarks.SOURCES.RESTORE_ON_STARTUP,
});
if (Services.policies.isAllowed("defaultBookmarks")) {
await BookmarkHTMLUtils.importFromURL(bookmarksUrl, {
replace: true,
source: PlacesUtils.bookmarks.SOURCES.RESTORE_ON_STARTUP,
});
}
} catch (e) {
Cu.reportError("Bookmarks.html file could be corrupt. " + e);
}
@ -2309,6 +2311,7 @@ BrowserGlue.prototype = {
// If version is current, or smart bookmarks are disabled, bail out.
if (smartBookmarksCurrentVersion == -1 ||
!Services.policies.isAllowed("defaultBookmarks") ||
smartBookmarksCurrentVersion >= SMART_BOOKMARKS_VERSION) {
return;
}

View File

@ -111,7 +111,6 @@ add_task(async function() {
let doc = gBrowser.selectedBrowser.contentDocument;
let showBtn = doc.getElementById("showUpdateHistory");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let dialogOverlay = content.gSubDialog._preloadDialog._overlay;
// XXX: For unknown reasons, this mock cannot be loaded by

View File

@ -8,7 +8,6 @@ add_task(async function setup() {
await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
info("Preferences page opened on the general pane.");
// eslint-disable-next-line mozilla/no-cpows-in-tests
await gBrowser.selectedBrowser.contentWindow.promiseLoadHandlersList;
info("Apps list loaded.");
@ -18,7 +17,6 @@ add_task(async function setup() {
});
add_task(async function getFeedItem() {
// eslint-disable-next-line mozilla/no-cpows-in-tests
win = gBrowser.selectedBrowser.contentWindow;
container = win.document.getElementById("handlersView");
@ -84,7 +82,6 @@ add_task(async function reselectInternalOptionForFeed() {
});
add_task(async function sortingCheck() {
// eslint-disable-next-line mozilla/no-cpows-in-tests
win = gBrowser.selectedBrowser.contentWindow;
const handlerView = win.document.getElementById("handlersView");

View File

@ -6,11 +6,8 @@ registerCleanupFunction(function() {
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
// eslint-disable-next-line mozilla/no-cpows-in-tests
await gBrowser.contentWindow.gMainPane._selectDefaultLanguageGroupPromise;
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
// eslint-disable-next-line mozilla/no-cpows-in-tests
let contentWindow = gBrowser.contentWindow;
var langGroup = Services.prefs.getComplexValue("font.language.group", Ci.nsIPrefLocalizedString).data;
is(contentWindow.Preferences.get("font.language.group").value, langGroup,

View File

@ -13,12 +13,10 @@ add_task(async function() {
window.resizeTo(window.outerWidth, 300);
let prefs = await openPreferencesViaOpenPreferencesAPI("paneSearch", {leaveOpen: true});
is(prefs.selectedPane, "paneSearch", "Search pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let mainContent = gBrowser.contentDocument.querySelector(".main-content");
mainContent.scrollTop = 50;
is(mainContent.scrollTop, 50, "main-content should be scrolled 50 pixels");
// eslint-disable-next-line mozilla/no-cpows-in-tests
gBrowser.contentWindow.gotoPref("paneGeneral");
is(mainContent.scrollTop, 0,
"Switching to a different category should reset the scroll position");

View File

@ -1,8 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-cpows-in-tests */
Services.prefs.setBoolPref("browser.preferences.instantApply", true);
registerCleanupFunction(function() {

View File

@ -9,7 +9,6 @@ add_task(async function() {
const tabURL = getRootDirectory(gTestPath) + "browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul";
await BrowserTestUtils.withNewTab({ gBrowser, url: tabURL }, async function(browser) {
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
let container = doc.getElementById("container");
@ -42,7 +41,6 @@ add_task(async function() {
});
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences#search" }, async function(browser) {
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
let container = doc.getElementsByClassName("main-content")[0];

View File

@ -22,11 +22,9 @@ function test() {
getService(Ci.nsIHandlerService);
hserv.store(info);
/* eslint-disable mozilla/no-cpows-in-tests */
openPreferencesViaOpenPreferencesAPI("general", {leaveOpen: true})
.then(() => gBrowser.selectedBrowser.contentWindow.promiseLoadHandlersList)
.then(() => runTest(gBrowser.selectedBrowser.contentWindow));
/* eslint-enable mozilla/no-cpows-in-tests */
}
function runTest(win) {

View File

@ -19,7 +19,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let win = gBrowser.selectedBrowser.contentWindow;
let container = win.document.getElementById("handlersView");

View File

@ -6,7 +6,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let checkbox = doc.querySelector("#checkSpelling");
is(checkbox.checked,

View File

@ -238,7 +238,6 @@ async function runTest(test, observances) {
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let historyMode = doc.getElementById("historyMode");
historyMode.value = "custom";

View File

@ -2,7 +2,6 @@
add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("search", {leaveOpen: true});
is(prefs.selectedPane, "paneSearch", "Search pane is selected by default");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let tree = doc.querySelector("#engineList");

View File

@ -55,7 +55,6 @@ function waitForMessageChange(element, cb, opts = { attributes: true, attributeF
return waitForMutation(element, opts, cb);
}
// eslint-disable-next-line mozilla/no-cpows-in-tests
function getElement(id, doc = gBrowser.contentDocument) {
return doc.getElementById(id);
}
@ -84,7 +83,6 @@ function waitForMessageContent(messageId, content, doc) {
add_task(async function testExtensionControlledHomepage() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
is(gBrowser.currentURI.spec, "about:preferences#general",
"#general should be in the URI for about:preferences");
@ -144,7 +142,6 @@ add_task(async function testExtensionControlledHomepage() {
add_task(async function testPrefLockedHomepage() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
is(gBrowser.currentURI.spec, "about:preferences#general",
"#general should be in the URI for about:preferences");
@ -276,7 +273,6 @@ add_task(async function testPrefLockedHomepage() {
add_task(async function testExtensionControlledNewTab() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
is(gBrowser.currentURI.spec, "about:preferences#general",
"#general should be in the URI for about:preferences");
@ -326,7 +322,6 @@ add_task(async function testExtensionControlledNewTab() {
add_task(async function testExtensionControlledDefaultSearch() {
await openPreferencesViaOpenPreferencesAPI("paneSearch", {leaveOpen: true});
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let extensionId = "@set_default_search";
let manifest = {
@ -422,7 +417,6 @@ add_task(async function testExtensionControlledDefaultSearch() {
add_task(async function testExtensionControlledHomepageUninstalledAddon() {
async function checkHomepageEnabled() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
is(gBrowser.currentURI.spec, "about:preferences#general",
"#general should be in the URI for about:preferences");
@ -566,7 +560,6 @@ add_task(async function testExtensionControlledTrackingProtection() {
let uiType = "new";
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
is(gBrowser.currentURI.spec, "about:preferences#privacy",
@ -745,7 +738,6 @@ add_task(async function testExtensionControlledProxyConfig() {
}
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
// eslint-disable-next-line mozilla/no-cpows-in-tests
let mainDoc = gBrowser.contentDocument;
is(gBrowser.currentURI.spec, "about:preferences#general",

View File

@ -1,4 +1,3 @@
/* eslint-disable mozilla/no-cpows-in-tests */
function whenMainPaneLoadedFinished() {
return new Promise(function(resolve, reject) {

View File

@ -2,7 +2,6 @@ add_task(async function testSetHomepageUseCurrent() {
is(gBrowser.currentURI.spec, "about:blank", "Test starts with about:blank open");
await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home");
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
is(gBrowser.currentURI.spec, "about:preferences#general",
"#general should be in the URI for about:preferences");

View File

@ -1,8 +1,6 @@
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
// eslint-disable-next-line mozilla/no-cpows-in-tests
const contentDocument = gBrowser.contentDocument;
// eslint-disable-next-line mozilla/no-cpows-in-tests
const dialogOverlay = content.gSubDialog._preloadDialog._overlay;
async function languagesSubdialogOpened() {

View File

@ -7,7 +7,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let checkbox = doc.querySelector("#allowHWAccel");
is(!checkbox.checked,

View File

@ -2,7 +2,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
is(prefs.selectedPane, "panePrivacy", "Privacy pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
// Fake the subdialog and LoginHelper
let win = doc.defaultView;

View File

@ -11,7 +11,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
is(prefs.selectedPane, "panePrivacy", "Privacy pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let notificationsDoNotDisturbBox = doc.getElementById("notificationsDoNotDisturbBox");
if (notificationsDoNotDisturbBox.hidden) {

View File

@ -66,7 +66,6 @@ add_task(async function test_deletePasswordWithKey() {
await TestUtils.waitForCondition(() => tree.view.rowCount == 0);
// eslint-disable-next-line mozilla/no-cpows-in-tests
is_element_visible(content.gSubDialog._dialogs[0]._box,
"Subdialog is visible after deleting an element");
});

View File

@ -13,7 +13,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings");
@ -79,7 +78,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings");
let allowHWAccel = doc.querySelector("#allowHWAccel");
@ -105,7 +103,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let performanceSettings = doc.querySelector("#performanceSettings");
@ -125,7 +122,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let performanceSettings = doc.querySelector("#performanceSettings");
@ -145,7 +141,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let performanceSettings = doc.querySelector("#performanceSettings");

View File

@ -16,7 +16,6 @@ add_task(async function testPrefsAreDefault() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings");
@ -51,7 +50,6 @@ add_task(async function testPrefsSetByUser() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let performanceSettings = doc.querySelector("#performanceSettings");
is(performanceSettings.hidden, false, "performance settings section is shown");

View File

@ -13,7 +13,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings");
@ -67,7 +66,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let performanceSettings = doc.querySelector("#performanceSettings");
@ -87,7 +85,6 @@ add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocument;
let performanceSettings = doc.querySelector("#performanceSettings");

View File

@ -4,7 +4,6 @@ const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul";
add_task(async function urlFieldVisibleForPopupPermissions(finish) {
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
// eslint-disable-next-line mozilla/no-cpows-in-tests
let win = gBrowser.selectedBrowser.contentWindow;
let doc = win.document;
let popupPolicyCheckbox = doc.getElementById("popupPolicy");

View File

@ -1,8 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-cpows-in-tests */
// Test the initial value of Browser Error collection checkbox
add_task(async function testBrowserErrorInitialValue() {
// Skip if non-Nightly since the checkbox will be missing.

View File

@ -8,7 +8,6 @@ function switchToCustomHistoryMode(doc) {
}
function testPrefStateMatchesLockedState() {
// eslint-disable-next-line mozilla/no-cpows-in-tests
let win = gBrowser.contentWindow;
let doc = win.document;
switchToCustomHistoryMode(doc);

View File

@ -3,8 +3,6 @@
* This file contains tests for the Preferences search bar.
*/
/* eslint-disable mozilla/no-cpows-in-tests */
requestLongerTimeout(6);
/**

View File

@ -3,8 +3,6 @@
* This file contains tests for the Preferences search bar.
*/
/* eslint-disable mozilla/no-cpows-in-tests */
/**
* Enabling searching functionality. Will display search bar from this testcase forward.
*/

View File

@ -1,7 +1,5 @@
"use strict";
/* eslint-disable mozilla/no-cpows-in-tests */
/**
* Test for "command" event on search input (when user clicks the x button)
*/

View File

@ -48,7 +48,6 @@ add_task(async function() {
// scroll the checkbox into the viewport and click checkbox
checkbox.scrollIntoView();
// eslint-disable-next-line mozilla/no-cpows-in-tests
EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
// check that both settings are now turned on or off

View File

@ -45,7 +45,6 @@ add_task(async function() {
// scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it
checkbox.scrollIntoView();
// eslint-disable-next-line mozilla/no-cpows-in-tests
EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
// check that setting is now turned on or off
@ -85,7 +84,6 @@ add_task(async function() {
// scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it
checkbox.scrollIntoView();
// eslint-disable-next-line mozilla/no-cpows-in-tests
EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
// check that both settings are now turned on or off

View File

@ -71,7 +71,6 @@ add_task(async function deleteALoginException() {
await TestUtils.waitForCondition(() => tree.view.rowCount == 0);
// eslint-disable-next-line mozilla/no-cpows-in-tests
is_element_visible(content.gSubDialog._dialogs[0]._box,
"Subdialog is visible after deleting an element");
});

View File

@ -1,4 +1,3 @@
/* eslint-disable mozilla/no-cpows-in-tests */
add_task(async function test_reports_section() {
let prefs = await openPreferencesViaOpenPreferencesAPI("privacy-reports", {leaveOpen: true});

View File

@ -185,7 +185,6 @@ add_task(async function check_reopening_dialog() {
add_task(async function check_opening_while_closing() {
await open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("closing");
// eslint-disable-next-line mozilla/no-cpows-in-tests
content.window.gSubDialog._topDialog.close();
info("reopening immediately after calling .close()");
await open_subdialog_and_test_generic_start_state(tab.linkedBrowser);

View File

@ -26,7 +26,6 @@ add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
await updatedPromise;
await openSiteDataSettingsDialog();
// eslint-disable-next-line mozilla/no-cpows-in-tests
let dialog = content.gSubDialog._topDialog;
let dialogFrame = dialog._frame;
let frameDoc = dialogFrame.contentDocument;

View File

@ -1,7 +1,5 @@
"use strict";
/* eslint-disable mozilla/no-cpows-in-tests */
function promiseSettingsDialogClose() {
return new Promise(resolve => {
let win = gBrowser.selectedBrowser.contentWindow;

View File

@ -77,7 +77,6 @@ add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
await updatedPromise;
await openSiteDataSettingsDialog();
// eslint-disable-next-line mozilla/no-cpows-in-tests
let win = gBrowser.selectedBrowser.contentWindow;
let dialogFrame = win.gSubDialog._topDialog._frame;
let frameDoc = dialogFrame.contentDocument;
@ -129,7 +128,6 @@ add_task(async function() {
await updatePromise;
await openSiteDataSettingsDialog();
// eslint-disable-next-line mozilla/no-cpows-in-tests
let dialog = content.gSubDialog._topDialog;
let dialogFrame = dialog._frame;
let frameDoc = dialogFrame.contentDocument;
@ -244,7 +242,6 @@ add_task(async function() {
await updatePromise;
await openSiteDataSettingsDialog();
// eslint-disable-next-line mozilla/no-cpows-in-tests
let dialog = content.gSubDialog._topDialog;
let dialogFrame = dialog._frame;
let frameDoc = dialogFrame.contentDocument;

View File

@ -64,7 +64,6 @@ var gTests = [
Services.prefs.setCharPref(kStatusPref, "pending");
let loadPromise = promiseStoppedLoad(expectedURL);
// eslint-disable-next-line mozilla/no-cpows-in-tests
gBrowser.contentDocumentAsCPOW.getElementById("searchResetKeepCurrent").click();
await loadPromise;
@ -83,7 +82,6 @@ var gTests = [
async run() {
let currentEngine = Services.search.currentEngine;
let originalEngine = Services.search.originalDefaultEngine;
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocumentAsCPOW;
let defaultEngineSpan = doc.getElementById("defaultEngine");
is(defaultEngineSpan.textContent, originalEngine.name,
@ -116,7 +114,6 @@ var gTests = [
let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser,
false,
"about:preferences#search");
// eslint-disable-next-line mozilla/no-cpows-in-tests
gBrowser.contentDocumentAsCPOW.getElementById("linkSettingsPage").click();
await loadPromise;

View File

@ -39,7 +39,6 @@ function test() {
tab.linkedBrowser.removeEventListener("load", load, true);
// Observe page setup
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocumentAsCPOW;
gMutationObserver = new MutationObserver(function(mutations) {
for (let mutation of mutations) {

View File

@ -16,7 +16,6 @@ add_task(async function() {
let browser = tab.linkedBrowser;
await BrowserTestUtils.browserLoaded(browser, false, "about:sessionrestore");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
// Click on the "Close" button after about:sessionrestore is loaded.
@ -36,7 +35,6 @@ add_task(async function() {
browser.loadURI("about:sessionrestore");
await BrowserTestUtils.browserLoaded(browser, false, "about:sessionrestore");
// eslint-disable-next-line mozilla/no-cpows-in-tests
doc = browser.contentDocument;
// Click on the "Close" button after about:sessionrestore is loaded.

View File

@ -32,7 +32,6 @@ function test() {
async function middleClickTest(win) {
let browser = win.gBrowser.selectedBrowser;
/* eslint-disable mozilla/no-cpows-in-tests */
let tabsToggle = browser.contentDocument.getElementById("tabsToggle");
EventUtils.synthesizeMouseAtCenter(tabsToggle, { button: 0 }, browser.contentWindow);
let treeContainer = browser.contentDocument.querySelector(".tree-container");
@ -40,7 +39,6 @@ async function middleClickTest(win) {
let tree = browser.contentDocument.getElementById("tabList");
is(tree.view.rowCount, 3, "There should be three items");
/* eslint-enable mozilla/no-cpows-in-tests */
// click on the first tab item
var rect = tree.treeBoxObject.getCoordsForCellItem(1, tree.columns[1], "text");

View File

@ -47,7 +47,6 @@ function test() {
});
// Create a dynamic subframe.
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
let iframe = doc.createElement("iframe");
doc.body.appendChild(iframe);

View File

@ -46,7 +46,6 @@ function test() {
});
// Create a dynamic subframe.
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
let iframe = doc.createElement("iframe");
doc.body.appendChild(iframe);

View File

@ -29,7 +29,6 @@ add_task(async function() {
ok(gBrowser.tabs.length > 1, "we have more than one tab");
// eslint-disable-next-line mozilla/no-cpows-in-tests
let view = browser.contentDocument.getElementById("tabList").view;
ok(view.isContainer(0), "first entry is the window");
is(view.getCellProperties(1, { id: "title" }), "icon",

View File

@ -390,7 +390,6 @@ add_task(async function test_hide_restore_all_button() {
// Crash the tab
await BrowserTestUtils.crashBrowser(browser);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocument;
let restoreAllButton = doc.getElementById("restoreAll");
let restoreOneButton = doc.getElementById("restoreTab");
@ -421,7 +420,6 @@ add_task(async function test_hide_restore_all_button() {
await BrowserTestUtils.crashBrowser(browser);
await otherBrowserReady;
// eslint-disable-next-line mozilla/no-cpows-in-tests
doc = browser.contentDocument;
restoreAllButton = doc.getElementById("restoreAll");
restoreOneButton = doc.getElementById("restoreTab");

View File

@ -26,7 +26,6 @@ function promiseDelayedStartupFinished(win) {
function promiseBrowserHasURL(browser, url) {
let promise = Promise.resolve();
// eslint-disable-next-line mozilla/no-cpows-in-tests
if (browser.contentDocument.readyState === "complete" &&
browser.currentURI.spec === url) {
return promise;

View File

@ -32,7 +32,6 @@ function onPageLoad() {
let shell = Cc["@mozilla.org/browser/shell-service;1"].
getService(Ci.nsIShellService);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let image = gBrowser.contentDocumentAsCPOW.images[0];
shell.setDesktopBackground(image, 0, "logo.png");

View File

@ -36,7 +36,6 @@ add_task(async function test_hide_skip_button_via_perf() {
await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-button", {}, tab.linkedBrowser);
await promiseOnboardingOverlayOpened(tab.linkedBrowser);
// eslint-disable-next-line mozilla/no-cpows-in-tests
ok(!gBrowser.contentDocumentAsCPOW.querySelector("#onboarding-skip-tour-button"), "should not render the skip button");
await BrowserTestUtils.removeTab(tab);

View File

@ -13,7 +13,6 @@ add_task(async function test_onboarding_default_new_tourset() {
await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-button", {}, tab.linkedBrowser);
await promiseOnboardingOverlayOpened(tab.linkedBrowser);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocumentAsCPOW;
let doms = doc.querySelectorAll(".onboarding-tour-item");
is(doms.length, TOUR_IDs.length, "has exact tour numbers");
@ -44,7 +43,6 @@ add_task(async function test_onboarding_custom_new_tourset() {
await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-button", {}, tab.linkedBrowser);
await promiseOnboardingOverlayOpened(tab.linkedBrowser);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocumentAsCPOW;
let doms = doc.querySelectorAll(".onboarding-tour-item");
is(doms.length, CUSTOM_NEW_TOURs.length, "has exact tour numbers");
@ -74,7 +72,6 @@ add_task(async function test_onboarding_custom_update_tourset() {
await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-button", {}, tab.linkedBrowser);
await promiseOnboardingOverlayOpened(tab.linkedBrowser);
// eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = gBrowser.contentDocumentAsCPOW;
let doms = doc.querySelectorAll(".onboarding-tour-item");
is(doms.length, CUSTOM_UPDATE_TOURs.length, "has exact tour numbers");

Some files were not shown because too many files have changed in this diff Show More