haikuwebkit/LayoutTests/fast/workers/DedicatedWorkerGlobalScope-...

14 lines
557 B
Plaintext
Raw Permalink Normal View History

DedicatedWorkerGlobalScope prototype chain is incorrect https://bugs.webkit.org/show_bug.cgi?id=158544 Reviewed by Brady Eidson. Source/WebCore: There were several issues with the prototype chain of DedicatedWorkerGlobalScope: 1. Object.getPrototypeOf(DedicatedWorkerGlobalScope.prototype) was not WorkerGlobalScope.prototype. 2. WorkerGlobalScope.prototype was a DedicatedWorkerGlobalScopePrototype object and was equal to DedicatedWorkerGlobalScope.prototype. 3. Object.getPrototypeOf(WorkerGlobalScope.prototype) was not EventTarget.prototype. Those issues were identified by the following W3C web-platform-test: http://w3c-test.org/workers/interfaces.worker This patch fixes the issue so that the prototype chain is now as per the specification. Test: fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::initScript): - Stop creating the WorkerGlobalScopePrototype and let JSWorkerGlobalScope create it. - Set DedicatedWorkerGlobalScopePrototype's prototype to JSWorkerGlobalScope's prototype after creating the JSDedicatedWorkerGlobalScope object. * bindings/scripts/CodeGeneratorJS.pm: (ShouldUseGlobalObjectPrototype): (GenerateHeader): (GenerateImplementation): (GenerateConstructorHelperMethods): - Do not use globalObject.getPrototypeDirect() as 'prototype' property for WorkerGlobalScope. The globalObject is a DedicatedWorkerGlobalScope, not a WorkerGlobalScope. - Generate the code to create / get a prototype object for WorkerGlobalScope. LayoutTests: Add test coverage for the DedicatedWorkerGlobalScope prototype chain. * fast/workers/DedicatedWorkerGlobalScope-prototype-chain-expected.txt: Added. * fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html: Added. Canonical link: https://commits.webkit.org/176634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-09 05:18:38 +00:00
Tests that DedicatedWorkerGlobalScope's prototype chain is correct.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
[WebIDL] Interface prototype objects should define @@toStringTag https://bugs.webkit.org/show_bug.cgi?id=211020 Reviewed by Darin Adler. LayoutTests/imported/w3c: Adjust tests for `X.prototype.toString()` returning "[object X]" instead of "[object XPrototype]", where X is WebIDL interface. * web-platform-tests/WebIDL/ecmascript-binding/class-string-interface.any-expected.txt: * web-platform-tests/WebIDL/ecmascript-binding/class-string-interface.any.worker-expected.txt: * web-platform-tests/WebIDL/ecmascript-binding/class-string-named-properties-object.window-expected.txt: * web-platform-tests/dom/nodes/Document-createEvent.https-expected.txt: * web-platform-tests/html/browsers/the-window-object/window-prototype-chain.html: WPT revision: 50417942bbfe. * web-platform-tests/wasm/jsapi/instance/toString.any-expected.txt: * web-platform-tests/wasm/jsapi/instance/toString.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/memory/toString.any-expected.txt: * web-platform-tests/wasm/jsapi/memory/toString.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/module/toString.any-expected.txt: * web-platform-tests/wasm/jsapi/module/toString.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/table/toString.any-expected.txt: * web-platform-tests/wasm/jsapi/table/toString.any.worker-expected.txt: Source/JavaScriptCore: WebIDL spec was recently updated [1] to define @@toStringTag on interface prototype objects. This change aligns WebIDL with ECMA-262 built-ins and Blink's behavior. Gecko have also expressed implementation commitment. This patch implements the spec change, making `X.prototype.toString()` return "[object X]" instead of "[object XPrototype]", where X is WebIDL interface. This behavior is proven to be web compatible (shipping in Chrome since Q2 2016) and matches class strings of iterator prototype objects [2] introduced in r253855. We define @@toStringTag for all WebAssembly interfaces but Error subclasses since they are not defined using WebIDL [3]. This change also introduces JSC_TO_STRING_TAG_WITHOUT_TRANSITION() macro that sets up @@toStringTag using ClassInfo to avoid extra strings creation, ensuring `className` equality between prototype and instance classes (fixing a few discrepancies), as well as correct descriptors. It also ensures using faster jsNontrivialString() and relieves from putting more code into CodeGeneratorJS.pm. [1]: https://github.com/heycam/webidl/pull/357 [2]: https://heycam.github.io/webidl/#es-iterator-prototype-object [3]: https://webassembly.github.io/spec/js-api/#error-objects Tests: imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.js imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.js imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.js imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.js * runtime/ArrayIteratorPrototype.cpp: (JSC::ArrayIteratorPrototype::finishCreation): * runtime/AsyncFunctionPrototype.cpp: (JSC::AsyncFunctionPrototype::finishCreation): * runtime/AsyncGeneratorFunctionPrototype.cpp: (JSC::AsyncGeneratorFunctionPrototype::finishCreation): * runtime/AsyncGeneratorPrototype.cpp: (JSC::AsyncGeneratorPrototype::finishCreation): * runtime/BigIntPrototype.cpp: (JSC::BigIntPrototype::finishCreation): * runtime/GeneratorFunctionPrototype.cpp: (JSC::GeneratorFunctionPrototype::finishCreation): * runtime/GeneratorPrototype.cpp: (JSC::GeneratorPrototype::finishCreation): * runtime/IntlCollatorPrototype.cpp: (JSC::IntlCollatorPrototype::finishCreation): * runtime/IntlDateTimeFormatPrototype.cpp: (JSC::IntlDateTimeFormatPrototype::finishCreation): * runtime/IntlNumberFormatPrototype.cpp: (JSC::IntlNumberFormatPrototype::finishCreation): * runtime/IntlPluralRulesPrototype.cpp: (JSC::IntlPluralRulesPrototype::finishCreation): * runtime/IntlRelativeTimeFormatPrototype.cpp: (JSC::IntlRelativeTimeFormatPrototype::finishCreation): * runtime/JSArrayBufferPrototype.cpp: (JSC::JSArrayBufferPrototype::finishCreation): * runtime/JSDataViewPrototype.cpp: (JSC::JSDataViewPrototype::finishCreation): * runtime/JSONObject.cpp: (JSC::JSONObject::finishCreation): * runtime/JSObject.h: * runtime/JSPromisePrototype.cpp: (JSC::JSPromisePrototype::finishCreation): * runtime/MapIteratorPrototype.cpp: (JSC::MapIteratorPrototype::finishCreation): * runtime/MapPrototype.cpp: (JSC::MapPrototype::finishCreation): * runtime/MathObject.cpp: (JSC::MathObject::finishCreation): * runtime/RegExpStringIteratorPrototype.cpp: (JSC::RegExpStringIteratorPrototype::finishCreation): * runtime/SetIteratorPrototype.cpp: (JSC::SetIteratorPrototype::finishCreation): * runtime/SetPrototype.cpp: (JSC::SetPrototype::finishCreation): * runtime/StringIteratorPrototype.cpp: (JSC::StringIteratorPrototype::finishCreation): * runtime/SymbolPrototype.cpp: (JSC::SymbolPrototype::finishCreation): * runtime/WeakMapPrototype.cpp: (JSC::WeakMapPrototype::finishCreation): * runtime/WeakObjectRefPrototype.cpp: (JSC::WeakObjectRefPrototype::finishCreation): * runtime/WeakSetPrototype.cpp: (JSC::WeakSetPrototype::finishCreation): * wasm/js/WebAssemblyInstancePrototype.cpp: (JSC::WebAssemblyInstancePrototype::finishCreation): * wasm/js/WebAssemblyMemoryPrototype.cpp: (JSC::WebAssemblyMemoryPrototype::finishCreation): * wasm/js/WebAssemblyModulePrototype.cpp: (JSC::WebAssemblyModulePrototype::finishCreation): * wasm/js/WebAssemblyTablePrototype.cpp: (JSC::WebAssemblyTablePrototype::finishCreation): Source/WebCore: WebIDL spec was recently updated [1] to define @@toStringTag on interface prototype objects. This change aligns WebIDL with ECMA-262 built-ins and Blink's behavior. Gecko have also expressed implementation commitment. This patch implements the spec change, making `X.prototype.toString()` return "[object X]" instead of "[object XPrototype]", where X is WebIDL interface. This behavior is proven to be web compatible (shipping in Chrome since Q2 2016) and matches class strings of iterator prototype objects [2] introduced in r253855. [1]: https://github.com/heycam/webidl/pull/357 [2]: https://heycam.github.io/webidl/#es-iterator-prototype-object Tests: fast/dom/prototype-chain.html fast/dom/wrapper-classes.html fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/class-string-interface.any.js imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/class-string-named-properties-object.window.js * bindings/js/JSDOMIterator.h: (WebCore::IteratorTraits>::finishCreation): * bindings/js/JSDOMWindowProperties.cpp: (WebCore::JSDOMWindowProperties::finishCreation): * bindings/js/JSDOMWindowProperties.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): (GeneratePrototypeDeclaration): (GenerateConstructorHelperMethods): * bindings/scripts/test/*: Updated. LayoutTests: Adjust tests for `X.prototype.toString()` returning "[object X]" instead of "[object XPrototype]", where X is WebIDL interface. * css3/blending/background-blend-mode-property-parsing-expected.txt: * css3/blending/background-blend-mode-property-parsing.html: * css3/blending/blend-mode-property-parsing-expected.txt: * css3/blending/blend-mode-property-parsing.html: * css3/filters/backdrop/backdropfilter-property-parsing-expected.txt: * css3/filters/backdrop/backdropfilter-property-parsing.html: * css3/filters/filter-property-parsing-expected.txt: * css3/filters/filter-property-parsing.html: * fast/css/image-set-parsing-expected.txt: * fast/css/image-set-parsing-generated-expected.txt: * fast/css/image-set-parsing-generated.html: * fast/css/image-set-parsing.html: * fast/dom/DOMException/prototype-object-expected.txt: * fast/dom/DOMException/prototype-object.html: * fast/dom/prototype-chain-expected.txt: * fast/dom/wrapper-classes-expected.txt: * fast/dom/wrapper-classes.html: * fast/events/event-view-toString-expected.txt: * fast/workers/DedicatedWorkerGlobalScope-prototype-chain-expected.txt: * fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html: * http/tests/xmlhttprequest/XMLHttpRequestException-expected.txt: * inspector/model/remote-object-get-properties-expected.txt: * platform/gtk/imported/w3c/web-platform-tests/dom/nodes/Document-createEvent.https-expected.txt: * platform/ios-wk2/imported/w3c/web-platform-tests/dom/nodes/Document-createEvent.https-expected.txt: * platform/wpe/imported/w3c/web-platform-tests/dom/nodes/Document-createEvent.https-expected.txt: * resources/idlharness.js: Remove asserts that are commented out in upstream. * svg/dom/svg2-inheritance.html: * transforms/2d/transform-value-types-expected.txt: * transforms/2d/transform-value-types.html: Canonical link: https://commits.webkit.org/224174@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-01 09:48:33 +00:00
DedicatedWorkerGlobalScope.prototype.toString() === "[object DedicatedWorkerGlobalScope]": true
DedicatedWorkerGlobalScope prototype chain is incorrect https://bugs.webkit.org/show_bug.cgi?id=158544 Reviewed by Brady Eidson. Source/WebCore: There were several issues with the prototype chain of DedicatedWorkerGlobalScope: 1. Object.getPrototypeOf(DedicatedWorkerGlobalScope.prototype) was not WorkerGlobalScope.prototype. 2. WorkerGlobalScope.prototype was a DedicatedWorkerGlobalScopePrototype object and was equal to DedicatedWorkerGlobalScope.prototype. 3. Object.getPrototypeOf(WorkerGlobalScope.prototype) was not EventTarget.prototype. Those issues were identified by the following W3C web-platform-test: http://w3c-test.org/workers/interfaces.worker This patch fixes the issue so that the prototype chain is now as per the specification. Test: fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::initScript): - Stop creating the WorkerGlobalScopePrototype and let JSWorkerGlobalScope create it. - Set DedicatedWorkerGlobalScopePrototype's prototype to JSWorkerGlobalScope's prototype after creating the JSDedicatedWorkerGlobalScope object. * bindings/scripts/CodeGeneratorJS.pm: (ShouldUseGlobalObjectPrototype): (GenerateHeader): (GenerateImplementation): (GenerateConstructorHelperMethods): - Do not use globalObject.getPrototypeDirect() as 'prototype' property for WorkerGlobalScope. The globalObject is a DedicatedWorkerGlobalScope, not a WorkerGlobalScope. - Generate the code to create / get a prototype object for WorkerGlobalScope. LayoutTests: Add test coverage for the DedicatedWorkerGlobalScope prototype chain. * fast/workers/DedicatedWorkerGlobalScope-prototype-chain-expected.txt: Added. * fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html: Added. Canonical link: https://commits.webkit.org/176634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-09 05:18:38 +00:00
Object.getPrototypeOf(DedicatedWorkerGlobalScope.prototype) === WorkerGlobalScope.prototype: true
[WebIDL] Interface prototype objects should define @@toStringTag https://bugs.webkit.org/show_bug.cgi?id=211020 Reviewed by Darin Adler. LayoutTests/imported/w3c: Adjust tests for `X.prototype.toString()` returning "[object X]" instead of "[object XPrototype]", where X is WebIDL interface. * web-platform-tests/WebIDL/ecmascript-binding/class-string-interface.any-expected.txt: * web-platform-tests/WebIDL/ecmascript-binding/class-string-interface.any.worker-expected.txt: * web-platform-tests/WebIDL/ecmascript-binding/class-string-named-properties-object.window-expected.txt: * web-platform-tests/dom/nodes/Document-createEvent.https-expected.txt: * web-platform-tests/html/browsers/the-window-object/window-prototype-chain.html: WPT revision: 50417942bbfe. * web-platform-tests/wasm/jsapi/instance/toString.any-expected.txt: * web-platform-tests/wasm/jsapi/instance/toString.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/memory/toString.any-expected.txt: * web-platform-tests/wasm/jsapi/memory/toString.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/module/toString.any-expected.txt: * web-platform-tests/wasm/jsapi/module/toString.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/table/toString.any-expected.txt: * web-platform-tests/wasm/jsapi/table/toString.any.worker-expected.txt: Source/JavaScriptCore: WebIDL spec was recently updated [1] to define @@toStringTag on interface prototype objects. This change aligns WebIDL with ECMA-262 built-ins and Blink's behavior. Gecko have also expressed implementation commitment. This patch implements the spec change, making `X.prototype.toString()` return "[object X]" instead of "[object XPrototype]", where X is WebIDL interface. This behavior is proven to be web compatible (shipping in Chrome since Q2 2016) and matches class strings of iterator prototype objects [2] introduced in r253855. We define @@toStringTag for all WebAssembly interfaces but Error subclasses since they are not defined using WebIDL [3]. This change also introduces JSC_TO_STRING_TAG_WITHOUT_TRANSITION() macro that sets up @@toStringTag using ClassInfo to avoid extra strings creation, ensuring `className` equality between prototype and instance classes (fixing a few discrepancies), as well as correct descriptors. It also ensures using faster jsNontrivialString() and relieves from putting more code into CodeGeneratorJS.pm. [1]: https://github.com/heycam/webidl/pull/357 [2]: https://heycam.github.io/webidl/#es-iterator-prototype-object [3]: https://webassembly.github.io/spec/js-api/#error-objects Tests: imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.js imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.js imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.js imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.js * runtime/ArrayIteratorPrototype.cpp: (JSC::ArrayIteratorPrototype::finishCreation): * runtime/AsyncFunctionPrototype.cpp: (JSC::AsyncFunctionPrototype::finishCreation): * runtime/AsyncGeneratorFunctionPrototype.cpp: (JSC::AsyncGeneratorFunctionPrototype::finishCreation): * runtime/AsyncGeneratorPrototype.cpp: (JSC::AsyncGeneratorPrototype::finishCreation): * runtime/BigIntPrototype.cpp: (JSC::BigIntPrototype::finishCreation): * runtime/GeneratorFunctionPrototype.cpp: (JSC::GeneratorFunctionPrototype::finishCreation): * runtime/GeneratorPrototype.cpp: (JSC::GeneratorPrototype::finishCreation): * runtime/IntlCollatorPrototype.cpp: (JSC::IntlCollatorPrototype::finishCreation): * runtime/IntlDateTimeFormatPrototype.cpp: (JSC::IntlDateTimeFormatPrototype::finishCreation): * runtime/IntlNumberFormatPrototype.cpp: (JSC::IntlNumberFormatPrototype::finishCreation): * runtime/IntlPluralRulesPrototype.cpp: (JSC::IntlPluralRulesPrototype::finishCreation): * runtime/IntlRelativeTimeFormatPrototype.cpp: (JSC::IntlRelativeTimeFormatPrototype::finishCreation): * runtime/JSArrayBufferPrototype.cpp: (JSC::JSArrayBufferPrototype::finishCreation): * runtime/JSDataViewPrototype.cpp: (JSC::JSDataViewPrototype::finishCreation): * runtime/JSONObject.cpp: (JSC::JSONObject::finishCreation): * runtime/JSObject.h: * runtime/JSPromisePrototype.cpp: (JSC::JSPromisePrototype::finishCreation): * runtime/MapIteratorPrototype.cpp: (JSC::MapIteratorPrototype::finishCreation): * runtime/MapPrototype.cpp: (JSC::MapPrototype::finishCreation): * runtime/MathObject.cpp: (JSC::MathObject::finishCreation): * runtime/RegExpStringIteratorPrototype.cpp: (JSC::RegExpStringIteratorPrototype::finishCreation): * runtime/SetIteratorPrototype.cpp: (JSC::SetIteratorPrototype::finishCreation): * runtime/SetPrototype.cpp: (JSC::SetPrototype::finishCreation): * runtime/StringIteratorPrototype.cpp: (JSC::StringIteratorPrototype::finishCreation): * runtime/SymbolPrototype.cpp: (JSC::SymbolPrototype::finishCreation): * runtime/WeakMapPrototype.cpp: (JSC::WeakMapPrototype::finishCreation): * runtime/WeakObjectRefPrototype.cpp: (JSC::WeakObjectRefPrototype::finishCreation): * runtime/WeakSetPrototype.cpp: (JSC::WeakSetPrototype::finishCreation): * wasm/js/WebAssemblyInstancePrototype.cpp: (JSC::WebAssemblyInstancePrototype::finishCreation): * wasm/js/WebAssemblyMemoryPrototype.cpp: (JSC::WebAssemblyMemoryPrototype::finishCreation): * wasm/js/WebAssemblyModulePrototype.cpp: (JSC::WebAssemblyModulePrototype::finishCreation): * wasm/js/WebAssemblyTablePrototype.cpp: (JSC::WebAssemblyTablePrototype::finishCreation): Source/WebCore: WebIDL spec was recently updated [1] to define @@toStringTag on interface prototype objects. This change aligns WebIDL with ECMA-262 built-ins and Blink's behavior. Gecko have also expressed implementation commitment. This patch implements the spec change, making `X.prototype.toString()` return "[object X]" instead of "[object XPrototype]", where X is WebIDL interface. This behavior is proven to be web compatible (shipping in Chrome since Q2 2016) and matches class strings of iterator prototype objects [2] introduced in r253855. [1]: https://github.com/heycam/webidl/pull/357 [2]: https://heycam.github.io/webidl/#es-iterator-prototype-object Tests: fast/dom/prototype-chain.html fast/dom/wrapper-classes.html fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/class-string-interface.any.js imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/class-string-named-properties-object.window.js * bindings/js/JSDOMIterator.h: (WebCore::IteratorTraits>::finishCreation): * bindings/js/JSDOMWindowProperties.cpp: (WebCore::JSDOMWindowProperties::finishCreation): * bindings/js/JSDOMWindowProperties.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): (GeneratePrototypeDeclaration): (GenerateConstructorHelperMethods): * bindings/scripts/test/*: Updated. LayoutTests: Adjust tests for `X.prototype.toString()` returning "[object X]" instead of "[object XPrototype]", where X is WebIDL interface. * css3/blending/background-blend-mode-property-parsing-expected.txt: * css3/blending/background-blend-mode-property-parsing.html: * css3/blending/blend-mode-property-parsing-expected.txt: * css3/blending/blend-mode-property-parsing.html: * css3/filters/backdrop/backdropfilter-property-parsing-expected.txt: * css3/filters/backdrop/backdropfilter-property-parsing.html: * css3/filters/filter-property-parsing-expected.txt: * css3/filters/filter-property-parsing.html: * fast/css/image-set-parsing-expected.txt: * fast/css/image-set-parsing-generated-expected.txt: * fast/css/image-set-parsing-generated.html: * fast/css/image-set-parsing.html: * fast/dom/DOMException/prototype-object-expected.txt: * fast/dom/DOMException/prototype-object.html: * fast/dom/prototype-chain-expected.txt: * fast/dom/wrapper-classes-expected.txt: * fast/dom/wrapper-classes.html: * fast/events/event-view-toString-expected.txt: * fast/workers/DedicatedWorkerGlobalScope-prototype-chain-expected.txt: * fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html: * http/tests/xmlhttprequest/XMLHttpRequestException-expected.txt: * inspector/model/remote-object-get-properties-expected.txt: * platform/gtk/imported/w3c/web-platform-tests/dom/nodes/Document-createEvent.https-expected.txt: * platform/ios-wk2/imported/w3c/web-platform-tests/dom/nodes/Document-createEvent.https-expected.txt: * platform/wpe/imported/w3c/web-platform-tests/dom/nodes/Document-createEvent.https-expected.txt: * resources/idlharness.js: Remove asserts that are commented out in upstream. * svg/dom/svg2-inheritance.html: * transforms/2d/transform-value-types-expected.txt: * transforms/2d/transform-value-types.html: Canonical link: https://commits.webkit.org/224174@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-01 09:48:33 +00:00
WorkerGlobalScope.prototype.toString() === "[object WorkerGlobalScope]": true
DedicatedWorkerGlobalScope prototype chain is incorrect https://bugs.webkit.org/show_bug.cgi?id=158544 Reviewed by Brady Eidson. Source/WebCore: There were several issues with the prototype chain of DedicatedWorkerGlobalScope: 1. Object.getPrototypeOf(DedicatedWorkerGlobalScope.prototype) was not WorkerGlobalScope.prototype. 2. WorkerGlobalScope.prototype was a DedicatedWorkerGlobalScopePrototype object and was equal to DedicatedWorkerGlobalScope.prototype. 3. Object.getPrototypeOf(WorkerGlobalScope.prototype) was not EventTarget.prototype. Those issues were identified by the following W3C web-platform-test: http://w3c-test.org/workers/interfaces.worker This patch fixes the issue so that the prototype chain is now as per the specification. Test: fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::initScript): - Stop creating the WorkerGlobalScopePrototype and let JSWorkerGlobalScope create it. - Set DedicatedWorkerGlobalScopePrototype's prototype to JSWorkerGlobalScope's prototype after creating the JSDedicatedWorkerGlobalScope object. * bindings/scripts/CodeGeneratorJS.pm: (ShouldUseGlobalObjectPrototype): (GenerateHeader): (GenerateImplementation): (GenerateConstructorHelperMethods): - Do not use globalObject.getPrototypeDirect() as 'prototype' property for WorkerGlobalScope. The globalObject is a DedicatedWorkerGlobalScope, not a WorkerGlobalScope. - Generate the code to create / get a prototype object for WorkerGlobalScope. LayoutTests: Add test coverage for the DedicatedWorkerGlobalScope prototype chain. * fast/workers/DedicatedWorkerGlobalScope-prototype-chain-expected.txt: Added. * fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html: Added. Canonical link: https://commits.webkit.org/176634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-09 05:18:38 +00:00
Object.getPrototypeOf(WorkerGlobalScope.prototype) === EventTarget.prototype: true
PASS successfullyParsed is true
TEST COMPLETE