[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

yurys at chromium.org yurys at chromium.org
Wed Dec 22 18:16:55 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit bb5946500f37332f7d4f77089f16a98f233110e4
Author: yurys at chromium.org <yurys at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 9 13:34:22 2010 +0000

    2010-12-09  Yury Semikhatsky  <yurys at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: Console records for failed XHRs should contain call stack and request method
            https://bugs.webkit.org/show_bug.cgi?id=50390
    
            The expectations needed update ue to log format changes.
    
            * http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt:
            * http/tests/inspector/console-resource-errors-expected.txt:
            * http/tests/inspector/console-xhr-logging-expected.txt:
            * platform/chromium/http/tests/inspector/console-resource-errors-expected.txt: Added.
            * platform/chromium/http/tests/inspector/console-xhr-logging-expected.txt: Copied from LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt.
    2010-12-09  Yury Semikhatsky  <yurys at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: Console records for failed XHRs should contain call stack and request method
            https://bugs.webkit.org/show_bug.cgi?id=50390
    
            When inspector front-end is open we capture call stack at the place where request is sent and
            pass the stack along with other request data. There is a new type of console messages which
            is NetworkErrorMessageType, all messages of that type will have requestId field initialized
            with the corresponding network request identifier so that later on when we need to display
            that message in the front-end we could pull request data from the Network panel using
            this identifier. If there are no data for given requestId message formatting falls back to
            the old implementation which lacks such things as call stack, request method and exact
            source location.
    
            * inspector/ConsoleMessage.cpp:
            (WebCore::ConsoleMessage::ConsoleMessage):
            (WebCore::ConsoleMessage::addToFrontend):
            (WebCore::ConsoleMessage::isEqual):
            * inspector/ConsoleMessage.h:
            * inspector/Inspector.idl:
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::didReceiveResponse):
            (WebCore::InspectorController::didFailLoading):
            * inspector/InspectorResourceAgent.cpp:
            (WebCore::InspectorResourceAgent::identifierForInitialRequest):
            * inspector/front-end/ConsoleView.js:
            (WebInspector.ConsoleView.prototype.updateMessageRepeatCount):
            (WebInspector.ConsoleMessage):
            (WebInspector.ConsoleMessage.prototype._formatMessage):
            (WebInspector.ConsoleMessage.prototype.toMessageElement):
            (WebInspector.ConsoleMessage.prototype.toString):
            (WebInspector.ConsoleMessage.prototype.isEqual):
            * inspector/front-end/ResourceManager.js:
            (WebInspector.ResourceManager.prototype.identifierForInitialRequest):
            * inspector/front-end/inspector.js:
            (WebInspector.addConsoleMessage):
            * page/Console.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73607 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 18287ef..e5c1c62 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-09  Yury Semikhatsky  <yurys at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: Console records for failed XHRs should contain call stack and request method
+        https://bugs.webkit.org/show_bug.cgi?id=50390
+
+        The expectations needed update ue to log format changes.
+
+        * http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt:
+        * http/tests/inspector/console-resource-errors-expected.txt:
+        * http/tests/inspector/console-xhr-logging-expected.txt:
+        * platform/chromium/http/tests/inspector/console-resource-errors-expected.txt: Added.
+        * platform/chromium/http/tests/inspector/console-xhr-logging-expected.txt: Copied from LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt.
+
 2010-12-09  Dai Mikurube  <dmikurube at google.com>
 
         Reviewed by Kent Tamura.
diff --git a/LayoutTests/http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt b/LayoutTests/http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt
index d0505e8..31e7840 100644
--- a/LayoutTests/http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt
+++ b/LayoutTests/http/tests/inspector-enabled/console-log-before-frame-navigation-expected.txt
@@ -4,7 +4,7 @@ Tests that Web Inspector won't crash if there are messages written to console fr
 
 Received console messages:
 Message[0]:
-URL: http://127.0.0.1:8000/inspector-enabled/resources/console-log-frame-before-navigation.html
-Message: Console message (C) %d with element
+URL: 
+Message: resources/console-log-frame-before-navigation.html:5Console message (C) %d with element
 TEST COMPLETE.
 
diff --git a/LayoutTests/http/tests/inspector/console-resource-errors-expected.txt b/LayoutTests/http/tests/inspector/console-resource-errors-expected.txt
index 64d014a..6329bc5 100644
--- a/LayoutTests/http/tests/inspector/console-resource-errors-expected.txt
+++ b/LayoutTests/http/tests/inspector/console-resource-errors-expected.txt
@@ -1,8 +1,8 @@
  Tests that errors to load a resource cause error messages to be logged to console.
 
 Page reloaded.
-missing.cssFailed to load resource: the server responded with a status of 404 (Not Found) console-message console-error-level
-non-existent-iframe.htmlFailed to load resource: the server responded with a status of 404 (Not Found) console-message console-error-level
-non-existent-script.jsFailed to load resource: the server responded with a status of 404 (Not Found) console-message console-error-level
-non-existent-xhrFailed to load resource: the server responded with a status of 404 (Not Found) console-message console-error-level
+missing.cssGET http://127.0.0.1:8000/inspector/missing.css 404 (Not Found) console-message console-error-level
+non-existent-iframe.htmlGET http://127.0.0.1:8000/inspector/non-existent-iframe.html 404 (Not Found) console-message console-error-level
+non-existent-script.jsGET http://127.0.0.1:8000/inspector/non-existent-script.js 404 (Not Found) console-message console-error-level
+non-existent-xhrGET http://127.0.0.1:8000/inspector/non-existent-xhr 404 (Not Found) console-message console-error-level
 
diff --git a/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt b/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt
index d702fcd..de371e8 100644
--- a/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt
+++ b/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt
@@ -12,13 +12,13 @@ console-xhr-logging.html:11enabled
 console-xhr-logging.html:40sending a GET request to resources/xhr-exists.html
 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html".
 console-xhr-logging.html:40sending a GET request to resources/xhr-does-not-exist.html
-xhr-does-not-exist.htmlFailed to load resource: the server responded with a status of 404 (Not Found)
+xhr-does-not-exist.htmlGET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)
 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html".
 console-xhr-logging.html:40sending a POST request to resources/post-target.cgi
 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/post-target.cgi".
 console-xhr-logging.html:21disabled
 console-xhr-logging.html:40sending a GET request to resources/xhr-exists.html
 console-xhr-logging.html:40sending a GET request to resources/xhr-does-not-exist.html
-xhr-does-not-exist.htmlFailed to load resource: the server responded with a status of 404 (Not Found)
+xhr-does-not-exist.htmlGET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)
 console-xhr-logging.html:40sending a POST request to resources/post-target.cgi
 
diff --git a/LayoutTests/platform/chromium/http/tests/inspector/console-resource-errors-expected.txt b/LayoutTests/platform/chromium/http/tests/inspector/console-resource-errors-expected.txt
new file mode 100755
index 0000000..895f4df
--- /dev/null
+++ b/LayoutTests/platform/chromium/http/tests/inspector/console-resource-errors-expected.txt
@@ -0,0 +1,7 @@
+ Tests that errors to load a resource cause error messages to be logged to console.
+
+Page reloaded.
+console-resource-errors.html:11GET http://127.0.0.1:8000/inspector/non-existent-xhr 404 (Not Found) console-message console-error-level
+missing.cssGET http://127.0.0.1:8000/inspector/missing.css 404 (Not Found) console-message console-error-level
+non-existent-iframe.htmlGET http://127.0.0.1:8000/inspector/non-existent-iframe.html 404 (Not Found) console-message console-error-level
+non-existent-script.jsGET http://127.0.0.1:8000/inspector/non-existent-script.js 404 (Not Found) console-message console-error-level
diff --git a/LayoutTests/platform/chromium/http/tests/inspector/console-xhr-logging-expected.txt b/LayoutTests/platform/chromium/http/tests/inspector/console-xhr-logging-expected.txt
new file mode 100644
index 0000000..509183d
--- /dev/null
+++ b/LayoutTests/platform/chromium/http/tests/inspector/console-xhr-logging-expected.txt
@@ -0,0 +1,23 @@
+CONSOLE MESSAGE: line 11: enabled
+CONSOLE MESSAGE: line 40: sending a %s request to %s
+CONSOLE MESSAGE: line 40: sending a %s request to %s
+CONSOLE MESSAGE: line 40: sending a %s request to %s
+CONSOLE MESSAGE: line 21: disabled
+CONSOLE MESSAGE: line 40: sending a %s request to %s
+CONSOLE MESSAGE: line 40: sending a %s request to %s
+CONSOLE MESSAGE: line 40: sending a %s request to %s
+Tests that XMLHttpRequest Logging works when Enabled and doesn't show logs when Disabled.
+
+console-xhr-logging.html:11enabled
+console-xhr-logging.html:40sending a GET request to resources/xhr-exists.html
+XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html".
+console-xhr-logging.html:40sending a GET request to resources/xhr-does-not-exist.html
+console-xhr-logging.html:43GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)
+XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html".
+console-xhr-logging.html:40sending a POST request to resources/post-target.cgi
+XHR finished loading: "http://127.0.0.1:8000/inspector/resources/post-target.cgi".
+console-xhr-logging.html:21disabled
+console-xhr-logging.html:40sending a GET request to resources/xhr-exists.html
+console-xhr-logging.html:40sending a GET request to resources/xhr-does-not-exist.html
+console-xhr-logging.html:43GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)
+console-xhr-logging.html:40sending a POST request to resources/post-target.cgi
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6ded679..ad0f5e3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,43 @@
+2010-12-09  Yury Semikhatsky  <yurys at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: Console records for failed XHRs should contain call stack and request method
+        https://bugs.webkit.org/show_bug.cgi?id=50390
+
+        When inspector front-end is open we capture call stack at the place where request is sent and
+        pass the stack along with other request data. There is a new type of console messages which
+        is NetworkErrorMessageType, all messages of that type will have requestId field initialized
+        with the corresponding network request identifier so that later on when we need to display
+        that message in the front-end we could pull request data from the Network panel using
+        this identifier. If there are no data for given requestId message formatting falls back to
+        the old implementation which lacks such things as call stack, request method and exact
+        source location.
+
+        * inspector/ConsoleMessage.cpp:
+        (WebCore::ConsoleMessage::ConsoleMessage):
+        (WebCore::ConsoleMessage::addToFrontend):
+        (WebCore::ConsoleMessage::isEqual):
+        * inspector/ConsoleMessage.h:
+        * inspector/Inspector.idl:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::didReceiveResponse):
+        (WebCore::InspectorController::didFailLoading):
+        * inspector/InspectorResourceAgent.cpp:
+        (WebCore::InspectorResourceAgent::identifierForInitialRequest):
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype.updateMessageRepeatCount):
+        (WebInspector.ConsoleMessage):
+        (WebInspector.ConsoleMessage.prototype._formatMessage):
+        (WebInspector.ConsoleMessage.prototype.toMessageElement):
+        (WebInspector.ConsoleMessage.prototype.toString):
+        (WebInspector.ConsoleMessage.prototype.isEqual):
+        * inspector/front-end/ResourceManager.js:
+        (WebInspector.ResourceManager.prototype.identifierForInitialRequest):
+        * inspector/front-end/inspector.js:
+        (WebInspector.addConsoleMessage):
+        * page/Console.h:
+
 2010-12-09  Dai Mikurube  <dmikurube at google.com>
 
         Reviewed by Kent Tamura.
diff --git a/WebCore/inspector/ConsoleMessage.cpp b/WebCore/inspector/ConsoleMessage.cpp
index 5812aa4..b22a6ef 100644
--- a/WebCore/inspector/ConsoleMessage.cpp
+++ b/WebCore/inspector/ConsoleMessage.cpp
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Matt Lilek <webkit at mattlilek.com>
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009, 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
@@ -33,6 +33,7 @@
 
 #if ENABLE(INSPECTOR)
 
+#include "Console.h"
 #include "InjectedScript.h"
 #include "InjectedScriptHost.h"
 #include "InspectorFrontend.h"
@@ -51,6 +52,7 @@ ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, c
     , m_line(li)
     , m_url(u)
     , m_repeatCount(1)
+    , m_requestId(0)
 {
 }
 
@@ -61,16 +63,23 @@ ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, c
     , m_message(m)
     , m_arguments(arguments)
     , m_callStack(callStack)
+    , m_line(0)
+    , m_url()
     , m_repeatCount(1)
+    , m_requestId(0)
 {
-    const ScriptCallFrame& lastCaller = m_callStack->at(0);
-    m_line = lastCaller.lineNumber();
-    m_url = lastCaller.sourceURL();
-
+}
 
-    bool storeTrace = (t == TraceMessageType || t == UncaughtExceptionMessageType || t == AssertMessageType);
-    if (!storeTrace)
-        m_callStack.clear();
+ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, const String& m, const String& responseUrl, unsigned long identifier)
+    : m_source(s)
+    , m_type(t)
+    , m_level(l)
+    , m_message(m)
+    , m_line(0)
+    , m_url(responseUrl)
+    , m_repeatCount(1)
+    , m_requestId(identifier)
+{
 }
 
 void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHost* injectedScriptHost)
@@ -83,6 +92,8 @@ void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHo
     jsonObj->setString("url", m_url);
     jsonObj->setNumber("repeatCount", static_cast<int>(m_repeatCount));
     jsonObj->setString("message", m_message);
+    if (m_type == NetworkErrorMessageType) 
+        jsonObj->setNumber("requestId", m_requestId);
     if (m_arguments && m_arguments->argumentCount()) {
         InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_arguments->globalState());
         if (!injectedScript.hasNoValue()) {
@@ -127,7 +138,8 @@ bool ConsoleMessage::isEqual(ConsoleMessage* msg) const
         && msg->m_level == m_level
         && msg->m_message == m_message
         && msg->m_line == m_line
-        && msg->m_url == m_url;
+        && msg->m_url == m_url
+        && msg->m_requestId == m_requestId;
 }
 
 } // namespace WebCore
diff --git a/WebCore/inspector/ConsoleMessage.h b/WebCore/inspector/ConsoleMessage.h
index a6d9a18..06a17d4 100644
--- a/WebCore/inspector/ConsoleMessage.h
+++ b/WebCore/inspector/ConsoleMessage.h
@@ -50,6 +50,7 @@ class ConsoleMessage : public Noncopyable {
 public:
     ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, unsigned li, const String& u);
     ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
+    ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, const String& responseUrl, unsigned long identifier);
 
     void addToFrontend(InspectorFrontend*, InjectedScriptHost*);
     void updateRepeatCountInConsole(InspectorFrontend* frontend);
@@ -69,6 +70,7 @@ private:
     unsigned m_line;
     String m_url;
     unsigned m_repeatCount;
+    unsigned int m_requestId;
 };
 
 } // namespace WebCore
diff --git a/WebCore/inspector/Inspector.idl b/WebCore/inspector/Inspector.idl
index 932fa90..6d8f22b 100644
--- a/WebCore/inspector/Inspector.idl
+++ b/WebCore/inspector/Inspector.idl
@@ -107,7 +107,7 @@ module core {
 
         [domain=Resources] void cachedResources(out Object resources);
         [domain=Resources] void resourceContent(in unsigned long frameId, in String url, in boolean base64Encode, out String content);
-        [notify] void identifierForInitialRequest(out long identifier, out String url, out Object loader);
+        [notify] void identifierForInitialRequest(out long identifier, out String url, out Object loader, out Value callStack);
         [notify] void willSendRequest(out long identifier, out double time, out Object request, out Object redirectResponse);
         [notify] void markResourceAsCached(out long identifier);
         [notify] void didReceiveResponse(out long identifier, out double time, out String resourceType, out Object response);
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 6eaf89e..f0cd8cf 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -861,7 +861,7 @@ void InspectorController::didReceiveResponse(unsigned long identifier, DocumentL
 
     if (response.httpStatusCode() >= 400) {
         String message = makeString("Failed to load resource: the server responded with a status of ", String::number(response.httpStatusCode()), " (", response.httpStatusText(), ')');
-        addMessageToConsole(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 0, response.url().string());
+        addConsoleMessage(new ConsoleMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, response.url().string(), identifier));
     }
 }
 
@@ -897,7 +897,7 @@ void InspectorController::didFailLoading(unsigned long identifier, const Resourc
     String message = "Failed to load resource";
         if (!error.localizedDescription().isEmpty())
             message += ": " + error.localizedDescription();
-        addMessageToConsole(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 0, error.failingURL());
+        addConsoleMessage(new ConsoleMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, error.failingURL(), identifier));
 
     if (m_resourceAgent)
         m_resourceAgent->didFailLoading(identifier, error);
diff --git a/WebCore/inspector/InspectorResourceAgent.cpp b/WebCore/inspector/InspectorResourceAgent.cpp
index 9dab24a..3ed14f7 100644
--- a/WebCore/inspector/InspectorResourceAgent.cpp
+++ b/WebCore/inspector/InspectorResourceAgent.cpp
@@ -52,6 +52,8 @@
 #include "ResourceError.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
+#include "ScriptCallStack.h"
+#include "ScriptCallStackFactory.h"
 #include "SharedBuffer.h"
 #include "TextEncoding.h"
 #include "WebSocketHandshakeRequest.h"
@@ -285,7 +287,13 @@ InspectorResourceAgent::~InspectorResourceAgent()
 void InspectorResourceAgent::identifierForInitialRequest(unsigned long identifier, const KURL& url, DocumentLoader* loader)
 {
     RefPtr<InspectorObject> loaderObject = buildObjectForDocumentLoader(loader);
-    m_frontend->identifierForInitialRequest(identifier, url.string(), loaderObject);
+    RefPtr<ScriptCallStack> callStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
+    RefPtr<InspectorValue> callStackValue;
+    if (callStack)
+        callStackValue = callStack->buildInspectorObject();
+    else
+        callStackValue = InspectorValue::null();
+    m_frontend->identifierForInitialRequest(identifier, url.string(), loaderObject, callStackValue);
 }
 
 void InspectorResourceAgent::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index 09ce793..f0df010 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -257,7 +257,7 @@ WebInspector.ConsoleView.prototype = {
             msg._updateRepeatCount();
             this._incrementErrorWarningCount(msg);
         } else {
-            var msgCopy = new WebInspector.ConsoleMessage(msg.source, msg.type, msg.level, msg.line, msg.url, count - prevRepeatCount, msg._messageText, msg._parameters, msg._stackTrace);
+            var msgCopy = new WebInspector.ConsoleMessage(msg.source, msg.type, msg.level, msg.line, msg.url, count - prevRepeatCount, msg._messageText, msg._parameters, msg._stackTrace, msg._requestId);
             msgCopy.totalRepeatCount = count;
             msgCopy._formatMessage();
             this.addMessage(msgCopy);
@@ -627,7 +627,7 @@ WebInspector.ConsoleView.prototype = {
 
 WebInspector.ConsoleView.prototype.__proto__ = WebInspector.View.prototype;
 
-WebInspector.ConsoleMessage = function(source, type, level, line, url, repeatCount, message, parameters, stackTrace)
+WebInspector.ConsoleMessage = function(source, type, level, line, url, repeatCount, message, parameters, stackTrace, requestId)
 {
     this.source = source;
     this.type = type;
@@ -640,6 +640,7 @@ WebInspector.ConsoleMessage = function(source, type, level, line, url, repeatCou
     this._messageText = message;
     this._parameters = parameters;
     this._stackTrace = stackTrace;
+    this._requestId = requestId;
     this._formatMessage();
 }
 
@@ -652,44 +653,91 @@ WebInspector.ConsoleMessage.createTextMessage = function(text, level)
 WebInspector.ConsoleMessage.prototype = {
     _formatMessage: function()
     {
+        var stackTrace = this._stackTrace;
+        var messageText;
         switch (this.type) {
-            case WebInspector.ConsoleMessage.MessageType.Assert:
             case WebInspector.ConsoleMessage.MessageType.Trace:
+                messageText = document.createTextNode("console.trace()");
+                break;
             case WebInspector.ConsoleMessage.MessageType.UncaughtException:
-                var ol = document.createElement("ol");
-                ol.className = "outline-disclosure";
-                var treeOutline = new TreeOutline(ol);
-                var messageText;
-                if (this.type === WebInspector.ConsoleMessage.MessageType.Assert)
-                    messageText = this._format(this._parameters);
-                else if (this.type === WebInspector.ConsoleMessage.MessageType.Trace)
-                    messageText = document.createTextNode("console.trace()");
-                else
-                    messageText = document.createTextNode(this._messageText);
-
-                var content = document.createElement("div");
-                this._addMessageHeader(content, messageText);
-                var root = new TreeElement(content, null, true);
-                content.treeElementForTest = root;
-                treeOutline.appendChild(root);
-                if (this.type === WebInspector.ConsoleMessage.MessageType.Trace)
-                    root.expand();
-
-                this._populateStackTraceTreeElement(root);
-                this.formattedMessage = ol;
+                messageText = document.createTextNode(this._messageText);
+                break;
+            case WebInspector.ConsoleMessage.MessageType.NetworkError:
+                var resource = this._requestId && WebInspector.panels.network.resources[this._requestId];
+                if (resource) {
+                    stackTrace = resource.stackTrace;
+
+                    messageText = document.createElement("span");
+                    messageText.appendChild(document.createTextNode(resource.requestMethod + " "));
+                    messageText.appendChild(WebInspector.linkifyURLAsNode(resource.url));
+                    if (resource.failed)
+                        messageText.appendChild(document.createTextNode(" " + resource.localizedFailDescription));
+                    else
+                        messageText.appendChild(document.createTextNode(" " + resource.statusCode + " (" + resource.statusText + ")"));
+                } else
+                    messageText = this._format([this._messageText]);
+                break;
+            case WebInspector.ConsoleMessage.MessageType.Assert:
+                var args = [WebInspector.UIString("Assertion failed:")];
+                if (this._parameters)
+                    args = args.concat(this._parameters);
+                messageText = this._format(args);
                 break;
             case WebInspector.ConsoleMessage.MessageType.Object:
                 var obj = this._parameters ? this._parameters[0] : undefined;
-                this.formattedMessage = this._format(["%O", obj]);
+                var args = ["%O", obj];
+                messageText = this._format(args);
                 break;
             default:
                 var args = this._parameters || [this._messageText];
-                this.formattedMessage = this._format(args);
+                messageText = this._format(args);
                 break;
         }
 
+        this._formattedMessage = document.createElement("span");
+        this._formattedMessage.className = "console-message-text source-code";
+
+        if (stackTrace && stackTrace.length) {
+            var topCallFrame = stackTrace[0];
+            var sourceName = topCallFrame.scriptName;
+            var sourceLine = topCallFrame.lineNumber;
+        } else {
+            var sourceName = this.url;
+            var sourceLine = this.line;
+        }
+
+        if (sourceName && sourceName !== "undefined") {
+            var urlElement = WebInspector.linkifyResourceAsNode(sourceName, "scripts", sourceLine, "console-message-url");
+            this._formattedMessage.appendChild(urlElement);
+        }
+
+        this._formattedMessage.appendChild(messageText);
+
+        if (this._stackTrace) {
+            switch (this.type) {
+                case WebInspector.ConsoleMessage.MessageType.Trace:
+                case WebInspector.ConsoleMessage.MessageType.UncaughtException:
+                case WebInspector.ConsoleMessage.MessageType.NetworkError:
+                case WebInspector.ConsoleMessage.MessageType.Assert: {
+                    var ol = document.createElement("ol");
+                    ol.className = "outline-disclosure";
+                    var treeOutline = new TreeOutline(ol);
+
+                    var content = this._formattedMessage;
+                    var root = new TreeElement(content, null, true);
+                    content.treeElementForTest = root;
+                    treeOutline.appendChild(root);
+                    if (this.type === WebInspector.ConsoleMessage.MessageType.Trace)
+                        root.expand();
+
+                    this._populateStackTraceTreeElement(root);
+                    this._formattedMessage = ol;
+                }
+            }
+        }
+
         // This is used for inline message bubbles in SourceFrames, or other plain-text representations.
-        this.message = this.formattedMessage.textContent;
+        this.message = this._formattedMessage.textContent;
     },
 
     isErrorOrWarning: function()
@@ -809,12 +857,7 @@ WebInspector.ConsoleMessage.prototype = {
             return element;
         }
 
-        if (this.type === WebInspector.ConsoleMessage.MessageType.Trace ||
-            this.type === WebInspector.ConsoleMessage.MessageType.Assert ||
-            this.type === WebInspector.ConsoleMessage.MessageType.UncaughtException)
-            element.appendChild(this.formattedMessage);
-        else
-            this._addMessageHeader(element, this.formattedMessage);
+        element.appendChild(this._formattedMessage);
 
         if (this.repeatCount > 1)
             this._updateRepeatCount();
@@ -842,21 +885,6 @@ WebInspector.ConsoleMessage.prototype = {
         }
     },
 
-    _addMessageHeader: function(parentElement, formattedMessage)
-    {
-        if (this.url && this.url !== "undefined") {
-            var urlElement = WebInspector.linkifyResourceAsNode(this.url, "scripts", this.line, "console-message-url");
-            parentElement.appendChild(urlElement);
-        }
-
-        var messageTextElement = document.createElement("span");
-        messageTextElement.className = "console-message-text source-code";
-        if (this.type === WebInspector.ConsoleMessage.MessageType.Assert)
-            messageTextElement.appendChild(document.createTextNode(WebInspector.UIString("Assertion failed: ")));
-        messageTextElement.appendChild(formattedMessage);
-        parentElement.appendChild(messageTextElement);
-    },
-
     _updateRepeatCount: function() {
         if (!this.repeatCountElement) {
             this.repeatCountElement = document.createElement("span");
@@ -896,6 +924,7 @@ WebInspector.ConsoleMessage.prototype = {
         switch (this.type) {
             case WebInspector.ConsoleMessage.MessageType.Log:
             case WebInspector.ConsoleMessage.MessageType.UncaughtException:
+            case WebInspector.ConsoleMessage.MessageType.NetworkError:
                 typeString = "Log";
                 break;
             case WebInspector.ConsoleMessage.MessageType.Object:
@@ -938,20 +967,35 @@ WebInspector.ConsoleMessage.prototype = {
                 break;
         }
 
-        return sourceString + " " + typeString + " " + levelString + ": " + this.formattedMessage.textContent + "\n" + this.url + " line " + this.line;
+        return sourceString + " " + typeString + " " + levelString + ": " + this._formattedMessage.textContent + "\n" + this.url + " line " + this.line;
     },
 
-    isEqual: function(msg, disreguardGroup)
+    isEqual: function(msg)
     {
         if (!msg)
             return false;
 
+        if (this._stackTrace) {
+            if (!msg._stackTrace)
+                return false;
+            var l = this._stackTrace;
+            var r = msg._stackTrace;
+            for (var i = 0; i < l.length; i++) {
+                if (l[i].scriptName !== r[i].scriptName ||
+                    l[i].functionName !== r[i].functionName ||
+                    l[i].lineNumber !== r[i].lineNumber ||
+                    l[i].column !== r[i].column)
+                    return false;
+            }
+        }
+
         return (this.source === msg.source)
             && (this.type === msg.type)
             && (this.level === msg.level)
             && (this.line === msg.line)
             && (this.url === msg.url)
-            && (this.message === msg.message);
+            && (this.message === msg.message)
+            && (this._requestId === msg._requestId);
     }
 }
 
@@ -974,7 +1018,8 @@ WebInspector.ConsoleMessage.MessageType = {
     EndGroup: 5,
     Assert: 6,
     UncaughtException: 7,
-    Result: 8
+    NetworkError:8,
+    Result: 9
 }
 
 WebInspector.ConsoleMessage.MessageLevel = {
diff --git a/WebCore/inspector/front-end/ResourceManager.js b/WebCore/inspector/front-end/ResourceManager.js
index 056be8c..9f35ed2 100644
--- a/WebCore/inspector/front-end/ResourceManager.js
+++ b/WebCore/inspector/front-end/ResourceManager.js
@@ -60,9 +60,9 @@ WebInspector.ResourceManager.prototype = {
             WebInspector[arguments[i]] = this[arguments[i]].bind(this);
     },
 
-    identifierForInitialRequest: function(identifier, url, loader)
+    identifierForInitialRequest: function(identifier, url, loader, callStack)
     {
-        var resource = this._createResource(identifier, url, loader);
+        var resource = this._createResource(identifier, url, loader, callStack);
 
         // It is important to bind resource url early (before scripts compile).
         this._bindResourceURL(resource);
@@ -71,12 +71,13 @@ WebInspector.ResourceManager.prototype = {
         WebInspector.panels.audits.resourceStarted(resource);
     },
 
-    _createResource: function(identifier, url, loader)
+    _createResource: function(identifier, url, loader, stackTrace)
     {
         var resource = new WebInspector.Resource(identifier, url);
         resource.loader = loader;
         if (loader)
             resource.documentURL = loader.url;
+        resource.stackTrace = stackTrace;
 
         this._resourcesById[identifier] = resource;
         return resource;
@@ -119,7 +120,7 @@ WebInspector.ResourceManager.prototype = {
         var originalResource = this._resourcesById[identifier];
         originalResource.identifier = null;
 
-        var newResource = this._createResource(identifier, redirectURL, originalResource.loader);
+        var newResource = this._createResource(identifier, redirectURL, originalResource.loader, originalResource.stackTrace);
         newResource.redirects = originalResource.redirects || [];
         delete originalResource.redirects;
         newResource.redirects.push(originalResource);
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index c40924c..8e165dc 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -1386,7 +1386,8 @@ WebInspector.addConsoleMessage = function(payload)
         payload.repeatCount,
         payload.message,
         payload.parameters,
-        payload.stackTrace);
+        payload.stackTrace,
+        payload.requestId);
     this.console.addMessage(consoleMessage);
 }
 
diff --git a/WebCore/page/Console.h b/WebCore/page/Console.h
index 19f1a57..dd692a2 100644
--- a/WebCore/page/Console.h
+++ b/WebCore/page/Console.h
@@ -68,7 +68,8 @@ enum MessageType {
     StartGroupCollapsedMessageType,
     EndGroupMessageType,
     AssertMessageType,
-    UncaughtExceptionMessageType
+    UncaughtExceptionMessageType,
+    NetworkErrorMessageType
 };
 
 enum MessageLevel {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list