Ignore:
Timestamp:
Aug 8, 2014, 11:50:19 PM (11 years ago)
Author:
[email protected]
Message:

REGRESSION: Inspector crashes when debugger is paused and injected scripts access window.screen().
<https://webkit.org/b/135656>

Not reviewed.

Rolling out r170680 which was merged to ToT in r172129.

Source/JavaScriptCore:

  • debugger/Debugger.h:
  • debugger/DebuggerCallFrame.cpp:

(JSC::DebuggerCallFrame::scope):
(JSC::DebuggerCallFrame::evaluate):
(JSC::DebuggerCallFrame::invalidate):

  • debugger/DebuggerCallFrame.h:
  • debugger/DebuggerScope.cpp:

(JSC::DebuggerScope::DebuggerScope):
(JSC::DebuggerScope::finishCreation):
(JSC::DebuggerScope::visitChildren):
(JSC::DebuggerScope::className):
(JSC::DebuggerScope::getOwnPropertySlot):
(JSC::DebuggerScope::put):
(JSC::DebuggerScope::deleteProperty):
(JSC::DebuggerScope::getOwnPropertyNames):
(JSC::DebuggerScope::defineOwnProperty):
(JSC::DebuggerScope::next): Deleted.
(JSC::DebuggerScope::invalidateChain): Deleted.
(JSC::DebuggerScope::isWithScope): Deleted.
(JSC::DebuggerScope::isGlobalScope): Deleted.
(JSC::DebuggerScope::isFunctionScope): Deleted.

  • debugger/DebuggerScope.h:

(JSC::DebuggerScope::create):
(JSC::DebuggerScope::Iterator::Iterator): Deleted.
(JSC::DebuggerScope::Iterator::get): Deleted.
(JSC::DebuggerScope::Iterator::operator++): Deleted.
(JSC::DebuggerScope::Iterator::operator==): Deleted.
(JSC::DebuggerScope::Iterator::operator!=): Deleted.
(JSC::DebuggerScope::isValid): Deleted.
(JSC::DebuggerScope::jsScope): Deleted.
(JSC::DebuggerScope::begin): Deleted.
(JSC::DebuggerScope::end): Deleted.

  • inspector/JSJavaScriptCallFrame.cpp:

(Inspector::JSJavaScriptCallFrame::scopeType):
(Inspector::JSJavaScriptCallFrame::scopeChain):

  • inspector/JavaScriptCallFrame.h:

(Inspector::JavaScriptCallFrame::scopeChain):

  • inspector/ScriptDebugServer.cpp:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::reset):
(JSC::JSGlobalObject::visitChildren):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::debuggerScopeStructure): Deleted.

  • runtime/JSObject.h:

(JSC::JSObject::isWithScope): Deleted.

  • runtime/JSScope.h:
  • runtime/VM.cpp:

(JSC::VM::VM):

  • runtime/VM.h:

Source/WebCore:

  • bindings/js/ScriptController.cpp:

(WebCore::ScriptController::attachDebugger):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/debugger/DebuggerScope.cpp

    r172129 r172372  
    2929#include "JSActivation.h"
    3030#include "JSCInlines.h"
    31 #include "JSWithScope.h"
    3231
    3332namespace JSC {
     
    3736const ClassInfo DebuggerScope::s_info = { "DebuggerScope", &Base::s_info, 0, CREATE_METHOD_TABLE(DebuggerScope) };
    3837
    39 DebuggerScope::DebuggerScope(VM& vm, JSScope* scope)
    40     : JSNonFinalObject(vm, scope->globalObject()->debuggerScopeStructure())
     38DebuggerScope::DebuggerScope(VM& vm)
     39    : JSNonFinalObject(vm, vm.debuggerScopeStructure.get())
    4140{
    42     ASSERT(scope);
    43     m_scope.set(vm, this, scope);
    4441}
    4542
    46 void DebuggerScope::finishCreation(VM& vm)
     43void DebuggerScope::finishCreation(VM& vm, JSObject* activation)
    4744{
    4845    Base::finishCreation(vm);
     46    ASSERT(activation);
     47    ASSERT(activation->isActivationObject());
     48    m_activation.set(vm, this, jsCast<JSActivation*>(activation));
    4949}
    5050
     
    5454    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    5555    JSObject::visitChildren(thisObject, visitor);
    56     visitor.append(&thisObject->m_scope);
    57     visitor.append(&thisObject->m_next);
     56    visitor.append(&thisObject->m_activation);
    5857}
    5958
    6059String DebuggerScope::className(const JSObject* object)
    6160{
    62     const DebuggerScope* scope = jsCast<const DebuggerScope*>(object);
    63     ASSERT(scope->isValid());
    64     if (!scope->isValid())
    65         return String();
    66     JSObject* thisObject = JSScope::objectAtScope(scope->jsScope());
    67     return thisObject->methodTable()->className(thisObject);
     61    const DebuggerScope* thisObject = jsCast<const DebuggerScope*>(object);
     62    return thisObject->m_activation->methodTable()->className(thisObject->m_activation.get());
    6863}
    6964
    7065bool DebuggerScope::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
    7166{
    72     DebuggerScope* scope = jsCast<DebuggerScope*>(object);
    73     ASSERT(scope->isValid());
    74     if (!scope->isValid())
    75         return false;
    76     JSObject* thisObject = JSScope::objectAtScope(scope->jsScope());
    77     return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, propertyName, slot);
     67    DebuggerScope* thisObject = jsCast<DebuggerScope*>(object);
     68    return thisObject->m_activation->methodTable()->getOwnPropertySlot(thisObject->m_activation.get(), exec, propertyName, slot);
    7869}
    7970
    8071void DebuggerScope::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
    8172{
    82     DebuggerScope* scope = jsCast<DebuggerScope*>(cell);
    83     ASSERT(scope->isValid());
    84     if (!scope->isValid())
    85         return;
    86     JSObject* thisObject = JSScope::objectAtScope(scope->jsScope());
    87     thisObject->methodTable()->put(thisObject, exec, propertyName, value, slot);
     73    DebuggerScope* thisObject = jsCast<DebuggerScope*>(cell);
     74    thisObject->m_activation->methodTable()->put(thisObject->m_activation.get(), exec, propertyName, value, slot);
    8875}
    8976
    9077bool DebuggerScope::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
    9178{
    92     DebuggerScope* scope = jsCast<DebuggerScope*>(cell);
    93     ASSERT(scope->isValid());
    94     if (!scope->isValid())
    95         return false;
    96     JSObject* thisObject = JSScope::objectAtScope(scope->jsScope());
    97     return thisObject->methodTable()->deleteProperty(thisObject, exec, propertyName);
     79    DebuggerScope* thisObject = jsCast<DebuggerScope*>(cell);
     80    return thisObject->m_activation->methodTable()->deleteProperty(thisObject->m_activation.get(), exec, propertyName);
    9881}
    9982
    10083void DebuggerScope::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
    10184{
    102     DebuggerScope* scope = jsCast<DebuggerScope*>(object);
    103     ASSERT(scope->isValid());
    104     if (!scope->isValid())
    105         return;
    106     JSObject* thisObject = JSScope::objectAtScope(scope->jsScope());
    107     thisObject->methodTable()->getPropertyNames(thisObject, exec, propertyNames, mode);
     85    DebuggerScope* thisObject = jsCast<DebuggerScope*>(object);
     86    thisObject->m_activation->methodTable()->getPropertyNames(thisObject->m_activation.get(), exec, propertyNames, mode);
    10887}
    10988
    11089bool DebuggerScope::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow)
    11190{
    112     DebuggerScope* scope = jsCast<DebuggerScope*>(object);
    113     ASSERT(scope->isValid());
    114     if (!scope->isValid())
    115         return false;
    116     JSObject* thisObject = JSScope::objectAtScope(scope->jsScope());
    117     return thisObject->methodTable()->defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
    118 }
    119 
    120 DebuggerScope* DebuggerScope::next()
    121 {
    122     ASSERT(isValid());
    123     if (!m_next && m_scope->next()) {
    124         VM& vm = *m_scope->vm();
    125         DebuggerScope* nextScope = create(vm, m_scope->next());
    126         m_next.set(vm, this, nextScope);
    127     }
    128     return m_next.get();
    129 }
    130 
    131 void DebuggerScope::invalidateChain()
    132 {
    133     DebuggerScope* scope = this;
    134     while (scope) {
    135         ASSERT(scope->isValid());
    136         DebuggerScope* nextScope = scope->m_next.get();
    137         scope->m_next.clear();
    138         scope->m_scope.clear();
    139         scope = nextScope;
    140     }
    141 }
    142 
    143 bool DebuggerScope::isWithScope() const
    144 {
    145     return m_scope->isWithScope();
    146 }
    147 
    148 bool DebuggerScope::isGlobalScope() const
    149 {
    150     return m_scope->isGlobalObject();
    151 }
    152 
    153 bool DebuggerScope::isFunctionScope() const
    154 {
    155     // In the current debugger implementation, every function will create an
    156     // activation object. Hence, an activation object implies a function scope.
    157     return m_scope->isActivationObject();
     91    DebuggerScope* thisObject = jsCast<DebuggerScope*>(object);
     92    return thisObject->m_activation->methodTable()->defineOwnProperty(thisObject->m_activation.get(), exec, propertyName, descriptor, shouldThrow);
    15893}
    15994
Note: See TracChangeset for help on using the changeset viewer.