@@ -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,106 @@ 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|, and then run the following steps [=in
1869+ parallel=] :
1870+
1871+ 1. Run the [=WebDriver-BiDi fragment navigated=] steps given |context|
1872+ and |navigate status|
1873+
1874+ Note: this is the case if the navigation only caused the fragment to
1875+ change. The parallel steps here ensure that we return the command result
1876+ before emitting the event, so the navigation id is known.
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|, and then run the following steps [=in
1895+ parallel=] :
1896+
1897+ 1. Run the [=WebDriver-BiDi navigation started=] steps given |context|
1898+ and |navigate status|
1899+
1900+ 1. Run the [=WebDriver-BiDi navigation started=] steps given |context|
1901+ and |navigate status|
1902+
1903+ Note: this event was previously suppressed to ensure that it would come
1904+ after the command response in the case that |wait condition| is
1905+ "<code> none</code> ".
1906+
1907+ Issue: Replace this suppression mechanism with an event queue.
1908+
1909+ 1. If |wait condition| is "<code> interactive</code> ", let |event name| be
1910+ "<code> domContentLoaded</code> ", otherwise let |event name| be
1911+ "<code> load</code> ".
1912+
1913+ 1. Let (|event received|, |status|) be [=await=] given «|event name|,
1914+ "<code> download started</code> ", "<code> navigation aborted</code> ",
1915+ "<code> navigation failed</code> "» and |navigation id|.
1916+
1917+ 1. If |event received| is "<code> navigation failed</code> "
1918+ return [=error=] with [=error code=] [=unknown error=] .
1919+
1920+ Issue: Are we surfacing enough information about what failed and why with
1921+ an error here? What error code do we want? Is there going to be a problem
1922+ where local ends parse the implementation-defined strings to figure out
1923+ what actually went wrong?
1924+
1925+ 1. Let |body| be a [=map=] matching the
1926+ <code> BrowsingContextNavigateResult</code> production, with the
1927+ <code> navigation</code> field set to |status|'s id, and the
1928+ <code> url</code> field set to the result of the [=URL serializer=] given
1929+ |status|'s url.
1930+
1931+ 1. Return [=success=] with data |body|.
1932+
1933+
18331934</div>
18341935
18351936#### The browsingContext.Navigation Type #### {#type-browsingContext-Navigation}
@@ -1994,93 +2095,62 @@ The [=remote end steps=] with |command parameters| are:
19942095
19952096 1. Let |request| be a new [=/request=] whose URL is |url record|.
19962097
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.
2098+ 1. Return the result of [=await a navigation=] with |context| and |request|.
20162099
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?
2100+ </div>
20312101
2032- 1. Assert: |navigate status|'s status is "<code> pending</code> " and
2033- |navigation id| is not null.
2102+ #### The browsingContext.reload Command #### {#command-browsingContext-reload}
20342103
2035- 1. If |wait condition| is "<code> none</code> ":
2104+ The <dfn export for=commands>browsingContext.reload</dfn> command reloads a
2105+ browsing context.
20362106
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.
2107+ <dl>
2108+ <dt> Command Type</dt>
2109+ <dd>
2110+ <pre class="cddl remote-cddl">
2111+ BrowsingContextReloadCommand = {
2112+ method: "browsingContext.reload",
2113+ params: BrowsingContextReloadParameters
2114+ }
20422115
2043- 1. Return [=success=] with data |body|, and then run the following steps [=in
2044- parallel=] :
2116+ BrowsingContextReloadParameters = {
2117+ context: BrowsingContext,
2118+ ?ignoreCache: boolean,
2119+ ?wait: ReadinessState,
2120+ }
2121+ </pre>
2122+ </dd>
2123+ </dl>
20452124
2046- 1. Run the [=WebDriver-BiDi navigation started=] steps given |context|
2047- and |navigate status|
2125+ <div algorithm="remote end steps for browsingContext.reload">
2126+ The [=remote end steps=] with |command parameters| are:
20482127
2049- 1. Run the [=WebDriver-BiDi navigation started=] steps given | context|
2050- and |navigate status|
2128+ 1. Let |context id| be the value of the <code> context</code> field of
2129+ |command parameters|.
20512130
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> ".
2131+ 1. Let |context| be the result of [=trying=] to [=get a browsing context=]
2132+ with |context id|.
20552133
2056- Issue: Replace this suppression mechanism with an event queue .
2134+ 1. Assert: |context| is not null .
20572135
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> ".
2136+ 1. Let |ignore cache| be the the value of the <code> ignoreCache</code> field of |command
2137+ parameters| if present, or false otherwise.
20612138
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|.
2139+ 1. Let |wait condition| be the value of the <code> wait</code> field of |command
2140+ parameters| if present, or "<code> none</code> " otherwise.
20652141
2066- 1. If |event received| is "<code> navigation failed</code> "
2067- return [=error=] with [=error code=] [=unknown error=] .
2142+ 1. Let |document| be |context|'s [=active document=] .
20682143
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?
2144+ 1. Let |URL| be |document|'s <a spec=DOM>URL</a> .
20732145
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.
2146+ 1. Let |request| be a new [=/request=] whose URL is |URl|.
20792147
2080- 1. Return [=success=] with data |body|.
2148+ 1. Return the result of [=await a navigation=] with |context|, |request|,
2149+ history handling "<code> reload</code> ", and ignore cache |ignore cache|.
20812150
20822151</div>
20832152
2153+
20842154### Events ### {#module-contexts-events}
20852155
20862156#### The browsingContext.contextCreated Event #### {#event-browsingContext-contextCreated}
0 commit comments