Commit Graph

55 Commits

Author SHA1 Message Date
Kris Maglione
e930b89c34 Bug 1514594: Part 3 - Change ChromeUtils.import API.
***
Bug 1514594: Part 3a - Change ChromeUtils.import to return an exports object; not pollute global. r=mccr8

This changes the behavior of ChromeUtils.import() to return an exports object,
rather than a module global, in all cases except when `null` is passed as a
second argument, and changes the default behavior not to pollute the global
scope with the module's exports. Thus, the following code written for the old
model:

  ChromeUtils.import("resource://gre/modules/Services.jsm");

is approximately the same as the following, in the new model:

  var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");

Since the two behaviors are mutually incompatible, this patch will land with a
scripted rewrite to update all existing callers to use the new model rather
than the old.
***
Bug 1514594: Part 3b - Mass rewrite all JS code to use the new ChromeUtils.import API. rs=Gijs

This was done using the followng script:

https://bitbucket.org/kmaglione/m-c-rewrites/src/tip/processors/cu-import-exports.jsm
***
Bug 1514594: Part 3c - Update ESLint plugin for ChromeUtils.import API changes. r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D16747
***
Bug 1514594: Part 3d - Remove/fix hundreds of duplicate imports from sync tests. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D16748
***
Bug 1514594: Part 3e - Remove no-op ChromeUtils.import() calls. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D16749
***
Bug 1514594: Part 3f.1 - Cleanup various test corner cases after mass rewrite. r=Gijs
***
Bug 1514594: Part 3f.2 - Cleanup various non-test corner cases after mass rewrite. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D16750

--HG--
extra : rebase_source : 359574ee3064c90f33bf36c2ebe3159a24cc8895
extra : histedit_source : b93c8f42808b1599f9122d7842d2c0b3e656a594%2C64a3a4e3359dc889e2ab2b49461bab9e27fc10a7
2019-01-17 10:18:31 -08:00
Geoff Lankow
fe3e835c8c Bug 1506523 - Adapt Marionette so it can run on Thunderbird; r=whimboo
--HG--
extra : rebase_source : 65b6677dfe8672b4972f65dcf50228a826a4ba9e
2018-11-23 10:38:19 +13:00
Andreas Tolfsen
5c26c522ac Bug 1447977 - Move cyclic object test function to evaluate. r=automatedtester
Moves the innards of assert.acyclic to evaluate.isCyclic so it can
be called externally without throwing.  It makes more sense for
this function to be exposed on the evaluate module, since other
behaviour related to JSON marshaling is also defined there.

MozReview-Commit-ID: 4WjEy8Sjqrm

--HG--
extra : rebase_source : 88cd829f3e178ec49ae532ea0af0a62defb4469f
2018-07-06 18:35:21 +01:00
Kris Maglione
19a956c2c6 Bug 1431533: Part 5b - Fix ESLint errors left over after rewrite. r=florian
MozReview-Commit-ID: 7bVI1iM6hor

--HG--
extra : source : 0b97a30cadb1a96d3cafae6b79ef0d3ec26770cf
extra : amend_source : 09a90b29837e339eec7bdf8504f86c28e74ca3dd
extra : intermediate-source : a1eca62826a1341ca24d4d2a93d4884d4fc7ad51
extra : histedit_source : eb26e73b531f9a34d3401d39f60b533b27b78540
2018-01-18 16:27:26 -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
Cosmin Sabou
9a65a40178 Backed out 3 changesets (bug 1431533) for Android mochitest failures on testEventDispatcher on a CLOSED TREE
Backed out changeset a1eca62826a1 (bug 1431533)
Backed out changeset 34c999fa006b (bug 1431533)
Backed out changeset e2674287e57f (bug 1431533)
2018-01-30 07:17:48 +02:00
Kris Maglione
e050496c59 Bug 1431533: Part 5b - Fix ESLint errors left over after rewrite. r=florian
MozReview-Commit-ID: 7bVI1iM6hor

--HG--
extra : source : 0b97a30cadb1a96d3cafae6b79ef0d3ec26770cf
extra : amend_source : d0515fe4eb13b59cc490ca9d964ad9ee15ef3cd3
extra : intermediate-source : 6e56f4c8843ed134b2dba34fb007298fd55be966
extra : histedit_source : 88abf9f4ea4e740a9391278625ef07395205c3f5%2Cc14bc7a71eb413fcb573ed0d030fd7f99a1468f0
2018-01-18 16:27:26 -08:00
Kris Maglione
6476f95b13 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
2018-01-29 15:20:18 -08:00
Brindusan Cristian
af8879d1eb Backed out 2 changesets (bug 1431533) for ESlint failures on a CLOSED TREE
Backed out changeset 6e56f4c8843e (bug 1431533)
Backed out changeset 12fc4dee861c (bug 1431533)
2018-01-30 02:32:43 +02:00
Kris Maglione
e70d01a9e9 Bug 1431533: Part 5b - Fix ESLint errors left over after rewrite. r=florian
MozReview-Commit-ID: 7bVI1iM6hor

--HG--
extra : rebase_source : 6286dcfd1a7c970272ac6befaccd3e47e90d2f6b
extra : intermediate-source : d48657228a0b84cf3a37a35227ca3b3d0bd2a017
extra : source : 0b97a30cadb1a96d3cafae6b79ef0d3ec26770cf
2018-01-18 16:27:26 -08:00
Kris Maglione
c276bb9375 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 : rebase_source : c004a023389f1f6bf3d2f3efe93c13d423b23ccd
2018-01-29 15:20:18 -08:00
Andreas Tolfsen
2861122a4c Bug 1430109 - Combine assert.window and assert.contentBrowser. r=maja_zf
The forthcoming window tracking refactoring introduces the new
abstractions ContentContext and ChromeContext that to a large extent
share the same interface.  They make it possible to interact with
both types of browsing context in a uniform manner.

Marionette currently has a lot of convoluted if-conditions to
paper over the differences between ChromeWindow, <xul:browser>,
and browser.Context.  Examples of this includes the assert.window
and assert.contentBrowser assertions: they essentially perform the
same job, but does not share the same API because the underlying
APIs they call are different.

In an effort to prepare Marionette for the window tracking refactoring,
this patch adds a bit of glue to combine them both into one assertion
called assert.open.  This checks that the browsing context has not
been discarded.

MozReview-Commit-ID: K5e7Sr1mq0
2018-01-15 14:02:39 +00:00
Andreas Tolfsen
17e02f9dbb Bug 1106913 - Add assert.acyclic for testing for cyclic objects. r=whimboo
Introduces a new assert.acyclic assertion helper function that uses
JSON.stringify to test if the input contains cyclic object references.
A JavaScriptError will be thrown if the object is not acyclic.

MozReview-Commit-ID: 3y8pnkPgf2k

--HG--
extra : rebase_source : 069ae9e1e6d3738c8712fe5c1838f6d3a91125e4
2017-11-24 18:21:03 +00:00
Peter Major
edc2cc261c Bug 1408962 - Make add cookie command webdriver spec comformant r=ato,whimboo
* Changed positiveInteger to validate upper bounds
* Removed processing for the no longer existent 'session' field
* Added default values for absent fields

MozReview-Commit-ID: E4x6TyMwZQs

--HG--
extra : rebase_source : 745cfeb0e3757651ed20f04de19eccb98eea9fc5
2017-10-28 11:37:40 +01:00
Andreas Tolfsen
405edbbbd0 Bug 1410652 - Fix API docs of assert functions. r=whimboo
MozReview-Commit-ID: HktgnHoCGZV

--HG--
extra : rebase_source : fbd1dbc73ad4ebfb3b06196eed2d17ea0c4b00f4
2017-10-24 17:32:26 +01:00
Sebastian Hengst
7eb270c395 Backed out 4 changesets (bug 1410652) for eslint failure at testing/marionette/element.js: Line 1456 exceeds the maximum line length of 78. r=backout
Backed out changeset 97031d4ea2bd (bug 1410652)
Backed out changeset 66754caa4c52 (bug 1410652)
Backed out changeset 48048929bb17 (bug 1410652)
Backed out changeset 265a168b4e37 (bug 1410652)
2017-10-30 19:32:43 +01:00
Andreas Tolfsen
999ba4ba27 Bug 1410652 - Fix API docs of assert functions. r=whimboo
MozReview-Commit-ID: HktgnHoCGZV

--HG--
extra : rebase_source : a7b5586dba2a18d325aac765a9db13de31696095
2017-10-24 17:32:26 +01: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
Henrik Skupin
b5ddfae9aa Bug 1407925 - Don't use application name but ID to determine Firefox. r=ato
MozReview-Commit-ID: 9TZrs4nk31y

--HG--
extra : rebase_source : a79e15619e5b25dd494ba0be5bb0e84ec67dab86
2017-10-12 13:21:17 +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
da6629ba61 Bug 1387559 - Drop session_id fallback for WebDriver:NewSession. r=automatedtester
The WebDriver service in the remote protocol accepts sessionId and
session_id and we only need on.  All known consumers are using sessionId,
and we can drop the session_id fallback.

MozReview-Commit-ID: 6fa5Lgkzwfu
2017-08-05 17:35:54 +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
Andreas Tolfsen
d26d0d6594 Bug 1371733 - Propagate error message of assert.object; r=whimboo
The err argument to assert.object is currently being dropped, which
means we loose the specialised and the custom error message.

This patch propagates the error message like we do for all other
assertions in this module.

MozReview-Commit-ID: GwuBSbqKfk1

--HG--
extra : rebase_source : 86c57aaaf60526eaf65345b9d5e38378920419e3
2017-06-12 18:02:39 +01:00
Henrik Skupin
c0479d07f7 Bug 1368965 - assert.contentBrowser has to check for closed chrome window. r=ato
Due to the current caching of this.tab in browser.js the assertion
for the contentBrowser would fail. As such additionally assert that
the currently selected chrome window has not been closed yet.

Also assert.window should better check the 'closed' property instead
of handling a possible TypeError.

MozReview-Commit-ID: B79czg3dsux

--HG--
extra : rebase_source : 31bf31d2151e4b461574101ce7770d38fb92bd5c
2017-06-13 18:08:22 +02:00
Henrik Skupin
8907d0b29a Bug 1368492 - Add assert.browsingContext for parent process. r=ato
When accessing a property of the current content browser from
the parent process, the current top-level browsing context has
to be valid.

MozReview-Commit-ID: BZHJTk1j5Nj

--HG--
extra : rebase_source : 7e44fc6e05d7fb1429fb3e36e897cf51b3d9142f
2017-05-31 16:44:49 +02:00
Henrik Skupin
16a144567e Bug 1318351 - Remove B2G related assertions. r=ato
MozReview-Commit-ID: Iy0wYJoodvO

--HG--
extra : rebase_source : 3bd93ecc4ef24df3db6846d7db2a314c183128aa
2017-05-03 16:40:37 +02:00
Andreas Tolfsen
9d9b0dba43 Bug 1359004 - Add preliminary support for unexpected alerts r=whimboo
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
2017-04-20 18:00:46 +01:00
Henrik Skupin
8f09dfa944 Bug 1299626 - Fix "TypeError: can't access dead object" in assert.window(). r=ato
The assertion method is used to check for a valid window. But it can fail
itself when already accessing the ChromeWindow. To fix that we have to
catch a possible TypeError and let the method throw a NoSuchWindowError
instead.

MozReview-Commit-ID: 3Uaio4a3HtA

--HG--
extra : rebase_source : 5c672e441789e45b4972b0f8fde8471b4998394d
2017-03-28 21:10:06 +02:00
Andreas Tolfsen
18c977b6ec Bug 1337743 - Document misuse of instanceof in Marionette; r=whimboo
MozReview-Commit-ID: IbUyQd0xCAI

--HG--
extra : rebase_source : 5f4298e2951d9a606ad85e145771570b84b2e3d7
2017-02-14 16:48:14 +00:00
Andreas Tolfsen
90398e4cd5 Bug 1337743 - Add assert.callable for checking callbacks; r=maja_zf
MozReview-Commit-ID: 2bJbi4iEGlZ

--HG--
extra : rebase_source : 2a16d909389df554eb719f574d655ee96694e0ad
2017-02-10 19:28:51 +00:00
Andreas Tolfsen
0a3aacab95 Bug 1337743 - Count nsJSIID objects as objects; r=whimboo
MozReview-Commit-ID: IKzgAYEgAJe

--HG--
extra : rebase_source : 643d38527e7707b8398477ecbc5f9a57f010eacd
2017-02-09 16:35:07 +00:00
Henrik Skupin
9b63422f73 Bug 1322383 - Add missing checks for valid chrome window. r=ato
Update necessary commands in driver.js to conform with webdriver spec by checking for a valid chrome window,
before executing the actual command.

MozReview-Commit-ID: Ad67SPx8vBx

--HG--
extra : rebase_source : 560b0807c72efb513027abcde3bf7af38aca602a
2017-03-20 15:13:32 +01:00
Sebastian Hengst
ce42d563b4 Backed out changeset 2da5d0c57ecd (bug 1322383) 2017-03-21 19:05:56 +01:00
Henrik Skupin
53fb89a6a6 Bug 1322383 - Add missing checks for valid chrome window. r=ato
Update necessary commands in driver.js to conform with webdriver spec by checking for a valid chrome window,
before executing the actual command.

MozReview-Commit-ID: Ad67SPx8vBx

--HG--
extra : rebase_source : 356f6aadad8e8a8cb53578bf1c194a3a26fb2e45
2017-03-20 15:13:32 +01:00
Carsten "Tomcat" Book
1f281c3405 Backed out changeset 74b0c928a23e (bug 1322383) for frequent failure rate in marionette tests
--HG--
rename : testing/marionette/harness/marionette_harness/tests/unit/test_window_type_chrome.py => testing/marionette/harness/marionette_harness/tests/unit/test_window_type.py
2017-03-01 12:49:21 +01:00
Henrik Skupin
adf2cd32d2 Bug 1322383 - Add missing checks for valid window r=ato+446296
MozReview-Commit-ID: Ad67SPx8vBx

--HG--
rename : testing/marionette/harness/marionette_harness/tests/unit/test_window_type.py => testing/marionette/harness/marionette_harness/tests/unit/test_window_type_chrome.py
extra : rebase_source : f799c6b272a48654dff8cbbb7df7fe8fbb05bc22
2017-02-03 17:49:38 +01:00
Maja Frydrychowicz
a0e09e3402 Bug 1337133 - Add number check to assert.js; r=ato+446296
MozReview-Commit-ID: 9BVna5jO49b

--HG--
extra : rebase_source : d3f0342adaaa872496bc6eb16ce40fb990311aab
2017-02-20 10:38:05 -05:00
Andreas Tolfsen
69d406c698 Bug 1336214 - Preserve stacktraces in Marionette errors; r=maja_zf
Since bug 1326534 we have discarded the original stacktrace from errors
originating inside Marionette.  This was due to faulty logic when
attempting to generate a new stacktrace when it was missing from a
propagated error.

This change simplifies WebDriver errors by making use of Error
inheritance.  The WebDriver error specific functions error.toJson and
error.fromJson has additionally been moved to WebDriverError.

MozReview-Commit-ID: C3Ns0H01LyG

--HG--
extra : rebase_source : 0c705054dae8c0647500bb90e9b970cc57e712c4
2017-02-10 18:36:52 +00:00
Sebastian Hengst
94a3198643 Backed out changeset deb5b08545fd (bug 1322383) for frequently failing to find windows in wpt tests on Windows. r=backout
--HG--
rename : testing/marionette/harness/marionette_harness/tests/unit/test_window_type_chrome.py => testing/marionette/harness/marionette_harness/tests/unit/test_window_type.py
2017-02-09 18:13:02 +01:00
Henrik Skupin
f681f14f4f Bug 1322383 - Add missing checks for valid window r=ato
MozReview-Commit-ID: Ad67SPx8vBx

--HG--
rename : testing/marionette/harness/marionette_harness/tests/unit/test_window_type.py => testing/marionette/harness/marionette_harness/tests/unit/test_window_type_chrome.py
extra : rebase_source : 16bcd69d1906d8f2a544fd441cac2ff59634a5a1
2017-02-03 17:49:38 +01:00
Andreas Tolfsen
73f85ac684 Bug 1336124 - Add assert.session for checking if session is active; r=maja_zf
MozReview-Commit-ID: CmHFag2q1V2

--HG--
extra : rebase_source : 526e01466ce4a00a091dd88cb060d166c6ac4245
2017-02-02 16:09:14 +00:00
Maja Frydrychowicz
259f6b6eda Bug 1328726 - Style fix ups in Marionette key actions implementation; r=ato
These are leftover from review of Bug 1320389. I must have forgotten to
re-push to MozReview.

MozReview-Commit-ID: ENTFdmCsv6I

--HG--
extra : rebase_source : 3c6961fb1826cb7cc00d1bd6048ed2c94c9a2f1a
2017-01-04 17:48:11 -05:00
Wes Kocher
abd222ddc9 Backed out 8 changesets (bug 1328726) for webdriver bustage a=backout CLOSED TREE
Backed out changeset 1039c2ca90ee (bug 1328726)
Backed out changeset de5830f1b8ab (bug 1328726)
Backed out changeset c039479ce446 (bug 1328726)
Backed out changeset 6d9673eedd91 (bug 1328726)
Backed out changeset be79eb6f9d64 (bug 1328726)
Backed out changeset 6be0203f1a26 (bug 1328726)
Backed out changeset 4430151d0cb4 (bug 1328726)
Backed out changeset 2143f1aa8087 (bug 1328726)

MozReview-Commit-ID: GrWBTO2rhXm
2017-01-25 10:51:08 -08:00
Maja Frydrychowicz
a09882ecfa Bug 1328726 - Style fix ups in Marionette key actions implementation; r=ato
These are leftover from review of Bug 1320389. I must have forgotten to
re-push to MozReview.

MozReview-Commit-ID: ENTFdmCsv6I

--HG--
extra : rebase_source : 3c6961fb1826cb7cc00d1bd6048ed2c94c9a2f1a
2017-01-04 17:48:11 -05:00
Wes Kocher
26b0e2ee32 Backed out 7 changesets (bug 1328726) for lint failures a=backout
Backed out changeset 93218dc2249f (bug 1328726)
Backed out changeset 0e6e8d3fccec (bug 1328726)
Backed out changeset 5606cc9b0654 (bug 1328726)
Backed out changeset 40fceb2644d7 (bug 1328726)
Backed out changeset 0c10680f0705 (bug 1328726)
Backed out changeset a2520d52c7cc (bug 1328726)
Backed out changeset ec1a2cd38ffe (bug 1328726)

MozReview-Commit-ID: KnktbcccJoR
2017-01-24 13:55:07 -08:00
Maja Frydrychowicz
fea0cb5625 Bug 1328726 - Style fix ups in Marionette key actions implementation; r=ato
These are leftover from review of Bug 1320389. I must have forgotten to
re-push to MozReview.

MozReview-Commit-ID: ENTFdmCsv6I

--HG--
extra : rebase_source : 3c6961fb1826cb7cc00d1bd6048ed2c94c9a2f1a
2017-01-04 17:48:11 -05:00
Andreas Tolfsen
52426eb1ab Bug 1326534 - Add assert.in for own properties; r=automatedtester
The implementation of the new library function `assert.in` is analogous
to Python's `unittest.TestCase.assertIn`.

MozReview-Commit-ID: 1pjS9ttPXgo

--HG--
extra : rebase_source : 3f4121226d65f127fdf0c990915483659f3a7f93
2016-12-30 11:39:22 +00:00