@@ -101,12 +101,14 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/
101101 text: create a new browsing context; url: creating-a-new-browsing-context
102102 text: environment settings object's Realm; url: environment-settings-object's-realm
103103 text: handled; url: concept-error-handled
104+ text: history handling behavior; url: history-handling-behavior
104105 text: navigation id; url: concept-navigation-id
105106 text: report an error; url: report-the-error
106107 text: remove a browsing context; url: bcg-remove
107108 text: session history; url: session-history
108109 text: set up a window environment settings object; url: set-up-a-window-environment-settings-object
109110 text: set up a worker environment settings object; url: set-up-a-worker-environment-settings-object
111+ text: set up a worklet environment settings object; url: set-up-a-worklet-environment-settings-object
110112 text: worker event loop; url: worker-event-loop-2
111113 text: worklet global scopes; url: concept-document-worklet-global-scopes
112114</pre>
@@ -1702,7 +1704,8 @@ navigation status</dfn> struct, which has the following items:
17021704
17031705BrowsingContextCommand = (
17041706 BrowsingContextGetTreeCommand //
1705- BrowsingContextNavigateCommand
1707+ BrowsingContextNavigateCommand //
1708+ BrowsingContextReloadCommand
17061709)
17071710</pre>
17081711
@@ -1833,6 +1836,88 @@ To <dfn>get the browsing context info</dfn> given |context|,
18331836
18341837 1. Return |contexts info|
18351838
1839+ </div>
1840+
1841+ <div algorithm>
1842+ To <dfn>await a navigation</dfn> given |context|, |request|, |wait condition|, and optionally
1843+ |history handling| (default: "<code> default</code> ") and |ignore cache| (default: false):
1844+
1845+ 1. Let |navigation id| be the string representation of a
1846+ [[!RFC4122|UUID]] based on truly random, or pseudo-random numbers.
1847+
1848+ 1. [=Navigate=] |context| with resource |request|, and using |context| as the
1849+ [=source browsing context=] , with [=navigation id=] |navigation id|, and
1850+ [=history handling behavior=] |history handling|. If |ignore cache| is true, the
1851+ navigation must not load resources from the HTTP cache.
1852+
1853+ Issue: property specify how the |ignore cache| flag works. This needs to
1854+ consider whether only the first load of a resource bypasses the cache
1855+ (i.e. whether this is like initially clearing the cache and proceeding like
1856+ normal), or whether resources not directly loaded by the HTML parser
1857+ (e.g. loads initiated by scripts or stylesheets) also bypass the cache.
1858+
1859+ 1. Let (|event received|, |navigate status|) be [=await=] given
1860+ «"<code> navigation started</code> ", "<code> navigation failed</code> ",
1861+ "<code> fragment navigated</code> "», and |navigation id|.
1862+
1863+ 1. Assert: |navigate status|'s id is |navigation id|.
1864+
1865+ 1. If |navigate status|'s status is "<code> complete</code> ":
1866+
1867+ 1. Let |body| be a [=map=] matching the
1868+ <code> BrowsingContextNavigateResult</code> production, with the
1869+ <code> navigation</code> field set to |navigation id|, and the
1870+ <code> url</code> field set to the result of the [=URL serializer=] given
1871+ |navigate status|'s url.
1872+
1873+ 1. Return [=success=] with data |body|.
1874+
1875+ Note: this is the case if the navigation only caused the fragment to
1876+ change.
1877+
1878+ 1. If |navigate status|'s status is "<code> canceled</code> " return [=error=]
1879+ with [=error code=] [=unknown error=] .
1880+
1881+ TODO: is this the right way to handle errors here?
1882+
1883+ 1. Assert: |navigate status|'s status is "<code> pending</code> " and
1884+ |navigation id| is not null.
1885+
1886+ 1. If |wait condition| is "<code> none</code> ":
1887+
1888+ 1. Let |body| be a [=map=] matching the
1889+ <code> BrowsingContextNavigateResult</code> production, with the
1890+ <code> navigation</code> field set to |navigation id|, and the
1891+ <code> url</code> field set to the result of the [=URL serializer=] given
1892+ |navigate status|'s url.
1893+
1894+ 1. Return [=success=] with data |body|.
1895+
1896+ 1. If |wait condition| is "<code> interactive</code> ", let |event name| be
1897+ "<code> domContentLoaded</code> ", otherwise let |event name| be
1898+ "<code> load</code> ".
1899+
1900+ 1. Let (|event received|, |status|) be [=await=] given «|event name|,
1901+ "<code> download started</code> ", "<code> navigation aborted</code> ",
1902+ "<code> navigation failed</code> "» and |navigation id|.
1903+
1904+ 1. If |event received| is "<code> navigation failed</code> "
1905+ return [=error=] with [=error code=] [=unknown error=] .
1906+
1907+ Issue: Are we surfacing enough information about what failed and why with
1908+ an error here? What error code do we want? Is there going to be a problem
1909+ where local ends parse the implementation-defined strings to figure out
1910+ what actually went wrong?
1911+
1912+ 1. Let |body| be a [=map=] matching the
1913+ <code> BrowsingContextNavigateResult</code> production, with the
1914+ <code> navigation</code> field set to |status|'s id, and the
1915+ <code> url</code> field set to the result of the [=URL serializer=] given
1916+ |status|'s url.
1917+
1918+ 1. Return [=success=] with data |body|.
1919+
1920+
18361921</div>
18371922
18381923#### The browsingContext.Navigation Type #### {#type-browsingContext-Navigation}
@@ -1997,93 +2082,64 @@ The [=remote end steps=] with |command parameters| are:
19972082
19982083 1. Let |request| be a new [=/request=] whose URL is |url record|.
19992084
2000- 1. Let |navigation id| be the string representation of a
2001- [[!RFC4122|UUID]] based on truly random, or pseudo-random numbers.
2002-
2003- 1. [=Navigate=] |context| with resource |request|, and using |context| as the
2004- [=source browsing context=] , and with navigation id |navigation id|.
2005-
2006- 1. Let (|event received|, |navigate status|) be [=await=] given
2007- «"<code> navigation started</code> ", "<code> navigation failed</code> ",
2008- and "<code> fragment navigated</code> "» and |navigation id|.
2009-
2010- 1. Assert: |navigate status|'s id is |navigation id|.
2011-
2012- 1. If |navigate status|'s status is "<code> complete</code> ":
2013-
2014- 1. Let |body| be a [=map=] matching the
2015- <code> BrowsingContextNavigateResult</code> production, with the
2016- <code> navigation</code> field set to |navigation id|, and the
2017- <code> url</code> field set to the result of the [=URL serializer=] given
2018- |navigate status|'s url.
2085+ 1. Return the result of [=await a navigation=] with |context|, |request| and
2086+ |wait condition|.
20192087
2020- 1. Return [=success=] with data |body|, and then run the following steps [=in
2021- parallel=] :
2022-
2023- 1. Run the [=WebDriver-BiDi fragment navigated=] steps given |context|
2024- and |navigate status|
2025-
2026- Note: this is the case if the navigation only caused the fragment to
2027- change. The parallel steps here ensure that we return the command result
2028- before emitting the event, so the navigation id is known.
2029-
2030- 1. If |navigate status|'s status is "<code> canceled</code> " return [=error=]
2031- with [=error code=] [=unknown error=] .
2032-
2033- TODO: is this the right way to handle errors here?
2088+ </div>
20342089
2035- 1. Assert: |navigate status|'s status is "<code> pending</code> " and
2036- |navigation id| is not null.
2090+ #### The browsingContext.reload Command #### {#command-browsingContext-reload}
20372091
2038- 1. If |wait condition| is "<code> none</code> ":
2092+ The <dfn export for=commands>browsingContext.reload</dfn> command reloads a
2093+ browsing context.
20392094
2040- 1. Let |body| be a [=map=] matching the
2041- <code> BrowsingContextNavigateResult</code> production, with the
2042- <code> navigation</code> field set to |navigation id|, and the
2043- <code> url</code> field set to the result of the [=URL serializer=] given
2044- |navigate status|'s url.
2095+ <dl>
2096+ <dt> Command Type</dt>
2097+ <dd>
2098+ <pre class="cddl remote-cddl">
2099+ BrowsingContextReloadCommand = {
2100+ method: "browsingContext.reload",
2101+ params: BrowsingContextReloadParameters
2102+ }
20452103
2046- 1. Return [=success=] with data |body|, and then run the following steps [=in
2047- parallel=] :
2104+ BrowsingContextReloadParameters = {
2105+ context: BrowsingContext,
2106+ ?ignoreCache: boolean,
2107+ ?wait: ReadinessState,
2108+ }
2109+ </pre>
2110+ </dd>
2111+ </dl>
20482112
2049- 1. Run the [=WebDriver-BiDi navigation started=] steps given |context|
2050- and |navigate status|
2113+ <div algorithm="remote end steps for browsingContext.reload">
2114+ The [=remote end steps=] with |command parameters| are:
20512115
2052- 1. Run the [=WebDriver-BiDi navigation started=] steps given | context|
2053- and |navigate status|
2116+ 1. Let |context id| be the value of the <code> context</code> field of
2117+ |command parameters|.
20542118
2055- Note: this event was previously suppressed to ensure that it would come
2056- after the command response in the case that |wait condition| is
2057- "<code> none</code> ".
2119+ 1. Let |context| be the result of [=trying=] to [=get a browsing context=]
2120+ with |context id|.
20582121
2059- Issue: Replace this suppression mechanism with an event queue .
2122+ 1. Assert: |context| is not null .
20602123
2061- 1. If |wait condition| is "<code> interactive</code> ", let |event name| be
2062- "<code> domContentLoaded</code> ", otherwise let |event name| be
2063- "<code> load</code> ".
2124+ 1. Let |ignore cache| be the the value of the <code> ignoreCache</code> field of |command
2125+ parameters| if present, or false otherwise.
20642126
2065- 1. Let (|event received|, |status|) be [=await=] given «|event name|,
2066- "<code> download started</code> ", "<code> navigation aborted</code> ",
2067- "<code> navigation failed</code> "» and |navigation id|.
2127+ 1. Let |wait condition| be the value of the <code> wait</code> field of |command
2128+ parameters| if present, or "<code> none</code> " otherwise.
20682129
2069- 1. If |event received| is "<code> navigation failed</code> "
2070- return [=error=] with [=error code=] [=unknown error=] .
2130+ 1. Let |document| be |context|'s [=active document=] .
20712131
2072- Issue: Are we surfacing enough information about what failed and why with
2073- an error here? What error code do we want? Is there going to be a problem
2074- where local ends parse the implementation-defined strings to figure out
2075- what actually went wrong?
2132+ 1. Let |url| be |document|'s <a spec=DOM>URL</a> .
20762133
2077- 1. Let |body| be a [=map=] matching the
2078- <code> BrowsingContextNavigateResult</code> production, with the
2079- <code> navigation</code> field set to |status|'s id, and the
2080- <code> url</code> field set to the result of the [=URL serializer=] given
2081- |status|'s url.
2134+ 1. Let |request| be a new [=/request=] whose URL is |url|.
20822135
2083- 1. Return [=success=] with data |body|.
2136+ 1. Return the result of [=await a navigation=] with |context|, |request|, |wait
2137+ condition|, history handling "<code> reload</code> ", and ignore
2138+ cache |ignore cache|.
20842139
20852140</div>
20862141
2142+
20872143### Events ### {#module-contexts-events}
20882144
20892145#### The browsingContext.contextCreated Event #### {#event-browsingContext-contextCreated}
0 commit comments