Changeset 234957 in webkit
- Timestamp:
- Aug 16, 2018 2:18:02 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r234953 r234957 1 2018-08-16 Ryosuke Niwa <rniwa@webkit.org> 2 3 Custom element constructor doesn't use HTMLElement in new.target's realm 4 https://bugs.webkit.org/show_bug.cgi?id=188634 5 6 Reviewed by Keith Miller. 7 8 Rebaselined the test now that all relevant test cases pass. All remaining test failures are 9 for customized builtin, which we do not and shall not implement. 10 11 * web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt: 12 1 13 2018-08-16 Ryosuke Niwa <rniwa@webkit.org> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt
r234039 r234957 2 2 PASS Use NewTarget's prototype, not the one stored at definition time 3 3 PASS Rethrow any exceptions thrown while getting the prototype 4 FAIL If prototype is not object (null), derives the fallback from NewTarget's realm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]" 5 FAIL If prototype is not object (undefined), derives the fallback from NewTarget's realm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]" 6 FAIL If prototype is not object (5), derives the fallback from NewTarget's realm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]" 7 FAIL If prototype is not object (string), derives the fallback from NewTarget's realm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]" 4 PASS If prototype is not object (null), derives the fallback from NewTarget's realm (autonomous custom elements) 5 PASS If prototype is not object (undefined), derives the fallback from NewTarget's realm (autonomous custom elements) 6 PASS If prototype is not object (5), derives the fallback from NewTarget's realm (autonomous custom elements) 7 PASS If prototype is not object (string), derives the fallback from NewTarget's realm (autonomous custom elements) 8 8 FAIL If prototype is not object (null), derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor" 9 9 FAIL If prototype is not object (undefined), derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor" -
trunk/Source/WebCore/ChangeLog
r234956 r234957 1 2018-08-16 Ryosuke Niwa <rniwa@webkit.org> 2 3 Custom element constructor doesn't use HTMLElement in new.target's realm 4 https://bugs.webkit.org/show_bug.cgi?id=188634 5 6 Reviewed by Keith Miller. 7 8 Fixed the bug that HTMLElement's constructor was constructing an element of its own realm 9 instead of the realm of new.target. This results in the JS wrapper created for the element 10 belonging to the global object of the HTMLElement constructor which was invoked instead of 11 the global object of new.target as specified in: 12 https://html.spec.whatwg.org/multipage/dom.html#html-element-constructors 13 14 In particular, step 9.2. specifies that we "perform element.[[SetPrototypeOf]](prototype)." 15 where prototype is the result of Get(NewTarget, "prototype") in step 7. 16 17 WebKit's new behavior matches that of Chrome and Firefox. 18 19 Test: imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html 20 21 * bindings/js/JSHTMLElementCustom.cpp: 22 (WebCore::constructJSHTMLElement): 23 1 24 2018-08-16 Aditya Keerthi <akeerthi@apple.com> 2 25 -
trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp
r233122 r234957 56 56 57 57 JSValue newTargetValue = exec.thisValue(); 58 auto* globalObject = jsConstructor->globalObject(); 58 auto* newTarget = newTargetValue.getObject(); 59 auto* globalObject = jsCast<JSDOMGlobalObject*>(newTarget->globalObject(vm)); 59 60 JSValue htmlElementConstructorValue = JSHTMLElement::getConstructor(vm, globalObject); 60 61 if (newTargetValue == htmlElementConstructorValue) … … 71 72 return throwVMTypeError(&exec, scope, "new.target is not a valid custom element constructor"_s); 72 73 73 JSObject* newTarget = newTargetValue.getObject();74 74 auto* elementInterface = registry->findInterface(newTarget); 75 75 if (!elementInterface)
Note: See TracChangeset
for help on using the changeset viewer.