This removes the "session." prefixed global export type in favour
of individually exported types.
MozReview-Commit-ID: 3DHTrJsy2IN
--HG--
extra : rebase_source : 74674f2cc549a245472304c55a14dd2eca1ee235
This removes the "session." prefixed global export type in favour
of individually exported types.
MozReview-Commit-ID: 3DHTrJsy2IN
--HG--
extra : rebase_source : eb2c05c1970c67b5752ece4b916145f053109f69
This change will prefix all log entries originating from a frame
script with the content browser's outerWindowID. That makes it
easier to for example keep of the origin of web DOM event logging.
Whilst it is true that Marionette operates in one browser context at a
time, the frequent context switches make it a cognitive challenge to
keep track of which browser is currently active. This is especially
true at the moment when Marionette does not have the capability to
uniquely identify a browser.
The intention is to change from using the outerWindowID,
which changes when a content browser undergoes a remoteness
change, to using a unique identifier for the browser once
https://bugzil.la/marionette-window-tracking is available.
MozReview-Commit-ID: 813zALY3I9i
--HG--
extra : rebase_source : 559ca853befb2da4a255d59b9525dece962fa357
The "parent process" terminology is already established in the
parent process message manager. This aligns the Marionette component
with this terminology.
MozReview-Commit-ID: 12z1M5jAWDa
--HG--
extra : rebase_source : e735dd5a15c39703cad9799dd7578fed5fb1f139
Calling Cu.importGlobalProperties immediately defines the import
properties and any prototypes that they require. Aside from CPU
overhead, this also tends to consume a lot of memory, especially
for objects with complex prototypes. And it does this once for
every global you call it in. This is especially a problem for
content processes, since we get this memory overhead in each and
every content process.
This patch moves Marionette to use the new
XPCOMUtils.defineLazyGlobalGetters so that symbols are constructed
only when actually needed.
MozReview-Commit-ID: 3RYWTcdO7FM
--HG--
extra : rebase_source : 0c450c8900e5de5446796b34ae4ab6bdf0fe9118
When we traverse up a shadow DOM we pass in null as an indicator to
move upwards. We now check that it is really an element and if not
assume that it is null and move up the tree
MozReview-Commit-ID: AK9eOLFDAgB
--HG--
extra : rebase_source : c748d0fd22d29286f40b78b8790f4a339dfd4299
Prior to bug 1400256 we used to have to deserialise the web
element received from chrome space manually, and presumably this
self-assignment is a leftover from that time.
This fixes an eslint error upon upgrading to eslint version 5.
Thanks-to: Mark Banner <standard8@mozilla.com>
MozReview-Commit-ID: A46wK71AwBe
--HG--
extra : rebase_source : 2ad04f87b31cb369c7c3acf6a50a3bcbd493a735
As a workaround for bug 1411513, about Log.jsm not supporting E10s,
testing/marionette/listener.js makes a synchronous call (sendSyncMessage)
to the main process asking for the Marionette logger repository's level.
We can avoid this blocking operation by using initialProcessData,
which is new since the workaround was implemented.
initialProcessData is a dictionary structured clone serialisable
that gets copied to the content process when it starts. Because the
Marionette log level cannot be changed at runtime it should be fine
to only send this data once per child process.
MozReview-Commit-ID: 3czydqGZpZH
--HG--
extra : rebase_source : 1aaae676d2b56c609844238e8173b64d300e3e00
Adds type checks for the WebDriver:ExecuteScript and
WebDriver:ExecuteAsyncScript commands. This should help prevent
accidental programming mistakes with the Marionette Python client.
MozReview-Commit-ID: JjKgG9OWrdL
--HG--
extra : rebase_source : cd652717f6d4b98d396386e2b971d51a7e737725
This flag is used to turn off the WebDriver spec conforming pointer origin
calculation. It has to be kept until all Selenium bindings can successfully
handle the WebDriver spec conforming Pointer Origin calculation.
MozReview-Commit-ID: 3YknXlWoyi1
--HG--
extra : rebase_source : 6df2af027e7458fd29658d7a3bbe99634b6f58f9
This patch was autogenerated by my decomponents.py
It covers almost every file with the extension js, jsm, html, py,
xhtml, or xul.
It removes blank lines after removed lines, when the removed lines are
preceded by either blank lines or the start of a new block. The "start
of a new block" is defined fairly hackily: either the line starts with
//, ends with */, ends with {, <![CDATA[, """ or '''. The first two
cover comments, the third one covers JS, the fourth covers JS embedded
in XUL, and the final two cover JS embedded in Python. This also
applies if the removed line was the first line of the file.
It covers the pattern matching cases like "var {classes: Cc,
interfaces: Ci, utils: Cu, results: Cr} = Components;". It'll remove
the entire thing if they are all either Ci, Cr, Cc or Cu, or it will
remove the appropriate ones and leave the residue behind. If there's
only one behind, then it will turn it into a normal, non-pattern
matching variable definition. (For instance, "const { classes: Cc,
Constructor: CC, interfaces: Ci, utils: Cu } = Components" becomes
"const CC = Components.Constructor".)
MozReview-Commit-ID: DeSHcClQ7cG
--HG--
extra : rebase_source : d9c41878036c1ef7766ef5e91a7005025bc1d72b
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm
MozReview-Commit-ID: 1Nc3XDu0wGl
--HG--
extra : source : 12fc4dee861c812fd2bd032c63ef17af61800c70
extra : intermediate-source : 34c999fa006bffe8705cf50c54708aa21a962e62
extra : histedit_source : b2be2c5e5d226e6c347312456a6ae339c1e634b0
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm
MozReview-Commit-ID: 1Nc3XDu0wGl
--HG--
extra : source : 12fc4dee861c812fd2bd032c63ef17af61800c70
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm
MozReview-Commit-ID: 1Nc3XDu0wGl
--HG--
extra : rebase_source : c004a023389f1f6bf3d2f3efe93c13d423b23ccd
The bubbling phase is too late so resetClick didn't always get called.
MozReview-Commit-ID: JIseY5o3oAX
--HG--
extra : rebase_source : c8d4c3748158f246261ff87e5684ada74682c241
This makes more sense with the UIEvent spec and it should fix
intermittent failures caused by extra dblclick events that arise
from different tests polluting each other's state.
For the wdspec actions tests, the `test_actions_page`
fixture is function-scoped, so the page is reloaded between
each subtest.
MozReview-Commit-ID: HxPbMzYeXIV
--HG--
extra : rebase_source : d1e5da2b2e53475beab513c2159a990a17a373cf
Because we use a lot of data URIs when testing Marionette, the URLs
we log during navigation can be quite long. As with logged packets,
we should truncate the URLs.
MozReview-Commit-ID: AKpr5vvdU8P
--HG--
extra : rebase_source : 12d367901f96fe972a1b38ca76b7b46c1a8e47d3
With the forthcoming window tracking changes the message listeners of
the content frame script are left listening for the duration of the
Marionette lifetime, and not for the duration of the Marionette session.
To prepare for the window tracking refactoring, we will want to
remove message listeners separately from clearing the session state.
Functionally, this patch changes nothing in Marionette for the moment,
except we send two IPC messages to the frame script instead of one.
MozReview-Commit-ID: DwVBCpvk9V9
--HG--
extra : rebase_source : d473a51209eeaf20967303af5aec7376e38fd283
sendSyncMessage returns an array of replies from the frame message
manager, each item being the return value from each message listener
that handles the message.
In testing/marionette/driver.js there are two handlers for
Marionette:Register, but it is not predictable at the moment when
both or either one of them is triggered. We would, however, always
expect a response, which means the reply array should never be empty.
MozReview-Commit-ID: 5F8YfKO8jBU
--HG--
extra : rebase_source : c23900fed32a52d228c91cb6428be569fb967f41
outerWindowID is no longer used for adding message listeners,
which means we do not need to store it globally.
MozReview-Commit-ID: HZ0oY7ozwnu
--HG--
extra : rebase_source : 4a03927b5bdbe3d34a45faf8fa9646e0a58bd96a
This implements the remote end steps for the Element Clear command
from WebDriver in Marionette.
The WPT test webdriver/tests/interaction/element_clear.py was deleted
because it tested a previous definition of the Element Clear command
and many of its tests were either incorrect or replaced by the new tests.
MozReview-Commit-ID: C2xmIlhSAdW
--HG--
extra : rebase_source : 8eddcee78450a8c7d10cf9f648bb1baabdac4ff1
Whenever we make proxied IPC calls to the content frame's message manager,
we do so over the global message manager. AsyncMessageChannel takes a
closure that returns the current message manager from GeckoDriver#mm,
but this is unnecessary because it always holds a global message channel.
By not having to pass in a closure returning a message manager
to AsyncMessageChannel we losen the tight coupling a little bit.
Future patches will further reduce the tight coupling of browserFn.
MozReview-Commit-ID: EU0pkxA7lab
--HG--
extra : rebase_source : f6d6735e2d5bacdfbf20bde9a835f3f83846b2d6
The Marionette:newSession IPC message is never used, and the
newSession function is consequently never called. Since we no
longer have a need for resetting the content frame script, like
had with B2G, removing it is probably fine.
This also changes the Marionette:Register command to return an object
with the "outerWindowID" key, making it easier to identify and extract.
MozReview-Commit-ID: Ae3cPFWshcv
--HG--
extra : rebase_source : 056e9f2016317c314b9d46699669bfc76ea0bc37
It is easier to review what message listeners are added and removed
when the list is sorted.
MozReview-Commit-ID: 2fMpulA42Ww
--HG--
extra : rebase_source : 64e80f7c314596f27400657bd2e77da110f1443e
Prior to this patch Marionette used a broadcasting technique that
sent every IPC message to every registered content frame's message
manager. This was implemented in GeckoDriver#sendAsync and worked
by appending the frame's outerWindowID to the message name to ensure
it reached the correct recipient.
Because it is hugely wasteful for every content frame to receive every IPC
message, this patch changes it so that we use a frame's dedicated message
manager to only channel messages it cares about. A content frame's
direct message manager is stored in browser.Context#messageManager,
whereas GeckoDriver#mm is always the global message manager.
MozReview-Commit-ID: L0sD3VhzStv
--HG--
extra : rebase_source : 3f77075d88036d1e381a1a3fbbd359656838532c
Capabilities are currently sent to the content frame script when
its IPC message listeners attach (on Marionette:ListenersAttached).
If for whatever reason a capability's value changes since the script
was registered, for example by a user calling the WebDriver:SetTimeouts
command, a race condition is introduced where the capabilities in
chrome will differ from those cached in the frame script.
To remove any chance of race conditions, this patch changes the
content frame script to query the capabilities from chrome every time
it needs them. This is slightly less efficient, but should be neglible.
The patch also clears up some unused state, such as the
curBrowser.newSessionCommandId property, which did not appear to
be used for anything interesting.
MozReview-Commit-ID: 1bSrRu5nK3h
--HG--
extra : rebase_source : 06f6fb8e4a6d04e5c4fa56d1becafd55ed0d1dee
This removes the Marionette:emitTouchEvent IPC message which is
currently not in use by any tests. Along with removing this message
listener we can get rid of a tonne of complicated infrastructure
in testing/marionette/frame.js.
On switching the content frame we no longer await frame scripts to
register themselves because they implicitly inherit the parent's
frame script in Firefox/Fennec. This was a relic from the B2G days
when each frame was OOP.
MozReview-Commit-ID: 5vxrWHjzd68
--HG--
extra : rebase_source : 544013f42c9ee9eebb119b8d98061d997c7a10f0
The MarionetteFrame:getCurrentFrameId IPC message was used for B2G
applications that needed access to chrome-scoped APIs for emitting
touch events. Now that actions happen either in chrome _or_ in
content this is no longer necessary functionality to maintain.
MozReview-Commit-ID: Bk9LRAOxjAw
--HG--
extra : rebase_source : 71dac090db681a24dc5ebb54fdf1cf02a97563b0
MarionetteFrame:getInterruptedState was used in B2G to abortence
if the OOP frame got interrupted by a modal dialogue. Like the
MarionetteFrame:handleModal IPC message, the frame script needed
chrome assistance for querying the presence of this dialogue.
Today modal dialogues (known as "user prompts") are handled entirely
in chrome space, and the presence of such a dialogue is indeed
meant to pause script execution in the web document.
This patch makes some rather questionable changes to the legacyaction
module, but this is alright because we don't expect any more tests to
be written using it. This patch just about makes sure the remaining
body of tests keeps passing.
MozReview-Commit-ID: 72g0GlYy21T
--HG--
extra : rebase_source : f44ed5999554a42c67827d6935bd96cc79a8e5dd
In B2G, when a frame was interrupted by a modal dialogue, the
Marionette:switchToModalOrigin IPC message allowed you to switch
back to the frame that was interrupted. It got called by the
interrupted frame once the dialogue got dismissed and the frame
resumed its process. This functionality is no longer requried.
MozReview-Commit-ID: DtCOzeW45qP
--HG--
extra : rebase_source : 46ed3841abc53e0369246625d16839e9b2576d39
Marionette has a Marionette:sleepSession IPC command it uses to put a
content frame script "to sleep". This removes certain message handlers
and clears some state by calling deleteSession() in listener.js.
The frame script can later be "restarted" by calling Marionette:restart.
This is B2G-specific functionality we no longer need. In an effort
to remove old cruft from Marionette before tackling the window
tracking refactoring we want to remove support for this.
This removes the Marionette:sleepSession and Marionette:restart
IPC messages as well as GeckoDriver#switchToGlobalMessageManager.
The latter function additionally resets GeckoDriver#mm to the global
message manager which is fine, because for Firefox/Fennec we never
use the targetted message manager.
There will be a follow-up bug to remove OOP frame handling and the
targetted message manager used in GeckoDriver#sendAsync.
MozReview-Commit-ID: GRSBReBfQGX
--HG--
extra : rebase_source : 9f5ff562e3547ee804ec350678cb688f2cf1b4fa
Enables webdriver spec keyboard interactability tests for 'Element Send Keys'
by default by re-using the same capability 'moz:webdriverClick' from
'Element Click'. It can be disabled by turning off this preference.
Also various webplatform tests for webdriver spec have been added which
cover both the scroll into view action, and keyboard interactability check.
Existing Marionette unit tests will be run in both modes, until we can
get rid of the legacy mode.
MozReview-Commit-ID: dFB8sQ6CN5
--HG--
extra : rebase_source : 9f6a3c3e42f779f039f61d0b239f9f5925ecdcf5
Each call to sendKeysToElement should go through the interaction
module, and never by directly calling event.sendKeysToElement. This
will make sure that keyboard interactability checks will always be
performed, even for chrome scope like alerts or modal dialogs.
MozReview-Commit-ID: GoDKjMsNZsq
--HG--
extra : rebase_source : c305c748e68e60abd01dab37d00a7e3aff7d3d64
Errors that arise from inside sendResponse or sendError are currently
only logged to stdout. Now that we have a pretty safe error.wrap
implementation we should serialise them and return them to the main
process so that they are not "lost" in stdout.
MozReview-Commit-ID: FuMeUqQ7CMv
--HG--
extra : rebase_source : 2d43eb63ec13dbfb461d72dd9ddee232ff4ff9d8
document.activeElement will return null if there is no document
element. This may happen if, for example, in an HTML document the
<body> element is removed.
The WPT test test_sucess_without_body in get_active_element.py
is wrong. It expects Get Active Element to return null if there
is no document element, but following a recent specification change
we want it to return a no such element error.
Specification change: https://github.com/w3c/webdriver/pull/1157
MozReview-Commit-ID: LQJ3slV9aty
--HG--
extra : rebase_source : cc349bb642f57bb2203d126ecd86d8d988d90301
This is a workaround for https://bugzil.la/1411513 about Log.jsm
not being compatible with E10s. It queries the log level via
synchronous IPC message to the main process.
MozReview-Commit-ID: 5RZluH8Rv9o
--HG--
extra : rebase_source : 7ccf803ec7041a2d910f5697f63ee8f1a978d79f
Registering listeners for the "beforeunload" and "unload" events currently
happens on the global window and document. This actually prevents Firefox
from adding those pages to the bfcache.
The correct is to add all the listeners to the tabchildglobal, which is
the framescript itself. Also by using the capture and not the bubble phase
the unload events are correctly propagaded to our registered listeners.
MozReview-Commit-ID: 4hJjuqWsoBP
--HG--
extra : rebase_source : 619a8c936f613823dab2387efa67dc65488fbbc3
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