Bug 1508983 - Enable ESLint for dom/base/test/chrome/ (manual changes) r=Standard8,smaug

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
mordax 2018-12-12 14:56:54 +00:00
parent e45d6338be
commit 632c7423fc
7 changed files with 25 additions and 19 deletions

View file

@ -169,8 +169,12 @@ devtools/server/tests/unit/xpcshell_debugging_script.js
dom/abort/**
dom/animation/**
dom/asmjscache/**
dom/base/**
dom/battery/**
dom/base/*.*
dom/base/test/*.*
dom/base/test/unit/test_serializers_entities*.js
dom/base/test/unit_ipc/**
dom/base/test/jsmodules/**
dom/bindings/**
dom/broadcastchannel/**
dom/browser-element/**

View file

@ -1,9 +1,9 @@
/* globals chromeWindow */
// The main test function.
var test = function(isContent) {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["security.allow_eval_with_system_principal",
true]]});
SpecialPowers.pushPrefEnv({"set": [["security.allow_eval_with_system_principal", true]]});
let { ww } = SpecialPowers.Services;
window.chromeWindow = ww.activeWindow;
@ -33,6 +33,7 @@ var test = function(isContent) {
// checkPair: tests if members of pair [a, b] are equal when evaluated.
let checkPair = function(a, b) {
// eslint-disable-next-line no-eval
is(eval(a), eval(b), a + " should be equal to " + b);
};

View file

@ -1,6 +1,8 @@
/* eslint-env mozilla/frame-script */
dump("loaded child cpow test\n");
Cu.importGlobalProperties(["XMLHttpRequest"]);
var is_remote;
(function start() {
[is_remote] = sendRpcMessage("cpows:is_remote");
@ -175,17 +177,16 @@ function compartment_test(finish) {
function testParentObject(obj) {
let results = [];
function is(a, b, msg) { results.push({ result: a === b ? "PASS" : "FAIL", message: msg }); }
function ok(x, msg) { results.push({ result: x ? "PASS" : "FAIL", message: msg }); }
function ok1(x, msg) { results.push({ result: x ? "PASS" : "FAIL", message: msg }); }
let cpowLocation = Cu.getRealmLocation(obj);
ok(/shared JSM global/.test(cpowLocation),
ok1(/shared JSM global/.test(cpowLocation),
"child->parent CPOWs should live in the privileged junk scope: " + cpowLocation);
is(obj(), 42, "child->parent CPOW is invokable");
try {
obj.expando;
ok(false, "child->parent CPOW cannot access properties");
ok1(false, "child->parent CPOW cannot access properties");
} catch (e) {
ok(true, "child->parent CPOW cannot access properties");
ok1(true, "child->parent CPOW cannot access properties");
}
return results;
@ -316,7 +317,7 @@ function cancel_test2(finish) {
req.open("get", "http://example.com", false);
req.send(null);
ok(fin == true, "XHR happened");
ok(fin === true, "XHR happened");
fin1 = true;
if (fin1 && fin2) finish();

View file

@ -1,3 +1,4 @@
/* globals finishTest */
class XFoo extends HTMLElement {
constructor() {
super();

View file

@ -23,6 +23,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1339722
ChromeUtils.import("resource://gre/modules/Services.jsm");
const TOPIC = "http-on-useragent-request";
let win;
Services.obs.addObserver({
observe(subject, topic, data) {
info("Got " + topic);
@ -30,13 +31,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1339722
// Query window proxy so it triggers DOMWindowCreated.
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
let win = channel.notificationCallbacks.getInterface(Ci.mozIDOMWindowProxy);
win = channel.notificationCallbacks.getInterface(Ci.mozIDOMWindowProxy);
},
}, TOPIC);
let docShell = SpecialPowers.wrap(window).docShell;
docShell.chromeEventHandler.addEventListener("DOMWindowCreated", function handler(e) {
docShell.chromeEventHandler.removeEventListener("DOMWindowCreated", handler);
let iframe = document.getElementById("testFrame");
is(e.target, iframe.contentDocument, "verify event target");
@ -46,7 +46,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1339722
ok(!document.getElementById("testFrame"), "verify iframe removed");
SimpleTest.finish();
}, 0);
});
}, {once: true});
SimpleTest.waitForExplicitFinish();
</script>

View file

@ -27,8 +27,7 @@ SimpleTest.waitForExplicitFinish();
*/
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var ios = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
var contentSecManager = Cc["@mozilla.org/contentsecuritymanager;1"]
.getService(Ci.nsIContentSecurityManager);
@ -36,7 +35,7 @@ var PROTOCOL_SCHEME = "jsproto";
function CustomChannel(uri, loadInfo) {
this.URI = this.originalURI = uri;
this.URI = this.originalURI = uri;
this.loadInfo = loadInfo;
}
CustomChannel.prototype = {
@ -123,7 +122,7 @@ CustomProtocol.prototype = {
return new CustomChannel(URI, loadInfo);
},
newChannel: function newChannel(URI) {
return newChannel2(URI);
return this.newChannel2(URI);
},
QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIProtocolHandler]),
};

View file

@ -16,15 +16,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650776
</div>
<pre id="test">
<script type="application/javascript">
ChromeUtils.import("resource://gre/modules/Services.jsm");
function createFileWithData(fileData) {
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
var testFile = dirSvc.get("ProfD", Ci.nsIFile);
var testFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
testFile.append("testBug914381");
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);
0o666, 0);
outStream.write(fileData, fileData.length);
outStream.close();