--- a/browser/base/content/test/general/browser_bug423833.js
+++ b/browser/base/content/test/general/browser_bug423833.js
@@ -79,26 +79,24 @@ function test2Setup() {
ok(test2tab, "openFrameInTab() opened a tab");
gBrowser.selectedTab = test2tab;
intervalID = setInterval(testOpenFrameInTab, 3000);
}
function testOpenFrameInTab() {
- /* eslint-disable mozilla/no-cpows-in-tests */
if (gBrowser.contentDocument.location.href == "about:blank")
// Wait another cycle
return;
clearInterval(intervalID);
// 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();
test3Setup();
}
function test3Setup() {
--- a/browser/base/content/test/general/browser_bug575561.js
+++ b/browser/base/content/test/general/browser_bug575561.js
@@ -69,17 +69,16 @@ async function testLink(aLinkIndexOrFunc
});
} else {
promise = BrowserTestUtils.browserLoaded(browser, 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();
href = link.href;
} else {
href = await ContentTask.spawn(browser, [ testSubFrame, aLinkIndexOrFunction ], function([ subFrame, index ]) {
let doc = subFrame ? content.document.querySelector("iframe").contentDocument : content.document;
let link = doc.querySelectorAll("a")[index];
--- a/browser/base/content/test/general/browser_bug678392.js
+++ b/browser/base/content/test/general/browser_bug678392.js
@@ -31,17 +31,16 @@ function test() {
"was successfully initialized when supported.");
cleanupArray();
load(gBrowser.selectedTab, HTTPROOT + "browser_bug678392-2.html", test0);
}
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);
}
function cleanupArray() {
let arr = gHistorySwipeAnimation._trackedSnapshots;
while (arr.length > 0) {
--- a/browser/base/content/test/general/browser_bug767836_perwindowpb.js
+++ b/browser/base/content/test/general/browser_bug767836_perwindowpb.js
@@ -70,17 +70,16 @@ function test() {
});
}
function openNewTab(aWindow, aCallback) {
// Open a new tab
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);
return;
}
BrowserTestUtils.browserLoaded(browser).then(() => {
executeSoon(aCallback);
--- a/browser/base/content/test/general/browser_e10s_about_page_triggeringprincipal.js
+++ b/browser/base/content/test/general/browser_e10s_about_page_triggeringprincipal.js
@@ -11,17 +11,16 @@ const kAboutPagesRegistered = Promise.al
registerCleanupFunction, "test-about-principal-parent", kParentPage,
Ci.nsIAboutModule.ALLOW_SCRIPT)
]);
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;
await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
let channel = content.document.docShell.currentDocumentChannel;
is(channel.originalURI.asciiSpec,
"about:test-about-principal-child",
--- a/browser/base/content/test/general/browser_keywordSearch_postData.js
+++ b/browser/base/content/test/general/browser_keywordSearch_postData.js
@@ -62,17 +62,16 @@ function nextTest() {
finish();
}
}
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;
is(loadedText, needle, "The query POST data should be returned in the response");
nextTest();
});
// Simulate a user entering search terms
--- a/browser/base/content/test/general/browser_tabfocus.js
+++ b/browser/base/content/test/general/browser_tabfocus.js
@@ -83,17 +83,16 @@ function focusInChild() {
addEventListener("focus", eventListener, true);
addEventListener("blur", eventListener, true);
addMessageListener("Browser:ChangeFocus", function changeFocus(message) {
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);
var details = "Focus is " + (node ? node.id : "<none>");
/* Check focus manager properties. Add an error onto the string if they are
not what is expected which will cause matching to fail in the parent process. */
let doc = content.document;
@@ -121,17 +120,16 @@ function focusElementInChild(elementid,
let browser = (elementid.includes("1")) ? browser1 : browser2;
if (gMultiProcessBrowser) {
browser.messageManager.sendAsyncMessage("Browser:ChangeFocus",
{ id: elementid, type });
} else {
browser.contentDocument.getElementById(elementid)[type]();
}
}
-/* eslint-enable mozilla/no-cpows-in-tests */
add_task(async function() {
tab1 = BrowserTestUtils.addTab(gBrowser);
browser1 = gBrowser.getBrowserForTab(tab1);
tab2 = BrowserTestUtils.addTab(gBrowser);
browser2 = gBrowser.getBrowserForTab(tab2);
--- a/browser/base/content/test/pageinfo/browser_pageinfo_image_info.js
+++ b/browser/base/content/test/pageinfo/browser_pageinfo_image_info.js
@@ -20,17 +20,16 @@ const URI =
function test() {
waitForExplicitFinish();
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
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,
"mediaTab", getImageInfo(testImg));
pageInfo.addEventListener("load", function() {
pageInfo.onFinished.push(function() {
var pageInfoImg = pageInfo.document.getElementById("thepreviewimage");
--- a/browser/base/content/test/popupNotifications/browser_popupNotification_keyboard.js
+++ b/browser/base/content/test/popupNotifications/browser_popupNotification_keyboard.js
@@ -187,17 +187,16 @@ var tests = [
await opened;
// Check that the focused element in the chrome window
// is either the browser in case we're running on e10s
// or the input field in case of non-e10s.
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"));
}
// Check that the input field is still focused inside the browser.
await ContentTask.spawn(browser, {}, function() {
is(content.document.activeElement, content.document.getElementById("test-input"));
});
--- a/browser/base/content/test/sidebar/browser_bug409481.js
+++ b/browser/base/content/test/sidebar/browser_bug409481.js
@@ -32,21 +32,19 @@ function delayedRunTest() {
setTimeout(runTest, 100);
}
function runTest(event) {
var sidebar = document.getElementById("sidebar");
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);
EventUtils.synthesizeMouseAtCenter(link, { type: "contextmenu", button: 2 }, browser.contentWindow);
}
function contextMenuOpened() {
var sidebar = document.getElementById("sidebar");
@@ -57,17 +55,16 @@ function contextMenuOpened() {
copyLinkCommand.doCommand();
}
function copyLinkCommandExecuted(event) {
event.target.removeEventListener("command", copyLinkCommandExecuted);
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");
is(textbox.value, "http://www.example.com/ctest", "copy link command");
sidebar.contentDocument.addEventListener("popuphidden", contextMenuClosed);
event.target.parentNode.hidePopup();
}
--- a/browser/base/content/test/siteIdentity/browser_bug906190.js
+++ b/browser/base/content/test/siteIdentity/browser_bug906190.js
@@ -29,28 +29,25 @@ async function doTest(parentTabSpec, chi
});
// Disable the Mixed Content Blocker for the page, which reloads it.
let promiseReloaded = BrowserTestUtils.browserLoaded(browser);
gIdentityHandler.disableMixedContentProtection();
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.
for (let openFn of [simulateCtrlClick, simulateContextMenuOpenInTab]) {
let promiseTabLoaded = waitForSomeTabToLoad();
openFn(browser);
await promiseTabLoaded;
gBrowser.selectTabAtIndex(2);
@@ -114,17 +111,16 @@ add_task(async function test_same_origin
HTTPS_TEST_ROOT_1 + "file_bug906190_2.html", async function() {
// The doorhanger should appear but activeBlocked should be >> NOT << true,
// because our decision of disabling the mixed content blocker is persistent
// across tabs.
await assertMixedContentBlockingState(gBrowser, {
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");
});
});
/**
* 2. - Load a html page which has mixed content
* - Doorhanger to disable protection appears - we disable it
@@ -136,17 +132,16 @@ add_task(async function test_different_o
HTTPS_TEST_ROOT_2 + "file_bug906190_2.html", async function() {
// The doorhanger should appear and activeBlocked should be >> TRUE <<,
// because our decision of disabling the mixed content blocker should only
// persist if pages are from the same domain.
await assertMixedContentBlockingState(gBrowser, {
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");
});
});
/**
* 3. - Load a html page which has mixed content
* - Doorhanger to disable protection appears - we disable it
@@ -158,17 +153,16 @@ add_task(async function test_same_origin
// file_bug906190_3_4.html redirects to page test1.example.com/* using meta-refresh
await doTest(HTTPS_TEST_ROOT_1 + "file_bug906190_1.html",
HTTPS_TEST_ROOT_1 + "file_bug906190_3_4.html", async function() {
// The doorhanger should appear but activeBlocked should be >> NOT << true!
await assertMixedContentBlockingState(gBrowser, {
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);
});
/**
* 4. - Load a html page which has mixed content
* - Doorhanger to disable protection appears - we disable it
@@ -179,17 +173,16 @@ add_task(async function test_same_origin
add_task(async function test_same_origin_metarefresh_different_origin() {
await doTest(HTTPS_TEST_ROOT_2 + "file_bug906190_1.html",
HTTPS_TEST_ROOT_2 + "file_bug906190_3_4.html", async function() {
// The doorhanger should appear and activeBlocked should be >> TRUE <<.
await assertMixedContentBlockingState(gBrowser, {
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);
});
/**
* 5. - Load a html page which has mixed content
* - Doorhanger to disable protection appears - we disable it
@@ -200,17 +193,16 @@ add_task(async function test_same_origin
// the sjs files returns a 302 redirect- note, same origins
await doTest(HTTPS_TEST_ROOT_1 + "file_bug906190_1.html",
HTTPS_TEST_ROOT_1 + "file_bug906190.sjs", function() {
// The doorhanger should appear but activeBlocked should be >> NOT << true.
// Currently it is >> TRUE << - see follow up bug 914860
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");
});
});
/**
* 6. - Load a html page which has mixed content
* - Doorhanger to disable protection appears - we disable it
@@ -221,17 +213,16 @@ add_task(async function test_same_origin
// the sjs files returns a 302 redirect - note, different origins
await doTest(HTTPS_TEST_ROOT_2 + "file_bug906190_1.html",
HTTPS_TEST_ROOT_2 + "file_bug906190.sjs", async function() {
// The doorhanger should appear and activeBlocked should be >> TRUE <<.
await assertMixedContentBlockingState(gBrowser, {
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");
});
});
/**
* 7. - Test memory leak issue on redirection error. See Bug 1269426.
*/
--- a/browser/base/content/test/tabcrashed/browser_autoSubmitRequest.js
+++ b/browser/base/content/test/tabcrashed/browser_autoSubmitRequest.js
@@ -27,17 +27,16 @@ add_task(async function test_show_form()
}, async function(browser) {
// Make sure we've flushed the browser messages so that
// we can restore it.
await TabStateFlusher.flush(browser);
// 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
// the content since about:tabcrashed is an in-process URL.
let requestAutoSubmit = doc.getElementById("requestAutoSubmit");
Assert.ok(!requestAutoSubmit.hidden,
"Request for autosubmission is visible.");
@@ -72,17 +71,16 @@ add_task(async function test_show_form()
await BrowserTestUtils.withNewTab({
gBrowser,
url: PAGE,
}, async function(browser) {
await TabStateFlusher.flush(browser);
// 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
// the content since about:tabcrashed is an in-process URL.
let requestAutoSubmit = doc.getElementById("requestAutoSubmit");
Assert.ok(requestAutoSubmit.hidden,
"Request for autosubmission is not visible.");
@@ -117,17 +115,16 @@ add_task(async function test_no_offer()
await TabStateFlusher.flush(browser);
// Make it so that it seems like no dump is available for the next crash.
prepareNoDump();
// 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.
let requestRect = doc.getElementById("requestAutoSubmit")
.getBoundingClientRect();
Assert.equal(0, requestRect.height,
"Request for autosubmission has no height");
Assert.equal(0, requestRect.width,
--- a/browser/base/content/test/tabcrashed/browser_clearEmail.js
+++ b/browser/base/content/test/tabcrashed/browser_clearEmail.js
@@ -32,29 +32,27 @@ add_task(async function test_clear_email
// crash
prefs.setCharPref("email", EMAIL);
prefs.setBoolPref("emailMe", true);
let tab = gBrowser.getTabForBrowser(browser);
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
// manipulate its DOM nodes directly
let emailMe = doc.getElementById("emailMe");
emailMe.checked = false;
let crashReport = promiseCrashReport({
Email: "",
});
- // eslint-disable-next-line mozilla/no-cpows-in-tests
let restoreTab = browser.contentDocument.getElementById("restoreTab");
restoreTab.click();
await BrowserTestUtils.waitForEvent(tab, "SSTabRestored");
await crashReport;
is(prefs.getCharPref("email"), "", "No email address should be stored");
// Submitting the crash report may have set some prefs regarding how to
--- a/browser/base/content/test/tabcrashed/browser_showForm.js
+++ b/browser/base/content/test/tabcrashed/browser_showForm.js
@@ -21,17 +21,16 @@ add_task(async function test_show_form()
let pref = TabCrashHandler.prefs.root + "sendReport";
await SpecialPowers.pushPrefEnv({
set: [[pref, true]]
});
// 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
// the content since about:tabcrashed is an in-process URL.
let checkbox = doc.getElementById("sendReport");
ok(checkbox.checked, "Send report checkbox is checked.");
// Ensure the options form is displayed.
--- a/browser/base/content/test/tabcrashed/browser_shown.js
+++ b/browser/base/content/test/tabcrashed/browser_shown.js
@@ -51,17 +51,16 @@ function crashTabTestHelper(fieldValues,
let prefs = TabCrashHandler.prefs;
let originalSendReport = prefs.getBoolPref("sendReport");
let originalEmailMe = prefs.getBoolPref("emailMe");
let originalIncludeURL = prefs.getBoolPref("includeURL");
let originalEmail = prefs.getCharPref("email");
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
// manipulate its DOM nodes directly
let comments = doc.getElementById("comments");
let email = doc.getElementById("email");
let emailMe = doc.getElementById("emailMe");
let includeURL = doc.getElementById("includeURL");
@@ -78,17 +77,16 @@ function crashTabTestHelper(fieldValues,
emailMe.checked = fieldValues.emailMe;
}
if (fieldValues.hasOwnProperty("includeURL")) {
includeURL.checked = fieldValues.includeURL;
}
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");
await crashReport;
// Submitting the crash report may have set some prefs regarding how to
// send tab crash reports. Let's reset them for the next test.
prefs.setBoolPref("sendReport", originalSendReport);
--- a/browser/base/content/test/urlbar/browser_urlbarKeepStateAcrossTabSwitches.js
+++ b/browser/base/content/test/urlbar/browser_urlbarKeepStateAcrossTabSwitches.js
@@ -5,17 +5,16 @@
* loads fail.
*/
add_task(async function() {
let input = "i-definitely-dont-exist.example.com";
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank", false);
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;
gURLBar.select();
EventUtils.sendKey("return");
await errorPageLoaded;
is(gURLBar.textValue, input, "Text is still in URL bar");
await BrowserTestUtils.switchTab(gBrowser, tab.previousSibling);
@@ -30,17 +29,16 @@ add_task(async function() {
*/
add_task(async function() {
let input = "To be or not to be-that is the question";
await SpecialPowers.pushPrefEnv({set: [["keyword.enabled", false]]});
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank", false);
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;
gURLBar.select();
EventUtils.sendKey("return");
await errorPageLoaded;
is(gURLBar.textValue, input, "Text is still in URL bar");
is(tab.linkedBrowser.userTypedValue, input, "Text still stored on browser");
--- a/browser/base/content/test/webextensions/browser_extension_sideloading.js
+++ b/browser/base/content/test/webextensions/browser_extension_sideloading.js
@@ -131,17 +131,16 @@ add_task(async function() {
ok(PanelUI.panel.state != "open", "Main menu is closed or closing.");
// When we get the permissions prompt, we should be at the extensions
// list in about:addons
let panel = await popupPromise;
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");
// Check the contents of the notification, then choose "Cancel"
checkNotification(panel, /\/foo-icon\.png$/, [
["webextPerms.hostDescription.allUrls"],
["webextPerms.description.history"],
@@ -167,17 +166,16 @@ add_task(async function() {
// Click the second sideloaded extension and wait for the notification
popupPromise = promisePopupNotificationShown("addon-webext-permissions");
addons.children[0].click();
panel = await popupPromise;
// 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");
// Check the notification contents.
checkNotification(panel, DEFAULT_ICON_URL, []);
// This time accept the install.
--- a/browser/components/contextualidentity/test/browser/browser_usercontext.js
+++ b/browser/components/contextualidentity/test/browser/browser_usercontext.js
@@ -64,17 +64,16 @@ add_task(async function test() {
let tab = openTabInUserContext(BASE_URI, userContextId);
// wait for load
let browser = gBrowser.getBrowserForTab(tab);
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
for (let part of title) {
let [storageMethodName, value] = part.split("=");
is(value, expectedContext,
"the title reflects the expected contextual identity of " +
expectedContext + " for method " + storageMethodName + ": " + value);
--- a/browser/components/customizableui/test/browser_947914_button_addons.js
+++ b/browser/components/customizableui/test/browser_947914_button_addons.js
@@ -19,17 +19,16 @@ add_task(async function() {
let addonsButton = document.getElementById("add-ons-button");
ok(addonsButton, "Add-ons button exists in Panel Menu");
addonsButton.click();
newTab = gBrowser.selectedTab;
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");
});
add_task(async function asyncCleanup() {
CustomizableUI.reset();
BrowserTestUtils.addTab(gBrowser, initialLocation);
--- a/browser/components/enterprisepolicies/tests/browser/browser_policies_notice_in_aboutpreferences.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policies_notice_in_aboutpreferences.js
@@ -4,13 +4,12 @@
"use strict";
add_task(async function test_notice_in_aboutprefences() {
await setupPolicyEngineWithJson({
"policies": { }
});
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");
});
});
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_masterpassword.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_masterpassword.js
@@ -32,17 +32,16 @@ async function checkDeviceManager({butto
is(changePwButton.getAttribute("disabled") == "true", buttonIsDisabled,
"Change Password button is in the correct state: " + buttonIsDisabled);
await BrowserTestUtils.closeWindow(deviceManagerWindow);
}
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);
});
}
add_task(async function test_policy_disable_masterpassword() {
ok(!mpToken.hasPassword, "Starting the test with no password");
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
@@ -36,22 +36,20 @@ add_task(async function testBrowserActio
// Tolerate if it is 1px too wide, as that may happen with the current resizing method.
Assert.lessOrEqual(Math.abs(dims.window.innerWidth - expected), 1,
`Panel window should be ${expected}px wide`);
is(dims.body.clientWidth, dims.body.scrollWidth,
"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,
400,
300,
];
for (let size of sizes) {
@@ -110,18 +108,16 @@ async function testPopupSize(standardsMo
<span></span>
</body>
</html>`,
},
});
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);
let dims = await promiseContentDimensions(browser);
is(dims.isStandards, standardsMode, "Document has the expected compat mode");
--- a/browser/components/extensions/test/browser/browser_ext_find.js
+++ b/browser/components/extensions/test/browser/browser_ext_find.js
@@ -1,12 +1,11 @@
/* global browser */
"use strict";
-/* eslint-disable mozilla/no-cpows-in-tests */
function frameScript() {
function getSelectedText() {
let frame = this.content.frames[0].frames[1];
let docShell = frame.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
let controller = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsISelectionDisplay)
@@ -24,17 +23,16 @@ function frameScript() {
let rect = {
top: (r1.top + r2.top + r3.top + f1.y + f2.y),
left: (r1.left + r2.left + r3.left + f1.x + f2.x),
};
this.sendAsyncMessage("test:find:selectionTest", {text: selection.toString(), rect});
}
getSelectedText();
}
-/* eslint-enable mozilla/no-cpows-in-tests */
function waitForMessage(messageManager, topic) {
return new Promise(resolve => {
messageManager.addMessageListener(topic, function messageListener(message) {
messageManager.removeMessageListener(topic, messageListener);
resolve(message);
});
});
--- a/browser/components/extensions/test/browser/browser_ext_omnibox.js
+++ b/browser/components/extensions/test/browser/browser_ext_omnibox.js
@@ -1,18 +1,12 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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";
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"omnibox": {
"keyword": keyword,
},
--- a/browser/components/extensions/test/browser/browser_ext_pageAction_popup_resize.js
+++ b/browser/components/extensions/test/browser/browser_ext_pageAction_popup_resize.js
@@ -46,23 +46,21 @@ add_task(async function testPageActionPo
"Panel root should be tall enough to fit its contents");
// Tolerate if it is 1px too wide, as that may happen with the current resizing method.
ok(Math.abs(dims.window.innerWidth - expected) <= 1, `Panel window should be ${expected}px wide`);
is(body.clientWidth, body.scrollWidth,
"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,
400,
300,
];
for (let size of sizes) {
@@ -119,21 +117,19 @@ add_task(async function testPageActionPo
await extension.startup();
await extension.awaitMessage("action-shown");
clickPageAction(extension, window);
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);
is(dims.window.innerWidth, 800, "Panel window should be 800px wide");
is(dims.body.clientWidth, 800, "Panel body should be 800px wide");
is(dims.body.clientWidth, dims.body.scrollWidth,
"Panel body should be wide enough to fit its contents");
--- a/browser/components/extensions/test/browser/browser_ext_popup_background.js
+++ b/browser/components/extensions/test/browser/browser_ext_popup_background.js
@@ -54,21 +54,19 @@ add_task(async function testPopupBackgro
function getBackground(browser) {
return ContentTask.spawn(browser, null, async function() {
return content.getComputedStyle(content.document.body)
.backgroundColor;
});
}
- /* 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));
info("Test that initial background color is applied");
checkArrow(await getBackground(browser));
info("Test that dynamically-changed background color is applied");
--- a/browser/components/extensions/test/browser/browser_ext_popup_corners.js
+++ b/browser/components/extensions/test/browser/browser_ext_popup_corners.js
@@ -41,23 +41,21 @@ add_task(async function testPopupBorderR
let stack = browser.parentNode;
let viewNode = stack.parentNode === panel ? browser : stack.parentNode;
let viewStyle = getComputedStyle(viewNode);
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) {
is(viewStyle[prop], panelStyle[prop], `Panel and view ${prop} should be the same`);
is(bodyStyle.get(prop), panelStyle[prop], `Panel and body ${prop} should be the same`);
} else {
is(viewStyle[prop], "0px", `View node ${prop} should be 0px`);
is(bodyStyle.get(prop), "0px", `Body node ${prop} should be 0px`);
--- a/browser/components/extensions/test/browser/browser_ext_webNavigation_onCreatedNavigationTarget.js
+++ b/browser/components/extensions/test/browser/browser_ext_webNavigation_onCreatedNavigationTarget.js
@@ -117,17 +117,17 @@ add_task(async function test_on_created_
info("Open a subframe link in a new tab using Ctrl-click");
await runCreatedNavigationTargetTest({
extension,
openNavTarget() {
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);
},
expectedWebNavProps: {
sourceTabId: expectedSourceTab.sourceTabId,
sourceFrameId: expectedSourceTab.sourceTabFrames[1].frameId,
url: `${OPENED_PAGE}#new-tab-from-mouse-click-subframe`,
},
@@ -136,17 +136,17 @@ add_task(async function test_on_created_
info("Open a subframe link in a new window using Shift-click");
await runCreatedNavigationTargetTest({
extension,
openNavTarget() {
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);
},
expectedWebNavProps: {
sourceTabId: expectedSourceTab.sourceTabId,
sourceFrameId: expectedSourceTab.sourceTabFrames[1].frameId,
url: `${OPENED_PAGE}#new-window-from-mouse-click-subframe`,
},
@@ -155,17 +155,17 @@ add_task(async function test_on_created_
info("Open a subframe link with target=\"_blank\" in a new tab using click");
await runCreatedNavigationTargetTest({
extension,
openNavTarget() {
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);
},
expectedWebNavProps: {
sourceTabId: expectedSourceTab.sourceTabId,
sourceFrameId: expectedSourceTab.sourceTabFrames[1].frameId,
url: `${OPENED_PAGE}#new-tab-from-targetblank-click-subframe`,
},
--- a/browser/components/extensions/test/browser/browser_ext_webNavigation_onCreatedNavigationTarget_contextmenu.js
+++ b/browser/components/extensions/test/browser/browser_ext_webNavigation_onCreatedNavigationTarget_contextmenu.js
@@ -112,17 +112,17 @@ add_task(async function test_on_created_
await runCreatedNavigationTargetTest({
extension,
async openNavTarget() {
await clickContextMenuItem({
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",
});
},
expectedWebNavProps: {
sourceTabId: expectedSourceTab.sourceTabId,
sourceFrameId: expectedSourceTab.sourceTabFrames[1].frameId,
@@ -134,17 +134,17 @@ add_task(async function test_on_created_
await runCreatedNavigationTargetTest({
extension,
async openNavTarget() {
await clickContextMenuItem({
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",
});
},
expectedWebNavProps: {
sourceTabId: expectedSourceTab.sourceTabId,
sourceFrameId: expectedSourceTab.sourceTabFrames[1].frameId,
--- a/browser/components/preferences/in-content/tests/browser_advanced_update.js
+++ b/browser/components/preferences/in-content/tests/browser_advanced_update.js
@@ -106,17 +106,16 @@ add_task(async function() {
gBrowser.removeCurrentTab();
});
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
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
// XPCOMUtils.defineLazyServiceGetter() called in aboutDialog-appUpdater.js.
// It is registered here so that we could assert update history subdialog
// without stopping the preferences advanced pane from loading.
// See bug 1361929.
mockUpdateManager.register();
--- a/browser/components/preferences/in-content/tests/browser_applications_selection.js
+++ b/browser/components/preferences/in-content/tests/browser_applications_selection.js
@@ -3,27 +3,25 @@ var feedItem;
var container;
SimpleTest.requestCompleteLog();
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.");
registerCleanupFunction(() => {
gBrowser.removeCurrentTab();
});
});
add_task(async function getFeedItem() {
- // eslint-disable-next-line mozilla/no-cpows-in-tests
win = gBrowser.selectedBrowser.contentWindow;
container = win.document.getElementById("handlersView");
feedItem = container.querySelector("richlistitem[type='application/vnd.mozilla.maybe.feed']");
Assert.ok(feedItem, "feedItem is present in handlersView.");
});
add_task(async function selectInternalOptionForFeed() {
@@ -79,17 +77,16 @@ add_task(async function reselectInternal
Assert.ok(list.selectedItem,
"Should have a selected item");
Assert.equal(list.selectedItem.getAttribute("action"),
Ci.nsIHandlerInfo.handleInternally,
"Selected item should still be the same as the previously selected item.");
});
add_task(async function sortingCheck() {
- // eslint-disable-next-line mozilla/no-cpows-in-tests
win = gBrowser.selectedBrowser.contentWindow;
const handlerView = win.document.getElementById("handlersView");
const typeColumn = win.document.getElementById("typeColumn");
Assert.ok(typeColumn, "typeColumn is present in handlersView.");
// Test default sorting
assertSortByType("ascending");
--- a/browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js
+++ b/browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js
@@ -1,21 +1,18 @@
Services.prefs.setBoolPref("browser.preferences.instantApply", true);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.preferences.instantApply");
});
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,
"Language group should be set correctly.");
let defaultFontType = Services.prefs.getCharPref("font.default." + langGroup);
let fontFamilyPref = "font.name." + defaultFontType + "." + langGroup;
let fontFamily = Services.prefs.getCharPref(fontFamilyPref);
--- a/browser/components/preferences/in-content/tests/browser_bug1018066_resetScrollPosition.js
+++ b/browser/components/preferences/in-content/tests/browser_bug1018066_resetScrollPosition.js
@@ -8,18 +8,16 @@ registerCleanupFunction(function() {
gBrowser.removeTab(gBrowser.tabs[1]);
});
add_task(async function() {
originalWindowHeight = window.outerHeight;
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");
});
--- a/browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js
+++ b/browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js
@@ -1,13 +1,11 @@
/* 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() {
Services.prefs.clearUserPref("browser.preferences.instantApply");
});
// Test opening to the differerent panes and subcategories in Preferences
add_task(async function() {
--- a/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js
+++ b/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js
@@ -4,17 +4,16 @@ const {Utils} = ChromeUtils.import("reso
const triggeringPrincipal_base64 = Utils.SERIALIZED_SYSTEMPRINCIPAL;
add_task(async function() {
waitForExplicitFinish();
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");
// Test button
let button = doc.getElementById("button");
button.focus();
EventUtils.sendString(" ");
await checkPageScrolling(container, "button");
@@ -37,17 +36,16 @@ add_task(async function() {
// Test radio
let radiogroup = doc.getElementById("radiogroup");
radiogroup.focus();
EventUtils.sendString(" ");
await checkPageScrolling(container, "radio");
});
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];
// Test search
let engineList = doc.getElementById("engineList");
engineList.focus();
EventUtils.sendString(" ");
is(engineList.view.selection.currentIndex, 0, "Search engineList is selected");
--- a/browser/components/preferences/in-content/tests/browser_bug410900.js
+++ b/browser/components/preferences/in-content/tests/browser_bug410900.js
@@ -17,21 +17,19 @@ function test() {
getService(Ci.nsIExternalProtocolService);
var info = extps.getProtocolHandlerInfo("apppanetest");
info.possibleApplicationHandlers.appendElement(handler);
var hserv = Cc["@mozilla.org/uriloader/handler-service;1"].
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) {
var rbox = win.document.getElementById("handlersView");
ok(rbox, "handlersView is present");
var items = rbox && rbox.getElementsByTagName("richlistitem");
ok(items && items.length > 0, "App handler list populated");
--- a/browser/components/preferences/in-content/tests/browser_change_app_handler.js
+++ b/browser/components/preferences/in-content/tests/browser_change_app_handler.js
@@ -14,17 +14,16 @@ function setupFakeHandler() {
gHandlerSvc.store(infoToModify);
}
add_task(async function() {
setupFakeHandler();
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");
let ourItem = container.querySelector("richlistitem[type='text/x-test-handler']");
ok(ourItem, "handlersView is present");
ourItem.scrollIntoView();
container.selectItem(ourItem);
ok(ourItem.selected, "Should be able to select our item.");
--- a/browser/components/preferences/in-content/tests/browser_checkspelling.js
+++ b/browser/components/preferences/in-content/tests/browser_checkspelling.js
@@ -1,17 +1,16 @@
add_task(async function() {
SpecialPowers.pushPrefEnv({set: [
["layout.spellcheckDefault", 2]
]});
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,
Services.prefs.getIntPref("layout.spellcheckDefault") == 2,
"checkbox should represent pref value before clicking on checkbox");
ok(checkbox.checked, "checkbox should be checked before clicking on checkbox");
checkbox.click();
--- a/browser/components/preferences/in-content/tests/browser_cookies_exceptions.js
+++ b/browser/components/preferences/in-content/tests/browser_cookies_exceptions.js
@@ -233,17 +233,16 @@ add_task(async function testSort() {
async function runTest(test, observances) {
registerCleanupFunction(function() {
Services.prefs.clearUserPref("privacy.history.custom");
});
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";
historyMode.doCommand();
let promiseSubDialogLoaded =
promiseLoadSubDialog("chrome://browser/content/preferences/permissions.xul");
doc.getElementById("cookieExceptions").doCommand();
--- a/browser/components/preferences/in-content/tests/browser_engines.js
+++ b/browser/components/preferences/in-content/tests/browser_engines.js
@@ -1,13 +1,12 @@
// Test Engine list
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");
ok(!tree.hidden, "The search engine list should be visible when Search is requested");
// Check for default search engines to be displayed in the engineList
let defaultEngines = Services.search.getDefaultEngines();
for (let i = 0; i < defaultEngines.length; i++) {
--- a/browser/components/preferences/in-content/tests/browser_extension_controlled.js
+++ b/browser/components/preferences/in-content/tests/browser_extension_controlled.js
@@ -50,17 +50,16 @@ function waitForMutation(target, opts, c
observer.observe(target, opts);
});
}
function waitForMessageChange(element, cb, opts = { attributes: true, attributeFilter: ["hidden"] }) {
return waitForMutation(element, opts, cb);
}
-// eslint-disable-next-line mozilla/no-cpows-in-tests
function getElement(id, doc = gBrowser.contentDocument) {
return doc.getElementById(id);
}
function waitForMessageHidden(messageId, doc) {
return waitForMessageChange(getElement(messageId, doc), target => target.hidden);
}
@@ -79,17 +78,16 @@ function waitForMessageContent(messageId
return waitForMessageChange(
getElement(messageId, doc),
target => target.textContent === content,
{ childList: true });
}
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");
let homepagePref = () => Services.prefs.getCharPref("browser.startup.homepage");
let originalHomepagePref = homepagePref();
let extensionHomepage = "https://developer.mozilla.org/";
let controlledContent = doc.getElementById("browserHomePageExtensionContent");
@@ -139,17 +137,16 @@ add_task(async function testExtensionCon
await waitForMessageShown("browserHomePageExtensionContent");
// Do the uninstall now that the enable code has been run.
addon.uninstall();
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
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");
let homePagePref = "browser.startup.homepage";
let buttonPrefs = [
"pref.browser.homepage.disable_button.current_page",
"pref.browser.homepage.disable_button.bookmark_page",
@@ -271,17 +268,16 @@ add_task(async function testPrefLockedHo
is(controlledContent.hidden, true,
"The extension controlled message is hidden when unlocked with no extension");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
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");
let controlledContent = doc.getElementById("browserNewTabExtensionContent");
// The new tab is set to the default and message is hidden.
ok(!aboutNewTabService.newTabURL.startsWith("moz-extension:"), "new tab is not set");
@@ -321,17 +317,16 @@ add_task(async function testExtensionCon
// Cleanup the tab and add-on.
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
let addon = await AddonManager.getAddonByID("@set_newtab");
addon.uninstall();
});
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 = {
manifest_version: 2,
name: "set_default_search",
applications: {gecko: {id: extensionId}},
description: "set_default_search description",
permissions: [],
@@ -417,17 +412,16 @@ add_task(async function testExtensionCon
await originalExtension.unload();
await updatedExtension.unload();
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
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");
let controlledContent = doc.getElementById("browserHomePageExtensionContent");
// The homepage is enabled.
let homepageInut = doc.getElementById("browserHomePage");
is(homepageInut.disabled, false, "The homepage input is enabled");
@@ -561,17 +555,16 @@ add_task(async function testExtensionCon
let controlledMessageShown = waitForMessageShown(CONTROLLED_LABEL_ID[uiType]);
addon.userDisabled = false;
await controlledMessageShown;
}
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",
"#privacy should be in the URI for about:preferences");
let controlledButton = doc.getElementById(CONTROLLED_BUTTON_ID);
verifyState(false);
@@ -740,17 +733,16 @@ add_task(async function testExtensionCon
async function closeProxyPanel(panelObj) {
panelObj.panel.document.documentElement.cancelDialog();
let panelClosingEvent = await panelObj.closingPromise;
ok(panelClosingEvent, "Proxy panel closed.");
}
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",
"#general should be in the URI for about:preferences");
verifyState(mainDoc, false);
// Open the connections panel.
--- a/browser/components/preferences/in-content/tests/browser_fluent.js
+++ b/browser/components/preferences/in-content/tests/browser_fluent.js
@@ -1,9 +1,8 @@
-/* eslint-disable mozilla/no-cpows-in-tests */
function whenMainPaneLoadedFinished() {
return new Promise(function(resolve, reject) {
const topic = "main-pane-loaded";
Services.obs.addObserver(function observer(aSubject) {
Services.obs.removeObserver(observer, topic);
resolve();
}, topic);
--- a/browser/components/preferences/in-content/tests/browser_homepages_filter_aboutpreferences.js
+++ b/browser/components/preferences/in-content/tests/browser_homepages_filter_aboutpreferences.js
@@ -1,13 +1,12 @@
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");
let oldHomepagePref = Services.prefs.getCharPref("browser.startup.homepage");
let useCurrent = doc.getElementById("useCurrent");
useCurrent.click();
--- a/browser/components/preferences/in-content/tests/browser_languages_subdialog.js
+++ b/browser/components/preferences/in-content/tests/browser_languages_subdialog.js
@@ -1,13 +1,11 @@
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() {
const promiseSubDialogLoaded = promiseLoadSubDialog("chrome://browser/content/preferences/languages.xul");
contentDocument.getElementById("chooseLanguage").click();
const win = await promiseSubDialogLoaded;
win.Preferences.forceEnableInstantApply();
is(dialogOverlay.style.visibility, "visible", "The dialog is visible.");
--- a/browser/components/preferences/in-content/tests/browser_layersacceleration.js
+++ b/browser/components/preferences/in-content/tests/browser_layersacceleration.js
@@ -2,17 +2,16 @@ add_task(async function() {
SpecialPowers.pushPrefEnv({set: [
["gfx.direct2d.disabled", false],
["layers.acceleration.disabled", false]
]});
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,
Services.prefs.getBoolPref("layers.acceleration.disabled"),
"checkbox should represent inverted pref value before clicking on checkbox");
checkbox.click();
--- a/browser/components/preferences/in-content/tests/browser_masterpassword.js
+++ b/browser/components/preferences/in-content/tests/browser_masterpassword.js
@@ -1,13 +1,12 @@
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;
let dialogURL = "";
win.gSubDialog = {
open(aDialogURL, unused, unused2, aCallback) {
dialogURL = aDialogURL;
masterPasswordSet = masterPasswordNextState;
--- a/browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js
+++ b/browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js
@@ -6,17 +6,16 @@ registerCleanupFunction(function() {
while (gBrowser.tabs[1])
gBrowser.removeTab(gBrowser.tabs[1]);
});
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) {
todo(false, "Do not disturb is not available on this platform");
return;
}
let alertService;
--- a/browser/components/preferences/in-content/tests/browser_password_management.js
+++ b/browser/components/preferences/in-content/tests/browser_password_management.js
@@ -61,12 +61,11 @@ add_task(async function test_deletePassw
if (AppConstants.platform == "macosx") {
EventUtils.synthesizeKey("KEY_Backspace");
} else {
EventUtils.synthesizeKey("KEY_Delete");
}
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");
});
--- a/browser/components/preferences/in-content/tests/browser_performance.js
+++ b/browser/components/preferences/in-content/tests/browser_performance.js
@@ -8,17 +8,16 @@ add_task(async function() {
["browser.preferences.defaultPerformanceSettings.enabled", true],
]});
});
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");
is(Services.prefs.getBoolPref("browser.preferences.defaultPerformanceSettings.enabled"), true,
"pref value should be true before clicking on checkbox");
ok(useRecommendedPerformanceSettings.checked, "checkbox should be checked before clicking on checkbox");
useRecommendedPerformanceSettings.click();
@@ -74,17 +73,16 @@ add_task(async function() {
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true);
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
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");
let contentProcessCount = doc.querySelector("#contentProcessCount");
let performanceSettings = doc.querySelector("#performanceSettings");
useRecommendedPerformanceSettings.click();
allowHWAccel.click();
@@ -100,17 +98,16 @@ add_task(async function() {
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true);
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
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");
is(performanceSettings.hidden, true, "performance settings section should not be shown");
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", false);
is(performanceSettings.hidden, false, "performance settings section should be shown");
@@ -120,17 +117,16 @@ add_task(async function() {
});
add_task(async function() {
Services.prefs.setIntPref("dom.ipc.processCount", 7);
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 should be shown");
let contentProcessCount = doc.querySelector("#contentProcessCount");
is(Services.prefs.getIntPref("dom.ipc.processCount"), 7, "pref value should be 7");
is(contentProcessCount.selectedItem.value, 7, "selected item should be 7");
@@ -140,17 +136,16 @@ add_task(async function() {
});
add_task(async function() {
Services.prefs.setBoolPref("layers.acceleration.disabled", true);
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 should be shown");
let allowHWAccel = doc.querySelector("#allowHWAccel");
is(Services.prefs.getBoolPref("layers.acceleration.disabled"), true,
"pref value is false");
--- a/browser/components/preferences/in-content/tests/browser_performance_e10srollout.js
+++ b/browser/components/preferences/in-content/tests/browser_performance_e10srollout.js
@@ -11,17 +11,16 @@ add_task(async function() {
add_task(async function testPrefsAreDefault() {
Services.prefs.setIntPref("dom.ipc.processCount", DEFAULT_PROCESS_COUNT);
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true);
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");
is(Services.prefs.getBoolPref("browser.preferences.defaultPerformanceSettings.enabled"), true,
"pref value should be true before clicking on checkbox");
ok(useRecommendedPerformanceSettings.checked, "checkbox should be checked before clicking on checkbox");
useRecommendedPerformanceSettings.click();
@@ -46,17 +45,16 @@ add_task(async function testPrefsAreDefa
add_task(async function testPrefsSetByUser() {
Services.prefs.setIntPref("dom.ipc.processCount", DEFAULT_PROCESS_COUNT + 2);
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", false);
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");
let contentProcessCount = doc.querySelector("#contentProcessCount");
is(contentProcessCount.disabled, false, "process count control should be enabled");
is(Services.prefs.getIntPref("dom.ipc.processCount"), DEFAULT_PROCESS_COUNT + 2, "process count should be the set value");
is(contentProcessCount.selectedItem.value, DEFAULT_PROCESS_COUNT + 2, "selected item should be the set one");
--- a/browser/components/preferences/in-content/tests/browser_performance_non_e10s.js
+++ b/browser/components/preferences/in-content/tests/browser_performance_non_e10s.js
@@ -8,17 +8,16 @@ add_task(async function() {
["browser.preferences.defaultPerformanceSettings.enabled", true],
]});
});
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");
is(Services.prefs.getBoolPref("browser.preferences.defaultPerformanceSettings.enabled"), true,
"pref value should be true before clicking on checkbox");
ok(useRecommendedPerformanceSettings.checked, "checkbox should be checked before clicking on checkbox");
useRecommendedPerformanceSettings.click();
@@ -62,17 +61,16 @@ add_task(async function() {
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true);
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
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");
is(performanceSettings.hidden, true, "performance settings section should not be shown");
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", false);
is(performanceSettings.hidden, false, "performance settings section should be shown");
@@ -82,17 +80,16 @@ add_task(async function() {
});
add_task(async function() {
Services.prefs.setBoolPref("layers.acceleration.disabled", true);
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 should be shown");
let allowHWAccel = doc.querySelector("#allowHWAccel");
is(Services.prefs.getBoolPref("layers.acceleration.disabled"), true,
"pref value is false");
--- a/browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js
+++ b/browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js
@@ -1,15 +1,14 @@
"use strict";
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");
ok(!popupPolicyCheckbox.checked, "popupPolicyCheckbox should be unchecked by default");
popupPolicyCheckbox.click();
let popupPolicyButton = doc.getElementById("popupPolicyButton");
ok(popupPolicyButton, "popupPolicyButton found");
let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL);
--- a/browser/components/preferences/in-content/tests/browser_privacypane.js
+++ b/browser/components/preferences/in-content/tests/browser_privacypane.js
@@ -1,13 +1,11 @@
/* 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.
if (!AppConstants.NIGHTLY_BUILD) {
return;
}
await SpecialPowers.pushPrefEnv({
--- a/browser/components/preferences/in-content/tests/browser_sanitizeOnShutdown_prefLocked.js
+++ b/browser/components/preferences/in-content/tests/browser_sanitizeOnShutdown_prefLocked.js
@@ -3,17 +3,16 @@
function switchToCustomHistoryMode(doc) {
// Select the last item in the menulist.
let menulist = doc.getElementById("historyMode");
menulist.focus();
EventUtils.sendKey("UP");
}
function testPrefStateMatchesLockedState() {
- // eslint-disable-next-line mozilla/no-cpows-in-tests
let win = gBrowser.contentWindow;
let doc = win.document;
switchToCustomHistoryMode(doc);
let checkbox = doc.getElementById("alwaysClear");
let preference = win.Preferences.get("privacy.sanitize.sanitizeOnShutdown");
is(checkbox.disabled, preference.locked, "Always Clear checkbox should be enabled when preference is not locked.");
--- a/browser/components/preferences/in-content/tests/browser_search_within_preferences_1.js
+++ b/browser/components/preferences/in-content/tests/browser_search_within_preferences_1.js
@@ -1,15 +1,13 @@
"use strict";
/**
* This file contains tests for the Preferences search bar.
*/
-/* eslint-disable mozilla/no-cpows-in-tests */
-
requestLongerTimeout(6);
/**
* Tests to see if search bar is being shown when pref is turned on
*/
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", { leaveOpen: true });
let searchInput = gBrowser.contentDocument.getElementById("searchInput");
--- a/browser/components/preferences/in-content/tests/browser_search_within_preferences_2.js
+++ b/browser/components/preferences/in-content/tests/browser_search_within_preferences_2.js
@@ -1,15 +1,13 @@
"use strict";
/**
* 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.
*/
add_task(async function() {
await SpecialPowers.pushPrefEnv({"set": [["browser.preferences.search", true]]});
});
/**
--- a/browser/components/preferences/in-content/tests/browser_search_within_preferences_command.js
+++ b/browser/components/preferences/in-content/tests/browser_search_within_preferences_command.js
@@ -1,12 +1,10 @@
"use strict";
-/* eslint-disable mozilla/no-cpows-in-tests */
-
/**
* Test for "command" event on search input (when user clicks the x button)
*/
add_task(async function() {
await SpecialPowers.pushPrefEnv({"set": [["browser.storageManager.enabled", false]]});
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
let generalPane = gBrowser.contentDocument.getElementById("generalCategory");
--- a/browser/components/preferences/in-content/tests/browser_security-1.js
+++ b/browser/components/preferences/in-content/tests/browser_security-1.js
@@ -43,17 +43,16 @@ add_task(async function() {
is(blockDownloads.hasAttribute("disabled"), !checked, "block downloads checkbox is set correctly");
is(checked, val1 && val2, "safebrowsing preference is initialized correctly");
// should be disabled when checked is false (= pref is turned off)
is(blockUncommon.hasAttribute("disabled"), !checked, "block uncommon checkbox is set correctly");
// 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
is(Services.prefs.getBoolPref("browser.safebrowsing.phishing.enabled"), !checked,
"safebrowsing.enabled is set correctly");
is(Services.prefs.getBoolPref("browser.safebrowsing.malware.enabled"), !checked,
"safebrowsing.malware.enabled is set correctly");
--- a/browser/components/preferences/in-content/tests/browser_security-2.js
+++ b/browser/components/preferences/in-content/tests/browser_security-2.js
@@ -40,17 +40,16 @@ add_task(async function() {
let blockUncommon = doc.getElementById("blockUncommonUnwanted");
let checked = checkbox.checked;
is(checked, val, "downloads preference is initialized correctly");
// should be disabled when val is false (= pref is turned off)
is(blockUncommon.hasAttribute("disabled"), !val, "block uncommon checkbox is set correctly");
// 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
is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.enabled"), !checked,
"safebrowsing.downloads preference is set correctly");
// check if the uncommon warning checkbox has updated
is(blockUncommon.hasAttribute("disabled"), val, "block uncommon checkbox is set correctly");
@@ -80,17 +79,16 @@ add_task(async function() {
let doc = gBrowser.selectedBrowser.contentDocument;
let checkbox = doc.getElementById("blockUncommonUnwanted");
let checked = checkbox.checked;
is(checked, val1 && val2, "unwanted/uncommon preference is initialized correctly");
// 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
is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted"), !checked,
"block_potentially_unwanted is set correctly");
is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_uncommon"), !checked,
"block_uncommon is set correctly");
--- a/browser/components/preferences/in-content/tests/browser_siteData.js
+++ b/browser/components/preferences/in-content/tests/browser_siteData.js
@@ -37,17 +37,16 @@ add_task(async function() {
await BrowserTestUtils.waitForContentEvent(
gBrowser.selectedBrowser, "test-indexedDB-done", false, null, true);
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
let updatedPromise = promiseSiteDataManagerSitesUpdated();
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;
let siteItems = frameDoc.getElementsByTagName("richlistitem");
is(siteItems.length, 2, "Should list sites using quota usage or appcache");
let appcacheSite = frameDoc.querySelector(`richlistitem[host="${TEST_OFFLINE_HOST}"]`);
--- a/browser/components/preferences/in-content/tests/browser_siteData2.js
+++ b/browser/components/preferences/in-content/tests/browser_siteData2.js
@@ -1,14 +1,12 @@
"use strict";
const { SiteDataManager } = ChromeUtils.import("resource:///modules/SiteDataManager.jsm", {});
const REMOVE_DIALOG_URL = "chrome://browser/content/preferences/siteDataRemoveSelected.xul";
-/* eslint-disable mozilla/no-cpows-in-tests */
-
function promiseSettingsDialogClose() {
return new Promise(resolve => {
let win = gBrowser.selectedBrowser.contentWindow;
let dialogOverlay = win.gSubDialog._topDialog._overlay;
let dialogWin = win.gSubDialog._topDialog._frame.contentWindow;
dialogWin.addEventListener("unload", function unload() {
if (dialogWin.document.documentURI === "chrome://browser/content/preferences/siteDataSettings.xul") {
isnot(dialogOverlay.style.visibility, "visible", "The Settings dialog should be hidden");
--- a/browser/components/preferences/in-content/tests/browser_siteData3.js
+++ b/browser/components/preferences/in-content/tests/browser_siteData3.js
@@ -76,17 +76,16 @@ add_task(async function() {
persisted: false
},
]);
let updatedPromise = promiseSiteDataManagerSitesUpdated();
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;
let siteItems = frameDoc.getElementsByTagName("richlistitem");
is(siteItems.length, 1, "Should group sites across scheme, port and origin attributes");
let columns = siteItems[0].querySelectorAll(".item-box > label");
@@ -129,17 +128,16 @@ add_task(async function() {
},
]);
let updatePromise = promiseSiteDataManagerSitesUpdated();
await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
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;
let hostCol = frameDoc.getElementById("hostCol");
let usageCol = frameDoc.getElementById("usageCol");
let cookiesCol = frameDoc.getElementById("cookiesCol");
let sitesList = frameDoc.getElementById("sitesList");
@@ -244,17 +242,16 @@ add_task(async function() {
},
]);
let updatePromise = promiseSiteDataManagerSitesUpdated();
await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
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;
let lastAccessedCol = frameDoc.getElementById("lastAccessedCol");
let sitesList = frameDoc.getElementById("sitesList");
// Test sorting on the date column
lastAccessedCol.click();
--- a/browser/components/preferences/in-content/tests/browser_site_login_exceptions.js
+++ b/browser/components/preferences/in-content/tests/browser_site_login_exceptions.js
@@ -66,12 +66,11 @@ add_task(async function deleteALoginExce
if (AppConstants.platform == "macosx") {
EventUtils.synthesizeKey("KEY_Backspace");
} else {
EventUtils.synthesizeKey("KEY_Delete");
}
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");
});
--- a/browser/components/preferences/in-content/tests/browser_spotlight.js
+++ b/browser/components/preferences/in-content/tests/browser_spotlight.js
@@ -1,9 +1,8 @@
-/* eslint-disable mozilla/no-cpows-in-tests */
add_task(async function test_reports_section() {
let prefs = await openPreferencesViaOpenPreferencesAPI("privacy-reports", {leaveOpen: true});
is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected by default");
let doc = gBrowser.contentDocument;
is(doc.location.hash, "#privacy", "The subcategory should be removed from the URI");
await TestUtils.waitForCondition(() => doc.querySelector(".spotlight"),
"Wait for the reports section is spotlighted.");
--- a/browser/components/preferences/in-content/tests/browser_subdialogs.js
+++ b/browser/components/preferences/in-content/tests/browser_subdialogs.js
@@ -180,17 +180,16 @@ add_task(async function check_reopening_
await close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { content.window.gSubDialog._topDialog._frame.contentDocument.documentElement.acceptDialog(); },
"accept", 1);
});
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);
await close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
function() { content.window.gSubDialog._topDialog._frame.contentDocument.documentElement.acceptDialog(); },
"accept", 1);
});
--- a/browser/components/search/test/browser_aboutSearchReset.js
+++ b/browser/components/search/test/browser_aboutSearchReset.js
@@ -59,17 +59,16 @@ var gTests = [
uri.spec;
let rawEngine = engine.wrappedJSObject;
let initialHash = rawEngine.getAttr("loadPathHash");
rawEngine.setAttr("loadPathHash", "broken");
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;
is(engine, Services.search.currentEngine,
"the custom engine is still default");
is(rawEngine.getAttr("loadPathHash"), initialHash,
"the loadPathHash has been fixed");
@@ -78,17 +77,16 @@ var gTests = [
}
},
{
desc: "Test the 'Restore Search Defaults' button.",
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,
"the name of the original default engine is displayed");
let expectedURL = originalEngine.
getSubmission(kSearchStr, null, kSearchPurpose).
uri.spec;
@@ -111,17 +109,16 @@ var gTests = [
{
desc: "Click the settings link.",
async run() {
Services.prefs.setCharPref(kStatusPref, "pending");
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;
checkTelemetryRecords(TELEMETRY_RESULT_ENUM.OPENED_SETTINGS);
is(Services.prefs.getCharPref(kStatusPref), "customized");
}
},
--- a/browser/components/search/test/browser_abouthome_behavior.js
+++ b/browser/components/search/test/browser_abouthome_behavior.js
@@ -34,17 +34,16 @@ function test() {
if (event.originalTarget != tab.linkedBrowser.contentDocumentAsCPOW ||
event.target.location.href == "about:blank") {
info("skipping spurious load event");
return;
}
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) {
if (mutation.attributeName == "searchEngineName") {
// Re-add the listener, and perform a search
gBrowser.addProgressListener(listener);
gMutationObserver.disconnect();
gMutationObserver = null;
--- a/browser/components/sessionstore/test/browser_480893.js
+++ b/browser/components/sessionstore/test/browser_480893.js
@@ -11,17 +11,16 @@ add_task(async function() {
]
});
let tab = BrowserTestUtils.addTab(gBrowser, "about:sessionrestore");
gBrowser.selectedTab = tab;
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.
doc.getElementById("errorCancel").click();
await BrowserTestUtils.browserLoaded(browser, false, "about:blank");
// Test that starting a new session loads the homepage (set to http://mochi.test:8888)
@@ -31,17 +30,16 @@ add_task(async function() {
"set": [
["browser.startup.homepage", homepage],
["browser.startup.page", 1],
]
});
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.
doc.getElementById("errorCancel").click();
await BrowserTestUtils.browserLoaded(browser);
is(browser.currentURI.spec, homepage, "loaded page is the homepage");
--- a/browser/components/sessionstore/test/browser_590563.js
+++ b/browser/components/sessionstore/test/browser_590563.js
@@ -27,25 +27,23 @@ function test() {
middleClickTest(win);
}, win);
});
});
}
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");
await BrowserTestUtils.waitForCondition(() => win.getComputedStyle(treeContainer).visibility == "visible");
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");
EventUtils.synthesizeMouse(tree.body, rect.x, rect.y, { button: 1 },
browser.contentWindow);
// click on the second tab item
rect = tree.treeBoxObject.getCoordsForCellItem(2, tree.columns[1], "text");
EventUtils.synthesizeMouse(tree.body, rect.x, rect.y, { button: 1 },
--- a/browser/components/sessionstore/test/browser_705597.js
+++ b/browser/components/sessionstore/test/browser_705597.js
@@ -42,17 +42,16 @@ function test() {
waitForBrowserState(blankState, finish);
});
// Force reload the browser to deprecate the subframes.
browser.reloadWithFlags(Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE);
});
// 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);
iframe.setAttribute("src", "about:mozilla");
});
});
}
--- a/browser/components/sessionstore/test/browser_707862.js
+++ b/browser/components/sessionstore/test/browser_707862.js
@@ -41,17 +41,16 @@ function test() {
});
});
// Force reload the browser to deprecate the subframes.
browser.reloadWithFlags(Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE);
});
// 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);
iframe.setAttribute("src", "about:mozilla");
});
});
// This test relies on the test timing out in order to indicate failure so
--- a/browser/components/sessionstore/test/browser_aboutSessionRestore.js
+++ b/browser/components/sessionstore/test/browser_aboutSessionRestore.js
@@ -24,17 +24,16 @@ add_task(async function() {
await promiseBrowserLoaded(browser);
// Fake a post-crash tab.
ss.setTabState(tab, JSON.stringify(TAB_STATE));
await promiseTabRestored(tab);
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",
"second entry is the tab and has a favicon");
browser.messageManager.loadFrameScript(FRAME_SCRIPT, true);
// Wait until the new window was restored.
--- a/browser/components/sessionstore/test/browser_crashedTabs.js
+++ b/browser/components/sessionstore/test/browser_crashedTabs.js
@@ -385,17 +385,16 @@ add_task(async function test_hide_restor
browser.loadURI(PAGE_1);
await promiseBrowserLoaded(browser);
await TabStateFlusher.flush(browser);
// 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");
let restoreAllStyles = window.getComputedStyle(restoreAllButton);
is(restoreAllStyles.display, "none", "Restore All button should be hidden");
ok(restoreOneButton.classList.contains("primary"), "Restore Tab button should have the primary class");
@@ -416,17 +415,16 @@ add_task(async function test_hide_restor
// sending its AboutTabCrashedReady event before we know for
// sure whether or not we're showing the right Restore buttons.
let otherBrowserReady = promiseTabCrashedReady(otherWinBrowser);
// Crash the first tab.
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");
restoreAllStyles = window.getComputedStyle(restoreAllButton);
isnot(restoreAllStyles.display, "none", "Restore All button should not be hidden");
ok(!(restoreOneButton.classList.contains("primary")), "Restore Tab button should not have the primary class");
--- a/browser/components/sessionstore/test/browser_swapDocShells.js
+++ b/browser/components/sessionstore/test/browser_swapDocShells.js
@@ -21,16 +21,15 @@ function promiseDelayedStartupFinished(w
return new Promise(resolve => {
whenDelayedStartupFinished(win, resolve);
});
}
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;
}
return promise.then(() => promiseBrowserHasURL(browser, url));
}
--- a/browser/components/shell/test/browser_1119088.js
+++ b/browser/components/shell/test/browser_1119088.js
@@ -27,17 +27,16 @@ function onPageLoad() {
wpFile.append("logo.png");
if (wpFile.exists()) {
wpFile.remove(false);
}
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");
setTimeout(function() {
ok(wpFile.exists(), "Desktop background was written to disk.");
desktopBackgroundDbBackup.moveTo(null, desktopBackgroundDb.leafName);
wpFile.remove(false);
--- a/browser/extensions/onboarding/test/browser/browser_onboarding_skip_tour.js
+++ b/browser/extensions/onboarding/test/browser/browser_onboarding_skip_tour.js
@@ -31,13 +31,12 @@ add_task(async function test_hide_skip_b
resetOnboardingDefaultState();
Preferences.set("browser.onboarding.skip-tour-button.hide", true);
let tab = await openTab(ABOUT_NEWTAB_URL);
await promiseOnboardingOverlayLoaded(tab.linkedBrowser);
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);
});
--- a/browser/extensions/onboarding/test/browser/browser_onboarding_tourset.js
+++ b/browser/extensions/onboarding/test/browser/browser_onboarding_tourset.js
@@ -8,17 +8,16 @@ requestLongerTimeout(2);
add_task(async function test_onboarding_default_new_tourset() {
resetOnboardingDefaultState();
let tab = await openTab(ABOUT_NEWTAB_URL);
await promiseOnboardingOverlayLoaded(tab.linkedBrowser);
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");
doms.forEach((dom, idx) => {
is(TOUR_IDs[idx], dom.id, "contain defined onboarding id");
});
await BrowserTestUtils.removeTab(tab);
@@ -39,17 +38,16 @@ add_task(async function test_onboarding_
["browser.onboarding.newtour", "private,addons,customize"],
]});
let tab = await openTab(ABOUT_NEWTAB_URL);
await promiseOnboardingOverlayLoaded(tab.linkedBrowser);
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");
doms.forEach((dom, idx) => {
is(CUSTOM_NEW_TOURs[idx], dom.id, "contain defined onboarding id");
});
await BrowserTestUtils.removeTab(tab);
@@ -69,17 +67,16 @@ add_task(async function test_onboarding_
["browser.onboarding.updatetour", "customize,private,addons"],
]});
let tab = await openTab(ABOUT_NEWTAB_URL);
await promiseOnboardingOverlayLoaded(tab.linkedBrowser);
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");
doms.forEach((dom, idx) => {
is(CUSTOM_UPDATE_TOURs[idx], dom.id, "contain defined onboarding id");
});
await BrowserTestUtils.removeTab(tab);
--- a/browser/modules/test/browser/formValidation/browser_form_validation.js
+++ b/browser/modules/test/browser/formValidation/browser_form_validation.js
@@ -341,17 +341,16 @@ add_task(async function() {
gObserver.notifyInvalidSubmit = function() {};
resolve();
});
};
Services.obs.addObserver(gObserver, "invalidformsubmit");
executeSoon(function() {
- // eslint-disable-next-line mozilla/no-cpows-in-tests
browser.contentDocument.getElementById("s").click();
});
});
await notifierPromise;
gBrowser.removeTab(gBrowser.getTabForBrowser(browser));
});
@@ -387,17 +386,16 @@ add_task(async function() {
let popupShownPromise = BrowserTestUtils.waitForEvent(gInvalidFormPopup, "popupshown");
await clickChildElement(browser);
await popupShownPromise;
checkPopupShow();
await checkChildFocus(browser, gInvalidFormPopup.firstChild.textContent);
- // eslint-disable-next-line mozilla/no-cpows-in-tests
let inputPromise = BrowserTestUtils.waitForEvent(gBrowser.contentDocument.getElementById("i"), "input");
EventUtils.sendString("f");
await inputPromise;
// Now, the element suffers from another error, the message should have
// been updated.
await new Promise((resolve, reject) => {
// XXXndeakin This isn't really going to work when the content is another process
--- a/devtools/.eslintrc.js
+++ b/devtools/.eslintrc.js
@@ -13,17 +13,16 @@ module.exports = {
"require": true,
},
"rules": {
// These are the rules that have been configured so far to match the
// devtools coding style.
// Rules from the mozilla plugin
"mozilla/no-aArgs": "error",
- "mozilla/no-cpows-in-tests": "error",
"mozilla/no-single-arg-cu-import": "error",
// See bug 1224289.
"mozilla/reject-importGlobalProperties": "error",
// devtools/shared/platform is special; see the README.md in that
// directory for details. We reject requires using explicit
// subdirectories of this directory.
"mozilla/reject-some-requires": ["error", "^devtools/shared/platform/(chome|content)/"],
"mozilla/var-only-at-top-level": "error",
--- a/devtools/client/debugger/new/test/mochitest/head.js
+++ b/devtools/client/debugger/new/test/mochitest/head.js
@@ -774,17 +774,17 @@ function waitForActive(dbg) {
* @static
*/
function invokeInTab(fnc, ...args) {
info(`Invoking in tab: ${fnc}(${args.map(uneval).join(",")})`);
return ContentTask.spawn(gBrowser.selectedBrowser, { fnc, args }, function*({
fnc,
args
}) {
- content.wrappedJSObject[fnc](...args); // eslint-disable-line mozilla/no-cpows-in-tests, max-len
+ content.wrappedJSObject[fnc](...args);
});
}
const isLinux = Services.appinfo.OS === "Linux";
const isMac = Services.appinfo.OS === "Darwin";
const cmdOrCtrl = isLinux ? { ctrlKey: true } : { metaKey: true };
const shiftOrAlt = isMac
? { accelKey: true, shiftKey: true }
--- a/devtools/client/netmonitor/test/browser_net_resend_cors.js
+++ b/devtools/client/netmonitor/test/browser_net_resend_cors.js
@@ -88,17 +88,16 @@ add_task(function* () {
// Wait for both requestPostData & responseContent payloads arrived.
yield waitUntil(() => {
item = getRequestById(store.getState(), item.id);
return item.responseContent && item.requestPostData;
});
is(item.requestPostData.postData.text, "post-data",
"The POST request has the right POST data");
- // eslint-disable-next-line mozilla/no-cpows-in-tests
is(item.responseContent.content.text, "Access-Control-Allow-Origin: *",
"The POST response has the right content");
}
}
info("Finishing the test");
return teardown(monitor);
});
--- a/devtools/client/responsive.html/test/browser/browser_page_state.js
+++ b/devtools/client/responsive.html/test/browser/browser_page_state.js
@@ -41,28 +41,26 @@ add_task(async function () {
// Click on content to set an altered state that would be lost on reload
await BrowserTestUtils.synthesizeMouseAtCenter("body", {}, browser);
let { ui } = await openRDM(tab);
// Check color inside the viewport
let color = await spawnViewportTask(ui, {}, function () {
- // eslint-disable-next-line mozilla/no-cpows-in-tests
return content.getComputedStyle(content.document.body)
.getPropertyValue("background-color");
});
is(color, "rgb(0, 128, 0)",
"Content is still modified from click in viewport");
await closeRDM(tab);
// Check color back in the browser tab
color = await ContentTask.spawn(browser, {}, async function () {
- // eslint-disable-next-line mozilla/no-cpows-in-tests
return content.getComputedStyle(content.document.body)
.getPropertyValue("background-color");
});
is(color, "rgb(0, 128, 0)",
"Content is still modified from click in browser tab");
// Check session history state
history = await getSessionHistory(browser);
--- a/devtools/client/shared/test/browser_toolbar_webconsole_errors_count.js
+++ b/devtools/client/shared/test/browser_toolbar_webconsole_errors_count.js
@@ -1,13 +1,11 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
-/* eslint-disable mozilla/no-cpows-in-tests */
-
"use strict";
// Tests that the developer toolbar errors count works properly.
const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser");
// Use the old webconsole since this is directly accessing old DOM, and
// the error count isn't reset when pressing the clear button in new one
--- a/devtools/client/sourceeditor/test/browser_css_autocompletion.js
+++ b/devtools/client/sourceeditor/test/browser_css_autocompletion.js
@@ -75,19 +75,17 @@ let index = 0;
let completer = null;
let progress;
let progressDiv;
let inspector;
function test() {
waitForExplicitFinish();
addTab(TEST_URI).then(function () {
- /* eslint-disable mozilla/no-cpows-in-tests */
doc = gBrowser.contentDocumentAsCPOW;
- /* eslint-enable mozilla/no-cpows-in-tests */
runTests();
});
}
function runTests() {
progress = doc.getElementById("progress");
progressDiv = doc.querySelector("#progress > div");
let target = TargetFactory.forTab(gBrowser.selectedTab);
--- a/devtools/client/sourceeditor/test/browser_css_getInfo.js
+++ b/devtools/client/sourceeditor/test/browser_css_getInfo.js
@@ -123,19 +123,17 @@ const TEST_URI = "data:text/html;charset
" </html>"
].join("\n"));
let doc = null;
function test() {
waitForExplicitFinish();
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
- /* eslint-disable mozilla/no-cpows-in-tests */
doc = gBrowser.contentDocumentAsCPOW;
- /* eslint-enable mozilla/no-cpows-in-tests */
runTests();
});
gBrowser.loadURI(TEST_URI);
}
function runTests() {
let completer = new CSSCompleter({
cssProperties: getClientCssProperties()
--- a/devtools/client/sourceeditor/test/browser_css_statemachine.js
+++ b/devtools/client/sourceeditor/test/browser_css_statemachine.js
@@ -54,19 +54,17 @@ const TEST_URI = "data:text/html;charset
" </html>"
].join("\n"));
var doc = null;
function test() {
waitForExplicitFinish();
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TEST_URI);
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
- /* eslint-disable mozilla/no-cpows-in-tests */
doc = gBrowser.contentDocumentAsCPOW;
- /* eslint-enable mozilla/no-cpows-in-tests */
runTests();
});
}
function runTests() {
let completer = new CSSCompleter({
cssProperties: getClientCssProperties()
});
--- a/devtools/server/tests/browser/browser_markers-docloading-01.js
+++ b/devtools/server/tests/browser/browser_markers-docloading-01.js
@@ -6,17 +6,16 @@
*/
"use strict";
const { TimelineFront } = require("devtools/shared/fronts/timeline");
const MARKER_NAMES = ["document::DOMContentLoaded", "document::Load"];
add_task(async function () {
let browser = await addTab(MAIN_DOMAIN + "doc_innerHTML.html");
- // eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocumentAsCPOW;
initDebuggerServer();
let client = new DebuggerClient(DebuggerServer.connectPipe());
let form = await connectDebuggerClient(client);
let front = TimelineFront(client, form);
let rec = await front.start({ withMarkers: true });
--- a/devtools/server/tests/browser/browser_markers-docloading-02.js
+++ b/devtools/server/tests/browser/browser_markers-docloading-02.js
@@ -6,17 +6,16 @@
*/
"use strict";
const { TimelineFront } = require("devtools/shared/fronts/timeline");
const MARKER_NAMES = ["document::DOMContentLoaded", "document::Load"];
add_task(async function () {
let browser = await addTab(MAIN_DOMAIN + "doc_innerHTML.html");
- // eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocumentAsCPOW;
initDebuggerServer();
let client = new DebuggerClient(DebuggerServer.connectPipe());
let form = await connectDebuggerClient(client);
let front = TimelineFront(client, form);
let rec = await front.start({ withMarkers: true, withDocLoadingEvents: true });
--- a/devtools/server/tests/browser/browser_markers-docloading-03.js
+++ b/devtools/server/tests/browser/browser_markers-docloading-03.js
@@ -6,17 +6,16 @@
*/
"use strict";
const { TimelineFront } = require("devtools/shared/fronts/timeline");
const MARKER_NAMES = ["document::DOMContentLoaded", "document::Load"];
add_task(async function () {
let browser = await addTab(MAIN_DOMAIN + "doc_innerHTML.html");
- // eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocumentAsCPOW;
initDebuggerServer();
let client = new DebuggerClient(DebuggerServer.connectPipe());
let form = await connectDebuggerClient(client);
let front = TimelineFront(client, form);
let rec = await front.start({ withDocLoadingEvents: true });
--- a/devtools/server/tests/browser/browser_storage_dynamic_windows.js
+++ b/devtools/server/tests/browser/browser_storage_dynamic_windows.js
@@ -158,20 +158,18 @@ function testAddIframe(front) {
let endTestReloaded = () => {
front.off("stores-update", onStoresUpdate);
resolve();
};
front.on("stores-update", onStoresUpdate);
- // eslint-disable-next-line mozilla/no-cpows-in-tests
let iframe = gBrowser.contentDocumentAsCPOW.createElement("iframe");
iframe.src = ALT_DOMAIN_SECURED + "storage-secured-iframe.html";
- // eslint-disable-next-line mozilla/no-cpows-in-tests
gBrowser.contentDocumentAsCPOW.querySelector("body").appendChild(iframe);
});
}
function testRemoveIframe(front) {
info("Testing if iframe removal works properly");
return new Promise(resolve => {
let shouldBeEmpty = {
--- a/devtools/server/tests/browser/browser_storage_updates.js
+++ b/devtools/server/tests/browser/browser_storage_updates.js
@@ -293,17 +293,16 @@ function storesCleared(data) {
async function finishTests(client) {
await client.close();
DebuggerServer.destroy();
finish();
}
add_task(async function () {
let browser = await addTab(MAIN_DOMAIN + "storage-updates.html");
- // eslint-disable-next-line mozilla/no-cpows-in-tests
let doc = browser.contentDocumentAsCPOW;
initDebuggerServer();
let client = new DebuggerClient(DebuggerServer.connectPipe());
let form = await connectDebuggerClient(client);
let front = StorageFront(client, form);
let win = doc.defaultView.wrappedJSObject;
--- a/toolkit/components/narrate/test/browser_narrate.js
+++ b/toolkit/components/narrate/test/browser_narrate.js
@@ -1,16 +1,14 @@
/* 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/. */
"use strict";
-/* eslint-disable mozilla/no-cpows-in-tests */
-
registerCleanupFunction(teardown);
add_task(async function testNarrate() {
setup();
await spawnInNewReaderTab(TEST_ARTICLE, async function() {
let TEST_VOICE = "urn:moz-tts:fake:teresa";
let $ = content.document.querySelector.bind(content.document);
--- a/toolkit/components/narrate/test/browser_narrate_language.js
+++ b/toolkit/components/narrate/test/browser_narrate_language.js
@@ -1,16 +1,14 @@
/* 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/. */
"use strict";
-/* eslint-disable mozilla/no-cpows-in-tests */
-
registerCleanupFunction(teardown);
add_task(async function testVoiceselectDropdownAutoclose() {
setup("automatic", true);
await spawnInNewReaderTab(TEST_ARTICLE, async function() {
let $ = content.document.querySelector.bind(content.document);
--- a/toolkit/components/narrate/test/browser_voiceselect.js
+++ b/toolkit/components/narrate/test/browser_voiceselect.js
@@ -1,16 +1,14 @@
/* 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/. */
"use strict";
-/* eslint-disable mozilla/no-cpows-in-tests */
-
registerCleanupFunction(teardown);
add_task(async function testVoiceselectDropdownAutoclose() {
setup();
await spawnInNewReaderTab(TEST_ARTICLE, async function() {
let $ = content.document.querySelector.bind(content.document);
--- a/toolkit/components/narrate/test/browser_word_highlight.js
+++ b/toolkit/components/narrate/test/browser_word_highlight.js
@@ -1,16 +1,14 @@
/* 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/. */
"use strict";
-/* eslint-disable mozilla/no-cpows-in-tests */
-
registerCleanupFunction(teardown);
add_task(async function testNarrate() {
setup("urn:moz-tts:fake:teresa");
await spawnInNewReaderTab(TEST_ARTICLE, async function() {
let $ = content.document.querySelector.bind(content.document);
--- a/toolkit/components/normandy/test/browser/browser_about_preferences.js
+++ b/toolkit/components/normandy/test/browser/browser_about_preferences.js
@@ -1,12 +1,10 @@
"use strict";
-/* eslint-disable mozilla/no-cpows-in-tests */
-
ChromeUtils.import("resource://gre/modules/Services.jsm", this);
const OPT_OUT_PREF = "app.shield.optoutstudies.enabled";
const FHR_PREF = "datareporting.healthreport.uploadEnabled";
function withPrivacyPrefs(testFunc) {
return async (...args) => (
BrowserTestUtils.withNewTab("about:preferences#privacy", async browser => (
--- a/toolkit/components/normandy/test/browser/browser_about_studies.js
+++ b/toolkit/components/normandy/test/browser/browser_about_studies.js
@@ -10,17 +10,16 @@ return async (...args) => (
testFunc(...args, browser)
))
);
}
decorate_task(
withAboutStudies,
async function testAboutStudiesWorks(browser) {
- // eslint-disable-next-line mozilla/no-cpows-in-tests
ok(browser.contentDocumentAsCPOW.getElementById("app"), "App element was found");
}
);
decorate_task(
withPrefEnv({
set: [["app.normandy.shieldLearnMoreUrl", "http://test/%OS%/"]],
}),
--- a/toolkit/components/payments/test/browser/browser_host_name.js
+++ b/toolkit/components/payments/test/browser/browser_host_name.js
@@ -5,17 +5,16 @@ async function withBasicRequestDialogFor
methodData: [PTU.MethodData.basicCard],
details: PTU.Details.total60USD,
};
await spawnInDialogForMerchantTask(PTU.ContentTasks.createRequest, dialogTaskFn, args, {
origin,
});
}
-/* eslint-disable mozilla/no-cpows-in-tests */
add_task(async function test_host() {
await withBasicRequestDialogForOrigin("https://example.com", () => {
is(content.document.querySelector("#host-name").textContent, "example.com",
"Check basic host name");
});
});
add_task(async function test_host_subdomain() {
--- a/toolkit/components/payments/test/browser/browser_profile_storage.js
+++ b/toolkit/components/payments/test/browser/browser_profile_storage.js
@@ -1,13 +1,10 @@
"use strict";
-// Disable CPOW checks because they have false-positives from use of ContentTask in a helper.
-/* eslint-disable mozilla/no-cpows-in-tests */
-
const methodData = [PTU.MethodData.basicCard];
const details = PTU.Details.total60USD;
add_task(async function test_initial_state() {
let onChanged = TestUtils.topicObserved("formautofill-storage-changed",
(subject, data) => data == "add");
let address1GUID = formAutofillStorage.addresses.add({
"given-name": "Timothy",
--- a/toolkit/components/payments/test/browser/browser_request_serialization.js
+++ b/toolkit/components/payments/test/browser/browser_request_serialization.js
@@ -1,13 +1,10 @@
"use strict";
-// Disable CPOW checks because they have false-positives from use of ContentTask in a helper.
-/* eslint-disable mozilla/no-cpows-in-tests */
-
add_task(async function test_serializeRequest_displayItems() {
const testTask = ({methodData, details}) => {
let contentWin = Cu.waiveXrays(content);
let store = contentWin.document.querySelector("payment-dialog").requestStore;
let state = store && store.getState();
ok(state, "got request store state");
let expected = details;
--- a/toolkit/components/payments/test/browser/browser_request_summary.js
+++ b/toolkit/components/payments/test/browser/browser_request_summary.js
@@ -1,11 +1,10 @@
"use strict";
add_task(async function test_summary() {
await BrowserTestUtils.withNewTab({
gBrowser,
url: "resource://payments/paymentRequest.xhtml",
}, async browser => {
- // eslint-disable-next-line mozilla/no-cpows-in-tests
ok(browser.contentDocumentAsCPOW.getElementById("cancel"), "Cancel button exists");
});
});
--- a/toolkit/components/payments/test/browser/browser_total.js
+++ b/toolkit/components/payments/test/browser/browser_total.js
@@ -1,11 +1,10 @@
"use strict";
-/* eslint-disable mozilla/no-cpows-in-tests */
add_task(async function test_total() {
const testTask = ({methodData, details}) => {
is(content.document.querySelector("#total > currency-amount").textContent,
"$60.00",
"Check total currency amount");
};
const args = {
methodData: [PTU.MethodData.basicCard],
--- a/toolkit/components/reader/test/browser_readerMode_with_anchor.js
+++ b/toolkit/components/reader/test/browser_readerMode_with_anchor.js
@@ -24,17 +24,16 @@ add_task(async function() {
});
add_task(async function() {
await BrowserTestUtils.withNewTab(TEST_PATH + "readerModeArticle.html", async function(browser) {
let pageShownPromise = BrowserTestUtils.waitForContentEvent(browser, "AboutReaderContentReady");
let readerButton = document.getElementById("reader-mode-button");
readerButton.click();
await pageShownPromise;
- // eslint-disable-next-line mozilla/no-cpows-in-tests
is(gBrowser.contentDocumentAsCPOW.documentElement.scrollTop, 0, "scrollTop should be 0");
await BrowserTestUtils.synthesizeMouseAtCenter("#foo-anchor", {}, browser);
await ContentTask.spawn(browser, null, async function() {
let foo = content.document.getElementById("foo");
ok(foo, "foo element should be in document");
let {scrollTop} = content.document.documentElement;
let {offsetTop} = foo;
Assert.lessOrEqual(Math.abs(scrollTop - offsetTop), 1,
--- a/toolkit/content/tests/browser/browser_datetime_datepicker.js
+++ b/toolkit/content/tests/browser/browser_datetime_datepicker.js
@@ -162,17 +162,16 @@ add_task(async function test_datepicker_
await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
// Click the first item (top-left corner) of the calendar
helper.click(helper.getElement(DAYS_VIEW).children[0]);
await ContentTask.spawn(helper.tab.linkedBrowser, {}, async function() {
let inputEl = content.document.querySelector("input");
await ContentTaskUtils.waitForEvent(inputEl, "input");
});
- // eslint-disable-next-line mozilla/no-cpows-in-tests
Assert.equal(gBrowser.contentDocumentAsCPOW.querySelector("input").value, firstDayOnCalendar);
await helper.tearDown();
});
/**
* Make sure picker is in correct state when it is reopened.
*/
--- a/toolkit/content/tests/browser/browser_saveImageURL.js
+++ b/toolkit/content/tests/browser/browser_saveImageURL.js
@@ -32,17 +32,16 @@ add_task(async function preferred_API()
url: IMAGE_PAGE,
}, async function(browser) {
let url = await ContentTask.spawn(browser, null, async function() {
let image = content.document.getElementById("image");
return image.href;
});
saveImageURL(url, "image.jpg", null, true, false, null, null, null, null, false);
- // eslint-disable-next-line mozilla/no-cpows-in-tests
let channel = gBrowser.contentDocumentAsCPOW.docShell.currentDocumentChannel;
if (channel) {
ok(true, channel.QueryInterface(Ci.nsIHttpChannelInternal)
.channelIsForDownload);
// Throttleable is the only class flag assigned to downloads.
ok(channel.QueryInterface(Ci.nsIClassOfService).classFlags,
Ci.nsIClassOfService.Throttleable);
@@ -69,17 +68,16 @@ add_task(async function deprecated_API()
return image.href;
});
// Now get the document directly from content. If we run this test with
// e10s-enabled, this will be a CPOW, which is forbidden. We'll just
// pass the XUL document instead to test this interface.
let doc = document;
- // eslint-disable-next-line mozilla/no-cpows-in-tests
let channel = gBrowser.contentDocumentAsCPOW.docShell.currentDocumentChannel;
if (channel) {
ok(true, channel.QueryInterface(Ci.nsIHttpChannelInternal)
.channelIsForDownload);
// Throttleable is the only class flag assigned to downloads.
ok(channel.QueryInterface(Ci.nsIClassOfService).classFlags,
Ci.nsIClassOfService.Throttleable);
--- a/toolkit/content/tests/browser/browser_save_resend_postdata.js
+++ b/toolkit/content/tests/browser/browser_save_resend_postdata.js
@@ -22,30 +22,28 @@ function test() {
gBrowser.addEventListener("pageshow", function pageShown(event) {
if (event.target.location == "about:blank")
return;
gBrowser.removeEventListener("pageshow", pageShown);
// Submit the form in the outer page, then wait for both the outer
// document and the inner frame to be loaded again.
gBrowser.addEventListener("DOMContentLoaded", handleOuterSubmit);
- // eslint-disable-next-line mozilla/no-cpows-in-tests
gBrowser.contentDocument.getElementById("postForm").submit();
});
var framesLoaded = 0;
var innerFrame;
function handleOuterSubmit() {
if (++framesLoaded < 2)
return;
gBrowser.removeEventListener("DOMContentLoaded", handleOuterSubmit);
- // eslint-disable-next-line mozilla/no-cpows-in-tests
innerFrame = gBrowser.contentDocument.getElementById("innerFrame");
// Submit the form in the inner page.
gBrowser.addEventListener("DOMContentLoaded", handleInnerSubmit);
innerFrame.contentDocument.getElementById("postForm").submit();
}
function handleInnerSubmit() {
--- a/toolkit/mozapps/extensions/test/browser/browser_bug562797.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug562797.js
@@ -1,14 +1,13 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* eslint max-nested-callbacks: ["warn", 12] */
-/* eslint-disable mozilla/no-cpows-in-tests */
/**
* Tests that history navigation works for the add-ons manager.
*/
const MAIN_URL = "https://example.com/" + RELATIVE_DIR + "discovery.html";
const SECOND_URL = "https://example.com/" + RELATIVE_DIR + "releaseNotes.xhtml";
--- a/toolkit/mozapps/extensions/test/browser/browser_discovery.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_discovery.js
@@ -169,17 +169,16 @@ function clickLink(aId, aCallback) {
var browser = gManagerWindow.document.getElementById("discover-browser");
browser.addProgressListener(gProgressListener);
gLoadCompleteCallback = function() {
browser.removeProgressListener(gProgressListener);
aCallback();
};
- // eslint-disable-next-line mozilla/no-cpows-in-tests
var link = browser.contentDocument.getElementById(aId);
EventUtils.sendMouseEvent({type: "click"}, link);
executeSoon(function() {
ok(isLoading(), "Clicking a link should show the loading pane");
});
}
--- a/toolkit/mozapps/extensions/test/browser/browser_discovery_install.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_discovery_install.js
@@ -1,14 +1,12 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-/* eslint-disable mozilla/no-cpows-in-tests */
-
// Tests that the discovery view can install add-ons correctly
const MAIN_URL = "https://example.com/" + RELATIVE_DIR + "discovery_install.html";
const GOOD_FRAMED_URL = "https://example.com/" + RELATIVE_DIR + "discovery_frame.html";
const BAD_FRAMED_URL = "https://example.org/" + RELATIVE_DIR + "discovery_frame.html";
const PREF_INSTALL_REQUIREBUILTINCERTS = "extensions.install.requireBuiltInCerts";
--- a/tools/lint/docs/linters/eslint-plugin-mozilla.rst
+++ b/tools/lint/docs/linters/eslint-plugin-mozilla.rst
@@ -165,38 +165,16 @@ first letter is a prefix that indicates
no-compare-against-boolean-literals
-----------------------------------
Checks that boolean expressions do not compare against literal values
of `true` or `false`. This is to prevent overly verbose code such as
`if (isEnabled == true)` when `if (isEnabled)` would suffice.
-no-cpows-in-tests
------------------
-
-This rule checks if the file is a browser mochitest and, if so, checks for
-possible CPOW usage by checking for the following strings:
-
-- ``gBrowser.contentWindow``
-- ``gBrowser.contentDocument``
-- ``gBrowser.selectedBrowser.contentWindow``
-- ``browser.contentDocument``
-- ``window.content``
-- ``content``
-- ``content.``
-
-Note: These are string matches so we will miss situations where the parent
-object is assigned to another variable e.g.:
-
-.. code-block:: js
-
- var b = gBrowser;
- b.content // Would not be detected as a CPOW.
-
no-define-cc-etc
----------------
This disallows statements such as:
.. code-block:: js
var Cc = Components.classes;
@@ -335,17 +313,16 @@ Example
Example configuration:
.. code-block:: js
"rules": {
"mozilla/balanced-listeners": 2,
"mozilla/mark-test-function-used": 1,
"mozilla/var-only-at-top-level": 1,
- "mozilla/no-cpows-in-tests": 1,
}
Tests
=====
The tests for eslint-plugin-mozilla are run via `mochajs`_ on top of node. Most
of the tests use the `ESLint Rule Unit Test framework`_.
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js
@@ -56,12 +56,11 @@ module.exports = {
"plugins": [
"mozilla"
],
"rules": {
"mozilla/import-content-task-globals": "error",
"mozilla/import-headjs-globals": "error",
"mozilla/mark-test-function-used": "error",
- "mozilla/no-arbitrary-setTimeout": "error",
- "mozilla/no-cpows-in-tests": "error"
+ "mozilla/no-arbitrary-setTimeout": "error"
}
};
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
@@ -40,17 +40,16 @@ module.exports = {
require("../lib/rules/import-content-task-globals"),
"import-globals": require("../lib/rules/import-globals"),
"import-headjs-globals": require("../lib/rules/import-headjs-globals"),
"mark-exported-symbols-as-used": require("../lib/rules/mark-exported-symbols-as-used"),
"mark-test-function-used": require("../lib/rules/mark-test-function-used"),
"no-aArgs": require("../lib/rules/no-aArgs"),
"no-arbitrary-setTimeout": require("../lib/rules/no-arbitrary-setTimeout"),
"no-compare-against-boolean-literals": require("../lib/rules/no-compare-against-boolean-literals"),
- "no-cpows-in-tests": require("../lib/rules/no-cpows-in-tests"),
"no-define-cc-etc": require("../lib/rules/no-define-cc-etc"),
"no-single-arg-cu-import": require("../lib/rules/no-single-arg-cu-import"),
"no-import-into-var-and-global":
require("../lib/rules/no-import-into-var-and-global.js"),
"no-task": require("../lib/rules/no-task"),
"no-useless-parameters": require("../lib/rules/no-useless-parameters"),
"no-useless-removeEventListener":
require("../lib/rules/no-useless-removeEventListener"),
deleted file mode 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-cpows-in-tests.js
+++ /dev/null
@@ -1,181 +0,0 @@
-/**
- * @fileoverview Prevent access to CPOWs in browser mochitests.
- *
- * 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/.
- */
-
-"use strict";
-
-// -----------------------------------------------------------------------------
-// Rule Definition
-// -----------------------------------------------------------------------------
-
-var helpers = require("../helpers");
-
-var cpows = [
- /^gBrowser\.contentWindow/,
- /^gBrowser\.contentDocument/,
- /^gBrowser\.selectedBrowser\.contentWindow/,
- /^browser\.contentDocument/,
- /^window\.content/
-];
-
-// Keep track of where the last error is reported so to avoid reporting the same
-// expression (e.g., window.content.X vs window.content). Resets for each file.
-var lastErrorStart;
-
-// Keep track of whether we've entered a ContentTask.spawn call where accesses
-// to "content" are *not* CPOW. Resets when exiting the call.
-var isInContentTask = false;
-
-module.exports = function(context) {
- // ---------------------------------------------------------------------------
- // Helpers
- // ---------------------------------------------------------------------------
-
- function showError(node, identifier) {
- if (isInContentTask) {
- return;
- }
-
- // Avoid showing partial expressions errors when one already errored.
- if (node.start === lastErrorStart) {
- return;
- }
- lastErrorStart = node.start;
-
- context.report({
- node,
- message: identifier +
- " is a possible Cross Process Object Wrapper (CPOW)."
- });
- }
-
- function hasLocalContentVariable(node) {
- // Walk up the parents, see if we can find if "content" is a local variable.
- let parent = node;
- do {
- parent = parent.parent;
-
- // Don't error if 'content' is one of the function parameters.
- if (helpers.getIsFunctionNode(parent) &&
- context.getDeclaredVariables(parent).some(variable => variable.name === "content")) {
- return true;
- } else if (parent.type === "BlockStatement" || parent.type === "Program") {
- // Don't error if the block or program includes their own definition of content.
- for (let item of parent.body) {
- if (item.type === "VariableDeclaration" && item.declarations.length) {
- for (let declaration of item.declarations) {
- if (declaration.id && declaration.id.name === "content") {
- return true;
- }
- }
- }
- }
- }
- } while (parent.parent);
- return false;
- }
-
- function isContentTask(node) {
- return node &&
- node.type === "MemberExpression" &&
- node.property.type === "Identifier" &&
- node.property.name === "spawn" &&
- node.object.type === "Identifier" &&
- node.object.name === "ContentTask";
- }
-
- // ---------------------------------------------------------------------------
- // Public
- // ---------------------------------------------------------------------------
-
- return {
- CallExpression(node) {
- if (isContentTask(node.callee)) {
- isInContentTask = true;
- }
- },
-
- "CallExpression:exit": function(node) {
- if (isContentTask(node.callee)) {
- isInContentTask = false;
- }
- },
-
- Program() {
- lastErrorStart = undefined;
- },
-
- MemberExpression(node) {
- if (helpers.getTestType(context) != "browser") {
- return;
- }
-
- var expression = context.getSource(node);
-
- // Only report a single CPOW error per node -- so if checking
- // |cpows| reports one, don't report another below.
- var someCpowFound = cpows.some(function(cpow) {
- if (cpow.test(expression)) {
- showError(node, expression);
- return true;
- }
- return false;
- });
-
- // Specially scope checks for "context." to avoid false positives.
- if (!someCpowFound && /^content\./.test(expression)) {
- // Don't error if we're multiple scopes deep. For now we only care about
- // 2 scopes: global (length = 0) or immediately called by add_task.
- // Ideally, we would care about any scope, but figuring out whether
- // "context" is CPOW-or-not depends on how functions are defined and
- // called -- both aspects are especially complex with head.js helpers.
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1417017#c9
- const scopes = context.getAncestors().filter(helpers.getIsFunctionNode);
- if (scopes.length > 1 || scopes.length === 1 &&
- (!scopes[0].parent.callee || scopes[0].parent.callee.name !== "add_task")) {
- return;
- }
-
- // Don't error if there's a locally scoped "content"
- if (hasLocalContentVariable(node)) {
- return;
- }
-
- showError(node, expression);
- }
- },
-
- Identifier(node) {
- if (helpers.getTestType(context) != "browser") {
- return;
- }
-
- if (node.name !== "content" ||
- // Don't complain if this is part of a member expression - the
- // MemberExpression() function will handle those.
- node.parent.type === "MemberExpression" ||
- // If this is a declared variable in a function, then don't complain.
- node.parent.type === "FunctionDeclaration") {
- return;
- }
-
- // Don't error in the case of `let content = foo`.
- if (node.parent.type === "VariableDeclarator" &&
- node.parent.id && node.parent.id.name === "content") {
- return;
- }
-
- // Don't error if there's a locally scoped "content"
- if (hasLocalContentVariable(node)) {
- return;
- }
-
- var expression = context.getSource(node);
- showError(node, expression);
- }
- };
-};
deleted file mode 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/tests/no-cpows-in-tests.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// ------------------------------------------------------------------------------
-// Requirements
-// ------------------------------------------------------------------------------
-
-var rule = require("../lib/rules/no-cpows-in-tests");
-var RuleTester = require("eslint/lib/testers/rule-tester");
-
-const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } });
-
-// ------------------------------------------------------------------------------
-// Tests
-// ------------------------------------------------------------------------------
-
-function wrapCode(code, filename = "browser_fake.js") {
- return {code, filename};
-}
-
-function invalidCode(code, item, type = "MemberExpression") {
- let message = `${item} is a possible Cross Process Object Wrapper (CPOW).`;
- let obj = wrapCode(code);
- obj.errors = [{message, type}];
- return obj;
-}
-
-ruleTester.run("no-cpows-in-tests", rule, {
- valid: [
- "window.document",
- wrapCode("ContentTask.spawn(browser, null, () => { content.document; });"),
- wrapCode("let x = cssDocs.tooltip.content.contentDocument;"),
- wrapCode("function test(content) { let x = content; }"),
- wrapCode('let content = "content"; foo(content);'),
- wrapCode("helper(() => content.document);"),
- wrapCode("add_task(() => helper(() => content.document));"),
- wrapCode("add_task(() => { let content = {}; content.document; })"),
- wrapCode("add_task(content => content.document)"),
- wrapCode("add_task(function(content) { content.document; })"),
- wrapCode("add_task(() => ContentTask.spawn(browser, null, () => content.document));")
- ],
- invalid: [
- invalidCode("let x = gBrowser.contentWindow;", "gBrowser.contentWindow"),
- invalidCode("let x = gBrowser.contentDocument;", "gBrowser.contentDocument"),
- invalidCode("let x = gBrowser.selectedBrowser.contentWindow;", "gBrowser.selectedBrowser.contentWindow"),
- invalidCode("let x = browser.contentDocument;", "browser.contentDocument"),
- invalidCode("let x = window.content;", "window.content"),
- invalidCode("content.document;", "content.document"),
- invalidCode("add_task(() => content.document.querySelectorAll())", "content.document.querySelectorAll"),
- invalidCode("let x = content;", "content", "Identifier"),
- invalidCode("let x = gBrowser.contentWindow.wrappedJSObject", "gBrowser.contentWindow.wrappedJSObject")
- ]
-});