@@ -28,6 +28,7 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/
2828 text: create a new top-level browsing context; url: creating-a-new-top-level-browsing-context
2929 urlPrefix: browsing-the-web.html
3030 text: prompt to unload; url: prompt-to-unload-a-document
31+ text: reserved environment; for: navigation params; url: navigation-params-reserved-environment
3132 urlPrefix: common-dom-interfaces.html
3233 text: limited to only known values; url: limited-to-only-known-values
3334 text: reflect; url: reflect
@@ -537,14 +538,15 @@ spec: ecma-262; urlPrefix: http://tc39.github.io/ecma262/
537538 1. [=Navigate=] |guestBrowsingContext| to |resource|.
538539
539540 <div class="note">
540- Unlike an <{iframe}> element, a <{portal}> element supports a state where
541- it has no associated browsing context. This is the initial state of a
542- <{portal}> element (i.e., it has no initial `about:blank` document;
543- instead it navigates directly to the first parsable URL assigned to it).
544-
545- Similarly, a <{portal}> element responds to an unparsable <{portal/src}>
546- URL by [=close a browsing context|closing=] its browsing context, rather
547- than by navigating to `about:blank`.
541+ Unlike an <{iframe}> element, a <{portal}> element supports a state where it has no associated
542+ browsing context. This is the initial state of a <{portal}> element. That is, the [=portal
543+ browsing context=] has no web-developer-visible initial `about:blank` {{Document}} ; instead it
544+ [=navigates=] directly to the first parsable URL assigned to it, and if the navigation cannot
545+ finish successfully, it [=close a browsing context|closes=] the browsing context before the
546+ navigation algorithm finishes.
547+
548+ Similarly, a <{portal}> element responds to an unparsable <{portal/src}> URL by [=close a
549+ browsing context|closing=] its browsing context, rather than by navigating to `about:blank`.
548550 </div>
549551 </section>
550552
@@ -968,6 +970,69 @@ spec: ecma-262; urlPrefix: http://tc39.github.io/ecma262/
968970 portals-close-window.html
969971 </wpt>
970972
973+ Navigation {#patch-navigation}
974+ ------------------------------
975+
976+ Patch the <a spec=HTML>navigate</a> algorithm to prevent certain navigations in a
977+ portal as follows:
978+
979+ <div algorithm="navigate patch">
980+ In <a spec=HTML>navigate</a> , in the case where <var ignore> resource</var> is a [=request=]
981+ whose [=request/url=] 's [=url/scheme=] is "`javascript`", prepend the following step as the
982+ first step of the queued task:
983+
984+ 1. If |browsingContext|'s [=portal state=] is not "`none`", then [=close a portal
985+ element|close=] |browsingContext|'s [=host element=] and abort these steps.
986+ </div>
987+
988+ <div algorithm="process a navigate response patch">
989+ In <a spec=HTML>process a navigate response</a> , append the following after the step which
990+ establishes the value of |failure|, but before the step which uses it to display an error page:
991+
992+ 1. If |browsingContext|'s [=portal state=] is not "`none`", and any of the following hold:
993+
994+ * |failure| is true;
995+ * |response|'s [=response/url=] is null;
996+ * |response| has a \``Content-Disposition`\` header specifying the `attachment`
997+ disposition type; or
998+ * |response|'s [=response/status=] is 204 or 205,
999+
1000+ then:
1001+
1002+ 1. If |browsingContext|'s only entry in its [=session history=] is the initial `about:blank`
1003+ {{Document}} , then:
1004+ 1. [=Close a portal element|Close=] |browsingContext|'s [=host element=] .
1005+ 1. Run the [=environment discarding steps=] for <var ignore> navigationParam</var> 's
1006+ [=navigation params/reserved environment=] .
1007+ 1. Return.
1008+ 1. Otherwise, return.
1009+
1010+ <p class="note"> If |response| has a non-null [=response/url=] , then that URL's
1011+ [=url/scheme=] will always be a [=HTTP(S) scheme=] .</p>
1012+ </div>
1013+
1014+ <div algorithm="process a navigate URL scheme patch">
1015+ In <a spec=HTML>process a navigate URL scheme</a> , insert the following step before the step
1016+ which displays inline content:
1017+
1018+ 1. Otherwise, if |browsingContext|'s [=portal state=] is not "`none`", then [=close a portal
1019+ element|close=] |browsingContext|'s [=host element=] .
1020+ </div>
1021+
1022+ Downloading resources {#patch-downloading}
1023+ ------------------------------------------
1024+
1025+ Modify the <a spec=HTML>allowed to download</a> algorithm to ensure that portaled content never
1026+ performs downloads, by prepending the following steps:
1027+
1028+ <div algorithm="allowed to download patch">
1029+ 1. If <var ignore> initiator browsing context</var> 's [=portal state=] is not "`none`", then
1030+ return false.
1031+
1032+ 1. If <var ignore> instantiator browsing context</var> 's [=portal state=] is not "`none`", then
1033+ return false.
1034+ </div>
1035+
9711036</section>
9721037
9731038<section>
0 commit comments