inspector/DOMNodeHighlighter.cpp
inspector/DOMPatchSupport.cpp
inspector/IdentifiersFactory.cpp
- inspector/InjectedScriptModule.cpp
inspector/InjectedScript.cpp
inspector/InjectedScriptBase.cpp
inspector/InjectedScriptHost.cpp
inspector/InjectedScriptManager.cpp
+ inspector/InjectedScriptModule.cpp
+ inspector/InjectedScriptWebGLModule.cpp
inspector/InspectorAgent.cpp
inspector/InspectorApplicationCacheAgent.cpp
inspector/InspectorBaseAgent.cpp
+2012-06-21 Andrey Adaikin <aandrey@chromium.org>
+
+ Web Inspector: [WebGL] Add injected WebGL module class
+ https://bugs.webkit.org/show_bug.cgi?id=89592
+
+ Reviewed by Pavel Feldman.
+
+ Adding a new InjectedScriptWebGLModule class and moving WebGL-related
+ stuff out of InjectedScriptManager class.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * inspector/InjectedScriptManager.cpp:
+ * inspector/InjectedScriptManager.h:
+ (InjectedScriptManager):
+ * inspector/InjectedScriptModule.cpp:
+ (WebCore::InjectedScriptModule::ensureInjected):
+ * inspector/InjectedScriptModule.h:
+ (InjectedScriptModule):
+ * inspector/InjectedScriptWebGLModule.cpp: Copied from Source/WebCore/inspector/InjectedScriptModule.cpp.
+ (WebCore):
+ (WebCore::InjectedScriptWebGLModule::InjectedScriptWebGLModule):
+ (WebCore::InjectedScriptWebGLModule::moduleForState):
+ (WebCore::InjectedScriptWebGLModule::source):
+ (WebCore::InjectedScriptWebGLModule::wrapWebGLContext):
+ (WebCore::InjectedScriptWebGLModule::captureFrame):
+ * inspector/InjectedScriptWebGLModule.h: Copied from Source/WebCore/inspector/InjectedScriptModule.h.
+ (WebCore):
+ (InjectedScriptWebGLModule):
+ * inspector/InspectorWebGLAgent.cpp:
+ (WebCore::InspectorWebGLAgent::wrapWebGLRenderingContextForInstrumentation):
+
2012-06-21 Pavel Feldman <pfeldman@chromium.org>
Web Inspector: do not add separator to the end of the context menu.
Source/WebCore/inspector/DOMWrapperVisitor.h \
Source/WebCore/inspector/IdentifiersFactory.cpp \
Source/WebCore/inspector/IdentifiersFactory.h \
- Source/WebCore/inspector/InjectedScriptModule.cpp \
- Source/WebCore/inspector/InjectedScriptModule.h \
Source/WebCore/inspector/InjectedScript.cpp \
Source/WebCore/inspector/InjectedScript.h \
Source/WebCore/inspector/InjectedScriptBase.cpp \
Source/WebCore/inspector/InjectedScriptHost.h \
Source/WebCore/inspector/InjectedScriptManager.cpp \
Source/WebCore/inspector/InjectedScriptManager.h \
+ Source/WebCore/inspector/InjectedScriptModule.cpp \
+ Source/WebCore/inspector/InjectedScriptModule.h \
+ Source/WebCore/inspector/InjectedScriptWebGLModule.cpp \
+ Source/WebCore/inspector/InjectedScriptWebGLModule.h \
Source/WebCore/inspector/InspectorAgent.cpp \
Source/WebCore/inspector/InspectorAgent.h \
Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp \
inspector/DOMNodeHighlighter.cpp \
inspector/DOMPatchSupport.cpp \
inspector/IdentifiersFactory.cpp \
- inspector/InjectedScriptModule.cpp \
inspector/InjectedScript.cpp \
inspector/InjectedScriptBase.cpp \
inspector/InjectedScriptHost.cpp \
inspector/InjectedScriptManager.cpp \
+ inspector/InjectedScriptModule.cpp \
+ inspector/InjectedScriptWebGLModule.cpp \
inspector/InspectorAgent.cpp \
inspector/InspectorApplicationCacheAgent.cpp \
inspector/InspectorBaseAgent.cpp \
inspector/DOMPatchSupport.h \
inspector/DOMWrapperVisitor.h \
inspector/IdentifiersFactory.h \
- inspector/InjectedScriptModule.h \
inspector/InjectedScript.h \
inspector/InjectedScriptBase.h \
inspector/InjectedScriptHost.h \
inspector/InjectedScriptManager.h \
+ inspector/InjectedScriptModule.h \
+ inspector/InjectedScriptWebGLModule.h \
inspector/InspectorAgent.h \
inspector/InspectorApplicationCacheAgent.h \
inspector/InspectorBaseAgent.h \
'inspector/DOMWrapperVisitor.h',
'inspector/IdentifiersFactory.cpp',
'inspector/IdentifiersFactory.h',
- 'inspector/InjectedScriptModule.cpp',
- 'inspector/InjectedScriptModule.h',
'inspector/InjectedScript.cpp',
'inspector/InjectedScript.h',
'inspector/InjectedScriptBase.cpp',
'inspector/InjectedScriptHost.h',
'inspector/InjectedScriptManager.cpp',
'inspector/InjectedScriptManager.h',
+ 'inspector/InjectedScriptModule.cpp',
+ 'inspector/InjectedScriptModule.h',
+ 'inspector/InjectedScriptWebGLModule.cpp',
+ 'inspector/InjectedScriptWebGLModule.h',
'inspector/InspectorAgent.cpp',
'inspector/InspectorApplicationCacheAgent.cpp',
'inspector/InspectorApplicationCacheAgent.h',
>
</File>
<File
- RelativePath="..\inspector\InjectedScriptModule.cpp"
+ RelativePath="..\inspector\InjectedScript.cpp"
>
<FileConfiguration
Name="Release|Win32"
</FileConfiguration>
</File>
<File
- RelativePath="..\inspector\InjectedScriptModule.h"
+ RelativePath="..\inspector\InjectedScript.h"
>
</File>
<File
- RelativePath="..\inspector\InjectedScript.cpp"
+ RelativePath="..\inspector\InjectedScriptBase.cpp"
>
<FileConfiguration
Name="Release|Win32"
</FileConfiguration>
</File>
<File
- RelativePath="..\inspector\InjectedScript.h"
+ RelativePath="..\inspector\InjectedScriptBase.h"
>
</File>
<File
- RelativePath="..\inspector\InjectedScriptBase.cpp"
+ RelativePath="..\inspector\InjectedScriptHost.cpp"
>
<FileConfiguration
Name="Release|Win32"
</FileConfiguration>
</File>
<File
- RelativePath="..\inspector\InjectedScriptBase.h"
+ RelativePath="..\inspector\InjectedScriptHost.h"
>
</File>
<File
- RelativePath="..\inspector\InjectedScriptHost.cpp"
+ RelativePath="..\inspector\InjectedScriptManager.cpp"
>
<FileConfiguration
Name="Release|Win32"
</FileConfiguration>
</File>
<File
- RelativePath="..\inspector\InjectedScriptHost.h"
+ RelativePath="..\inspector\InjectedScriptManager.h"
>
</File>
<File
- RelativePath="..\inspector\InjectedScriptManager.cpp"
+ RelativePath="..\inspector\InjectedScriptModule.cpp"
>
<FileConfiguration
Name="Release|Win32"
</FileConfiguration>
</File>
<File
- RelativePath="..\inspector\InjectedScriptManager.h"
+ RelativePath="..\inspector\InjectedScriptModule.h"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\InjectedScriptWebGLModule.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Production|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\inspector\InjectedScriptWebGLModule.h"
>
</File>
<File
AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
AA4C3A760B2B1679002334A2 /* StyleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA4C3A740B2B1679002334A2 /* StyleElement.cpp */; };
AA4C3A770B2B1679002334A2 /* StyleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = AA4C3A750B2B1679002334A2 /* StyleElement.h */; };
+ AA73183E159255B900A93E6E /* InjectedScriptWebGLModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA73183C159255B900A93E6E /* InjectedScriptWebGLModule.cpp */; };
+ AA73183F159255B900A93E6E /* InjectedScriptWebGLModule.h in Headers */ = {isa = PBXBuildFile; fileRef = AA73183D159255B900A93E6E /* InjectedScriptWebGLModule.h */; };
AAB6054E15874C58007B5031 /* InjectedScriptBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAB6054A15874C58007B5031 /* InjectedScriptBase.cpp */; };
AAB6054F15874C58007B5031 /* InjectedScriptBase.h in Headers */ = {isa = PBXBuildFile; fileRef = AAB6054B15874C58007B5031 /* InjectedScriptBase.h */; };
AAB6055015874C58007B5031 /* InjectedScriptModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAB6054C15874C58007B5031 /* InjectedScriptModule.cpp */; };
AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSCursorImageValue.h; sourceTree = "<group>"; };
AA4C3A740B2B1679002334A2 /* StyleElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StyleElement.cpp; sourceTree = "<group>"; };
AA4C3A750B2B1679002334A2 /* StyleElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StyleElement.h; sourceTree = "<group>"; };
+ AA73183C159255B900A93E6E /* InjectedScriptWebGLModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScriptWebGLModule.cpp; sourceTree = "<group>"; };
+ AA73183D159255B900A93E6E /* InjectedScriptWebGLModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScriptWebGLModule.h; sourceTree = "<group>"; };
AA9030FE157E16A000276247 /* InjectedWebGLScriptSource.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = InjectedWebGLScriptSource.js; sourceTree = "<group>"; };
AA912750157E35A500454E54 /* InjectedWebGLScriptSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedWebGLScriptSource.h; sourceTree = "<group>"; };
AAB6054A15874C58007B5031 /* InjectedScriptBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScriptBase.cpp; sourceTree = "<group>"; };
AAB6054C15874C58007B5031 /* InjectedScriptModule.cpp */,
AAB6054D15874C58007B5031 /* InjectedScriptModule.h */,
7A563F9512DF5C9100F4536D /* InjectedScriptSource.js */,
+ AA73183C159255B900A93E6E /* InjectedScriptWebGLModule.cpp */,
+ AA73183D159255B900A93E6E /* InjectedScriptWebGLModule.h */,
AA9030FE157E16A000276247 /* InjectedWebGLScriptSource.js */,
1C435CD414E8545B004E10EA /* Inspector-0.1.json */,
1C435CD514E8545B004E10EA /* Inspector-1.0.json */,
7A0E76FA10BF08ED00A0276E /* InjectedScriptHost.h in Headers */,
F316396C1329481A00A649CB /* InjectedScriptManager.h in Headers */,
AAB6055115874C58007B5031 /* InjectedScriptModule.h in Headers */,
+ AA73183F159255B900A93E6E /* InjectedScriptWebGLModule.h in Headers */,
A8CFF5E50A155A05000A4234 /* InlineBox.h in Headers */,
A8CFF5E30A155A05000A4234 /* InlineFlowBox.h in Headers */,
BCE789161120D6080060ECE5 /* InlineIterator.h in Headers */,
7A0E76F910BF08ED00A0276E /* InjectedScriptHost.cpp in Sources */,
F316396B1329481A00A649CB /* InjectedScriptManager.cpp in Sources */,
AAB6055015874C58007B5031 /* InjectedScriptModule.cpp in Sources */,
+ AA73183E159255B900A93E6E /* InjectedScriptWebGLModule.cpp in Sources */,
A8CFF5E60A155A05000A4234 /* InlineBox.cpp in Sources */,
A8CFF5E40A155A05000A4234 /* InlineFlowBox.cpp in Sources */,
BCEA4859097D93020094C9E4 /* InlineTextBox.cpp in Sources */,
#include "InjectedScript.h"
#include "InjectedScriptHost.h"
#include "InjectedScriptSource.h"
-#if ENABLE(WEBGL)
-#include "InjectedWebGLScriptSource.h"
-#endif
#include "InspectorValues.h"
#include "ScriptObject.h"
#include <wtf/PassOwnPtr.h>
return result;
}
-#if ENABLE(WEBGL)
-ScriptObject InjectedScriptManager::wrapWebGLRenderingContextForInstrumentation(const ScriptObject&)
-{
- // FIXME(88973): Inject via this.injectScript()
- return ScriptObject();
-}
-
-String InjectedScriptManager::injectedWebGLScriptSource()
-{
- return String(reinterpret_cast<const char*>(InjectedWebGLScriptSource_js), sizeof(InjectedWebGLScriptSource_js));
-}
-#endif
-
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
void discardInjectedScriptsFor(DOMWindow*);
void releaseObjectGroup(const String& objectGroup);
-#if ENABLE(WEBGL)
- ScriptObject wrapWebGLRenderingContextForInstrumentation(const ScriptObject&);
-#endif
-
typedef bool (*InspectedStateAccessCheck)(ScriptState*);
InspectedStateAccessCheck inspectedStateAccessCheck() const { return m_inspectedStateAccessCheck; }
String injectedScriptSource();
ScriptObject createInjectedScript(const String& source, ScriptState*, int id);
-#if ENABLE(WEBGL)
- String injectedWebGLScriptSource();
-#endif
-
static bool canAccessInspectedWindow(ScriptState*);
static bool canAccessInspectedWorkerContext(ScriptState*);
{
}
-void InjectedScriptModule::ensureInjected(InjectedScriptManager& injectedScriptManager, ScriptState* scriptState)
+void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptManager, ScriptState* scriptState)
{
- InjectedScript injectedScript = injectedScriptManager.injectedScriptFor(scriptState);
+ InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(scriptState);
ASSERT(!injectedScript.hasNoValue());
if (injectedScript.hasNoValue())
return;
}
ScriptObject moduleObject(scriptState, resultValue);
- initialize(moduleObject, injectedScriptManager.inspectedStateAccessCheck());
+ initialize(moduleObject, injectedScriptManager->inspectedStateAccessCheck());
}
} // namespace WebCore
// a static factory method that would create a new instance of the class
// and call its ensureInjected() method immediately.
InjectedScriptModule(const String& name);
- void ensureInjected(InjectedScriptManager&, ScriptState*);
+ void ensureInjected(InjectedScriptManager*, ScriptState*);
};
#endif
--- /dev/null
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(INSPECTOR) && ENABLE(WEBGL)
+
+#include "InjectedScriptWebGLModule.h"
+
+#include "InjectedScript.h"
+#include "InjectedScriptManager.h"
+#include "InjectedWebGLScriptSource.h"
+#include "ScriptFunctionCall.h"
+#include "ScriptObject.h"
+
+namespace WebCore {
+
+InjectedScriptWebGLModule::InjectedScriptWebGLModule()
+ : InjectedScriptModule("InjectedScriptWebGLModule")
+{
+}
+
+InjectedScriptWebGLModule InjectedScriptWebGLModule::moduleForState(InjectedScriptManager* injectedScriptManager, ScriptState* scriptState)
+{
+ InjectedScriptWebGLModule result;
+ result.ensureInjected(injectedScriptManager, scriptState);
+ return result;
+}
+
+String InjectedScriptWebGLModule::source() const
+{
+ return String(reinterpret_cast<const char*>(InjectedWebGLScriptSource_js), sizeof(InjectedWebGLScriptSource_js));
+}
+
+ScriptObject InjectedScriptWebGLModule::wrapWebGLContext(const ScriptObject& glContext)
+{
+ ScriptFunctionCall function(injectedScriptObject(), "wrapWebGLContext");
+ function.appendArgument(glContext);
+ bool hadException = false;
+ ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException);
+ if (hadException || resultValue.hasNoValue() || !resultValue.isObject()) {
+ ASSERT_NOT_REACHED();
+ return ScriptObject();
+ }
+ return ScriptObject(glContext.scriptState(), resultValue);
+}
+
+void InjectedScriptWebGLModule::captureFrame(ErrorString* errorString, const String& contextId)
+{
+ ScriptFunctionCall function(injectedScriptObject(), "captureFrame");
+ function.appendArgument(contextId);
+ bool hadException = false;
+ callFunctionWithEvalEnabled(function, hadException);
+ ASSERT(!hadException);
+ if (hadException)
+ *errorString = "Internal error";
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR) && ENABLE(WEBGL)
--- /dev/null
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InjectedScriptWebGLModule_h
+#define InjectedScriptWebGLModule_h
+
+#include "InjectedScriptModule.h"
+#include "PlatformString.h"
+#include "ScriptState.h"
+
+namespace WebCore {
+
+class InjectedScriptManager;
+class ScriptObject;
+
+#if ENABLE(INSPECTOR) && ENABLE(WEBGL)
+
+class InjectedScriptWebGLModule : public InjectedScriptModule {
+public:
+ virtual String source() const;
+
+ static InjectedScriptWebGLModule moduleForState(InjectedScriptManager*, ScriptState*);
+
+ ScriptObject wrapWebGLContext(const ScriptObject& glContext);
+ void captureFrame(ErrorString*, const String& contextId);
+
+private:
+ InjectedScriptWebGLModule();
+};
+
+#endif
+
+} // namespace WebCore
+
+#endif
#include "InspectorWebGLAgent.h"
#include "InjectedScriptManager.h"
+#include "InjectedScriptWebGLModule.h"
#include "InspectorFrontend.h"
#include "InspectorState.h"
#include "InstrumentingAgents.h"
ScriptObject InspectorWebGLAgent::wrapWebGLRenderingContextForInstrumentation(const ScriptObject& glContext)
{
- return m_injectedScriptManager->wrapWebGLRenderingContextForInstrumentation(glContext);
+ if (glContext.hasNoValue()) {
+ ASSERT_NOT_REACHED();
+ return ScriptObject();
+ }
+ InjectedScriptWebGLModule module = InjectedScriptWebGLModule::moduleForState(m_injectedScriptManager, glContext.scriptState());
+ if (module.hasNoValue()) {
+ ASSERT_NOT_REACHED();
+ return ScriptObject();
+ }
+ return module.wrapWebGLContext(glContext);
}
} // namespace WebCore