@@ -1699,7 +1699,8 @@ navigation status</dfn> struct, which has the following items:
16991699
17001700BrowsingContextCommand = (
17011701 BrowsingContextGetTreeCommand //
1702- BrowsingContextNavigateCommand
1702+ BrowsingContextNavigateCommand //
1703+ BrowsingContextReloadCommand
17031704)
17041705</pre>
17051706
@@ -1830,6 +1831,85 @@ To <dfn>get the browsing context info</dfn> given |context|,
18301831
18311832 1. Return |contexts info|
18321833
1834+ </div>
1835+
1836+ <div algorithm>
1837+ To <dfn>await a navigation</dfn> given |context|, |request| and optionally
1838+ |history handling| (default: "<code> default</code> ") and |ignore cache| (default: false):
1839+
1840+ 1. Let |navigation id| be the string representation of a
1841+ [[!RFC4122|UUID]] based on truly random, or pseudo-random numbers.
1842+
1843+ 1. [=Navigate=] |context| with resource |request|, and using |context| as the
1844+ [=source browsing context=] , with navigation id |navigation id|, and history
1845+ handling |history handling|. If |ignore cache| is true, the navigation must
1846+ not load resources from the HTTP cache.
1847+
1848+ Issue: property specify how the |ignore cache| flag works. This needs to
1849+ consider whether only the first load of a resource bypasses the cache
1850+ (i.e. whether this is like initially clearing the cache and proceeding like
1851+ normal), or whether resources not directly loaded by the HTML parser
1852+ (e.g. loads initiated by scripts or stylesheets) also bypass the cache.
1853+
1854+ 1. Let (|event received|, |navigate status|) be [=await=] given
1855+ «"<code> navigation started</code> ", "<code> navigation failed</code> ",
1856+ and "<code> fragment navigated</code> "» and |navigation id|.
1857+
1858+ 1. Assert: |navigate status|'s id is |navigation id|.
1859+
1860+ 1. If |navigate status|'s status is "<code> complete</code> ":
1861+
1862+ 1. Let |body| be a [=map=] matching the
1863+ <code> BrowsingContextNavigateResult</code> production, with the
1864+ <code> navigation</code> field set to |navigation id|, and the
1865+ <code> url</code> field set to the result of the [=URL serializer=] given
1866+ |navigate status|'s url.
1867+
1868+ 1. Return [=success=] with data |body|.
1869+
1870+ 1. If |navigate status|'s status is "<code> canceled</code> " return [=error=]
1871+ with [=error code=] [=unknown error=] .
1872+
1873+ TODO: is this the right way to handle errors here?
1874+
1875+ 1. Assert: |navigate status|'s status is "<code> pending</code> " and
1876+ |navigation id| is not null.
1877+
1878+ 1. If |wait condition| is "<code> none</code> ":
1879+
1880+ 1. Let |body| be a [=map=] matching the
1881+ <code> BrowsingContextNavigateResult</code> production, with the
1882+ <code> navigation</code> field set to |navigation id|, and the
1883+ <code> url</code> field set to the result of the [=URL serializer=] given
1884+ |navigate status|'s url.
1885+
1886+ 1. Return [=success=] with data |body|.
1887+
1888+ 1. If |wait condition| is "<code> interactive</code> ", let |event name| be
1889+ "<code> domContentLoaded</code> ", otherwise let |event name| be
1890+ "<code> load</code> ".
1891+
1892+ 1. Let (|event received|, |status|) be [=await=] given «|event name|,
1893+ "<code> download started</code> ", "<code> navigation aborted</code> ",
1894+ "<code> navigation failed</code> "» and |navigation id|.
1895+
1896+ 1. If |event received| is "<code> navigation failed</code> "
1897+ return [=error=] with [=error code=] [=unknown error=] .
1898+
1899+ Issue: Are we surfacing enough information about what failed and why with
1900+ an error here? What error code do we want? Is there going to be a problem
1901+ where local ends parse the implementation-defined strings to figure out
1902+ what actually went wrong?
1903+
1904+ 1. Let |body| be a [=map=] matching the
1905+ <code> BrowsingContextNavigateResult</code> production, with the
1906+ <code> navigation</code> field set to |status|'s id, and the
1907+ <code> url</code> field set to the result of the [=URL serializer=] given
1908+ |status|'s url.
1909+
1910+ 1. Return [=success=] with data |body|.
1911+
1912+
18331913</div>
18341914
18351915#### The browsingContext.Navigation Type #### {#type-browsingContext-Navigation}
@@ -1976,9 +2056,6 @@ The [=remote end steps=] with |command parameters| are:
19762056
19772057 1. Assert: |context| is not null.
19782058
1979- 1. Let |wait condition| be the value of the <code> wait</code> field of |command
1980- parameters| if present, or "<code> none</code> " otherwise.
1981-
19822059 1. Let |url| be the value of the <code> url</code> field of |command
19832060 parameters|.
19842061
@@ -1994,93 +2071,62 @@ The [=remote end steps=] with |command parameters| are:
19942071
19952072 1. Let |request| be a new [=/request=] whose URL is |url record|.
19962073
1997- 1. Let |navigation id| be the string representation of a
1998- [[!RFC4122|UUID]] based on truly random, or pseudo-random numbers.
1999-
2000- 1. [=Navigate=] |context| with resource |request|, and using |context| as the
2001- [=source browsing context=] , and with navigation id |navigation id|.
2002-
2003- 1. Let (|event received|, |navigate status|) be [=await=] given
2004- «"<code> navigation started</code> ", "<code> navigation failed</code> ",
2005- and "<code> fragment navigated</code> "» and |navigation id|.
2006-
2007- 1. Assert: |navigate status|'s id is |navigation id|.
2008-
2009- 1. If |navigate status|'s status is "<code> complete</code> ":
2010-
2011- 1. Let |body| be a [=map=] matching the
2012- <code> BrowsingContextNavigateResult</code> production, with the
2013- <code> navigation</code> field set to |navigation id|, and the
2014- <code> url</code> field set to the result of the [=URL serializer=] given
2015- |navigate status|'s url.
2074+ 1. Return the result of [=await a navigation=] with |context| and |request|.
20162075
2017- 1. Return [=success=] with data |body|, and then run the following steps [=in
2018- parallel=] :
2019-
2020- 1. Run the [=WebDriver-BiDi fragment navigated=] steps given |context|
2021- and |navigate status|
2022-
2023- Note: this is the case if the navigation only caused the fragment to
2024- change. The parallel steps here ensure that we return the command result
2025- before emitting the event, so the navigation id is known.
2026-
2027- 1. If |navigate status|'s status is "<code> canceled</code> " return [=error=]
2028- with [=error code=] [=unknown error=] .
2029-
2030- TODO: is this the right way to handle errors here?
2076+ </div>
20312077
2032- 1. Assert: |navigate status|'s status is "<code> pending</code> " and
2033- |navigation id| is not null.
2078+ #### The browsingContext.reload Command #### {#command-browsingContext-reload}
20342079
2035- 1. If |wait condition| is "<code> none</code> ":
2080+ The <dfn export for=commands>browsingContext.reload</dfn> command reloads a
2081+ browsing context.
20362082
2037- 1. Let |body| be a [=map=] matching the
2038- <code> BrowsingContextNavigateResult</code> production, with the
2039- <code> navigation</code> field set to |navigation id|, and the
2040- <code> url</code> field set to the result of the [=URL serializer=] given
2041- |navigate status|'s url.
2083+ <dl>
2084+ <dt> Command Type</dt>
2085+ <dd>
2086+ <pre class="cddl remote-cddl">
2087+ BrowsingContextReloadCommand = {
2088+ method: "browsingContext.reload",
2089+ params: BrowsingContextReloadParameters
2090+ }
20422091
2043- 1. Return [=success=] with data |body|, and then run the following steps [=in
2044- parallel=] :
2092+ BrowsingContextReloadParameters = {
2093+ context: BrowsingContext,
2094+ ?ignoreCache: boolean,
2095+ ?wait: ReadinessState,
2096+ }
2097+ </pre>
2098+ </dd>
2099+ </dl>
20452100
2046- 1. Run the [=WebDriver-BiDi navigation started=] steps given |context|
2047- and |navigate status|
2101+ <div algorithm="remote end steps for browsingContext.reload">
2102+ The [=remote end steps=] with |command parameters| are:
20482103
2049- 1. Run the [=WebDriver-BiDi navigation started=] steps given | context|
2050- and |navigate status|
2104+ 1. Let |context id| be the value of the <code> context</code> field of
2105+ |command parameters|.
20512106
2052- Note: this event was previously suppressed to ensure that it would come
2053- after the command response in the case that |wait condition| is
2054- "<code> none</code> ".
2107+ 1. Let |context| be the result of [=trying=] to [=get a browsing context=]
2108+ with |context id|.
20552109
2056- Issue: Replace this suppression mechanism with an event queue .
2110+ 1. Assert: |context| is not null .
20572111
2058- 1. If |wait condition| is "<code> interactive</code> ", let |event name| be
2059- "<code> domContentLoaded</code> ", otherwise let |event name| be
2060- "<code> load</code> ".
2112+ 1. Let |ignore cache| be the the value of the <code> ignoreCache</code> field of |command
2113+ parameters| if present, or false otherwise.
20612114
2062- 1. Let (|event received|, |status|) be [=await=] given «|event name|,
2063- "<code> download started</code> ", "<code> navigation aborted</code> ",
2064- "<code> navigation failed</code> "» and |navigation id|.
2115+ 1. Let |wait condition| be the value of the <code> wait</code> field of |command
2116+ parameters| if present, or "<code> none</code> " otherwise.
20652117
2066- 1. If |event received| is "<code> navigation failed</code> "
2067- return [=error=] with [=error code=] [=unknown error=] .
2118+ 1. Let |document| be |context|'s [=active document=] .
20682119
2069- Issue: Are we surfacing enough information about what failed and why with
2070- an error here? What error code do we want? Is there going to be a problem
2071- where local ends parse the implementation-defined strings to figure out
2072- what actually went wrong?
2120+ 1. Let |URL| be |document|'s <a spec=DOM>URL</a> .
20732121
2074- 1. Let |body| be a [=map=] matching the
2075- <code> BrowsingContextNavigateResult</code> production, with the
2076- <code> navigation</code> field set to |status|'s id, and the
2077- <code> url</code> field set to the result of the [=URL serializer=] given
2078- |status|'s url.
2122+ 1. Let |request| be a new [=/request=] whose URL is |URl|.
20792123
2080- 1. Return [=success=] with data |body|.
2124+ 1. Return the result of [=await a navigation=] with |context|, |request|,
2125+ history handling "<code> reload</code> ", and ignore cache |ignore cache|.
20812126
20822127</div>
20832128
2129+
20842130### Events ### {#module-contexts-events}
20852131
20862132#### The browsingContext.contextCreated Event #### {#event-browsingContext-contextCreated}
0 commit comments