-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 environment's execution ready flag #1992
Comments
Hmm, for origin, what if it turns out to be sandboxed in some way? |
An environment's origin would not be exposed but just used during the navigation even before the global and the document are created. The purpose of using it is to check it against the SW's origin to filter out those not in the same origin in the first place. In the case it turns out to be sandboxed, it's just set to an opaque origin as expected I guess. |
- Add execution ready flag, which is set when the corresponding environment settings object is created and the potential main resource is fetched (in the case of an initial browsing context creation, the main resource fetch doesn't occur and not considered as a condition.) . This flag is mainly used in Service Worker's Client API (i.e. to get a value for client.reserved) - Define the origin algorithm that returns the creation URL's origin . The origin algorithms defined in the environment settings objects override the behavior. . The primary purpose of defining this algorithm is to allow a polymorphic dispatch depending on the type of objects (i.e. to simplify the steps in the call sites.) Related issue: whatwg#1992
The proposed origin algorithm has been out of scope: #2004 (comment) Service worker spec has added the relevant origin algorithm: w3c/ServiceWorker@c4c1250 |
Service worker's Client's reserved attribute and clients.matchAll(/* options.includeReserved */) method require getting the state of a Client object whether its environment is in reserved state or not. This commit adds the execution ready flag to the environment concept that distinguishes the state between before and after the user agent is ready to parse a fetched (or given default) document or execute a worker script. The execution ready flag is set when the global object and realm execution context are created and the main resource (for parsing/executing) is ready. Related service worker issue: w3c/ServiceWorker#1003. Fixes whatwg#1992.
While working on SW's clients methods, I encountered additional requirements on the environment definition.
client.reserved
attribute (initially true when client is created)- Environment's origin algorithm- SW methods check the reserved client's origin (to compare it against the running SW's origin.) Here the reserved client can be either an environment or an environment settings object. If the reserved client is an environment, the steps should use environment's creation URL's origin while they could simply use the origin with an environment settings object. So, the steps need to branch for them as of now. It'd be handy If we define an algorithm, origin, (for an environment) which returns its creation URL's origin under the assumption that the model supports some polymorphic dynamic dispatch based on which object's origin algorithm is called. Would it work?I'll make a PR based on the discussion here.
The text was updated successfully, but these errors were encountered: