Index: third_party/WebKit/LayoutTests/custom-elements/spec/resources/custom-elements-helpers.js |
diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/resources/custom-elements-helpers.js b/third_party/WebKit/LayoutTests/custom-elements/spec/resources/custom-elements-helpers.js |
index 7a1c7196fe65276e536e5b269001cb878089c62f..114e1b00bc6ffb268a28a110e75a443962c4ef7d 100644 |
--- a/third_party/WebKit/LayoutTests/custom-elements/spec/resources/custom-elements-helpers.js |
+++ b/third_party/WebKit/LayoutTests/custom-elements/spec/resources/custom-elements-helpers.js |
@@ -4,7 +4,7 @@ function create_window_in_test(t, srcdoc) { |
f.srcdoc = srcdoc ? srcdoc : ''; |
f.onload = (event) => { |
let w = f.contentWindow; |
- t.add_cleanup(() => f.remove()); |
+ t.add_cleanup(() => f.parentNode && f.remove()); |
resolve(w); |
}; |
document.body.appendChild(f); |