Commit Graph

71 Commits

Author SHA1 Message Date
Andrew McCreight
5dec0e0beb Bug 1432992, part 1 - Remove definitions of Ci, Cr, Cc, and Cu. r=florian
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
2018-02-06 09:36:57 -08:00
Kris Maglione
918ed6c474 Bug 1431533: Part 5a - Auto-rewrite code to use ChromeUtils import methods. r=florian
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
2018-01-29 15:20:18 -08:00
Andreas Tolfsen
5553f78cda Bug 1433422 - Fix interaction.moveCaretToEnd element conditions. r=automatedtester
Bug 1432864 introduced a regression where the element conditions
for moving the caret to the end of the textual input were wrong.
Apparently if conditions are hard.

MozReview-Commit-ID: KlRv6sCroXW

--HG--
extra : rebase_source : d649bc2c63d616f77bf7cebdb72875047a57b502
2018-01-26 15:38:14 +00:00
Andreas Tolfsen
a87465be5d Bug 1433422 - Move caret after focussing element. r=automatedtester
Focussing the element changes the selection range.

MozReview-Commit-ID: JW68aZupkly

--HG--
extra : rebase_source : 61a6129d8d51ceec44485271bd0d6fa54fc7f357
2018-01-26 15:38:06 +00:00
Andreas Tolfsen
69a46ce79e Bug 1432864 - Run unfocussing steps after interaction. r=automatedtester
A couple of commands were not running the appropriate unfocussing
steps as the WebDriver standards says they should.

MozReview-Commit-ID: FyuRvkct19m

--HG--
extra : rebase_source : fe37727126a6907f6182d166a035b4f368118df9
2018-01-24 19:07:18 +00:00
Andreas Tolfsen
e8df6e360f Bug 1432864 - Run native focussing steps on interaction commands. r=automatedtester
Instead of generating custom focus events when interacting with elements,
we can run the HTMLElement.focus() function will do the correct thing.

Before this patch we only simulated focus events, whereas this
patch will actually focus the element.

MozReview-Commit-ID: IoBV2ngqOA5

--HG--
extra : rebase_source : c133a8ac7fc91dfa373a9d8adbc3f30d2441c46d
2018-01-24 19:04:30 +00:00
Andreas Tolfsen
660c1092d4 Bug 1432864 - Decouple focussing from moving caret in textual form controls. r=automatedtester
Renames the interaction.focusElement, which also happened to move
the caret in textual form controls, to interaction.moveCaretToEnd,
focussed solely on moving the caret.  It doesn't make sense to
coalesce these two operations into one function.

MozReview-Commit-ID: 2QxV8FllW8J

--HG--
extra : rebase_source : f95973c3bd5759d4b60467f88720ea66c0511873
2018-01-24 19:01:47 +00:00
Andreas Tolfsen
fc0a3934f3 Bug 1430571 - Fire DOM change event on WebDriver:ElementClear. r=automatedtester
When clearing an element using the WebDriver Element Clear command,
the DOM change event should be fired.

MozReview-Commit-ID: 94iG8bsRe4S

--HG--
extra : rebase_source : db67b681aabae64c463e3591ee43c7fd0995b3af
2018-01-24 17:27:26 +00:00
Andreas Tolfsen
6521893473 Bug 1430575 - Add validity state check for WebDriver:ElementClear. r=automatedtester
This patch checks that the element satisfies its form control
constraints, as well as being empty, before deciding not to clear
the element.  This will make it possible to clear elements that
have invalid input.

The "clear a resettable element" algorithm is missing a check of
the <input> element's ValidityState.  WebDriver:ElementClear has
a subtle bug that only manifests in Gecko because Blink rejects
invalid key input to validation fields such as <input type=number>,
but Gecko does not.

The value property of <input type=number> will not be updated unless
the input is actually valid, which means the first step of the algorithm
will pass irregardless of whether the user has actually modified it.

MozReview-Commit-ID: C2M3Fl1iKx6

--HG--
extra : rebase_source : 8e5698cf8adab4361d16ada403858d0703861d9a
2018-01-15 17:17:11 +00:00
Andreas Tolfsen
2e533b57f4 Bug 1430575 - Document interaction.clearElement. r=automatedtester
MozReview-Commit-ID: 6bwVFiJP6ej

--HG--
extra : rebase_source : 53aab2f44bde289e1b1c59613dfe43ce0ee7fd5e
2018-01-15 17:15:10 +00:00
Andreas Tolfsen
a2f89134da Bug 1354211 - Make WebDriver:ElementClear conforming to standard. r=automatedtester
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
2017-12-31 14:53:42 +00:00
Andreas Tolfsen
ae01ba2bf2 Bug 1429384 - Stop toggling selectedness state of <option disabled>. r=automatedtester
When WebDriver:ElementClick clicks an <option disabled> element,
its selectedness state should according to a new specification
change proposed not change:

	https://github.com/w3c/webdriver/pull/1189

This patch provides tests for the specification change.

MozReview-Commit-ID: EXG98LjgB7d

--HG--
extra : rebase_source : d9e5b31dbd869c8151d85eb2b5bb8ba94a378a52
2018-01-10 13:30:17 +00:00
Tim Nguyen
c9103613c5 Bug 1428849 - Remove datetimepicker.xml bindings. r=mconley
MozReview-Commit-ID: LhfabvhJP5d

--HG--
extra : rebase_source : 8a2c329fab9b90746af9a09877be049479459b75
2018-01-09 19:39:30 +00:00
Henrik Skupin
cb6d8c72b5 Bug 1414322 - Use WebDriver conformant interactability checks for sendKeysToElement. r=ato
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
2017-11-10 20:29:04 +01:00
Henrik Skupin
88c43fb94d Bug 1414322 - Refactor sendKeysToElement methods. r=ato
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
2017-11-09 20:39:51 +01:00
Andreas Tolfsen
51b3c4eebd Bug 1417821 - Prevent missing click event from causing deadlock in interaction.flushEventLoop. r=whimboo
If the DOM click event does not fire, which currently happens in
this edge case where Firefox does not bubble the click event up
to <body>, interaction.flushEventLoop will hang forever.

This is believed to be a bug in Gecko, but it is probably safer to
use a TimedPromise here in case anything else bad were to happen.

Thanks-to: Alexei Barantsev <barancev@gmail.com>
MozReview-Commit-ID: KZBdR8zcfJb

--HG--
extra : rebase_source : aba0c4c810a703877d858fa6f4398ad960ece0d1
2017-11-23 15:02:17 +00:00
Andreas Tolfsen
7abd1cfb0b Bug 1414329 - Make WebDriver:ClickElement wait for click events r=jgraham,whimboo
This changes interaction.flushEventLoop from relying on the beforeunload
DOM event to determine when to bail in case the document navigates.
Instead, it now relies on the unload event which should not affect
bfcache.

It also changes flushEventLoop to append a click event listener to
the targetted element's container element.  Because this event will
be added last, the intention is that all preceding click evens will
have had time to fire and propagate before our listener spins the
event loop through setTimeout once.

Our listeners are added using the privileged mozSystemGroup option so
that a potential invocation of EventTarget.stopImmediatePropagation
does not prevent our listener from firing.

MozReview-Commit-ID: 2Ehxwg2p6Fo

--HG--
extra : rebase_source : 767bc955ba49152ff501ee8ff9c856fe204b25f4
2017-11-03 19:20:46 +00:00
Andreas Tolfsen
7974848c51 Bug 1408454 - Move error.pprint to format.pprint. r=whimboo
Pretty-printing an object belongs more naturally to the new format module.

MozReview-Commit-ID: AfXLMPAT5ar

--HG--
extra : rebase_source : 1074febec66df49745256fc9cd04b0fecd293919
2017-10-13 17:59:30 +01:00
Andreas Tolfsen
545d5ec9f4 Bug 1275273 - Make WebDriver:IsElementSelected conform to spec. r=maja_zf
Splits interaction.isElementSelected into two parts: one checking
whether the element DOM properties are selected/checked, and the
other checking accessibility.  This so this so that the selectedness
can be unit tested, as we do not have the capability of standing
up accessibility in the xpcshell tests.

The second part of this change moves us away from atom.isElementSelected
in favour of a specification conforming implementation in Marionette.
This is a word-by-word implementation of the Is Element Selected
command from WebDriver.

MozReview-Commit-ID: 93WDKbPcEIB
2017-10-11 15:24:03 +01:00
Henrik Skupin
7d2717c4aa Bug 1375660 - Remove Selenium atom: getElementAttribute. r=ato
MozReview-Commit-ID: 2vyuxmVE7Oi

--HG--
extra : rebase_source : 4dd33939a20285dbb4fdcc8add2551d8550a747e
2017-09-29 15:35:14 +02:00
Andreas Tolfsen
d28ce13224 Bug 1405279 - Remove unused variables. r=whimboo
MozReview-Commit-ID: CmiDVCw6xVK

--HG--
extra : rebase_source : e71cfb7da973d95c796a93cc1e4da6f709acf65e
2017-10-03 14:35:47 +01:00
Andreas Tolfsen
7b0b197759 Bug 1394849 - Export pprint separately. r=automatedtester
pprint is currently exposed twice: once on the error namespace and once
separately.  We only want to expose it once, and since there are only a
handful "error.pprint" usages left, we can go ahead and make this change.

When we move transition to use "require" in the future, like devtools
does, it will be possible to use both "error.pprint" and "pprint" styles
without export duplication.

MozReview-Commit-ID: CAnPDWn9Vr7

--HG--
extra : rebase_source : 05a05460d710eb96fa7b20cb94477be0282809de
2017-08-29 17:33:38 +01:00
Andreas Tolfsen
29f6ebe13f Bug 1394881 - Use Node.isConnected for web element staleness check. r=automatedtester
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
2017-08-30 14:22:39 +01:00
Andreas Tolfsen
65b371f187 Bug 1388082 - Switch to async/await in interaction module. r=automatedtester
MozReview-Commit-ID: 2aUUrT3KXRF

--HG--
extra : rebase_source : c8d9b411c59da2979fc9b08fa1d09afec8f82d9b
2017-08-07 18:56:29 +01:00
Andreas Tolfsen
5ec99cbafd Bug 1387457 - Convert element click functions to async. r=automatedtester
The element click functions in testing/marionette/interaction.js are
generator functions using "yield".  This patch converts them to async
functions.

MozReview-Commit-ID: 4A4cTaY619w
2017-08-05 17:21:06 +01:00
Andreas Tolfsen
38118e543e Bug 1385873 - <option> should not be deselected in dropdown. r=automatedtester
Marionette deselects <option>s if they are already selected in <select
multiple>, but it should not deselect them if they are in a dropdown
<select>.

MozReview-Commit-ID: 9CHfYrGn7xR

--HG--
extra : rebase_source : f2357c8b111a0296844b8eb594cfb13e8799c3a0
2017-07-31 14:08:41 +01:00
Andreas Tolfsen
30162bd0ea Bug 1385873 - Throw TypeError when passing XUL element to interaction.selectOption. r=automatedtester
Marionette throws a TypeError when the element is not an <option>,
and we should use the same error type when a XUL element is passed.

MozReview-Commit-ID: 3p3wPcW621f

--HG--
extra : rebase_source : dd5147d98ce68e664d0782949a760f499f3fe24a
2017-07-31 14:06:07 +01:00
Andreas Tolfsen
ec081889ac Bug 1385873 - Better error on wrong element to interaction.selectOption. r=automatedtester
Throw a better error message when the wrong element type is passed to
interaction.selectOption.

MozReview-Commit-ID: G1NIZ25umm2

--HG--
extra : rebase_source : 55389d965c253dc3f1718e627f5c3a0c4f16fb84
2017-07-31 14:04:50 +01:00
Andreas Tolfsen
dd7a57fd22 Bug 1384517 - Fix testing/marionette API docs; r=automatedtester
Various fixes to make the generated API documentation from
testing/marionette somewhat easier to read.

MozReview-Commit-ID: F9duuQoOYBt

--HG--
extra : rebase_source : 3ade69773ceba42826aedef05b1371240b51cf82
2017-07-26 13:11:53 +01:00
Andreas Tolfsen
de001d80b7 Bug 1376128 - Lint testing/marionette; r=automatedtester
MozReview-Commit-ID: DY4yCSBEZrN

--HG--
extra : rebase_source : d4e25369418cc72a6ee9f78d44b050a87403391d
2017-06-29 16:40:24 -07:00
Andreas Tolfsen
54c2f296a7 Bug 1376128 - Use selective imports from error module; r=automatedtester
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
2017-06-28 11:01:49 -07:00
Jessica Jong
efe6bfa010 Bug 1366188 - Part 1: Fix Marionette's DateTimeValue when dom.forms.datetime is enabled. r=ato
When we enable "dom.forms.datetime", <input type=date> and <input type=time>
are displayed as multi-field text box, where the fields are ordered depending
on locale. To avoid too much overhead, instead of synthesising each key event,
we set the element's value property and fire the corresponding events to
emulate user interaction.

MozReview-Commit-ID: Ao6ip61CNT6

--HG--
extra : rebase_source : f03d9c5d2e2540e6c2189b542d9270be5fb63919
2017-05-30 23:37:00 +02:00
Henrik Skupin
891449384c Bug 1357634 - Use 'beforeunload' to detect a possible page load. r=ato
Using only the different unload events to detect a page load is
unreliable because of a possible delay in starting the navigation,
which could be triggered by a slowness of the application.

By using 'beforeunload', an event will be received much earlier,
and the unload timer can be extended to a couple more seconds to
wait for the navigation request to start.

If a website has it's own 'beforeunload' listener registered,
a tab modal dialog will be opened by Firefox, and Marionette
returns from the currently active command immediately to allow
the test to handle the dialog.

MozReview-Commit-ID: 6ZUYtFJSSnz

--HG--
extra : rebase_source : 3f7b9d9d0067ed7c65a3bb8774f0a5ae8bc702c2
2017-04-28 10:27:12 +02:00
Andreas Tolfsen
8f9f92f1cb Bug 1359079 - Take <select multiple> into account for obscured click test; r=whimboo
Because individual <option> elements are painted and represented in the
DOM when they belong to a <select multiple> list, the center point of
the list might be one of the options.

To take this into account, we perform an inclusive descendant check
(DOMElement.contains) to see if the <option> element is a descendant of
the container <select> element.

In the case the targetted element is the element itself, the test will
still pass since it is an _inclusive_ descendant check.  In other words,
containerEl.contains(tree[0]), if tree[0] is equal to containerEl,
will pass.

The relevant specification changes were made in
40abcefd6a.

MozReview-Commit-ID: ORX8zLxQJ

--HG--
extra : rebase_source : 87ca38df6696257d569ef1ffcb888426d1f569af
2017-04-17 17:24:19 +01:00
Henrik Skupin
247b5f9899 Bug 1335778 - Make element click command check for page load and wait. r=ato
If the click command triggered a page load, it should not return before
the page has been fully loaded. With this patch we allow an opt-in for
commands to make use of an unload check. It's set to 200ms right now, and
will cancel an ongoing waitForPageLoad() if no page activity is detected.

MozReview-Commit-ID: DWV53sckBS2

--HG--
extra : rebase_source : 1b7905c101b7ebf406e88c73be5d0e069b7342c0
2017-04-20 12:12:27 +02:00
Sebastian Hengst
2bb5df4de7 Backed out changeset e084deb550c2 (bug 1335778) 2017-04-26 14:12:13 +02:00
Henrik Skupin
d9653a7941 Bug 1335778 - Make element click command check for page load and wait. r=ato
If the click command triggered a page load, it should not return before
the page has been fully loaded. With this patch we allow an opt-in for
commands to make use of an unload check. It's set to 200ms right now, and
will cancel an ongoing waitForPageLoad() if no page activity is detected.

MozReview-Commit-ID: DWV53sckBS2

--HG--
extra : rebase_source : 455e252e85c14b4ca841f02794bf0d33133ef10a
2017-04-20 12:12:27 +02:00
Andreas Tolfsen
72f6c01b53 Bug 1359059 - Skip visibility checks when clicking in XUL; r=whimboo
This patch removes the call to element.isVisible when clicking XUL
elements because it does not do anything useful.  element.isVisible skips
the Selenium atom.isElementDisplayed check for XUL elements and runs a
few web content/viewport centric tests that always pass in XUL.

It also splits the chrome click out to a separate function to avoid a
few if-conditions.

MozReview-Commit-ID: EkcwT77ku3C

--HG--
extra : rebase_source : ee5e8148934ec008cda996610c20a826f86412af
2017-04-24 15:01:41 +01:00
Andreas Tolfsen
754d617ec8 Bug 1359053 - Reject interaction.flushEventLoop if window is discarded; r=maja_zf
The window reference may have been discarded as a result of interaction.
For example, this may happen when clicking a button that deletes the
host <iframe> element containing the child window.  In this case, the
WindowProxy will set its closed property to true, to indicate that the
browsing context has been discarded.

We only want to flush the event loop of windows that exist, and so we
return early from interaction.flushEventLoop if the window has been
closed.

MozReview-Commit-ID: LtTHQRudKvk

--HG--
extra : rebase_source : e4133ddeed9e89e38fba6e9b8f17544a3546f7eb
2017-04-17 18:42:18 +01:00
Andreas Tolfsen
287f6b6d18 Bug 1333014 - Support intercepted clicks and align with spec; r=automatedtester,whimboo
The WebDriver specification changed recently to introduce a new
'element click intercepted' error that is returned if the high-level
Element Click command attempts an element that is obscured by another
(the other element's z-index, or order in the paint tree, is higher).

This patch introduces the notion of 'container elements', which is an
element's context.  For example, an <option> element's container element
or context is the nearest ancestral <select> or <datalist> element.

It also makes a distinction between an element being pointer-interactable
and merely being in-view.  This is important since an element may be in
view but not pointer-interactable (i.e. clicking its centre coordinates
might be intercepted), and we do not want to wait for an element to
become pointer-interactable after scrolling it into view if it is indeed
obscured.

MozReview-Commit-ID: 8dqGZP6UyOo

--HG--
extra : rebase_source : 68f1f7ee922ab8ed6acd92d3f89d6887b23ae801
2017-02-03 19:52:34 +00:00
Andreas Tolfsen
7fbc7c7a97 Bug 1333014 - Align element interaction errors with spec; r=whimboo
This renames the ElementNotVisibleError to ElementNotInteractableError,
and adds a new ElementClickInterceptedError.

MozReview-Commit-ID: 6cjVghUCvyv

--HG--
extra : rebase_source : 3f2105c1f631ac4776e231bb6c88a00e26f1ae6c
2017-02-03 19:30:13 +00:00
Tooru Fujisawa
44f45bf316 Bug 1338257 - Remove remaining legacy generator from testing/marionette/. r=ato 2017-02-11 11:47:57 +09:00
Andrea Marchesini
8cf1cb8c2f Bug 1335536 - File.createFromNsIFile and File.createFromFileName should be async - part 1 - tests, r=smaug 2017-02-08 10:18:32 +01:00
Florian Quèze
b11907c7aa Bug 1334156 - script-generated patch to replace .ownerDocument.defaultView with .ownerGlobal, r=jaws. 2017-01-27 10:51:03 +01:00
Thomas Charles
acf2f9d4dd Bug 1316975 - Correct function definition style in Marionette components; r=ato
No functional changes.

MozReview-Commit-ID: 25cWAnpRB9H

--HG--
extra : rebase_source : c8b14bf47a476488568f54d3640b51bbeed5b04b
2016-12-04 12:42:52 +01:00
Andreas Tolfsen
be2dd10746 Bug 1317386 - Check pointer interactability upon interaction; r=automatedtester
Checking for general interactability will also consider keyboard
interactability, which has not yet been implemented.  On interacting with
an element by clicking, we should only test for pointer interactability.

MozReview-Commit-ID: BUCs7zHppRm

--HG--
extra : rebase_source : 2053a49ee4bcb291299568902e9ac25cc747bc5e
2016-11-14 21:07:42 +00:00
Andrea Marchesini
2aba798852 Bug 1303518 - Remove the chrome only constructor for File, r=qdot 2016-11-11 18:56:44 +01:00
Andreas Tolfsen
e3a3466f75 Bug 1244425 - Avoid CPOW when setting file array on <input type=file>; r=automatedtester
This removes the need to use a CPOW when sending keys to <input type=file>
elements.  It was previously not possible to constructo File objects in
privileged content space, but this now appears fixed.

MozReview-Commit-ID: 8XOVsDdypwC

--HG--
extra : rebase_source : 8d4329c4c6a64ac717fc5d54dc42c8eb136f5e7f
2016-08-30 12:46:01 +01:00
Andreas Tolfsen
0f34b42611 Bug 1280947 - Dispatch DOM change event on appending file to input; r=automatedtester
MozReview-Commit-ID: 6SC01AEkuTs

--HG--
extra : rebase_source : ee4ed323e024bf6fdcf9a28ab7f44763c7475c8c
2016-08-25 14:18:04 +01:00
Andreas Tolfsen
cf5f3418f9 Bug 1255955 -Run element enabled check before accessibility checks; r=automatedtester
MozReview-Commit-ID: 18OtOKtox3K

--HG--
extra : rebase_source : 2773dbd04f7a728b6b9fcd5db8e57b8abc28abcc
2016-08-13 20:59:14 +02:00