Bug 19874 - Inspector should support inspect() in the command line
Summary: Inspector should support inspect() in the command line
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 14355
  Show dependency treegraph
 
Reported: 2008-07-03 06:47 PDT by Keishi Hattori
Modified: 2009-07-28 21:55 PDT (History)
4 users (show)

See Also:


Attachments
Patch (4.16 KB, patch)
2009-07-19 05:14 PDT, Keishi Hattori
no flags Details | Formatted Diff | Diff
Fixed misleading method name (4.16 KB, patch)
2009-07-19 05:17 PDT, Keishi Hattori
no flags Details | Formatted Diff | Diff
used workaround for DOMStorage (4.21 KB, patch)
2009-07-19 08:48 PDT, Keishi Hattori
timothy: review+
Details | Formatted Diff | Diff
Extra Printout, Can this be removed? (123.15 KB, image/png)
2009-07-19 14:39 PDT, Joseph Pecoraro
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Keishi Hattori 2008-07-03 06:47:34 PDT
Inspector should support inspect() in the command line for Firebug parity.
Comment 1 Adam Roben (:aroben) 2008-07-11 14:07:53 PDT
<rdar://problem/6070225>
Comment 2 Keishi Hattori 2009-07-19 05:14:12 PDT
Created attachment 33039 [details]
Patch

inspect(document.body) jumps to the Elements panel and selects the node in the dom tree
inspect(db) jumps to the Databases panel and selects the database
inspect(window.localStorage) jumps to the Databases panel and selects the domStorage

For other objects, like inspect("foo"), there is no appropriate panel so it fallsback to console.log
Firebug shows "foo" in the DOM tab.

inspect() with no arguments is ignored.
Firebug shows window in the DOM tab.
Is that better?
Comment 3 Keishi Hattori 2009-07-19 05:17:59 PDT
Created attachment 33040 [details]
Fixed misleading method name
Comment 4 Keishi Hattori 2009-07-19 08:48:59 PDT
Created attachment 33047 [details]
used workaround for DOMStorage

JoePeck advised me to use a workaround for DOMStorage
Comment 5 Joseph Pecoraro 2009-07-19 14:33:08 PDT
> JoePeck advised me to use a workaround for DOMStorage

Yes, this is the same approach I took in the (unreviewed) Live Update DOM Storage Data Grid.  If there is a better way, please comment on that bug as well:
https://bugs.webkit.org/show_bug.cgi?id=27400

The problem is that this doesn't work properly:

  inspectedWindow.localStorage === this._domStorage[0]._domStorage

Even though they are in fact the same Storage objects, that equivalence test (and also ==) wasn't working for me.
Comment 6 Joseph Pecoraro 2009-07-19 14:39:14 PDT
Created attachment 33057 [details]
Extra Printout, Can this be removed?

There is an extra printout in the Console which is always "undefined".  This is the print out of the return value of the inspect() function.  Can this printout be removed?

I tried just adding "return o" at the end of the inspectObject function, but the console logs are different then the direct "inspectedWindow.console.log(o)".  Any other ideas?
Comment 7 Joseph Pecoraro 2009-07-19 19:34:51 PDT
Ahh, this extra printout happens on clear() as well. So it is a problem with both of the functions that are added onto _inspectorCommandLineAPI.  So I guess that is an unrelated problem.
Comment 8 Keishi Hattori 2009-07-19 20:55:50 PDT
(In reply to comment #6)
> Created an attachment (id=33057) [details]
>
> There is an extra printout in the Console which is always "undefined".  This is
> the print out of the return value of the inspect() function.  Can this printout
> be removed?

Firebug doesn't print the return value when it's undefined. We discussed it here
https://bugs.webkit.org/show_bug.cgi?id=19932
I think we decided to keep it at least for now.

> I tried just adding "return o" at the end of the inspectObject function, but
> the console logs are different then the direct
> "inspectedWindow.console.log(o)".  Any other ideas?

This is another bug I've encountered before. It's blocking 
https://bugs.webkit.org/show_bug.cgi?id=17907

I've taken a look inside
JSValue JSQuarantinedObjectWrapper::call(ExecState* exec, JSObject* function, JSValue thisValue, const ArgList& args)

It wraps the unwrapped return value with JSInspectedObjectWrapper::wrapOutgoingValue but that's causing this.

If you change it to return the unwrappedResult, it will work as expected. But I don't think this is OK because I suspect the return value should be wrapped for security.
Comment 9 Timothy Hatcher 2009-07-28 20:45:35 PDT
Can you file bugs about InspectorController.wrapCallback wrapping return results wrong?
Comment 10 Timothy Hatcher 2009-07-28 21:55:47 PDT
http://trac.webkit.org/changeset/46517