Index: third_party/WebKit/LayoutTests/custom-elements/constructor-context-dies-retrieving-prototype.html |
diff --git a/third_party/WebKit/LayoutTests/custom-elements/constructor-context-dies-before-super.html b/third_party/WebKit/LayoutTests/custom-elements/constructor-context-dies-retrieving-prototype.html |
similarity index 62% |
copy from third_party/WebKit/LayoutTests/custom-elements/constructor-context-dies-before-super.html |
copy to third_party/WebKit/LayoutTests/custom-elements/constructor-context-dies-retrieving-prototype.html |
index 7b232226ebb579b7739476cd97f5187e14a05750..93f6965c6d059f2570bcf5648ff8d0dcaf76576c 100644 |
--- a/third_party/WebKit/LayoutTests/custom-elements/constructor-context-dies-before-super.html |
+++ b/third_party/WebKit/LayoutTests/custom-elements/constructor-context-dies-retrieving-prototype.html |
@@ -15,7 +15,7 @@ function finishJSTest() {} |
if (fork()) { |
// The controlling parent frame. |
- let t = async_test('constructor destroys the context before super'); |
+ let t = async_test('constructor destroys the context retrieving prototype'); |
let watcher = new EventWatcher(t, window, 'message'); |
watcher.wait_for('message').then(t.step_func((event) => { |
assert_equals(event.data, 'PASS destroyed context'); |
@@ -26,15 +26,24 @@ if (fork()) { |
})); |
} else { |
// The child frame. |
- class BadConstructor extends HTMLElement { |
- constructor() { |
- destroyContext(); |
- super(); |
- } |
+ let should_destroy = false; |
+ let proxy; |
+ function BadConstructor() { |
+ should_destroy = true; |
+ return Reflect.construct(HTMLElement, [], proxy); |
} |
- window.customElements.define('x-x', BadConstructor); |
+ proxy = new Proxy(BadConstructor, { |
+ get(receiver, name) { |
+ if (should_destroy && name == 'prototype') { |
+ destroyContext(); |
+ return 42; |
+ } |
+ return receiver[name]; |
+ } |
+ }); |
+ window.customElements.define('x-x', proxy); |
try { |
- new BadConstructor(); |
+ new proxy(); |
} finally { |
done(); |
} |