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

Move unregister() to PushRegistration. #97

Merged
merged 1 commit into from Dec 15, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 29 additions & 31 deletions index.html
Expand Up @@ -171,9 +171,10 @@ <h2>
<code><a href=
"http://www.w3.org/TR/dom/#notfounderror"><dfn>NotFoundError</dfn></a></code>,
<code><a href=
"http://www.w3.org/TR/dom/#securityerror"><dfn>SecurityError</dfn></a></code>, and <a href=
"http://www.w3.org/TR/dom/#concept-event-constructor"><dfn>steps for constructing
events</dfn></a> are defined in [[!DOM]].
"http://www.w3.org/TR/dom/#securityerror"><dfn>SecurityError</dfn></a></code>,
<code><a href="http://www.w3.org/TR/dom/#networkerror"><dfn>NetworkError</dfn></a></code>,
and <a href="http://www.w3.org/TR/dom/#concept-event-constructor"><dfn>steps for
constructing events</dfn></a> are defined in [[!DOM]].
</p>
<p>
<dfn>Service Worker</dfn>, <dfn>ServiceWorkerRegistration</dfn>,
Expand Down Expand Up @@ -441,9 +442,6 @@ <h2>
<dt>
Promise&lt;PushRegistration&gt; register ()
</dt>
<dt>
Promise&lt;PushRegistration&gt; unregister ()
</dt>
<dt>
Promise&lt;PushRegistration&gt; getRegistration ()
</dt>
Expand Down Expand Up @@ -505,31 +503,6 @@ <h2>
has not yet been defined in a specification, this document currently links to the bug for
defining it.
</p>
<p>
The <code><dfn id=
"widl-PushRegistrationManager-unregister-Promise-PushRegistration">unregister</dfn></code>
method when invoked MUST run the following steps:
</p>
<ol>
<li>Let <var>promise</var> be a new <a><code>Promise</code></a>.
</li>
<li>Return <var>promise</var> and continue the following steps asynchronously.
</li>
<li>If the <a>webapp</a> is not registered, reject <var>promise</var> with a
<code><a>DOMException</a></code> whose name is "<code><a>NotFoundError</a></code>" and
terminate these steps.
</li>
<li>Make a request to the system to deactivate the <a>push registration</a> associated with
the <a>webapp</a>.
</li>
<li>If there is an error, reject <var>promise</var> with a <code><a>DOMException</a></code>
whose name is "<code><a>AbortError</a></code>" and terminate these steps.
</li>
<li>When the request has been completed, resolve <var>promise</var> with a
<a><code>PushRegistration</code></a> providing the details of the <a>push registration</a>
which has been unregistered.
</li>
</ol>
<p>
The <code><dfn id=
"widl-PushRegistrationManager-getRegistration-Promise-PushRegistration">getRegistration</dfn></code>
Expand Down Expand Up @@ -644,6 +617,9 @@ <h2>
<dt>
readonly attribute DOMString registrationId
</dt>
<dt>
Promise&lt;boolean&gt; unregister ()
</dt>
</dl>
<p>
When getting the <code><dfn id="widl-PushRegistration-endpoint">endpoint</dfn></code>
Expand All @@ -662,6 +638,28 @@ <h2>
<code>registrationId</code> and <code>endpoint</code> is expected to be unique and specific
to a particular <a>webapp</a> instance running on a specific device.
</p>
<p>
The <code><dfn id=
"widl-PushRegistration-unregister-Promise-boolean">unregister</dfn></code> method when
invoked MUST run the following steps:
</p>
<ol>
<li>Let <var>promise</var> be a new <a><code>Promise</code></a>.
</li>
<li>Return <var>promise</var> and continue the following steps asynchronously.
</li>
<li>If the <a>webapp</a> is not registered, resolve <var>promise</var> with
<code>false</code> and terminate these steps.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we were still considering whether this should return true, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

How so?

Copy link
Contributor

Choose a reason for hiding this comment

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

For the case where unregister is called twice. The desired result was achieved: you are unregistered. That sounds more like true than false.

Copy link
Member Author

Choose a reason for hiding this comment

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

I disagree. The entire idea of returning a boolean is to point that nothing actually happen. This is also what we do for ServiceWorker.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's weird, but I don't feel too strongly about it and aligning with sw is good. lgtm

</li>
<li>Make a request to the system to deactivate the <a>push registration</a> associated with
the <a>webapp</a>.
</li>
<li>If it was not possible to access the <a>push server</a>, reject <var>promise</var> with
a "<code><a>NetworkError</a></code>" exception and terminate these steps.
</li>
<li>When the request has been completed, resolve <var>promise</var> with <code>true</code>.
</li>
</ol>
</section>
<section>
<h2>
Expand Down