diff --git a/custom-elements/form-associated/ElementInternals-target-element-is-held-strongly.html b/custom-elements/form-associated/ElementInternals-target-element-is-held-strongly.html new file mode 100644 index 00000000000000..7119d5f9ebe95e --- /dev/null +++ b/custom-elements/form-associated/ElementInternals-target-element-is-held-strongly.html @@ -0,0 +1,26 @@ + +Target element of ElementsInternals is held strongly and doesn't get GCed if there are no other references + + + + + + diff --git a/custom-elements/resources/garbage-collect.js b/custom-elements/resources/garbage-collect.js new file mode 100644 index 00000000000000..d2e3449c05e298 --- /dev/null +++ b/custom-elements/resources/garbage-collect.js @@ -0,0 +1,19 @@ +async function maybeGarbageCollectAsync() { + if (typeof TestUtils !== 'undefined' && TestUtils.gc) { + await TestUtils.gc(); + } else if (self.gc) { + // Use --expose_gc for V8 (and Node.js) + // to pass this flag at chrome launch use: --js-flags="--expose-gc" + // Exposed in SpiderMonkey shell as well + await self.gc(); + } else if (self.GCController) { + // Present in some WebKit development environments + await GCController.collect(); + } else { + /* eslint-disable no-console */ + console.warn('Tests are running without the ability to do manual ' + + 'garbage collection. They will still work, but ' + + 'coverage will be suboptimal.'); + /* eslint-enable no-console */ + } +} diff --git a/lint.ignore b/lint.ignore index 8f035b9f956933..6c93ccafb44b1f 100644 --- a/lint.ignore +++ b/lint.ignore @@ -107,6 +107,7 @@ PRINT STATEMENT: webdriver/tests/support/helpers.py # semi-legitimate use of console.* CONSOLE: console/* +CONSOLE: custom-elements/resources/garbage-collect.js CONSOLE: js/builtins/weakrefs/resources/maybe-garbage-collect.js CONSOLE: resources/check-layout-th.js CONSOLE: resources/chromium/*