Closed Bug 1215502 Opened 4 years ago Closed 4 years ago

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

Categories

(Testing :: Marionette, defect)

defect
Not set

Tracking

(firefox45 fixed, firefox46 fixed)

VERIFIED FIXED
mozilla46
Tracking Status
firefox45 --- fixed
firefox46 --- fixed

People

(Reporter: whimboo, Assigned: ato)

References

Details

(Keywords: pi-marionette-server)

Attachments

(2 files)

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
The error.toJSON function has since been removed.  Does this still reproduce?
Flags: needinfo?(hskupin)
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)
Blocks: 1202576
No longer blocks: 1202576
Flags: needinfo?(hskupin)
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)
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/
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/
Attachment #8705146 - Flags: review?(dburns)
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
Thanks for the quick fix Andreas! I wonder if a unit test would also be good to have here.
https://hg.mozilla.org/mozilla-central/rev/26a9634f6ec2
https://hg.mozilla.org/mozilla-central/rev/a9da976060a8
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
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
Flags: needinfo?(dburns)
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.