Chrome window handles and window handles are identifiers for different types
of windows. As such those should not be mixed up. Especially for chrome
windows without a tabbrowser we erroneously inject such a chrome window
handle. It can break those tests which assume it's a tab.
MozReview-Commit-ID: 1n2vOyfaSUh
--HG--
extra : rebase_source : 08ebff867a0075191908bc7aa535f3f8b386871d
Previously, mock_runner.driverclass() returned a plain Mock object.
MozReview-Commit-ID: 1RMQhud4BJD
--HG--
extra : rebase_source : 54d7f62444e66bc2f9ae07c0b5ed91cd9a3cbbaf
SpecialPowers has been removed from Marionette, and this method does not
appear to be used anywhere in mozilla-central.
MozReview-Commit-ID: 3hkPVNJw0iA
--HG--
extra : rebase_source : a5cb71ece7d40dbbcb9ae5a532b74d69cd7b209c
BaseMarionetteTestRunner.appinfo is used in two places: when logging
whether E10s is enabled at the beginning of a test run, and for comparing
a few properties in the WebDriver capabilities test.
It currently tries to serialise Services.appinfo, which has
a field QueryInterface, which is a function. Because of the
Function.prototype.inherits field, this serialisation results in an
infinite recursion, presumably because the inherits method itself is
a function.
This patch removes BaseMarionetteTestRunner.appinfo as it is a clunky and
potentially error-prone implementation due to the way it caches appinfo,
and replaces the current consumers with functions retrieving specific
properties from Services.appinfo.
MozReview-Commit-ID: BPDA6TJrHHb
--HG--
extra : rebase_source : cb97953b7110f3d6dda75fbe3a1fd7dcffcef0c2
BaseMarionetteTestRunner.appinfo is used in two places: when logging
whether E10s is enabled at the beginning of a test run, and for comparing
a few properties in the WebDriver capabilities test.
It currently tries to serialise Services.appinfo, which has
a field QueryInterface, which is a function. Because of the
Function.prototype.inherits field, this serialisation results in an
infinite recursion, presumably because the inherits method itself is
a function.
This patch removes BaseMarionetteTestRunner.appinfo as it is a clunky and
potentially error-prone implementation due to the way it caches appinfo,
and replaces the current consumers with functions retrieving specific
properties from Services.appinfo.
MozReview-Commit-ID: BPDA6TJrHHb
--HG--
extra : rebase_source : 763c18f2c71412140e4ca21854e1e05514112d0e
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
When a call through the content frame proxy is interrupted by the
dialogueObserver, the synchronous promise that is meant to wait for a
response from the frame script is resolved immediately with an undefined
return value.
When an undefined value is assigned to the response body, it gets dropped
during JSON serialisation. To ensure the "value" field expected from
the Execute Script and Execute Async Script commands is populated,
we need to assign a null value to resp.body.value.
We can treat undefined as null by calling evaluate.toJSON again on the
return value from the proxied frame script call. This effectively means
we serialise it twice, since it first needs to be serialised to cross
the IPC border, though the second computation only looks at primitives
and no known web element store is required.
It would be nicer if the content frame script itself would be able to
return early with null by installing a user prompt notification event,
but this is not possible because the tabmodal dialogue that appears
blocks script execution. This means we need to rely on the
dialogueObserver in testing/marionette/proxy.js to take care of the
dialogue for us.
MozReview-Commit-ID: D14TA2TYYXI
--HG--
extra : rebase_source : 5fc17a1f0786e2fc9a2d054ef7c1f8b0e3336906
The import script functionality was removed in
https://bugzilla.mozilla.org/show_bug.cgi?id=1368648, but the
Marionette.clear_imported_script API was not removed from the client.
We are currently making calls after every test to the clearImportedScripts
command in the server, but we are apparently ignoring the ‘unknown
command’ error that is being returned.
MozReview-Commit-ID: KVjh2IfhuUY
--HG--
extra : rebase_source : ebc8faf8746e7e3e91b395ec488aeea014747848
When a call through the content frame proxy is interrupted by the
dialogueObserver, the synchronous promise that is meant to wait for a
response from the frame script is resolved immediately with an undefined
return value.
When an undefined value is assigned to the response body, it gets dropped
during JSON serialisation. To ensure the "value" field expected from
the Execute Script and Execute Async Script commands is populated,
we need to assign a null value to resp.body.value.
We can treat undefined as null by calling evaluate.toJSON again on the
return value from the proxied frame script call. This effectively means
we serialise it twice, since it first needs to be serialised to cross
the IPC border, though the second computation only looks at primitives
and no known web element store is required.
It would be nicer if the content frame script itself would be able to
return early with null by installing a user prompt notification event,
but this is not possible because the tabmodal dialogue that appears
blocks script execution. This means we need to rely on the
dialogueObserver in testing/marionette/proxy.js to take care of the
dialogue for us.
MozReview-Commit-ID: D14TA2TYYXI
--HG--
extra : rebase_source : 3b2405111b0f027b1fd6281d075ab6dbb2259591
In case a quit or restart is requested, but eg. the in_app
callback doesn't really trigger a shutdown of the application,
Marionette has to force close it after the default shutdown
timeout.
This is necessary because "acceptConnections" is set to false
and no further connection could be made to the still running
application.
MozReview-Commit-ID: GwSeYyjI6M9
--HG--
extra : rebase_source : 52a9b0dcc2b8b7710925f25ec48f4ad5b5e96c64
The Permissions API was used extensively during B2G to make sure the
state of the browser and permissions for APIs were in the relevant
state. This code is no longer used and can be removed.
MozReview-Commit-ID: HgcQe3GEd09
--HG--
extra : rebase_source : 08187e93b6729faae8a1913573d57add752dbb46
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
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 : 6ad739d2ff9bf3d6bafaed0450c8794a257657e7
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 : b4b7e66452b7ce7335ef5f509957121f403d7043
This removes importScript functionality that was used extensively for
B2G testing but is no longer used in tree.
MozReview-Commit-ID: 1O7GWCZPWRZ
--HG--
extra : rebase_source : dc57710690116d9f473271f88f43f298590e895e
If a web page gets opened in a new tab or window, there is no way for
the navigate command to check the current page load status. Instead
we have to wait until the correct URL is getting reported.
MozReview-Commit-ID: JQhPXRgh5Ae
--HG--
extra : rebase_source : 9b60d62af5d4cec2c1a693e152510807165755ba
There is no reason for the command to call into the content framescript.
It's only adding overhead and can currently cause hangs if the framescript
gets reloaded.
Instead use the content browser which is always aware of the current URL.
MozReview-Commit-ID: 9Ui7qClFEWJ
--HG--
extra : rebase_source : e428e71ddb66e0152d164f2aebd20efb0593ceec
If the browser is in fullscreen mode and Set Window Rect is called
we need to exit fullscreen mode and then continue to manipulate the
browser.
As described in https://w3c.github.io/webdriver/webdriver-spec.html#set-window-rect
Step 10
MozReview-Commit-ID: 5ixhGOXVBE4
--HG--
extra : rebase_source : be2b8b6da5cf78c6263502a6cb422e2de81c742d
If the browser is in fullscreen mode and Set Window Rect is called
we need to exit fullscreen mode and then continue to manipulate the
browser.
As described in https://w3c.github.io/webdriver/webdriver-spec.html#set-window-rect
Step 10
MozReview-Commit-ID: 5ixhGOXVBE4
--HG--
extra : rebase_source : be2b8b6da5cf78c6263502a6cb422e2de81c742d
Full Firefox on Linux can now be run with a --headless flag.
This includes seven parts:
1) Running all marionette tests in headless mode.
2) Prevents crashes where Firefox calls into GTK.
3) Adds a headless screen helper which supports changing the headless
screen size with the environment variables MOZ_HEADLESS_WIDTH and
MOZ_HEADLESS_HEIGHT.
4) Supports simulating moving a headless window.
5) Adds a stubbed out nsSound implementation.
6) Supports simulating size mode changes of headless windows.
7) Adds the --headless flag for Firefox.
The test for getting a CSS value off a chrome element relied on a
hardcoded expectation value. To reduce future maintenance, it is better
to get the computed style value and compare it against what Marionette
returns.
MozReview-Commit-ID: 3FbPHGqNEpK
--HG--
extra : rebase_source : 91c0fe0e387152f4c8de1e21c5bda64108249e36
The restart unit tests were using the preference browser.startup.page
with its value set to 3. This actually causes sessionrestore to restore
the session during the next startup. Given that there is a race condition
in retrieving window handles (bug 1363368) it's better to use another
default preference which does not trigger this behavior.
MozReview-Commit-ID: 4m7qHxgI504
--HG--
extra : rebase_source : d5e29c0357dfcbe8395681f57000a7a1db769178
For debug builds a delay of 1s is too short. It means that a navigation
command will return when the readyState reaches interactive for an eager
page load strategy. Also due to the slowness of the browser, the getUrl
command which gets run before the readyState check takes too long. Doing
the latter check first fixes it.
MozReview-Commit-ID: D2je04Euwf0
--HG--
extra : rebase_source : 0708fcc1eb5b7198fa45ab995de404db34b64968
For debug builds a delay of 1s is too short. It means that a navigation
command will return when the readyState reaches interactive for an eager
page load strategy. But due to the slowness of the browser, the next
command could already operate on a complete readyState. Delaying the load
of resources is the only possible option.
MozReview-Commit-ID: D2je04Euwf0
--HG--
extra : rebase_source : d74f276d96cd5bd2301f9dac8866f9dadc6e2937
According to a recent change in the WebDriver specification, we need to
return an object's JSON representation iff it exists.
The relevant specification prose change was made in
1ee4c61c11.
This patch causes return values that have a toJSON property that is a
function, to return the value of calling said function.
MozReview-Commit-ID: GpQNE9GpjCH
--HG--
extra : rebase_source : 7192bbd484cbaa4661f2442990082aefcdd1570b
This adds a test to set the window size to that of the available height and width. This
was an issue before. See https://github.com/mozilla/geckodriver/issues/153
MozReview-Commit-ID: J7H8WIYiB5l
--HG--
extra : rebase_source : d1da5420ccf99cab9c0e96c869059d0feb63fbb7
By using the page load strategy each navigation request has to return
when the page load has reached the expected document ready state, or
immediately if a strategy of "none" is set.
This also removes the page load checks when switching frames because
this is not part of the webdriver spec.
MozReview-Commit-ID: 3KbsDvzEG6c
--HG--
extra : rebase_source : 68170235424e181c083febd44fca6bb0c5dfec63
The patch aligns the steps for deserializing the page load strategy with
the webdriver specification.
MozReview-Commit-ID: GnVTnhVQVkG
--HG--
extra : rebase_source : c7796817fa6d0397b4821445dc3bd87853e0e509
Right now we retrieve window handles at different locations and as
such those are sometimes numbers but also strings. Given that we have
strict comparisons when checking for the id, checks can fail.
The patch also ensures that both close() and closeChromeWindow()
methods are returning the window ids as string.
MozReview-Commit-ID: ImOLe0Z2OE1
--HG--
extra : rebase_source : fe6e7857def2fde4e8253b1bfef8dd2a7d6bd954
There is a race condition for all navigation tests inside the setUp
method of the BaseNavigationTestCase class. The assert for history
items can already happen if the page hasn't been fully loaded yet.
As such a failure is thrown. To fix this we have to wait for the
page being loaded.
MozReview-Commit-ID: 9LbArVT9WqA
--HG--
extra : rebase_source : 0c64798893b64f66f39e7aca16db9b4423d78047
This implements the Full Screen method described in the WebDriver specification
(http://w3c.github.io/webdriver/webdriver-spec.html#fullscreen-window) as well as
tests for it.
MozReview-Commit-ID: GKec7GNE6rm
--HG--
extra : rebase_source : 92d427b40d6aeb760783e67d4796a56bb0dbc6cb
In cases when the navigation trigger function returns too late and the
beforeunload event has already been fired, the page load currently gets
canceled. This happens because the page unload timer hasn't been set at
this time and the unbeforeunload handler doesn't extend its time.
With this patch a flag is used which indicates if an beforeunload
event already occurred, so when the pageunload timer notifies the page
listener the unload timer can be extended to 5s as expected.
MozReview-Commit-ID: FKK0oGEWijU
--HG--
extra : rebase_source : bf4342cfb439eb85cb87cad922054953e5cb97f3
Continue to allow non-multiprocessCompatible extensions in automation.
There are a ton of places that would need to be changed, many of which
will be changing soon anyway with the non-webextensions change in 57
so this is mostly the expedient route to keeping the tree green.
MozReview-Commit-ID: EZZoDVdhLfy
--HG--
extra : rebase_source : f83472bc1c88dd0deadbe485d9002499027ff07f
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
Our click + page load implementation doesn't handle complex navigation
scenarios yet. As such those should not be triggered inside our unit
tests.
MozReview-Commit-ID: Cog5vohttes
--HG--
extra : rebase_source : 7068483f041ab1895ecc921f377da9bfd420ec23
Continue to allow non-multiprocessCompatible extensions in automation.
There are a ton of places that would need to be changed, many of which
will be changing soon anyway with the non-webextensions change in 57
so this is mostly the expedient route to keeping the tree green.
MozReview-Commit-ID: EZZoDVdhLfy
--HG--
extra : rebase_source : 34aa762917566b052ade6372280caed72fbfbe9a
Similar to the other unload and load events during a page load,
the hashchange event should only be handled if the event's target
document is the current window.
MozReview-Commit-ID: F1LMBh5Cy4A
--HG--
extra : rebase_source : 668fd6946067989e7e732b24baf6de2e85541f21
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
When refactoring the tests for the Set Window Rect command, it was
discovered that the Maximize Window command was not synchronous.
This patch makes GeckoDriver#maximizeWindow synchronous by waiting for
the DOM resize event to fire before returning the window rect to the user.
It also aligns the command with the WebDriver standard by making it
restore the window to its original size when calling the command a
second time.
MozReview-Commit-ID: Ft3tn2A4m7u
--HG--
extra : rebase_source : 52b523e53dd19cc8bdc4631382c96db5906f333a
When the window's size is being set to the window's existing size,
Marionette unconditionally listens for the DOM resize event. When a
window is not resized, no such event fires.
This patch skips setting the window size when the window's current size
is the requested size. This bypasses the problem of listening for an
event that never occurs.
It also combines the window position- and size tests into a
test_window_rect.py test, since they share many of the same
characteristics.
Fixes: https://github.com/mozilla/geckodriver/issues/643
MozReview-Commit-ID: IUtCFXwT1fh
--HG--
extra : rebase_source : 43c4d0e24cf1e0dc6102af48b8fe6f075b6dd4a2
The test assumes the click point is the centre of the element, whereas
WebDriver uses the _in-view_ centre point to perform clicks.
If parts of the element is rendered outside the viewport, the click
point is calculated from visible portion of the element that is seen in
the viewport.
This means that if any portion of an element is within the boundaries of
the viewport, it is clickable. If it is not, then it is not interactable.
This change is unfortunately not accompanied with any
implementation changes, but prepares Marionette for the changes
to the Element Click implementation that will come as part of
https://bugzilla.mozilla.org/show_bug.cgi?id=1321516.
MozReview-Commit-ID: Kh0zzRrtmJ4
--HG--
extra : rebase_source : 63cc463a11d5ca085e7a96ea84dcadbe3bb90204
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
Tests for page timeout durations have to use an HTTPD handler that delays
or slows down document load. Otherwise there a risk that the timeout error
is not returned before the document finishes loading.
MozReview-Commit-ID: HGGcXfCuaSH
--HG--
extra : rebase_source : c79b01ca4e56e21877c6fe94309b7b0424d9b552
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
Tests for page timeout durations have to use an HTTPD handler that delays
or slows down document load. Otherwise there a risk that the timeout error
is not returned before the document finishes loading.
MozReview-Commit-ID: HGGcXfCuaSH
--HG--
extra : rebase_source : c79b01ca4e56e21877c6fe94309b7b0424d9b552
This change makes it possible to click elements that has its
pointer-events style property set to "none".
If an element has its style property pointer-events set to "none",
the element in view test will fail due to document.elementsFromPoint
excluding it due to non-interactability. This is only a problem when
checking if the element is inside the viewport, and not when actually
performing interaction with the element.
The relevant specification change is
ba6ee925b5.
MozReview-Commit-ID: JwZB6fm7P9A
--HG--
extra : rebase_source : 18ddf7955c7e0bc6d1d7f798aebc6e09799a99ca
Add preliminary support for returning unexpected alert open errors when
calling commands that require it according to the WebDriver standard.
Also fixes a faulty test that seems to believe it is fine to click an
element whilst an alert is present.
Further work needs to be done on user prompts, asserts, and the handler
for user prompts in https://bugzilla.mozilla.org/show_bug.cgi?id=1264259.
MozReview-Commit-ID: BiWURoQECji
--HG--
extra : rebase_source : caa1506a0e972c7ad0da2d31993fb0b8ecc1ee17
Testing the return value is misleading in this case. What we want to
test is that it does not throw due to a permissions issue.
MozReview-Commit-ID: 2Wbwou9opyF
--HG--
extra : rebase_source : 2731ddce0efcd705880a70d69ee934571a766b9a
The Components.classes constructor should throw an error in both the
mutable and the "default" sandbox.
MozReview-Commit-ID: C40nZNaVWwz
--HG--
extra : rebase_source : 81ecde684967241de5fed8f61dd1c0d69d077cfb
We accidentally only ran them in "default" and "system" before, and also
one of the arguments in the system globals test was wrong.
MozReview-Commit-ID: DmBYGsZaIVP
--HG--
extra : rebase_source : 25f72fca677a44079d727e5ff3fa147e3e28eb6e
We were previously missing a test for the arguments variable that is
implicitly exposed to functions.
MozReview-Commit-ID: IC6aJcUsyhd
--HG--
extra : rebase_source : 7aeb986bb4c299ef5996f7b2847e6cc2d878459f
The Python standard library uses tuples to define arguments for functions,
whenever they are invoked through meta programming.
The Marionette client only allows the list type for backwards
compatibility, so we prefer tuples in this case.
Another good argument for tuples is that tuples are immutable.
MozReview-Commit-ID: 72zPzYvBz7Q
--HG--
extra : rebase_source : 79315dd809e00c4c805bd0de3244b519e3ff286f
Marionette does not protect the unloadHandler in
testing/marionette/evaluate.js from content introspection or
modification, which can happen when web frameworks override
window.addEventListener/window.removeEventListener.
The script evaluation module used in Marionette relies on
sandbox.window.addEventListener/removeEventListener to throw an error when
script execution is aborted due to the document unloading itself. If the
window.addEventListener/removeEventListener functions have been overridden
to introspect the objects that are passed, they may inadvertently touch
objects originating from chrome space, such as the unloadHandler.
Because the Gecko sandboxing system put in place strict security measures
to prevent accidental chrome-space modification from content, inspecting
the unloadHandler will throw a permission denied error once the script
has finished executing.
We have found examples in the wild of this in particular with the Angular
web framework. This patch makes the unloadHandler safe for introspection
from web content.
Fixes: https://github.com/mozilla/geckodriver/issues/515
MozReview-Commit-ID: E2LgPhLLuDT
--HG--
extra : rebase_source : 9948585b4ac2f464a9f31868bfd2d5967e61755e
The test doesn't care about the page load status when a timeout error happened
for a back and forward command. It only compares the urlbar for the expected
url, but doesn't actually wait for the required element on the page.
MozReview-Commit-ID: 8w0iP62rlQZ
--HG--
extra : rebase_source : a78d8530dd181084a5f45e6bffeae136a0cabb74
Everything depending on the widget being gonk can go away, as well as
everything depending on MOZ_AUDIO_CHANNEL_MANAGER, which was only
defined on gonk builds under b2g/ (which goes away in bug 1357326).
--HG--
extra : rebase_source : 9f0aeeb7eea8417fa4e06d662d566d67ecaf2a24
Testing the return value is misleading in this case. What we want to
test is that it does not throw due to a permissions issue.
MozReview-Commit-ID: 2Wbwou9opyF
--HG--
extra : rebase_source : f2a95ba66999ee430f58b7aa9de70742a209defd
The Components.classes constructor should throw an error in both the
mutable and the "default" sandbox.
MozReview-Commit-ID: C40nZNaVWwz
--HG--
extra : rebase_source : ced5ccba9108f2cd0c37cf799e83913bf19afac6
We accidentally only ran them in "default" and "system" before, and also
one of the arguments in the system globals test was wrong.
MozReview-Commit-ID: DmBYGsZaIVP
--HG--
extra : rebase_source : 75b2f87a6c9f1b425607e0a743669b985b8f3072
We were previously missing a test for the arguments variable that is
implicitly exposed to functions.
MozReview-Commit-ID: IC6aJcUsyhd
--HG--
extra : rebase_source : d94cdf0a0f4c74b0bb3240b32ad53da107931183
The Python standard library uses tuples to define arguments for functions,
whenever they are invoked through meta programming.
The Marionette client only allows the list type for backwards
compatibility, so we prefer tuples in this case.
Another good argument for tuples is that tuples are immutable.
MozReview-Commit-ID: 72zPzYvBz7Q
--HG--
extra : rebase_source : f9338db8adacbccd82f23a3b7a38194d747e27a1
Marionette does not protect the unloadHandler in
testing/marionette/evaluate.js from content introspection or
modification, which can happen when web frameworks override
window.addEventListener/window.removeEventListener.
The script evaluation module used in Marionette relies on
sandbox.window.addEventListener/removeEventListener to throw an error when
script execution is aborted due to the document unloading itself. If the
window.addEventListener/removeEventListener functions have been overridden
to introspect the objects that are passed, they may inadvertently touch
objects originating from chrome space, such as the unloadHandler.
Because the Gecko sandboxing system put in place strict security measures
to prevent accidental chrome-space modification from content, inspecting
the unloadHandler will throw a permission denied error once the script
has finished executing.
We have found examples in the wild of this in particular with the Angular
web framework. This patch makes the unloadHandler safe for introspection
from web content.
Fixes: https://github.com/mozilla/geckodriver/issues/515
MozReview-Commit-ID: E2LgPhLLuDT
--HG--
extra : rebase_source : c7431630d24c42ebfd7ded3cf204c1ef245211d0
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 : 2c4d2a19a006645ecd44e08a28309367bf4f8d32
Tests for page timeout durations have to use an HTTPD handler that delays
or slows down document load. Otherwise there a risk that the timeout error
is not returned before the document finishes loading.
MozReview-Commit-ID: HGGcXfCuaSH
--HG--
extra : rebase_source : 42f60ad9864d87601cd528a0f1accffb768ba438
Tests which have to wait for a page being loaded should always use a timeout as
set via self.marionette.timeout.page_load.
MozReview-Commit-ID: HFTOYy6WYNk
--HG--
extra : rebase_source : cc2981595e2a62fd761baec8a3c15486832cc0ed
Testing the return value is misleading in this case. What we want to
test is that it does not throw due to a permissions issue.
MozReview-Commit-ID: 2Wbwou9opyF
--HG--
extra : rebase_source : cd056ed38b9cf7b9eb095635209fbe6b090721fd
The Components.classes constructor should throw an error in both the
mutable and the "default" sandbox.
MozReview-Commit-ID: C40nZNaVWwz
--HG--
extra : rebase_source : f02506f16ff409761ba09ae0f32ff2902cdf07a3
We accidentally only ran them in "default" and "system" before, and also
one of the arguments in the system globals test was wrong.
MozReview-Commit-ID: DmBYGsZaIVP
--HG--
extra : rebase_source : c9f1493ce3faed0ec2e5ad6125a4f7811a1fef03
We were previously missing a test for the arguments variable that is
implicitly exposed to functions.
MozReview-Commit-ID: IC6aJcUsyhd
--HG--
extra : rebase_source : 9039dcb7fcea681d8c9cd729cca8c55701631a5c
The Python standard library uses tuples to define arguments for functions,
whenever they are invoked through meta programming.
The Marionette client only allows the list type for backwards
compatibility, so we prefer tuples in this case.
Another good argument for tuples is that tuples are immutable.
MozReview-Commit-ID: 72zPzYvBz7Q
--HG--
extra : rebase_source : 2406e92b8bec8a965df6457bb166fd9761513b1e
Marionette does not protect the unloadHandler in
testing/marionette/evaluate.js from content introspection or
modification, which can happen when web frameworks override
window.addEventListener/window.removeEventListener.
The script evaluation module used in Marionette relies on
sandbox.window.addEventListener/removeEventListener to throw an error when
script execution is aborted due to the document unloading itself. If the
window.addEventListener/removeEventListener functions have been overridden
to introspect the objects that are passed, they may inadvertently touch
objects originating from chrome space, such as the unloadHandler.
Because the Gecko sandboxing system put in place strict security measures
to prevent accidental chrome-space modification from content, inspecting
the unloadHandler will throw a permission denied error once the script
has finished executing.
We have found examples in the wild of this in particular with the Angular
web framework. This patch makes the unloadHandler safe for introspection
from web content.
Fixes: https://github.com/mozilla/geckodriver/issues/515
MozReview-Commit-ID: E2LgPhLLuDT
--HG--
extra : rebase_source : 6fe4f61fd18f42fb5332a664189f3ea919db28c5
Update the refresh command to make it synchronous, and let it return
once the target page has been loaded. This can be accomplished by using
the loadListener object in listener.js.
MozReview-Commit-ID: Lc8QoGFeQrY
--HG--
extra : rebase_source : 1fd914aec1c55fe91a0de773cfd7ff22b5d12167
This refactoring allows us to re-use the same load algorithm for
each command which could trigger a page load. It also takes remoteness
changes into account, and waits until the load has been done.
With this change we no longer check for readyState only, but observe
the necessary DOM events as fired for page unloads and loads. This will
help us to implement the page loading strategy later.
By observing the DOM events, I also expect a small increase of performance
for any kind of page load, given that we now return immediately and do not
have a delay of 100ms at maximum.
MozReview-Commit-ID: IVtO6KgJFES
--HG--
extra : rebase_source : 40f90e3b9d1bf0a2f9123271cd08513769616e41
To delay the page load for our slowly served example page when using the
back or forward commands, the page doesn't have to be put into the browser
cache.
MozReview-Commit-ID: 4xMjR3SakZn
--HG--
extra : rebase_source : 024b8e702d95689defcee7e12496ce531e72d651
Using non-remote pages causes framescripts to be reloaded. We should try
to avoid using those pages as much as possible, and test remoteness
switches in particular tests only. This is to reduce possible hangs.
MozReview-Commit-ID: ICPPkU07KQK
--HG--
extra : rebase_source : 7fdf1f2815790c70f4961cb004a3c066d9a2471e
To ensure that Marionette can also detect modal dialogs opened right after
the application starts, and before Marionette has been initialized, the modal
dialog detection code has to be delayed until a new session actually gets
started. Then it's not enough to only register the observer notification, but
it should also be checked for open modal or tab modal dialogs.
MozReview-Commit-ID: ChYcR3I59DW
--HG--
extra : rebase_source : 68f13620a41d0535f96abe4d1b25d41a6b428120
Until now the unit tests only covered modal dialogs as shown when
disabling the preference `prompts.tab_modal.enabled`. This actually
tests an unsupported feature. Replacing it with a real modal dialog
like HTTP authentication is what we really want here.
MozReview-Commit-ID: 9FBxVuGJiEB
--HG--
rename : testing/marionette/harness/marionette_harness/www/modal_dialogs.html => testing/marionette/harness/marionette_harness/www/test_tab_modal_dialogs.html
extra : rebase_source : 504cf50ab5392d1f55e3027883ef6d45b69fc38b
Update the refresh command to make it synchronous, and let it return
once the target page has been loaded. This can be accomplished by using
the loadListener object in listener.js.
MozReview-Commit-ID: Lc8QoGFeQrY
--HG--
extra : rebase_source : afb2bd3f10fd08b6eff85f7583d2cbb535f4f154
This refactoring allows us to re-use the same load algorithm for
each command which could trigger a page load. It also takes remoteness
changes into account, and waits until the load has been done.
With this change we no longer check for readyState only, but observe
the necessary DOM events as fired for page unloads and loads. This will
help us to implement the page loading strategy later.
By observing the DOM events, I also expect a small increase of performance
for any kind of page load, given that we now return immediately and do not
have a delay of 100ms at maximum.
MozReview-Commit-ID: IVtO6KgJFES
--HG--
extra : rebase_source : 1216be48a23f8841fe1b12873e6154480ace125a
To delay the page load for our slowly served example page when using the
back or forward commands, the page doesn't have to be put into the browser
cache.
MozReview-Commit-ID: 4xMjR3SakZn
--HG--
extra : rebase_source : 081ce5fa2b915c8aede55c7194e975da2ba6169e
Using non-remote pages causes framescripts to be reloaded. We should try
to avoid using those pages as much as possible, and test remoteness
switches in particular tests only. This is to reduce possible hangs.
MozReview-Commit-ID: ICPPkU07KQK
--HG--
extra : rebase_source : 05ec5d09fec88236b6535e757ee1d1348f485bf6
Brings the getWindowPosition and getWindowSize calls into
one call. This aligns Marionette with the W3C WebDriver call
`Get Window Rect`.
MozReview-Commit-ID: ItWI6YpCJkx
--HG--
extra : rebase_source : c08daa9ba0a31a2f2082a7d460619e817180bf22
This implements Set Window Rect from the W3C WebDriver specification
to allow us to change the size and position of a window in one call
MozReview-Commit-ID: KxwJyyjg1VU
--HG--
extra : rebase_source : e2f32e4c674847b336c5eeb772d24fff595e2075
This shortens the name of the quitApplication Marionette command to
`quit'.
The client is not updated since it is used for Firefox upgrade tests.
It can be updated to use `quit' when Firefox 56 ships.
MozReview-Commit-ID: Gq5KWMS1AzF
--HG--
extra : rebase_source : dfaf557f658595bfa5b8d1d294d6d6525f5d2abf
This adds a return type to the quitApplication command in Marionette,
which extracts the data received by the quit-application observer.
The returned cause is either "shutdown" or "restart".
MozReview-Commit-ID: 85fBGaS1VeQ
--HG--
extra : rebase_source : f96409b772a2c30e755b5a28b6e4eef1dcfb2654
Change Marionette's quitApplication command to accept an optional array
of masks for Services.startup.quit. If no masks are provided or the flags
field is not provided, we assume nsIAppInfo.eAttemptQuit as the default.
This deviates from the current behaviour whereby eAttemptQuit is
unconditionally included when passed an array of flags. This is
problematic because Services.startup.quit does not allow combinations
of *Quit flags, e.g. eAttemptQuit and eForceQuit cannot be combined.
MozReview-Commit-ID: FVqdaXFA4aC
--HG--
extra : rebase_source : 10074c53294a6596ecbd09a3f6ec477f3f8ed452
Update the refresh command to make it synchronous, and let it return
once the target page has been loaded. This can be accomplished by using
the loadListener object in listener.js.
MozReview-Commit-ID: Lc8QoGFeQrY
--HG--
extra : rebase_source : f5aa7a9a6d144b849b2808b08d78ca99fc83e518
This refactoring allows us to re-use the same load algorithm for
each command which could trigger a page load. It also takes remoteness
changes into account, and waits until the load has been done.
With this change we no longer check for readyState only, but observe
the necessary DOM events as fired for page unloads and loads. This will
help us to implement the page loading strategy later.
By observing the DOM events, I also expect a small increase of performance
for any kind of page load, given that we now return immediately and do not
have a delay of 100ms at maximum.
MozReview-Commit-ID: IVtO6KgJFES
--HG--
extra : rebase_source : 7cce694d464a18773c65056c336b9f900f5466d0
To delay the page load for our slowly served example page when using the
back or forward commands, the page doesn't have to be put into the browser
cache.
MozReview-Commit-ID: 4xMjR3SakZn
--HG--
extra : rebase_source : a580578b277ad56a54a775f5a9a18ec62c7f81a7
Using non-remote pages causes framescripts to be reloaded. We should try
to avoid using those pages as much as possible, and test remoteness
switches in particular tests only. This is to reduce possible hangs.
MozReview-Commit-ID: ICPPkU07KQK
--HG--
extra : rebase_source : 54faf68950fe70bbb49bd8f6b4f8595d5ef988c0
The WebDriver specification recently decided to use "pageLoad" instead of
"page load" to identify the page load duration timeout in the session
timeouts configuration object:
https://github.com/w3c/webdriver/pull/796
This change aligns Marionette with WebDriver, and as long as this patch
is uplifted to Aurora (53) and Beta (52) in reasonable time, we should be
able to avoid the backwards compatibility dance with the Python client
(for upgrade tests) because the original change to the data format
landed on the current Firefox version:
https://bugzilla.mozilla.org/show_bug.cgi?id=1316622
MozReview-Commit-ID: BzQeJku4AFS
--HG--
extra : rebase_source : 61b4450ef610cb36e6ed585ee6b20807b51f23be