From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../tests/avoid-Date-timing.js | 42 + .../tests/avoid-removeChild.js | 46 + .../tests/balanced-listeners.js | 89 + .../tests/balanced-observers.js | 74 + .../tests/consistent-if-bracing.js | 40 + .../eslint/eslint-plugin-mozilla/tests/globals.js | 161 + .../tests/lazy-getter-object-name.js | 50 + .../tests/mark-exported-symbols-as-used.js | 45 + .../tests/no-addtask-setup.js | 81 + .../tests/no-arbitrary-setTimeout.js | 41 + .../tests/no-compare-against-boolean-literals.js | 61 + .../tests/no-cu-reportError.js | 90 + .../tests/no-define-cc-etc.js | 62 + .../tests/no-throw-cr-literal.js | 62 + .../tests/no-useless-parameters.js | 147 + .../tests/no-useless-removeEventListener.js | 99 + .../tests/no-useless-run-test.js | 124 + .../tests/prefer-boolean-length-check.js | 97 + .../tests/prefer-formatValues.js | 72 + .../tests/reject-addtask-only.js | 56 + .../tests/reject-chromeutils-import-params.js | 67 + .../tests/reject-eager-module-in-lazy-getter.js | 80 + .../tests/reject-global-this.js | 49 + .../tests/reject-globalThis-modification.js | 90 + .../reject-import-system-module-from-non-system.js | 33 + .../tests/reject-importGlobalProperties.js | 87 + .../tests/reject-lazy-imports-into-globals.js | 50 + .../tests/reject-mixing-eager-and-lazy.js | 124 + .../tests/reject-multiple-getters-calls.js | 60 + .../eslint-plugin-mozilla/tests/reject-osfile.js | 50 + .../tests/reject-relative-requires.js | 58 + .../tests/reject-scriptableunicodeconverter.js | 33 + .../tests/reject-some-requires.js | 49 + .../tests/reject-top-level-await.js | 36 + .../tests/rejects-requires-await.js | 32 + .../eslint-plugin-mozilla/tests/use-cc-etc.js | 60 + .../tests/use-chromeutils-generateqi.js | 81 + .../tests/use-chromeutils-import.js | 70 + .../tests/use-default-preference-values.js | 41 + .../tests/use-includes-instead-of-indexOf.js | 38 + .../eslint-plugin-mozilla/tests/use-isInstance.js | 130 + .../eslint-plugin-mozilla/tests/use-ownerGlobal.js | 35 + .../eslint-plugin-mozilla/tests/use-returnValue.js | 39 + .../eslint-plugin-mozilla/tests/use-services.js | 60 + .../tests/use-static-import.js | 88 + .../eslint-plugin-mozilla/tests/valid-ci-uses.js | 58 + .../eslint-plugin-mozilla/tests/valid-lazy.js | 151 + .../tests/valid-services-property.js | 42 + .../eslint-plugin-mozilla/tests/valid-services.js | 33 + .../eslint-plugin-mozilla/tests/xpidl/docshell.xpt | 6077 ++++++++++++++++++++ .../tests/xpidl/xpcom_base.xpt | 3197 ++++++++++ 51 files changed, 12637 insertions(+) create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-Date-timing.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-removeChild.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/balanced-listeners.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/balanced-observers.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/consistent-if-bracing.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/globals.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/lazy-getter-object-name.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/mark-exported-symbols-as-used.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/no-addtask-setup.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/no-arbitrary-setTimeout.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/no-compare-against-boolean-literals.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/no-cu-reportError.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/no-define-cc-etc.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/no-throw-cr-literal.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-parameters.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-removeEventListener.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-run-test.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/prefer-boolean-length-check.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/prefer-formatValues.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-addtask-only.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-chromeutils-import-params.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-eager-module-in-lazy-getter.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-global-this.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-globalThis-modification.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-import-system-module-from-non-system.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-importGlobalProperties.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-lazy-imports-into-globals.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-mixing-eager-and-lazy.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-multiple-getters-calls.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-osfile.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-relative-requires.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-scriptableunicodeconverter.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-some-requires.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-top-level-await.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/rejects-requires-await.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/use-cc-etc.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/use-chromeutils-generateqi.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/use-chromeutils-import.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/use-default-preference-values.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/use-includes-instead-of-indexOf.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/use-isInstance.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/use-ownerGlobal.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/use-returnValue.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/use-services.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/use-static-import.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/valid-ci-uses.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/valid-lazy.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/valid-services-property.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/valid-services.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/xpidl/docshell.xpt create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/xpidl/xpcom_base.xpt (limited to 'tools/lint/eslint/eslint-plugin-mozilla/tests') diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-Date-timing.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-Date-timing.js new file mode 100644 index 0000000000..597961e8cc --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-Date-timing.js @@ -0,0 +1,42 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/avoid-Date-timing"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, type, message) { + return { code, errors: [{ message, type }] }; +} + +ruleTester.run("avoid-Date-timing", rule, { + valid: [ + "new Date('2017-07-11');", + "new Date(1499790192440);", + "new Date(2017, 7, 11);", + "Date.UTC(2017, 7);", + ], + invalid: [ + invalidCode( + "Date.now();", + "CallExpression", + "use performance.now() instead of Date.now() for timing measurements" + ), + invalidCode( + "new Date();", + "NewExpression", + "use performance.now() instead of new Date() for timing measurements" + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-removeChild.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-removeChild.js new file mode 100644 index 0000000000..e6a146898d --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-removeChild.js @@ -0,0 +1,46 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/avoid-removeChild"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, message) { + if (!message) { + message = + "use element.remove() instead of " + + "element.parentNode.removeChild(element)"; + } + return { code, errors: [{ message, type: "CallExpression" }] }; +} + +ruleTester.run("avoid-removeChild", rule, { + valid: [ + "elt.remove();", + "elt.parentNode.parentNode.removeChild(elt2.parentNode);", + "elt.parentNode.removeChild(elt2);", + "elt.removeChild(elt2);", + ], + invalid: [ + invalidCode("elt.parentNode.removeChild(elt);"), + invalidCode("elt.parentNode.parentNode.removeChild(elt.parentNode);"), + invalidCode("$(e).parentNode.removeChild($(e));"), + invalidCode("$('e').parentNode.removeChild($('e'));"), + invalidCode( + "elt.removeChild(elt.firstChild);", + "use element.firstChild.remove() instead of " + + "element.removeChild(element.firstChild)" + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/balanced-listeners.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/balanced-listeners.js new file mode 100644 index 0000000000..ca84e3474f --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/balanced-listeners.js @@ -0,0 +1,89 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/balanced-listeners"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function error(code, message) { + return { + code, + errors: [{ message, type: "Identifier" }], + }; +} + +ruleTester.run("balanced-listeners", rule, { + valid: [ + "elt.addEventListener('event', handler);" + + "elt.removeEventListener('event', handler);", + + "elt.addEventListener('event', handler, true);" + + "elt.removeEventListener('event', handler, true);", + + "elt.addEventListener('event', handler, false);" + + "elt.removeEventListener('event', handler, false);", + + "elt.addEventListener('event', handler);" + + "elt.removeEventListener('event', handler, false);", + + "elt.addEventListener('event', handler, false);" + + "elt.removeEventListener('event', handler);", + + "elt.addEventListener('event', handler, {capture: false});" + + "elt.removeEventListener('event', handler);", + + "elt.addEventListener('event', handler);" + + "elt.removeEventListener('event', handler, {capture: false});", + + "elt.addEventListener('event', handler, {capture: true});" + + "elt.removeEventListener('event', handler, true);", + + "elt.addEventListener('event', handler, true);" + + "elt.removeEventListener('event', handler, {capture: true});", + + "elt.addEventListener('event', handler, {once: true});", + + "elt.addEventListener('event', handler, {once: true, capture: true});", + ], + invalid: [ + error( + "elt.addEventListener('click', handler, false);", + "No corresponding 'removeEventListener(click)' was found." + ), + + error( + "elt.addEventListener('click', handler, false);" + + "elt.removeEventListener('click', handler, true);", + "No corresponding 'removeEventListener(click)' was found." + ), + + error( + "elt.addEventListener('click', handler, {capture: false});" + + "elt.removeEventListener('click', handler, true);", + "No corresponding 'removeEventListener(click)' was found." + ), + + error( + "elt.addEventListener('click', handler, {capture: true});" + + "elt.removeEventListener('click', handler);", + "No corresponding 'removeEventListener(click)' was found." + ), + + error( + "elt.addEventListener('click', handler, true);" + + "elt.removeEventListener('click', handler);", + "No corresponding 'removeEventListener(click)' was found." + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/balanced-observers.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/balanced-observers.js new file mode 100644 index 0000000000..e5f31fa969 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/balanced-observers.js @@ -0,0 +1,74 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/balanced-observers"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function error(code, message) { + return { + code, + errors: [{ message, type: "Identifier" }], + }; +} + +ruleTester.run("balanced-observers", rule, { + valid: [ + "Services.obs.addObserver(observer, 'observable');" + + "Services.obs.removeObserver(observer, 'observable');", + "Services.prefs.addObserver('preference.name', otherObserver);" + + "Services.prefs.removeObserver('preference.name', otherObserver);", + ], + invalid: [ + error( + // missing Services.obs.removeObserver + "Services.obs.addObserver(observer, 'observable');", + "No corresponding 'removeObserver(\"observable\")' was found." + ), + + error( + // wrong observable name for Services.obs.removeObserver + "Services.obs.addObserver(observer, 'observable');" + + "Services.obs.removeObserver(observer, 'different-observable');", + "No corresponding 'removeObserver(\"observable\")' was found." + ), + + error( + // missing Services.prefs.removeObserver + "Services.prefs.addObserver('preference.name', otherObserver);", + "No corresponding 'removeObserver(\"preference.name\")' was found." + ), + + error( + // wrong observable name for Services.prefs.removeObserver + "Services.prefs.addObserver('preference.name', otherObserver);" + + "Services.prefs.removeObserver('other.preference', otherObserver);", + "No corresponding 'removeObserver(\"preference.name\")' was found." + ), + + error( + // mismatch Services.prefs vs Services.obs + "Services.obs.addObserver(observer, 'observable');" + + "Services.prefs.removeObserver(observer, 'observable');", + "No corresponding 'removeObserver(\"observable\")' was found." + ), + + error( + "Services.prefs.addObserver('preference.name', otherObserver);" + + // mismatch Services.prefs vs Services.obs + "Services.obs.removeObserver('preference.name', otherObserver);", + "No corresponding 'removeObserver(\"preference.name\")' was found." + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/consistent-if-bracing.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/consistent-if-bracing.js new file mode 100644 index 0000000000..b6b5b849b9 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/consistent-if-bracing.js @@ -0,0 +1,40 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/consistent-if-bracing"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code) { + return { code, errors: [{ messageId: "consistentIfBracing" }] }; +} + +ruleTester.run("consistent-if-bracing", rule, { + valid: [ + "if (true) {1} else {0}", + "if (false) 1; else 0", + "if (true) {1} else if (true) {2} else {0}", + "if (true) {1} else if (true) {2} else if (true) {3} else {0}", + ], + invalid: [ + invalidCode(`if (true) {1} else 0`), + invalidCode("if (true) 1; else {0}"), + invalidCode("if (true) {1} else if (true) 2; else {0}"), + invalidCode("if (true) 1; else if (true) {2} else {0}"), + invalidCode("if (true) {1} else if (true) 2; else {0}"), + invalidCode("if (true) {1} else if (true) {2} else 0"), + invalidCode("if (true) {1} else if (true) {2} else if (true) 3; else {0}"), + invalidCode("if (true) {if (true) 1; else {0}} else {0}"), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/globals.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/globals.js new file mode 100644 index 0000000000..80fa35f4a6 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/globals.js @@ -0,0 +1,161 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +var { getGlobalsForCode } = require("../lib/globals"); +var assert = require("assert"); + +/* global describe, it */ + +describe("globals", function() { + it("should reflect top-level this property assignment", function() { + const globals = getGlobalsForCode(` +this.foo = 10; +`); + assert.deepEqual(globals, [{ name: "foo", writable: true }]); + }); + + it("should reflect this property assignment inside block", function() { + const globals = getGlobalsForCode(` +{ + this.foo = 10; +} +`); + assert.deepEqual(globals, [{ name: "foo", writable: true }]); + }); + + it("should ignore this property assignment inside function declaration", function() { + const globals = getGlobalsForCode(` +function f() { + this.foo = 10; +} +`); + assert.deepEqual(globals, [{ name: "f", writable: true }]); + }); + + it("should ignore this property assignment inside function expression", function() { + const globals = getGlobalsForCode(` +(function f() { + this.foo = 10; +}); +`); + assert.deepEqual(globals, []); + }); + + it("should ignore this property assignment inside method", function() { + const globals = getGlobalsForCode(` +({ + method() { + this.foo = 10; + } +}); +`); + assert.deepEqual(globals, []); + }); + + it("should ignore this property assignment inside accessor", function() { + const globals = getGlobalsForCode(` +({ + get x() { + this.foo = 10; + }, + set x(v) { + this.bar = 10; + } +}); +`); + assert.deepEqual(globals, []); + }); + + it("should reflect this property assignment inside arrow function", function() { + const globals = getGlobalsForCode(` +() => { + this.foo = 10; +}; +`); + assert.deepEqual(globals, [{ name: "foo", writable: true }]); + }); + + it("should ignore this property assignment inside arrow function inside function expression", function() { + const globals = getGlobalsForCode(` +(function f() { + () => { + this.foo = 10; + }; +}); +`); + assert.deepEqual(globals, []); + }); + + it("should ignore this property assignment inside class static", function() { + const globals = getGlobalsForCode(` +class A { + static { + this.foo = 10; + (() => { + this.bar = 10; + })(); + } +} +`); + assert.deepEqual(globals, [{ name: "A", writable: true }]); + }); + + it("should ignore this property assignment inside class property", function() { + const globals = getGlobalsForCode(` +class A { + a = this.foo = 10; + b = (() => { + this.bar = 10; + })(); +} +`); + assert.deepEqual(globals, [{ name: "A", writable: true }]); + }); + + it("should ignore this property assignment inside class static property", function() { + const globals = getGlobalsForCode(` +class A { + static a = this.foo = 10; + static b = (() => { + this.bar = 10; + })(); +} +`); + assert.deepEqual(globals, [{ name: "A", writable: true }]); + }); + + it("should ignore this property assignment inside class private property", function() { + const globals = getGlobalsForCode(` +class A { + #a = this.foo = 10; + #b = (() => { + this.bar = 10; + })(); +} +`); + assert.deepEqual(globals, [{ name: "A", writable: true }]); + }); + + it("should ignore this property assignment inside class static private property", function() { + const globals = getGlobalsForCode(` +class A { + static #a = this.foo = 10; + static #b = (() => { + this.bar = 10; + })(); +} +`); + assert.deepEqual(globals, [{ name: "A", writable: true }]); + }); + + it("should reflect lazy getters", function() { + const globals = getGlobalsForCode(` +ChromeUtils.defineESModuleGetters(this, { + A: "B", +}); +`); + assert.deepEqual(globals, [{ name: "A", writable: true, explicit: true }]); + }); +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/lazy-getter-object-name.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/lazy-getter-object-name.js new file mode 100644 index 0000000000..8a75e6238c --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/lazy-getter-object-name.js @@ -0,0 +1,50 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/lazy-getter-object-name"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester(); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code) { + let message = + "The variable name of the object passed to ChromeUtils.defineESModuleGetters must be `lazy`"; + return { code, errors: [{ message, type: "CallExpression" }] }; +} + +ruleTester.run("lazy-getter-object-name", rule, { + valid: [ + ` + ChromeUtils.defineESModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); +`, + ], + invalid: [ + invalidCode(` + ChromeUtils.defineESModuleGetters(obj, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); +`), + invalidCode(` + ChromeUtils.defineESModuleGetters(this, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); +`), + invalidCode(` + ChromeUtils.defineESModuleGetters(window, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); +`), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/mark-exported-symbols-as-used.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/mark-exported-symbols-as-used.js new file mode 100644 index 0000000000..d004650997 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/mark-exported-symbols-as-used.js @@ -0,0 +1,45 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/mark-exported-symbols-as-used"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, type, message) { + return { code, errors: [{ message, type }] }; +} + +ruleTester.run("mark-exported-symbols-as-used", rule, { + valid: [ + "var EXPORTED_SYMBOLS = ['foo'];", + "this.EXPORTED_SYMBOLS = ['foo'];", + ], + invalid: [ + invalidCode( + "let EXPORTED_SYMBOLS = ['foo'];", + "VariableDeclaration", + "EXPORTED_SYMBOLS cannot be declared via `let`. Use `var` or `this.EXPORTED_SYMBOLS =`" + ), + invalidCode( + "var EXPORTED_SYMBOLS = 'foo';", + "VariableDeclaration", + "Unexpected assignment of non-Array to EXPORTED_SYMBOLS" + ), + invalidCode( + "this.EXPORTED_SYMBOLS = 'foo';", + "AssignmentExpression", + "Unexpected assignment of non-Array to EXPORTED_SYMBOLS" + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/no-addtask-setup.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-addtask-setup.js new file mode 100644 index 0000000000..b8275a00ef --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-addtask-setup.js @@ -0,0 +1,81 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/no-addtask-setup"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 9 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function callError(message) { + return [{ message, type: "CallExpression" }]; +} + +ruleTester.run("no-addtask-setup", rule, { + valid: [ + "add_task(function() {});", + "add_task(function () {});", + "add_task(function foo() {});", + "add_task(async function() {});", + "add_task(async function () {});", + "add_task(async function foo() {});", + "something(function setup() {});", + "something(async function setup() {});", + "add_task(setup);", + "add_task(setup => {});", + "add_task(async setup => {});", + ], + invalid: [ + { + code: "add_task(function setup() {});", + output: "add_setup(function() {});", + errors: callError( + "Do not use add_task() for setup, use add_setup() instead." + ), + }, + { + code: "add_task(function setup () {});", + output: "add_setup(function () {});", + errors: callError( + "Do not use add_task() for setup, use add_setup() instead." + ), + }, + { + code: "add_task(async function setup() {});", + output: "add_setup(async function() {});", + errors: callError( + "Do not use add_task() for setup, use add_setup() instead." + ), + }, + { + code: "add_task(async function setup () {});", + output: "add_setup(async function () {});", + errors: callError( + "Do not use add_task() for setup, use add_setup() instead." + ), + }, + { + code: "add_task(async function setUp() {});", + output: "add_setup(async function() {});", + errors: callError( + "Do not use add_task() for setup, use add_setup() instead." + ), + }, + { + code: "add_task(async function init() {});", + output: "add_setup(async function() {});", + errors: callError( + "Do not use add_task() for setup, use add_setup() instead." + ), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/no-arbitrary-setTimeout.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-arbitrary-setTimeout.js new file mode 100644 index 0000000000..907b439b3c --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-arbitrary-setTimeout.js @@ -0,0 +1,41 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/no-arbitrary-setTimeout"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function wrapCode(code, filename = "xpcshell/test_foo.js") { + return { code, filename }; +} + +function invalidCode(code) { + let message = + "listen for events instead of setTimeout() with arbitrary delay"; + let obj = wrapCode(code); + obj.errors = [{ message, type: "CallExpression" }]; + return obj; +} + +ruleTester.run("no-arbitrary-setTimeout", rule, { + valid: [ + wrapCode("setTimeout(function() {}, 0);"), + wrapCode("setTimeout(function() {});"), + wrapCode("setTimeout(function() {}, 10);", "test_foo.js"), + ], + invalid: [ + invalidCode("setTimeout(function() {}, 10);"), + invalidCode("setTimeout(function() {}, timeout);"), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/no-compare-against-boolean-literals.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-compare-against-boolean-literals.js new file mode 100644 index 0000000000..722e6b5dda --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-compare-against-boolean-literals.js @@ -0,0 +1,61 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/no-compare-against-boolean-literals"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function callError(message) { + return [{ message, type: "BinaryExpression" }]; +} + +const MESSAGE = "Don't compare for inexact equality against boolean literals"; + +ruleTester.run("no-compare-against-boolean-literals", rule, { + valid: [`if (!foo) {}`, `if (!!foo) {}`], + invalid: [ + { + code: `if (foo == true) {}`, + errors: callError(MESSAGE), + }, + { + code: `if (foo != true) {}`, + errors: callError(MESSAGE), + }, + { + code: `if (foo == false) {}`, + errors: callError(MESSAGE), + }, + { + code: `if (foo != false) {}`, + errors: callError(MESSAGE), + }, + { + code: `if (true == foo) {}`, + errors: callError(MESSAGE), + }, + { + code: `if (true != foo) {}`, + errors: callError(MESSAGE), + }, + { + code: `if (false == foo) {}`, + errors: callError(MESSAGE), + }, + { + code: `if (false != foo) {}`, + errors: callError(MESSAGE), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/no-cu-reportError.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-cu-reportError.js new file mode 100644 index 0000000000..16aa8b6358 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-cu-reportError.js @@ -0,0 +1,90 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/no-cu-reportError"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 9 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function callError() { + return [{ messageId: "useConsoleError", type: "CallExpression" }]; +} + +ruleTester.run("no-cu-reportError", rule, { + valid: [ + "console.error('foo')", + "Cu.cloneInto({}, {})", + "foo().catch(console.error)", + // TODO: Bug 1802347 - this should be treated as an error as well. + "Cu.reportError('foo', stack)", + ], + invalid: [ + { + code: "Cu.reportError('foo')", + output: "console.error('foo')", + errors: callError(), + }, + { + code: "Cu.reportError(bar)", + output: "console.error(bar)", + errors: callError(), + }, + { + code: "foo().catch(Cu.reportError)", + output: "foo().catch(console.error)", + errors: callError(), + }, + // When referencing identifiers/members, try to reference them rather + // than stringifying: + { + code: "Cu.reportError('foo' + e)", + output: "console.error('foo', e)", + errors: callError(), + }, + { + code: "Cu.reportError('foo' + msg.data)", + output: "console.error('foo', msg.data)", + errors: callError(), + }, + // Don't touch existing concatenation of literals (usually done for + // wrapping reasons) + { + code: "Cu.reportError('foo' + 'bar' + 'baz')", + output: "console.error('foo' + 'bar' + 'baz')", + errors: callError(), + }, + // Ensure things work when nested: + { + code: "Cu.reportError('foo' + e + 'baz')", + output: "console.error('foo', e, 'baz')", + errors: callError(), + }, + // Ensure things work when nested in different places: + { + code: "Cu.reportError('foo' + e + 'quux' + 'baz')", + output: "console.error('foo', e, 'quux' + 'baz')", + errors: callError(), + }, + { + code: "Cu.reportError('foo' + 'quux' + e + 'baz')", + output: "console.error('foo' + 'quux', e, 'baz')", + errors: callError(), + }, + // Ensure things work with parens changing order of operations: + { + code: "Cu.reportError('foo' + 'quux' + (e + 'baz'))", + output: "console.error('foo' + 'quux' + (e + 'baz'))", + errors: callError(), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/no-define-cc-etc.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-define-cc-etc.js new file mode 100644 index 0000000000..735c7f4654 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-define-cc-etc.js @@ -0,0 +1,62 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/no-define-cc-etc"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 9 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, varNames) { + if (!Array.isArray(varNames)) { + varNames = [varNames]; + } + return { + code, + errors: varNames.map(name => { + return { + message: `${name} is now defined in global scope, a separate definition is no longer necessary.`, + type: "VariableDeclarator", + }; + }), + }; +} + +ruleTester.run("no-define-cc-etc", rule, { + valid: [ + "var Cm = Components.manager;", + "const CC = Components.Constructor;", + "var {Constructor: CC, manager: Cm} = Components;", + "const {Constructor: CC, manager: Cm} = Components;", + "foo.Cc.test();", + "const {bar, ...foo} = obj;", + ], + invalid: [ + invalidCode("var Cc;", "Cc"), + invalidCode("let Cc;", "Cc"), + invalidCode("let Ci;", "Ci"), + invalidCode("let Cr;", "Cr"), + invalidCode("let Cu;", "Cu"), + invalidCode("var Cc = Components.classes;", "Cc"), + invalidCode("const {classes: Cc} = Components;", "Cc"), + invalidCode("let {classes: Cc, manager: Cm} = Components", "Cc"), + invalidCode("const Cu = Components.utils;", "Cu"), + invalidCode("var Ci = Components.interfaces, Cc = Components.classes;", [ + "Ci", + "Cc", + ]), + invalidCode("var {'interfaces': Ci, 'classes': Cc} = Components;", [ + "Ci", + "Cc", + ]), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/no-throw-cr-literal.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-throw-cr-literal.js new file mode 100644 index 0000000000..6750213e72 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-throw-cr-literal.js @@ -0,0 +1,62 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/no-throw-cr-literal"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, output, messageId) { + return { + code, + output, + errors: [{ messageId, type: "ThrowStatement" }], + }; +} + +ruleTester.run("no-throw-cr-literal", rule, { + valid: [ + 'throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);', + 'throw Components.Exception("", Components.results.NS_ERROR_UNEXPECTED);', + 'function t() { throw Components.Exception("", Cr.NS_ERROR_NO_CONTENT); }', + // We don't handle combined values, regular no-throw-literal catches them + 'throw Components.results.NS_ERROR_UNEXPECTED + "whoops";', + ], + invalid: [ + invalidCode( + "throw Cr.NS_ERROR_NO_INTERFACE;", + 'throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);', + "bareCR" + ), + invalidCode( + "throw Components.results.NS_ERROR_ABORT;", + 'throw Components.Exception("", Components.results.NS_ERROR_ABORT);', + "bareComponentsResults" + ), + invalidCode( + "function t() { throw Cr.NS_ERROR_NULL_POINTER; }", + 'function t() { throw Components.Exception("", Cr.NS_ERROR_NULL_POINTER); }', + "bareCR" + ), + invalidCode( + "throw new Error(Cr.NS_ERROR_ABORT);", + 'throw Components.Exception("", Cr.NS_ERROR_ABORT);', + "newErrorCR" + ), + invalidCode( + "throw new Error(Components.results.NS_ERROR_ABORT);", + 'throw Components.Exception("", Components.results.NS_ERROR_ABORT);', + "newErrorComponentsResults" + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-parameters.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-parameters.js new file mode 100644 index 0000000000..0c9b12f6eb --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-parameters.js @@ -0,0 +1,147 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/no-useless-parameters"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function callError(message) { + return [{ message, type: "CallExpression" }]; +} + +ruleTester.run("no-useless-parameters", rule, { + valid: [ + "Services.prefs.clearUserPref('browser.search.custom');", + "Services.removeObserver('notification name', {});", + "Services.io.newURI('http://example.com');", + "Services.io.newURI('http://example.com', 'utf8');", + "elt.addEventListener('click', handler);", + "elt.addEventListener('click', handler, true);", + "elt.addEventListener('click', handler, {once: true});", + "elt.removeEventListener('click', handler);", + "elt.removeEventListener('click', handler, true);", + "Services.obs.addObserver(this, 'topic', true);", + "Services.obs.addObserver(this, 'topic');", + "Services.prefs.addObserver('branch', this, true);", + "Services.prefs.addObserver('branch', this);", + "array.appendElement(elt);", + "Services.obs.notifyObservers(obj, 'topic', 'data');", + "Services.obs.notifyObservers(obj, 'topic');", + "window.getComputedStyle(elt);", + "window.getComputedStyle(elt, ':before');", + ], + invalid: [ + { + code: "Services.prefs.clearUserPref('browser.search.custom', false);", + output: "Services.prefs.clearUserPref('browser.search.custom');", + errors: callError("clearUserPref takes only 1 parameter."), + }, + { + code: "Services.prefs.clearUserPref('browser.search.custom',\n false);", + output: "Services.prefs.clearUserPref('browser.search.custom');", + errors: callError("clearUserPref takes only 1 parameter."), + }, + { + code: "Services.removeObserver('notification name', {}, false);", + output: "Services.removeObserver('notification name', {});", + errors: callError("removeObserver only takes 2 parameters."), + }, + { + code: "Services.removeObserver('notification name', {}, true);", + output: "Services.removeObserver('notification name', {});", + errors: callError("removeObserver only takes 2 parameters."), + }, + { + code: "Services.io.newURI('http://example.com', null, null);", + output: "Services.io.newURI('http://example.com');", + errors: callError("newURI's last parameters are optional."), + }, + { + code: "Services.io.newURI('http://example.com', 'utf8', null);", + output: "Services.io.newURI('http://example.com', 'utf8');", + errors: callError("newURI's last parameters are optional."), + }, + { + code: "Services.io.newURI('http://example.com', null);", + output: "Services.io.newURI('http://example.com');", + errors: callError("newURI's last parameters are optional."), + }, + { + code: "Services.io.newURI('http://example.com', '', '');", + output: "Services.io.newURI('http://example.com');", + errors: callError("newURI's last parameters are optional."), + }, + { + code: "Services.io.newURI('http://example.com', '');", + output: "Services.io.newURI('http://example.com');", + errors: callError("newURI's last parameters are optional."), + }, + { + code: "elt.addEventListener('click', handler, false);", + output: "elt.addEventListener('click', handler);", + errors: callError( + "addEventListener's third parameter can be omitted when it's false." + ), + }, + { + code: "elt.removeEventListener('click', handler, false);", + output: "elt.removeEventListener('click', handler);", + errors: callError( + "removeEventListener's third parameter can be omitted when it's" + + " false." + ), + }, + { + code: "Services.obs.addObserver(this, 'topic', false);", + output: "Services.obs.addObserver(this, 'topic');", + errors: callError( + "addObserver's third parameter can be omitted when it's false." + ), + }, + { + code: "Services.prefs.addObserver('branch', this, false);", + output: "Services.prefs.addObserver('branch', this);", + errors: callError( + "addObserver's third parameter can be omitted when it's false." + ), + }, + { + code: "array.appendElement(elt, false);", + output: "array.appendElement(elt);", + errors: callError( + "appendElement's second parameter can be omitted when it's false." + ), + }, + { + code: "Services.obs.notifyObservers(obj, 'topic', null);", + output: "Services.obs.notifyObservers(obj, 'topic');", + errors: callError("notifyObservers's third parameter can be omitted."), + }, + { + code: "Services.obs.notifyObservers(obj, 'topic', '');", + output: "Services.obs.notifyObservers(obj, 'topic');", + errors: callError("notifyObservers's third parameter can be omitted."), + }, + { + code: "window.getComputedStyle(elt, null);", + output: "window.getComputedStyle(elt);", + errors: callError("getComputedStyle's second parameter can be omitted."), + }, + { + code: "window.getComputedStyle(elt, '');", + output: "window.getComputedStyle(elt);", + errors: callError("getComputedStyle's second parameter can be omitted."), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-removeEventListener.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-removeEventListener.js new file mode 100644 index 0000000000..9f59c78d05 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-removeEventListener.js @@ -0,0 +1,99 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/no-useless-removeEventListener"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code) { + let message = + "use {once: true} instead of removeEventListener " + + "as the first instruction of the listener"; + return { code, errors: [{ message, type: "CallExpression" }] }; +} + +ruleTester.run("no-useless-removeEventListener", rule, { + valid: [ + // Listeners that aren't a function are always valid. + "elt.addEventListener('click', handler);", + "elt.addEventListener('click', handler, true);", + "elt.addEventListener('click', handler, {once: true});", + + // Should not fail on empty functions. + "elt.addEventListener('click', function() {});", + + // Should not reject when removing a listener for another event. + "elt.addEventListener('click', function listener() {" + + " elt.removeEventListener('keypress', listener);" + + "});", + + // Should not reject when there's another instruction before + // removeEventListener. + "elt.addEventListener('click', function listener() {" + + " elt.focus();" + + " elt.removeEventListener('click', listener);" + + "});", + + // Should not reject when wantsUntrusted is true. + "elt.addEventListener('click', function listener() {" + + " elt.removeEventListener('click', listener);" + + "}, false, true);", + + // Should not reject when there's a literal and a variable + "elt.addEventListener('click', function listener() {" + + " elt.removeEventListener(eventName, listener);" + + "});", + + // Should not reject when there's 2 different variables + "elt.addEventListener(event1, function listener() {" + + " elt.removeEventListener(event2, listener);" + + "});", + + // Should not fail if this is a different type of event listener function. + "myfunc.addEventListener(listener);", + ], + invalid: [ + invalidCode( + "elt.addEventListener('click', function listener() {" + + " elt.removeEventListener('click', listener);" + + "});" + ), + invalidCode( + "elt.addEventListener('click', function listener() {" + + " elt.removeEventListener('click', listener, true);" + + "}, true);" + ), + invalidCode( + "elt.addEventListener('click', function listener() {" + + " elt.removeEventListener('click', listener);" + + "}, {once: true});" + ), + invalidCode( + "elt.addEventListener('click', function listener() {" + + " /* Comment */" + + " elt.removeEventListener('click', listener);" + + "});" + ), + invalidCode( + "elt.addEventListener('click', function() {" + + " elt.removeEventListener('click', arguments.callee);" + + "});" + ), + invalidCode( + "elt.addEventListener(eventName, function listener() {" + + " elt.removeEventListener(eventName, listener);" + + "});" + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-run-test.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-run-test.js new file mode 100644 index 0000000000..3541467143 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-run-test.js @@ -0,0 +1,124 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/no-useless-run-test"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, output) { + let message = + "Useless run_test function - only contains run_next_test; whole function can be removed"; + return { code, output, errors: [{ message, type: "FunctionDeclaration" }] }; +} + +ruleTester.run("no-useless-run-test", rule, { + valid: [ + "function run_test() {}", + "function run_test() {let args = 1; run_next_test();}", + "function run_test() {fakeCall(); run_next_test();}", + ], + invalid: [ + // Single-line case. + invalidCode("function run_test() { run_next_test(); }", ""), + // Multiple-line cases + invalidCode( + ` +function run_test() { + run_next_test(); +}`, + `` + ), + invalidCode( + ` +foo(); +function run_test() { + run_next_test(); +} +`, + ` +foo(); +` + ), + invalidCode( + ` +foo(); +function run_test() { + run_next_test(); +} +bar(); +`, + ` +foo(); +bar(); +` + ), + invalidCode( + ` +foo(); + +function run_test() { + run_next_test(); +} + +bar();`, + ` +foo(); + +bar();` + ), + invalidCode( + ` +foo(); + +function run_test() { + run_next_test(); +} + +// A comment +bar(); +`, + ` +foo(); + +// A comment +bar(); +` + ), + invalidCode( + ` +foo(); + +/** + * A useful comment. + */ +function run_test() { + run_next_test(); +} + +// A comment +bar(); +`, + ` +foo(); + +/** + * A useful comment. + */ + +// A comment +bar(); +` + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/prefer-boolean-length-check.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/prefer-boolean-length-check.js new file mode 100644 index 0000000000..daf3c6f3d9 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/prefer-boolean-length-check.js @@ -0,0 +1,97 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/prefer-boolean-length-check"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidError() { + let message = "Prefer boolean length check"; + return [{ message, type: "BinaryExpression" }]; +} + +ruleTester.run("check-length", rule, { + valid: [ + "if (foo.length && foo.length) {}", + "if (!foo.length) {}", + "if (foo.value == 0) {}", + "if (foo.value > 0) {}", + "if (0 == foo.value) {}", + "if (0 < foo.value) {}", + "var a = !!foo.length", + "function bar() { return !!foo.length }", + ], + invalid: [ + { + code: "if (foo.length == 0) {}", + output: "if (!foo.length) {}", + errors: invalidError(), + }, + { + code: "if (foo.length > 0) {}", + output: "if (foo.length) {}", + errors: invalidError(), + }, + { + code: "if (0 < foo.length) {}", + output: "if (foo.length) {}", + errors: invalidError(), + }, + { + code: "if (0 == foo.length) {}", + output: "if (!foo.length) {}", + errors: invalidError(), + }, + { + code: "if (foo && foo.length == 0) {}", + output: "if (foo && !foo.length) {}", + errors: invalidError(), + }, + { + code: "if (foo.bar.length == 0) {}", + output: "if (!foo.bar.length) {}", + errors: invalidError(), + }, + { + code: "var a = foo.length>0", + output: "var a = !!foo.length", + errors: invalidError(), + }, + { + code: "function bar() { return foo.length>0 }", + output: "function bar() { return !!foo.length }", + errors: invalidError(), + }, + { + code: "if (foo && bar.length>0) {}", + output: "if (foo && bar.length) {}", + errors: invalidError(), + }, + { + code: "while (foo && bar.length>0) {}", + output: "while (foo && bar.length) {}", + errors: invalidError(), + }, + { + code: "x = y && bar.length > 0", + output: "x = y && !!bar.length", + errors: invalidError(), + }, + { + code: "function bar() { return x && foo.length > 0}", + output: "function bar() { return x && !!foo.length}", + errors: invalidError(), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/prefer-formatValues.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/prefer-formatValues.js new file mode 100644 index 0000000000..0883130f17 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/prefer-formatValues.js @@ -0,0 +1,72 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/prefer-formatValues"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function error(line, column = undefined) { + return { + message: + "prefer to use a single document.l10n.formatValues call instead " + + "of multiple calls to document.l10n.formatValue or document.l10n.formatValues", + type: "CallExpression", + line, + column, + }; +} + +ruleTester.run("check-length", rule, { + valid: [ + "document.l10n.formatValue('foobar');", + "document.l10n.formatValues(['foobar', 'foobaz']);", + `if (foo) { + document.l10n.formatValue('foobar'); + } else { + document.l10n.formatValue('foobaz'); + }`, + `document.l10n.formatValue('foobaz'); + if (foo) { + document.l10n.formatValue('foobar'); + }`, + `if (foo) { + document.l10n.formatValue('foobar'); + } + document.l10n.formatValue('foobaz');`, + `if (foo) { + document.l10n.formatValue('foobar'); + } + document.l10n.formatValues(['foobaz']);`, + ], + invalid: [ + { + code: `document.l10n.formatValue('foobar'); + document.l10n.formatValue('foobaz');`, + errors: [error(1, 1), error(2, 14)], + }, + { + code: `document.l10n.formatValue('foobar'); + if (foo) { + document.l10n.formatValue('foobiz'); + } + document.l10n.formatValue('foobaz');`, + errors: [error(1, 1), error(5, 14)], + }, + { + code: `document.l10n.formatValues('foobar'); + document.l10n.formatValue('foobaz');`, + errors: [error(1, 1), error(2, 14)], + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-addtask-only.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-addtask-only.js new file mode 100644 index 0000000000..196b47f9cb --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-addtask-only.js @@ -0,0 +1,56 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-addtask-only"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidError(output) { + let message = + "add_task(...).only() not allowed - add an exception if this is intentional"; + return [ + { + message, + type: "CallExpression", + suggestions: [{ desc: "Remove only() call from task", output }], + }, + ]; +} + +ruleTester.run("reject-addtask-only", rule, { + valid: [ + "add_task(foo())", + "add_task(foo()).skip()", + "add_task(function() {})", + "add_task(function() {}).skip()", + ], + invalid: [ + { + code: "add_task(foo()).only()", + errors: invalidError("add_task(foo())"), + }, + { + code: "add_task(foo()).only(bar())", + errors: invalidError("add_task(foo())"), + }, + { + code: "add_task(function() {}).only()", + errors: invalidError("add_task(function() {})"), + }, + { + code: "add_task(function() {}).only(bar())", + errors: invalidError("add_task(function() {})"), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-chromeutils-import-params.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-chromeutils-import-params.js new file mode 100644 index 0000000000..8d813b30d8 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-chromeutils-import-params.js @@ -0,0 +1,67 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-chromeutils-import-params"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidError(suggested) { + return [ + { + message: "ChromeUtils.import only takes one argument.", + type: "CallExpression", + suggestions: [ + { + desc: "Remove the unnecessary parameters.", + output: suggested, + }, + ], + }, + ]; +} + +ruleTester.run("reject-chromeutils-import-params", rule, { + valid: ['ChromeUtils.import("resource://some/path/to/My.jsm")'], + invalid: [ + { + code: 'ChromeUtils.import("resource://some/path/to/My.jsm", null)', + errors: invalidError( + `ChromeUtils.import("resource://some/path/to/My.jsm")` + ), + }, + { + code: ` +ChromeUtils.import( + "resource://some/path/to/My.jsm", + null +);`, + errors: invalidError(` +ChromeUtils.import( + "resource://some/path/to/My.jsm" +);`), + }, + { + code: 'ChromeUtils.import("resource://some/path/to/My.jsm", this)', + errors: invalidError( + `ChromeUtils.import("resource://some/path/to/My.jsm")` + ), + }, + { + code: 'ChromeUtils.import("resource://some/path/to/My.jsm", foo, bar)', + errors: invalidError( + `ChromeUtils.import("resource://some/path/to/My.jsm")` + ), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-eager-module-in-lazy-getter.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-eager-module-in-lazy-getter.js new file mode 100644 index 0000000000..0df97883a8 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-eager-module-in-lazy-getter.js @@ -0,0 +1,80 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-eager-module-in-lazy-getter"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester(); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, uri) { + return { code, errors: [{ messageId: "eagerModule", data: { uri } }] }; +} + +ruleTester.run("reject-eager-module-in-lazy-getter", rule, { + valid: [ + ` + XPCOMUtils.defineLazyModuleGetter( + lazy, "Integration", "resource://gre/modules/Integration.jsm" + ); +`, + ` + ChromeUtils.defineModuleGetter( + lazy, "Integration", "resource://gre/modules/Integration.jsm" + ); +`, + ` + XPCOMUtils.defineLazyModuleGetters(lazy, { + Integration: "resource://gre/modules/Integration.jsm", + }); +`, + ` + ChromeUtils.defineESModuleGetters(lazy, { + Integration: "resource://gre/modules/Integration.sys.mjs", + }); +`, + ], + invalid: [ + invalidCode( + ` + XPCOMUtils.defineLazyModuleGetter( + lazy, "AppConstants", "resource://gre/modules/AppConstants.jsm" + ); +`, + "resource://gre/modules/AppConstants.jsm" + ), + invalidCode( + ` + ChromeUtils.defineModuleGetter( + lazy, "XPCOMUtils", "resource://gre/modules/XPCOMUtils.jsm" + ); +`, + "resource://gre/modules/XPCOMUtils.jsm" + ), + invalidCode( + ` + XPCOMUtils.defineLazyModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.jsm", + }); +`, + "resource://gre/modules/AppConstants.jsm" + ), + invalidCode( + ` + ChromeUtils.defineESModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); +`, + "resource://gre/modules/AppConstants.sys.mjs" + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-global-this.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-global-this.js new file mode 100644 index 0000000000..44ee559580 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-global-this.js @@ -0,0 +1,49 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-global-this"); +var RuleTester = require("eslint").RuleTester; + +// class static block is available from ES2022 = 13. +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 13 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code) { + let message = "JSM should not use the global this"; + return { code, errors: [{ message, type: "ThisExpression" }] }; +} + +ruleTester.run("reject-top-level-await", rule, { + valid: [ + "function f() { this; }", + "(function f() { this; });", + "({ foo() { this; } });", + "({ get foo() { this; } })", + "({ set foo(x) { this; } })", + "class X { foo() { this; } }", + "class X { get foo() { this; } }", + "class X { set foo(x) { this; } }", + "class X { static foo() { this; } }", + "class X { static get foo() { this; } }", + "class X { static set foo(x) { this; } }", + "class X { P = this; }", + "class X { #P = this; }", + "class X { static { this; } }", + ], + invalid: [ + invalidCode("this;"), + invalidCode("() => this;"), + + invalidCode("this.foo = 10;"), + invalidCode("ChromeUtils.defineModuleGetter(this, {});"), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-globalThis-modification.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-globalThis-modification.js new file mode 100644 index 0000000000..a0002ff654 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-globalThis-modification.js @@ -0,0 +1,90 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-globalThis-modification"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester(); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCall(code) { + return { + code, + errors: [ + { + message: + "`globalThis` shouldn't be passed to function that can modify it. `globalThis` is the shared global inside the system module, and properties defined on it is visible from all modules.", + type: "CallExpression", + }, + ], + }; +} + +function invalidAssignment(code) { + return { + code, + errors: [ + { + message: + "`globalThis` shouldn't be modified. `globalThis` is the shared global inside the system module, and properties defined on it is visible from all modules.", + type: "AssignmentExpression", + }, + ], + }; +} + +ruleTester.run("reject-globalThis-modification", rule, { + valid: [ + `var x = globalThis.Array;`, + `Array in globalThis;`, + `result.deserialize(globalThis)`, + ], + invalid: [ + invalidAssignment(` + globalThis.foo = 10; +`), + invalidCall(` + Object.defineProperty(globalThis, "foo", { value: 10 }); +`), + invalidCall(` + Object.defineProperties(globalThis, { + foo: { value: 10 }, + }); +`), + invalidCall(` + Object.assign(globalThis, { foo: 10 }); +`), + invalidCall(` + ChromeUtils.defineModuleGetter( + globalThis, "AppConstants", "resource://gre/modules/AppConstants.jsm" + ); +`), + invalidCall(` + ChromeUtils.defineESMGetters(globalThis, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); +`), + invalidCall(` + XPCOMUtils.defineLazyModuleGetter( + globalThis, "AppConstants", "resource://gre/modules/AppConstants.jsm" + ); +`), + invalidCall(` + XPCOMUtils.defineLazyModuleGetters(globalThis, { + AppConstants: "resource://gre/modules/AppConstants.jsm", + }); +`), + invalidCall(` + someFunction(1, globalThis); +`), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-import-system-module-from-non-system.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-import-system-module-from-non-system.js new file mode 100644 index 0000000000..b78a3a195d --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-import-system-module-from-non-system.js @@ -0,0 +1,33 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-import-system-module-from-non-system"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ + parserOptions: { ecmaVersion: 13, sourceType: "module" }, +}); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +ruleTester.run("reject-import-system-module-from-non-system", rule, { + valid: [ + { + code: `const { AppConstants } = ChromeUtils.importESM("resource://gre/modules/AppConstants.sys.mjs");`, + }, + ], + invalid: [ + { + code: `import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";`, + errors: [{ messageId: "rejectStaticImportSystemModuleFromNonSystem" }], + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-importGlobalProperties.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-importGlobalProperties.js new file mode 100644 index 0000000000..c86d9676d5 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-importGlobalProperties.js @@ -0,0 +1,87 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-importGlobalProperties"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +ruleTester.run("reject-importGlobalProperties", rule, { + valid: [ + { + code: "Cu.something();", + }, + { + options: ["allownonwebidl"], + code: "Cu.importGlobalProperties(['fetch'])", + }, + { + options: ["allownonwebidl"], + code: "XPCOMUtils.defineLazyGlobalGetters(this, ['fetch'])", + }, + { + options: ["allownonwebidl"], + code: "Cu.importGlobalProperties(['TextEncoder'])", + filename: "foo.sjs", + }, + { + options: ["allownonwebidl"], + code: "XPCOMUtils.defineLazyGlobalGetters(this, ['TextEncoder'])", + filename: "foo.sjs", + }, + ], + invalid: [ + { + code: "Cu.importGlobalProperties(['fetch'])", + options: ["everything"], + errors: [{ messageId: "unexpectedCall" }], + }, + { + code: "XPCOMUtils.defineLazyGlobalGetters(this, ['fetch'])", + options: ["everything"], + errors: [{ messageId: "unexpectedCall" }], + }, + { + code: "Cu.importGlobalProperties(['TextEncoder'])", + options: ["everything"], + errors: [{ messageId: "unexpectedCall" }], + }, + { + code: "XPCOMUtils.defineLazyGlobalGetters(this, ['TextEncoder'])", + options: ["everything"], + errors: [{ messageId: "unexpectedCall" }], + }, + { + code: "Cu.importGlobalProperties(['TextEncoder'])", + options: ["allownonwebidl"], + errors: [{ messageId: "unexpectedCallCuWebIdl" }], + }, + { + code: "XPCOMUtils.defineLazyGlobalGetters(this, ['TextEncoder'])", + options: ["allownonwebidl"], + errors: [{ messageId: "unexpectedCallXPCOMWebIdl" }], + }, + { + options: ["allownonwebidl"], + code: "Cu.importGlobalProperties(['TextEncoder'])", + errors: [{ messageId: "unexpectedCallCuWebIdl" }], + filename: "foo.js", + }, + { + options: ["allownonwebidl"], + code: "XPCOMUtils.defineLazyGlobalGetters(this, ['TextEncoder'])", + errors: [{ messageId: "unexpectedCallXPCOMWebIdl" }], + filename: "foo.js", + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-lazy-imports-into-globals.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-lazy-imports-into-globals.js new file mode 100644 index 0000000000..b3df33a87d --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-lazy-imports-into-globals.js @@ -0,0 +1,50 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-lazy-imports-into-globals"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ + parserOptions: { ecmaVersion: 13, sourceType: "module" }, +}); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code) { + return { code, errors: [{ messageId: "rejectLazyImportsIntoGlobals" }] }; +} + +ruleTester.run("reject-lazy-imports-into-globals", rule, { + valid: [ + ` + const lazy = {}; + XPCOMUtils.defineLazyGetter(lazy, "foo", () => {}); + `, + ], + invalid: [ + invalidCode(`XPCOMUtils.defineLazyGetter(globalThis, "foo", () => {});`), + invalidCode(`XPCOMUtils.defineLazyGetter(window, "foo", () => {});`), + invalidCode( + `XPCOMUtils.defineLazyModuleGetter(globalThis, "foo", "foo.jsm");` + ), + invalidCode(`XPCOMUtils.defineLazyModuleGetter(window, "foo", "foo.jsm");`), + invalidCode( + `XPCOMUtils.defineLazyPreferenceGetter(globalThis, "foo", "foo.bar");` + ), + invalidCode( + `XPCOMUtils.defineLazyServiceGetter(globalThis, "foo", "@foo", "nsIFoo");` + ), + invalidCode(`XPCOMUtils.defineLazyGlobalGetters(globalThis, {});`), + invalidCode(`XPCOMUtils.defineLazyGlobalGetters(window, {});`), + invalidCode(`XPCOMUtils.defineLazyModuleGetters(globalThis, {});`), + invalidCode(`ChromeUtils.defineESModuleGetters(window, {});`), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-mixing-eager-and-lazy.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-mixing-eager-and-lazy.js new file mode 100644 index 0000000000..b317cf3377 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-mixing-eager-and-lazy.js @@ -0,0 +1,124 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-mixing-eager-and-lazy"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ + parserOptions: { ecmaVersion: 13, sourceType: "module" }, +}); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, uri) { + return { code, errors: [{ messageId: "mixedEagerAndLazy", data: { uri } }] }; +} + +ruleTester.run("reject-mixing-eager-and-lazy", rule, { + valid: [ + ` + ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); +`, + ` + ChromeUtils.importESModule("resource://gre/modules/AppConstants.sys.mjs"); +`, + ` + import{ AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +`, + ` + XPCOMUtils.defineLazyModuleGetter( + lazy, "AppConstants", "resource://gre/modules/AppConstants.jsm" + ); +`, + ` + ChromeUtils.defineModuleGetter( + lazy, "AppConstants", "resource://gre/modules/AppConstants.jsm" + ); +`, + ` + XPCOMUtils.defineLazyModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.jsm", + }); +`, + ` + ChromeUtils.defineESModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); +`, + ` + if (some_condition) { + ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); + } + XPCOMUtils.defineLazyModuleGetter( + lazy, "AppConstants", "resource://gre/modules/AppConstants.jsm" + ); +`, + ` + ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); + XPCOMUtils.defineLazyModuleGetter( + sandbox, "AppConstants", "resource://gre/modules/AppConstants.jsm" + ); +`, + ` + ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); + XPCOMUtils.defineLazyModuleGetters(sandbox, { + AppConstants: "resource://gre/modules/AppConstants.jsm", + }); +`, + ], + invalid: [ + invalidCode( + ` + ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); + XPCOMUtils.defineLazyModuleGetter( + lazy, "AppConstants", "resource://gre/modules/AppConstants.jsm" + ); +`, + "resource://gre/modules/AppConstants.jsm" + ), + invalidCode( + ` + ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); + ChromeUtils.defineModuleGetter( + lazy, "AppConstants", "resource://gre/modules/AppConstants.jsm" + ); +`, + "resource://gre/modules/AppConstants.jsm" + ), + invalidCode( + ` + ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); + XPCOMUtils.defineLazyModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.jsm", + }); +`, + "resource://gre/modules/AppConstants.jsm" + ), + invalidCode( + ` + ChromeUtils.importESModule("resource://gre/modules/AppConstants.sys.mjs"); + ChromeUtils.defineESModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); +`, + "resource://gre/modules/AppConstants.sys.mjs" + ), + invalidCode( + ` + import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; + ChromeUtils.defineESModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); +`, + "resource://gre/modules/AppConstants.sys.mjs" + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-multiple-getters-calls.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-multiple-getters-calls.js new file mode 100644 index 0000000000..fa6117d19f --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-multiple-getters-calls.js @@ -0,0 +1,60 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-multiple-getters-calls"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester(); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code) { + return { code, errors: [{ messageId: "rejectMultipleCalls" }] }; +} + +ruleTester.run("reject-multiple-getters-calls", rule, { + valid: [ + ` + ChromeUtils.defineESModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", + }); + `, + ` + ChromeUtils.defineESModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); + ChromeUtils.defineESModuleGetters(window, { + PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", + }); + `, + ` + ChromeUtils.defineESModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); + if (cond) { + ChromeUtils.defineESModuleGetters(lazy, { + PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", + }); + } + `, + ], + invalid: [ + invalidCode(` + ChromeUtils.defineESModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }); + ChromeUtils.defineESModuleGetters(lazy, { + PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", + }); + `), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-osfile.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-osfile.js new file mode 100644 index 0000000000..c8eb3f2f5f --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-osfile.js @@ -0,0 +1,50 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-osfile"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidError(os, util) { + let message = `${os} is deprecated. You should use ${util} instead.`; + return [{ message, type: "MemberExpression" }]; +} + +ruleTester.run("reject-osfile", rule, { + valid: ["IOUtils.write()"], + invalid: [ + { + code: "OS.File.write()", + errors: invalidError("OS.File", "IOUtils"), + }, + { + code: "lazy.OS.File.write()", + errors: invalidError("OS.File", "IOUtils"), + }, + ], +}); + +ruleTester.run("reject-osfile", rule, { + valid: ["PathUtils.join()"], + invalid: [ + { + code: "OS.Path.join()", + errors: invalidError("OS.Path", "PathUtils"), + }, + { + code: "lazy.OS.Path.join()", + errors: invalidError("OS.Path", "PathUtils"), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-relative-requires.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-relative-requires.js new file mode 100644 index 0000000000..19f30559ec --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-relative-requires.js @@ -0,0 +1,58 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-relative-requires"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidError() { + let message = "relative paths are not allowed with require()"; + return [{ message, type: "CallExpression" }]; +} + +ruleTester.run("reject-relative-requires", rule, { + valid: [ + 'require("devtools/absolute/path")', + 'require("resource://gre/modules/SomeModule.jsm")', + 'loader.lazyRequireGetter(this, "path", "devtools/absolute/path", true)', + 'loader.lazyRequireGetter(this, "Path", "devtools/absolute/path")', + ], + invalid: [ + { + code: 'require("./relative/path")', + errors: invalidError(), + }, + { + code: 'require("../parent/folder/path")', + errors: invalidError(), + }, + { + code: 'loader.lazyRequireGetter(this, "path", "./relative/path", true)', + errors: invalidError(), + }, + { + code: + 'loader.lazyRequireGetter(this, "path", "../parent/folder/path", true)', + errors: invalidError(), + }, + { + code: 'loader.lazyRequireGetter(this, "path", "./relative/path")', + errors: invalidError(), + }, + { + code: 'loader.lazyRequireGetter(this, "path", "../parent/folder/path")', + errors: invalidError(), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-scriptableunicodeconverter.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-scriptableunicodeconverter.js new file mode 100644 index 0000000000..04fb8057db --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-scriptableunicodeconverter.js @@ -0,0 +1,33 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-scriptableunicodeconverter"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidError() { + let message = + "Ci.nsIScriptableUnicodeConverter is deprecated. You should use TextEncoder or TextDecoder instead."; + return [{ message, type: "MemberExpression" }]; +} + +ruleTester.run("reject-scriptableunicodeconverter", rule, { + valid: ["TextEncoder", "TextDecoder"], + invalid: [ + { + code: "Ci.nsIScriptableUnicodeConverter", + errors: invalidError(), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-some-requires.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-some-requires.js new file mode 100644 index 0000000000..b56dd2cf96 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-some-requires.js @@ -0,0 +1,49 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-some-requires"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function requirePathError(path) { + const message = `require(${path}) is not allowed`; + return [{ message, type: "CallExpression" }]; +} + +const DEVTOOLS_FORBIDDEN_PATH = "^(resource://)?devtools/forbidden"; + +ruleTester.run("reject-some-requires", rule, { + valid: [ + { + code: 'require("devtools/not-forbidden/path")', + options: [DEVTOOLS_FORBIDDEN_PATH], + }, + { + code: 'require("resource://devtools/not-forbidden/path")', + options: [DEVTOOLS_FORBIDDEN_PATH], + }, + ], + invalid: [ + { + code: 'require("devtools/forbidden/path")', + errors: requirePathError("devtools/forbidden/path"), + options: [DEVTOOLS_FORBIDDEN_PATH], + }, + { + code: 'require("resource://devtools/forbidden/path")', + errors: requirePathError("resource://devtools/forbidden/path"), + options: [DEVTOOLS_FORBIDDEN_PATH], + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-top-level-await.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-top-level-await.js new file mode 100644 index 0000000000..844af78643 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-top-level-await.js @@ -0,0 +1,36 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/reject-top-level-await"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ + parserOptions: { ecmaVersion: 13, sourceType: "module" }, +}); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, messageId) { + return { code, errors: [{ messageId: "rejectTopLevelAwait" }] }; +} + +ruleTester.run("reject-top-level-await", rule, { + valid: [ + "async() => { await bar() }", + "async() => { for await (let x of []) {} }", + ], + invalid: [ + invalidCode("await foo"), + invalidCode("{ await foo }"), + invalidCode("(await foo)"), + invalidCode("for await (let x of []) {}"), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/rejects-requires-await.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/rejects-requires-await.js new file mode 100644 index 0000000000..ea6273a8ee --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/rejects-requires-await.js @@ -0,0 +1,32 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/rejects-requires-await"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, messageId) { + return { code, errors: [{ messageId: "rejectRequiresAwait" }] }; +} + +ruleTester.run("reject-requires-await", rule, { + valid: [ + "async() => { await Assert.rejects(foo, /assertion/) }", + "async() => { await Assert.rejects(foo, /assertion/, 'msg') }", + ], + invalid: [ + invalidCode("Assert.rejects(foo)"), + invalidCode("Assert.rejects(foo, 'msg')"), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/use-cc-etc.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-cc-etc.js new file mode 100644 index 0000000000..935d42debb --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-cc-etc.js @@ -0,0 +1,60 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/use-cc-etc"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, originalName, newName, output) { + return { + code, + output, + errors: [ + { + message: `Use ${newName} rather than ${originalName}`, + type: "MemberExpression", + }, + ], + }; +} + +ruleTester.run("use-cc-etc", rule, { + valid: ["Components.Constructor();", "let x = Components.foo;"], + invalid: [ + invalidCode( + "let foo = Components.classes['bar'];", + "Components.classes", + "Cc", + "let foo = Cc['bar'];" + ), + invalidCode( + "let bar = Components.interfaces.bar;", + "Components.interfaces", + "Ci", + "let bar = Ci.bar;" + ), + invalidCode( + "Components.results.NS_ERROR_ILLEGAL_INPUT;", + "Components.results", + "Cr", + "Cr.NS_ERROR_ILLEGAL_INPUT;" + ), + invalidCode( + "Components.utils.reportError('fake');", + "Components.utils", + "Cu", + "Cu.reportError('fake');" + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/use-chromeutils-generateqi.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-chromeutils-generateqi.js new file mode 100644 index 0000000000..26c6b350bc --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-chromeutils-generateqi.js @@ -0,0 +1,81 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/use-chromeutils-generateqi"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function callError(message) { + return [{ message, type: "CallExpression" }]; +} +function error(message, type) { + return [{ message, type }]; +} + +const MSG_NO_JS_QUERY_INTERFACE = + "Please use ChromeUtils.generateQI rather than manually creating " + + "JavaScript QueryInterface functions"; + +const MSG_NO_XPCOMUTILS_GENERATEQI = + "Please use ChromeUtils.generateQI instead of XPCOMUtils.generateQI"; + +/* globals nsIFlug */ +function QueryInterface(iid) { + if ( + iid.equals(Ci.nsISupports) || + iid.equals(Ci.nsIMeh) || + iid.equals(nsIFlug) || + iid.equals(Ci.amIFoo) + ) { + return this; + } + throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE); +} + +ruleTester.run("use-chromeutils-generateqi", rule, { + valid: [ + `X.prototype.QueryInterface = ChromeUtils.generateQI(["nsIMeh"]);`, + `X.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIMeh"]) }`, + ], + invalid: [ + { + code: `X.prototype.QueryInterface = XPCOMUtils.generateQI(["nsIMeh"]);`, + output: `X.prototype.QueryInterface = ChromeUtils.generateQI(["nsIMeh"]);`, + errors: callError(MSG_NO_XPCOMUTILS_GENERATEQI), + }, + { + code: `X.prototype = { QueryInterface: XPCOMUtils.generateQI(["nsIMeh"]) };`, + output: `X.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIMeh"]) };`, + errors: callError(MSG_NO_XPCOMUTILS_GENERATEQI), + }, + { + code: `X.prototype = { QueryInterface: ${QueryInterface} };`, + output: `X.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIMeh", "nsIFlug", "amIFoo"]) };`, + errors: error(MSG_NO_JS_QUERY_INTERFACE, "Property"), + }, + { + code: `X.prototype = { ${String(QueryInterface).replace( + /^function /, + "" + )} };`, + output: `X.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIMeh", "nsIFlug", "amIFoo"]) };`, + errors: error(MSG_NO_JS_QUERY_INTERFACE, "Property"), + }, + { + code: `X.prototype.QueryInterface = ${QueryInterface};`, + output: `X.prototype.QueryInterface = ChromeUtils.generateQI(["nsIMeh", "nsIFlug", "amIFoo"]);`, + errors: error(MSG_NO_JS_QUERY_INTERFACE, "AssignmentExpression"), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/use-chromeutils-import.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-chromeutils-import.js new file mode 100644 index 0000000000..92b8aaa360 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-chromeutils-import.js @@ -0,0 +1,70 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/use-chromeutils-import"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function callError(message) { + return [{ message, type: "CallExpression" }]; +} + +const MESSAGE_IMPORT = "Please use ChromeUtils.import instead of Cu.import"; +const MESSAGE_DEFINE = + "Please use ChromeUtils.defineModuleGetter instead of " + + "XPCOMUtils.defineLazyModuleGetter"; + +ruleTester.run("use-chromeutils-import", rule, { + valid: [ + `ChromeUtils.import("resource://gre/modules/AppConstants.jsm");`, + `ChromeUtils.import("resource://gre/modules/AppConstants.jsm", this);`, + `ChromeUtils.defineModuleGetter(this, "AppConstants", + "resource://gre/modules/AppConstants.jsm");`, + `XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", + "resource://gre/modules/AppConstants.jsm", + "Foo");`, + `XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", + "resource://gre/modules/AppConstants.jsm", + undefined, preAppConstantsLambda);`, + ], + invalid: [ + { + code: `Cu.import("resource://gre/modules/AppConstants.jsm");`, + output: `ChromeUtils.import("resource://gre/modules/AppConstants.jsm");`, + errors: callError(MESSAGE_IMPORT), + }, + { + code: `Cu.import("resource://gre/modules/AppConstants.jsm", this);`, + output: `ChromeUtils.import("resource://gre/modules/AppConstants.jsm", this);`, + errors: callError(MESSAGE_IMPORT), + }, + { + code: `Components.utils.import("resource://gre/modules/AppConstants.jsm");`, + output: `ChromeUtils.import("resource://gre/modules/AppConstants.jsm");`, + errors: callError(MESSAGE_IMPORT), + }, + { + code: `Components.utils.import("resource://gre/modules/AppConstants.jsm");`, + output: `ChromeUtils.import("resource://gre/modules/AppConstants.jsm");`, + errors: callError(MESSAGE_IMPORT), + }, + { + code: `XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", + "resource://gre/modules/AppConstants.jsm");`, + output: `ChromeUtils.defineModuleGetter(this, "AppConstants", + "resource://gre/modules/AppConstants.jsm");`, + errors: callError(MESSAGE_DEFINE), + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/use-default-preference-values.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-default-preference-values.js new file mode 100644 index 0000000000..f4ad001a08 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-default-preference-values.js @@ -0,0 +1,41 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/use-default-preference-values"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code) { + let message = "provide a default value instead of using a try/catch block"; + return { code, errors: [{ message, type: "TryStatement" }] }; +} + +let types = ["Bool", "Char", "Float", "Int"]; +let methods = types.map(type => "get" + type + "Pref"); + +ruleTester.run("use-default-preference-values", rule, { + valid: [].concat( + methods.map(m => "blah = branch." + m + "('blah', true);"), + methods.map(m => "blah = branch." + m + "('blah');"), + methods.map( + m => "try { canThrow(); blah = branch." + m + "('blah'); } catch(e) {}" + ) + ), + + invalid: [].concat( + methods.map(m => + invalidCode("try { blah = branch." + m + "('blah'); } catch(e) {}") + ) + ), +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/use-includes-instead-of-indexOf.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-includes-instead-of-indexOf.js new file mode 100644 index 0000000000..cb1810b305 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-includes-instead-of-indexOf.js @@ -0,0 +1,38 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/use-includes-instead-of-indexOf"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code) { + let message = "use .includes instead of .indexOf"; + return { code, errors: [{ message, type: "BinaryExpression" }] }; +} + +ruleTester.run("use-includes-instead-of-indexOf", rule, { + valid: [ + "let a = foo.includes(bar);", + "let a = foo.indexOf(bar) > 0;", + "let a = foo.indexOf(bar) != 0;", + ], + invalid: [ + invalidCode("let a = foo.indexOf(bar) >= 0;"), + invalidCode("let a = foo.indexOf(bar) != -1;"), + invalidCode("let a = foo.indexOf(bar) !== -1;"), + invalidCode("let a = foo.indexOf(bar) == -1;"), + invalidCode("let a = foo.indexOf(bar) === -1;"), + invalidCode("let a = foo.indexOf(bar) < 0;"), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/use-isInstance.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-isInstance.js new file mode 100644 index 0000000000..7e7b423484 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-isInstance.js @@ -0,0 +1,130 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/use-isInstance"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +const errors = [ + { + message: + "Please prefer .isInstance() in chrome scripts over the standard instanceof operator for DOM interfaces, " + + "since the latter will return false when the object is created from a different context.", + type: "BinaryExpression", + }, +]; + +const env = { browser: true }; + +/** + * A test case boilerplate simulating chrome privileged script. + * @param {string} code + */ +function mockChromeScript(code) { + return { + code, + filename: "foo.sys.mjs", + env, + }; +} + +/** + * A test case boilerplate simulating content script. + * @param {string} code + */ +function mockContentScript(code) { + return { + code, + filename: "foo.js", + env, + }; +} + +ruleTester.run("use-isInstance", rule, { + valid: [ + mockChromeScript("(() => {}) instanceof Function;"), + mockChromeScript("({}) instanceof Object;"), + mockChromeScript("Node instanceof Object;"), + mockChromeScript("node instanceof lazy.Node;"), + mockChromeScript("var Node;node instanceof Node;"), + mockChromeScript("file instanceof lazy.File;"), + mockChromeScript("file instanceof OS.File;"), + mockChromeScript("file instanceof OS.File.Error;"), + mockChromeScript("file instanceof lazy.OS.File;"), + mockChromeScript("file instanceof lazy.OS.File.Error;"), + mockChromeScript("file instanceof lazy.lazy.OS.File;"), + mockChromeScript("var File;file instanceof File;"), + mockChromeScript("foo instanceof RandomGlobalThing;"), + mockChromeScript("foo instanceof lazy.RandomGlobalThing;"), + mockContentScript("node instanceof Node;"), + mockContentScript("file instanceof File;"), + mockContentScript( + "SpecialPowers.ChromeUtils.import(''); file instanceof File;" + ), + ], + invalid: [ + { + code: "node instanceof Node", + output: "Node.isInstance(node)", + env, + errors, + filename: "foo.sys.mjs", + }, + { + code: "text instanceof win.Text", + output: "win.Text.isInstance(text)", + errors, + filename: "foo.sys.mjs", + }, + { + code: "target instanceof this.contentWindow.HTMLAudioElement", + output: "this.contentWindow.HTMLAudioElement.isInstance(target)", + errors, + filename: "foo.sys.mjs", + }, + { + code: "target instanceof File", + output: "File.isInstance(target)", + env, + errors, + filename: "foo.sys.mjs", + }, + { + code: "target instanceof win.File", + output: "win.File.isInstance(target)", + errors, + filename: "foo.sys.mjs", + }, + { + code: "window.arguments[0] instanceof window.XULElement", + output: "window.XULElement.isInstance(window.arguments[0])", + errors, + filename: "foo.sys.mjs", + }, + { + code: "ChromeUtils.import(''); node instanceof Node", + output: "ChromeUtils.import(''); Node.isInstance(node)", + env, + errors, + filename: "foo.js", + }, + { + code: "ChromeUtils.import(''); file instanceof File", + output: "ChromeUtils.import(''); File.isInstance(file)", + env, + errors, + filename: "foo.js", + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/use-ownerGlobal.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-ownerGlobal.js new file mode 100644 index 0000000000..b08bdf1632 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-ownerGlobal.js @@ -0,0 +1,35 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/use-ownerGlobal"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code) { + let message = "use .ownerGlobal instead of .ownerDocument.defaultView"; + return { code, errors: [{ message, type: "MemberExpression" }] }; +} + +ruleTester.run("use-ownerGlobal", rule, { + valid: [ + "aEvent.target.ownerGlobal;", + "this.DOMPointNode.ownerGlobal.getSelection();", + "windowToMessageManager(node.ownerGlobal);", + ], + invalid: [ + invalidCode("aEvent.target.ownerDocument.defaultView;"), + invalidCode("this.DOMPointNode.ownerDocument.defaultView.getSelection();"), + invalidCode("windowToMessageManager(node.ownerDocument.defaultView);"), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/use-returnValue.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-returnValue.js new file mode 100644 index 0000000000..81952452e4 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-returnValue.js @@ -0,0 +1,39 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/use-returnValue"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, methodName) { + let message = `{Array/String}.${methodName} doesn't modify the instance in-place`; + return { code, errors: [{ message, type: "ExpressionStatement" }] }; +} + +ruleTester.run("use-returnValue", rule, { + valid: [ + "a = foo.concat(bar)", + "b = bar.concat([1,3,4])", + "c = baz.concat()", + "d = qux.join(' ')", + "e = quux.slice(1)", + ], + invalid: [ + invalidCode("foo.concat(bar)", "concat"), + invalidCode("bar.concat([1,3,4])", "concat"), + invalidCode("baz.concat()", "concat"), + invalidCode("qux.join(' ')", "join"), + invalidCode("quux.slice(1)", "slice"), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/use-services.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-services.js new file mode 100644 index 0000000000..4c8a6359dd --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-services.js @@ -0,0 +1,60 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/use-services"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, name, replaces, type = "CallExpression") { + let message = `Use Services.${name} rather than ${replaces}.`; + return { code, errors: [{ message, type }] }; +} + +ruleTester.run("use-services", rule, { + valid: [ + 'Cc["@mozilla.org/fakeservice;1"].getService(Ci.nsIFake)', + 'Components.classes["@mozilla.org/fakeservice;1"].getService(Components.interfaces.nsIFake)', + "Services.wm.addListener()", + ], + invalid: [ + invalidCode( + 'Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);', + "wm", + "getService()" + ), + invalidCode( + 'Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(Components.interfaces.nsIAppStartup);', + "startup", + "getService()" + ), + invalidCode( + `XPCOMUtils.defineLazyServiceGetters(this, { + uuidGen: ["@mozilla.org/uuid-generator;1", "nsIUUIDGenerator"], + });`, + "uuid", + "defineLazyServiceGetters", + "ArrayExpression" + ), + invalidCode( + `XPCOMUtils.defineLazyServiceGetter( + this, + "gELS", + "@mozilla.org/eventlistenerservice;1", + "nsIEventListenerService" + );`, + "els", + "defineLazyServiceGetter" + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/use-static-import.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-static-import.js new file mode 100644 index 0000000000..e4d28861ad --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-static-import.js @@ -0,0 +1,88 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/use-static-import"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ + parserOptions: { ecmaVersion: 13, sourceType: "module" }, +}); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function callError() { + return [{ messageId: "useStaticImport", type: "VariableDeclaration" }]; +} + +ruleTester.run("use-static-import", rule, { + valid: [ + { + // Already converted, no issues. + code: + 'import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";', + filename: "test.sys.mjs", + }, + { + // Inside an if statement. + code: + 'if (foo) { const { XPCOMUtils } = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs") }', + filename: "test.sys.mjs", + }, + { + // Inside a function. + code: + 'function foo() { const { XPCOMUtils } = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs") }', + filename: "test.sys.mjs", + }, + { + // importESModule with two args cannot be converted. + code: + 'const { f } = ChromeUtils.importESModule("some/module.sys.mjs", { loadInDevToolsLoader : true });', + filename: "test.sys.mjs", + }, + { + // A non-system file attempting to import a system file should not be + // converted. + code: + 'const { XPCOMUtils } = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs")', + filename: "test.mjs", + }, + ], + invalid: [ + { + // Simple import in system module should be converted. + code: + 'const { XPCOMUtils } = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs")', + errors: callError(), + filename: "test.sys.mjs", + output: + 'import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"', + }, + { + // Should handle rewritten variables as well. + code: + 'const { XPCOMUtils: foo } = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs")', + errors: callError(), + filename: "test.sys.mjs", + output: + 'import { XPCOMUtils as foo } from "resource://gre/modules/XPCOMUtils.sys.mjs"', + }, + { + // Should handle multiple variables. + code: + 'const { foo, XPCOMUtils } = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs")', + errors: callError(), + filename: "test.sys.mjs", + output: + 'import { foo, XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"', + }, + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-ci-uses.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-ci-uses.js new file mode 100644 index 0000000000..e351711944 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-ci-uses.js @@ -0,0 +1,58 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var os = require("os"); +var rule = require("../lib/rules/valid-ci-uses"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 13 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, messageId, data) { + return { code, errors: [{ messageId, data }] }; +} + +process.env.MOZ_XPT_ARTIFACTS_DIR = `${__dirname}/xpidl`; + +const tests = { + valid: ["Ci.nsIURIFixup", "Ci.nsIURIFixup.FIXUP_FLAG_NONE"], + invalid: [ + invalidCode("Ci.nsIURIFixup.UNKNOWN_CONSTANT", "unknownProperty", { + interface: "nsIURIFixup", + property: "UNKNOWN_CONSTANT", + }), + invalidCode("Ci.nsIFoo", "unknownInterface", { + interface: "nsIFoo", + }), + ], +}; + +// For ESLint tests, we only have a couple of xpt examples in the xpidl directory. +// Therefore we can pretend that these interfaces no longer exist. +switch (os.platform) { + case "windows": + tests.invalid.push( + invalidCode("Ci.nsIJumpListShortcut", "missingInterface") + ); + break; + case "darwin": + tests.invalid.push( + invalidCode("Ci.nsIMacShellService", "missingInterface") + ); + break; + case "linux": + tests.invalid.push( + invalidCode("Ci.mozISandboxReporter", "missingInterface") + ); +} + +ruleTester.run("valid-ci-uses", rule, tests); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-lazy.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-lazy.js new file mode 100644 index 0000000000..6e207584fa --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-lazy.js @@ -0,0 +1,151 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/valid-lazy"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 13 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, name, messageId) { + return { code, errors: [{ messageId, data: { name } }] }; +} + +ruleTester.run("valid-lazy", rule, { + // Note: these tests build on top of one another, although lazy gets + // re-declared, it + valid: [ + ` + const lazy = {}; + XPCOMUtils.defineLazyGetter(lazy, "foo", () => {}); + if (x) { lazy.foo.bar(); } + `, + ` + const lazy = {}; + XPCOMUtils.defineLazyModuleGetters(lazy, { + foo: "foo.jsm", + }); + if (x) { lazy.foo.bar(); } + `, + ` + const lazy = {}; + ChromeUtils.defineESModuleGetters(lazy, { + foo: "foo.mjs", + }); + if (x) { lazy.foo.bar(); } + `, + ` + const lazy = {}; + Integration.downloads.defineESModuleGetter(lazy, "foo", "foo.sys.mjs"); + if (x) { lazy.foo.bar(); } + `, + ` + const lazy = createLazyLoaders({ foo: () => {}}); + if (x) { lazy.foo.bar(); } + `, + ` + const lazy = {}; + loader.lazyRequireGetter( + lazy, + ["foo1", "foo2"], + "bar", + true + ); + if (x) { + lazy.foo1.bar(); + lazy.foo2.bar(); + } + `, + // Test for top-level unconditional. + ` + const lazy = {}; + XPCOMUtils.defineLazyGetter(lazy, "foo", () => {}); + if (x) { lazy.foo.bar(); } + for (;;) { lazy.foo.bar(); } + for (var x in y) { lazy.foo.bar(); } + for (var x of y) { lazy.foo.bar(); } + while (true) { lazy.foo.bar(); } + do { lazy.foo.bar(); } while (true); + switch (x) { case 1: lazy.foo.bar(); } + try { lazy.foo.bar(); } catch (e) {} + function f() { lazy.foo.bar(); } + (function f() { lazy.foo.bar(); }); + () => { lazy.foo.bar(); }; + class C { + constructor() { lazy.foo.bar(); } + foo() { lazy.foo.bar(); } + get x() { lazy.foo.bar(); } + set x(v) { lazy.foo.bar(); } + a = lazy.foo.bar(); + #b = lazy.foo.bar(); + static { + lazy.foo.bar(); + } + } + a && lazy.foo.bar(); + a || lazy.foo.bar(); + a ?? lazy.foo.bar(); + a ? lazy.foo.bar() : b; + a?.b[lazy.foo.bar()]; + a ||= lazy.foo.bar(); + a &&= lazy.foo.bar(); + a ??= lazy.foo.bar(); + var { x = lazy.foo.bar() } = {}; + var [ y = lazy.foo.bar() ] = []; + `, + ], + invalid: [ + invalidCode("if (x) { lazy.bar; }", "bar", "unknownProperty"), + invalidCode( + ` + const lazy = {}; + XPCOMUtils.defineLazyGetter(lazy, "foo", "foo.jsm"); + XPCOMUtils.defineLazyGetter(lazy, "foo", "foo1.jsm"); + if (x) { lazy.foo.bar(); } + `, + "foo", + "duplicateSymbol" + ), + invalidCode( + ` + const lazy = {}; + XPCOMUtils.defineLazyModuleGetters(lazy, { + "foo-bar": "foo.jsm", + }); + if (x) { lazy["foo-bar"].bar(); } + `, + "foo-bar", + "incorrectType" + ), + invalidCode( + `const lazy = {}; + XPCOMUtils.defineLazyGetter(lazy, "foo", "foo.jsm"); + `, + "foo", + "unusedProperty" + ), + invalidCode( + `const lazy = {}; + XPCOMUtils.defineLazyGetter(lazy, "foo1", () => {}); + lazy.foo1.bar();`, + "foo1", + "topLevelAndUnconditional" + ), + invalidCode( + `const lazy = {}; + XPCOMUtils.defineLazyGetter(lazy, "foo1", () => {}); + { x = -f(1 + lazy.foo1.bar()); }`, + "foo1", + "topLevelAndUnconditional" + ), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-services-property.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-services-property.js new file mode 100644 index 0000000000..005393f431 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-services-property.js @@ -0,0 +1,42 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/valid-services-property"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 13 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, messageId, data) { + return { code, errors: [{ messageId, data }] }; +} + +process.env.MOZ_XPT_ARTIFACTS_DIR = `${__dirname}/xpidl`; + +ruleTester.run("valid-services-property", rule, { + valid: [ + "Services.uriFixup.keywordToURI()", + "Services.uriFixup.FIXUP_FLAG_NONE", + ], + invalid: [ + invalidCode("Services.uriFixup.UNKNOWN_CONSTANT", "unknownProperty", { + alias: "uriFixup", + propertyName: "UNKNOWN_CONSTANT", + checkedInterfaces: ["nsIURIFixup"], + }), + invalidCode("Services.uriFixup.foo()", "unknownProperty", { + alias: "uriFixup", + propertyName: "foo", + checkedInterfaces: ["nsIURIFixup"], + }), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-services.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-services.js new file mode 100644 index 0000000000..7a2c192b93 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/valid-services.js @@ -0,0 +1,33 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +var rule = require("../lib/rules/valid-services"); +var RuleTester = require("eslint").RuleTester; + +const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6 } }); + +// ------------------------------------------------------------------------------ +// Tests +// ------------------------------------------------------------------------------ + +function invalidCode(code, name) { + let message = `Unknown Services member property ${name}`; + return { code, errors: [{ message }] }; +} + +ruleTester.run("valid-services", rule, { + valid: ["Services.crashmanager", "lazy.Services.crashmanager"], + invalid: [ + invalidCode("Services.foo", "foo"), + invalidCode("Services.foo()", "foo"), + invalidCode("lazy.Services.foo", "foo"), + invalidCode("Services.foo.bar()", "foo"), + invalidCode("lazy.Services.foo.bar()", "foo"), + ], +}); diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/xpidl/docshell.xpt b/tools/lint/eslint/eslint-plugin-mozilla/tests/xpidl/docshell.xpt new file mode 100644 index 0000000000..abb593296b --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/xpidl/docshell.xpt @@ -0,0 +1,6077 @@ +[ + { + "consts": [ + { + "name": "ePrompt", + "type": { + "tag": "TD_UINT8" + }, + "value": 0 + }, + { + "name": "eDontPromptAndDontUnload", + "type": { + "tag": "TD_UINT8" + }, + "value": 1 + }, + { + "name": "eDontPromptAndUnload", + "type": { + "tag": "TD_UINT8" + }, + "value": 2 + }, + { + "name": "eAllowNavigation", + "type": { + "tag": "TD_UINT8" + }, + "value": 0 + }, + { + "name": "eRequestBlockNavigation", + "type": { + "tag": "TD_UINT8" + }, + "value": 1 + }, + { + "name": "eDelayResize", + "type": { + "tag": "TD_UINT32" + }, + "value": 1 + } + ], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [ + "hidden" + ], + "name": "init", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "container", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIDocShell", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "container", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIDocShell", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "loadStart", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "headerFile": "mozilla/dom/Document.h", + "name": "Document", + "native": "mozilla::dom::Document", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [], + "name": "loadComplete", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hidden", + "hasretval" + ], + "name": "loadCompleted", + "params": [] + }, + { + "flags": [ + "getter", + "hidden", + "hasretval" + ], + "name": "isStopped", + "params": [] + }, + { + "flags": [ + "hasretval" + ], + "name": "permitUnload", + "params": [ + { + "flags": [ + "in", + "optional" + ], + "type": { + "tag": "TD_UINT8" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "inPermitUnload", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "dispatchBeforeUnload", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "beforeUnloadFiring", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "pageHide", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "close", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsISHEntry", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "destroy", + "params": [] + }, + { + "flags": [], + "name": "stop", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "DOMDocument", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "headerFile": "mozilla/dom/Document.h", + "name": "Document", + "native": "mozilla::dom::Document", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getDocument", + "params": [] + }, + { + "flags": [ + "hidden" + ], + "name": "setDocument", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "headerFile": "mozilla/dom/Document.h", + "name": "Document", + "native": "mozilla::dom::Document", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getBounds", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "setBounds", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "setBoundsWithFlags", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hidden", + "hasretval" + ], + "name": "previousViewer", + "params": [] + }, + { + "flags": [ + "setter", + "hidden" + ], + "name": "previousViewer", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIContentViewer", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "move", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "show", + "params": [] + }, + { + "flags": [], + "name": "hide", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "sticky", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "sticky", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "open", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsISHEntry", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "clearHistoryEntry", + "params": [] + }, + { + "flags": [], + "name": "setPageModeForTesting", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIPrintSettings", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "setPrintSettingsForSubdocument", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIPrintSettings", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "historyEntry", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsISHEntry", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isTabModalPromptAllowed", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isHidden", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "isHidden", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hidden", + "hasretval" + ], + "name": "presShell", + "params": [] + }, + { + "flags": [ + "getter", + "hidden", + "hasretval" + ], + "name": "presContext", + "params": [] + }, + { + "flags": [ + "hidden" + ], + "name": "setDocumentInternal", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "headerFile": "mozilla/dom/Document.h", + "name": "Document", + "native": "mozilla::dom::Document", + "tag": "TD_DOMOBJECT" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "findContainerView", + "params": [] + }, + { + "flags": [ + "hidden" + ], + "name": "setNavigationTiming", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "deviceFullZoomForTest", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_FLOAT" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "authorStyleDisabled", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "authorStyleDisabled", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "getContentSize", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "getContentSizeConstrained", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getReloadEncodingAndSource", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "setReloadEncodingAndSource", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "forgetReloadEncoding", + "params": [] + } + ], + "name": "nsIContentViewer", + "parent": "nsISupports", + "uuid": "2da17016-7851-4a45-a7a8-00b360e01595" + }, + { + "consts": [ + { + "name": "COPY_IMAGE_TEXT", + "type": { + "tag": "TD_INT32" + }, + "value": 1 + }, + { + "name": "COPY_IMAGE_HTML", + "type": { + "tag": "TD_INT32" + }, + "value": 2 + }, + { + "name": "COPY_IMAGE_DATA", + "type": { + "tag": "TD_INT32" + }, + "value": 4 + }, + { + "name": "COPY_IMAGE_ALL", + "type": { + "tag": "TD_INT32" + }, + "value": -1 + } + ], + "flags": [], + "methods": [ + { + "flags": [], + "name": "clearSelection", + "params": [] + }, + { + "flags": [], + "name": "selectAll", + "params": [] + }, + { + "flags": [], + "name": "copySelection", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "copyable", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "copyLinkLocation", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "inLink", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "copyImage", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "inImage", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "getContents", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "canGetContents", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "setCommandNode", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "headerFile": "nsIContent.h", + "name": "Node", + "native": "nsINode", + "tag": "TD_DOMOBJECT" + } + } + ] + } + ], + "name": "nsIContentViewerEdit", + "parent": "nsISupports", + "uuid": "35be2d7e-f29b-48ec-bf7e-80a30a724de3" + }, + { + "consts": [ + { + "name": "ENUMERATE_FORWARDS", + "type": { + "tag": "TD_UINT8" + }, + "value": 0 + }, + { + "name": "ENUMERATE_BACKWARDS", + "type": { + "tag": "TD_UINT8" + }, + "value": 1 + }, + { + "name": "APP_TYPE_UNKNOWN", + "type": { + "tag": "TD_UINT8" + }, + "value": 0 + }, + { + "name": "APP_TYPE_MAIL", + "type": { + "tag": "TD_UINT8" + }, + "value": 1 + }, + { + "name": "APP_TYPE_EDITOR", + "type": { + "tag": "TD_UINT8" + }, + "value": 2 + }, + { + "name": "BUSY_FLAGS_NONE", + "type": { + "tag": "TD_UINT8" + }, + "value": 0 + }, + { + "name": "BUSY_FLAGS_BUSY", + "type": { + "tag": "TD_UINT8" + }, + "value": 1 + }, + { + "name": "BUSY_FLAGS_BEFORE_PAGE_LOAD", + "type": { + "tag": "TD_UINT8" + }, + "value": 2 + }, + { + "name": "BUSY_FLAGS_PAGE_LOADING", + "type": { + "tag": "TD_UINT8" + }, + "value": 4 + }, + { + "name": "LOAD_CMD_NORMAL", + "type": { + "tag": "TD_UINT8" + }, + "value": 1 + }, + { + "name": "LOAD_CMD_RELOAD", + "type": { + "tag": "TD_UINT8" + }, + "value": 2 + }, + { + "name": "LOAD_CMD_HISTORY", + "type": { + "tag": "TD_UINT8" + }, + "value": 4 + }, + { + "name": "LOAD_CMD_PUSHSTATE", + "type": { + "tag": "TD_UINT8" + }, + "value": 8 + }, + { + "name": "META_VIEWPORT_OVERRIDE_DISABLED", + "type": { + "tag": "TD_UINT8" + }, + "value": 0 + }, + { + "name": "META_VIEWPORT_OVERRIDE_ENABLED", + "type": { + "tag": "TD_UINT8" + }, + "value": 1 + }, + { + "name": "META_VIEWPORT_OVERRIDE_NONE", + "type": { + "tag": "TD_UINT8" + }, + "value": 2 + } + ], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [], + "name": "setCancelContentJSEpoch", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "loadURI", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "jscontext" + ], + "name": "addState", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_JSVAL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "prepareForNewContentModel", + "params": [] + }, + { + "flags": [], + "name": "setCurrentURIForSessionStore", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "firePageHideNotification", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hidden", + "hasretval" + ], + "name": "presContext", + "params": [] + }, + { + "flags": [ + "getter", + "hidden", + "hasretval" + ], + "name": "presShell", + "params": [] + }, + { + "flags": [ + "getter", + "hidden", + "hasretval" + ], + "name": "eldestPresShell", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "contentViewer", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIContentViewer", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "outerWindowID", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UINT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "chromeEventHandler", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "headerFile": "mozilla/dom/EventTarget.h", + "name": "EventTarget", + "native": "mozilla::dom::EventTarget", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "chromeEventHandler", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "headerFile": "mozilla/dom/EventTarget.h", + "name": "EventTarget", + "native": "mozilla::dom::EventTarget", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "customUserAgent", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "customUserAgent", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "cssErrorReportingEnabled", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "cssErrorReportingEnabled", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "allowPlugins", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "allowPlugins", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "allowMetaRedirects", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "allowMetaRedirects", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "allowSubframes", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "allowSubframes", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "allowImages", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "allowImages", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "allowMedia", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "allowMedia", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "allowDNSPrefetch", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "allowDNSPrefetch", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "allowWindowControl", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "allowWindowControl", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "allowContentRetargeting", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "allowContentRetargeting", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "allowContentRetargetingOnChildren", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "allowContentRetargetingOnChildren", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "getAllDocShellsInSubtree", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT8" + } + }, + { + "flags": [ + "out" + ], + "type": { + "element": { + "name": "nsIDocShell", + "tag": "TD_INTERFACE_TYPE" + }, + "tag": "TD_ARRAY" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "appType", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UINT8" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "appType", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT8" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "allowAuth", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "allowAuth", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "zoom", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_FLOAT" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "zoom", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_FLOAT" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "tabToTreeOwner", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "busyFlags", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UINT8" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "loadType", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "loadType", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "defaultLoadFlags", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "defaultLoadFlags", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "isBeingDestroyed", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isExecutingOnLoadHandler", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "layoutHistoryState", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsILayoutHistoryState", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "layoutHistoryState", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsILayoutHistoryState", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "loadURIDelegate", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsILoadURIDelegate", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "suspendRefreshURIs", + "params": [] + }, + { + "flags": [], + "name": "resumeRefreshURIs", + "params": [] + }, + { + "flags": [], + "name": "beginRestore", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIContentViewer", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "finishRestore", + "params": [] + }, + { + "flags": [], + "name": "clearCachedUserAgent", + "params": [] + }, + { + "flags": [], + "name": "clearCachedPlatform", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "restoringDocument", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "useErrorPages", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "useErrorPages", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "displayLoadError", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PWSTRING" + } + }, + { + "flags": [ + "in", + "optional" + ], + "type": { + "name": "nsIChannel", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "failedChannel", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIChannel", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "previousEntryIndex", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "loadedEntryIndex", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "historyPurged", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "currentDocumentChannel", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIChannel", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isInUnload", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "DetachEditorFromWindow", + "params": [] + }, + { + "flags": [], + "name": "exitPrintPreview", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "historyID", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_NSID" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "HistoryID", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isAppTab", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "isAppTab", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "createAboutBlankContentViewer", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIPrincipal", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIPrincipal", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in", + "optional" + ], + "type": { + "name": "nsIContentSecurityPolicy", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "charset", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_CSTRING" + } + } + ] + }, + { + "flags": [], + "name": "forceEncodingDetection", + "params": [] + }, + { + "flags": [ + "hidden" + ], + "name": "setParentCharset", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIPrincipal", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getParentCharset", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "out" + ], + "type": { + "name": "nsIPrincipal", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "recordProfileTimelineMarkers", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "recordProfileTimelineMarkers", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "now", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_DOUBLE" + } + } + ] + }, + { + "flags": [ + "jscontext", + "hasretval" + ], + "name": "popProfileTimelineMarkers", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_JSVAL" + } + } + ] + }, + { + "flags": [], + "name": "addWeakPrivacyTransitionObserver", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIPrivacyTransitionObserver", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "addWeakReflowObserver", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIReflowObserver", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "removeWeakReflowObserver", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIReflowObserver", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "notifyReflowObservers", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_DOUBLE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_DOUBLE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "addWeakScrollObserver", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIScrollObserver", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "removeWeakScrollObserver", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIScrollObserver", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "notifyScrollObservers", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isTopLevelContentDocShell", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "getSameTypeInProcessParentIgnoreBrowserBoundaries", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIDocShell", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "asyncPanZoomEnabled", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "pluginsAllowedInCurrentDoc", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "mayEnableCharacterEncodingMenu", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "editor", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIEditor", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "editor", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIEditor", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "editable", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "hasEditingSession", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "makeEditable", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "getCurrentSHEntry", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsISHEntry", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "isCommandEnabled", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "doCommand", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + } + ] + }, + { + "flags": [], + "name": "doCommandWithParams", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsICommandParams", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "IsInvisible", + "params": [] + }, + { + "flags": [ + "hidden" + ], + "name": "SetInvisible", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "GetScriptGlobalObject", + "params": [] + }, + { + "flags": [ + "hidden" + ], + "name": "getExtantDocument", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "deviceSizeIsPageSize", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "deviceSizeIsPageSize", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "notifyJSRunToCompletionStart", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_JSVAL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "notifyJSRunToCompletionStop", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "hasLoadedNonBlankURI", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "windowDraggingAllowed", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "windowDraggingAllowed", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "currentScrollRestorationIsManual", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "currentScrollRestorationIsManual", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "jscontext", + "hasretval" + ], + "name": "getOriginAttributes", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_JSVAL" + } + } + ] + }, + { + "flags": [ + "jscontext" + ], + "name": "setOriginAttributes", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_JSVAL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "editingSession", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIEditingSession", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "browserChild", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIBrowserChild", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "GetBrowserChild", + "params": [] + }, + { + "flags": [ + "hidden" + ], + "name": "GetCommandManager", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "metaViewportOverride", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UINT8" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "metaViewportOverride", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT8" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "useTrackingProtection", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "useTrackingProtection", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "dispatchLocationChangeEvent", + "params": [] + }, + { + "flags": [ + "hidden" + ], + "name": "startDelayedAutoplayMediaComponents", + "params": [] + }, + { + "flags": [ + "hidden" + ], + "name": "TakeInitialClientSource", + "params": [] + }, + { + "flags": [], + "name": "setColorMatrix", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "element": { + "tag": "TD_FLOAT" + }, + "tag": "TD_ARRAY" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isForceReloading", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "getColorMatrix", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "element": { + "tag": "TD_FLOAT" + }, + "tag": "TD_ARRAY" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "messageManager", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "headerFile": "mozilla/dom/ContentFrameMessageManager.h", + "name": "ContentFrameMessageManager", + "native": "mozilla::dom::ContentFrameMessageManager", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "getHasTrackingContentBlocked", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_PROMISE" + } + } + ] + }, + { + "flags": [ + "getter", + "hidden", + "hasretval" + ], + "name": "isAttemptingToNavigate", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isNavigating", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "synchronizeLayoutHistoryState", + "params": [] + }, + { + "flags": [], + "name": "persistLayoutHistoryState", + "params": [] + } + ], + "name": "nsIDocShell", + "parent": "nsIDocShellTreeItem", + "uuid": "049234fe-da10-478b-bc5d-bc6f9a1ba63d" + }, + { + "consts": [ + { + "name": "typeChrome", + "type": { + "tag": "TD_INT32" + }, + "value": 0 + }, + { + "name": "typeContent", + "type": { + "tag": "TD_INT32" + }, + "value": 1 + }, + { + "name": "typeContentWrapper", + "type": { + "tag": "TD_INT32" + }, + "value": 2 + }, + { + "name": "typeChromeWrapper", + "type": { + "tag": "TD_INT32" + }, + "value": 3 + }, + { + "name": "typeAll", + "type": { + "tag": "TD_INT32" + }, + "value": 2147483647 + } + ], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [ + "getter", + "hasretval" + ], + "name": "name", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "name", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "nameEquals", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "itemType", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "ItemType", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "parent", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIDocShellTreeItem", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "sameTypeParent", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIDocShellTreeItem", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "rootTreeItem", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIDocShellTreeItem", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "sameTypeRootTreeItem", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIDocShellTreeItem", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "treeOwner", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIDocShellTreeOwner", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "setTreeOwner", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIDocShellTreeOwner", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "childCount", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "addChild", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIDocShellTreeItem", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "removeChild", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIDocShellTreeItem", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "getChildAt", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "out" + ], + "type": { + "name": "nsIDocShellTreeItem", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "browsingContext", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "headerFile": "mozilla/dom/BrowsingContext.h", + "name": "BrowsingContext", + "native": "mozilla::dom::BrowsingContext", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getBrowsingContext", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "domWindow", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "mozIDOMWindowProxy", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getDocument", + "params": [] + }, + { + "flags": [ + "hidden" + ], + "name": "getWindow", + "params": [] + } + ], + "name": "nsIDocShellTreeItem", + "parent": "nsISupports", + "uuid": "9b7c586f-9214-480c-a2c4-49b526fff1a6" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "contentShellAdded", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIDocShellTreeItem", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "contentShellRemoved", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIDocShellTreeItem", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "primaryContentShell", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIDocShellTreeItem", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "remoteTabAdded", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIRemoteTab", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "remoteTabRemoved", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIRemoteTab", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "primaryRemoteTab", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIRemoteTab", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "primaryContentBrowsingContext", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "headerFile": "mozilla/dom/BrowsingContext.h", + "name": "BrowsingContext", + "native": "mozilla::dom::BrowsingContext", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [], + "name": "sizeShellTo", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIDocShellTreeItem", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "getPrimaryContentSize", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "setPrimaryContentSize", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "getRootShellSize", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "setRootShellSize", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "setPersistence", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "getPersistence", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "tabCount", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "hasPrimaryContent", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + } + ], + "name": "nsIDocShellTreeOwner", + "parent": "nsISupports", + "uuid": "0e3dc4b1-4cea-4a37-af71-79f0afd07574" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "createInstance", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIChannel", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsILoadGroup", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIDocShell", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "out" + ], + "type": { + "name": "nsIStreamListener", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "out" + ], + "type": { + "name": "nsIContentViewer", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "createInstanceForDocument", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "headerFile": "mozilla/dom/Document.h", + "name": "Document", + "native": "mozilla::dom::Document", + "tag": "TD_DOMOBJECT" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "out" + ], + "type": { + "name": "nsIContentViewer", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + } + ], + "name": "nsIDocumentLoaderFactory", + "parent": "nsISupports", + "uuid": "e795239e-9d3c-47c4-b063-9e600fb3b287" + }, + { + "consts": [], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [ + "getter", + "hasretval" + ], + "name": "associatedWindow", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "mozIDOMWindowProxy", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "topWindow", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "mozIDOMWindowProxy", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "topFrameElement", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "headerFile": "mozilla/dom/Element.h", + "name": "Element", + "native": "mozilla::dom::Element", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isContent", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "usePrivateBrowsing", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "usePrivateBrowsing", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "useRemoteTabs", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "useRemoteSubframes", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "useTrackingProtection", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "useTrackingProtection", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "SetPrivateBrowsing", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "SetRemoteTabs", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "SetRemoteSubframes", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "jscontext", + "hasretval" + ], + "name": "originAttributes", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_JSVAL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "GetOriginAttributes", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + } + ], + "name": "nsILoadContext", + "parent": "nsISupports", + "uuid": "2813a7a3-d084-4d00-acd0-f76620315c02" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "loadURI", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT16" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIPrincipal", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "handleLoadError", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT16" + } + }, + { + "flags": [ + "out" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + } + ], + "name": "nsILoadURIDelegate", + "parent": "nsISupports", + "uuid": "78e42d37-a34c-4d96-b901-25385669aba4" + }, + { + "consts": [], + "flags": [ + "function" + ], + "methods": [ + { + "flags": [], + "name": "privateModeChanged", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + } + ], + "name": "nsIPrivacyTransitionObserver", + "parent": "nsISupports", + "uuid": "b4b1449d-0ef0-47f5-b62e-adc57fd49702" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "reflow", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_DOUBLE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_DOUBLE" + } + } + ] + }, + { + "flags": [], + "name": "reflowInterruptible", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_DOUBLE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_DOUBLE" + } + } + ] + } + ], + "name": "nsIReflowObserver", + "parent": "nsISupports", + "uuid": "832e692c-c4a6-11e2-8fd1-dce678957a39" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "refreshURI", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIPrincipal", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [], + "name": "forceRefreshURI", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIPrincipal", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [], + "name": "cancelRefreshURITimers", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "refreshPending", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + } + ], + "name": "nsIRefreshURI", + "parent": "nsISupports", + "uuid": "a5e61a3c-51bd-45be-ac0c-e87b71860656" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "onShowTooltip", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [], + "name": "onHideTooltip", + "params": [] + } + ], + "name": "nsITooltipListener", + "parent": "nsISupports", + "uuid": "44b78386-1dd2-11b2-9ad2-e4eee2ca1916" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "getNodeText", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "headerFile": "nsIContent.h", + "name": "Node", + "native": "nsINode", + "tag": "TD_DOMOBJECT" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_PWSTRING" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_PWSTRING" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + } + ], + "name": "nsITooltipTextProvider", + "parent": "nsISupports", + "uuid": "b128a1e6-44f3-4331-8fbe-5af360ff21ee" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "getter", + "hasretval" + ], + "name": "consumer", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "headerFile": "mozilla/dom/BrowsingContext.h", + "name": "BrowsingContext", + "native": "mozilla::dom::BrowsingContext", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "consumer", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "headerFile": "mozilla/dom/BrowsingContext.h", + "name": "BrowsingContext", + "native": "mozilla::dom::BrowsingContext", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "preferredURI", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "preferredURI", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "fixedURI", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "fixedURI", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "keywordProviderName", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "keywordProviderName", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "keywordAsSent", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "keywordAsSent", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "fixupChangedProtocol", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "fixupChangedProtocol", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "fixupCreatedAlternateURI", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "fixupCreatedAlternateURI", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "originalInput", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UTF8STRING" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "originalInput", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UTF8STRING" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "postData", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIInputStream", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "postData", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIInputStream", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + } + ], + "name": "nsIURIFixupInfo", + "parent": "nsISupports", + "uuid": "4819f183-b532-4932-ac09-b309cd853be7" + }, + { + "consts": [ + { + "name": "FIXUP_FLAG_NONE", + "type": { + "tag": "TD_UINT32" + }, + "value": 0 + }, + { + "name": "FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP", + "type": { + "tag": "TD_UINT32" + }, + "value": 1 + }, + { + "name": "FIXUP_FLAGS_MAKE_ALTERNATE_URI", + "type": { + "tag": "TD_UINT32" + }, + "value": 2 + }, + { + "name": "FIXUP_FLAG_PRIVATE_CONTEXT", + "type": { + "tag": "TD_UINT32" + }, + "value": 4 + }, + { + "name": "FIXUP_FLAG_FIX_SCHEME_TYPOS", + "type": { + "tag": "TD_UINT32" + }, + "value": 8 + }, + { + "name": "FIXUP_FLAG_FORCE_ALTERNATE_URI", + "type": { + "tag": "TD_UINT32" + }, + "value": 16 + } + ], + "flags": [], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "getFixupURIInfo", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UTF8STRING" + } + }, + { + "flags": [ + "in", + "optional" + ], + "type": { + "tag": "TD_UINT32" + } + }, + { + "flags": [ + "out" + ], + "type": { + "name": "nsIURIFixupInfo", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "webNavigationFlagsToFixupFlags", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UTF8STRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "keywordToURI", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UTF8STRING" + } + }, + { + "flags": [ + "in", + "optional" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "out" + ], + "type": { + "name": "nsIURIFixupInfo", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "forceHttpFixup", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UTF8STRING" + } + }, + { + "flags": [ + "out" + ], + "type": { + "name": "nsIURIFixupInfo", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "checkHost", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIDNSListener", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in", + "optional" + ], + "type": { + "tag": "TD_JSVAL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "isDomainKnown", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UTF8STRING" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + } + ], + "name": "nsIURIFixup", + "parent": "nsISupports", + "uuid": "1da7e9d4-620b-4949-849a-1cd6077b1b2d" + }, + { + "consts": [ + { + "name": "LOAD_FLAGS_MASK", + "type": { + "tag": "TD_UINT32" + }, + "value": 65535 + }, + { + "name": "LOAD_FLAGS_NONE", + "type": { + "tag": "TD_UINT32" + }, + "value": 0 + }, + { + "name": "LOAD_FLAGS_IS_REFRESH", + "type": { + "tag": "TD_UINT32" + }, + "value": 16 + }, + { + "name": "LOAD_FLAGS_IS_LINK", + "type": { + "tag": "TD_UINT32" + }, + "value": 32 + }, + { + "name": "LOAD_FLAGS_BYPASS_HISTORY", + "type": { + "tag": "TD_UINT32" + }, + "value": 64 + }, + { + "name": "LOAD_FLAGS_REPLACE_HISTORY", + "type": { + "tag": "TD_UINT32" + }, + "value": 128 + }, + { + "name": "LOAD_FLAGS_BYPASS_CACHE", + "type": { + "tag": "TD_UINT32" + }, + "value": 256 + }, + { + "name": "LOAD_FLAGS_BYPASS_PROXY", + "type": { + "tag": "TD_UINT32" + }, + "value": 512 + }, + { + "name": "LOAD_FLAGS_CHARSET_CHANGE", + "type": { + "tag": "TD_UINT32" + }, + "value": 1024 + }, + { + "name": "LOAD_FLAGS_STOP_CONTENT", + "type": { + "tag": "TD_UINT32" + }, + "value": 2048 + }, + { + "name": "LOAD_FLAGS_FROM_EXTERNAL", + "type": { + "tag": "TD_UINT32" + }, + "value": 4096 + }, + { + "name": "LOAD_FLAGS_FIRST_LOAD", + "type": { + "tag": "TD_UINT32" + }, + "value": 16384 + }, + { + "name": "LOAD_FLAGS_ALLOW_POPUPS", + "type": { + "tag": "TD_UINT32" + }, + "value": 32768 + }, + { + "name": "LOAD_FLAGS_BYPASS_CLASSIFIER", + "type": { + "tag": "TD_UINT32" + }, + "value": 65536 + }, + { + "name": "LOAD_FLAGS_FORCE_ALLOW_COOKIES", + "type": { + "tag": "TD_UINT32" + }, + "value": 131072 + }, + { + "name": "LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL", + "type": { + "tag": "TD_UINT32" + }, + "value": 262144 + }, + { + "name": "LOAD_FLAGS_ERROR_LOAD_CHANGES_RV", + "type": { + "tag": "TD_UINT32" + }, + "value": 524288 + }, + { + "name": "LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP", + "type": { + "tag": "TD_UINT32" + }, + "value": 1048576 + }, + { + "name": "LOAD_FLAGS_FIXUP_SCHEME_TYPOS", + "type": { + "tag": "TD_UINT32" + }, + "value": 2097152 + }, + { + "name": "LOAD_FLAGS_FORCE_ALLOW_DATA_URI", + "type": { + "tag": "TD_UINT32" + }, + "value": 4194304 + }, + { + "name": "LOAD_FLAGS_IS_REDIRECT", + "type": { + "tag": "TD_UINT32" + }, + "value": 8388608 + }, + { + "name": "LOAD_FLAGS_DISABLE_TRR", + "type": { + "tag": "TD_UINT32" + }, + "value": 16777216 + }, + { + "name": "LOAD_FLAGS_FORCE_TRR", + "type": { + "tag": "TD_UINT32" + }, + "value": 33554432 + }, + { + "name": "LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE", + "type": { + "tag": "TD_UINT32" + }, + "value": 67108864 + }, + { + "name": "LOAD_FLAGS_USER_ACTIVATION", + "type": { + "tag": "TD_UINT32" + }, + "value": 134217728 + }, + { + "name": "STOP_NETWORK", + "type": { + "tag": "TD_UINT32" + }, + "value": 1 + }, + { + "name": "STOP_CONTENT", + "type": { + "tag": "TD_UINT32" + }, + "value": 2 + }, + { + "name": "STOP_ALL", + "type": { + "tag": "TD_UINT32" + }, + "value": 3 + } + ], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [ + "getter", + "hasretval" + ], + "name": "canGoBack", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "canGoForward", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "goBack", + "params": [ + { + "flags": [ + "in", + "optional" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in", + "optional" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "goForward", + "params": [ + { + "flags": [ + "in", + "optional" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in", + "optional" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "gotoIndex", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in", + "optional" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "jscontext" + ], + "name": "loadURI", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_JSVAL" + } + } + ] + }, + { + "flags": [], + "name": "binaryLoadURI", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [], + "name": "reload", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [], + "name": "stop", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "document", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "headerFile": "mozilla/dom/Document.h", + "name": "Document", + "native": "mozilla::dom::Document", + "tag": "TD_DOMOBJECT" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "currentURI", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIURI", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "sessionHistory", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "resumeRedirectedLoad", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT64" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + } + ], + "name": "nsIWebNavigation", + "parent": "nsISupports", + "uuid": "3ade79d4-8cb9-4952-b18d-4f9b63ca0d31" + }, + { + "consts": [ + { + "name": "UNSUPPORTED", + "type": { + "tag": "TD_UINT32" + }, + "value": 0 + }, + { + "name": "IMAGE", + "type": { + "tag": "TD_UINT32" + }, + "value": 1 + }, + { + "name": "FALLBACK", + "type": { + "tag": "TD_UINT32" + }, + "value": 2 + }, + { + "name": "OTHER", + "type": { + "tag": "TD_UINT32" + }, + "value": 32768 + } + ], + "flags": [], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "isTypeSupported", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + } + ], + "name": "nsIWebNavigationInfo", + "parent": "nsISupports", + "uuid": "62a93afb-93a1-465c-84c8-0432264229de" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "loadPageAsViewSource", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIDocShell", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "currentDescriptor", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + } + ], + "name": "nsIWebPageDescriptor", + "parent": "nsISupports", + "uuid": "6f30b676-3710-4c2c-80b1-0395fb26516e" + } +] \ No newline at end of file diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/xpidl/xpcom_base.xpt b/tools/lint/eslint/eslint-plugin-mozilla/tests/xpidl/xpcom_base.xpt new file mode 100644 index 0000000000..943b2c8e87 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/xpidl/xpcom_base.xpt @@ -0,0 +1,3197 @@ +[ + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "unloadTabAsync", + "params": [] + } + ], + "name": "nsITabUnloader", + "parent": "nsISupports", + "uuid": "2e530956-6054-464f-9f4c-0ae6f8de5523" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "registerTabUnloader", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsITabUnloader", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "onUnloadAttemptCompleted", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + } + ], + "name": "nsIAvailableMemoryWatcherBase", + "parent": "nsISupports", + "uuid": "b0b5701e-239d-49db-9009-37e89f86441c" + }, + { + "consts": [], + "flags": [ + "function" + ], + "methods": [ + { + "flags": [], + "name": "observe", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIConsoleMessage", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + } + ], + "name": "nsIConsoleListener", + "parent": "nsISupports", + "uuid": "35c400a4-5792-438c-b915-65e30d58d557" + }, + { + "consts": [ + { + "name": "debug", + "type": { + "tag": "TD_UINT32" + }, + "value": 0 + }, + { + "name": "info", + "type": { + "tag": "TD_UINT32" + }, + "value": 1 + }, + { + "name": "warn", + "type": { + "tag": "TD_UINT32" + }, + "value": 2 + }, + { + "name": "error", + "type": { + "tag": "TD_UINT32" + }, + "value": 3 + } + ], + "flags": [], + "methods": [ + { + "flags": [ + "getter", + "hasretval" + ], + "name": "logLevel", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "timeStamp", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "microSecondTimeStamp", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "message", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isForwardedFromContentProcess", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "isForwardedFromContentProcess", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "toString", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UTF8STRING" + } + } + ] + } + ], + "name": "nsIConsoleMessage", + "parent": "nsISupports", + "uuid": "3aba9617-10e2-4839-83ae-2e6fc4df428b" + }, + { + "consts": [ + { + "name": "SuppressLog", + "type": { + "tag": "TD_UINT8" + }, + "value": 0 + }, + { + "name": "OutputToLog", + "type": { + "tag": "TD_UINT8" + }, + "value": 1 + } + ], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [], + "name": "logMessage", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIConsoleMessage", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "logMessageWithMode", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIConsoleMessage", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT8" + } + } + ] + }, + { + "flags": [], + "name": "logStringMessage", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PWSTRING" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "getMessageArray", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "element": { + "name": "nsIConsoleMessage", + "tag": "TD_INTERFACE_TYPE" + }, + "tag": "TD_ARRAY" + } + } + ] + }, + { + "flags": [], + "name": "registerListener", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIConsoleListener", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "unregisterListener", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIConsoleListener", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "reset", + "params": [] + }, + { + "flags": [], + "name": "resetWindow", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT64" + } + } + ] + } + ], + "name": "nsIConsoleService", + "parent": "nsISupports", + "uuid": "0eb81d20-c37e-42d4-82a8-ca9ae96bdf52" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "noteRefCountedObject", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + } + ] + }, + { + "flags": [], + "name": "noteGCedObject", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + } + ] + }, + { + "flags": [], + "name": "noteEdge", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + } + ] + }, + { + "flags": [], + "name": "describeRoot", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + }, + { + "flags": [], + "name": "describeGarbage", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + } + ] + } + ], + "name": "nsICycleCollectorHandler", + "parent": "nsISupports", + "uuid": "7f093367-1492-4b89-87af-c01dbc831246" + }, + { + "consts": [], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [ + "hidden" + ], + "name": "open", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [], + "name": "closeGCLog", + "params": [] + }, + { + "flags": [], + "name": "closeCCLog", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "filenameIdentifier", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "filenameIdentifier", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "processIdentifier", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "processIdentifier", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "gcLog", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIFile", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "ccLog", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIFile", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + } + ], + "name": "nsICycleCollectorLogSink", + "parent": "nsISupports", + "uuid": "3ad9875f-d0e4-4ac2-87e3-f127f6c02ce1" + }, + { + "consts": [], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "allTraces", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsICycleCollectorListener", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "wantAllTraces", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "disableLog", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "disableLog", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "logSink", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsICycleCollectorLogSink", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "logSink", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsICycleCollectorLogSink", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "wantAfterProcessing", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "setter" + ], + "name": "wantAfterProcessing", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "processNext", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsICycleCollectorHandler", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden", + "hasretval" + ], + "name": "asLogger", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + } + ], + "name": "nsICycleCollectorListener", + "parent": "nsISupports", + "uuid": "703b53b6-24f6-40c6-9ea9-aeb2dc53d170" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isDebugBuild", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "assertionCount", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isDebuggerAttached", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "assertion", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "warning", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "break", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "abort", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [], + "name": "rustPanic", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + } + ] + }, + { + "flags": [], + "name": "rustLog", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_PSTRING" + } + } + ] + }, + { + "flags": [], + "name": "crashWithOOM", + "params": [] + } + ], + "name": "nsIDebug2", + "parent": "nsISupports", + "uuid": "9641dc15-10fb-42e3-a285-18be90a5c10b" + }, + { + "consts": [], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [ + "getter", + "jscontext", + "hasretval" + ], + "name": "filename", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "jscontext", + "hasretval" + ], + "name": "name", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "jscontext", + "hasretval" + ], + "name": "sourceId", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "getter", + "jscontext", + "hasretval" + ], + "name": "lineNumber", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "getter", + "jscontext", + "hasretval" + ], + "name": "columnNumber", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "sourceLine", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UTF8STRING" + } + } + ] + }, + { + "flags": [ + "getter", + "jscontext", + "hasretval" + ], + "name": "asyncCause", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "jscontext", + "hasretval" + ], + "name": "asyncCaller", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIStackFrame", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "jscontext", + "hasretval" + ], + "name": "caller", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIStackFrame", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "getter", + "jscontext", + "hasretval" + ], + "name": "formattedStack", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "nativeSavedFrame", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_JSVAL" + } + } + ] + }, + { + "flags": [ + "jscontext", + "hasretval" + ], + "name": "toString", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UTF8STRING" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getFilename", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getName", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getSourceId", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getLineNumber", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getColumnNumber", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getAsyncCause", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getAsyncCaller", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getCaller", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getFormattedStack", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "toStringInfallible", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_UTF8STRING" + } + } + ] + } + ], + "name": "nsIStackFrame", + "parent": "nsISupports", + "uuid": "28bfb2a2-5ea6-4738-918b-049dc4d51f0b" + }, + { + "consts": [], + "flags": [ + "builtinclass" + ], + "methods": [], + "name": "nsIException", + "parent": "nsISupports", + "uuid": "4371b5bf-6845-487f-8d9d-3f1e4a9badd2" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "init", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIFile", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "initANSIFileDesc", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + }, + { + "flags": [], + "name": "write", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UTF8STRING" + } + } + ] + }, + { + "flags": [], + "name": "finish", + "params": [] + } + ], + "name": "nsIGZFileWriter", + "parent": "nsISupports", + "uuid": "6bd5642c-1b90-4499-ba4b-199f27efaba5" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "getInterface", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_NSID" + } + }, + { + "flags": [ + "out" + ], + "type": { + "iid_is": 0, + "tag": "TD_INTERFACE_IS_TYPE" + } + } + ] + } + ], + "name": "nsIInterfaceRequestor", + "parent": "nsISupports", + "uuid": "033a1470-8b2a-11d3-af88-00a024ffc08c" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "policiesEnabled", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "jscontext", + "hasretval" + ], + "name": "readPreferences", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_JSVAL" + } + } + ] + } + ], + "name": "nsIMacPreferencesReader", + "parent": "nsISupports", + "uuid": "b0f20595-88ce-4738-a1a4-24de78eb8051" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "getter", + "hasretval" + ], + "name": "architecturesInBinary", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isTranslated", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + } + ], + "name": "nsIMacUtils", + "parent": "nsISupports", + "uuid": "5e9072d7-ff95-455e-9466-8af9841a72ec" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "heapMinimize", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hasretval" + ], + "name": "isLowMemoryPlatform", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + } + ], + "name": "nsIMemory", + "parent": "nsISupports", + "uuid": "1e004834-6d8f-425a-bc9c-a2812ed43bb7" + }, + { + "consts": [], + "flags": [ + "function" + ], + "methods": [ + { + "flags": [], + "name": "callback", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + } + ], + "name": "nsIFinishDumpingCallback", + "parent": "nsISupports", + "uuid": "2dea18fc-fbfa-4bf7-ad45-0efaf5495f5e" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "onDump", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIFile", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIFile", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "onFinish", + "params": [] + } + ], + "name": "nsIDumpGCAndCCLogsCallback", + "parent": "nsISupports", + "uuid": "dc1b2b24-65bd-441b-b6bd-cb5825a7ed14" + }, + { + "consts": [], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [], + "name": "dumpMemoryReportsToNamedFile", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIFinishDumpingCallback", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "dumpMemoryInfoToTempDir", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "dumpGCAndCCLogsToFile", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIDumpGCAndCCLogsCallback", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "dumpGCAndCCLogsToSink", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsICycleCollectorLogSink", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + } + ], + "name": "nsIMemoryInfoDumper", + "parent": "nsISupports", + "uuid": "48541b74-47ee-4a62-9557-7f4b809bda5c" + }, + { + "consts": [], + "flags": [ + "function" + ], + "methods": [ + { + "flags": [], + "name": "callback", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UTF8STRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT32" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT64" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UTF8STRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + } + ], + "name": "nsIHandleReportCallback", + "parent": "nsISupports", + "uuid": "62ef0e1c-dbd6-11e3-aa75-3c970e9f4238" + }, + { + "consts": [ + { + "name": "KIND_NONHEAP", + "type": { + "tag": "TD_INT32" + }, + "value": 0 + }, + { + "name": "KIND_HEAP", + "type": { + "tag": "TD_INT32" + }, + "value": 1 + }, + { + "name": "KIND_OTHER", + "type": { + "tag": "TD_INT32" + }, + "value": 2 + }, + { + "name": "UNITS_BYTES", + "type": { + "tag": "TD_INT32" + }, + "value": 0 + }, + { + "name": "UNITS_COUNT", + "type": { + "tag": "TD_INT32" + }, + "value": 1 + }, + { + "name": "UNITS_COUNT_CUMULATIVE", + "type": { + "tag": "TD_INT32" + }, + "value": 2 + }, + { + "name": "UNITS_PERCENTAGE", + "type": { + "tag": "TD_INT32" + }, + "value": 3 + } + ], + "flags": [], + "methods": [ + { + "flags": [], + "name": "collectReports", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIHandleReportCallback", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + } + ], + "name": "nsIMemoryReporter", + "parent": "nsISupports", + "uuid": "92a36db1-46bd-4fe6-988e-47db47236d8b" + }, + { + "consts": [], + "flags": [ + "function" + ], + "methods": [ + { + "flags": [], + "name": "callback", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + } + ], + "name": "nsIFinishReportingCallback", + "parent": "nsISupports", + "uuid": "548b3909-c04d-4ca6-8466-b8bee3837457" + }, + { + "consts": [], + "flags": [ + "function" + ], + "methods": [ + { + "flags": [], + "name": "callback", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + } + ], + "name": "nsIHeapAllocatedCallback", + "parent": "nsISupports", + "uuid": "1a80cd0f-0d9e-4397-be69-68ad28fe5175" + }, + { + "consts": [], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [], + "name": "init", + "params": [] + }, + { + "flags": [], + "name": "registerStrongReporter", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIMemoryReporter", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "registerStrongAsyncReporter", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIMemoryReporter", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "registerWeakReporter", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIMemoryReporter", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "registerWeakAsyncReporter", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIMemoryReporter", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "unregisterStrongReporter", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIMemoryReporter", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "unregisterWeakReporter", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIMemoryReporter", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "blockRegistrationAndHideExistingReporters", + "params": [] + }, + { + "flags": [], + "name": "unblockRegistrationAndRestoreOriginalReporters", + "params": [] + }, + { + "flags": [], + "name": "registerStrongReporterEvenIfBlocked", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIMemoryReporter", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "getReports", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIHandleReportCallback", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIFinishReportingCallback", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getReportsExtended", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIHandleReportCallback", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIFinishReportingCallback", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_ASTRING" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "getReportsForThisProcessExtended", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIHandleReportCallback", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_BOOL" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsIFinishReportingCallback", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "name": "nsISupports", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "endReport", + "params": [] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "vsize", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "vsizeMaxContiguous", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "resident", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "residentFast", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "residentPeak", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "residentUnique", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "heapAllocated", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "heapOverheadFraction", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "JSMainRuntimeGCHeap", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "JSMainRuntimeTemporaryPeak", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "JSMainRuntimeCompartmentsSystem", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "JSMainRuntimeCompartmentsUser", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "JSMainRuntimeRealmsSystem", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "JSMainRuntimeRealmsUser", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "imagesContentUsedUncompressed", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "storageSQLite", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "lowMemoryEventsPhysical", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "ghostWindows", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "pageFaultsHard", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "hasMozMallocUsableSize", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isDMDEnabled", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [ + "getter", + "hasretval" + ], + "name": "isDMDRunning", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_BOOL" + } + } + ] + }, + { + "flags": [], + "name": "minimizeMemoryUsage", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIRunnable", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + }, + { + "flags": [], + "name": "sizeOfTab", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "mozIDOMWindowProxy", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT64" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_DOUBLE" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_DOUBLE" + } + } + ] + } + ], + "name": "nsIMemoryReporterManager", + "parent": "nsISupports", + "uuid": "2998574d-8993-407a-b1a5-8ad7417653e1" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [], + "name": "postIdleTask", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "name": "nsIRunnable", + "tag": "TD_INTERFACE_TYPE" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_UINT32" + } + } + ] + } + ], + "name": "nsIMessageLoop", + "parent": "nsISupports", + "uuid": "3e8c58e8-e52c-43e0-8e66-669ca788ff5f" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "QueryInterface", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_NSID" + } + }, + { + "flags": [ + "out" + ], + "type": { + "iid_is": 0, + "tag": "TD_INTERFACE_IS_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "AddRef", + "params": [] + }, + { + "flags": [ + "hidden" + ], + "name": "Release", + "params": [] + } + ], + "name": "nsISupports", + "parent": null, + "uuid": "00000000-0000-0000-c000-000000000046" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "generateUUID", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_NSIDPTR" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "generateUUIDInPlace", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + } + ], + "name": "nsIUUIDGenerator", + "parent": "nsISupports", + "uuid": "138ad1b2-c694-41cc-b201-333ce936d8b8" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "compare", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + }, + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_CSTRING" + } + }, + { + "flags": [ + "out" + ], + "type": { + "tag": "TD_INT32" + } + } + ] + } + ], + "name": "nsIVersionComparator", + "parent": "nsISupports", + "uuid": "e6cd620a-edbb-41d2-9e42-9a2ffc8107f3" + }, + { + "consts": [], + "flags": [ + "builtinclass" + ], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "QueryReferent", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_NSID" + } + }, + { + "flags": [ + "out" + ], + "type": { + "iid_is": 0, + "tag": "TD_INTERFACE_IS_TYPE" + } + } + ] + }, + { + "flags": [ + "hidden" + ], + "name": "sizeOfOnlyThis", + "params": [ + { + "flags": [ + "in" + ], + "type": { + "tag": "TD_VOID" + } + } + ] + } + ], + "name": "nsIWeakReference", + "parent": "nsISupports", + "uuid": "9188bc85-f92e-11d2-81ef-0060083a0bcf" + }, + { + "consts": [], + "flags": [], + "methods": [ + { + "flags": [ + "hasretval" + ], + "name": "GetWeakReference", + "params": [ + { + "flags": [ + "out" + ], + "type": { + "name": "nsIWeakReference", + "tag": "TD_INTERFACE_TYPE" + } + } + ] + } + ], + "name": "nsISupportsWeakReference", + "parent": "nsISupports", + "uuid": "9188bc86-f92e-11d2-81ef-0060083a0bcf" + } +] \ No newline at end of file -- cgit v1.2.3