TypeError: 'toString' called on an object that does not implement interface Exception

VERIFIED FIXED in Firefox 45

Status

VERIFIED FIXED
3 years ago
3 years ago

People

(Reporter: whimboo, Assigned: ato)

Tracking

({pi-marionette-server})

unspecified
mozilla46
pi-marionette-server
Points:
---

Firefox Tracking Flags

(firefox45 fixed, firefox46 fixed)

Details

MozReview Requests

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(2 attachments)

(Reporter)

Description

3 years ago
I can see this exception when I was investigating a test failure in our Firefox ui tests logged as bug 1215499.

The following output is visible in the Gecko log:

MARIONETTE LOG: INFO: TEST-START: c:\jenkins\workspace\release-mozilla-release_functional\venv\Lib\site-packages\firefox_ui_tests\functional\private_browsing\test_about_private_browsing.py:testCheckAboutPrivateBrowsing
1444997539656 Marionette: Element does not have an accessible object*************************
A coding exception was thrown in a Promise rejection callback.
See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise

Full message: TypeError: 'toString' called on an object that does not implement interface Exception.
Full stack: error.isError@chrome://marionette/content/error.js:104:12
error.isWebDriverError@chrome://marionette/content/error.js:112:10
error.toJSON@chrome://marionette/content/error.js:72:8
Response.prototype.sendError@chrome://marionette/content/command.js:100:16
Handler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:925:21
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:801:7
this.PromiseWalker.scheduleWalkerLoop/<@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:740:39

*************************
Marionette threw an error: TypeError: 'toString' called on an object that does not implement interface Exception.
error.isError@chrome://marionette/content/error.js:104:12
error.isWebDriverError@chrome://marionette/content/error.js:112:10
error.toJSON@chrome://marionette/content/error.js:72:8
Response.prototype.sendError@chrome://marionette/content/command.js:100:16
Handler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:925:21
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:801:7
this.PromiseWalker.scheduleWalkerLoop/<@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:740:39
(Assignee)

Comment 1

3 years ago
The error.toJSON function has since been removed.  Does this still reproduce?
Flags: needinfo?(hskupin)
(Reporter)

Comment 2

3 years ago
Yes, still a problem with a Nightly build from Tuesday:

Full message: TypeError: 'toString' called on an object that does not implement interface Exception.
Full stack: error.isError@chrome://marionette/content/error.js:78:12
error.isWebDriverError@chrome://marionette/content/error.js:86:10
Response.prototype.sendError@chrome://marionette/content/command.js:89:12
Flags: needinfo?(hskupin)
(Assignee)

Updated

3 years ago
Blocks: 1202576
(Assignee)

Updated

3 years ago
No longer blocks: 1202576
Flags: needinfo?(hskupin)
Keywords: ateam-marionette-server
(Assignee)

Comment 3

3 years ago
This is caused by an incomplete test for whether val in error.isError is an XPCOM exception.  The correct check would be to do

    val instanceof Ci.nsIException
Assignee: nobody → ato
Blocks: 1202576
Status: NEW → ASSIGNED
Flags: needinfo?(hskupin)
(Assignee)

Comment 4

3 years ago
Created attachment 8705146 [details]
MozReview Request: Bug 1215502: Perform nsIException instance test for XPCOM exceptions

The current test of the `result' property does not always pass for all
types of XPCOM exceptions.  A safer test is to do an instance check
against Components.interfaces.nsIException.

This fixes hangs such as the one described in bug 1202576.

r=dburns

Review commit: https://reviewboard.mozilla.org/r/29881/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/29881/
(Assignee)

Comment 5

3 years ago
Created attachment 8705147 [details]
MozReview Request: Bug 1215502: Send wrapped WebDriverError to client

This fixes serialisation of XPCOM exceptions to the client.
Response.sendError was incorrectly serialising the err input variable
instead of the wrapped WebDriverError, we.

r=dburns

Review commit: https://reviewboard.mozilla.org/r/29883/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/29883/
(Assignee)

Updated

3 years ago
Attachment #8705146 - Flags: review?(dburns)
(Assignee)

Updated

3 years ago
Attachment #8705147 - Flags: review?(dburns)
Comment on attachment 8705146 [details]
MozReview Request: Bug 1215502: Perform nsIException instance test for XPCOM exceptions

https://reviewboard.mozilla.org/r/29881/#review26687
Attachment #8705146 - Flags: review?(dburns) → review+
Attachment #8705147 - Flags: review?(dburns) → review+
Comment on attachment 8705147 [details]
MozReview Request: Bug 1215502: Send wrapped WebDriverError to client

https://reviewboard.mozilla.org/r/29883/#review26691
(Reporter)

Comment 9

3 years ago
Thanks for the quick fix Andreas! I wonder if a unit test would also be good to have here.

Comment 10

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/26a9634f6ec2
https://hg.mozilla.org/mozilla-central/rev/a9da976060a8
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox46: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
(Reporter)

Updated

3 years ago
Blocks: 1238996
(Reporter)

Comment 11

3 years ago
This looks great! The hang (bug 1202576) is fixed which was caused by this bug.

David, can we please get this backported to the aurora branch to have it included in the next ESR? Thanks.
Status: RESOLVED → VERIFIED
status-firefox45: --- → affected
Flags: needinfo?(dburns)
(Reporter)

Updated

3 years ago
No longer blocks: 1238996
Flags: needinfo?(dburns)
Whiteboard: [checkin-needed-aurora]
Whiteboard: [checkin-needed-aurora]
You need to log in before you can comment on or make changes to this bug.