[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
yurys at chromium.org
yurys at chromium.org
Wed Dec 22 11:13:45 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit c61b5739664fbeff7611ddc2063aa83d205dac17
Author: yurys at chromium.org <yurys at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jul 15 15:23:19 2010 +0000
2010-07-15 Yury Semikhatsky <yurys at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: pass all parameters to WebInspector.addConsoleMessage as a single payload object
https://bugs.webkit.org/show_bug.cgi?id=42345
This refactoring is covered by existing console tests.
* bindings/js/ScriptArray.cpp:
(WebCore::ScriptArray::set):
* bindings/js/ScriptArray.h:
(WebCore::ScriptArray::ScriptArray):
(WebCore::ScriptArray::jsArray):
* bindings/v8/ScriptArray.cpp:
(WebCore::ScriptArray::set):
* bindings/v8/ScriptArray.h:
(WebCore::ScriptArray::ScriptArray):
(WebCore::ScriptArray::~ScriptArray):
* inspector/ConsoleMessage.cpp:
(WebCore::ConsoleMessage::addToFrontend):
* inspector/InspectorFrontend.cpp:
(WebCore::InspectorFrontend::addConsoleMessage):
* inspector/InspectorFrontend.h:
* inspector/front-end/ConsoleView.js:
(WebInspector.ConsoleView.prototype.updateMessageRepeatCount):
(WebInspector.ConsoleMessage):
(WebInspector.ConsoleMessage.createTextMessage):
(WebInspector.ConsoleCommandResult):
* inspector/front-end/ElementsPanel.js:
(WebInspector.ElementsPanel.prototype.generateStylesheet):
* inspector/front-end/InjectedScriptAccess.js:
(InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName.myCallback):
(InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName):
(InjectedScriptAccess._installHandler):
* inspector/front-end/Resource.js:
(WebInspector.Resource.prototype._checkWarning):
* inspector/front-end/inspector.js:
(WebInspector.updateConsoleMessageExpiredCount):
(WebInspector.addConsoleMessage):
(WebInspector.log.logMessage):
(WebInspector.log):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63427 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d9d3751..27946bd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,46 @@
+2010-07-15 Yury Semikhatsky <yurys at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: pass all parameters to WebInspector.addConsoleMessage as a single payload object
+ https://bugs.webkit.org/show_bug.cgi?id=42345
+
+ This refactoring is covered by existing console tests.
+
+ * bindings/js/ScriptArray.cpp:
+ (WebCore::ScriptArray::set):
+ * bindings/js/ScriptArray.h:
+ (WebCore::ScriptArray::ScriptArray):
+ (WebCore::ScriptArray::jsArray):
+ * bindings/v8/ScriptArray.cpp:
+ (WebCore::ScriptArray::set):
+ * bindings/v8/ScriptArray.h:
+ (WebCore::ScriptArray::ScriptArray):
+ (WebCore::ScriptArray::~ScriptArray):
+ * inspector/ConsoleMessage.cpp:
+ (WebCore::ConsoleMessage::addToFrontend):
+ * inspector/InspectorFrontend.cpp:
+ (WebCore::InspectorFrontend::addConsoleMessage):
+ * inspector/InspectorFrontend.h:
+ * inspector/front-end/ConsoleView.js:
+ (WebInspector.ConsoleView.prototype.updateMessageRepeatCount):
+ (WebInspector.ConsoleMessage):
+ (WebInspector.ConsoleMessage.createTextMessage):
+ (WebInspector.ConsoleCommandResult):
+ * inspector/front-end/ElementsPanel.js:
+ (WebInspector.ElementsPanel.prototype.generateStylesheet):
+ * inspector/front-end/InjectedScriptAccess.js:
+ (InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName.myCallback):
+ (InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName):
+ (InjectedScriptAccess._installHandler):
+ * inspector/front-end/Resource.js:
+ (WebInspector.Resource.prototype._checkWarning):
+ * inspector/front-end/inspector.js:
+ (WebInspector.updateConsoleMessageExpiredCount):
+ (WebInspector.addConsoleMessage):
+ (WebInspector.log.logMessage):
+ (WebInspector.log):
+
2010-07-14 Tony Gentilcore <tonyg at chromium.org>
Reviewed by Darin Fisher.
diff --git a/WebCore/bindings/js/ScriptArray.cpp b/WebCore/bindings/js/ScriptArray.cpp
index caecc40..119d303 100644
--- a/WebCore/bindings/js/ScriptArray.cpp
+++ b/WebCore/bindings/js/ScriptArray.cpp
@@ -31,6 +31,8 @@
#include "config.h"
#include "ScriptArray.h"
+#include "SerializedScriptValue.h"
+
#include <runtime/JSLock.h>
using namespace JSC;
@@ -62,6 +64,19 @@ bool ScriptArray::set(unsigned index, const ScriptObject& value)
return handleException(m_scriptState);
}
+bool ScriptArray::set(unsigned index, SerializedScriptValue* value)
+{
+ ScriptValue scriptValue = ScriptValue::deserialize(m_scriptState, value);
+ if (scriptValue.hasNoValue()) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
+ JSLock lock(SilenceAssertionsOnly);
+ jsArray()->put(m_scriptState, index, scriptValue.jsValue());
+ return handleException(m_scriptState);
+}
+
bool ScriptArray::set(unsigned index, const String& value)
{
JSLock lock(SilenceAssertionsOnly);
diff --git a/WebCore/bindings/js/ScriptArray.h b/WebCore/bindings/js/ScriptArray.h
index 9240368..2badd09 100644
--- a/WebCore/bindings/js/ScriptArray.h
+++ b/WebCore/bindings/js/ScriptArray.h
@@ -37,23 +37,25 @@
#include <runtime/JSArray.h>
namespace WebCore {
-
- class ScriptArray : public ScriptObject {
- public:
- ScriptArray(ScriptState*, JSC::JSArray*);
- ScriptArray() {}
- JSC::JSArray* jsArray() const { return asArray(jsValue()); }
-
- bool set(unsigned index, const ScriptObject&);
- bool set(unsigned index, const String&);
- bool set(unsigned index, double);
- bool set(unsigned index, long long);
- bool set(unsigned index, int);
- bool set(unsigned index, bool);
- unsigned length();
-
- static ScriptArray createNew(ScriptState*);
- };
+class SerializedScriptValue;
+
+class ScriptArray : public ScriptObject {
+public:
+ ScriptArray(ScriptState*, JSC::JSArray*);
+ ScriptArray() {}
+ JSC::JSArray* jsArray() const { return asArray(jsValue()); }
+
+ bool set(unsigned index, const ScriptObject&);
+ bool set(unsigned index, SerializedScriptValue*);
+ bool set(unsigned index, const String&);
+ bool set(unsigned index, double);
+ bool set(unsigned index, long long);
+ bool set(unsigned index, int);
+ bool set(unsigned index, bool);
+ unsigned length();
+
+ static ScriptArray createNew(ScriptState*);
+};
}
#endif // ScriptArray_h
diff --git a/WebCore/bindings/v8/ScriptArray.cpp b/WebCore/bindings/v8/ScriptArray.cpp
index a199a6c..7119b27 100644
--- a/WebCore/bindings/v8/ScriptArray.cpp
+++ b/WebCore/bindings/v8/ScriptArray.cpp
@@ -31,11 +31,11 @@
#include "config.h"
#include "ScriptArray.h"
-#include "ScriptScope.h"
-#include "ScriptState.h"
-
#include "Document.h"
#include "Frame.h"
+#include "ScriptScope.h"
+#include "ScriptState.h"
+#include "SerializedScriptValue.h"
#include "V8Binding.h"
#include "V8Proxy.h"
@@ -57,6 +57,19 @@ bool ScriptArray::set(unsigned index, const ScriptObject& value)
return scope.success();
}
+bool ScriptArray::set(unsigned index, SerializedScriptValue* value)
+{
+ ScriptValue scriptValue = ScriptValue::deserialize(m_scriptState, value);
+ if (scriptValue.hasNoValue()) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
+ ScriptScope scope(m_scriptState);
+ v8Object()->Set(v8::Integer::New(index), scriptValue.v8Value());
+ return scope.success();
+}
+
bool ScriptArray::set(unsigned index, const String& value)
{
ScriptScope scope(m_scriptState);
diff --git a/WebCore/bindings/v8/ScriptArray.h b/WebCore/bindings/v8/ScriptArray.h
index 9f40fbf..9aa8764 100644
--- a/WebCore/bindings/v8/ScriptArray.h
+++ b/WebCore/bindings/v8/ScriptArray.h
@@ -36,24 +36,26 @@
#include <v8.h>
namespace WebCore {
- class ScriptState;
-
- class ScriptArray : public ScriptObject {
- public:
- ScriptArray(ScriptState* scriptState, v8::Handle<v8::Array>);
- ScriptArray() {};
- virtual ~ScriptArray() {}
-
- bool set(unsigned index, const ScriptObject&);
- bool set(unsigned index, const String&);
- bool set(unsigned index, double);
- bool set(unsigned index, long long);
- bool set(unsigned index, int);
- bool set(unsigned index, bool);
- unsigned length();
-
- static ScriptArray createNew(ScriptState*);
- };
+class ScriptState;
+class SerializedScriptValue;
+
+class ScriptArray : public ScriptObject {
+public:
+ ScriptArray(ScriptState* scriptState, v8::Handle<v8::Array>);
+ ScriptArray() {};
+ virtual ~ScriptArray() {}
+
+ bool set(unsigned index, const ScriptObject&);
+ bool set(unsigned index, SerializedScriptValue*);
+ bool set(unsigned index, const String&);
+ bool set(unsigned index, double);
+ bool set(unsigned index, long long);
+ bool set(unsigned index, int);
+ bool set(unsigned index, bool);
+ unsigned length();
+
+ static ScriptArray createNew(ScriptState*);
+};
}
#endif // ScriptArray_h
diff --git a/WebCore/inspector/ConsoleMessage.cpp b/WebCore/inspector/ConsoleMessage.cpp
index 934e2e9..c458eaa 100644
--- a/WebCore/inspector/ConsoleMessage.cpp
+++ b/WebCore/inspector/ConsoleMessage.cpp
@@ -93,15 +93,26 @@ void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHo
jsonObj.set("url", m_url);
jsonObj.set("groupLevel", static_cast<int>(m_groupLevel));
jsonObj.set("repeatCount", static_cast<int>(m_repeatCount));
- Vector<RefPtr<SerializedScriptValue> > arguments;
+ jsonObj.set("message", m_message);
if (!m_arguments.isEmpty()) {
+ ScriptArray jsonArgs = frontend->newScriptArray();
InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_scriptState.get());
for (unsigned i = 0; i < m_arguments.size(); ++i) {
RefPtr<SerializedScriptValue> serializedValue = injectedScript.wrapForConsole(m_arguments[i]);
- arguments.append(serializedValue);
+ if (!jsonArgs.set(i, serializedValue.get())) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
}
- }
- frontend->addConsoleMessage(jsonObj, m_frames, arguments, m_message);
+ jsonObj.set("parameters", jsonArgs);
+ }
+ if (!m_frames.isEmpty()) {
+ ScriptArray jsonFrames = frontend->newScriptArray();
+ for (unsigned i = 0; i < m_frames.size(); ++i)
+ jsonFrames.set(i, m_frames[i]);
+ jsonObj.set("stackTrace", jsonFrames);
+ }
+ frontend->addConsoleMessage(jsonObj);
}
void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend* frontend)
diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp
index f9a29b6..5925741 100644
--- a/WebCore/inspector/InspectorFrontend.cpp
+++ b/WebCore/inspector/InspectorFrontend.cpp
@@ -32,7 +32,6 @@
#if ENABLE(INSPECTOR)
-#include "ConsoleMessage.h"
#include "Frame.h"
#include "InjectedScript.h"
#include "InjectedScriptHost.h"
@@ -112,26 +111,11 @@ void InspectorFrontend::updateConsoleMessageExpiredCount(unsigned count)
function.call();
}
-void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<RefPtr<SerializedScriptValue> >& arguments, const String& message)
+void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj)
{
ScriptFunctionCall function(m_webInspector, "dispatch");
function.appendArgument("addConsoleMessage");
function.appendArgument(messageObj);
- if (!frames.isEmpty()) {
- for (unsigned i = 0; i < frames.size(); ++i)
- function.appendArgument(frames[i]);
- } else if (!arguments.isEmpty()) {
- for (unsigned i = 0; i < arguments.size(); ++i) {
- ScriptValue scriptValue = ScriptValue::deserialize(scriptState(), arguments[i].get());
- if (scriptValue.hasNoValue()) {
- ASSERT_NOT_REACHED();
- return;
- }
- function.appendArgument(scriptValue);
- }
- } else {
- function.appendArgument(message);
- }
function.call();
}
diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h
index e32f40c..e6567be 100644
--- a/WebCore/inspector/InspectorFrontend.h
+++ b/WebCore/inspector/InspectorFrontend.h
@@ -68,7 +68,7 @@ namespace WebCore {
void populateSessionSettings(const String& settings);
void updateConsoleMessageExpiredCount(unsigned count);
- void addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<RefPtr<SerializedScriptValue> >& arguments, const String& message);
+ void addConsoleMessage(const ScriptObject& messageObj);
void updateConsoleMessageRepeatCount(unsigned count);
void clearConsoleMessages();
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index 8bb71e6..df5a1a2 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -275,9 +275,9 @@ WebInspector.ConsoleView.prototype = {
msg._updateRepeatCount();
this._incrementErrorWarningCount(msg);
} else {
- msgCopy = new WebInspector.ConsoleMessage(msg.source, msg.type, msg.level, msg.line, msg.url, msg.groupLevel, count - prevRepeatCount);
+ var msgCopy = new WebInspector.ConsoleMessage(msg.source, msg.type, msg.level, msg.line, msg.url, msg.groupLevel, count - prevRepeatCount, msg._messageText, msg._parameters, msg._stackTrace);
msgCopy.totalRepeatCount = count;
- msgCopy.setMessageBody(msg.args);
+ msgCopy._formatMessage();
this.addMessage(msgCopy);
}
},
@@ -645,7 +645,7 @@ WebInspector.ConsoleView.prototype = {
WebInspector.ConsoleView.prototype.__proto__ = WebInspector.View.prototype;
-WebInspector.ConsoleMessage = function(source, type, level, line, url, groupLevel, repeatCount)
+WebInspector.ConsoleMessage = function(source, type, level, line, url, groupLevel, repeatCount, message, parameters, stackTrace)
{
this.source = source;
this.type = type;
@@ -656,29 +656,37 @@ WebInspector.ConsoleMessage = function(source, type, level, line, url, groupLeve
this.repeatCount = repeatCount;
this.repeatDelta = repeatCount;
this.totalRepeatCount = repeatCount;
- if (arguments.length > 7)
- this.setMessageBody(Array.prototype.slice.call(arguments, 7));
+ this._messageText = message;
+ this._parameters = parameters;
+ this._stackTrace = stackTrace;
+ this._formatMessage();
+}
+
+WebInspector.ConsoleMessage.createTextMessage = function(text, level)
+{
+ level = level || WebInspector.ConsoleMessage.MessageLevel.Log;
+ return new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Log, level, 0, null, null, 1, null, [text], null);
}
WebInspector.ConsoleMessage.prototype = {
- setMessageBody: function(args)
+ _formatMessage: function()
{
- this.args = args;
switch (this.type) {
case WebInspector.ConsoleMessage.MessageType.Trace:
var span = document.createElement("span");
span.className = "console-formatted-trace source-code";
- var stack = Array.prototype.slice.call(args);
- var funcNames = stack.map(function(f) {
+ var funcNames = this._stackTrace.map(function(f) {
return f || WebInspector.UIString("(anonymous function)");
});
span.appendChild(document.createTextNode(funcNames.join("\n")));
this.formattedMessage = span;
break;
case WebInspector.ConsoleMessage.MessageType.Object:
- this.formattedMessage = this._format(["%O", args[0]]);
+ var obj = this._parameters ? this._parameters[0] : undefined;
+ this.formattedMessage = this._format(["%O", obj]);
break;
default:
+ var args = this._parameters || [this._messageText];
this.formattedMessage = this._format(args);
break;
}
@@ -1001,14 +1009,6 @@ WebInspector.ConsoleCommand.prototype = {
}
}
-WebInspector.ConsoleTextMessage = function(text, level)
-{
- level = level || WebInspector.ConsoleMessage.MessageLevel.Log;
- WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Log, level, 0, null, null, 1, text);
-}
-
-WebInspector.ConsoleTextMessage.prototype.__proto__ = WebInspector.ConsoleMessage.prototype;
-
WebInspector.ConsoleCommandResult = function(result, exception, originatingCommand)
{
var level = (exception ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log);
@@ -1023,7 +1023,7 @@ WebInspector.ConsoleCommandResult = function(result, exception, originatingComma
this.originatingCommand = originatingCommand;
- WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, line, url, null, 1, message);
+ WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, line, url, null, 1, null, [message]);
}
WebInspector.ConsoleCommandResult.prototype = {
diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js
index e55294a..48eb4c0 100644
--- a/WebCore/inspector/front-end/ElementsPanel.js
+++ b/WebCore/inspector/front-end/ElementsPanel.js
@@ -453,7 +453,7 @@ WebInspector.ElementsPanel.prototype = {
}
WebInspector.showConsole();
- WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage(builder.join("\n")));
+ WebInspector.console.addMessage(WebInspector.ConsoleMessage.createTextMessage(builder.join("\n")));
},
get rootDOMNode()
diff --git a/WebCore/inspector/front-end/InjectedScriptAccess.js b/WebCore/inspector/front-end/InjectedScriptAccess.js
index 90daab7..0e4cc2e 100644
--- a/WebCore/inspector/front-end/InjectedScriptAccess.js
+++ b/WebCore/inspector/front-end/InjectedScriptAccess.js
@@ -58,7 +58,7 @@ InjectedScriptAccess._installHandler = function(methodName, async)
if (!isException)
callback(result);
else
- WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage("Error dispatching: " + methodName));
+ WebInspector.console.addMessage(WebInspector.ConsoleMessage.createTextMessage("Error dispatching: " + methodName));
}
var callId = WebInspector.Callback.wrap(myCallback);
diff --git a/WebCore/inspector/front-end/Resource.js b/WebCore/inspector/front-end/Resource.js
index cd51ac0..06a610d 100644
--- a/WebCore/inspector/front-end/Resource.js
+++ b/WebCore/inspector/front-end/Resource.js
@@ -598,9 +598,14 @@ WebInspector.Resource.prototype = {
if (!this._mimeTypeIsConsistentWithType())
msg = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other,
WebInspector.ConsoleMessage.MessageType.Log,
- WebInspector.ConsoleMessage.MessageLevel.Warning, -1, this.url, null, 1,
- String.sprintf(WebInspector.Warnings.IncorrectMIMEType.message,
- WebInspector.Resource.Type.toString(this.type), this.mimeType));
+ WebInspector.ConsoleMessage.MessageLevel.Warning,
+ -1,
+ this.url,
+ null,
+ 1,
+ String.sprintf(WebInspector.Warnings.IncorrectMIMEType.message, WebInspector.Resource.Type.toString(this.type), this.mimeType),
+ null,
+ null);
break;
}
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 88d912c..f0eef5e 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -1464,10 +1464,10 @@ WebInspector.didCommitLoad = function()
WebInspector.updateConsoleMessageExpiredCount = function(count)
{
var message = String.sprintf(WebInspector.UIString("%d console messages are not shown."), count);
- WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
+ WebInspector.console.addMessage(WebInspector.ConsoleMessage.createTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
}
-WebInspector.addConsoleMessage = function(payload, opt_args)
+WebInspector.addConsoleMessage = function(payload)
{
var consoleMessage = new WebInspector.ConsoleMessage(
payload.source,
@@ -1476,8 +1476,10 @@ WebInspector.addConsoleMessage = function(payload, opt_args)
payload.line,
payload.url,
payload.groupLevel,
- payload.repeatCount);
- consoleMessage.setMessageBody(Array.prototype.slice.call(arguments, 1));
+ payload.repeatCount,
+ payload.message,
+ payload.parameters,
+ payload.stackTrace);
this.console.addMessage(consoleMessage);
}
@@ -1545,7 +1547,9 @@ WebInspector.log = function(message, messageLevel)
null,
null,
repeatCount,
- message);
+ null,
+ [message],
+ null);
self.console.addMessage(msg);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list