| Differences between
and this patch
- a/Source/WebCore/ChangeLog +51 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-06-14  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 NOBODY (OOPS!).
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
1
2012-06-19  Abhishek Arya  <inferno@chromium.org>
52
2012-06-19  Abhishek Arya  <inferno@chromium.org>
2
53
3
        Crash in RenderInline::willBeDestroyed.
54
        Crash in RenderInline::willBeDestroyed.
- a/Source/WebCore/CMakeLists.txt +1 lines
Lines 930-935 SET(WebCore_SOURCES a/Source/WebCore/CMakeLists.txt_sec1
930
    inspector/DOMPatchSupport.cpp
930
    inspector/DOMPatchSupport.cpp
931
    inspector/IdentifiersFactory.cpp
931
    inspector/IdentifiersFactory.cpp
932
    inspector/InjectedScript.cpp
932
    inspector/InjectedScript.cpp
933
    inspector/InjectedScriptBase.cpp
933
    inspector/InjectedScriptHost.cpp
934
    inspector/InjectedScriptHost.cpp
934
    inspector/InjectedScriptManager.cpp
935
    inspector/InjectedScriptManager.cpp
935
    inspector/InspectorAgent.cpp
936
    inspector/InspectorAgent.cpp
- a/Source/WebCore/GNUmakefile.list.am +2 lines
Lines 2655-2660 webcore_sources += \ a/Source/WebCore/GNUmakefile.list.am_sec1
2655
	Source/WebCore/inspector/IdentifiersFactory.h \
2655
	Source/WebCore/inspector/IdentifiersFactory.h \
2656
	Source/WebCore/inspector/InjectedScript.cpp \
2656
	Source/WebCore/inspector/InjectedScript.cpp \
2657
	Source/WebCore/inspector/InjectedScript.h \
2657
	Source/WebCore/inspector/InjectedScript.h \
2658
	Source/WebCore/inspector/InjectedScriptBase.cpp \
2659
	Source/WebCore/inspector/InjectedScriptBase.h \
2658
	Source/WebCore/inspector/InjectedScriptHost.cpp \
2660
	Source/WebCore/inspector/InjectedScriptHost.cpp \
2659
	Source/WebCore/inspector/InjectedScriptHost.h \
2661
	Source/WebCore/inspector/InjectedScriptHost.h \
2660
	Source/WebCore/inspector/InjectedScriptManager.cpp \
2662
	Source/WebCore/inspector/InjectedScriptManager.cpp \
- a/Source/WebCore/Target.pri +2 lines
Lines 891-896 SOURCES += \ a/Source/WebCore/Target.pri_sec1
891
    inspector/DOMPatchSupport.cpp \
891
    inspector/DOMPatchSupport.cpp \
892
    inspector/IdentifiersFactory.cpp \
892
    inspector/IdentifiersFactory.cpp \
893
    inspector/InjectedScript.cpp \
893
    inspector/InjectedScript.cpp \
894
    inspector/InjectedScriptBase.cpp \
894
    inspector/InjectedScriptHost.cpp \
895
    inspector/InjectedScriptHost.cpp \
895
    inspector/InjectedScriptManager.cpp \
896
    inspector/InjectedScriptManager.cpp \
896
    inspector/InspectorAgent.cpp \
897
    inspector/InspectorAgent.cpp \
Lines 2038-2043 HEADERS += \ a/Source/WebCore/Target.pri_sec2
2038
    inspector/DOMWrapperVisitor.h \
2039
    inspector/DOMWrapperVisitor.h \
2039
    inspector/IdentifiersFactory.h \
2040
    inspector/IdentifiersFactory.h \
2040
    inspector/InjectedScript.h \
2041
    inspector/InjectedScript.h \
2042
    inspector/InjectedScriptBase.h \
2041
    inspector/InjectedScriptHost.h \
2043
    inspector/InjectedScriptHost.h \
2042
    inspector/InjectedScriptManager.h \
2044
    inspector/InjectedScriptManager.h \
2043
    inspector/InspectorAgent.h \
2045
    inspector/InspectorAgent.h \
- a/Source/WebCore/WebCore.gypi +2 lines
Lines 2765-2770 a/Source/WebCore/WebCore.gypi_sec1
2765
            'inspector/IdentifiersFactory.h',
2765
            'inspector/IdentifiersFactory.h',
2766
            'inspector/InjectedScript.cpp',
2766
            'inspector/InjectedScript.cpp',
2767
            'inspector/InjectedScript.h',
2767
            'inspector/InjectedScript.h',
2768
            'inspector/InjectedScriptBase.cpp',
2769
            'inspector/InjectedScriptBase.h',
2768
            'inspector/InjectedScriptHost.cpp',
2770
            'inspector/InjectedScriptHost.cpp',
2769
            'inspector/InjectedScriptHost.h',
2771
            'inspector/InjectedScriptHost.h',
2770
            'inspector/InjectedScriptManager.cpp',
2772
            'inspector/InjectedScriptManager.cpp',
- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +24 lines
Lines 73331-73336 a/Source/WebCore/WebCore.vcproj/WebCore.vcproj_sec1
73331
				>
73331
				>
73332
			</File>
73332
			</File>
73333
			<File
73333
			<File
73334
				RelativePath="..\inspector\InjectedScriptBase.cpp"
73335
				>
73336
				<FileConfiguration
73337
					Name="Release|Win32"
73338
					ExcludedFromBuild="true"
73339
					>
73340
					<Tool
73341
						Name="VCCLCompilerTool"
73342
					/>
73343
				</FileConfiguration>
73344
				<FileConfiguration
73345
					Name="Production|Win32"
73346
					ExcludedFromBuild="true"
73347
					>
73348
					<Tool
73349
						Name="VCCLCompilerTool"
73350
					/>
73351
				</FileConfiguration>
73352
			</File>
73353
			<File
73354
				RelativePath="..\inspector\InjectedScriptBase.h"
73355
				>
73356
			</File>
73357
			<File
73334
				RelativePath="..\inspector\InjectedScriptHost.cpp"
73358
				RelativePath="..\inspector\InjectedScriptHost.cpp"
73335
				>
73359
				>
73336
				<FileConfiguration
73360
				<FileConfiguration
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +8 lines
Lines 4463-4468 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
4463
		AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
4463
		AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
4464
		AA4C3A760B2B1679002334A2 /* StyleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA4C3A740B2B1679002334A2 /* StyleElement.cpp */; };
4464
		AA4C3A760B2B1679002334A2 /* StyleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA4C3A740B2B1679002334A2 /* StyleElement.cpp */; };
4465
		AA4C3A770B2B1679002334A2 /* StyleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = AA4C3A750B2B1679002334A2 /* StyleElement.h */; };
4465
		AA4C3A770B2B1679002334A2 /* StyleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = AA4C3A750B2B1679002334A2 /* StyleElement.h */; };
4466
		AAB6054E15874C58007B5031 /* InjectedScriptBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAB6054A15874C58007B5031 /* InjectedScriptBase.cpp */; };
4467
		AAB6054F15874C58007B5031 /* InjectedScriptBase.h in Headers */ = {isa = PBXBuildFile; fileRef = AAB6054B15874C58007B5031 /* InjectedScriptBase.h */; };
4466
		AAD766EB157E502F00E85423 /* InspectorWebGLAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAD766E8157E502F00E85423 /* InspectorWebGLAgent.cpp */; };
4468
		AAD766EB157E502F00E85423 /* InspectorWebGLAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAD766E8157E502F00E85423 /* InspectorWebGLAgent.cpp */; };
4467
		AAD766EC157E502F00E85423 /* InspectorWebGLAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = AAD766E9157E502F00E85423 /* InspectorWebGLAgent.h */; };
4469
		AAD766EC157E502F00E85423 /* InspectorWebGLAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = AAD766E9157E502F00E85423 /* InspectorWebGLAgent.h */; };
4468
		AAD766ED157E502F00E85423 /* InspectorWebGLInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = AAD766EA157E502F00E85423 /* InspectorWebGLInstrumentation.h */; };
4470
		AAD766ED157E502F00E85423 /* InspectorWebGLInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = AAD766EA157E502F00E85423 /* InspectorWebGLInstrumentation.h */; };
Lines 11472-11477 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
11472
		AA4C3A750B2B1679002334A2 /* StyleElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StyleElement.h; sourceTree = "<group>"; };
11474
		AA4C3A750B2B1679002334A2 /* StyleElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StyleElement.h; sourceTree = "<group>"; };
11473
		AA9030FE157E16A000276247 /* InjectedWebGLScriptSource.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = InjectedWebGLScriptSource.js; sourceTree = "<group>"; };
11475
		AA9030FE157E16A000276247 /* InjectedWebGLScriptSource.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = InjectedWebGLScriptSource.js; sourceTree = "<group>"; };
11474
		AA912750157E35A500454E54 /* InjectedWebGLScriptSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedWebGLScriptSource.h; sourceTree = "<group>"; };
11476
		AA912750157E35A500454E54 /* InjectedWebGLScriptSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedWebGLScriptSource.h; sourceTree = "<group>"; };
11477
		AAB6054A15874C58007B5031 /* InjectedScriptBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScriptBase.cpp; sourceTree = "<group>"; };
11478
		AAB6054B15874C58007B5031 /* InjectedScriptBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScriptBase.h; sourceTree = "<group>"; };
11475
		AAD766E8157E502F00E85423 /* InspectorWebGLAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorWebGLAgent.cpp; sourceTree = "<group>"; };
11479
		AAD766E8157E502F00E85423 /* InspectorWebGLAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorWebGLAgent.cpp; sourceTree = "<group>"; };
11476
		AAD766E9157E502F00E85423 /* InspectorWebGLAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorWebGLAgent.h; sourceTree = "<group>"; };
11480
		AAD766E9157E502F00E85423 /* InspectorWebGLAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorWebGLAgent.h; sourceTree = "<group>"; };
11477
		AAD766EA157E502F00E85423 /* InspectorWebGLInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorWebGLInstrumentation.h; sourceTree = "<group>"; };
11481
		AAD766EA157E502F00E85423 /* InspectorWebGLInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorWebGLInstrumentation.h; sourceTree = "<group>"; };
Lines 14401-14406 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
14401
				5913A24013D49EBA00F5B05C /* IdentifiersFactory.h */,
14405
				5913A24013D49EBA00F5B05C /* IdentifiersFactory.h */,
14402
				F3644AFD1119805900E0D537 /* InjectedScript.cpp */,
14406
				F3644AFD1119805900E0D537 /* InjectedScript.cpp */,
14403
				F3644AFE1119805900E0D537 /* InjectedScript.h */,
14407
				F3644AFE1119805900E0D537 /* InjectedScript.h */,
14408
				AAB6054A15874C58007B5031 /* InjectedScriptBase.cpp */,
14409
				AAB6054B15874C58007B5031 /* InjectedScriptBase.h */,
14404
				7A0E76F610BF08ED00A0276E /* InjectedScriptHost.cpp */,
14410
				7A0E76F610BF08ED00A0276E /* InjectedScriptHost.cpp */,
14405
				7A0E76F710BF08ED00A0276E /* InjectedScriptHost.h */,
14411
				7A0E76F710BF08ED00A0276E /* InjectedScriptHost.h */,
14406
				7A0E76F810BF08ED00A0276E /* InjectedScriptHost.idl */,
14412
				7A0E76F810BF08ED00A0276E /* InjectedScriptHost.idl */,
Lines 23317-23322 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
23317
				316FE1180E6E1DA700BF6088 /* ImplicitAnimation.h in Headers */,
23323
				316FE1180E6E1DA700BF6088 /* ImplicitAnimation.h in Headers */,
23318
				DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */,
23324
				DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */,
23319
				F3644B001119805900E0D537 /* InjectedScript.h in Headers */,
23325
				F3644B001119805900E0D537 /* InjectedScript.h in Headers */,
23326
				AAB6054F15874C58007B5031 /* InjectedScriptBase.h in Headers */,
23320
				7A0E76FA10BF08ED00A0276E /* InjectedScriptHost.h in Headers */,
23327
				7A0E76FA10BF08ED00A0276E /* InjectedScriptHost.h in Headers */,
23321
				F316396C1329481A00A649CB /* InjectedScriptManager.h in Headers */,
23328
				F316396C1329481A00A649CB /* InjectedScriptManager.h in Headers */,
23322
				A8CFF5E50A155A05000A4234 /* InlineBox.h in Headers */,
23329
				A8CFF5E50A155A05000A4234 /* InlineBox.h in Headers */,
Lines 26454-26459 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
26454
				316FE1170E6E1DA700BF6088 /* ImplicitAnimation.cpp in Sources */,
26461
				316FE1170E6E1DA700BF6088 /* ImplicitAnimation.cpp in Sources */,
26455
				DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */,
26462
				DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */,
26456
				F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */,
26463
				F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */,
26464
				AAB6054E15874C58007B5031 /* InjectedScriptBase.cpp in Sources */,
26457
				7A0E76F910BF08ED00A0276E /* InjectedScriptHost.cpp in Sources */,
26465
				7A0E76F910BF08ED00A0276E /* InjectedScriptHost.cpp in Sources */,
26458
				F316396B1329481A00A649CB /* InjectedScriptManager.cpp in Sources */,
26466
				F316396B1329481A00A649CB /* InjectedScriptManager.cpp in Sources */,
26459
				A8CFF5E60A155A05000A4234 /* InlineBox.cpp in Sources */,
26467
				A8CFF5E60A155A05000A4234 /* InlineBox.cpp in Sources */,
- a/Source/WebCore/inspector/InjectedScript.cpp -98 / +19 lines
Lines 1-5 a/Source/WebCore/inspector/InjectedScript.cpp_sec1
1
/*
1
/*
2
 * Copyright (C) 2010, 2011 Google Inc. All rights reserved.
2
 * Copyright (C) 2012 Google Inc. All rights reserved.
3
 *
3
 *
4
 * Redistribution and use in source and binary forms, with or without
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions are
5
 * modification, are permitted provided that the following conditions are
Lines 34-48 a/Source/WebCore/inspector/InjectedScript.cpp_sec2
34
34
35
#include "InjectedScript.h"
35
#include "InjectedScript.h"
36
36
37
#include "DOMWindow.h"
38
#include "Frame.h"
39
#include "InjectedScriptHost.h"
37
#include "InjectedScriptHost.h"
40
#include "InjectedScriptManager.h"
41
#include "InspectorInstrumentation.h"
42
#include "InspectorValues.h"
38
#include "InspectorValues.h"
43
#include "Node.h"
39
#include "Node.h"
44
#include "PlatformString.h"
40
#include "PlatformString.h"
45
#include "ScriptFunctionCall.h"
41
#include "ScriptFunctionCall.h"
42
#include "SerializedScriptValue.h"
46
43
47
using WebCore::TypeBuilder::Array;
44
using WebCore::TypeBuilder::Array;
48
using WebCore::TypeBuilder::Debugger::CallFrame;
45
using WebCore::TypeBuilder::Debugger::CallFrame;
Lines 53-71 using WebCore::TypeBuilder::Runtime::RemoteObject; a/Source/WebCore/inspector/InjectedScript.cpp_sec3
53
namespace WebCore {
50
namespace WebCore {
54
51
55
InjectedScript::InjectedScript()
52
InjectedScript::InjectedScript()
56
    : m_inspectedStateAccessCheck(0)
57
{
53
{
58
}
54
}
59
55
60
InjectedScript::InjectedScript(ScriptObject injectedScriptObject, InspectedStateAccessCheck accessCheck)
56
InjectedScript::InjectedScript(ScriptObject injectedScriptObject, InspectedStateAccessCheck accessCheck)
61
    : m_injectedScriptObject(injectedScriptObject)
57
    : InjectedScriptBase(injectedScriptObject, accessCheck)
62
    , m_inspectedStateAccessCheck(accessCheck)
63
{
58
{
64
}
59
}
65
60
66
void InjectedScript::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown)
61
void InjectedScript::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown)
67
{
62
{
68
    ScriptFunctionCall function(m_injectedScriptObject, "evaluate");
63
    ScriptFunctionCall function(injectedScriptObject(), "evaluate");
69
    function.appendArgument(expression);
64
    function.appendArgument(expression);
70
    function.appendArgument(objectGroup);
65
    function.appendArgument(objectGroup);
71
    function.appendArgument(includeCommandLineAPI);
66
    function.appendArgument(includeCommandLineAPI);
Lines 75-81 void InjectedScript::evaluate(ErrorString* errorString, const String& expression a/Source/WebCore/inspector/InjectedScript.cpp_sec4
75
70
76
void InjectedScript::callFunctionOn(ErrorString* errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown)
71
void InjectedScript::callFunctionOn(ErrorString* errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown)
77
{
72
{
78
    ScriptFunctionCall function(m_injectedScriptObject, "callFunctionOn");
73
    ScriptFunctionCall function(injectedScriptObject(), "callFunctionOn");
79
    function.appendArgument(objectId);
74
    function.appendArgument(objectId);
80
    function.appendArgument(expression);
75
    function.appendArgument(expression);
81
    function.appendArgument(arguments);
76
    function.appendArgument(arguments);
Lines 85-91 void InjectedScript::callFunctionOn(ErrorString* errorString, const String& obje a/Source/WebCore/inspector/InjectedScript.cpp_sec5
85
80
86
void 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)
81
void 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)
87
{
82
{
88
    ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnCallFrame");
83
    ScriptFunctionCall function(injectedScriptObject(), "evaluateOnCallFrame");
89
    function.appendArgument(callFrames);
84
    function.appendArgument(callFrames);
90
    function.appendArgument(callFrameId);
85
    function.appendArgument(callFrameId);
91
    function.appendArgument(expression);
86
    function.appendArgument(expression);
Lines 117-123 void InjectedScript::restartFrame(ErrorString* errorString, const ScriptValue& c a/Source/WebCore/inspector/InjectedScript.cpp_sec6
117
112
118
void InjectedScript::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<FunctionDetails>* result)
113
void InjectedScript::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<FunctionDetails>* result)
119
{
114
{
120
    ScriptFunctionCall function(m_injectedScriptObject, "getFunctionDetails");
115
    ScriptFunctionCall function(injectedScriptObject(), "getFunctionDetails");
121
    function.appendArgument(functionId);
116
    function.appendArgument(functionId);
122
    RefPtr<InspectorValue> resultValue;
117
    RefPtr<InspectorValue> resultValue;
123
    makeCall(function, &resultValue);
118
    makeCall(function, &resultValue);
Lines 131-137 void InjectedScript::getFunctionDetails(ErrorString* errorString, const String& a/Source/WebCore/inspector/InjectedScript.cpp_sec7
131
126
132
void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ownProperties, RefPtr<Array<PropertyDescriptor> >* properties)
127
void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ownProperties, RefPtr<Array<PropertyDescriptor> >* properties)
133
{
128
{
134
    ScriptFunctionCall function(m_injectedScriptObject, "getProperties");
129
    ScriptFunctionCall function(injectedScriptObject(), "getProperties");
135
    function.appendArgument(objectId);
130
    function.appendArgument(objectId);
136
    function.appendArgument(ownProperties);
131
    function.appendArgument(ownProperties);
137
132
Lines 149-155 Node* InjectedScript::nodeForObjectId(const String& objectId) a/Source/WebCore/inspector/InjectedScript.cpp_sec8
149
    if (hasNoValue() || !canAccessInspectedWindow())
144
    if (hasNoValue() || !canAccessInspectedWindow())
150
        return 0;
145
        return 0;
151
146
152
    ScriptFunctionCall function(m_injectedScriptObject, "nodeForObjectId");
147
    ScriptFunctionCall function(injectedScriptObject(), "nodeForObjectId");
153
    function.appendArgument(objectId);
148
    function.appendArgument(objectId);
154
149
155
    bool hadException = false;
150
    bool hadException = false;
Lines 161-167 Node* InjectedScript::nodeForObjectId(const String& objectId) a/Source/WebCore/inspector/InjectedScript.cpp_sec9
161
156
162
void InjectedScript::releaseObject(const String& objectId)
157
void InjectedScript::releaseObject(const String& objectId)
163
{
158
{
164
    ScriptFunctionCall function(m_injectedScriptObject, "releaseObject");
159
    ScriptFunctionCall function(injectedScriptObject(), "releaseObject");
165
    function.appendArgument(objectId);
160
    function.appendArgument(objectId);
166
    RefPtr<InspectorValue> result;
161
    RefPtr<InspectorValue> result;
167
    makeCall(function, &result);
162
    makeCall(function, &result);
Lines 171-182 void InjectedScript::releaseObject(const String& objectId) a/Source/WebCore/inspector/InjectedScript.cpp_sec10
171
PassRefPtr<Array<CallFrame> > InjectedScript::wrapCallFrames(const ScriptValue& callFrames)
166
PassRefPtr<Array<CallFrame> > InjectedScript::wrapCallFrames(const ScriptValue& callFrames)
172
{
167
{
173
    ASSERT(!hasNoValue());
168
    ASSERT(!hasNoValue());
174
    ScriptFunctionCall function(m_injectedScriptObject, "wrapCallFrames");
169
    ScriptFunctionCall function(injectedScriptObject(), "wrapCallFrames");
175
    function.appendArgument(callFrames);
170
    function.appendArgument(callFrames);
176
    bool hadException = false;
171
    bool hadException = false;
177
    ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadException);
172
    ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadException);
178
    ASSERT(!hadException);
173
    ASSERT(!hadException);
179
    RefPtr<InspectorValue> result = callFramesValue.toInspectorValue(m_injectedScriptObject.scriptState());
174
    RefPtr<InspectorValue> result = callFramesValue.toInspectorValue(scriptState());
180
    if (result->type() == InspectorValue::TypeArray)
175
    if (result->type() == InspectorValue::TypeArray)
181
        return Array<CallFrame>::runtimeCast(result);
176
        return Array<CallFrame>::runtimeCast(result);
182
    return Array<CallFrame>::create();
177
    return Array<CallFrame>::create();
Lines 186-192 PassRefPtr<Array<CallFrame> > InjectedScript::wrapCallFrames(const ScriptValue& a/Source/WebCore/inspector/InjectedScript.cpp_sec11
186
PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(ScriptValue value, const String& groupName) const
181
PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(ScriptValue value, const String& groupName) const
187
{
182
{
188
    ASSERT(!hasNoValue());
183
    ASSERT(!hasNoValue());
189
    ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObject");
184
    ScriptFunctionCall wrapFunction(injectedScriptObject(), "wrapObject");
190
    wrapFunction.appendArgument(value);
185
    wrapFunction.appendArgument(value);
191
    wrapFunction.appendArgument(groupName);
186
    wrapFunction.appendArgument(groupName);
192
    wrapFunction.appendArgument(canAccessInspectedWindow());
187
    wrapFunction.appendArgument(canAccessInspectedWindow());
Lines 195-201 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(Script a/Source/WebCore/inspector/InjectedScript.cpp_sec12
195
    if (hadException) {
190
    if (hadException) {
196
        return 0;
191
        return 0;
197
    }
192
    }
198
    RefPtr<InspectorObject> rawResult = r.toInspectorValue(m_injectedScriptObject.scriptState())->asObject();
193
    RefPtr<InspectorObject> rawResult = r.toInspectorValue(scriptState())->asObject();
199
    return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult);
194
    return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult);
200
}
195
}
201
196
Lines 206-219 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapNode(Node* no a/Source/WebCore/inspector/InjectedScript.cpp_sec13
206
201
207
PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapSerializedObject(SerializedScriptValue* serializedScriptValue, const String& groupName) const
202
PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapSerializedObject(SerializedScriptValue* serializedScriptValue, const String& groupName) const
208
{
203
{
209
    ScriptValue scriptValue = serializedScriptValue->deserializeForInspector(m_injectedScriptObject.scriptState());
204
    ScriptValue scriptValue = serializedScriptValue->deserializeForInspector(scriptState());
210
    return scriptValue.hasNoValue() ? 0 : wrapObject(scriptValue, groupName);
205
    return scriptValue.hasNoValue() ? 0 : wrapObject(scriptValue, groupName);
211
}
206
}
212
207
213
ScriptValue InjectedScript::findObjectById(const String& objectId) const
208
ScriptValue InjectedScript::findObjectById(const String& objectId) const
214
{
209
{
215
    ASSERT(!hasNoValue());
210
    ASSERT(!hasNoValue());
216
    ScriptFunctionCall function(m_injectedScriptObject, "findObjectById");
211
    ScriptFunctionCall function(injectedScriptObject(), "findObjectById");
217
    function.appendArgument(objectId);
212
    function.appendArgument(objectId);
218
213
219
    bool hadException = false;
214
    bool hadException = false;
Lines 225-231 ScriptValue InjectedScript::findObjectById(const String& objectId) const a/Source/WebCore/inspector/InjectedScript.cpp_sec14
225
void InjectedScript::inspectNode(Node* node)
220
void InjectedScript::inspectNode(Node* node)
226
{
221
{
227
    ASSERT(!hasNoValue());
222
    ASSERT(!hasNoValue());
228
    ScriptFunctionCall function(m_injectedScriptObject, "inspectNode");
223
    ScriptFunctionCall function(injectedScriptObject(), "inspectNode");
229
    function.appendArgument(nodeAsScriptValue(node));
224
    function.appendArgument(nodeAsScriptValue(node));
230
    RefPtr<InspectorValue> result;
225
    RefPtr<InspectorValue> result;
231
    makeCall(function, &result);
226
    makeCall(function, &result);
Lines 234-323 void InjectedScript::inspectNode(Node* node) a/Source/WebCore/inspector/InjectedScript.cpp_sec15
234
void InjectedScript::releaseObjectGroup(const String& objectGroup)
229
void InjectedScript::releaseObjectGroup(const String& objectGroup)
235
{
230
{
236
    ASSERT(!hasNoValue());
231
    ASSERT(!hasNoValue());
237
    ScriptFunctionCall releaseFunction(m_injectedScriptObject, "releaseObjectGroup");
232
    ScriptFunctionCall releaseFunction(injectedScriptObject(), "releaseObjectGroup");
238
    releaseFunction.appendArgument(objectGroup);
233
    releaseFunction.appendArgument(objectGroup);
239
    bool hadException = false;
234
    bool hadException = false;
240
    callFunctionWithEvalEnabled(releaseFunction, hadException);
235
    callFunctionWithEvalEnabled(releaseFunction, hadException);
241
    ASSERT(!hadException);
236
    ASSERT(!hadException);
242
}
237
}
243
238
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
318
ScriptValue InjectedScript::nodeAsScriptValue(Node* node)
239
ScriptValue InjectedScript::nodeAsScriptValue(Node* node)
319
{
240
{
320
    return InjectedScriptHost::nodeAsScriptValue(m_injectedScriptObject.scriptState(), node);
241
    return InjectedScriptHost::nodeAsScriptValue(scriptState(), node);
321
}
242
}
322
243
323
} // namespace WebCore
244
} // namespace WebCore
- a/Source/WebCore/inspector/InjectedScript.h -19 / +4 lines
Lines 1-5 a/Source/WebCore/inspector/InjectedScript.h_sec1
1
/*
1
/*
2
 * Copyright (C) 2010, 2011 Google Inc. All rights reserved.
2
 * Copyright (C) 2012 Google Inc. All rights reserved.
3
 *
3
 *
4
 * Redistribution and use in source and binary forms, with or without
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions are
5
 * modification, are permitted provided that the following conditions are
Lines 31-36 a/Source/WebCore/inspector/InjectedScript.h_sec2
31
#ifndef InjectedScript_h
31
#ifndef InjectedScript_h
32
#define InjectedScript_h
32
#define InjectedScript_h
33
33
34
#include "InjectedScriptBase.h"
34
#include "InjectedScriptManager.h"
35
#include "InjectedScriptManager.h"
35
#include "InspectorTypeBuilder.h"
36
#include "InspectorTypeBuilder.h"
36
#include "ScriptObject.h"
37
#include "ScriptObject.h"
Lines 41-63 a/Source/WebCore/inspector/InjectedScript.h_sec3
41
42
42
namespace WebCore {
43
namespace WebCore {
43
44
44
class InspectorArray;
45
class InspectorObject;
46
class InspectorValue;
47
class Node;
45
class Node;
48
class ScriptFunctionCall;
46
class SerializedScriptValue;
49
50
typedef String ErrorString;
51
47
52
#if ENABLE(INSPECTOR)
48
#if ENABLE(INSPECTOR)
53
49
54
class InjectedScript {
50
class InjectedScript : public InjectedScriptBase {
55
public:
51
public:
56
    InjectedScript();
52
    InjectedScript();
57
    ~InjectedScript() { }
53
    ~InjectedScript() { }
58
54
59
    bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
60
61
    void evaluate(ErrorString*,
55
    void evaluate(ErrorString*,
62
                  const String& expression,
56
                  const String& expression,
63
                  const String& objectGroup,
57
                  const String& objectGroup,
Lines 98-118 public: a/Source/WebCore/inspector/InjectedScript.h_sec4
98
92
99
    void inspectNode(Node*);
93
    void inspectNode(Node*);
100
    void releaseObjectGroup(const String&);
94
    void releaseObjectGroup(const String&);
101
    ScriptState* scriptState() const { return m_injectedScriptObject.scriptState(); }
102
95
103
private:
96
private:
104
    friend InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState*);
97
    friend InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState*);
105
    typedef bool (*InspectedStateAccessCheck)(ScriptState*);
106
    InjectedScript(ScriptObject, InspectedStateAccessCheck);
98
    InjectedScript(ScriptObject, InspectedStateAccessCheck);
107
99
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);
112
    ScriptValue nodeAsScriptValue(Node*);
100
    ScriptValue nodeAsScriptValue(Node*);
113
114
    ScriptObject m_injectedScriptObject;
115
    InspectedStateAccessCheck m_inspectedStateAccessCheck;
116
};
101
};
117
102
118
#endif
103
#endif
- a/Source/WebCore/inspector/InjectedScriptBase.cpp +138 lines
Line 0 a/Source/WebCore/inspector/InjectedScriptBase.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Google Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions are
6
 * met:
7
 *
8
 *     * Redistributions of source code must retain the above copyright
9
 * notice, this list of conditions and the following disclaimer.
10
 *     * Redistributions in binary form must reproduce the above
11
 * copyright notice, this list of conditions and the following disclaimer
12
 * in the documentation and/or other materials provided with the
13
 * distribution.
14
 *     * Neither the name of Google Inc. nor the names of its
15
 * contributors may be used to endorse or promote products derived from
16
 * this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
 */
30
31
#include "config.h"
32
33
#if ENABLE(INSPECTOR)
34
35
#include "InjectedScriptBase.h"
36
37
#include "InspectorInstrumentation.h"
38
#include "InspectorValues.h"
39
#include "PlatformString.h"
40
#include "ScriptFunctionCall.h"
41
42
using WebCore::TypeBuilder::Runtime::RemoteObject;
43
44
namespace WebCore {
45
46
InjectedScriptBase::InjectedScriptBase()
47
    : m_inspectedStateAccessCheck(0)
48
{
49
}
50
51
InjectedScriptBase::InjectedScriptBase(ScriptObject injectedScriptObject, InspectedStateAccessCheck accessCheck)
52
    : m_injectedScriptObject(injectedScriptObject)
53
    , m_inspectedStateAccessCheck(accessCheck)
54
{
55
}
56
57
bool InjectedScriptBase::canAccessInspectedWindow() const
58
{
59
    return m_inspectedStateAccessCheck(m_injectedScriptObject.scriptState());
60
}
61
62
const ScriptObject& InjectedScriptBase::injectedScriptObject() const
63
{
64
    return m_injectedScriptObject;
65
}
66
67
ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(ScriptFunctionCall& function, bool& hadException) const
68
{
69
    ScriptExecutionContext* scriptExecutionContext = scriptExecutionContextFromScriptState(m_injectedScriptObject.scriptState());
70
    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willCallFunction(scriptExecutionContext, "InjectedScript", 1);
71
72
    ScriptState* scriptState = m_injectedScriptObject.scriptState();
73
    bool evalIsDisabled = false;
74
    if (scriptState) {
75
        evalIsDisabled = !evalEnabled(scriptState);
76
        // Temporarily enable allow evals for inspector.
77
        if (evalIsDisabled)
78
            setEvalEnabled(scriptState, true);
79
    }
80
81
    ScriptValue resultValue = function.call(hadException);
82
83
    if (evalIsDisabled)
84
        setEvalEnabled(scriptState, false);
85
86
    InspectorInstrumentation::didCallFunction(cookie);
87
    return resultValue;
88
}
89
90
void InjectedScriptBase::makeCall(ScriptFunctionCall& function, RefPtr<InspectorValue>* result)
91
{
92
    if (hasNoValue() || !canAccessInspectedWindow()) {
93
        *result = InspectorValue::null();
94
        return;
95
    }
96
97
    bool hadException = false;
98
    ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException);
99
100
    ASSERT(!hadException);
101
    if (!hadException) {
102
        *result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState());
103
        if (!*result)
104
            *result = InspectorString::create(String::format("Object has too long reference chain(must not be longer than %d)", InspectorValue::maxDepth));
105
    } else
106
        *result = InspectorString::create("Exception while making a call.");
107
}
108
109
void InjectedScriptBase::makeEvalCall(ErrorString* errorString, ScriptFunctionCall& function, RefPtr<TypeBuilder::Runtime::RemoteObject>* objectResult, TypeBuilder::OptOutput<bool>* wasThrown)
110
{
111
    RefPtr<InspectorValue> result;
112
    makeCall(function, &result);
113
    if (!result) {
114
        *errorString = "Internal error: result value is empty";
115
        return;
116
    }
117
    if (result->type() == InspectorValue::TypeString) {
118
        result->asString(errorString);
119
        return;
120
    }
121
    RefPtr<InspectorObject> resultPair = result->asObject();
122
    if (!resultPair) {
123
        *errorString = "Internal error: result is not an Object";
124
        return;
125
    }
126
    RefPtr<InspectorObject> resultObj = resultPair->getObject("result");
127
    bool wasThrownVal = false;
128
    if (!resultObj || !resultPair->getBoolean("wasThrown", &wasThrownVal)) {
129
        *errorString = "Internal error: result is not a pair of value and wasThrown flag";
130
        return;
131
    }
132
    *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj);
133
    *wasThrown = wasThrownVal;
134
}
135
136
} // namespace WebCore
137
138
#endif // ENABLE(INSPECTOR)
- a/Source/WebCore/inspector/InjectedScriptBase.h +75 lines
Line 0 a/Source/WebCore/inspector/InjectedScriptBase.h_sec1
1
/*
2
 * Copyright (C) 2012 Google Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions are
6
 * met:
7
 *
8
 *     * Redistributions of source code must retain the above copyright
9
 * notice, this list of conditions and the following disclaimer.
10
 *     * Redistributions in binary form must reproduce the above
11
 * copyright notice, this list of conditions and the following disclaimer
12
 * in the documentation and/or other materials provided with the
13
 * distribution.
14
 *     * Neither the name of Google Inc. nor the names of its
15
 * contributors may be used to endorse or promote products derived from
16
 * this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
 */
30
31
#ifndef InjectedScriptBase_h
32
#define InjectedScriptBase_h
33
34
#include "InspectorTypeBuilder.h"
35
#include "ScriptObject.h"
36
#include <wtf/Forward.h>
37
#include <wtf/RefPtr.h>
38
39
namespace WebCore {
40
41
class InspectorValue;
42
class ScriptFunctionCall;
43
44
typedef String ErrorString;
45
46
#if ENABLE(INSPECTOR)
47
48
class InjectedScriptBase {
49
public:
50
    virtual ~InjectedScriptBase() { }
51
52
    bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
53
    ScriptState* scriptState() const { return m_injectedScriptObject.scriptState(); }
54
55
protected:
56
    typedef bool (*InspectedStateAccessCheck)(ScriptState*);
57
    InjectedScriptBase();
58
    InjectedScriptBase(ScriptObject, InspectedStateAccessCheck);
59
60
    bool canAccessInspectedWindow() const;
61
    const ScriptObject& injectedScriptObject() const;
62
    ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadException) const;
63
    void makeCall(ScriptFunctionCall&, RefPtr<InspectorValue>* result);
64
    void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
65
66
private:
67
    ScriptObject m_injectedScriptObject;
68
    InspectedStateAccessCheck m_inspectedStateAccessCheck;
69
};
70
71
#endif
72
73
} // namespace WebCore
74
75
#endif
- a/Source/WebCore/inspector/InspectorAllInOne.cpp +1 lines
Lines 32-37 a/Source/WebCore/inspector/InspectorAllInOne.cpp_sec1
32
#include "DOMPatchSupport.cpp"
32
#include "DOMPatchSupport.cpp"
33
#include "IdentifiersFactory.cpp"
33
#include "IdentifiersFactory.cpp"
34
#include "InjectedScript.cpp"
34
#include "InjectedScript.cpp"
35
#include "InjectedScriptBase.cpp"
35
#include "InjectedScriptHost.cpp"
36
#include "InjectedScriptHost.cpp"
36
#include "InjectedScriptManager.cpp"
37
#include "InjectedScriptManager.cpp"
37
#include "InspectorAgent.cpp"
38
#include "InspectorAgent.cpp"

Return to Bug 89107