Closed Bug 819670 Opened 12 years ago Closed 12 years ago

Web console object inspection does not handle native getters throwing very well

Categories

(DevTools :: Console, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(2 files)

Steps to reproduce:

1)  Open web console
2)  Type "document.__proto__"
3)  Click the resulting object to inspect it.

EXPECTED RESULTS: Inspection window comes up

ACTUAL RESULTS: No inspection window, and error console has:

  Timestamp: 12/8/12 10:50:11 AM
  Error: TypeError: Value does not implement interface Node.
  Source File: chrome://global/content/devtools/dbg-server.js
  Line: 641
  Timestamp: 12/8/12 10:50:11 AM
  Error: TypeError: Value does not implement interface Node.
  Source File: chrome://global/content/devtools/dbg-server.js
  Line: 641

This is because the proto chain has getter properties that will throw when called on a non-instance object.

Patch coming up to fix this.
Blocks: 819624
Note that once bug 819624 lands this will be somewhat tested because there will be properties that throw on a chrome HTMLDocument (e.g. .domain).
Attachment #690101 - Flags: review?(mihai.sucan)
Comment on attachment 690101 [details] [diff] [review]
Make the console utils handle getters throwing by just reporting the property as having a getter, since the value can't be gotten.

Thank you for the patch! We should have a test as well. I can add one next week, if you're busy.
Attachment #690101 - Flags: review?(mihai.sucan) → review+
It's not so much being busy as having no idea how to add one.  So if you're willing to, that would be great!  Though note what I said in comment 1 about this being tested at least a bit by the existing tests once bug 819624 lands (which might admittedly not be too soon).
Attached patch fix + testSplinter Review
Added a test which checks if inspection fails for document.__proto__. Please let me know if this is sufficient. Thanks!
Attachment #690427 - Flags: review?(bzbarsky)
Comment on attachment 690427 [details] [diff] [review]
fix + test

Assuming the test fails without the patch, r=me
Attachment #690427 - Flags: review?(bzbarsky) → review+
(In reply to Boris Zbarsky (:bz) from comment #5)
> Comment on attachment 690427 [details] [diff] [review]
> fix + test
> 
> Assuming the test fails without the patch, r=me

It does. Thanks!
Status: NEW → ASSIGNED
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: [need review] → [fixed-in-fx-team]
Version: unspecified → Trunk
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: