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

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/constructor-context-dies-retrieving-prototype.html

Issue 2441943002: Retrieve prototype during custom element construction. (Closed)
Patch Set: Update after https://codereview.chromium.org/2443543002 Created 4 years, 2 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
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();
}

Powered by Google App Engine
This is Rietveld 408576698