Closed Bug 1617657 Opened 4 years ago Closed 4 years ago

Incorrect link in console for "TypeError: x called on an object that does not implement interface y"

Categories

(DevTools :: Console, defect, P3)

73 Branch
defect

Tracking

(firefox76 fixed)

RESOLVED FIXED
Firefox 76
Tracking Status
firefox76 --- fixed

People

(Reporter: airhogs777, Assigned: evilpie)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0

Steps to reproduce:

  1. Run the following in the console: DOMTokenList.prototype.contains.call(['hello'], 'hello')

Actual results:

Got the correct error "TypeError: 'contains' called on an object that does not implement interface DOMTokenList." but the [Learn More] link directed me to the page for "TypeError: "x" is read-only" https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Read-only

Expected results:

The [Learn More] link should direct to a relevant page. I'm not seeing one in the MDN "List of Errors" page (except maybe "TypeError: X.prototype.y called on incompatible type" ??)

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Console
Product: Firefox → DevTools
Priority: -- → P3
See Also: → 1615518

Nicolas, I assume next step here is filing a bug to document MSG_METHOD_THIS_DOES_NOT_IMPLEMENT_INTERFACE. What's needed from the DOM/DevTools side?

Flags: needinfo?(nchevobbe)

So this message is printed because errorMessageName is JSMSG_READ_ONLY which matches https://searchfox.org/mozilla-central/rev/49ed791eec93335abfe6c2880f84c324e73e47e6/devtools/server/actors/errordocs.js#18

What should be done is find which one of the C++ call using JSMSG_READ_ONLY should use something else instead (https://searchfox.org/mozilla-central/search?q=JSMSG_READ_ONLY&case=true&regexp=false&path=)

Flags: needinfo?(nchevobbe)

The error message identifier here is MSG_METHOD_THIS_DOES_NOT_IMPLEMENT_INTERFACE, not JSMSG_READ_ONLY. But those two enum values (from different enums, note!) happen to have the same numeric value. The numeric value of the message is only meaningful if you know which callback function is used to produce the message string, and there are different callback functions for SpiderMonkey and the DOM. That is, the numeric message identifier on its own is not enough to identify the message involved, and devtools should really not be using it for that...

ccing some SpiderMonkey people who have expressed interest in generally making this stuff saner.

Status: UNCONFIRMED → NEW
Ever confirmed: true

What I suspect is happening that when we assign mErrorMsgName in xpc::ErrorReport::init, we always use js::GetErrorMessage to map the error number to the message. But like bz already hinted at, error numbers can be shared with other i.e. mozilla::dom::GetErrorMessage.

I don't think we can actually differentiate between these two at that point.

That's correct...

I suppose one thing we could do in the DOM is add whatever the last JS error value is at the point where we call ReportErrorNumberWhatever and then subtract that off in our dom::GetErrorMessage to index into our array? Are there any other message-getters other than js::GetErrorMessage and dom::GetErrorMessage? Is the "last JS error value" available via jsapi?

I think we should just change JSErrorReport to include the ErrorMsgName and set that in ExpandErrorArgumentsHelper or so.

Blocks: 1620583
Assignee: nobody → evilpies

No test run yet, but manual testing shows the bug is fixed.

Nice! We should then add the DOM names to the stuff console knows about...

Attachment #9131613 - Attachment description: Bug 1617657 - Store errorMessageName in JSErrorReport. → Bug 1617657 - Store errorMessageName in JSErrorReport. r?jorendorff r?mccr8
Attachment #9131613 - Attachment description: Bug 1617657 - Store errorMessageName in JSErrorReport. r?jorendorff r?mccr8 → Bug 1617657 - Store errorMessageName in JSErrorReport. r?jorendorff! r?mccr8!
Attachment #9131613 - Attachment description: Bug 1617657 - Store errorMessageName in JSErrorReport. r?jorendorff! r?mccr8! → Bug 1617657 - Store errorMessageName in JSErrorReport. r?jorendorff!,mccr8!
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/4512dab2fe53
Store errorMessageName in JSErrorReport. r=jorendorff,mccr8
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 76
Blocks: 1622135
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: