Ignore:
Timestamp:
Feb 16, 2015, 2:10:12 PM (10 years ago)
Author:
[email protected]
Message:

Web Inspector: Scope details sidebar should label objects with constructor names
https://bugs.webkit.org/show_bug.cgi?id=139449

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2015-02-16
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

  • inspector/JSInjectedScriptHost.cpp:

(Inspector::JSInjectedScriptHost::internalConstructorName):

  • runtime/Structure.cpp:

(JSC::Structure::toStructureShape):
Share calculatedClassName.

  • runtime/JSObject.h:
  • runtime/JSObject.cpp:

(JSC::JSObject::calculatedClassName):
Elaborate on a way to get an Object's class name.

LayoutTests:

  • inspector/model/remote-object-expected.txt:
  • inspector/model/remote-object.html:

Improve the test to include Objects where previously
we would have had poorer class name descriptions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Structure.cpp

    r179429 r180173  
    10601060        }
    10611061
    1062         bool foundCtorName = false;
    1063         if (JSObject* profilingVal = curValue.getObject()) {
    1064             ExecState* exec = profilingVal->globalObject()->globalExec();
    1065             PropertySlot slot(storedPrototype());
    1066             PropertyName constructor(exec->propertyNames().constructor);
    1067             if (profilingVal->getPropertySlot(exec, constructor, slot)) {
    1068                 if (slot.isValue()) {
    1069                     JSValue constructorValue = slot.getValue(exec, constructor);
    1070                     if (constructorValue.isCell()) {
    1071                         if (JSCell* constructorCell = constructorValue.asCell()) {
    1072                             if (JSObject* ctorObject = constructorCell->getObject()) {
    1073                                 if (JSFunction* constructorFunction = jsDynamicCast<JSFunction*>(ctorObject)) {
    1074                                     curShape->setConstructorName(constructorFunction->calculatedDisplayName(exec));
    1075                                     foundCtorName = true;
    1076                                 } else if (InternalFunction* constructorFunction = jsDynamicCast<InternalFunction*>(ctorObject)) {
    1077                                     curShape->setConstructorName(constructorFunction->calculatedDisplayName(exec));
    1078                                     foundCtorName = true;
    1079                                 }
    1080                             }
    1081                         }
    1082                     }
    1083                 }
    1084             }
    1085         }
    1086 
    1087         if (!foundCtorName)
     1062       
     1063        if (JSObject* curObject = curValue.getObject())
     1064            curShape->setConstructorName(JSObject::calculatedClassName(curObject));
     1065        else
    10881066            curShape->setConstructorName(curStructure->classInfo()->className);
    10891067
Note: See TracChangeset for help on using the changeset viewer.