JavaScript errors that arise from the Marionette implementation are
currently wrapped as WebDriverErrors. A WebDriverError is encoded with
a "webdriver error" error code, which officially does not exist in the
WebDriver specification.
To distinguish WebDriver errors from programming errors of Marionette,
this changes them to be encoded as UnknownErrors (error code
"unknown error"). This will make stacktraces coming from clients
easier to read, since it is clear that the error is not caught by the
WebDriverError-catchall.
MozReview-Commit-ID: A5HejTOgOp8
--HG--
extra : rebase_source : 7bd4f539954dd11973b2bd16c1bf4f4ea7b4a4d7
This change introduces more data validation checks on unmarshaling
Marionette protocol messages. Specifically, validation of
message.Command's and message.Response's constructor arguments and packet
contents in their respective fromMsg functions are tested.
Doing these tests ensures more safety further down the pipeline with
respect to the data integrity in Marionette commands.
MozReview-Commit-ID: BxYipX5zfo9
--HG--
extra : rebase_source : 5cd9edab8801323b19688f871ba78ccf70a05c5e
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
The `stack` argument to `WebDriverError` has never been in use. Following
the API of the `Error` prototype, this changes its constructor to take
one argument which can either be a string of an `Error`.
When internal errors are thrown in Marionette, they are usually
wrapped in `WebDriverError` but we currently lose track of its stack.
This preserves the wrapped error's stacktrace by setting the `stack`
property. Practice have found that they are very useful to return to
the client, as they are currently only printed to stdout.
MozReview-Commit-ID: 9sTdP4TntIc
--HG--
extra : rebase_source : f14197a1c8700215ce3d0edc7078c9f568b80ec4