-
Notifications
You must be signed in to change notification settings - Fork 165
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
Exposing an interface "on all globals" #468
Comments
+1, I think it would be good to have a carefully-considered class of APIs available everywhere. The question is what the worklets folks think, IMO: would exposing e.g. |
Something like |
I'm not against this per se, but it seems to go against the idea of making sure editors carefully consider each place where their APIs are exposed (which I assumed we were championing when deciding to make [Exposed] mandatory). This might be mitigated by a combination of the following:
|
I think requiring either is still good enough for that, coupled with implementer review. |
Bikeshed: |
Yeah, that was also my initial thought. I think the grammar let's us do it, too. |
Thanks for your support here! Should I make a PR for |
Sure. :) |
I'm having trouble figuring out how the grammar supports |
So you want to add a 6th non-terminal to the group of non-terminals described in Extended attributes: ExtendedAttributeWildcard, which you'd define as: ExtendedAttributeWildcard :
identifier "=" "*" Note this group of non-terminals is a bit special, as it's a subset of what the grammar allows for extended attributes. So you'll still want to add "*" to the Other non-terminal to make the main grammar work. And I think you should be fine. (That's generally when @bzbarsky shows up to tell me I'm wrong, so you might want to wait a couple of hours.) |
At first glance, that sounds fine to me too. |
This patch adds support in WebIDL for declaring an interface available in all contexts. Closes whatwg#468
This patch adds support in WebIDL for declaring an interface available in all contexts. Closes whatwg#468
@bfgeek @padenot could you say something about #468 (comment)? I think worklets are intentionally small in their API surface and therefore I think the preference is that nothing additional is exposed there, unless it adds sufficient utility. It's not entirely clear they need URL parsing (e.g., they don't want |
I'd be curious about feedback for a couple other things:
I was assuming that we'd want to expose these everywhere, including worklets, but this assumption was made without checking with Worklet experts. |
This patch adds support in WebIDL for declaring an interface available in all contexts. Closes whatwg#468
This patch adds support in WebIDL for declaring an interface available in all contexts. Closes whatwg#468
It is the current thinking of the Audio Working Group that indeed, we want the set of APIs available inside an In addition, my opinion is that it would be best to not expose API that would encourage mis-use of the |
@padenot Currently, internationalization is being developed as an ad-on to the ECMAScript standard, and we don't even have notation for not exposing it in certain globals. Would you be interested in coming over to TC39 to explain the AudioWorkletGlobalScope requirements so we can make sure to accommodate them well? This could be through remotely attending a meeting over video conferencing, or filing an issue. |
I can certainly do both, but I will kick things off with an issue on the link you provided. Thanks! |
I just opened tc39/ecma262#1120 for this. |
I've put together a patch for WebCore in https://github.com/caitp/WebKit/pull/1/files, if anyone is interested in double checking my interpretation |
This patch adds support in WebIDL for declaring an interface available in all contexts. Closes whatwg#468
This patch adds support in WebIDL for declaring an interface available in all contexts. Closes #468 Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Co-authored-by: Ms2ger <Ms2ger@gmail.com>
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
For WebAssembly, I'm using WebIDL to specify the interface between WebAssembly and JavaScript in this PR. We're trying to avoid tying this into the Web Platform. One of the few ways that the current spec does tie into the Web is, to expose the interface to global objects, it uses
[Exposed=(Window,Worker)]
.What we really want for Wasm is for it to be exposed on all global objects. One aspect was accidentally omitting it on Worklets, but the bigger aspect is omitting it for everything that's not the web platform. For example, Node.js is likely to eventually enable Wasm support, and so the interface should be created on its global object as well.
I imagine that a version of Exposed which is everywhere might be useful for the Web Platform as well. APIs like TextEncoder which don't do any particular I/O wouldn't need a change each time another type of global object is added--they could be like new libraries added in the JavaScript standard.
What would you think about an additional extended attribute, or mode of using
[Exposed]
, to support this case?The text was updated successfully, but these errors were encountered: