[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
pfeldman at chromium.org
pfeldman at chromium.org
Sun Feb 20 22:54:42 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 417eb9392807f66a1da216e811baa08985a9cc2e
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 13 16:42:03 2011 +0000
2011-01-12 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: embed injected script into the backend.
https://bugs.webkit.org/show_bug.cgi?id=52312
InjectedScript belongs to the backend of the system and
should be exposed by means of protocol, not InjectedScriptAccess.
This patch makes injected script a part of the backend.
It introduces single manual generation step (xxd -i) that should be
automated by the build scripts for all the platforms.
* CMakeLists.txt:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSInjectedScriptHostCustom.cpp:
(WebCore::InjectedScriptHost::injectedScriptFor):
* bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
(WebCore::InjectedScriptHost::injectedScriptFor):
* inspector/InjectedScriptHost.cpp:
(WebCore::InjectedScriptHost::injectedScriptSource):
* inspector/InjectedScriptHost.h:
* inspector/Inspector.idl:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::restoreInspectorStateFromCookie):
* inspector/InspectorState.cpp:
(WebCore::InspectorState::InspectorState):
* inspector/InspectorState.h:
* inspector/front-end/InjectedScript.js: Removed.
* inspector/front-end/WebKit.qrc:
* inspector/front-end/inspector.html:
* inspector/front-end/inspector.js:
(WebInspector.doLoadedDone.propertyNamesCallback):
(WebInspector.doLoadedDone):
* inspector/xxd.pl: Added.
2011-01-12 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: embed injected script into the backend.
https://bugs.webkit.org/show_bug.cgi?id=52312
* WebKit.grd:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75715 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index f212fb8..983ea51 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -2099,6 +2099,15 @@ ADD_CUSTOM_COMMAND(
LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_DIR}/InspectorBackendDispatcher.cpp ${DERIVED_SOURCES_DIR}/InspectorFrontend.cpp)
+# Generate InjectedScriptSource.h
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${DERIVED_SOURCES_DIR}/InjectedScriptSource.h
+ MAIN_DEPENDENCY inspector/InjectedScriptSource.js
+ COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/inspector/xxd.pl InjectedScriptSource_js ${WEBCORE_DIR}/inspector/InjectedScriptSource.js ${DERIVED_SOURCES_DIR}/InjectedScriptSource.h
+ VERBATIM)
+LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_DIR}/InjectedScriptSource.h)
+
+
MAKE_HASH_TOOLS(${WEBCORE_DIR}/platform/ColorData)
LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_DIR}/ColorData.cpp)
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 98f5979..b1a1de6 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,45 @@
+2011-01-12 Pavel Feldman <pfeldman at chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: embed injected script into the backend.
+ https://bugs.webkit.org/show_bug.cgi?id=52312
+
+ InjectedScript belongs to the backend of the system and
+ should be exposed by means of protocol, not InjectedScriptAccess.
+ This patch makes injected script a part of the backend.
+ It introduces single manual generation step (xxd -i) that should be
+ automated by the build scripts for all the platforms.
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * WebCore.gyp/WebCore.gyp:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSInjectedScriptHostCustom.cpp:
+ (WebCore::InjectedScriptHost::injectedScriptFor):
+ * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+ (WebCore::InjectedScriptHost::injectedScriptFor):
+ * inspector/InjectedScriptHost.cpp:
+ (WebCore::InjectedScriptHost::injectedScriptSource):
+ * inspector/InjectedScriptHost.h:
+ * inspector/Inspector.idl:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::restoreInspectorStateFromCookie):
+ * inspector/InspectorState.cpp:
+ (WebCore::InspectorState::InspectorState):
+ * inspector/InspectorState.h:
+ * inspector/front-end/InjectedScript.js: Removed.
+ * inspector/front-end/WebKit.qrc:
+ * inspector/front-end/inspector.html:
+ * inspector/front-end/inspector.js:
+ (WebInspector.doLoadedDone.propertyNamesCallback):
+ (WebInspector.doLoadedDone):
+ * inspector/xxd.pl: Added.
+
2011-01-13 Mikhail Naganov <mnaganov at chromium.org>
Reviewed by Timothy Hatcher.
diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make
index ebb92b1..22f987d 100644
--- a/Source/WebCore/DerivedSources.make
+++ b/Source/WebCore/DerivedSources.make
@@ -866,6 +866,11 @@ INSPECTOR_GENERATOR_SCRIPTS = $(GENERATE_SCRIPTS) inspector/CodeGeneratorInspect
InspectorFrontend.h : Inspector.idl $(INSPECTOR_GENERATOR_SCRIPTS)
$(call generator_script, $(INSPECTOR_GENERATOR_SCRIPTS)) --outputDir . --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator Inspector $<
+all : InjectedScriptSource.h
+
+InjectedScriptSource.h : InjectedScriptSource.js
+ perl $(WebCore)/inspector/xxd.pl InjectedScriptSource_js $(WebCore)/inspector/InjectedScriptSource.js InjectedScriptSource.h
+
-include $(JS_DOM_HEADERS:.h=.dep)
ifeq ($(findstring BUILDING_WX,$(FEATURE_DEFINES)), BUILDING_WX)
diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am
index 4251fbe..83c543b 100644
--- a/Source/WebCore/GNUmakefile.am
+++ b/Source/WebCore/GNUmakefile.am
@@ -109,6 +109,7 @@ webcore_built_sources += \
DerivedSources/WebCore/HTMLEntityTable.cpp \
DerivedSources/WebCore/HTMLNames.cpp \
DerivedSources/WebCore/HTMLNames.h \
+ DerivedSources/WebCore/InjectedScriptSource.h \
DerivedSources/WebCore/InspectorBackendDispatcher.cpp \
DerivedSources/WebCore/InspectorBackendDispatcher.h \
DerivedSources/WebCore/InspectorFrontend.cpp \
@@ -4784,6 +4785,8 @@ DerivedSources/WebCore/InspectorFrontend.h: DerivedSources/WebCore/InspectorFron
DerivedSources/WebCore/InspectorFrontend.cpp: DerivedSources/WebCore/InspectorBackendStub.js
DerivedSources/WebCore/InspectorBackendStub.js: DerivedSources/WebCore/InspectorBackendDispatcher.h
DerivedSources/WebCore/InspectorBackendDispatcher.h: DerivedSources/WebCore/InspectorBackendDispatcher.cpp
+DerivedSources/WebCore/InjectedScriptSource.h: $(WebCore)/inspector/InjectedScriptSource.js
+ perl $(WebCore)/inspector/xxd.pl InjectedScriptSource_js $(WebCore)/inspector/InjectedScriptSource.js $(GENSOURCES_WEBCORE)/InjectedScriptSource.h
IDL_PATH := \
$(WebCore)/bindings/js \
diff --git a/Source/WebCore/WebCore.gyp/WebCore.gyp b/Source/WebCore/WebCore.gyp/WebCore.gyp
index b800cf3..282296c 100644
--- a/Source/WebCore/WebCore.gyp/WebCore.gyp
+++ b/Source/WebCore/WebCore.gyp/WebCore.gyp
@@ -333,6 +333,29 @@
]
},
{
+ 'target_name': 'injected_script_source',
+ 'type': 'none',
+ 'actions': [
+ {
+ 'action_name': 'generateInjectedScriptSource',
+ 'inputs': [
+ '../inspector/InjectedScriptSource.js',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedScriptSource.h',
+ ],
+ 'action': [
+ 'perl',
+ '../inspector/xxd.pl',
+ 'InjectedScriptSource_js',
+ '../inspector/InjectedScriptSource.js',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedScriptSource.h'
+ ],
+ 'message': 'Generating InjectedScriptSource.h from InjectedScriptSource.js',
+ },
+ ]
+ },
+ {
'target_name': 'webcore_bindings_sources',
'type': 'none',
'hard_dependency': 1,
@@ -723,6 +746,7 @@
'dependencies': [
'webcore_bindings_sources',
'inspector_protocol_sources',
+ 'injected_script_source',
'../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:pcre',
'../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf',
'<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index 83e55d4..ae96939 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -4638,7 +4638,6 @@
'inspector/front-end/ImageView.js',
'inspector/front-end/InspectorFrontendHostStub.js',
'inspector/front-end/InjectedFakeWorker.js',
- 'inspector/front-end/InjectedScript.js',
'inspector/front-end/InjectedScriptAccess.js',
'inspector/front-end/inspector.js',
'inspector/front-end/KeyboardShortcut.js',
diff --git a/Source/WebCore/WebCore.pro b/Source/WebCore/WebCore.pro
index 09a6e2a..39bb738 100644
--- a/Source/WebCore/WebCore.pro
+++ b/Source/WebCore/WebCore.pro
@@ -1932,6 +1932,7 @@ HEADERS += \
inspector/ConsoleMessage.h \
inspector/InjectedScript.h \
inspector/InjectedScriptHost.h \
+ inspector/InjectedScriptSource.h \
inspector/InspectorApplicationCacheAgent.h \
inspector/InspectorController.h \
inspector/InspectorCSSAgent.h \
diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
index bffc6d6..724d3cf 100755
--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -574,6 +574,10 @@
>
</File>
<File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\InjectedScriptSource.h"
+ >
+ </File>
+ <File
RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\JSAbstractWorker.cpp"
>
<FileConfiguration
@@ -65365,10 +65369,6 @@
>
</File>
<File
- RelativePath="..\inspector\front-end\InjectedScript.js"
- >
- </File>
- <File
RelativePath="..\inspector\front-end\InjectedScriptAccess.js"
>
</File>
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index c38f82d..e8fbb97 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1646,6 +1646,7 @@
7A1F2B52126C61B20006A7E6 /* InspectorClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */; };
7A24587B1021EAF4000A00AA /* InspectorDOMAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A2458791021EAF4000A00AA /* InspectorDOMAgent.cpp */; };
7A24587C1021EAF4000A00AA /* InspectorDOMAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A24587A1021EAF4000A00AA /* InspectorDOMAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 7A563F9612DF5C9100F4536D /* InjectedScriptSource.js in Sources */ = {isa = PBXBuildFile; fileRef = 7A563F9512DF5C9100F4536D /* InjectedScriptSource.js */; };
7A674BDB0F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */; };
7A674BDC0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */; };
7A74ECBA101839A600BF939E /* InspectorDOMStorageAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */; };
@@ -8049,6 +8050,8 @@
7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorClient.cpp; sourceTree = "<group>"; };
7A2458791021EAF4000A00AA /* InspectorDOMAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDOMAgent.cpp; sourceTree = "<group>"; };
7A24587A1021EAF4000A00AA /* InspectorDOMAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDOMAgent.h; sourceTree = "<group>"; };
+ 7A563E5412DE32B000F4536D /* InjectedScriptSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScriptSource.h; sourceTree = "<group>"; };
+ 7A563F9512DF5C9100F4536D /* InjectedScriptSource.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = InjectedScriptSource.js; sourceTree = "<group>"; };
7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroupLoadDeferrer.cpp; sourceTree = "<group>"; };
7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageGroupLoadDeferrer.h; sourceTree = "<group>"; };
7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDOMStorageAgent.cpp; sourceTree = "<group>"; };
@@ -12869,6 +12872,7 @@
1C5FAECA0DCFD8C900D58F78 /* Inspector */ = {
isa = PBXGroup;
children = (
+ 7A563E5412DE32B000F4536D /* InjectedScriptSource.h */,
4F707A9711EF679400ACDA69 /* InspectorBackendDispatcher.cpp */,
4F707A9811EF679400ACDA69 /* InspectorBackendDispatcher.h */,
4F4F5FFA11CBD2D200A186BF /* InspectorFrontend.cpp */,
@@ -12898,6 +12902,7 @@
7A0E76F610BF08ED00A0276E /* InjectedScriptHost.cpp */,
7A0E76F710BF08ED00A0276E /* InjectedScriptHost.h */,
7A0E76F810BF08ED00A0276E /* InjectedScriptHost.idl */,
+ 7A563F9512DF5C9100F4536D /* InjectedScriptSource.js */,
B885E8D211E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp */,
B885E8D311E06DD2009FFBF4 /* InspectorApplicationCacheAgent.h */,
7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */,
@@ -24976,6 +24981,7 @@
93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */,
E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
+ 7A563F9612DF5C9100F4536D /* InjectedScriptSource.js in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index de72dea..971098d 100644
--- a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -199,8 +199,7 @@ InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* scriptState)
if (!canAccessInspectedWindow(scriptState))
return InjectedScript();
- ASSERT(!m_injectedScriptSource.isEmpty());
- pair<long, ScriptObject> injectedScriptObject = injectScript(m_injectedScriptSource, scriptState);
+ pair<long, ScriptObject> injectedScriptObject = injectScript(injectedScriptSource(), scriptState);
globalObject->setInjectedScript(injectedScriptObject.second.jsObject());
InjectedScript result(injectedScriptObject.second);
m_idToInjectedScript.set(injectedScriptObject.first, result);
diff --git a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 81ad955..6bd5abb 100644
--- a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -241,8 +241,7 @@ InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScrip
if (!canAccessInspectedWindow(inspectedScriptState))
return InjectedScript();
- ASSERT(!m_injectedScriptSource.isEmpty());
- pair<long, ScriptObject> injectedScript = injectScript(m_injectedScriptSource, inspectedScriptState);
+ pair<long, ScriptObject> injectedScript = injectScript(injectedScriptSource(), inspectedScriptState);
InjectedScript result(injectedScript.second);
m_idToInjectedScript.set(injectedScript.first, result);
global->SetHiddenValue(key, injectedScript.second.v8Object());
diff --git a/Source/WebCore/inspector/InjectedScriptHost.cpp b/Source/WebCore/inspector/InjectedScriptHost.cpp
index a4a0c6f..8d6c8e7 100644
--- a/Source/WebCore/inspector/InjectedScriptHost.cpp
+++ b/Source/WebCore/inspector/InjectedScriptHost.cpp
@@ -30,6 +30,7 @@
#include "config.h"
#include "InjectedScriptHost.h"
+#include "InjectedScriptSource.h"
#include "InspectorDatabaseAgent.h"
#include "InspectorDOMStorageAgent.h"
@@ -182,6 +183,11 @@ InspectorFrontend* InjectedScriptHost::frontend()
return m_inspectorController->m_frontend.get();
}
+String InjectedScriptHost::injectedScriptSource()
+{
+ return String(reinterpret_cast<char*>(InjectedScriptSource_js), sizeof(InjectedScriptSource_js));
+}
+
pair<long, ScriptObject> InjectedScriptHost::injectScript(const String& source, ScriptState* scriptState)
{
long id = m_nextInjectedScriptId++;
diff --git a/Source/WebCore/inspector/InjectedScriptHost.h b/Source/WebCore/inspector/InjectedScriptHost.h
index 6b70f62..e9c09aa 100644
--- a/Source/WebCore/inspector/InjectedScriptHost.h
+++ b/Source/WebCore/inspector/InjectedScriptHost.h
@@ -58,9 +58,6 @@ public:
~InjectedScriptHost();
- String injectedScriptSource() { return m_injectedScriptSource; }
- void setInjectedScriptSource(const String& source) { m_injectedScriptSource = source; }
-
InspectorController* inspectorController() { return m_inspectorController; }
void disconnectController() { m_inspectorController = 0; }
@@ -96,11 +93,11 @@ private:
InjectedScriptHost(InspectorController* inspectorController);
InspectorDOMAgent* inspectorDOMAgent();
InspectorFrontend* frontend();
+ String injectedScriptSource();
ScriptObject createInjectedScript(const String& source, ScriptState* scriptState, long id);
void discardInjectedScript(ScriptState*);
InspectorController* m_inspectorController;
- String m_injectedScriptSource;
long m_nextInjectedScriptId;
long m_lastWorkerId;
typedef HashMap<long, InjectedScript> IdToInjectedScriptMap;
diff --git a/Source/WebCore/inspector/InjectedScriptSource.js b/Source/WebCore/inspector/InjectedScriptSource.js
new file mode 100644
index 0000000..90797fb
--- /dev/null
+++ b/Source/WebCore/inspector/InjectedScriptSource.js
@@ -0,0 +1,717 @@
+/*
+ * Copyright (C) 2007 Apple 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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.
+ */
+
+(function (InjectedScriptHost, inspectedWindow, injectedScriptId) {
+
+var InjectedScript = function()
+{
+ this._lastBoundObjectId = 1;
+ this._idToWrappedObject = {};
+ this._objectGroups = {};
+}
+
+InjectedScript.prototype = {
+ wrapObjectForConsole: function(object, canAccessInspectedWindow)
+ {
+ if (canAccessInspectedWindow)
+ return this._wrapObject(object, "console");
+ var result = {};
+ result.type = typeof object;
+ result.description = this._toString(object);
+ return result;
+ },
+
+ _wrapObject: function(object, objectGroupName, abbreviate)
+ {
+ try {
+ var objectId;
+ if (typeof object === "object" || typeof object === "function" || this._isHTMLAllCollection(object)) {
+ var id = this._lastBoundObjectId++;
+ this._idToWrappedObject[id] = object;
+
+ var group = this._objectGroups[objectGroupName];
+ if (!group) {
+ group = [];
+ this._objectGroups[objectGroupName] = group;
+ }
+ group.push(id);
+ objectId = this._serializeObjectId(id, objectGroupName);
+ }
+ return InjectedScript.RemoteObject.fromObject(object, objectId, abbreviate);
+ } catch (e) {
+ return InjectedScript.RemoteObject.fromObject("[ Exception: " + e.toString() + " ]");
+ }
+ },
+
+ _serializeObjectId: function(id, groupName)
+ {
+ return injectedScriptId + ":" + id + ":" + groupName;
+ },
+
+ _parseObjectId: function(objectId)
+ {
+ var tokens = objectId.split(":");
+ var parsedObjectId = {};
+ parsedObjectId.id = parseInt(tokens[1]);
+ parsedObjectId.groupName = tokens[2];
+ return parsedObjectId;
+ },
+
+ releaseWrapperObjectGroup: function(objectGroupName)
+ {
+ var group = this._objectGroups[objectGroupName];
+ if (!group)
+ return;
+ for (var i = 0; i < group.length; i++)
+ delete this._idToWrappedObject[group[i]];
+ delete this._objectGroups[objectGroupName];
+ },
+
+ dispatch: function(methodName, args)
+ {
+ var argsArray = eval("(" + args + ")");
+ var result = this[methodName].apply(this, argsArray);
+ if (typeof result === "undefined") {
+ inspectedWindow.console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName);
+ result = null;
+ }
+ return result;
+ },
+
+ getPrototypes: function(nodeId)
+ {
+ this.releaseWrapperObjectGroup("prototypes");
+ var node = this._nodeForId(nodeId);
+ if (!node)
+ return false;
+
+ var result = [];
+ var prototype = node;
+ do {
+ result.push(this._wrapObject(prototype, "prototypes"));
+ prototype = prototype.__proto__;
+ } while (prototype)
+ return result;
+ },
+
+ getProperties: function(objectId, ignoreHasOwnProperty, abbreviate)
+ {
+ var parsedObjectId = this._parseObjectId(objectId);
+ var object = this._objectForId(parsedObjectId);
+ if (!this._isDefined(object))
+ return false;
+ var properties = [];
+
+ var propertyNames = ignoreHasOwnProperty ? this._getPropertyNames(object) : Object.getOwnPropertyNames(object);
+ if (!ignoreHasOwnProperty && object.__proto__)
+ propertyNames.push("__proto__");
+
+ // Go over properties, prepare results.
+ for (var i = 0; i < propertyNames.length; ++i) {
+ var propertyName = propertyNames[i];
+
+ var property = {};
+ property.name = propertyName + "";
+ var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName);
+ if (!isGetter) {
+ try {
+ property.value = this._wrapObject(object[propertyName], parsedObjectId.groupName, abbreviate);
+ } catch(e) {
+ property.value = new InjectedScript.RemoteObject.fromException(e);
+ }
+ } else {
+ // FIXME: this should show something like "getter" (bug 16734).
+ property.value = new InjectedScript.RemoteObject.fromObject("\u2014"); // em dash
+ property.isGetter = true;
+ }
+ properties.push(property);
+ }
+ return properties;
+ },
+
+ setPropertyValue: function(objectId, propertyName, expression)
+ {
+ var parsedObjectId = this._parseObjectId(objectId);
+ var object = this._objectForId(parsedObjectId);
+ if (!this._isDefined(object))
+ return false;
+
+ var expressionLength = expression.length;
+ if (!expressionLength) {
+ delete object[propertyName];
+ return !(propertyName in object);
+ }
+
+ try {
+ // Surround the expression in parenthesis so the result of the eval is the result
+ // of the whole expression not the last potential sub-expression.
+
+ // There is a regression introduced here: eval is now happening against global object,
+ // not call frame while on a breakpoint.
+ // TODO: bring evaluation against call frame back.
+ var result = inspectedWindow.eval("(" + expression + ")");
+ // Store the result in the property.
+ object[propertyName] = result;
+ return true;
+ } catch(e) {
+ try {
+ var result = inspectedWindow.eval("\"" + expression.replace(/"/g, "\\\"") + "\"");
+ object[propertyName] = result;
+ return true;
+ } catch(e) {
+ return false;
+ }
+ }
+ },
+
+ _populatePropertyNames: function(object, resultSet)
+ {
+ for (var o = object; o; o = o.__proto__) {
+ try {
+ var names = Object.getOwnPropertyNames(o);
+ for (var i = 0; i < names.length; ++i)
+ resultSet[names[i]] = true;
+ } catch (e) {
+ }
+ }
+ },
+
+ _getPropertyNames: function(object, resultSet)
+ {
+ var propertyNameSet = {};
+ this._populatePropertyNames(object, propertyNameSet);
+ return Object.keys(propertyNameSet);
+ },
+
+ getCompletions: function(expression, includeInspectorCommandLineAPI, callFrameId)
+ {
+ var props = {};
+ try {
+ var expressionResult;
+ // Evaluate on call frame if call frame id is available.
+ if (typeof callFrameId === "number") {
+ var callFrame = this._callFrameForId(callFrameId);
+ if (!callFrame)
+ return props;
+ if (expression)
+ expressionResult = this._evaluateOn(callFrame.evaluate, callFrame, expression, true);
+ else {
+ // Evaluate into properties in scope of the selected call frame.
+ var scopeChain = callFrame.scopeChain;
+ for (var i = 0; i < scopeChain.length; ++i)
+ this._populatePropertyNames(scopeChain[i], props);
+ }
+ } else {
+ if (!expression)
+ expression = "this";
+ expressionResult = this._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false);
+ }
+ if (typeof expressionResult === "object")
+ this._populatePropertyNames(expressionResult, props);
+
+ if (includeInspectorCommandLineAPI) {
+ for (var prop in this._commandLineAPI)
+ props[prop] = true;
+ }
+ } catch(e) {
+ }
+ return props;
+ },
+
+ evaluate: function(expression, objectGroup)
+ {
+ return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup, false);
+ },
+
+ _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, isEvalOnCallFrame)
+ {
+ try {
+ return this._wrapObject(this._evaluateOn(evalFunction, object, expression, isEvalOnCallFrame), objectGroup);
+ } catch (e) {
+ return InjectedScript.RemoteObject.fromException(e);
+ }
+ },
+
+ _evaluateOn: function(evalFunction, object, expression, isEvalOnCallFrame)
+ {
+ // Only install command line api object for the time of evaluation.
+ // Surround the expression in with statements to inject our command line API so that
+ // the window object properties still take more precedent than our API functions.
+ inspectedWindow.console._commandLineAPI = this._commandLineAPI;
+
+ // We don't want local variables to be shadowed by global ones when evaluating on CallFrame.
+ if (!isEvalOnCallFrame)
+ expression = "with (window) {\n" + expression + "\n} ";
+ expression = "with (window ? window.console._commandLineAPI : {}) {\n" + expression + "\n}";
+ var value = evalFunction.call(object, expression);
+
+ delete inspectedWindow.console._commandLineAPI;
+
+ // When evaluating on call frame error is not thrown, but returned as a value.
+ if (this._type(value) === "error")
+ throw value.toString();
+
+ return value;
+ },
+
+ getNodeId: function(node)
+ {
+ return InjectedScriptHost.pushNodePathToFrontend(node, false, false);
+ },
+
+ callFrames: function()
+ {
+ var callFrame = InjectedScriptHost.currentCallFrame();
+ if (!callFrame)
+ return false;
+
+ injectedScript.releaseWrapperObjectGroup("backtrace");
+ var result = [];
+ var depth = 0;
+ do {
+ result.push(new InjectedScript.CallFrameProxy(depth++, callFrame));
+ callFrame = callFrame.caller;
+ } while (callFrame);
+ return result;
+ },
+
+ evaluateInCallFrame: function(callFrameId, code, objectGroup)
+ {
+ var callFrame = this._callFrameForId(callFrameId);
+ if (!callFrame)
+ return false;
+ return this._evaluateAndWrap(callFrame.evaluate, callFrame, code, objectGroup, true);
+ },
+
+ _callFrameForId: function(id)
+ {
+ var callFrame = InjectedScriptHost.currentCallFrame();
+ while (--id >= 0 && callFrame)
+ callFrame = callFrame.caller;
+ return callFrame;
+ },
+
+ _nodeForId: function(nodeId)
+ {
+ if (!nodeId)
+ return null;
+ return InjectedScriptHost.nodeForId(nodeId);
+ },
+
+ _objectForId: function(parsedObjectId)
+ {
+ return this._idToWrappedObject[parsedObjectId.id];
+ },
+
+ resolveNode: function(nodeId)
+ {
+ var node = this._nodeForId(nodeId);
+ if (!node)
+ return false;
+ // FIXME: receive the object group from client.
+ return this._wrapObject(node, "prototype");
+ },
+
+ getNodeProperties: function(nodeId, properties)
+ {
+ var node = this._nodeForId(nodeId);
+ if (!node)
+ return false;
+ var result = {};
+ for (var i = 0; i < properties.length; ++i)
+ result[properties[i]] = node[properties[i]];
+ return result;
+ },
+
+ pushNodeToFrontend: function(objectId)
+ {
+ var parsedObjectId = this._parseObjectId(objectId);
+ var object = this._objectForId(parsedObjectId);
+ if (!object || this._type(object) !== "node")
+ return false;
+ return InjectedScriptHost.pushNodePathToFrontend(object, false, false);
+ },
+
+ evaluateOnSelf: function(funcBody, args)
+ {
+ var func = window.eval("(" + funcBody + ")");
+ return func.apply(this, args || []);
+ },
+
+ _isDefined: function(object)
+ {
+ return object || this._isHTMLAllCollection(object);
+ },
+
+ _isHTMLAllCollection: function(object)
+ {
+ // document.all is reported as undefined, but we still want to process it.
+ return (typeof object === "undefined") && inspectedWindow.HTMLAllCollection && object instanceof inspectedWindow.HTMLAllCollection;
+ },
+
+ _type: function(obj)
+ {
+ if (obj === null)
+ return "null";
+
+ var type = typeof obj;
+ if (type !== "object" && type !== "function") {
+ // FIXME(33716): typeof document.all is always 'undefined'.
+ if (this._isHTMLAllCollection(obj))
+ return "array";
+ return type;
+ }
+
+ // If owning frame has navigated to somewhere else window properties will be undefined.
+ // In this case just return result of the typeof.
+ if (!inspectedWindow.document)
+ return type;
+
+ if (obj instanceof inspectedWindow.Node)
+ return (obj.nodeType === undefined ? type : "node");
+ if (obj instanceof inspectedWindow.String)
+ return "string";
+ if (obj instanceof inspectedWindow.Array)
+ return "array";
+ if (obj instanceof inspectedWindow.Boolean)
+ return "boolean";
+ if (obj instanceof inspectedWindow.Number)
+ return "number";
+ if (obj instanceof inspectedWindow.Date)
+ return "date";
+ if (obj instanceof inspectedWindow.RegExp)
+ return "regexp";
+ // FireBug's array detection.
+ if (isFinite(obj.length) && typeof obj.splice === "function")
+ return "array";
+ if (isFinite(obj.length) && typeof obj.callee === "function") // arguments.
+ return "array";
+ if (obj instanceof inspectedWindow.NodeList)
+ return "array";
+ if (obj instanceof inspectedWindow.HTMLCollection)
+ return "array";
+ if (obj instanceof inspectedWindow.Error)
+ return "error";
+ return type;
+ },
+
+ _describe: function(obj, abbreviated)
+ {
+ var type = this._type(obj);
+
+ switch (type) {
+ case "object":
+ case "node":
+ var result = InjectedScriptHost.internalConstructorName(obj);
+ if (result === "Object") {
+ // In Chromium DOM wrapper prototypes will have Object as their constructor name,
+ // get the real DOM wrapper name from the constructor property.
+ var constructorName = obj.constructor && obj.constructor.name;
+ if (constructorName)
+ return constructorName;
+ }
+ return result;
+ case "array":
+ var className = InjectedScriptHost.internalConstructorName(obj);
+ if (typeof obj.length === "number")
+ className += "[" + obj.length + "]";
+ return className;
+ case "string":
+ if (!abbreviated)
+ return obj;
+ if (obj.length > 100)
+ return "\"" + obj.substring(0, 100) + "\u2026\"";
+ return "\"" + obj + "\"";
+ case "function":
+ var objectText = this._toString(obj);
+ if (abbreviated)
+ objectText = /.*/.exec(objectText)[0].replace(/ +$/g, "");
+ return objectText;
+ default:
+ return this._toString(obj);
+ }
+ },
+
+ _toString: function(obj)
+ {
+ // We don't use String(obj) because inspectedWindow.String is undefined if owning frame navigated to another page.
+ return "" + obj;
+ },
+
+ _logEvent: function(event)
+ {
+ console.log(event.type, event);
+ },
+
+ _normalizeEventTypes: function(types)
+ {
+ if (typeof types === "undefined")
+ types = [ "mouse", "key", "load", "unload", "abort", "error", "select", "change", "submit", "reset", "focus", "blur", "resize", "scroll" ];
+ else if (typeof types === "string")
+ types = [ types ];
+
+ var result = [];
+ for (var i = 0; i < types.length; i++) {
+ if (types[i] === "mouse")
+ result.splice(0, 0, "mousedown", "mouseup", "click", "dblclick", "mousemove", "mouseover", "mouseout");
+ else if (types[i] === "key")
+ result.splice(0, 0, "keydown", "keyup", "keypress");
+ else
+ result.push(types[i]);
+ }
+ return result;
+ },
+
+ _inspectedNode: function(num)
+ {
+ var nodeId = InjectedScriptHost.inspectedNode(num);
+ return this._nodeForId(nodeId);
+ },
+
+ _bindToScript: function(func)
+ {
+ var args = Array.prototype.slice.call(arguments, 1);
+ function bound()
+ {
+ return func.apply(injectedScript, args.concat(Array.prototype.slice.call(arguments)));
+ }
+ bound.toString = function() {
+ return "bound: " + func;
+ };
+ return bound;
+ }
+}
+
+var injectedScript = new InjectedScript();
+
+InjectedScript.RemoteObject = function(objectId, type, description, hasChildren)
+{
+ this.objectId = objectId;
+ this.type = type;
+ this.description = description;
+ this.hasChildren = hasChildren;
+}
+
+InjectedScript.RemoteObject.fromException = function(e)
+{
+ return new InjectedScript.RemoteObject(null, "error", e.toString());
+}
+
+InjectedScript.RemoteObject.fromObject = function(object, objectId, abbreviate)
+{
+ var type = injectedScript._type(object);
+ var rawType = typeof object;
+ var hasChildren = (rawType === "object" && object !== null && (Object.getOwnPropertyNames(object).length || !!object.__proto__)) || rawType === "function";
+ var description = "";
+ try {
+ var description = injectedScript._describe(object, abbreviate);
+ return new InjectedScript.RemoteObject(objectId, type, description, hasChildren);
+ } catch (e) {
+ return InjectedScript.RemoteObject.fromException(e);
+ }
+}
+
+InjectedScript.CallFrameProxy = function(id, callFrame)
+{
+ this.id = id;
+ this.type = callFrame.type;
+ this.functionName = (this.type === "function" ? callFrame.functionName : "");
+ this.sourceID = callFrame.sourceID;
+ this.line = callFrame.line;
+ this.scopeChain = this._wrapScopeChain(callFrame);
+ this.worldId = injectedScriptId;
+}
+
+InjectedScript.CallFrameProxy.prototype = {
+ _wrapScopeChain: function(callFrame)
+ {
+ const GLOBAL_SCOPE = 0;
+ const LOCAL_SCOPE = 1;
+ const WITH_SCOPE = 2;
+ const CLOSURE_SCOPE = 3;
+ const CATCH_SCOPE = 4;
+
+ var scopeChain = callFrame.scopeChain;
+ var scopeChainProxy = [];
+ var foundLocalScope = false;
+ for (var i = 0; i < scopeChain.length; i++) {
+ var scopeType = callFrame.scopeType(i);
+ var scopeObject = scopeChain[i];
+ var scopeObjectProxy = injectedScript._wrapObject(scopeObject, "backtrace", true);
+
+ switch(scopeType) {
+ case LOCAL_SCOPE: {
+ foundLocalScope = true;
+ scopeObjectProxy.isLocal = true;
+ scopeObjectProxy.thisObject = injectedScript._wrapObject(callFrame.thisObject, "backtrace", true);
+ break;
+ }
+ case CLOSURE_SCOPE: {
+ scopeObjectProxy.isClosure = true;
+ break;
+ }
+ case WITH_SCOPE:
+ case CATCH_SCOPE: {
+ if (foundLocalScope && scopeObject instanceof inspectedWindow.Element)
+ scopeObjectProxy.isElement = true;
+ else if (foundLocalScope && scopeObject instanceof inspectedWindow.Document)
+ scopeObjectProxy.isDocument = true;
+ else
+ scopeObjectProxy.isWithBlock = true;
+ break;
+ }
+ }
+ scopeChainProxy.push(scopeObjectProxy);
+ }
+ return scopeChainProxy;
+ }
+}
+
+function CommandLineAPI()
+{
+ for (var i = 0; i < 5; ++i)
+ this.__defineGetter__("$" + i, injectedScript._bindToScript(injectedScript._inspectedNode, i));
+}
+
+CommandLineAPI.prototype = {
+ // Only add API functions here, private stuff should go to
+ // InjectedScript so that it is not suggested by the completion.
+ $: function()
+ {
+ return document.getElementById.apply(document, arguments)
+ },
+
+ $$: function()
+ {
+ return document.querySelectorAll.apply(document, arguments)
+ },
+
+ $x: function(xpath, context)
+ {
+ var nodes = [];
+ try {
+ var doc = context || document;
+ var results = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null);
+ var node;
+ while (node = results.iterateNext())
+ nodes.push(node);
+ } catch (e) {
+ }
+ return nodes;
+ },
+
+ dir: function()
+ {
+ return console.dir.apply(console, arguments)
+ },
+
+ dirxml: function()
+ {
+ return console.dirxml.apply(console, arguments)
+ },
+
+ keys: function(object)
+ {
+ return Object.keys(object);
+ },
+
+ values: function(object)
+ {
+ var result = [];
+ for (var key in object)
+ result.push(object[key]);
+ return result;
+ },
+
+ profile: function()
+ {
+ return console.profile.apply(console, arguments)
+ },
+
+ profileEnd: function()
+ {
+ return console.profileEnd.apply(console, arguments)
+ },
+
+ monitorEvents: function(object, types)
+ {
+ if (!object || !object.addEventListener || !object.removeEventListener)
+ return;
+ types = injectedScript._normalizeEventTypes(types);
+ for (var i = 0; i < types.length; ++i) {
+ object.removeEventListener(types[i], injectedScript._logEvent, false);
+ object.addEventListener(types[i], injectedScript._logEvent, false);
+ }
+ },
+
+ unmonitorEvents: function(object, types)
+ {
+ if (!object || !object.addEventListener || !object.removeEventListener)
+ return;
+ types = injectedScript._normalizeEventTypes(types);
+ for (var i = 0; i < types.length; ++i)
+ object.removeEventListener(types[i], injectedScript._logEvent, false);
+ },
+
+ inspect: function(object)
+ {
+ if (arguments.length === 0)
+ return;
+
+ inspectedWindow.console.log(object);
+ if (injectedScript._type(object) === "node")
+ InjectedScriptHost.pushNodePathToFrontend(object, false, true);
+ else {
+ switch (injectedScript._describe(object)) {
+ case "Database":
+ InjectedScriptHost.selectDatabase(object);
+ break;
+ case "Storage":
+ InjectedScriptHost.selectDOMStorage(object);
+ break;
+ }
+ }
+ },
+
+ copy: function(object)
+ {
+ if (injectedScript._type(object) === "node")
+ object = object.outerHTML;
+ InjectedScriptHost.copyText(object);
+ },
+
+ clear: function()
+ {
+ InjectedScriptHost.clearConsoleMessages();
+ }
+}
+
+injectedScript._commandLineAPI = new CommandLineAPI();
+return injectedScript;
+})
+
diff --git a/Source/WebCore/inspector/Inspector.idl b/Source/WebCore/inspector/Inspector.idl
index ed00cc7..87b38c2 100644
--- a/Source/WebCore/inspector/Inspector.idl
+++ b/Source/WebCore/inspector/Inspector.idl
@@ -37,7 +37,6 @@ module core {
///////////////////////////////////////////////////////////////////////
// HUGE FIXME: we need to expose InjectedScript methods here. Or document InjectedScript capabilities.
- [domain=Inspector] void setInjectedScriptSource(in String scriptSource);
[domain=Inspector] void dispatchOnInjectedScript(in long injectedScriptId, in String methodName, in String arguments, out Value result, out boolean isException);
[domain=Inspector] void addScriptToEvaluateOnLoad(in String scriptSource);
[domain=Inspector] void removeAllScriptsToEvaluateOnLoad();
diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp
index ee1536f..20da731 100644
--- a/Source/WebCore/inspector/InspectorController.cpp
+++ b/Source/WebCore/inspector/InspectorController.cpp
@@ -230,10 +230,6 @@ void InspectorController::restoreInspectorStateFromCookie(const String& inspecto
{
m_state->restoreFromInspectorCookie(inspectorStateCookie);
- String injectedScriptSource = m_state->getString(InspectorState::injectedScriptSource);
- if (!injectedScriptSource.isEmpty())
- injectedScriptHost()->setInjectedScriptSource(injectedScriptSource);
-
if (!m_frontend)
connectFrontend();
@@ -1342,12 +1338,6 @@ bool InspectorController::hasXHRBreakpoint(const String& url, String* breakpoint
#endif
-void InspectorController::setInjectedScriptSource(const String& source)
-{
- injectedScriptHost()->setInjectedScriptSource(source);
- m_state->setString(InspectorState::injectedScriptSource, source);
-}
-
void InspectorController::dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException)
{
if (!m_frontend)
diff --git a/Source/WebCore/inspector/InspectorState.cpp b/Source/WebCore/inspector/InspectorState.cpp
index 591eedd..0865648 100644
--- a/Source/WebCore/inspector/InspectorState.cpp
+++ b/Source/WebCore/inspector/InspectorState.cpp
@@ -50,7 +50,6 @@ InspectorState::InspectorState(InspectorClient* client)
registerBoolean(consoleMessagesEnabled, false, "consoleMessagesEnabled", String());
registerBoolean(userInitiatedProfiling, false, "userInitiatedProfiling", String());
registerObject(stickyBreakpoints, String(), String());
- registerString(injectedScriptSource, String(), String(), String());
}
void InspectorState::restoreFromInspectorCookie(const String& json)
diff --git a/Source/WebCore/inspector/InspectorState.h b/Source/WebCore/inspector/InspectorState.h
index 56ab507..4f57da7 100644
--- a/Source/WebCore/inspector/InspectorState.h
+++ b/Source/WebCore/inspector/InspectorState.h
@@ -56,7 +56,6 @@ public:
consoleMessagesEnabled,
userInitiatedProfiling,
stickyBreakpoints,
- injectedScriptSource,
lastPropertyId
};
diff --git a/Source/WebCore/inspector/front-end/InjectedScript.js b/Source/WebCore/inspector/front-end/InjectedScript.js
deleted file mode 100644
index fb6b796..0000000
--- a/Source/WebCore/inspector/front-end/InjectedScript.js
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
- * Copyright (C) 2007 Apple 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:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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.
- */
-
-var injectedScriptConstructor = (function (InjectedScriptHost, inspectedWindow, injectedScriptId) {
-
-var InjectedScript = function()
-{
- this._lastBoundObjectId = 1;
- this._idToWrappedObject = {};
- this._objectGroups = {};
-}
-
-InjectedScript.prototype = {
- wrapObjectForConsole: function(object, canAccessInspectedWindow)
- {
- if (canAccessInspectedWindow)
- return this._wrapObject(object, "console");
- var result = {};
- result.type = typeof object;
- result.description = this._toString(object);
- return result;
- },
-
- _wrapObject: function(object, objectGroupName, abbreviate)
- {
- try {
- var objectId;
- if (typeof object === "object" || typeof object === "function" || this._isHTMLAllCollection(object)) {
- var id = this._lastBoundObjectId++;
- this._idToWrappedObject[id] = object;
-
- var group = this._objectGroups[objectGroupName];
- if (!group) {
- group = [];
- this._objectGroups[objectGroupName] = group;
- }
- group.push(id);
- objectId = this._serializeObjectId(id, objectGroupName);
- }
- return InjectedScript.RemoteObject.fromObject(object, objectId, abbreviate);
- } catch (e) {
- return InjectedScript.RemoteObject.fromObject("[ Exception: " + e.toString() + " ]");
- }
- },
-
- _serializeObjectId: function(id, groupName)
- {
- return injectedScriptId + ":" + id + ":" + groupName;
- },
-
- _parseObjectId: function(objectId)
- {
- var tokens = objectId.split(":");
- var parsedObjectId = {};
- parsedObjectId.id = parseInt(tokens[1]);
- parsedObjectId.groupName = tokens[2];
- return parsedObjectId;
- },
-
- releaseWrapperObjectGroup: function(objectGroupName)
- {
- var group = this._objectGroups[objectGroupName];
- if (!group)
- return;
- for (var i = 0; i < group.length; i++)
- delete this._idToWrappedObject[group[i]];
- delete this._objectGroups[objectGroupName];
- },
-
- dispatch: function(methodName, args)
- {
- var argsArray = eval("(" + args + ")");
- var result = this[methodName].apply(this, argsArray);
- if (typeof result === "undefined") {
- inspectedWindow.console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName);
- result = null;
- }
- return result;
- },
-
- getPrototypes: function(nodeId)
- {
- this.releaseWrapperObjectGroup("prototypes");
- var node = this._nodeForId(nodeId);
- if (!node)
- return false;
-
- var result = [];
- var prototype = node;
- do {
- result.push(this._wrapObject(prototype, "prototypes"));
- prototype = prototype.__proto__;
- } while (prototype)
- return result;
- },
-
- getProperties: function(objectId, ignoreHasOwnProperty, abbreviate)
- {
- var parsedObjectId = this._parseObjectId(objectId);
- var object = this._objectForId(parsedObjectId);
- if (!this._isDefined(object))
- return false;
- var properties = [];
-
- var propertyNames = ignoreHasOwnProperty ? this._getPropertyNames(object) : Object.getOwnPropertyNames(object);
- if (!ignoreHasOwnProperty && object.__proto__)
- propertyNames.push("__proto__");
-
- // Go over properties, prepare results.
- for (var i = 0; i < propertyNames.length; ++i) {
- var propertyName = propertyNames[i];
-
- var property = {};
- property.name = propertyName + "";
- var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName);
- if (!isGetter) {
- try {
- property.value = this._wrapObject(object[propertyName], parsedObjectId.groupName, abbreviate);
- } catch(e) {
- property.value = new InjectedScript.RemoteObject.fromException(e);
- }
- } else {
- // FIXME: this should show something like "getter" (bug 16734).
- property.value = new InjectedScript.RemoteObject.fromObject("\u2014"); // em dash
- property.isGetter = true;
- }
- properties.push(property);
- }
- return properties;
- },
-
- setPropertyValue: function(objectId, propertyName, expression)
- {
- var parsedObjectId = this._parseObjectId(objectId);
- var object = this._objectForId(parsedObjectId);
- if (!this._isDefined(object))
- return false;
-
- var expressionLength = expression.length;
- if (!expressionLength) {
- delete object[propertyName];
- return !(propertyName in object);
- }
-
- try {
- // Surround the expression in parenthesis so the result of the eval is the result
- // of the whole expression not the last potential sub-expression.
-
- // There is a regression introduced here: eval is now happening against global object,
- // not call frame while on a breakpoint.
- // TODO: bring evaluation against call frame back.
- var result = inspectedWindow.eval("(" + expression + ")");
- // Store the result in the property.
- object[propertyName] = result;
- return true;
- } catch(e) {
- try {
- var result = inspectedWindow.eval("\"" + expression.replace(/"/g, "\\\"") + "\"");
- object[propertyName] = result;
- return true;
- } catch(e) {
- return false;
- }
- }
- },
-
- _populatePropertyNames: function(object, resultSet)
- {
- for (var o = object; o; o = o.__proto__) {
- try {
- var names = Object.getOwnPropertyNames(o);
- for (var i = 0; i < names.length; ++i)
- resultSet[names[i]] = true;
- } catch (e) {
- }
- }
- },
-
- _getPropertyNames: function(object, resultSet)
- {
- var propertyNameSet = {};
- this._populatePropertyNames(object, propertyNameSet);
- return Object.keys(propertyNameSet);
- },
-
- getCompletions: function(expression, includeInspectorCommandLineAPI, callFrameId)
- {
- var props = {};
- try {
- var expressionResult;
- // Evaluate on call frame if call frame id is available.
- if (typeof callFrameId === "number") {
- var callFrame = this._callFrameForId(callFrameId);
- if (!callFrame)
- return props;
- if (expression)
- expressionResult = this._evaluateOn(callFrame.evaluate, callFrame, expression, true);
- else {
- // Evaluate into properties in scope of the selected call frame.
- var scopeChain = callFrame.scopeChain;
- for (var i = 0; i < scopeChain.length; ++i)
- this._populatePropertyNames(scopeChain[i], props);
- }
- } else {
- if (!expression)
- expression = "this";
- expressionResult = this._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false);
- }
- if (typeof expressionResult === "object")
- this._populatePropertyNames(expressionResult, props);
-
- if (includeInspectorCommandLineAPI) {
- for (var prop in this._commandLineAPI)
- props[prop] = true;
- }
- } catch(e) {
- }
- return props;
- },
-
- evaluate: function(expression, objectGroup)
- {
- return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup, false);
- },
-
- _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, isEvalOnCallFrame)
- {
- try {
- return this._wrapObject(this._evaluateOn(evalFunction, object, expression, isEvalOnCallFrame), objectGroup);
- } catch (e) {
- return InjectedScript.RemoteObject.fromException(e);
- }
- },
-
- _evaluateOn: function(evalFunction, object, expression, isEvalOnCallFrame)
- {
- // Only install command line api object for the time of evaluation.
- // Surround the expression in with statements to inject our command line API so that
- // the window object properties still take more precedent than our API functions.
- inspectedWindow.console._commandLineAPI = this._commandLineAPI;
-
- // We don't want local variables to be shadowed by global ones when evaluating on CallFrame.
- if (!isEvalOnCallFrame)
- expression = "with (window) {\n" + expression + "\n} ";
- expression = "with (window ? window.console._commandLineAPI : {}) {\n" + expression + "\n}";
- var value = evalFunction.call(object, expression);
-
- delete inspectedWindow.console._commandLineAPI;
-
- // When evaluating on call frame error is not thrown, but returned as a value.
- if (this._type(value) === "error")
- throw value.toString();
-
- return value;
- },
-
- getNodeId: function(node)
- {
- return InjectedScriptHost.pushNodePathToFrontend(node, false, false);
- },
-
- callFrames: function()
- {
- var callFrame = InjectedScriptHost.currentCallFrame();
- if (!callFrame)
- return false;
-
- injectedScript.releaseWrapperObjectGroup("backtrace");
- var result = [];
- var depth = 0;
- do {
- result.push(new InjectedScript.CallFrameProxy(depth++, callFrame));
- callFrame = callFrame.caller;
- } while (callFrame);
- return result;
- },
-
- evaluateInCallFrame: function(callFrameId, code, objectGroup)
- {
- var callFrame = this._callFrameForId(callFrameId);
- if (!callFrame)
- return false;
- return this._evaluateAndWrap(callFrame.evaluate, callFrame, code, objectGroup, true);
- },
-
- _callFrameForId: function(id)
- {
- var callFrame = InjectedScriptHost.currentCallFrame();
- while (--id >= 0 && callFrame)
- callFrame = callFrame.caller;
- return callFrame;
- },
-
- _nodeForId: function(nodeId)
- {
- if (!nodeId)
- return null;
- return InjectedScriptHost.nodeForId(nodeId);
- },
-
- _objectForId: function(parsedObjectId)
- {
- return this._idToWrappedObject[parsedObjectId.id];
- },
-
- resolveNode: function(nodeId)
- {
- var node = this._nodeForId(nodeId);
- if (!node)
- return false;
- // FIXME: receive the object group from client.
- return this._wrapObject(node, "prototype");
- },
-
- getNodeProperties: function(nodeId, properties)
- {
- var node = this._nodeForId(nodeId);
- if (!node)
- return false;
- var result = {};
- for (var i = 0; i < properties.length; ++i)
- result[properties[i]] = node[properties[i]];
- return result;
- },
-
- pushNodeToFrontend: function(objectId)
- {
- var parsedObjectId = this._parseObjectId(objectId);
- var object = this._objectForId(parsedObjectId);
- if (!object || this._type(object) !== "node")
- return false;
- return InjectedScriptHost.pushNodePathToFrontend(object, false, false);
- },
-
- evaluateOnSelf: function(funcBody, args)
- {
- var func = window.eval("(" + funcBody + ")");
- return func.apply(this, args || []);
- },
-
- _isDefined: function(object)
- {
- return object || this._isHTMLAllCollection(object);
- },
-
- _isHTMLAllCollection: function(object)
- {
- // document.all is reported as undefined, but we still want to process it.
- return (typeof object === "undefined") && inspectedWindow.HTMLAllCollection && object instanceof inspectedWindow.HTMLAllCollection;
- },
-
- _type: function(obj)
- {
- if (obj === null)
- return "null";
-
- var type = typeof obj;
- if (type !== "object" && type !== "function") {
- // FIXME(33716): typeof document.all is always 'undefined'.
- if (this._isHTMLAllCollection(obj))
- return "array";
- return type;
- }
-
- // If owning frame has navigated to somewhere else window properties will be undefined.
- // In this case just return result of the typeof.
- if (!inspectedWindow.document)
- return type;
-
- if (obj instanceof inspectedWindow.Node)
- return (obj.nodeType === undefined ? type : "node");
- if (obj instanceof inspectedWindow.String)
- return "string";
- if (obj instanceof inspectedWindow.Array)
- return "array";
- if (obj instanceof inspectedWindow.Boolean)
- return "boolean";
- if (obj instanceof inspectedWindow.Number)
- return "number";
- if (obj instanceof inspectedWindow.Date)
- return "date";
- if (obj instanceof inspectedWindow.RegExp)
- return "regexp";
- // FireBug's array detection.
- if (isFinite(obj.length) && typeof obj.splice === "function")
- return "array";
- if (isFinite(obj.length) && typeof obj.callee === "function") // arguments.
- return "array";
- if (obj instanceof inspectedWindow.NodeList)
- return "array";
- if (obj instanceof inspectedWindow.HTMLCollection)
- return "array";
- if (obj instanceof inspectedWindow.Error)
- return "error";
- return type;
- },
-
- _describe: function(obj, abbreviated)
- {
- var type = this._type(obj);
-
- switch (type) {
- case "object":
- case "node":
- var result = InjectedScriptHost.internalConstructorName(obj);
- if (result === "Object") {
- // In Chromium DOM wrapper prototypes will have Object as their constructor name,
- // get the real DOM wrapper name from the constructor property.
- var constructorName = obj.constructor && obj.constructor.name;
- if (constructorName)
- return constructorName;
- }
- return result;
- case "array":
- var className = InjectedScriptHost.internalConstructorName(obj);
- if (typeof obj.length === "number")
- className += "[" + obj.length + "]";
- return className;
- case "string":
- if (!abbreviated)
- return obj;
- if (obj.length > 100)
- return "\"" + obj.substring(0, 100) + "\u2026\"";
- return "\"" + obj + "\"";
- case "function":
- var objectText = this._toString(obj);
- if (abbreviated)
- objectText = /.*/.exec(objectText)[0].replace(/ +$/g, "");
- return objectText;
- default:
- return this._toString(obj);
- }
- },
-
- _toString: function(obj)
- {
- // We don't use String(obj) because inspectedWindow.String is undefined if owning frame navigated to another page.
- return "" + obj;
- },
-
- _logEvent: function(event)
- {
- console.log(event.type, event);
- },
-
- _normalizeEventTypes: function(types)
- {
- if (typeof types === "undefined")
- types = [ "mouse", "key", "load", "unload", "abort", "error", "select", "change", "submit", "reset", "focus", "blur", "resize", "scroll" ];
- else if (typeof types === "string")
- types = [ types ];
-
- var result = [];
- for (var i = 0; i < types.length; i++) {
- if (types[i] === "mouse")
- result.splice(0, 0, "mousedown", "mouseup", "click", "dblclick", "mousemove", "mouseover", "mouseout");
- else if (types[i] === "key")
- result.splice(0, 0, "keydown", "keyup", "keypress");
- else
- result.push(types[i]);
- }
- return result;
- },
-
- _inspectedNode: function(num)
- {
- var nodeId = InjectedScriptHost.inspectedNode(num);
- return this._nodeForId(nodeId);
- },
-
- _bindToScript: function(func)
- {
- var args = Array.prototype.slice.call(arguments, 1);
- function bound()
- {
- return func.apply(injectedScript, args.concat(Array.prototype.slice.call(arguments)));
- }
- bound.toString = function() {
- return "bound: " + func;
- };
- return bound;
- }
-}
-
-var injectedScript = new InjectedScript();
-
-InjectedScript.RemoteObject = function(objectId, type, description, hasChildren)
-{
- this.objectId = objectId;
- this.type = type;
- this.description = description;
- this.hasChildren = hasChildren;
-}
-
-InjectedScript.RemoteObject.fromException = function(e)
-{
- return new InjectedScript.RemoteObject(null, "error", e.toString());
-}
-
-InjectedScript.RemoteObject.fromObject = function(object, objectId, abbreviate)
-{
- var type = injectedScript._type(object);
- var rawType = typeof object;
- var hasChildren = (rawType === "object" && object !== null && (Object.getOwnPropertyNames(object).length || !!object.__proto__)) || rawType === "function";
- var description = "";
- try {
- var description = injectedScript._describe(object, abbreviate);
- return new InjectedScript.RemoteObject(objectId, type, description, hasChildren);
- } catch (e) {
- return InjectedScript.RemoteObject.fromException(e);
- }
-}
-
-InjectedScript.CallFrameProxy = function(id, callFrame)
-{
- this.id = id;
- this.type = callFrame.type;
- this.functionName = (this.type === "function" ? callFrame.functionName : "");
- this.sourceID = callFrame.sourceID;
- this.line = callFrame.line;
- this.scopeChain = this._wrapScopeChain(callFrame);
- this.worldId = injectedScriptId;
-}
-
-InjectedScript.CallFrameProxy.prototype = {
- _wrapScopeChain: function(callFrame)
- {
- const GLOBAL_SCOPE = 0;
- const LOCAL_SCOPE = 1;
- const WITH_SCOPE = 2;
- const CLOSURE_SCOPE = 3;
- const CATCH_SCOPE = 4;
-
- var scopeChain = callFrame.scopeChain;
- var scopeChainProxy = [];
- var foundLocalScope = false;
- for (var i = 0; i < scopeChain.length; i++) {
- var scopeType = callFrame.scopeType(i);
- var scopeObject = scopeChain[i];
- var scopeObjectProxy = injectedScript._wrapObject(scopeObject, "backtrace", true);
-
- switch(scopeType) {
- case LOCAL_SCOPE: {
- foundLocalScope = true;
- scopeObjectProxy.isLocal = true;
- scopeObjectProxy.thisObject = injectedScript._wrapObject(callFrame.thisObject, "backtrace", true);
- break;
- }
- case CLOSURE_SCOPE: {
- scopeObjectProxy.isClosure = true;
- break;
- }
- case WITH_SCOPE:
- case CATCH_SCOPE: {
- if (foundLocalScope && scopeObject instanceof inspectedWindow.Element)
- scopeObjectProxy.isElement = true;
- else if (foundLocalScope && scopeObject instanceof inspectedWindow.Document)
- scopeObjectProxy.isDocument = true;
- else
- scopeObjectProxy.isWithBlock = true;
- break;
- }
- }
- scopeChainProxy.push(scopeObjectProxy);
- }
- return scopeChainProxy;
- }
-}
-
-function CommandLineAPI()
-{
- for (var i = 0; i < 5; ++i)
- this.__defineGetter__("$" + i, injectedScript._bindToScript(injectedScript._inspectedNode, i));
-}
-
-CommandLineAPI.prototype = {
- // Only add API functions here, private stuff should go to
- // InjectedScript so that it is not suggested by the completion.
- $: function()
- {
- return document.getElementById.apply(document, arguments)
- },
-
- $$: function()
- {
- return document.querySelectorAll.apply(document, arguments)
- },
-
- $x: function(xpath, context)
- {
- var nodes = [];
- try {
- var doc = context || document;
- var results = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null);
- var node;
- while (node = results.iterateNext())
- nodes.push(node);
- } catch (e) {
- }
- return nodes;
- },
-
- dir: function()
- {
- return console.dir.apply(console, arguments)
- },
-
- dirxml: function()
- {
- return console.dirxml.apply(console, arguments)
- },
-
- keys: function(object)
- {
- return Object.keys(object);
- },
-
- values: function(object)
- {
- var result = [];
- for (var key in object)
- result.push(object[key]);
- return result;
- },
-
- profile: function()
- {
- return console.profile.apply(console, arguments)
- },
-
- profileEnd: function()
- {
- return console.profileEnd.apply(console, arguments)
- },
-
- monitorEvents: function(object, types)
- {
- if (!object || !object.addEventListener || !object.removeEventListener)
- return;
- types = injectedScript._normalizeEventTypes(types);
- for (var i = 0; i < types.length; ++i) {
- object.removeEventListener(types[i], injectedScript._logEvent, false);
- object.addEventListener(types[i], injectedScript._logEvent, false);
- }
- },
-
- unmonitorEvents: function(object, types)
- {
- if (!object || !object.addEventListener || !object.removeEventListener)
- return;
- types = injectedScript._normalizeEventTypes(types);
- for (var i = 0; i < types.length; ++i)
- object.removeEventListener(types[i], injectedScript._logEvent, false);
- },
-
- inspect: function(object)
- {
- if (arguments.length === 0)
- return;
-
- inspectedWindow.console.log(object);
- if (injectedScript._type(object) === "node")
- InjectedScriptHost.pushNodePathToFrontend(object, false, true);
- else {
- switch (injectedScript._describe(object)) {
- case "Database":
- InjectedScriptHost.selectDatabase(object);
- break;
- case "Storage":
- InjectedScriptHost.selectDOMStorage(object);
- break;
- }
- }
- },
-
- copy: function(object)
- {
- if (injectedScript._type(object) === "node")
- object = object.outerHTML;
- InjectedScriptHost.copyText(object);
- },
-
- clear: function()
- {
- InjectedScriptHost.clearConsoleMessages();
- }
-}
-
-injectedScript._commandLineAPI = new CommandLineAPI();
-return injectedScript;
-});
diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc
index c1008ad..80a6533 100644
--- a/Source/WebCore/inspector/front-end/WebKit.qrc
+++ b/Source/WebCore/inspector/front-end/WebKit.qrc
@@ -51,7 +51,6 @@
<file>HelpScreen.js</file>
<file>ImageView.js</file>
<file>InjectedFakeWorker.js</file>
- <file>InjectedScript.js</file>
<file>InjectedScriptAccess.js</file>
<file>inspector.js</file>
<file>InspectorFrontendHostStub.js</file>
diff --git a/Source/WebCore/inspector/front-end/inspector.html b/Source/WebCore/inspector/front-end/inspector.html
index e1590f2..44f096f 100644
--- a/Source/WebCore/inspector/front-end/inspector.html
+++ b/Source/WebCore/inspector/front-end/inspector.html
@@ -142,7 +142,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<script type="text/javascript" src="HeapSnapshotView.js"></script>
<script type="text/javascript" src="DebuggerModel.js"></script>
<script type="text/javascript" src="DOMAgent.js"></script>
- <script type="text/javascript" src="InjectedScript.js"></script>
<script type="text/javascript" src="InjectedScriptAccess.js"></script>
<script type="text/javascript" src="TimelineAgent.js"></script>
<script type="text/javascript" src="TimelinePanel.js"></script>
diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js
index b1f0c78..681fc9e 100644
--- a/Source/WebCore/inspector/front-end/inspector.js
+++ b/Source/WebCore/inspector/front-end/inspector.js
@@ -492,7 +492,6 @@ WebInspector.loaded = function()
WebInspector.doLoadedDone = function()
{
- InspectorBackend.setInjectedScriptSource("(" + injectedScriptConstructor + ");");
InspectorFrontendHost.loaded();
var platform = WebInspector.platform;
@@ -618,7 +617,6 @@ WebInspector.doLoadedDone = function()
{
WebInspector.cssNameCompletions = new WebInspector.CSSCompletions(names);
}
-
// As a DOMAgent method, this needs to happen after the frontend has loaded and the agent is available.
InspectorBackend.getSupportedCSSProperties(propertyNamesCallback);
}
diff --git a/Source/WebCore/inspector/xxd.pl b/Source/WebCore/inspector/xxd.pl
new file mode 100644
index 0000000..42cf4a2
--- /dev/null
+++ b/Source/WebCore/inspector/xxd.pl
@@ -0,0 +1,45 @@
+#! /usr/bin/perl
+
+# Copyright (C) 2010 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.
+#
+
+$varname = shift;
+$fname = shift;
+$output = shift;
+
+open($input, '<', $fname) or die "Can't open file for read: $fname $!";
+$/ = undef;
+$text = <$input>;
+close($input);
+
+$text = join(', ', map('0x' . unpack("H*", $_), split(undef, $text)));
+
+open($output, '>', $output) or die "Can't open file for write: $output $!";
+print $output "unsigned char $varname\[\] = {\n$text\n};\n";
+close($output);
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 91ca301..6eacddf 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,12 @@
+2011-01-12 Pavel Feldman <pfeldman at chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: embed injected script into the backend.
+ https://bugs.webkit.org/show_bug.cgi?id=52312
+
+ * WebKit.grd:
+
2011-01-12 Mihai Parparita <mihaip at chromium.org>
Reviewed by David Levin.
diff --git a/WebKit/chromium/WebKit.grd b/WebKit/chromium/WebKit.grd
index ab89640..1650e8c 100644
--- a/WebKit/chromium/WebKit.grd
+++ b/WebKit/chromium/WebKit.grd
@@ -10,7 +10,6 @@
<release seq="1">
<includes>
<include name="IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS" file="..\..\Source\WebCore\bindings\v8\DebuggerScript.js" type="BINDATA"/>
- <include name="IDR_DEVTOOLS_INJECT_WEBKIT_JS" file="..\..\Source\WebCore\inspector\front-end\InjectedScript.js" type="BINDATA"/>
</includes>
</release>
</grit>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list