Skip to content
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

New text for guidance on exposing interfaces everywhere #510

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ptomato
Copy link

@ptomato ptomato commented Sep 12, 2024

Here's an initial draft for text on exposing interfaces everywhere. It's similar to the text I wrote in #509 and the examples I gave there.

Closes: #509


Preview | Diff

ptomato added a commit to ptomato/urlpattern that referenced this pull request Sep 13, 2024
I've drafted a set of criteria for which interfaces to expose
universally on all globals, at
w3ctag/design-principles#510.
URLPattern looks like it fits those criteria and is useful to have in
any environment.
@caridy
Copy link

caridy commented Sep 15, 2024

this is great, thanks @ptomato for putting the time on this

Copy link
Contributor

@jyasskin jyasskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should think some about the [SecureContext] question, but otherwise this looks ready to go in.

index.bs Outdated Show resolved Hide resolved
@jyasskin
Copy link
Contributor

@zcorpan Intuitively I disagree with your argument in whatwg/webidl#1119 (comment), at least given the guidance in this PR. The downside of requiring review for every new kind of realm is that when we add a new realm type, there's going to be a long string of paper-cuts as developers reach for various utility functions and notice that they haven't yet been added to this particular realm.

ptomato added a commit to ptomato/WebKit that referenced this pull request Nov 14, 2024
Need the bug URL (OOPS!).

Reviewed by NOBODY (OOPS!).

As per the current state of whatwg/html#9893,
and the design principles in
w3ctag/design-principles#510, the global object
in a ShadowRealm should be an EventTarget. This makes
ShadowRealmGlobalScope inherit EventTarget.

* Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::deriveShadowRealmGlobalObject): Set the
prototype of the global wrapper object to be EventTarget.prototype.
* Source/WebCore/bindings/js/JSEventTargetCustom.cpp: Handle ShadowRealm
  global objects in casts to and from EventTarget.
(WebCore::JSEventTarget::toWrapped):
(WebCore::jsEventTargetCast):
* Source/WebCore/dom/EventTargetFactory.in: Add ShadowRealmGlobalScope
  as an EventTarget.
* Source/WebCore/page/ShadowRealmGlobalScope.h: Make
  WebCore::ShadowRealmGlobalScope inherit WebCore::EventTarget and
  implement its pure virtual methods.
* Source/WebCore/page/ShadowRealmGlobalScope.idl: Make
  ShadowRealmGlobalScope inherit EventTarget.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Principle: Use [Exposed=*] to make only purely computational APIs available
5 participants