Because the content frame script's clickElement function uses
the old-style despatch technique, all code lines that have the
potential of throwing must be encapsualted in try...catch blocks.
Bug 1400256 accidentally moved them outside this block, and we did
not have any tests for stale elements in web content.
This ensures errors from WebElement.fromJSON and seenEls.get get
returned to the WebDriver service in testing/marionette/driver.js.
MozReview-Commit-ID: 49qjWhXWy69
--HG--
extra : rebase_source : 3e1b639ad253c3fe7eda890de04608a925e256f5
Since web element references are now implicitly unmarshaled when
they are passed to the content frame script, there is no need for
the actions module to check that the element origin is a reference
and try to look it up from the known element store.
MozReview-Commit-ID: 3BGBIBQMtR3
--HG--
extra : rebase_source : 1505fe15b060f85ad34628f34f67cfe96aaaa9c1
The element.isStale function does not take into account the current
browsing context when checking an element’s staleness. This means,
for example, that an element in an <iframe> that gets retrieved, will
still be considered valid for as long as its associated document lives.
In WebDriver the expected behaviour is for the element reference to
only be valid for the current browsing context, meaning retrieving
the element reference when another browsing context is chosen should
return a stale element error.
Fixes: https://github.com/mozilla/geckodriver/issues/934
MozReview-Commit-ID: JpQVt78u5AN
This makes it possible to subscribe to DOM events in web content, in
order to facilitate fixes for cases such as https://bugzil.la/1397007.
Although the current interface, WebElementEventTarget, is associated with
browser.Context (curBrowser) it is the intention that we in the future
will associate this with representations of the marshaled web element.
This will make it quack and act like an Element's EventTarget, which
has nice parity to it.
The WebElementEventTarget works by passing IPC messages to
a backend service in the content frame script implemented by
ContentEventObserverService. This registers event handlers for specific
DOM events, and relays these events back to the browser-specific message
handler in chrome.
This will enable chrome code to wait for events to occur in content,
like this:
await new Promise(resolve => {
webElement.addEventListener("visibilitychange", resolve, {once: true});
contentBrowser.minimize();
});
MozReview-Commit-ID: B8MMHyG8n04
--HG--
extra : rebase_source : 25ac77fbcfb09435325719ac61614c4a8ce37996
To allow geckodriver to temporarily opt-in for using the webdriver
conforming click, a new custom capability has to be created for
Marionette. If not specified the legacy clickElement method will
be used instead.
MozReview-Commit-ID: LuyTjLJXMGL
--HG--
extra : rebase_source : 8e133fb2d9767ea580468013fedff5233fd8eb93
It turns out that Node.isConnected (described in
https://dom.spec.whatwg.org/#dom-node-isconnected) handles an element’s
shadow root, which element.isDisconnected tries to replicate.
element.isDisconnected and element.isStale are both long and error-prone
and can be removed entirely in favour of this web platform API.
The relevant change to the WebDriver specification landed in
32a477b023.
MozReview-Commit-ID: 5Q0gWLvw8KL
--HG--
extra : rebase_source : 773ab302df27cf11be6079f918a48d3730ceb5c1
The convention is to use fromJSON (instead of fromJson) because this
gives parity to toJSON which is supported by JSON.stringify.
MozReview-Commit-ID: 9dX14pFO2Bj
--HG--
extra : rebase_source : d0c1d657eee1f84d34e5a7116d8bb9ca579c8b51
Various functions in the action module take a container object such as
{frame: <WindowProxy global>, shadowRoot: <Element>}
when it in fact never uses the shadowRoot entry. As part of the new
window tracking we will get rid of the container concept altogether.
Because the action module is sufficiently self-contained, we can start
with removing it from there already.
MozReview-Commit-ID: KeeNF08mqnX
--HG--
extra : rebase_source : 51eee50a648a994fab456adf4add46c91a6c82a3
In case of websites manipulating the browser's history via history.pushState
there will be no usual page load events fired. Instead listeners for popstate
events have to be used.
When such an event occurs we can directly return because the browser will
not load the underlying page. This only happens when navigating to another
page first, or restarting Firefox.
MozReview-Commit-ID: 3PceeYK9Co7
--HG--
extra : rebase_source : 30c162f72279712920a96ebc2076db27d01c41b6
Various fixes to make the generated API documentation from
testing/marionette somewhat easier to read.
MozReview-Commit-ID: F9duuQoOYBt
--HG--
extra : rebase_source : 3ade69773ceba42826aedef05b1371240b51cf82
In some cases the registration of the frame script takes longer and as
result the page load events for DOMContentLoaded and pageshow are
missed. With that the current command waits forever and causes a page
load timeout error after 300s.
By checking the readyState of the document before the listeners are
getting attached, we can ensure to return immediately if the document
has already been finished loading.
MozReview-Commit-ID: 17f6jVz7sZZ
--HG--
extra : rebase_source : 1cc27fc9bd4d9b4a39607f8d44692dfc7095b2d7
If the target URL has the exact same hash parameter as the current URL no
page load will happen. As such Marionette should not wait for the appropriate
events.
MozReview-Commit-ID: LNbGJQgChya
--HG--
extra : rebase_source : a775f090c9c4e558803af80078c3eb3bf79fa583
While observing page loads the only interesting events are for the
current browsing context, and its document. While most events have
the document as target, and bubble up, the hashchange event only
fires for the window.
MozReview-Commit-ID: CiqkV4DuH48
--HG--
extra : rebase_source : b7bb9c2b3e4d591cbe700f627cdadd9a232ddbf5
baseURI isn't actually we have to check for to get the
current documents URI. Therefore documentURI exists.
MozReview-Commit-ID: CDhOZ8lU2qJ
--HG--
extra : rebase_source : c53f79468a7d319bd5e7aa40338fce0ca7299bd4
With multi-processes for content reloads of the frame script
can happen at any time, and not only for remoteness changes.
As such the current browser has to be re-registered with the
new id of the listener.
MozReview-Commit-ID: 48MOZfuPTR9
--HG--
extra : rebase_source : 60e91ae7e1cdc942d0ac9a9dd3aac3baeccc5ddf
To retrieve the title of the currently selected content browser
it is not necessary to call into the frame script. Instead just
take the value from the parent process directly.
MozReview-Commit-ID: KEpYKLIydrJ
--HG--
extra : rebase_source : 8b179de7057f8655a81656bd4d95b1562edb9f54
Whilst try...catch (e if foo) { ... } is a very nice construct, it has
not been standardised and we should avoid using non-web platform features.
MozReview-Commit-ID: 9qzHtBdlPfw
--HG--
extra : rebase_source : be27a3d647eba2d48721c77dabe12ca13278bda9
In particular, XPCNativeWrapper should probably be made available
by default.
MozReview-Commit-ID: E1oYFyApbLi
--HG--
extra : rebase_source : 4e27ad6882bd4e43dadc97d4fd2a186e01510dfd
Instead of importing everything from the testing/marionette/error.js
module into the global scope, we need to be selective about what symbols
we want.
MozReview-Commit-ID: HZDAS0bs0GD
--HG--
extra : rebase_source : 14a300bb2cedc0716168d50846755a6faed83012
Reorder imports so that global ones are done before local imports.
MozReview-Commit-ID: 7xA9XQlxlj4
--HG--
extra : rebase_source : b144401c5c6c47e87beab669f76f2b61fb79e5b6
It will help a lot for debugging when the outer window id of the
content window gets logged when the frame script gets registered.
MozReview-Commit-ID: D64A1nPEs6l
--HG--
extra : rebase_source : 0e592e10cb1a0979f4331b92dbfcfc905e737120
This adds commands to start a reftest session, run a test, and end the
session. It as assumed that after you start a reftest session you will
just run reftests until you end the session. When starting a session
the user provides a string indicating when screenshots should be
taken, and an object mapping urls to a count of the number of times
that url is expected to be used in the session, to help with
caching. Running the tests takes a url to a test, an expected status,
a timeout, and a nested list of possible references, in which each
entry at a specific level is combined by OR and nested references are
combined by AND.
The implementation is heavilly inspired by the existing reftest
harness, starting a minimal window with no tabs, and loading the urls
directly in there. In order to get a screenshot in the e10s case we
have to pass the DRAW_VIEW and USE_WIDGET_LAYERS flags when taking the
screenshot.
For performance we heavily cache canvases; for references that will be
repeated we cache the full canvas with image, and we also cache a
single canvas to use for all other screenshots to avoid the overhead
of repeatedly creating a new canvas element.
MozReview-Commit-ID: JOFvtmH7tg
This adds commands to start a reftest session, run a test, and end the
session. It as assumed that after you start a reftest session you will
just run reftests until you end the session. When starting a session
the user provides a string indicating when screenshots should be
taken, and an object mapping urls to a count of the number of times
that url is expected to be used in the session, to help with
caching. Running the tests takes a url to a test, an expected status,
a timeout, and a nested list of possible references, in which each
entry at a specific level is combined by OR and nested references are
combined by AND.
The implementation is heavilly inspired by the existing reftest
harness, starting a minimal window with no tabs, and loading the urls
directly in there. In order to get a screenshot in the e10s case we
have to pass the DRAW_VIEW and USE_WIDGET_LAYERS flags when taking the
screenshot.
For performance we heavily cache canvases; for references that will be
repeated we cache the full canvas with image, and we also cache a
single canvas to use for all other screenshots to avoid the overhead
of repeatedly creating a new canvas element.
MozReview-Commit-ID: JOFvtmH7tg
--HG--
extra : rebase_source : ab5a2ef2e450b9bbdc6bc3c9487ed5dfda2c1d4b
Reorder imports so that global ones are done before local imports.
MozReview-Commit-ID: 7xA9XQlxlj4
--HG--
extra : rebase_source : b144401c5c6c47e87beab669f76f2b61fb79e5b6
It will help a lot for debugging when the outer window id of the
content window gets logged when the frame script gets registered.
MozReview-Commit-ID: D64A1nPEs6l
--HG--
extra : rebase_source : 0e592e10cb1a0979f4331b92dbfcfc905e737120
The cookie service relies on the current document's
domain which is accessible from chrome space through
this.curBrowser.contentBrowser.contentURI.host.
As it is implemented currently, Marionette's cookie service jumps
between chrome- and content space more than necessary. This incurs
significant serialisation and IPC overhead, considering that the domain,
hostname, and current path information is readily available in chrome
space.
This patch removes all cookie-related functionality from
testing/marionette/listener.js, and implements a pure chrome-only
version of the service. It does, however, not try to fix conformance
issues with the WebDriver specification, of which there are many.
Some of the algorithms, especially to do with iteration over cookies,
implemented in cookie.iter, is also highly suboptimal. I have not
fundamentally changed any algorithms, and so my recommendation is to
address this later when addressing potential conformance bugs.
MozReview-Commit-ID: Fgs8ocbDJxb
--HG--
extra : rebase_source : 16470d5341459e40b1ceed12728451d517bbc490
Marionette uses singular module names. Make the cookie module
fall in line by renaming it from testing/marionette/cookies.js to
testing/marionette/cookie.js.
MozReview-Commit-ID: H4jyvI3lFxz
--HG--
rename : testing/marionette/cookies.js => testing/marionette/cookie.js
extra : rebase_source : 6da48d3d9215de34ccb97823c0430766538fb45f
The expires property on nsICookie2 does not exist and we are
consequently returning it as undefined, which gets omitted in the JSON
serialisation to the client.
This patch changes it to return the correct property so that the expiry
property is returned as part of the serialised cookie.
MozReview-Commit-ID: IIjf4NWnUoQ
--HG--
extra : rebase_source : 5e2dc27fb550a010dcbe40eee49d9ae31244d749
Marionette exposes a global called "global" to scripts that are
evaluated in sandboxes. This is no longer needed after the rewrite of
the testing/marionette/evaluate.js module.
MozReview-Commit-ID: BobdwilaCy0
--HG--
extra : rebase_source : 96df7df0711eba9833b7e1198ffab0768b87e5cb
setTestName was used for logging which test was being run for the
JS Tests used in B2G.
MozReview-Commit-ID: FNF4Sm7vAYM
--HG--
extra : rebase_source : cbb6667bb0d8be65c34c6e84b70caf21c6b3c34d
This is a remanent of the B2G code for injecting Mochitest style tests
into Gecko. This is no longer used by anything and is now dead code.
MozReview-Commit-ID: 4qaB3vxQzon
--HG--
extra : rebase_source : 7297648ed73faf326dc98f9c26604a447d658beb
setTestName was used for logging which test was being run for the
JS Tests used in B2G.
MozReview-Commit-ID: FNF4Sm7vAYM
--HG--
extra : rebase_source : b12fd8ce04e7da739a8a5ec0e7b30b6734c58e4a
This is a remanent of the B2G code for injecting Mochitest style tests
into Gecko. This is no longer used by anything and is now dead code.
MozReview-Commit-ID: 4qaB3vxQzon
--HG--
extra : rebase_source : 3af2c7655ecd2d03f266d0a1ad02eadfea1b1a0b