Bug 1508823 - Enable ESLint for dom/browser-element (manual changes). r=mccr8

Depends on D21215

Differential Revision: https://phabricator.services.mozilla.com/D14130

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jagmeet Bhamber 2019-03-19 20:56:24 +00:00
parent e29933c06a
commit e15a06b5ac
66 changed files with 207 additions and 102 deletions

View file

@ -167,7 +167,6 @@ dom/base/test/unit/test_serializers_entities*.js
dom/base/test/unit_ipc/**
dom/base/test/jsmodules/**
dom/bindings/**
dom/browser-element/**
dom/canvas/**
dom/encoding/**
dom/events/**

View file

@ -2,6 +2,9 @@
* 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/. */
/* eslint-env mozilla/frame-script */
/* global api, CopyPasteAssistent */
"use strict";
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");

View file

@ -4,6 +4,8 @@
"use strict";
/* eslint-env mozilla/frame-script */
function debug(msg) {
// dump("BrowserElementChildPreload - " + msg + "\n");
}
@ -40,7 +42,7 @@ function sendSyncMsg(msg, data) {
// Ensure that we don't send any messages before BrowserElementChild.js
// finishes loading.
if (!BrowserElementIsReady) {
return;
return undefined;
}
if (!data) {
@ -160,10 +162,8 @@ BrowserElementChild.prototype = {
addMessageListener("browser-element-api:call", this);
let els = Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService);
LISTENED_SYSTEM_EVENTS.forEach(event => {
els.addSystemEventListener(global, event.type, this, event.useCapture);
Services.els.addSystemEventListener(global, event.type, this, event.useCapture);
});
OBSERVED_EVENTS.forEach((aTopic) => {
@ -192,10 +192,8 @@ BrowserElementChild.prototype = {
removeMessageListener("browser-element-api:call", this);
let els = Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService);
LISTENED_SYSTEM_EVENTS.forEach(event => {
els.removeSystemEventListener(global, event.type, this, event.useCapture);
Services.els.removeSystemEventListener(global, event.type, this, event.useCapture);
});
OBSERVED_EVENTS.forEach((aTopic) => {
@ -281,6 +279,7 @@ BrowserElementChild.prototype = {
if (message.data.msg_name in mmCalls) {
return mmCalls[message.data.msg_name].apply(self, arguments);
}
return undefined;
},
_paintFrozenTimer: null,
@ -363,6 +362,7 @@ BrowserElementChild.prototype = {
args.promptType == "custom-prompt") {
return returnValue;
}
return undefined;
},
/**
@ -379,7 +379,7 @@ BrowserElementChild.prototype = {
// I have no idea what waiting for a result means when there's no inner
// window, so let's just bail.
debug("_waitForResult: No inner window. Bailing.");
return;
return undefined;
}
this._windowIDDict[outerWindowID] = Cu.getWeakReference(win);
@ -902,7 +902,7 @@ BrowserElementChild.prototype = {
if (menu) {
this._maybeCopyAttribute(menu, menuObj, "label");
for (var i = 0, child; child = menu.children[i++];) {
for (var i = 0, child; (child = menu.children[i++]);) {
if (child.nodeName === "MENU") {
menuObj.items.push(this._buildMenuObj(child, idPrefix + i + "_", false));
} else if (child.nodeName === "MENUITEM") {
@ -1026,8 +1026,7 @@ BrowserElementChild.prototype = {
}
// Remove password from uri.
location = Cc["@mozilla.org/docshell/urifixup;1"]
.getService(Ci.nsIURIFixup).createExposableURI(location);
location = Services.uriFixup.createExposableURI(location);
var webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
@ -1036,6 +1035,7 @@ BrowserElementChild.prototype = {
canGoForward: webNav.canGoForward });
},
// eslint-disable-next-line complexity
onStateChange(webProgress, request, stateFlags, status) {
if (webProgress != docShell) {
return;

View file

@ -6,6 +6,14 @@
"use strict";
/*
global addMessageListener
global removeMessageListener
global docShell
global content
global sendAsyncMsg
*/
function debug(msg) {
// dump("BrowserElementCopyPaste - " + msg + "\n");
}
@ -71,7 +79,7 @@ var CopyPasteAssistent = {
e.stopPropagation();
let boundingClientRect = e.boundingClientRect;
let canPaste = this._isCommandEnabled("paste");
this._isCommandEnabled("paste");
let zoomFactor = content.innerWidth == 0 ? 1 : content.screen.width / content.innerWidth;
let detail = {

View file

@ -16,14 +16,6 @@ function debug(msg) {
// dump("BrowserElementParent - " + msg + "\n");
}
function getIntPref(prefName, def) {
try {
return Services.prefs.getIntPref(prefName);
} catch (err) {
return def;
}
}
function handleWindowEvent(e) {
if (this._browserElementParents) {
let beps = ChromeUtils.nondeterministicGetWeakMapKeys(this._browserElementParents);
@ -96,11 +88,9 @@ BrowserElementParent.prototype = {
this._window._browserElementParents = new WeakMap();
let handler = handleWindowEvent.bind(this._window);
let windowEvents = ["visibilitychange", "fullscreenchange"];
let els = Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService);
for (let event of windowEvents) {
els.addSystemEventListener(this._window, event, handler,
/* useCapture = */ true);
Services.els.addSystemEventListener(this._window, event, handler,
/* useCapture = */ true);
}
}
@ -138,7 +128,7 @@ BrowserElementParent.prototype = {
receiveMessage(aMsg) {
if (!this._isAlive()) {
return;
return undefined;
}
// Messages we receive are handed to functions which take a (data) argument,
@ -184,6 +174,7 @@ BrowserElementParent.prototype = {
} else if (aMsg.data.msg_name in mmSecuritySensitiveCalls) {
return mmSecuritySensitiveCalls[aMsg.data.msg_name].apply(this, arguments);
}
return undefined;
},
_removeMessageListener() {
@ -210,7 +201,6 @@ BrowserElementParent.prototype = {
promptAuth(authDetail, callback) {
let evt;
let self = this;
let callbackCalled = false;
let cancelCallback = function() {
if (!callbackCalled) {

View file

@ -294,8 +294,6 @@ BrowserElementAuthPrompt.prototype = {
return;
let prompt = this._asyncPrompts[hashKey];
let [hostname, httpRealm] = this._getAuthTarget(prompt.channel,
prompt.authInfo);
this._asyncPromptInProgress.set(prompt.browserElementParent, true);
prompt.inProgress = true;
@ -570,16 +568,14 @@ var BrowserElementPromptService = {
// If the pref is disabled, do nothing except wait for the pref to change.
if (!this._browserFramesPrefEnabled()) {
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
prefs.addObserver(BROWSER_FRAMES_ENABLED_PREF, this, /* ownsWeak = */ true);
Services.prefs.addObserver(BROWSER_FRAMES_ENABLED_PREF, this, /* ownsWeak = */ true);
return;
}
this._initialized = true;
this._browserElementParentMap = new WeakMap();
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
os.addObserver(this, "outer-window-destroyed", /* ownsWeak = */ true);
Services.obs.addObserver(this, "outer-window-destroyed", /* ownsWeak = */ true);
// Wrap the existing @mozilla.org/prompter;1 implementation.
var contractID = "@mozilla.org/prompter;1";
@ -644,12 +640,7 @@ var BrowserElementPromptService = {
},
_browserFramesPrefEnabled() {
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
try {
return prefs.getBoolPref(BROWSER_FRAMES_ENABLED_PREF);
} catch (e) {
return false;
}
return Services.prefs.getBoolPref(BROWSER_FRAMES_ENABLED_PREF, false);
},
observe(subject, topic, data) {

View file

@ -69,7 +69,7 @@
}
).catch(err => reject(err));
}
step(gen.next(value));
return step(gen.next(value));
}
});
};

View file

@ -4,6 +4,8 @@
// Test that alert works.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Test that alert works from inside an <iframe> inside an <iframe mozbrowser>.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Test that auth prompt works.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -37,9 +39,9 @@ function testHttpAuthCancel(e) {
// Will cancel authentication, but prompt should not be shown again. Instead,
// we will be led to fail message
iframe.addEventListener("mozbrowserusernameandpasswordrequired", testFail);
iframe.addEventListener("mozbrowsertitlechange", function(e) {
iframe.addEventListener("mozbrowsertitlechange", function(f) {
iframe.removeEventListener("mozbrowserusernameandpasswordrequired", testFail);
is(e.detail, "http auth failed", "expected authentication to fail");
is(f.detail, "http auth failed", "expected authentication to fail");
iframe.addEventListener("mozbrowserusernameandpasswordrequired", testHttpAuth);
SimpleTest.executeSoon(function() {
// Use absolute path because we need to specify host.
@ -65,9 +67,9 @@ function testHttpAuth(e) {
// Will authenticate with correct password, prompt should not be
// called again.
iframe.addEventListener("mozbrowserusernameandpasswordrequired", testFail);
iframe.addEventListener("mozbrowsertitlechange", function(e) {
iframe.addEventListener("mozbrowsertitlechange", function(f) {
iframe.removeEventListener("mozbrowserusernameandpasswordrequired", testFail);
is(e.detail, "http auth success", "expect authentication to succeed");
is(f.detail, "http auth success", "expect authentication to succeed");
SimpleTest.executeSoon(testProxyAuth);
}, {once: true});
@ -84,7 +86,7 @@ function testHttpAuth(e) {
});
}
function testProxyAuth(e) {
function testProxyAuth() {
// The testingSJS simulates the 407 proxy authentication required response
// for proxy server, which will trigger the browser element to send prompt
// event with proxy infomation.
@ -94,9 +96,9 @@ function testProxyAuth(e) {
function onUserNameAndPasswordRequired(e) {
iframe.removeEventListener("mozbrowserusernameandpasswordrequired",
onUserNameAndPasswordRequired);
iframe.addEventListener("mozbrowsertitlechange", function(e) {
iframe.addEventListener("mozbrowsertitlechange", function(event) {
iframe.removeEventListener("mozbrowserusernameandpasswordrequired", testFail);
is(e.detail, "http auth success", "expect authentication to succeed");
is(event.detail, "http auth success", "expect authentication to succeed");
SimpleTest.executeSoon(testAuthJarNoInterfere);
}, {once: true});
@ -149,12 +151,10 @@ function testProxyAuth(e) {
}
function testAuthJarNoInterfere(e) {
var authMgr = SpecialPowers.Cc["@mozilla.org/network/http-auth-manager;1"]
let authMgr = SpecialPowers.Cc["@mozilla.org/network/http-auth-manager;1"]
.getService(SpecialPowers.Ci.nsIHttpAuthManager);
var secMan = SpecialPowers.Cc["@mozilla.org/scriptsecuritymanager;1"]
.getService(SpecialPowers.Ci.nsIScriptSecurityManager);
var ioService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
.getService(SpecialPowers.Ci.nsIIOService);
let secMan = SpecialPowers.Services.scriptSecurityManager;
let ioService = SpecialPowers.Services.io;
var uri = ioService.newURI("http://test/tests/dom/browser-element/mochitest/file_http_401_response.sjs");
// Set a bunch of auth data that should not conflict with the correct auth data already
@ -177,9 +177,9 @@ function testAuthJarNoInterfere(e) {
// Will authenticate with correct password, prompt should not be
// called again.
iframe.addEventListener("mozbrowserusernameandpasswordrequired", testFail);
iframe.addEventListener("mozbrowsertitlechange", function(e) {
iframe.addEventListener("mozbrowsertitlechange", function(f) {
iframe.removeEventListener("mozbrowserusernameandpasswordrequired", testFail);
is(e.detail, "http auth success", "expected authentication success");
is(f.detail, "http auth success", "expected authentication success");
SimpleTest.executeSoon(testAuthJarInterfere);
}, {once: true});
@ -189,12 +189,10 @@ function testAuthJarNoInterfere(e) {
}
function testAuthJarInterfere(e) {
var authMgr = SpecialPowers.Cc["@mozilla.org/network/http-auth-manager;1"]
let authMgr = SpecialPowers.Cc["@mozilla.org/network/http-auth-manager;1"]
.getService(SpecialPowers.Ci.nsIHttpAuthManager);
var secMan = SpecialPowers.Cc["@mozilla.org/scriptsecuritymanager;1"]
.getService(SpecialPowers.Ci.nsIScriptSecurityManager);
var ioService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
.getService(SpecialPowers.Ci.nsIIOService);
let secMan = SpecialPowers.Services.scriptSecurityManager;
let ioService = SpecialPowers.Services.io;
var uri = ioService.newURI("http://test/tests/dom/browser-element/mochitest/file_http_401_response.sjs");
// Set some auth data that should overwrite the successful stored details.
@ -211,7 +209,7 @@ function testAuthJarInterfere(e) {
}
iframe.addEventListener("mozbrowserusernameandpasswordrequired",
onUserNameAndPasswordRequired);
iframe.addEventListener("mozbrowsertitlechange", function(e) {
iframe.addEventListener("mozbrowsertitlechange", function(f) {
iframe.removeEventListener("mozbrowserusernameandpasswordrequired",
onUserNameAndPasswordRequired);
ok(gotusernamepasswordrequired,
@ -226,13 +224,11 @@ function testAuthJarInterfere(e) {
function testFinish() {
// Clear login information stored in password manager.
var authMgr = SpecialPowers.Cc["@mozilla.org/network/http-auth-manager;1"]
let authMgr = SpecialPowers.Cc["@mozilla.org/network/http-auth-manager;1"]
.getService(SpecialPowers.Ci.nsIHttpAuthManager);
authMgr.clearAll();
var pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"]
.getService(SpecialPowers.Ci.nsILoginManager);
pwmgr.removeAllLogins();
SpecialPowers.Services.logins.removeAllLogins();
SimpleTest.finish();
}

View file

@ -5,6 +5,9 @@
// <iframe mozbrowser>.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);

View file

@ -7,6 +7,8 @@
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -23,12 +25,12 @@ function runTest() {
ok(true, "Got first mozbrowseropenwindow event.");
document.body.appendChild(e.detail.frameElement);
e.detail.frameElement.addEventListener("mozbrowserlocationchange", function(e) {
if (e.detail.url == "http://example.com/#2") {
e.detail.frameElement.addEventListener("mozbrowserlocationchange", function(f) {
if (f.detail.url == "http://example.com/#2") {
ok(true, "Got locationchange to http://example.com/#2");
SimpleTest.finish();
} else {
ok(true, "Got locationchange to " + e.detail.url);
ok(true, "Got locationchange to " + f.detail.url);
}
});
@ -40,7 +42,7 @@ function runTest() {
SpecialPowers.wrap(iframe2).presetOpenerWindow(iframe1.contentWindow);
iframe2.setAttribute("mozbrowser", "true");
iframe2.addEventListener("mozbrowseropenwindow", function(e) {
iframe2.addEventListener("mozbrowseropenwindow", function(f) {
ok(false, "Got second mozbrowseropenwindow event.");
});

View file

@ -4,6 +4,8 @@
// Bug 891763 - Test the mozbrowserresize event
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Test that window.close() works.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -19,7 +21,7 @@ function runTest() {
SimpleTest.finish();
});
iframe.src = "data:text/html,<html><body><script>window.close()</scr" + "ipt></body></html>";
iframe.src = "data:text/html,<html><body><script>window.close()</script></body></html>";
}
addEventListener("testready", runTest);

View file

@ -4,6 +4,8 @@
// Bug 764718 - Test that window.close() works from the opener window.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -16,7 +18,7 @@ function runTest() {
ok(true, "got openwindow event.");
document.body.appendChild(e.detail.frameElement);
e.detail.frameElement.addEventListener("mozbrowserclose", function(e) {
e.detail.frameElement.addEventListener("mozbrowserclose", function(f) {
ok(true, "got mozbrowserclose event.");
SimpleTest.finish();
});

View file

@ -1,5 +1,8 @@
"use strict";
/* global browserElementTestHelpers */
/* eslint-env mozilla/frame-script */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.setClipboardPlainTextOnlyPref(false);

View file

@ -5,6 +5,8 @@
// third-party.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,13 +4,14 @@
// Test that "cut, copy, paste, selectall" and caretstatechanged event works from inside an <iframe mozbrowser>.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.setupAccessibleCaretPref();
browserElementTestHelpers.addPermission();
browserElementTestHelpers.allowTopLevelDataURINavigation();
const { Services } = SpecialPowers.Cu.import("resource://gre/modules/Services.jsm");
var gTextarea = null;
var mm;
@ -72,9 +73,9 @@ function runTest() {
iframeInner.setAttribute("mozbrowser", true);
iframeInner.setAttribute("remote", "false");
contentDoc.body.appendChild(iframeInner);
iframeInner.addEventListener("mozbrowserloadend", function(e) {
iframeInner.addEventListener("mozbrowserloadend", function(f) {
mm = SpecialPowers.getBrowserFrameMessageManager(iframeInner);
dispatchTest(e);
dispatchTest(f);
}, {once: true});
} else {
iframeInner = iframeOuter;
@ -96,9 +97,9 @@ function doCommand(cmd) {
}
function dispatchTest(e) {
iframeInner.addEventListener("mozbrowserloadend", function(e) {
iframeInner.addEventListener("mozbrowserloadend", function(f) {
iframeInner.focus();
SimpleTest.executeSoon(function() { testSelectAll(e); });
SimpleTest.executeSoon(function() { testSelectAll(f); });
}, {once: true});
switch (state) {
@ -180,21 +181,20 @@ function dispatchTest(e) {
}
function isChildProcess() {
return SpecialPowers.Cc["@mozilla.org/xre/app-info;1"]
.getService(SpecialPowers.Ci.nsIXULRuntime)
.processType != SpecialPowers.Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
return SpecialPowers.Services.appinfo
.processType != SpecialPowers.Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
}
function testSelectAll(e) {
// Skip mozbrowser test if we're at child process.
if (!isChildProcess()) {
let eventName = "mozbrowsercaretstatechanged";
iframeOuter.addEventListener(eventName, function(e) {
iframeOuter.addEventListener(eventName, function(f) {
ok(true, "got mozbrowsercaretstatechanged event." + stateMeaning);
ok(e.detail, "event.detail is not null." + stateMeaning);
ok(e.detail.width != 0, "event.detail.width is not zero" + stateMeaning);
ok(e.detail.height != 0, "event.detail.height is not zero" + stateMeaning);
SimpleTest.executeSoon(function() { testCopy1(e); });
ok(f.detail, "event.detail is not null." + stateMeaning);
ok(f.detail.width != 0, "event.detail.width is not zero" + stateMeaning);
ok(f.detail.height != 0, "event.detail.height is not zero" + stateMeaning);
SimpleTest.executeSoon(function() { testCopy1(f); });
}, {capture: true, once: true});
}
@ -336,4 +336,3 @@ addEventListener("testready", function() {
{type: "browser", allow: 1, context},
], runTest);
});

View file

@ -4,6 +4,9 @@
// Test that data: URIs work with mozbrowserlocationchange events.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -2,6 +2,9 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("testing mozbrowser data: navigation is blocked");

View file

@ -4,6 +4,8 @@
// Bug 829486 - Add mozdocumentbrowserfirstpaint event.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);

View file

@ -5,6 +5,8 @@
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -5,6 +5,9 @@
// "unexposable" parts before sending them in the locationchange event.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Bug 787378 - Add mozbrowserfirstpaint event.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -6,6 +6,8 @@
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,9 @@
// Bug 804446 - Test that window.open(javascript:..) works with <iframe mozbrowser>.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Test that the onmozbrowsericonchange event works.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -5,6 +5,9 @@
// events when this page is in the whitelist.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Test that the onmozbrowsermetachange event works.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -5,6 +5,9 @@
// with the same name, we get only one mozbrowseropenwindow event.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -23,9 +26,9 @@ function runTest() {
is(popupFrame.getAttribute("name"), "OpenNamed");
// Called when file_browserElement_OpenNamed2.html loads into popupFrame.
popupFrame.addEventListener("mozbrowsershowmodalprompt", function(e) {
popupFrame.addEventListener("mozbrowsershowmodalprompt", function(f) {
ok(gotPopup, "Got openwindow event before showmodalprompt event.");
is(e.detail.message, "success: loaded");
is(f.detail.message, "success: loaded");
SimpleTest.executeSoon(test2);
}, {once: true});

View file

@ -4,6 +4,9 @@
// Bug 1144015 - test middle/ctrl/cmd-click on a link.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,9 @@
// Bug 742944 - Test that window.open works with <iframe mozbrowser>.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,9 @@
// Bug 769182 - window.open to a different origin should load the page.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -15,12 +18,12 @@ function runTest() {
iframe.addEventListener("mozbrowseropenwindow", function(e) {
ok(true, "Got first window.open call");
e.detail.frameElement.addEventListener("mozbrowseropenwindow", function(e) {
e.detail.frameElement.addEventListener("mozbrowseropenwindow", function(f) {
ok(true, "Got second window.open call");
document.body.appendChild(e.detail.frameElement);
document.body.appendChild(f.detail.frameElement);
});
e.detail.frameElement.addEventListener("mozbrowsershowmodalprompt", function(e) {
e.detail.frameElement.addEventListener("mozbrowsershowmodalprompt", function(f) {
ok(true, "Got alert from second window.");
SimpleTest.finish();
});

View file

@ -5,6 +5,9 @@
// about:blank as default
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -10,6 +10,9 @@
// an iframe.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -5,6 +5,9 @@
// reject the call. This shouldn't cause problems (crashes, leaks).
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -9,6 +9,9 @@
// preventDefault() on the event.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Test that the onmozbrowseropensearch event works.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Test that the mozprivatebrowsing attribute works.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -10,6 +10,8 @@
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -37,6 +39,7 @@ function runTest() {
}
});
/* eslint-disable no-useless-concat */
iframe.src =
'data:text/html,<html><body><script>\
addEventListener("load", function() { \
@ -48,6 +51,7 @@ function runTest() {
}); \
}); \
</scr' + "ipt></body></html>";
/* eslint-enable no-useless-concat */
}
// The test harness sets dom.successive_dialog_time_limit to 0 for some bizarre

View file

@ -8,6 +8,8 @@
// ourselves.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -68,6 +70,7 @@ function runTest() {
}
});
/* eslint-disable no-useless-concat */
iframe.src =
'data:text/html,<html><body><script>\
function sendVal(val) { \
@ -81,6 +84,7 @@ function runTest() {
sendVal(prompt("6", "initial")); \
sendVal(prompt("7", "initial")); \
</scr' + "ipt></body></html>";
/* eslint-enable no-useless-concat */
}
addEventListener("testready", runTest);

View file

@ -4,6 +4,10 @@
// Bug 741717 - Test the reload ability of <iframe mozbrowser>.
"use strict";
/* global browserElementTestHelpers */
/* eslint-env mozilla/frame-script */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -5,6 +5,9 @@
// POST respest.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
browserElementTestHelpers.setEnabledPref(true);
@ -17,10 +20,8 @@ var isPostRequestSubmitted;
function getExpectedStrings() {
let result = {};
let bundleService = SpecialPowers.Cc["@mozilla.org/intl/stringbundle;1"].
getService(SpecialPowers.Ci.nsIStringBundleService);
let appBundle = bundleService.createBundle("chrome://global/locale/appstrings.properties");
let brandBundle = bundleService.createBundle("chrome://branding/locale/brand.properties");
let appBundle = Services.strings.createBundle("chrome://global/locale/appstrings.properties");
let brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
try {
let brandName = brandBundle.GetStringFromName("brandShortName");
result.message = appBundle.formatStringFromName("confirmRepostPrompt",

View file

@ -6,6 +6,8 @@
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Test that scroll event bubbles up.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -5,6 +5,9 @@
// mozbrowsersecuritychange events.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -55,4 +58,3 @@ addEventListener("testready", function() {
["browser.safebrowsing.malware.enabled", false],
]}, runTest);
});

View file

@ -4,6 +4,8 @@
// Test that sendMouseEvent dispatch events.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);

View file

@ -9,6 +9,9 @@
// image load will be cancaelled and mozbrowserloadend should be called.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
browserElementTestHelpers.setEnabledPref(true);

View file

@ -5,6 +5,8 @@
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -5,6 +5,8 @@
// mozbrowser>.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Test that the onmozbrowsermetachange event for theme-color works.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -82,4 +84,3 @@ function runTest() {
}
window.addEventListener("testready", runTest);

View file

@ -4,6 +4,8 @@
// Test that the onmozbrowsertitlechange event works.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Test that an <iframe mozbrowser> is a window.{top,parent,frameElement} barrier.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Test that the onmozbrowsermetachange event for viewmode works.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -68,4 +70,3 @@ function runTest() {
}
window.addEventListener("testready", runTest);

View file

@ -5,6 +5,8 @@
// <iframe mozbrowser>.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -4,6 +4,8 @@
// Bug 690168 - Support Allow-From notation for X-Frame-Options header.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
@ -27,8 +29,6 @@ function arrayBuffersEqual(a, b) {
}
function runTest() {
var count = 0;
var iframe = document.createElement("iframe");
iframe.setAttribute("mozbrowser", "true");
iframe.height = "1000px";

View file

@ -5,6 +5,8 @@
// subframe of <iframe mozbrowser>.
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -7,6 +7,8 @@
"use strict";
/* global browserElementTestHelpers */
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

View file

@ -1,5 +1,6 @@
<script>
function testSucceeded() { alert("success"); }
// eslint-disable-next-line no-useless-concat
function callback() { return "<script>opener.testSucceeded()</" + "script>"; }
var w = window.open("javascript:opener.callback();");
</script>

View file

@ -7,6 +7,7 @@
Aloha! My URL is <span id='url'></span>.
<script>
// eslint-disable-next-line no-unsanitized/property
document.getElementById("url").innerHTML = window.location;
</script>

View file

@ -10,6 +10,7 @@ if (location.search == "?1") {
alert("finish");
}
// eslint-disable-next-line no-unsanitized/property
document.getElementById("name").innerHTML = location.search;
</script>

View file

@ -6,6 +6,7 @@
if (location.search == "") {
window.open("file_browserElement_TargetTop.html?2", "_top");
}
// eslint-disable-next-line no-unsanitized/property
document.getElementById("url").innerHTML = document.location.href;
</script>
</body>

View file

@ -23,9 +23,7 @@ document.body.appendChild(iframe1);
iframe1.addEventListener("load", function() {
// This causes our embedder to take a screenshot (and blocks until the
// screenshot is completed).
var iframe2Loaded = false;
iframe2.addEventListener("load", function() {
iframe2Loaded = true;
alert("finish");
}, {once: true});

View file

@ -7,6 +7,7 @@
Aloha! My URL is <span id='url'></span>.
<script>
// eslint-disable-next-line no-unsanitized/property
document.getElementById("url").innerHTML = window.location;
</script>

View file

@ -3,6 +3,7 @@
Aloha! My URL is <span id='url'></span>.
<script>
// eslint-disable-next-line no-unsanitized/property
document.getElementById("url").innerHTML = window.location;
</script>
@ -13,8 +14,7 @@ document.getElementById("url").innerHTML = window.location;
var alreadyBlocked = false;
addEventListener("keydown", function(e) {
if (e.keyCode == KeyboardEvent.DOM_VK_ESCAPE &&
alreadyBlocked == false) {
if (e.keyCode == KeyboardEvent.DOM_VK_ESCAPE && !alreadyBlocked) {
alreadyBlocked = true;
e.preventDefault();
}

View file

@ -10,6 +10,7 @@ module.exports = {
"globals": {
// SpecialPowers is injected into the window object via SimpleTest.js
"SpecialPowers": false,
"XPCNativeWrapper": false,
},
"overrides": [{