From d8c43d0ea160123f0100a7a648ea3bdb5b10ced6 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Mon, 10 Oct 2022 22:22:00 +0000 Subject: [PATCH] Bug 1793227, part 3 - Automatic fixes for js/xpconnect/tests/chrome. r=kmag Also change .eslintignore to cover the other directories. This also fixes the indentation the automatic fixer messed up in a few XHTML files. Differential Revision: https://phabricator.services.mozilla.com/D158503 --- .eslintignore | 7 +- js/xpconnect/tests/chrome/bug503926.xhtml | 2 +- .../tests/chrome/file_expandosharing.jsm | 8 +- .../tests/chrome/outoflinexulscript.js | 3 +- .../tests/chrome/test_APIExposer.xhtml | 2 +- .../tests/chrome/test_bug1041626.xhtml | 2 +- .../tests/chrome/test_bug1074863.html | 2 +- .../tests/chrome/test_bug1124898.html | 2 +- .../tests/chrome/test_bug503926.xhtml | 2 +- .../tests/chrome/test_bug596580.xhtml | 4 +- .../tests/chrome/test_bug658909.xhtml | 12 +-- .../tests/chrome/test_bug706301.xhtml | 2 +- .../tests/chrome/test_bug720619.xhtml | 4 +- .../tests/chrome/test_bug732665.xhtml | 2 +- .../tests/chrome/test_bug732665_meta.js | 18 +++-- .../tests/chrome/test_bug760076.xhtml | 2 +- .../tests/chrome/test_bug771429.xhtml | 2 +- .../tests/chrome/test_bug795275.xhtml | 8 +- .../tests/chrome/test_bug799348.xhtml | 7 +- .../tests/chrome/test_bug895340.xhtml | 9 +-- .../tests/chrome/test_cloneInto.xhtml | 10 +-- .../tests/chrome/test_exposeInDerived.xhtml | 2 +- .../chrome/test_weakmap_keys_preserved2.xhtml | 2 +- .../chrome/test_windowProxyDeadWrapper.html | 2 +- js/xpconnect/tests/chrome/test_xrayToJS.xhtml | 74 +++++++++---------- js/xpconnect/tests/chrome/utf8_subscript.js | 4 +- 26 files changed, 98 insertions(+), 96 deletions(-) diff --git a/.eslintignore b/.eslintignore index 5819f278fdf9..114812d3b7cd 100644 --- a/.eslintignore +++ b/.eslintignore @@ -138,12 +138,17 @@ intl/l10n/ # Exclude everything but self-hosted JS js/examples/ js/public/ -js/xpconnect/ js/src/devtools/ js/src/jit-test/ js/src/tests/ js/src/Y.js +# Changes to XPConnect tests must be carefully audited. +js/xpconnect/loader/ +js/xpconnect/tests/browser/ +js/xpconnect/tests/mochitest/ +js/xpconnect/tests/unit/ + # Fuzzing code for testing only, targeting the JS shell js/src/fuzz-tests/ diff --git a/js/xpconnect/tests/chrome/bug503926.xhtml b/js/xpconnect/tests/chrome/bug503926.xhtml index 07f4ec236aac..bfd5470305d6 100644 --- a/js/xpconnect/tests/chrome/bug503926.xhtml +++ b/js/xpconnect/tests/chrome/bug503926.xhtml @@ -18,7 +18,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=503926 var gWindowUtils = window.windowUtils; var passed = false; // eslint-disable-next-line mozilla/use-chromeutils-generateqi - var obj = { QueryInterface: function() { passed = true; } } + var obj = { QueryInterface() { passed = true; } } gWindowUtils.xpconnectArgument(obj); var isDialog = location.hash != '#iframe'; var outer = XPCNativeWrapper.unwrap(isDialog ? window.arguments[0] : parent); diff --git a/js/xpconnect/tests/chrome/file_expandosharing.jsm b/js/xpconnect/tests/chrome/file_expandosharing.jsm index 78718b28ec1c..f680ae20a993 100644 --- a/js/xpconnect/tests/chrome/file_expandosharing.jsm +++ b/js/xpconnect/tests/chrome/file_expandosharing.jsm @@ -1,4 +1,4 @@ -var EXPORTED_SYMBOLS = ['checkFromJSM']; +var EXPORTED_SYMBOLS = ["checkFromJSM"]; function checkFromJSM(target, is_op) { is_op(target.numProp, 42, "Number expando works"); @@ -6,5 +6,7 @@ function checkFromJSM(target, is_op) { // If is_op is todo_is, target.objProp will be undefined. try { is_op(target.objProp.bar, "baz", "Object expando works"); - } catch(e) { is_op(0, 1, "No object expando"); } -} \ No newline at end of file + } catch (e) { + is_op(0, 1, "No object expando"); + } +} diff --git a/js/xpconnect/tests/chrome/outoflinexulscript.js b/js/xpconnect/tests/chrome/outoflinexulscript.js index a06b633afd99..14b99048e9c9 100644 --- a/js/xpconnect/tests/chrome/outoflinexulscript.js +++ b/js/xpconnect/tests/chrome/outoflinexulscript.js @@ -1,6 +1,5 @@ // Some unicode characters that must be decoded: // ……………………………………………………………………………………………………………………………… function outoflinefunction() { - return 42; + return 42; } - diff --git a/js/xpconnect/tests/chrome/test_APIExposer.xhtml b/js/xpconnect/tests/chrome/test_APIExposer.xhtml index 4044474df24f..b327abe44d13 100644 --- a/js/xpconnect/tests/chrome/test_APIExposer.xhtml +++ b/js/xpconnect/tests/chrome/test_APIExposer.xhtml @@ -29,7 +29,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=634156 function genPropDesc(value) { return { enumerable: true, configurable: true, writable: true, - value: value }; + value }; } const props = { 'getProp': genPropDesc(function() { ok(true, "called prop that shadowed a getter"); }), diff --git a/js/xpconnect/tests/chrome/test_bug1041626.xhtml b/js/xpconnect/tests/chrome/test_bug1041626.xhtml index 3f970df60d12..61d763083806 100644 --- a/js/xpconnect/tests/chrome/test_bug1041626.xhtml +++ b/js/xpconnect/tests/chrome/test_bug1041626.xhtml @@ -42,7 +42,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1041626 xrayOwnProperties = Object.getOwnPropertyNames(window[0].document); realOwnProperties = Object.getOwnPropertyNames(window[0].wrappedJSObject.document); - ok(realOwnProperties.length > 0); + ok(!!realOwnProperties.length); is(xrayOwnProperties.sort().toSource(), realOwnProperties.sort().toSource(), "Xray enumerates document properties properly"); diff --git a/js/xpconnect/tests/chrome/test_bug1074863.html b/js/xpconnect/tests/chrome/test_bug1074863.html index 7dcad965e563..2fbe69a547b5 100644 --- a/js/xpconnect/tests/chrome/test_bug1074863.html +++ b/js/xpconnect/tests/chrome/test_bug1074863.html @@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1074863