Changeset 120769 in webkit


Ignore:
Timestamp:
Jun 19, 2012 4:21:03 PM (12 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: Extract InjectedScriptBase class from the InjectedScript
https://bugs.webkit.org/show_bug.cgi?id=89107

Extract methods from the InjectedScript that do not depend on
the concrete InjectedScriptSource.js implementation.

Patch by Andrey Adaikin <aandrey@chromium.org> on 2012-06-19
Reviewed by Pavel Feldman.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • inspector/InjectedScript.cpp:

(WebCore::InjectedScript::InjectedScript):
(WebCore::InjectedScript::evaluate):
(WebCore::InjectedScript::callFunctionOn):
(WebCore::InjectedScript::evaluateOnCallFrame):
(WebCore::InjectedScript::getFunctionDetails):
(WebCore::InjectedScript::getProperties):
(WebCore::InjectedScript::nodeForObjectId):
(WebCore::InjectedScript::releaseObject):
(WebCore::InjectedScript::wrapCallFrames):
(WebCore::InjectedScript::wrapObject):
(WebCore::InjectedScript::wrapSerializedObject):
(WebCore::InjectedScript::findObjectById):
(WebCore::InjectedScript::inspectNode):
(WebCore::InjectedScript::releaseObjectGroup):
(WebCore::InjectedScript::nodeAsScriptValue):

  • inspector/InjectedScript.h:

(WebCore):
(InjectedScript):

  • inspector/InjectedScriptBase.cpp: Added.

(WebCore):
(WebCore::InjectedScriptBase::InjectedScriptBase):
(WebCore::InjectedScriptBase::canAccessInspectedWindow):
(WebCore::InjectedScriptBase::injectedScriptObject):
(WebCore::InjectedScriptBase::callFunctionWithEvalEnabled):
(WebCore::InjectedScriptBase::makeCall):
(WebCore::InjectedScriptBase::makeEvalCall):

  • inspector/InjectedScriptBase.h: Copied from Source/WebCore/bindings/js/ScriptObject.h.

(WebCore):
(InjectedScriptBase):
(WebCore::InjectedScriptBase::~InjectedScriptBase):
(WebCore::InjectedScriptBase::hasNoValue):
(WebCore::InjectedScriptBase::scriptState):

  • inspector/InspectorAllInOne.cpp:
Location:
trunk/Source/WebCore
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r120757 r120769  
    932932    inspector/IdentifiersFactory.cpp
    933933    inspector/InjectedScript.cpp
     934    inspector/InjectedScriptBase.cpp
    934935    inspector/InjectedScriptHost.cpp
    935936    inspector/InjectedScriptManager.cpp
  • trunk/Source/WebCore/ChangeLog

    r120765 r120769  
     12012-06-19  Andrey Adaikin  <aandrey@chromium.org>
     2
     3        Web Inspector: Extract InjectedScriptBase class from the InjectedScript
     4        https://bugs.webkit.org/show_bug.cgi?id=89107
     5
     6        Extract methods from the InjectedScript that do not depend on
     7        the concrete InjectedScriptSource.js implementation.
     8
     9        Reviewed by Pavel Feldman.
     10
     11        * CMakeLists.txt:
     12        * GNUmakefile.list.am:
     13        * Target.pri:
     14        * WebCore.gypi:
     15        * WebCore.vcproj/WebCore.vcproj:
     16        * WebCore.xcodeproj/project.pbxproj:
     17        * inspector/InjectedScript.cpp:
     18        (WebCore::InjectedScript::InjectedScript):
     19        (WebCore::InjectedScript::evaluate):
     20        (WebCore::InjectedScript::callFunctionOn):
     21        (WebCore::InjectedScript::evaluateOnCallFrame):
     22        (WebCore::InjectedScript::getFunctionDetails):
     23        (WebCore::InjectedScript::getProperties):
     24        (WebCore::InjectedScript::nodeForObjectId):
     25        (WebCore::InjectedScript::releaseObject):
     26        (WebCore::InjectedScript::wrapCallFrames):
     27        (WebCore::InjectedScript::wrapObject):
     28        (WebCore::InjectedScript::wrapSerializedObject):
     29        (WebCore::InjectedScript::findObjectById):
     30        (WebCore::InjectedScript::inspectNode):
     31        (WebCore::InjectedScript::releaseObjectGroup):
     32        (WebCore::InjectedScript::nodeAsScriptValue):
     33        * inspector/InjectedScript.h:
     34        (WebCore):
     35        (InjectedScript):
     36        * inspector/InjectedScriptBase.cpp: Added.
     37        (WebCore):
     38        (WebCore::InjectedScriptBase::InjectedScriptBase):
     39        (WebCore::InjectedScriptBase::canAccessInspectedWindow):
     40        (WebCore::InjectedScriptBase::injectedScriptObject):
     41        (WebCore::InjectedScriptBase::callFunctionWithEvalEnabled):
     42        (WebCore::InjectedScriptBase::makeCall):
     43        (WebCore::InjectedScriptBase::makeEvalCall):
     44        * inspector/InjectedScriptBase.h: Copied from Source/WebCore/bindings/js/ScriptObject.h.
     45        (WebCore):
     46        (InjectedScriptBase):
     47        (WebCore::InjectedScriptBase::~InjectedScriptBase):
     48        (WebCore::InjectedScriptBase::hasNoValue):
     49        (WebCore::InjectedScriptBase::scriptState):
     50        * inspector/InspectorAllInOne.cpp:
     51
    1522012-06-19  Sheriff Bot  <webkit.review.bot@gmail.com>
    253
  • trunk/Source/WebCore/GNUmakefile.list.am

    r120757 r120769  
    26562656        Source/WebCore/inspector/InjectedScript.cpp \
    26572657        Source/WebCore/inspector/InjectedScript.h \
     2658        Source/WebCore/inspector/InjectedScriptBase.cpp \
     2659        Source/WebCore/inspector/InjectedScriptBase.h \
    26582660        Source/WebCore/inspector/InjectedScriptHost.cpp \
    26592661        Source/WebCore/inspector/InjectedScriptHost.h \
  • trunk/Source/WebCore/Target.pri

    r120757 r120769  
    892892    inspector/IdentifiersFactory.cpp \
    893893    inspector/InjectedScript.cpp \
     894    inspector/InjectedScriptBase.cpp \
    894895    inspector/InjectedScriptHost.cpp \
    895896    inspector/InjectedScriptManager.cpp \
     
    20392040    inspector/IdentifiersFactory.h \
    20402041    inspector/InjectedScript.h \
     2042    inspector/InjectedScriptBase.h \
    20412043    inspector/InjectedScriptHost.h \
    20422044    inspector/InjectedScriptManager.h \
  • trunk/Source/WebCore/WebCore.gypi

    r120757 r120769  
    27662766            'inspector/InjectedScript.cpp',
    27672767            'inspector/InjectedScript.h',
     2768            'inspector/InjectedScriptBase.cpp',
     2769            'inspector/InjectedScriptBase.h',
    27682770            'inspector/InjectedScriptHost.cpp',
    27692771            'inspector/InjectedScriptHost.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r120757 r120769  
    7334073340                        </File>
    7334173341                        <File
     73342                                RelativePath="..\inspector\InjectedScriptBase.cpp"
     73343                                >
     73344                                <FileConfiguration
     73345                                        Name="Release|Win32"
     73346                                        ExcludedFromBuild="true"
     73347                                        >
     73348                                        <Tool
     73349                                                Name="VCCLCompilerTool"
     73350                                        />
     73351                                </FileConfiguration>
     73352                                <FileConfiguration
     73353                                        Name="Production|Win32"
     73354                                        ExcludedFromBuild="true"
     73355                                        >
     73356                                        <Tool
     73357                                                Name="VCCLCompilerTool"
     73358                                        />
     73359                                </FileConfiguration>
     73360                        </File>
     73361                        <File
     73362                                RelativePath="..\inspector\InjectedScriptBase.h"
     73363                                >
     73364                        </File>
     73365                        <File
    7334273366                                RelativePath="..\inspector\InjectedScriptHost.cpp"
    7334373367                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r120757 r120769  
    44664466                AA4C3A760B2B1679002334A2 /* StyleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA4C3A740B2B1679002334A2 /* StyleElement.cpp */; };
    44674467                AA4C3A770B2B1679002334A2 /* StyleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = AA4C3A750B2B1679002334A2 /* StyleElement.h */; };
     4468                AAB6054E15874C58007B5031 /* InjectedScriptBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAB6054A15874C58007B5031 /* InjectedScriptBase.cpp */; };
     4469                AAB6054F15874C58007B5031 /* InjectedScriptBase.h in Headers */ = {isa = PBXBuildFile; fileRef = AAB6054B15874C58007B5031 /* InjectedScriptBase.h */; };
    44684470                AAD766EB157E502F00E85423 /* InspectorWebGLAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAD766E8157E502F00E85423 /* InspectorWebGLAgent.cpp */; };
    44694471                AAD766EC157E502F00E85423 /* InspectorWebGLAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = AAD766E9157E502F00E85423 /* InspectorWebGLAgent.h */; };
     
    1147711479                AA9030FE157E16A000276247 /* InjectedWebGLScriptSource.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = InjectedWebGLScriptSource.js; sourceTree = "<group>"; };
    1147811480                AA912750157E35A500454E54 /* InjectedWebGLScriptSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedWebGLScriptSource.h; sourceTree = "<group>"; };
     11481                AAB6054A15874C58007B5031 /* InjectedScriptBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScriptBase.cpp; sourceTree = "<group>"; };
     11482                AAB6054B15874C58007B5031 /* InjectedScriptBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScriptBase.h; sourceTree = "<group>"; };
    1147911483                AAD766E8157E502F00E85423 /* InspectorWebGLAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorWebGLAgent.cpp; sourceTree = "<group>"; };
    1148011484                AAD766E9157E502F00E85423 /* InspectorWebGLAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorWebGLAgent.h; sourceTree = "<group>"; };
     
    1440614410                                F3644AFD1119805900E0D537 /* InjectedScript.cpp */,
    1440714411                                F3644AFE1119805900E0D537 /* InjectedScript.h */,
     14412                                AAB6054A15874C58007B5031 /* InjectedScriptBase.cpp */,
     14413                                AAB6054B15874C58007B5031 /* InjectedScriptBase.h */,
    1440814414                                7A0E76F610BF08ED00A0276E /* InjectedScriptHost.cpp */,
    1440914415                                7A0E76F710BF08ED00A0276E /* InjectedScriptHost.h */,
     
    2332423330                                DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */,
    2332523331                                F3644B001119805900E0D537 /* InjectedScript.h in Headers */,
     23332                                AAB6054F15874C58007B5031 /* InjectedScriptBase.h in Headers */,
    2332623333                                7A0E76FA10BF08ED00A0276E /* InjectedScriptHost.h in Headers */,
    2332723334                                F316396C1329481A00A649CB /* InjectedScriptManager.h in Headers */,
     
    2646226469                                DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */,
    2646326470                                F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */,
     26471                                AAB6054E15874C58007B5031 /* InjectedScriptBase.cpp in Sources */,
    2646426472                                7A0E76F910BF08ED00A0276E /* InjectedScriptHost.cpp in Sources */,
    2646526473                                F316396B1329481A00A649CB /* InjectedScriptManager.cpp in Sources */,
  • trunk/Source/WebCore/inspector/InjectedScript.cpp

    r120709 r120769  
    11/*
    2  * Copyright (C) 2010, 2011 Google Inc. All rights reserved.
     2 * Copyright (C) 2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3535#include "InjectedScript.h"
    3636
    37 #include "DOMWindow.h"
    38 #include "Frame.h"
    3937#include "InjectedScriptHost.h"
    40 #include "InjectedScriptManager.h"
    41 #include "InspectorInstrumentation.h"
    4238#include "InspectorValues.h"
    4339#include "Node.h"
    4440#include "PlatformString.h"
    4541#include "ScriptFunctionCall.h"
     42#include "SerializedScriptValue.h"
    4643
    4744using WebCore::TypeBuilder::Array;
     
    5451
    5552InjectedScript::InjectedScript()
    56     : m_inspectedStateAccessCheck(0)
    5753{
    5854}
    5955
    6056InjectedScript::InjectedScript(ScriptObject injectedScriptObject, InspectedStateAccessCheck accessCheck)
    61     : m_injectedScriptObject(injectedScriptObject)
    62     , m_inspectedStateAccessCheck(accessCheck)
     57    : InjectedScriptBase(injectedScriptObject, accessCheck)
    6358{
    6459}
     
    6661void InjectedScript::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown)
    6762{
    68     ScriptFunctionCall function(m_injectedScriptObject, "evaluate");
     63    ScriptFunctionCall function(injectedScriptObject(), "evaluate");
    6964    function.appendArgument(expression);
    7065    function.appendArgument(objectGroup);
     
    7671void InjectedScript::callFunctionOn(ErrorString* errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown)
    7772{
    78     ScriptFunctionCall function(m_injectedScriptObject, "callFunctionOn");
     73    ScriptFunctionCall function(injectedScriptObject(), "callFunctionOn");
    7974    function.appendArgument(objectId);
    8075    function.appendArgument(expression);
     
    8681void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, RefPtr<RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown)
    8782{
    88     ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnCallFrame");
     83    ScriptFunctionCall function(injectedScriptObject(), "evaluateOnCallFrame");
    8984    function.appendArgument(callFrames);
    9085    function.appendArgument(callFrameId);
     
    9893void InjectedScript::restartFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, RefPtr<InspectorObject>* result)
    9994{
    100     ScriptFunctionCall function(m_injectedScriptObject, "restartFrame");
     95    ScriptFunctionCall function(injectedScriptObject(), "restartFrame");
    10196    function.appendArgument(callFrames);
    10297    function.appendArgument(callFrameId);
     
    118113void InjectedScript::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<FunctionDetails>* result)
    119114{
    120     ScriptFunctionCall function(m_injectedScriptObject, "getFunctionDetails");
     115    ScriptFunctionCall function(injectedScriptObject(), "getFunctionDetails");
    121116    function.appendArgument(functionId);
    122117    RefPtr<InspectorValue> resultValue;
     
    132127void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ownProperties, RefPtr<Array<PropertyDescriptor> >* properties)
    133128{
    134     ScriptFunctionCall function(m_injectedScriptObject, "getProperties");
     129    ScriptFunctionCall function(injectedScriptObject(), "getProperties");
    135130    function.appendArgument(objectId);
    136131    function.appendArgument(ownProperties);
     
    150145        return 0;
    151146
    152     ScriptFunctionCall function(m_injectedScriptObject, "nodeForObjectId");
     147    ScriptFunctionCall function(injectedScriptObject(), "nodeForObjectId");
    153148    function.appendArgument(objectId);
    154149
     
    162157void InjectedScript::releaseObject(const String& objectId)
    163158{
    164     ScriptFunctionCall function(m_injectedScriptObject, "releaseObject");
     159    ScriptFunctionCall function(injectedScriptObject(), "releaseObject");
    165160    function.appendArgument(objectId);
    166161    RefPtr<InspectorValue> result;
     
    172167{
    173168    ASSERT(!hasNoValue());
    174     ScriptFunctionCall function(m_injectedScriptObject, "wrapCallFrames");
     169    ScriptFunctionCall function(injectedScriptObject(), "wrapCallFrames");
    175170    function.appendArgument(callFrames);
    176171    bool hadException = false;
    177172    ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadException);
    178173    ASSERT(!hadException);
    179     RefPtr<InspectorValue> result = callFramesValue.toInspectorValue(m_injectedScriptObject.scriptState());
     174    RefPtr<InspectorValue> result = callFramesValue.toInspectorValue(scriptState());
    180175    if (result->type() == InspectorValue::TypeArray)
    181176        return Array<CallFrame>::runtimeCast(result);
     
    187182{
    188183    ASSERT(!hasNoValue());
    189     ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObject");
     184    ScriptFunctionCall wrapFunction(injectedScriptObject(), "wrapObject");
    190185    wrapFunction.appendArgument(value);
    191186    wrapFunction.appendArgument(groupName);
     
    196191        return 0;
    197192    }
    198     RefPtr<InspectorObject> rawResult = r.toInspectorValue(m_injectedScriptObject.scriptState())->asObject();
     193    RefPtr<InspectorObject> rawResult = r.toInspectorValue(scriptState())->asObject();
    199194    return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult);
    200195}
     
    207202PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapSerializedObject(SerializedScriptValue* serializedScriptValue, const String& groupName) const
    208203{
    209     ScriptValue scriptValue = serializedScriptValue->deserializeForInspector(m_injectedScriptObject.scriptState());
     204    ScriptValue scriptValue = serializedScriptValue->deserializeForInspector(scriptState());
    210205    return scriptValue.hasNoValue() ? 0 : wrapObject(scriptValue, groupName);
    211206}
     
    214209{
    215210    ASSERT(!hasNoValue());
    216     ScriptFunctionCall function(m_injectedScriptObject, "findObjectById");
     211    ScriptFunctionCall function(injectedScriptObject(), "findObjectById");
    217212    function.appendArgument(objectId);
    218213
     
    226221{
    227222    ASSERT(!hasNoValue());
    228     ScriptFunctionCall function(m_injectedScriptObject, "inspectNode");
     223    ScriptFunctionCall function(injectedScriptObject(), "inspectNode");
    229224    function.appendArgument(nodeAsScriptValue(node));
    230225    RefPtr<InspectorValue> result;
     
    235230{
    236231    ASSERT(!hasNoValue());
    237     ScriptFunctionCall releaseFunction(m_injectedScriptObject, "releaseObjectGroup");
     232    ScriptFunctionCall releaseFunction(injectedScriptObject(), "releaseObjectGroup");
    238233    releaseFunction.appendArgument(objectGroup);
    239234    bool hadException = false;
     
    242237}
    243238
    244 bool InjectedScript::canAccessInspectedWindow() const
    245 {
    246     return m_inspectedStateAccessCheck(m_injectedScriptObject.scriptState());
    247 }
    248 
    249 ScriptValue InjectedScript::callFunctionWithEvalEnabled(ScriptFunctionCall& function, bool& hadException) const
    250 {
    251     ScriptExecutionContext* scriptExecutionContext = scriptExecutionContextFromScriptState(m_injectedScriptObject.scriptState());
    252     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willCallFunction(scriptExecutionContext, "InjectedScript", 1);
    253 
    254     ScriptState* scriptState = m_injectedScriptObject.scriptState();
    255     bool evalIsDisabled = false;
    256     if (scriptState) {
    257         evalIsDisabled = !evalEnabled(scriptState);
    258         // Temporarily enable allow evals for inspector.
    259         if (evalIsDisabled)
    260             setEvalEnabled(scriptState, true);
    261     }
    262 
    263     ScriptValue resultValue = function.call(hadException);
    264 
    265     if (evalIsDisabled)
    266         setEvalEnabled(scriptState, false);
    267 
    268     InspectorInstrumentation::didCallFunction(cookie);
    269     return resultValue;
    270 }
    271 
    272 void InjectedScript::makeCall(ScriptFunctionCall& function, RefPtr<InspectorValue>* result)
    273 {
    274     if (hasNoValue() || !canAccessInspectedWindow()) {
    275         *result = InspectorValue::null();
    276         return;
    277     }
    278 
    279     bool hadException = false;
    280     ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException);
    281 
    282     ASSERT(!hadException);
    283     if (!hadException) {
    284         *result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState());
    285         if (!*result)
    286             *result = InspectorString::create(String::format("Object has too long reference chain(must not be longer than %d)", InspectorValue::maxDepth));
    287     } else
    288         *result = InspectorString::create("Exception while making a call.");
    289 }
    290 
    291 void InjectedScript::makeEvalCall(ErrorString* errorString, ScriptFunctionCall& function, RefPtr<TypeBuilder::Runtime::RemoteObject>* objectResult, TypeBuilder::OptOutput<bool>* wasThrown)
    292 {
    293     RefPtr<InspectorValue> result;
    294     makeCall(function, &result);
    295     if (!result) {
    296         *errorString = "Internal error: result value is empty";
    297         return;
    298     }
    299     if (result->type() == InspectorValue::TypeString) {
    300         result->asString(errorString);
    301         return;
    302     }
    303     RefPtr<InspectorObject> resultPair = result->asObject();
    304     if (!resultPair) {
    305         *errorString = "Internal error: result is not an Object";
    306         return;
    307     }
    308     RefPtr<InspectorObject> resultObj = resultPair->getObject("result");
    309     bool wasThrownVal = false;
    310     if (!resultObj || !resultPair->getBoolean("wasThrown", &wasThrownVal)) {
    311         *errorString = "Internal error: result is not a pair of value and wasThrown flag";
    312         return;
    313     }
    314     *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj);
    315     *wasThrown = wasThrownVal;
    316 }
    317 
    318239ScriptValue InjectedScript::nodeAsScriptValue(Node* node)
    319240{
    320     return InjectedScriptHost::nodeAsScriptValue(m_injectedScriptObject.scriptState(), node);
     241    return InjectedScriptHost::nodeAsScriptValue(scriptState(), node);
    321242}
    322243
  • trunk/Source/WebCore/inspector/InjectedScript.h

    r120709 r120769  
    11/*
    2  * Copyright (C) 2010, 2011 Google Inc. All rights reserved.
     2 * Copyright (C) 2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3232#define InjectedScript_h
    3333
     34#include "InjectedScriptBase.h"
    3435#include "InjectedScriptManager.h"
    3536#include "InspectorTypeBuilder.h"
     
    4243namespace WebCore {
    4344
    44 class InspectorArray;
    45 class InspectorObject;
    46 class InspectorValue;
    4745class Node;
    48 class ScriptFunctionCall;
    49 
    50 typedef String ErrorString;
     46class SerializedScriptValue;
    5147
    5248#if ENABLE(INSPECTOR)
    5349
    54 class InjectedScript {
     50class InjectedScript : public InjectedScriptBase {
    5551public:
    5652    InjectedScript();
    5753    ~InjectedScript() { }
    58 
    59     bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
    6054
    6155    void evaluate(ErrorString*,
     
    9993    void inspectNode(Node*);
    10094    void releaseObjectGroup(const String&);
    101     ScriptState* scriptState() const { return m_injectedScriptObject.scriptState(); }
    10295
    10396private:
    10497    friend InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState*);
    105     typedef bool (*InspectedStateAccessCheck)(ScriptState*);
    10698    InjectedScript(ScriptObject, InspectedStateAccessCheck);
    10799
    108     bool canAccessInspectedWindow() const;
    109     ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadException) const;
    110     void makeCall(ScriptFunctionCall&, RefPtr<InspectorValue>* result);
    111     void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
    112100    ScriptValue nodeAsScriptValue(Node*);
    113 
    114     ScriptObject m_injectedScriptObject;
    115     InspectedStateAccessCheck m_inspectedStateAccessCheck;
    116101};
    117102
  • trunk/Source/WebCore/inspector/InspectorAllInOne.cpp

    r119572 r120769  
    3333#include "IdentifiersFactory.cpp"
    3434#include "InjectedScript.cpp"
     35#include "InjectedScriptBase.cpp"
    3536#include "InjectedScriptHost.cpp"
    3637#include "InjectedScriptManager.cpp"
Note: See TracChangeset for help on using the changeset viewer.