Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/gc.html

Issue 1952893003: Implement custom element construction and some 'define' checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement feedback. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-elements/isolated-worlds.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/custom-elements/gc.html
diff --git a/third_party/WebKit/LayoutTests/custom-elements/gc.html b/third_party/WebKit/LayoutTests/custom-elements/gc.html
new file mode 100644
index 0000000000000000000000000000000000000000..beb67e14cbe42295932481b18c2dbe1cc6d888e4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/custom-elements/gc.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharness-helpers.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<body>
+<script>
+'use strict';
+(() => {
+
+if (!window.internals) {
+ // Requires observeGC
+ return;
+}
+
+promise_test((t) => {
+ var observation = null;
+ (() => {
+ let f = document.createElement('iframe');
+ f.srcdoc = 'content';
+ document.body.appendChild(f);
+ let w = f.contentWindow;
+
+ var X = new Object;
+ X.a = [f, w, w.customElements, w.document];
+ X.a.forEach((o) => o.x = X);
+ observation = internals.observeGC(X);
+
+ f.remove();
+ })();
+
+ return Promise.resolve()
+ .then(() => {
+ gc(); gc();
+ assert_true(observation.wasCollected,
+ 'cyclic references between objects and DOM wrappers should ' +
+ 'not leak');
+ });
+}, 'Sanity check ordinary objects are not leaking');
+
+promise_test((t) => {
+ var observation = null;
+ (() => {
+ let f = document.createElement('iframe');
+ f.srcdoc = 'content';
+ document.body.appendChild(f);
+ let w = f.contentWindow;
+
+ class X extends HTMLElement {}
+ X.a = [f, w, w.customElements, w.document];
+ X.a.forEach((o) => o.x = X);
+ w.customElements.define('a-a', X);
+ observation = internals.observeGC(X);
+
+ f.remove();
+ })();
+
+ return Promise.resolve()
+ .then(() => {
+ gc(); gc();
+ assert_true(observation.wasCollected,
+ 'defining a custom element should not leak its constructor');
+ });
+}, 'Defining custom elements does not leak');
+
+})();
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-elements/isolated-worlds.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698