-
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
Extend environment concept #2004
Conversation
- 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
Unfortunately wattsi doesn't know about the |
@@ -85800,6 +85806,14 @@ interface <dfn>NavigatorOnLine</dfn> { | |||
data-x="dfn-control">controls</span> the <span>environment</span>.</p></dd> | |||
</dl> | |||
|
|||
<p>An <span>environment</span> has an <dfn data-x="concept-environment-execution-ready-flag" | |||
data-export="">execution ready flag</dfn>, which is initially unset.</p> |
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.
This should also have a data-dfn-for="environment".
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.
Ah.. just missed this comment before pushing the data-x commit. Will add this.
Added |
On reflection, for the origin, I think I can also do it in SW by defining an origin field on the service worker client. Not sure if other specs (e.g. Secure Context) will need a reference to the environment's origin in the future, though. If that's the case, having it in the environment will still be useful. |
This removes the environment's origin algorithm definition. The requirement is now covered by Service Workers spec with the service worker client's origin algorithm: https://w3c.github.io/ServiceWorker/#service-worker-client-origin
I removed the environment's origin definition from this PR and spec the algorithm in SW instead: https://w3c.github.io/ServiceWorker/#service-worker-client-origin So, this PR is now only for adding the execution ready flag. If we need an origin algorithm on environment in the future, I'll make a separate PR for that. |
@@ -85800,6 +85806,10 @@ interface <dfn>NavigatorOnLine</dfn> { | |||
data-x="dfn-control">controls</span> the <span>environment</span>.</p></dd> | |||
</dl> | |||
|
|||
<p>An <span>environment</span> has an <dfn data-x="concept-environment-execution-ready-flag" |
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.
This should be added to the previous <dl>
, I think?
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.
I was wondering whether I should get both the fields and the flag in the same <dl>
considering we put it as "An environment has the following fields". So, I guess a flag is a field? I'm fine with adding it to the <dl>
if so.
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.
A field can be a flag, yeah :). Flag is a type, kind of like a boolean but just a bit more awkward to use.
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.
That makes sense. Addressed the comment.
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.
LGTM with nit but would appreciate @annevk's review as well.
<li><p><span>Set up a browsing context environment settings object</span> with | ||
<var>realm execution context</var>.</p></li> | ||
<li><p><span>Set up a browsing context environment settings object</span> with <var>realm | ||
execution context</var>, and set <var>settingsObject</var> to the result.</p></li> |
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.
let settingsObject be the result; this is the first introduction of the settingsObject variable.
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.
Addressed the comment. Thanks.
My main concern is that I don't have the full flow in my head. And we're adding this state for lifetime management of a global, but we don't fully understand the lifetime of globals yet. |
Trying to clarify, |
What is the SW issue for adding reserved? And why is that not a promise-state attribute? E.g., |
It started as
Good point. Once a /cc @jakearchibald |
Also note that execution ready flag is used in |
Okay, so if reserved doesn't change and we read the execution ready flag when we asynchronously gather state to create Would be good to have the issue in SW filed so we can mention that in the commit message here. Makes it easier for folks in the future to figure out how everything relates. |
Okay. Will fix |
Also, could you propose a commit message for this PR that includes all the relevant info? I or @domenic can then land it since I think the text we have here is fine. |
Sure. Will do when ready with all the relevant info. What's the convention to propose the final commit message? Update the OP or just a new comment here? |
A new comment using the triple backtick syntax. |
I've addressed the Here' the proposed commit message:
|
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: #1992