-
Notifications
You must be signed in to change notification settings - Fork 313
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
Bikeshed cleanup #1014
Bikeshed cleanup #1014
Conversation
Found a few cases where the auto-linker is picking up the wrong thing. Fixing now… |
Haha ok it's pretty broken, don't bother reviewing until I wave. A few markdown issues related to nested lists caught me out. It's different to github. |
Ok, it's in a somewhat better shape now. Here are the intentional (larger) changes I made
|
Great move. Was keen to change the following:
I'll review. |
Three commits are missing from the master: eda15f6, c2a518b, I guess rebasing seems harder than merging them manually? If so, I can help. Also shaping V1 would be a job. Wouldn't it be easier to separate it out from the Nightly when we're ready for the last WD before moving to CR? |
It seems we can keep Storage Considerations with some non-normative words? People tend to ask what happens if the storage with the Cache API gets full. Yeah, I agree better wording's needed to keep it. |
You need to rebase if you want to land this successfully. |
Suggestion: what about changing function names to lowercase? The history they are currently uppercase for each word is that I tried to use ECMAScript internal method notation in the early days. And later we dropped the double-brackets. I think we can just move to lowercase as in the other specs. |
@annevk, do you see 100 char wrapping rule is really helpful? |
@jungkees yeah, I'm aware that work on master continues as I'm working on this. Let's manually merge them once the branch is done. When it comes to V1… hmm. I'd rather not introduce a whole new version. I'll take a look at how much effort it would be to convert V1. |
OK. The important bit would be to not loose the commit history. Let's leave the relevant description when manual merging is needed. |
@jungkees wrapping tends to make diffs more readable, but sometimes not. |
I'm in two minds about it. The lack of wrapping make it a lot easier to do multi-cursor editing and find/replace during this PR. |
Whenever I wrap for DOM, Fetch, etc. I leave terms unwrapped to make finding and replacing them easy, but HTML follows a different convention... I don't really understand what you mean by manually merging btw. Is the plan to keep the git history linear? |
Sorry, yes, I mean "manually rebase" I guess. Intent is to remain linear. |
I've reviewed the diff with the HTML output from 0dcd798 (the current branch point) and it looks good to me. Going to give it a second reading to be sure. Btw, temporarily re-adding the "storage considerations" section makes the diff a lot more readable. |
…now. The whole spec isn’t here yet.
d55cc7d
to
87cc817
Compare
@jakearchibald, I rebased it onto master and fixed some minor errors. I still encounters one bikeshed error though:
Do you have any clue? I think the current snapshot seems good-to-go after resolving the above issue. Re V1, do you have any suggestion how to shape it? |
You can find out the line for an error with |
No, those ! indicate the abstract operation does not throw. They have meaning and should probably not be removed. Curious that Service Workers plays with |
This reverts commit 5d841b6.
@annevk oops. TIL. Going to try to get bikeshed working locally so I can investigate that error. However, it seems to be failing with commits that I'm pretty certain it was working with a few days ago, so it might be a bikeshed issue. |
Yeah this is a bikeshed regression speced/bikeshed#884 |
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.
Awesome cleanup. Thanks for cleaning up my mess :) I haven't quite made it through the entire thing yet, but it looks good I think. Just some random ideas for possible future improvements.
|
||
<p>The <a href="#dfn-service-worker">service worker</a> is designed first to redress this balance by providing a Web Worker context, which can be started by a runtime when navigations are about to occur. This event-driven worker is registered against an origin and a path (or pattern), meaning it can be consulted when navigations occur to that location. Events that correspond to network requests are dispatched to the worker and the responses generated by the worker may override default network stack behavior. This puts the <a href="#dfn-service-worker">service worker</a>, conceptually, between the network and a document renderer, allowing the <a href="#dfn-service-worker">service worker</a> to provide content for documents, even while offline.</p> | ||
The <a for="/">service worker</a> is designed first to redress this balance by providing a Web Worker context, which can be started by a runtime when navigations are about to occur. This event-driven worker is registered against an origin and a path (or pattern), meaning it can be consulted when navigations occur to that location. Events that correspond to network requests are dispatched to the worker and the responses generated by the worker may override default network stack behavior. This puts the <a for="/">service worker</a>, conceptually, between the network and a document renderer, allowing the <a for="/">service worker</a> to provide content for documents, even while offline. |
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.
depending on how shorthand-rather-than-html you want to go, all these "<a for="/">service worker</a>"
bits could be written as [=/service worker=]
.
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 like it! [=/service worker=]
, [=ServiceWorkerGlobalScope/service worker=]
work fine and are shorter to type.
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.
Replaced all the <a for="thing">a dfn for thing</a>
style anchors with [=thing/a dfn for thing=]
style shorthands. I didn't change the existing <a>to dfn</a>
(without for attribute) occurrences yet. Would it be better to change all of them to [=to dfn=]
?
</ol> | ||
The <dfn method for="ServiceWorker"><code>postMessage(|message|, |transfer|)</code></dfn> method *must* run these steps: | ||
|
||
1. If the {{ServiceWorker/state}} attribute value of the <a>context object</a> is "<code>redundant</code>", <a>throw</a> an "{{InvalidStateError}}" exception and abort these steps. |
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.
"<code>redundant</code>"
could also be written as {{"redundant"}}
(or {{ServiceWorkerState/"redundant"}}
to get proper cross-references for enum values.
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.
{{ServiceWorkerState/"redundant"}}
would be nice.
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.
Changed them to {{"enumvalue"}}
style. I didn't put ServiceWorkerState/
within the spec. Also I left them "<code>string</code>"
when they represent just a string.
|
||
A <a for="/">service worker</a> has an associated <dfn export id="dfn-service-worker-global-object" for="service worker">global object</dfn> (a {{ServiceWorkerGlobalScope}} object or null). | ||
|
||
A <a for="/">service worker</a> is dispatched a set of <dfn export id="dfn-lifecycle-events">lifecycle events</dfn>, <a event for="ServiceWorkerGlobalScope">install</a> and <a event for="ServiceWorkerGlobalScope">activate</a>, and <dfn export id="dfn-functional-events">functional events</dfn> including <a event for="ServiceWorkerGlobalScope">fetch</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.
You're a bit inconsistent with how you link to event types. Here you use the full <a ...>
syntax, while in other places you would have written this as {{install!!event}}
(or {{ServiceWorkerGlobalScope/install!!event}}
if you want to be explicit about which install event you're talking about).
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's use {{install!!event}}
. I think it'd not be ambiguous without the event target within the spec.
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.
Done.
|
||
<p class="example">In the example in section 3.1.1, the value of <code>registration.scope</code>, obtained from <code>navigator.serviceWorker.ready.then(function(registration) { console.log(registration.scope); })</code> for example, will be "<code>https://example.com/</code>".</p> | ||
<div class="example"> | ||
In the example in section 3.1.1, the value of <code>registration.scope</code>, obtained from <code>navigator.serviceWorker.ready.then(registration => console.log(registration.scope))</code> for example, will be "<code>https://example.com/</code>". |
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.
Maybe change section 3.1.1
to [[#service-worker-url]]
to get auto-linking to that section? Although not sure if having the section title in the resulting link will make it more or less readable here.
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.
Changed it. Enabling a link seems better.
1. Run the following substeps <a>in parallel</a>: | ||
1. Let |array| be an empty array. | ||
1. <a for="map">For each</a> |key| → |value| of <a>scope to registration map</a>: | ||
1. If the <a for="environment settings object">origin</a> of the result of <a lt="URL parser">parsing</a> |key| is the <a lt="same origin">same</a> as |client|'s <a for="environment settings object">origin</a>, and |value|'s <a>uninstalling flag</a> is unset, add the {{ServiceWorkerRegistration}} object associated with |value| to the |array|. |
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.
The first origin here should be <a for="url">
as it's referring to the origin of a url rather than that of a settings object (I know, I made quite a mess about linking to the correct origin definition whenever an origin was used).
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.
@@ -765,7 +716,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 | |||
<tr> | |||
<td><dfn event id="service-worker-container-controllerchange-event"><code>controllerchange</code></dfn></td> | |||
<td>{{Event}}</td> | |||
<td>The <a for="ServiceWorkerContainer">service worker client</a>'s <a>active service worker</a> changes. (See step 9.2 of the <a href="#activation-algorithm">Activate</a> algorithm. The <a href="#dfn-skip-waiting-flag">skip waiting flag</a> of a <a href="#dfn-service-worker">service worker</a> causes <a href="#activation-algorithm">activation</a> of the <a href="#dfn-service-worker-registration">service worker registration</a> to occur while <a href="#dfn-service-worker-client">service worker clients</a> are <a href="#dfn-use">using</a> the <a href="#dfn-service-worker-registration">service worker registration</a>, {{ServiceWorkerContainer/controller|navigator.serviceWorker.controller}} immediately reflects the <a href="#dfn-active-worker">active worker</a> as the <a href="#dfn-service-worker">service worker</a> that <a href="#dfn-control">controls</a> the <a href="#dfn-service-worker-client">service worker client</a>.)</td> | |||
<td>The <a for="ServiceWorkerContainer">service worker client</a>'s <a>active service worker</a> changes. (See step 9.2 of the <a>Activate</a> algorithm. The <a>skip waiting flag</a> of a <a for="/">service worker</a> causes <a lt="activate">activation</a> of the <a for="/">service worker registration</a> to occur while <a for="/">service worker clients</a> are <a>using</a> the <a for="/">service worker registration</a>, {{ServiceWorkerContainer/controller|navigator.serviceWorker.controller}} immediately reflects the <a>active worker</a> as the <a for="/">service worker</a> that <a>controls</a> the <a for="/">service worker client</a>.)</td> |
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.
@tabatkins hmm, would be nice if bikeshed provided a way to link to specific steps in an algorithm that would get rendered as "step 9.2", but wouldn't require hard-coding and manually keeping up to date the numbering (like it already sort of supports for sections).
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.
Yup, that's tracked as speced/bikeshed#796 already. ^_^
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.
Yes, this will help a lot for both discussion and writing.
@mkruisselbrink, your comments are great. I'll address them. |
@jakearchibald, I'm working on V1. |
Haha I'm running out of things to do on my flight home. Thanks for taking a look, let me know if there's anything I can do. |
Haha, that's OK. I just uploaded a patch having merged the changes to V1. Please review and merge this PR if it looks good. |
Aaaaand we're merged! Thank you @jungkees @mkruisselbrink and @annevk. |
Bikeshed is now building the spec without complaining, aside from the lack of privacy considerations.
I'm now going to go through a diff of this and the current spec and see if anything's broken.
I've made some intentional changes along the way, and I'll detail them here for review.
Once it's in a good place I'll merge in the changes that have been made to the spec since I started.