[Webkit-unassigned] [Bug 27514] add support for watched expressions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 4 12:21:27 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=27514





--- Comment #9 from Pavel Feldman <pfeldman at chromium.org>  2009-09-04 12:21:27 PDT ---

> +
> +        // WebInspector.ConsoleView._evalInInspectedWindow should be made 'public'
> +        WebInspector.console._evalInInspectedWindow("(" + this.expression + ")", callback);

_evalInInspectedWindow is used in console where we don't know whether we are on
breakpoint or not. If watch expressions are only applicable to the paused
state, you should use ScriptsPanel.prototype.evaluateInSelectedCallFrame or
doEvalInCallFrame (your watch expressions are not supposed to mutate the app
state).

> +
> +        // Note, should provide a better way to get the "description";
> +        // would prefer to just use Object.describe(), but returns
> +        // "Object" for new Date() compared to the proxy which returns
> +        // the date string
> +        
> +        // if a proxy object, get description from there
> +        if (value && value.objectId && value.description)
> +            this.valueElement.textContent = value.description;
> +            
> +        // if not a proxy object, use Object.describe()
> +        else
> +            this.valueElement.textContent = Object.describe(value, true);
> +

Object.describe is not available (will soon be not available) in the frontend.
It is declared in the InjectedScript and should only be applied to the real
objects (not proxies) in the InjectedScript.js. Look at how values
are formatted in ConsoleView's _format method for reverence on how to render
evaluation results instead.

> +    _refreshExpressionPropertiesCallback: function(properties)
> +    {
> +        this.removeChildren();
> +
> +        if (!properties) {
> +            this.hasChildren = false;
> +            return;
> +        }
> +
> +        // WebInspector.ObjectPropertiesSection.prototype._displaySort should be
> +        // moved to something like utilities.js
> +        properties.sort(WebInspector.ObjectPropertiesSection.prototype._displaySort);
> +
> +        for (var i = 0; i < properties.length; ++i) {
> +            this.appendChild(new this.treeOutline.section.treeElementConstructor(properties[i]));
> +        }
> +        this.hasChildren = properties.length > 0;
> +    },
> +

This snippet as well as the InspectorController.getProperties(value, true,
callback) above seems to be a large functionality dupe of what happens in
ObjectPropertiesSection. Why not to use ObjectPropertiesSection explicitly?
It would handle all the bits of rendering and expansion. Doesn't it work for
you?

I now recall that ObjectPropertiesSection can have problems rendering primitive
values that are being returned from the evaluate without being wrapped with
ObjectProxies. But that should be fairly easy to fix in the
InjectedScript.evaluateOn body. It would actually simplify ConsoleView's
formatting as well.
If that is the case, I can fix that in the evaluate code and you would be able
to nuke most of the duplicated code.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list