-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add [Exposed=*] to expose on all globals #526
Conversation
f3b99aa
to
f0f2125
Compare
I think before landing this we should try to address the question at #468 (comment). |
35b291d
to
2e23cfb
Compare
@annevk Thanks for making this link. I think we should work out an answer in conjunction with TC39 to this question, given that ECMAScript includes things that are pretty equivalent in power/appropriateness to put everywhere to TextEncoder and URL. I'm fine with letting this PR be blocked on this question. |
We should include the jsidl label on this issue, since all ES APIs will need to be exposed to all globals |
@littledan I believe we should follow up on this PR for the proper ShadowRealms integration, right? |
We could add this for ShadowRealms, or we could just add |
This comment has been minimized.
This comment has been minimized.
I think it'd be better to add |
In an offline discussion tc39/ecma262#1120 came up, but since we did not change JavaScript to support minimal realms (i.e., a subset of what is defined in JavaScript), we should not do so here by excluding worklets. (As that would make worklets the new minimal realms due to organizational boundaries.) As I understand it the primary motivation for having minimal realms in worklets was to avoid steering web developers down the wrong path, but in practice this hasn't been much of a problem. This is a long way of saying that I agree with @domenic, but I thought it might be useful to add some context. |
OK, thanks for the clarifications everyone, sounds like I was the confused/misunderstanding one. Does that mean we should move ahead with [Exposed=*]? |
This patch adds support in WebIDL for declaring an interface available in all contexts. Closes whatwg#468
Rebased and rephrased a bit - what's next here? |
Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
@Ms2ger it would be helpful if you could make a list of interfaces which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Besides the ones already listed in tc39/proposal-shadowrealm#331, we might propose some parts of Crypto and Performance - please do let me know if you'd like me to present the list in some other way |
https://bugs.webkit.org/show_bug.cgi?id=231082 Reviewed by Chris Dumez. Adds a shorthand to expose interfaces/attributes on Window, Workers*, and the forthcoming ShadowRealm global object. See whatwg/webidl#468 and whatwg/webidl#526 for details. * bindings/scripts/CodeGenerator.pm: (shouldPropertyBeExposed): * bindings/scripts/CodeGeneratorJS.pm: (GenerateRuntimeEnableConditionalStringForExposed): * bindings/scripts/IDLParser.pm: (parseExtendedAttributeRest2): * bindings/scripts/preprocess-idls.pl: * bindings/scripts/test/AudioWorkletGlobalScopeConstructors.idl: * bindings/scripts/test/DOMWindowConstructors.idl: * bindings/scripts/test/DedicatedWorkerGlobalScopeConstructors.idl: * bindings/scripts/test/ExposedStar.idl: Added. * bindings/scripts/test/JS/JSDOMWindow.cpp: (WebCore::jsDOMWindow_ExposedStarConstructorGetter): (WebCore::JSC_DEFINE_CUSTOM_GETTER): * bindings/scripts/test/JS/JSDedicatedWorkerGlobalScope.cpp: (WebCore::jsDedicatedWorkerGlobalScope_ExposedStarConstructorGetter): (WebCore::JSC_DEFINE_CUSTOM_GETTER): * bindings/scripts/test/JS/JSExposedStar.cpp: Added. (WebCore::JSExposedStarDOMConstructor::prototypeForStructure): (WebCore::JSExposedStarDOMConstructor::initializeProperties): (WebCore::JSExposedStarPrototype::finishCreation): (WebCore::JSExposedStar::JSExposedStar): (WebCore::JSExposedStar::finishCreation): (WebCore::JSExposedStar::createPrototype): (WebCore::JSExposedStar::prototype): (WebCore::JSExposedStar::getConstructor): (WebCore::JSC_DEFINE_CUSTOM_GETTER): (WebCore::jsExposedStarPrototypeFunction_operationForAllContextsBody): (WebCore::JSC_DEFINE_HOST_FUNCTION): (WebCore::jsExposedStarPrototypeFunction_operationJustForWindowContextsBody): (WebCore::jsExposedStarPrototypeFunction_operationJustForWorkerContextsBody): (WebCore::JSExposedStar::subspaceForImpl): (WebCore::JSExposedStar::analyzeHeap): (WebCore::toJSNewlyCreated): (WebCore::toJS): (WebCore::JSExposedStar::toWrapped): * bindings/scripts/test/JS/JSExposedStar.h: Added. (WebCore::JSExposedStar::create): (WebCore::JSExposedStar::createStructure): (WebCore::JSExposedStar::subspaceFor): (WebCore::JSExposedStar::wrapped const): (WebCore::toJS): (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSPaintWorkletGlobalScope.cpp: (WebCore::jsPaintWorkletGlobalScope_ExposedStarConstructorGetter): (WebCore::JSC_DEFINE_CUSTOM_GETTER): * bindings/scripts/test/JS/JSServiceWorkerGlobalScope.cpp: (WebCore::jsServiceWorkerGlobalScope_ExposedStarConstructorGetter): (WebCore::JSC_DEFINE_CUSTOM_GETTER): * bindings/scripts/test/PaintWorkletGlobalScopeConstructors.idl: * bindings/scripts/test/ServiceWorkerGlobalScopeConstructors.idl: * bindings/scripts/test/SupplementalDependencies.dep: Canonical link: https://commits.webkit.org/243822@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=231082 Reviewed by Chris Dumez. Adds a shorthand to expose interfaces/attributes on Window, Workers*, and the forthcoming ShadowRealm global object. See whatwg/webidl#468 and whatwg/webidl#526 for details. * bindings/scripts/CodeGenerator.pm: (shouldPropertyBeExposed): * bindings/scripts/CodeGeneratorJS.pm: (GenerateRuntimeEnableConditionalStringForExposed): * bindings/scripts/IDLParser.pm: (parseExtendedAttributeRest2): * bindings/scripts/preprocess-idls.pl: * bindings/scripts/test/AudioWorkletGlobalScopeConstructors.idl: * bindings/scripts/test/DOMWindowConstructors.idl: * bindings/scripts/test/DedicatedWorkerGlobalScopeConstructors.idl: * bindings/scripts/test/ExposedStar.idl: Added. * bindings/scripts/test/JS/JSDOMWindow.cpp: (WebCore::jsDOMWindow_ExposedStarConstructorGetter): (WebCore::JSC_DEFINE_CUSTOM_GETTER): * bindings/scripts/test/JS/JSDedicatedWorkerGlobalScope.cpp: (WebCore::jsDedicatedWorkerGlobalScope_ExposedStarConstructorGetter): (WebCore::JSC_DEFINE_CUSTOM_GETTER): * bindings/scripts/test/JS/JSExposedStar.cpp: Added. (WebCore::JSExposedStarDOMConstructor::prototypeForStructure): (WebCore::JSExposedStarDOMConstructor::initializeProperties): (WebCore::JSExposedStarPrototype::finishCreation): (WebCore::JSExposedStar::JSExposedStar): (WebCore::JSExposedStar::finishCreation): (WebCore::JSExposedStar::createPrototype): (WebCore::JSExposedStar::prototype): (WebCore::JSExposedStar::getConstructor): (WebCore::JSC_DEFINE_CUSTOM_GETTER): (WebCore::jsExposedStarPrototypeFunction_operationForAllContextsBody): (WebCore::JSC_DEFINE_HOST_FUNCTION): (WebCore::jsExposedStarPrototypeFunction_operationJustForWindowContextsBody): (WebCore::jsExposedStarPrototypeFunction_operationJustForWorkerContextsBody): (WebCore::JSExposedStar::subspaceForImpl): (WebCore::JSExposedStar::analyzeHeap): (WebCore::toJSNewlyCreated): (WebCore::toJS): (WebCore::JSExposedStar::toWrapped): * bindings/scripts/test/JS/JSExposedStar.h: Added. (WebCore::JSExposedStar::create): (WebCore::JSExposedStar::createStructure): (WebCore::JSExposedStar::subspaceFor): (WebCore::JSExposedStar::wrapped const): (WebCore::toJS): (WebCore::toJSNewlyCreated): * bindings/scripts/test/JS/JSPaintWorkletGlobalScope.cpp: (WebCore::jsPaintWorkletGlobalScope_ExposedStarConstructorGetter): (WebCore::JSC_DEFINE_CUSTOM_GETTER): * bindings/scripts/test/JS/JSServiceWorkerGlobalScope.cpp: (WebCore::jsServiceWorkerGlobalScope_ExposedStarConstructorGetter): (WebCore::JSC_DEFINE_CUSTOM_GETTER): * bindings/scripts/test/PaintWorkletGlobalScopeConstructors.idl: * bindings/scripts/test/ServiceWorkerGlobalScopeConstructors.idl: * bindings/scripts/test/SupplementalDependencies.dep: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@285196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
This change looks great, but I don't think it handles the ShadowRealm case yet, since that is not an interface. |
@littledan that's a good point. I suppose we should put that requirement in HTML along with the overall ShadowRealm integration? |
This patch adds support in WebIDL for declaring an interface available
in all contexts.
Closes #468
This PR follows the syntax and outline suggested by @tobie . Thanks for your clear instructions here.
Preview | Diff