mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1876988 - Enable remaining ESLint rules on dom/file/ipc. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D199813
This commit is contained in:
parent
2cdfd413a4
commit
30b1ef027d
@ -432,7 +432,6 @@ module.exports = {
|
||||
"dom/canvas/test/**",
|
||||
"dom/events/test/**",
|
||||
"dom/fetch/tests/**",
|
||||
"dom/file/ipc/tests/**",
|
||||
"dom/file/tests/**",
|
||||
"dom/html/test/**",
|
||||
"dom/jsurl/test/**",
|
||||
|
@ -10,8 +10,8 @@ add_task(async function test_CtoPtoC_big() {
|
||||
let browser1 = gBrowser.getBrowserForTab(tab1);
|
||||
|
||||
let blob = await SpecialPowers.spawn(browser1, [], function () {
|
||||
let blob = new Blob([new Array(1024 * 1024).join("123456789ABCDEF")]);
|
||||
return blob;
|
||||
let innerBlob = new Blob([new Array(1024 * 1024).join("123456789ABCDEF")]);
|
||||
return innerBlob;
|
||||
});
|
||||
|
||||
ok(blob, "CtoPtoC-big: We have a blob!");
|
||||
@ -24,15 +24,19 @@ add_task(async function test_CtoPtoC_big() {
|
||||
let tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, BASE_URI);
|
||||
let browser2 = gBrowser.getBrowserForTab(tab2);
|
||||
|
||||
let status = await SpecialPowers.spawn(browser2, [blob], function (blob) {
|
||||
return new Promise(resolve => {
|
||||
let fr = new content.FileReader();
|
||||
fr.readAsText(blob);
|
||||
fr.onloadend = function () {
|
||||
resolve(fr.result == new Array(1024 * 1024).join("123456789ABCDEF"));
|
||||
};
|
||||
});
|
||||
});
|
||||
let status = await SpecialPowers.spawn(
|
||||
browser2,
|
||||
[blob],
|
||||
function (innerBlob) {
|
||||
return new Promise(resolve => {
|
||||
let fr = new content.FileReader();
|
||||
fr.readAsText(innerBlob);
|
||||
fr.onloadend = function () {
|
||||
resolve(fr.result == new Array(1024 * 1024).join("123456789ABCDEF"));
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
ok(status, "CtoPtoC-big: Data match!");
|
||||
|
||||
@ -46,8 +50,8 @@ add_task(async function test_CtoPtoC_small() {
|
||||
let browser1 = gBrowser.getBrowserForTab(tab1);
|
||||
|
||||
let blob = await SpecialPowers.spawn(browser1, [], function () {
|
||||
let blob = new Blob(["hello world!"]);
|
||||
return blob;
|
||||
let innerBlob = new Blob(["hello world!"]);
|
||||
return innerBlob;
|
||||
});
|
||||
|
||||
ok(blob, "CtoPtoC-small: We have a blob!");
|
||||
@ -56,15 +60,19 @@ add_task(async function test_CtoPtoC_small() {
|
||||
let tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, BASE_URI);
|
||||
let browser2 = gBrowser.getBrowserForTab(tab2);
|
||||
|
||||
let status = await SpecialPowers.spawn(browser2, [blob], function (blob) {
|
||||
return new Promise(resolve => {
|
||||
let fr = new content.FileReader();
|
||||
fr.readAsText(blob);
|
||||
fr.onloadend = function () {
|
||||
resolve(fr.result == "hello world!");
|
||||
};
|
||||
});
|
||||
});
|
||||
let status = await SpecialPowers.spawn(
|
||||
browser2,
|
||||
[blob],
|
||||
function (innerBlob) {
|
||||
return new Promise(resolve => {
|
||||
let fr = new content.FileReader();
|
||||
fr.readAsText(innerBlob);
|
||||
fr.onloadend = function () {
|
||||
resolve(fr.result == "hello world!");
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
ok(status, "CtoPtoC-small: Data match!");
|
||||
|
||||
@ -161,10 +169,10 @@ add_task(async function test_CtoPtoC_bc_small() {
|
||||
let status = await SpecialPowers.spawn(
|
||||
browser2,
|
||||
[blobURL],
|
||||
function (blobURL) {
|
||||
function (innerBlobURL) {
|
||||
return new Promise(resolve => {
|
||||
var xhr = new content.XMLHttpRequest();
|
||||
xhr.open("GET", blobURL);
|
||||
xhr.open("GET", innerBlobURL);
|
||||
xhr.onloadend = function () {
|
||||
resolve(xhr.response == "hello world!");
|
||||
};
|
||||
@ -197,15 +205,19 @@ add_task(async function test_CtoPtoC_multipart() {
|
||||
let tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, BASE_URI);
|
||||
let browser2 = gBrowser.getBrowserForTab(tab2);
|
||||
|
||||
let status = await SpecialPowers.spawn(browser2, [newBlob], function (blob) {
|
||||
return new Promise(resolve => {
|
||||
let fr = new content.FileReader();
|
||||
fr.readAsText(new Blob(["hello ", blob]));
|
||||
fr.onloadend = function () {
|
||||
resolve(fr.result == "hello world!");
|
||||
};
|
||||
});
|
||||
});
|
||||
let status = await SpecialPowers.spawn(
|
||||
browser2,
|
||||
[newBlob],
|
||||
function (innerBlob) {
|
||||
return new Promise(resolve => {
|
||||
let fr = new content.FileReader();
|
||||
fr.readAsText(new Blob(["hello ", innerBlob]));
|
||||
fr.onloadend = function () {
|
||||
resolve(fr.result == "hello world!");
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
ok(status, "CtoPtoC-multipart: Data match!");
|
||||
|
||||
|
@ -23,7 +23,7 @@ add_task(async function test() {
|
||||
let bc = new content.window.BroadcastChannel("foobar");
|
||||
bc.onmessage = e => {
|
||||
function realTest() {
|
||||
return new content.window.Promise(resolve => {
|
||||
return new content.window.Promise(innerResolve => {
|
||||
let count = 10;
|
||||
for (let i = 0; i < count; ++i) {
|
||||
info("FileReader at the same time: " + i);
|
||||
@ -36,7 +36,7 @@ add_task(async function test() {
|
||||
fr.onloadend = () => {
|
||||
is(fr.result.length, e.data.size, "FileReader worked fine.");
|
||||
if (!--count) {
|
||||
resolve(true);
|
||||
innerResolve(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -4,8 +4,7 @@
|
||||
Cu.importGlobalProperties(["File"]);
|
||||
|
||||
addMessageListener("file.open", function (e) {
|
||||
var testFile = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIDirectoryService)
|
||||
var testFile = Services.dirsvc
|
||||
.QueryInterface(Ci.nsIProperties)
|
||||
.get("ProfD", Ci.nsIFile);
|
||||
testFile.append("ipc_fileReader_testing");
|
||||
@ -31,8 +30,7 @@ addMessageListener("file.open", function (e) {
|
||||
});
|
||||
|
||||
addMessageListener("emptyfile.open", function (e) {
|
||||
var testFile = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIDirectoryService)
|
||||
var testFile = Services.dirsvc
|
||||
.QueryInterface(Ci.nsIProperties)
|
||||
.get("ProfD", Ci.nsIFile);
|
||||
testFile.append("ipc_fileReader_testing");
|
||||
|
@ -22,8 +22,8 @@ function test_mainThread() {
|
||||
}
|
||||
|
||||
fetch('green.jpg').then(r => r.blob()).then(blob => {
|
||||
let bc = new BroadcastChannel('testMainThread');
|
||||
bc.postMessage(blob);
|
||||
let innerBc = new BroadcastChannel('testMainThread');
|
||||
innerBc.postMessage(blob);
|
||||
});
|
||||
}
|
||||
|
||||
@ -42,8 +42,8 @@ function test_worker() {
|
||||
}
|
||||
|
||||
fetch('http://mochi.test:8888/tests/dom/file/ipc/tests/green.jpg').then(r => r.blob()).then(blob => {
|
||||
let bc = new BroadcastChannel('testWorker');
|
||||
bc.postMessage(blob);
|
||||
let innerBc = new BroadcastChannel('testWorker');
|
||||
innerBc.postMessage(blob);
|
||||
});
|
||||
}
|
||||
let workerUrl = URL.createObjectURL(new Blob(["(", workerScript.toString(), ")()"]));
|
||||
|
Loading…
Reference in New Issue
Block a user