Commit 8381e35c authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

custom-element: Do not crash by Get(NewTarget, "prototype") failure.

https://html.spec.whatwg.org/multipage/dom.html#html-element-constructors
> 7. Let prototype be Get(NewTarget, "prototype"). Rethrow any exceptions.

As the specification says, we should rethrow. Removing a v8::TryCatch
instance in V8HTMLConstructor::HtmlConstructor() works as "rethrow".

Bug: 854887
Change-Id: I6b2d6ae829453270fe4437a87e65528525c64990
Reviewed-on: https://chromium-review.googlesource.com/1124129Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572167}
parent 29ea232d
This is a testharness.js-based test.
FAIL CEReactions should rethrow an exception by the originally-specified steps assert_throws: function "() => { log.outerHTML = '<my-custom-element></my-custom-element>'; }" did not throw
Harness: the test ran to completion.
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<body>
<div id=log></div>
<script>
test(() => {
var upgraded = false;
class MyCustomElement extends HTMLElement {
constructor() { super(); upgraded = true; }
}
customElements.define('my-custom-element', MyCustomElement);
log.addEventListener('DOMNodeRemoved', function (e) {
if (document.querySelector('#log'))
document.adoptNode(log);
});
assert_throws('NotFoundError', () => { log.outerHTML = '<my-custom-element></my-custom-element>'; });
assert_true(upgraded, 'MyCustomElement constructor should be called');
}, 'CEReactions should rethrow an exception by the originally-specified steps');
</script>
</body>
......@@ -93,8 +93,6 @@ void V8HTMLConstructor::HtmlConstructor(
ExceptionState exception_state(isolate, ExceptionState::kConstructionContext,
"HTMLElement");
v8::TryCatch try_catch(isolate);
// 6. Let prototype be Get(NewTarget, "prototype"). Rethrow any exceptions.
v8::Local<v8::Value> prototype;
v8::Local<v8::String> prototype_string = V8AtomicString(isolate, "prototype");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment