[Webkit-unassigned] [Bug 139449] Web Inspector: Scope details sidebar should label objects with constructor names

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Feb 14 00:33:08 PST 2015


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

Joseph Pecoraro <joepeck at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|webkit-unassigned at lists.web |joepeck at webkit.org
                   |kit.org                     |

--- Comment #3 from Joseph Pecoraro <joepeck at webkit.org> ---
Sam pointed me in the right direction: Structure::toStructureShape is doing the same constructor function look up we were doing in JSC, but better.

PassRefPtr<StructureShape> Structure::toStructureShape(JSValue value)
{
    ...
        bool foundCtorName = false;
        if (JSObject* profilingVal = curValue.getObject()) {
            ExecState* exec = profilingVal->globalObject()->globalExec();
            PropertySlot slot(storedPrototype());
            PropertyName constructor(exec->propertyNames().constructor);
            if (profilingVal->getPropertySlot(exec, constructor, slot)) {
                if (slot.isValue()) {
                    JSValue constructorValue = slot.getValue(exec, constructor);
                    if (constructorValue.isCell()) {
                        if (JSCell* constructorCell = constructorValue.asCell()) {
                            if (JSObject* ctorObject = constructorCell->getObject()) {
                                if (JSFunction* constructorFunction = jsDynamicCast<JSFunction*>(ctorObject)) {
                                    curShape->setConstructorName(constructorFunction->calculatedDisplayName(exec));
                                    foundCtorName = true;
                                } else if (InternalFunction* constructorFunction = jsDynamicCast<InternalFunction*>(ctorObject)) {
                                    curShape->setConstructorName(constructorFunction->calculatedDisplayName(exec));
                                    foundCtorName = true;
                                }
                            }
                        }
                    }
                }
            }
        }

        if (!foundCtorName)
            curShape->setConstructorName(curStructure->classInfo()->className);
    ...
}

This looks like something we can just plug into:

    JSValue JSInjectedScriptHost::internalConstructorName(ExecState* exec)

I'll give it a shot!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150214/39ceb0ea/attachment-0002.html>


More information about the webkit-unassigned mailing list