-
Notifications
You must be signed in to change notification settings - Fork 155
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 support for 'serviceworkers' member #507
Changes from 1 commit
9e5567a
4a5f762
e97ab3e
2524071
3df8f7a
5d37374
5c867ad
4fc48b1
77bdd10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2048,51 +2048,54 @@ <h3> | |
service worker as defined in [[!SERVICE-WORKERS-1]]. | ||
</p> | ||
<p> | ||
The <a><code>serviceworker</code> member</a> represents a service worker | ||
registration. Other service worker registrations can be done, for instance | ||
The <a><code>serviceworker</code> member</a> represents a <a | ||
href="https://w3c.github.io/ServiceWorker/#service-worker-registration-concept"> | ||
service worker registration</a>. Other service worker registrations can be done, for instance | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The text "Other service worker registrations can be done" should be in a non-normative note. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, you are redefining the rules - which is a bit dangerous. That should point to the SW spec, like: "For rules on how SWs interact, then see section X of Service Workers" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made it a note now. @jungkees can you point me to the best place to refer to? |
||
by a script; if these have different scopes they will be considered separate | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably not re-specify the rules that are in the service worker spec; we should reference them. |
||
registrations. If they have the same scope and script URL, they coalesce. | ||
If they have different script URLs, last one wins. | ||
</p> | ||
<p> | ||
The <dfn>steps for processing the <code>serviceworker</code> | ||
member</dfn> are given by the following algorithm. The algorithm | ||
takes a <a>manifest</a> <var>manifest</var> and <a>serviceworker object</a> | ||
<var>serviceworker</var> as an argument. This algorithm returns a | ||
serviceworker object <var>serviceworker</var>, which can be <code>undefined</code>. | ||
takes a <a>manifest</a> <var>manifest</var>. This algorithm returns a | ||
registration object <var>registration</var>, which can be <code>undefined</code>. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: link to registration object? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
</p> | ||
<ol> | ||
<li>Let <var>unprocessed registration</var> be the result of calling the | ||
<a>[[\GetOwnProperty]]</a> internal method of <var>manifest</var> | ||
with argument "<code>serviceworker</code>". | ||
<li>Let <var>src</var> be the result of running the <a>steps | ||
for processing the <code>src</code> member of a service worker</a> | ||
with <var>serviceworker</var> and <var>manifest URL</var>. | ||
with <var>unprocessed registration</var> and <var>manifest URL</var>. | ||
</li> | ||
<li>If <var>src</var> is <code>undefined</code>, or if the result of | ||
running <a href="https://w3c.github.io/webappsec/specs/powerfulfeatures/#is-origin-trustworthy">Is origin potentially trustworthy</a> | ||
running <a>Is origin potentially trustworthy</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: capital "Is" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably warn developer here too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
with the origin of <var>src</var> is <code>Not Trusted</code>, return | ||
<code>undefined</code>. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. screwing up the security aspects of the registration is a pretty big error... so we should maybe pass this through and just allow service worker registration to fail (and kill the whole object then) |
||
</li> | ||
<li>Otherwise, let <var>serviceworker</var> be an object with | ||
<li>Otherwise, let <var>registration</var> be an object with | ||
properties <code>src</code> and <code>scope</code>. All properties | ||
initially set to <code>undefined</code>. | ||
</li> | ||
<li>Set <var>serviceworker</var>'s <code>src</code> property to be | ||
<li>Set <var>registration</var>'s <code>src</code> property to be | ||
<var>src</var>. | ||
</li> | ||
<li>Let <var>type</var> be the result of running the <a>steps | ||
for processing the <code>scope</code> member of a service worker</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When this algorithm returns undefined, the steps to install the web application gets to pass nothing to Start Register. In this case, shouldn't there be an error handling such that Start Register is not invoked? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me check that, it should not be invoked no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It is not invoked if it fails There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That looks good. |
||
passing <var>serviceworker</var>. | ||
passing <var>unprocessed registration</var>. | ||
</li> | ||
<li>If <var>scope</var> is not <code>undefined</code>, | ||
set<var>serviceworker</var>'s <code>scope</code> | ||
set <var>registration</var>'s <code>scope</code> | ||
property to be <var>scope</var>. | ||
</li> | ||
<li>Return <var>serviceworker</var>. | ||
<li>Return <var>registration</var>. | ||
</li> | ||
</ol> | ||
<div class="example"> | ||
In the following example, the web application is listing | ||
a service worker for the <code>/foo</code> scope: | ||
<pre class=""> | ||
<pre class="example"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: you can indent this normally, ReSpec handles that for you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
"serviceworker": { | ||
"src": "sw.js", | ||
"scope": "/foo" | ||
|
@@ -2904,14 +2907,14 @@ <h3> | |
<p> | ||
The <dfn>steps for processing the <code>src</code> member of a | ||
service worker</dfn> are given by the following algorithm. The algorithm takes | ||
a <a>serviceworker object</a> <var>serviceworker</var>, and a <a>URL</a> <var>manifest | ||
a <a>serviceworker object</a> <var>registration</var>, and a <a>URL</a> <var>manifest | ||
URL</var>, which is the <a>URL</a> from which the | ||
<var>manifest</var> was fetched. This algorithm will return a | ||
<a>URL</a> or <code>undefined</code>. | ||
</p> | ||
<ol> | ||
<li>Let <var>value</var> be the result of calling the | ||
<a>[[\GetOwnProperty]]</a> internal method of <var>serviceworker</var> | ||
<a>[[\GetOwnProperty]]</a> internal method of <var>registration</var> | ||
passing " <code>src</code>" as the argument. | ||
</li> | ||
<li>Let <var>type</var> be <a>Type</a>(<var>value</var>). | ||
|
@@ -2945,14 +2948,14 @@ <h3> | |
<p> | ||
The <dfn>steps for processing the <code>scope</code> member of a | ||
service worker</dfn> are given by the following algorithm. The algorithm takes | ||
a <a>serviceworker object</a> <var>serviceworker</var>, and a <a>URL</a> <var>manifest | ||
a <a>serviceworker object</a> <var>registration</var>, and a <a>URL</a> <var>manifest | ||
URL</var>, which is the <a>URL</a> from which the | ||
<var>manifest</var> was fetched. This algorithm will return a | ||
<a>URL</a> or <code>undefined</code>. | ||
</p> | ||
<ol> | ||
<li>Let <var>value</var> be the result of calling the | ||
<a>[[\GetOwnProperty]]</a> internal method of <var>serviceworker</var> | ||
<a>[[\GetOwnProperty]]</a> internal method of <var>registration</var> | ||
passing " <code>scope</code>" as the argument. | ||
</li> | ||
<li>Let <var>type</var> be <a>Type</a>(<var>value</var>). | ||
|
@@ -3149,6 +3152,10 @@ <h2> | |
<dfn><code>default-src</code></dfn></a> directives are defined in | ||
[[!CSP3]]. | ||
</p> | ||
<p> | ||
The <a href="https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy"> | ||
<dfn>Is origin potentially trustworthy</dfn></a> is defined in [[!SECURE-CONTEXTS]] | ||
</p> | ||
<p> | ||
The <a href= | ||
"https://www.ecma-international.org/ecma-402/1.0/#sec-6.2.2"><dfn>IsStructurallyValidLanguageTag</dfn></a> | ||
|
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.
Nit: Is there some unversioned reference we can use here instead of V1?
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.
Not as far as I could see. @jungkees ?