Skip to content

Commit

Permalink
Delay registerProtocolHandler() and unregisterProtocolHandler() until…
Browse files Browse the repository at this point in the history
… activation

To handle potential synchronous exceptions while normalizing parameters, this adds custom steps instead of using [DelayWhilePrerendering].
  • Loading branch information
nhiroki authored Nov 8, 2023
1 parent d4dd4da commit 0114801
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions prerendering.bs
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,24 @@ Add {{[DelayWhilePrerendering]}} to {{SpeechRecognition/start()}}, {{SpeechRecog

Add {{[DelayWhilePrerendering]}} to {{LockManager/request(name, callback)}}, {{LockManager/request(name, options, callback)}}, and {{LockManager/query()}}.

<h4 id="custom-scheme-handlers-patch">Custom Scheme Handlers</h4>

<div algorithm="dom-navigator-registerProtocolHandler patch">
Modify the {{NavigatorContentUtils/registerProtocolHandler(scheme, url)|registerProtocolHandler(scheme, url)}} method steps by overwriting the first few steps, before it goes [=in parallel=], as follows:

1. Let (<var ignore>normalizedScheme</var>, <var ignore>normalizedURLString</var>) be the result of running <a spec=HTML>normalize protocol handler parameters</a> with scheme, url, and [=this=]'s [=relevant settings object=].

1. If [=this=]'s [=relevant global object=]'s [=Window/navigable=] is a [=prerendering navigable=], then append the following steps to [=this=]'s [=platform object/post-prerendering activation steps list=] and return.
</div>

<div algorithm="dom-navigator-unregisterprotocolhandler patch">
Modify the {{NavigatorContentUtils/unregisterProtocolHandler(scheme, url)|unregisterProtocolHandler(scheme, url)}} method steps by overwriting the first few steps, before it goes [=in parallel=], as follows:

1. Let (<var ignore>normalizedScheme</var>, <var ignore>normalizedURLString</var>) be the result of running <a spec=HTML>normalize protocol handler parameters</a> with scheme, url, and [=this=]'s [=relevant settings object=].

1. If [=this=]'s [=relevant global object=]'s [=Window/navigable=] is a [=prerendering navigable=], then append the following steps to [=this=]'s [=platform object/post-prerendering activation steps list=] and return.
</div>

<h3 id="implicitly-restricted">Implicitly restricted APIs</h3>

Some APIs do not need modifications because they will automatically fail or no-op without a property that a [=prerendering navigable=], its [=navigable/active window=], or its [=navigable/active document=] will never have. These properties include:
Expand Down

0 comments on commit 0114801

Please sign in to comment.