Bug 1877940 - Enable remaining ESLint rules on dom/messagechannel. r=dom-core,peterv

Differential Revision: https://phabricator.services.mozilla.com/D200280
This commit is contained in:
Mark Banner 2024-02-12 22:28:14 +00:00
parent 5a0f9d9b3a
commit e610a51084
5 changed files with 9 additions and 10 deletions

View file

@ -445,7 +445,6 @@ module.exports = {
"dom/html/test/**", "dom/html/test/**",
"dom/media/webaudio/test/**", "dom/media/webaudio/test/**",
"dom/media/webrtc/tests/**", "dom/media/webrtc/tests/**",
"dom/messagechannel/tests/**",
"dom/payments/test/**", "dom/payments/test/**",
"dom/performance/tests/**", "dom/performance/tests/**",
"dom/quota/test/browser/**", "dom/quota/test/browser/**",

View file

@ -20,7 +20,7 @@ function ok(condition, message) {
debug("condition: " + condition + ", " + message + "\n"); debug("condition: " + condition + ", " + message + "\n");
if (!condition) { if (!condition) {
sendAsyncMessage("mmMessagePort:fail", { message }); sendAsyncMessage("mmMessagePort:fail", { message });
throw "failed check: " + message; throw new Error("failed check: " + message);
} }
} }

View file

@ -59,15 +59,15 @@ function compare(a, b) {
ok (a !== b, 'They should not match'); ok (a !== b, 'They should not match');
var aProps = []; var aProps = [];
for (var p in a) aProps.push(p); for (let p in a) aProps.push(p);
var bProps = []; var bProps = [];
for (var p in b) bProps.push(p); for (let p in b) bProps.push(p);
is (aProps.length, bProps.length, 'Props match'); is (aProps.length, bProps.length, 'Props match');
is (aProps.sort().toString(), bProps.sort().toString(), 'Prop names match'); is (aProps.sort().toString(), bProps.sort().toString(), 'Prop names match');
for (var p in a) { for (let p in a) {
compare(a[p], b[p]); compare(a[p], b[p]);
} }

View file

@ -39,13 +39,13 @@ function test_fullDeliveredMessages() {
var mc = new MessageChannel(); var mc = new MessageChannel();
worker.postMessage(42, [mc.port2]); worker.postMessage(42, [mc.port2]);
for (var i = 0; i < MAX; ++i) { for (let i = 0; i < MAX; ++i) {
mc.port1.postMessage(i); mc.port1.postMessage(i);
} }
mc.port1.close(); mc.port1.close();
for (var i = 0; i < MAX * 2; ++i) { for (let i = 0; i < MAX * 2; ++i) {
mc.port1.postMessage(i); mc.port1.postMessage(i);
} }
} }

View file

@ -18,14 +18,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=677638
var a = new MessageChannel(); var a = new MessageChannel();
var status = false; var messageStatus = false;
try { try {
a.port1.postMessage('foobar', [a.port1]); a.port1.postMessage('foobar', [a.port1]);
} catch(e) { } catch(e) {
status =true; messageStatus = true;
} }
ok(status, "Transfering the same port should throw"); ok(messageStatus, "Transfering the same port should throw");
</script> </script>
</body> </body>