Bug 1532934 - Enable ESLint for dom/url (manual changes). r=Standard8,baku

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
danielleleb 2019-03-12 22:00:01 +00:00
parent 65d7066adf
commit 85f131dba4
10 changed files with 42 additions and 27 deletions

View file

@ -204,7 +204,6 @@ dom/svg/**
dom/tests/html/**
dom/tests/mochitest/**
dom/u2f/**
dom/url/**
dom/vr/**
dom/webauthn/**
dom/webgpu/**

View file

@ -13,11 +13,11 @@ function test() {
function downloadOnLoad() {
domwindow.removeEventListener("load", downloadOnLoad, true);
is(domwindow.document.location.href, "chrome://mozapps/content/downloads/unknownContentType.xul", "Download page appeared");
is(domwindow.document.location.href, "chrome://mozapps/content/downloads/unknownContentType.xul", "Download page appeared");
domwindow.close();
domwindow.close();
gBrowser.removeTab(gBrowser.selectedTab);
finish();
finish();
}
var domwindow = aXULWindow.docShell.domWindow;

View file

@ -10,7 +10,7 @@ function checkFromJSM(ok, is) {
is(url2.href, "http://www.example.com/foobar", "JSM should have URL - based on another URL");
var blob = new Blob(["a"]);
var url = URL.createObjectURL(blob);
url = URL.createObjectURL(blob);
ok(url, "URL is created!");
var u = new URL(url);

View file

@ -1,15 +1,17 @@
/* eslint-env worker */
onmessage = function(event) {
if (event.data != 0) {
var worker = new Worker("jsm_url_worker.js");
worker.onmessage = function(event) {
postMessage(event.data);
worker.onmessage = function(ev) {
postMessage(ev.data);
};
worker.postMessage(event.data - 1);
return;
}
status = false;
let status = false;
try {
if ((URL instanceof Object)) {
status = true;
@ -49,7 +51,7 @@ onmessage = function(event) {
postMessage({type: "status", status, msg: "Blob Revoke URL"});
status = false;
var url = null;
url = null;
try {
url = URL.createObjectURL(true);
} catch (e) {
@ -59,7 +61,7 @@ onmessage = function(event) {
postMessage({type: "status", status, msg: "CreateObjectURL should fail if the arg is not a blob"});
status = false;
var url = null;
url = null;
try {
url = URL.createObjectURL(blob);
status = true;
@ -70,7 +72,7 @@ onmessage = function(event) {
status = false;
try {
URL.createObjectURL(new Object());
URL.createObjectURL({});
} catch (e) {
status = true;
}

View file

@ -292,7 +292,7 @@
if ("search" in test) is(url.search, test.search, "search");
if ("hash" in test) is(url.hash, test.hash, "hash");
if ("skip_setters" in test && test.skip_setters == false) {
if ("skip_setters" in test && test.skip_setters === false) {
info("Skip setter methods for URL: " + test);
continue;
}
@ -431,8 +431,8 @@
<script>
/** Test for Bug 1275746 **/
SimpleTest.doesThrow(() => { var url = new URL("http:"); }, "http: is not a valid URL");
SimpleTest.doesThrow(() => { var url = new URL("http:///"); }, "http: is not a valid URL");
SimpleTest.doesThrow(() => { new URL("http:"); }, "http: is not a valid URL");
SimpleTest.doesThrow(() => { new URL("http:///"); }, "http: is not a valid URL");
var url = new URL("file:");
is(url.href, "file:///", "Parsing file: should work.");

View file

@ -16,8 +16,10 @@ var base = new URL("data:text/plain,");
base.protocol = "chrome:";
is(base.protocol, "data:", "The protocol should not change from data to chrome.");
let relative;
try {
var relative = new URL("a", base);
relative = new URL("a", base);
ok(false, "Relative URL from a data:text/plain should not work.");
} catch (e) {
ok(true, "Relative URL from a data:text/plain should not work.");
@ -27,7 +29,7 @@ base.protocol = "http:";
ok(true, "Protocol: http changed");
is(base.href, "http://text/plain,", "Base URL is correct");
var relative = new URL("a", base);
relative = new URL("a", base);
ok(relative, "This works.");
is(relative.href, "http://text/a", "Relative URL is correct");

View file

@ -1,3 +1,6 @@
/* eslint-env worker */
function ok(a, msg) {
dump("OK: " + !!a + " => " + a + " " + msg + "\n");
postMessage({type: "status", status: !!a, msg: a + ": " + msg });
@ -8,8 +11,9 @@ function is(a, b, msg) {
postMessage({type: "status", status: a === b, msg: a + " === " + b + ": " + msg });
}
// eslint-disable-next-line complexity
onmessage = function() {
status = false;
let status = false;
try {
if ((URL instanceof Object)) {
status = true;
@ -17,6 +21,8 @@ onmessage = function() {
} catch (e) {
}
ok(status, "URL in workers \\o/");
var tests = [
{ url: "http://www.abc.com",
base: undefined,

View file

@ -1,3 +1,5 @@
/* import-globals-from urlSearchParams_worker.js */
function testSimpleURLSearchParams() {
var u = new URLSearchParams();
ok(u, "URLSearchParams created");
@ -92,7 +94,7 @@ function testParserURLSearchParams() {
var count = 0;
for (var key in checks[i].data) {
++count;
count = count + 1;
ok(u.has(key), "key " + key + " found");
var all = u.getAll(key);

View file

@ -1,3 +1,5 @@
/* eslint-env worker */
importScripts("urlSearchParams_commons.js");
function ok(a, msg) {
@ -30,7 +32,7 @@ function runTest() {
}
onmessage = function() {
status = false;
let status = false;
try {
if ((URLSearchParams instanceof Object)) {
status = true;

View file

@ -1,15 +1,17 @@
/* eslint-env worker */
onmessage = function(event) {
if (event.data != 0) {
var worker = new Worker("url_worker.js");
worker.onmessage = function(event) {
postMessage(event.data);
worker.onmessage = function(ev) {
postMessage(ev.data);
};
worker.postMessage(event.data - 1);
return;
}
status = false;
let status = false;
try {
if ((URL instanceof Object)) {
status = true;
@ -30,7 +32,7 @@ onmessage = function(event) {
postMessage({type: "status", status, msg: "Blob:" + blob});
status = false;
var url = null;
let url = null;
try {
url = URL.createObjectURL(blob);
status = true;
@ -49,7 +51,7 @@ onmessage = function(event) {
postMessage({type: "status", status, msg: "Blob Revoke URL"});
status = false;
var url = null;
url = null;
try {
url = URL.createObjectURL(true);
} catch (e) {
@ -59,7 +61,7 @@ onmessage = function(event) {
postMessage({type: "status", status, msg: "CreateObjectURL should fail if the arg is not a blob"});
status = false;
var url = null;
url = null;
try {
url = URL.createObjectURL(blob);
status = true;
@ -71,14 +73,14 @@ onmessage = function(event) {
status = false;
try {
URL.createObjectURL(new Object());
URL.createObjectURL({});
} catch (e) {
status = true;
}
postMessage({type: "status", status, msg: "Exception wanted" });
var blob = new Blob([123]);
blob = new Blob([123]);
var uri = URL.createObjectURL(blob);
postMessage({type: "status", status: !!uri,
msg: "The URI has been generated from the blob"});