Bug 50063 - [v8] Web Inspector: display name of an object constructor as the object's type
Summary: [v8] Web Inspector: display name of an object constructor as the object's type
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Yury Semikhatsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-25 03:33 PST by Yury Semikhatsky
Modified: 2010-11-29 08:05 PST (History)
14 users (show)

See Also:


Attachments
Patch (11.55 KB, patch)
2010-11-25 06:41 PST, Yury Semikhatsky
no flags Details | Formatted Diff | Diff
Patch (11.55 KB, patch)
2010-11-25 06:50 PST, Yury Semikhatsky
no flags Details | Formatted Diff | Diff
Patch (11.60 KB, patch)
2010-11-25 08:01 PST, Yury Semikhatsky
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yury Semikhatsky 2010-11-25 03:33:48 PST
Chrome's web inspector shows somewhat misleading "representation" of an object. Run this in web inspector's console:

function Parent(){} 
function Child(){} 
Child.prototype = new Parent;
new Child; // displayed as "Parent", instead of expected "Child"

It looks like object representation is the result of evaluating non-standard "name" property of object's constructor (or something similar to that). Once `Child.prototype.constructor` is set to reference `Child`, object is represented as "Child".

Would it be possible to change this behavior, so that `new Child` is represented as "Child" without setting `Child.prototype.constructor` to `Child`? (the latter is not always possible when working with 3rd party code)

Original Chromium bug: http://code.google.com/p/chromium/issues/detail?id=63383
Comment 1 Yury Semikhatsky 2010-11-25 06:41:27 PST
Created attachment 74869 [details]
Patch
Comment 2 anton muhin 2010-11-25 06:43:48 PST
Comment on attachment 74869 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=74869&action=review

> WebCore/inspector/front-end/InjectedScript.js:432
> +                // In Chromium DOM wrapper prototypes will have Object as their construcor name,

nit: construc[t]or
Comment 3 Yury Semikhatsky 2010-11-25 06:50:55 PST
Created attachment 74871 [details]
Patch
Comment 4 Yury Semikhatsky 2010-11-25 07:02:43 PST
(In reply to comment #2)
> (From update of attachment 74869 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=74869&action=review
> 
> > WebCore/inspector/front-end/InjectedScript.js:432
> > +                // In Chromium DOM wrapper prototypes will have Object as their construcor name,
> 
> nit: construc[t]or

Fixed.
Comment 5 Pavel Feldman 2010-11-25 07:08:54 PST
Comment on attachment 74871 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=74871&action=review

Please do renaming prior to landing.

> WebCore/inspector/InjectedScriptHost.idl:41
> +        [Custom] DOMObject constructorName(in DOMObject object);

internalConstructorName?

> WebCore/inspector/front-end/InjectedScript.js:431
> +            if (result === "Object") {

If constructorName is Object, then we use constructor name?
Comment 6 Eric Seidel (no email) 2010-11-25 07:26:29 PST
Attachment 74871 [details] did not build on chromium:
Build output: http://queues.webkit.org/results/6391041
Comment 7 Yury Semikhatsky 2010-11-25 08:01:07 PST
Created attachment 74879 [details]
Patch
Comment 8 Yury Semikhatsky 2010-11-25 08:02:16 PST
(In reply to comment #5)
> (From update of attachment 74871 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=74871&action=review
> 
> Please do renaming prior to landing.
> 
> > WebCore/inspector/InjectedScriptHost.idl:41
> > +        [Custom] DOMObject constructorName(in DOMObject object);
> 
> internalConstructorName?
> 
Done.
Comment 9 Eric Seidel (no email) 2010-11-25 09:05:16 PST
Attachment 74879 [details] did not build on chromium:
Build output: http://queues.webkit.org/results/6314046
Comment 10 WebKit Review Bot 2010-11-28 14:18:34 PST
Attachment 74879 [details] did not build on chromium:
Build output: http://queues.webkit.org/results/6410092
Comment 11 Yury Semikhatsky 2010-11-29 08:05:54 PST
Committed r72800