Closed Bug 608358 Opened 10 years ago Closed 10 years ago
inspect() and pprint() console helper functions not working on window object
Not sure if it's on all pages or not. 1. On this page, open the web console (ctrl/cmd-shift-k) 2. in the command line, enter "inspect(window)" expect to see a js object inspector open on the window object. Instead, we get" 16:49:57.772: [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: resource://gre/modules/PropertyPanel.jsm :: namesAndValuesOf :: line 130" data: no]
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b8pre) Gecko/20101029 Firefox/4.0b8pre
same test seems to pass for "inspect(document)".
Summary: inspect() and pprint() console helper functions not working, revisit jsterm unittests → inspect() and pprint() console helper functions not working on window object
workaround: inspect(this) returns an inspector on the window object.
(In reply to comment #3) > workaround: inspect(this) returns an inspector on the window object. Yeah - this is an xrayWrapped *window* that does this. The patch is a one liner that unwraps any object passed into that function "namesAndValuesOf"
yeah, you're right. I just added a little test inside pprint() and it's returning a wrapped window object. Even though running "typeof(window)" on the console returns "object". Trying to understand why this is, I guess object evaluated inside the sandbox are wrapped, but results coming back from it are unwrapped. nifty!
adding in a few unwraps and an unwrap() convenience method.
Assignee: nobody → rcampbell
Status: NEW → ASSIGNED
requesting blocking final so we can get this reviewed and landed.
blocking2.0: --- → ?
Attachment #487168 - Flags: review?(gavin.sharp)
Blocking, seems like a common thing to be inspected.
blocking2.0: ? → final+
Comment on attachment 487168 [details] [diff] [review] [checked-in] unwrap This should be easy to test, right?
Attachment #487168 - Flags: review?(gavin.sharp) → review+
(In reply to comment #9) > Comment on attachment 487168 [details] [diff] [review] > unwrap > > This should be easy to test, right? trivially. I'll add a couple to the JSTerm helper tests.
simple tests for pprint(window) and keys(window)
Comment on attachment 487168 [details] [diff] [review] [checked-in] unwrap http://hg.mozilla.org/mozilla-central/rev/f9966f6545e0
Attachment #487168 - Attachment description: unwrap → [checked-in] unwrap
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.