executor-common.js |
|
285 |
executor-window.js |
Suspends the executor and executes the function in `fnString` when it has
suspended. Installs a pageshow handler to resume the executor if the
document is BFCached. Installs a hashchange handler to detect when the
navigation did not change documents.
This returns nothing because fn is invoke after waiting for the document to
be suspended. If we were to return a promise, the executor could not suspend
until that promise resolved but the promise cannot resolve until the executor
is suspended. This could be avoided by adding support
directly in the dispatcher for tasks suspend immediately after execution.
@param {string} fnString A stringified function to be executed.
@param {any[]} args The arguments to pass to the function.
|
2638 |
executor-window.py |
<!DOCTYPE HTML>
<base href="{html.escape(request.url)}">
<script src="/common/dispatcher/dispatcher.js"></script>
<script src="./executor-common.js"></script>
<script src="./executor-window.js"></script>
{scripts_s}
<body>
<script>
window.__requestHeaders = new Headers();
{initRequestHeaders}
requestExecutor("{uuid}", {start_on_s});
</script>
|
1690 |
executor-worker.js |
|
268 |
remote-context-helper.js |
This provides a more friendly interface to remote contexts in dispatches.js.
The goal is to make it easy to write multi-window/-frame/-worker tests where
the logic is entirely in 1 test file and there is no need to check in any
other file (although it is often helpful to check in files of JS helper
functions that are shared across remote context).
So for example, to test that history traversal works, we create a new window,
navigate it to a new document, go back and then go forward.
@example
promise_test(async t => {
const rcHelper = new RemoteContextHelper();
const rc1 = await rcHelper.addWindow();
const rc2 = await rc1.navigateToNew();
assert_equals(await rc2.executeScript(() => 'here'), 'here', 'rc2 is live');
rc2.historyBack();
assert_equals(await rc1.executeScript(() => 'here'), 'here', 'rc1 is live');
rc1.historyForward();
assert_equals(await rc2.executeScript(() => 'here'), 'here', 'rc2 is live');
});
Note on the correspondence between remote contexts and
`RemoteContextWrapper`s. A remote context is entirely determined by its URL.
So navigating away from one and then back again will result in a remote
context that can be controlled by the same `RemoteContextWrapper` instance
before and after navigation. Messages sent to a remote context while it is
destroyed or in BFCache will be queued and processed if that that URL is
navigated back to.
Navigation:
This framework does not keep track of the history of the frame tree and so it
is up to the test script to keep track of what remote contexts are currently
active and to keep references to the corresponding `RemoteContextWrapper`s.
Any action that leads to navigation in the remote context must be executed
using
@see RemoteContextWrapper.navigate.
|
26842 |