Web Inspector: split ConsoleView into the View and the Model.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Aug 2011 10:01:27 +0000 (10:01 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Aug 2011 10:01:27 +0000 (10:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=66861

Reviewed by Yury Semikhatsky.

Source/WebCore:

* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/compile-front-end.sh:
* inspector/front-end/BreakpointManager.js:
* inspector/front-end/ConsoleMessage.js:
(WebInspector.ConsoleMessage.prototype._format):
* inspector/front-end/ConsoleModel.js: Added.
(WebInspector.ConsoleModel):
(WebInspector.ConsoleModel.prototype._setConsoleMessageExpiredCount):
(WebInspector.ConsoleModel.prototype.addMessage):
(WebInspector.ConsoleModel.prototype._incrementErrorWarningCount):
(WebInspector.ConsoleModel.prototype.requestClearMessages):
(WebInspector.ConsoleModel.prototype.clearMessages):
(WebInspector.ConsoleDispatcher):
(WebInspector.ConsoleDispatcher.prototype.messageAdded):
(WebInspector.ConsoleDispatcher.prototype.messageRepeatCountUpdated):
* inspector/front-end/ConsolePanel.js:
(WebInspector.ConsolePanel):
(WebInspector.ConsolePanel.prototype.performSearch):
* inspector/front-end/ConsoleView.js:
(WebInspector.ConsoleView):
(WebInspector.ConsoleView.prototype._consoleMessageAdded):
(WebInspector.ConsoleView.prototype._appendConsoleCommand):
(WebInspector.ConsoleView.prototype._appendConsoleCommandResult):
(WebInspector.ConsoleView.prototype._appendConsoleMessage):
(WebInspector.ConsoleView.prototype._consoleCleared):
(WebInspector.ConsoleView.prototype._registerShortcuts):
(WebInspector.ConsoleView.prototype._requestClearMessages):
* inspector/front-end/DebuggerModel.js:
* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel):
(WebInspector.DebuggerPresentationModel.prototype.addSourceMappingListener):
(WebInspector.DebuggerPresentationModel.prototype.removeSourceMappingListener):
* inspector/front-end/NetworkLog.js: Copied from Source/WebCore/inspector/front-end/externs.js.
(WebInspector.NetworkLog):
(WebInspector.NetworkLog.prototype.get resources):
(WebInspector.NetworkLog.prototype._frameNavigated):
(WebInspector.NetworkLog.prototype._onResourceStarted):
* inspector/front-end/NetworkManager.js:
(WebInspector.NetworkDispatcher.prototype._updateResourceWithResponse):
(WebInspector.NetworkDispatcher.prototype._mimeTypeIsConsistentWithType):
* inspector/front-end/Resource.js:
(WebInspector.Resource.prototype.set finished):
* inspector/front-end/ResourceTreeModel.js:
(WebInspector.ResourceTreeModel):
* inspector/front-end/SourceFile.js:
(WebInspector.RawSourceCode.prototype._scriptForRawLocation):
(WebInspector.ScriptContentProvider.prototype.requestContent):
(WebInspector.ConcatenatedScriptsContentProvider.prototype._concatenateScriptsContent.appendChunk):
(WebInspector.ConcatenatedScriptsContentProvider.prototype._concatenateScriptsContent):
* inspector/front-end/UISourceCode.js:
(WebInspector.ContentProvider):
(WebInspector.ContentProvider.prototype.requestContent):
* inspector/front-end/WatchExpressionsSidebarPane.js:
(WebInspector.WatchExpressionsSection.prototype.update):
* inspector/front-end/WebKit.qrc:
* inspector/front-end/externs.js:
(WebInspector.linkifyURLAsNode):
(WebInspector.formatLinkText):
* inspector/front-end/inspector.html:
* inspector/front-end/inspector.js:
(WebInspector._createGlobalStatusBarItems):
(WebInspector._updateErrorAndWarningCounts):
(WebInspector.showConsole):

LayoutTests:

* http/tests/inspector/change-iframe-src.html:
* http/tests/inspector/console-cd-completions.html:
* http/tests/inspector/console-cd.html:
* http/tests/inspector/console-resource-errors.html:
* http/tests/inspector/console-test.js:
(initialize_ConsoleTest.InspectorTest.dumpConsoleMessages):
(initialize_ConsoleTest.InspectorTest.dumpConsoleMessagesWithClasses):
(initialize_ConsoleTest.InspectorTest.expandConsoleMessages):
(initialize_ConsoleTest):
* http/tests/inspector/inspector-test.js:
(initialize_InspectorTest.InspectorTest.evaluateInConsole):
(initialize_InspectorTest):
* http/tests/inspector/network/disabled-cache-crash.html:
* http/tests/inspector/network/network-cachedresources-with-same-urls.html:
* http/tests/inspector/network/network-clear-cache.html-disabled:
* http/tests/inspector/network/network-clear-cookies.html-disabled:
* http/tests/inspector/network/network-content-replacement-embed.html:
* http/tests/inspector/network/network-content-replacement-xhr.html:
* http/tests/inspector/network/network-disable-cache-memory.html:
* http/tests/inspector/network/network-disable-cache-xhrs.html:
* http/tests/inspector/network/network-embed.html:
* http/tests/inspector/network/network-iframe-load-and-delete.html:
* http/tests/inspector/network/network-initiator-from-console.html:
* http/tests/inspector/network/network-initiator.html:
* http/tests/inspector/network/network-request-revision-content.html:
* http/tests/inspector/network/network-shared-worker.html:
* http/tests/inspector/network/network-sidebar-width.html:
* http/tests/inspector/network/network-size-chunked.html:
* http/tests/inspector/network/network-size-sync.html:
* http/tests/inspector/network/network-size.html:
* http/tests/inspector/network/network-timing.html:
* http/tests/inspector/network/network-worker.html:
* http/tests/inspector/network/network-xhr-async.html:
* http/tests/inspector/network/network-xhr-sync.html:
* http/tests/inspector/resource-tree/resource-tree-frame-add.html:
* http/tests/inspector/resource-tree/resource-tree-frame-navigate.html:
* http/tests/inspector/resource-tree/resource-tree-no-xhrs.html:
* inspector/console/console-assert.html:
* inspector/console/console-trace-in-eval.html:
* inspector/console/console-trace.html:
* inspector/console/console-uncaught-exception.html:
* inspector/debugger/debugger-autocontinue-on-syntax-error.html:
* inspector/debugger/debugger-completions-on-call-frame.html:
* inspector/styles/styles-iframe.html:
* inspector/timeline/timeline-network-resource.html:
* inspector/timeline/timeline-script-tag-1.html:
* inspector/timeline/timeline-script-tag-2.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@93769 268f45cc-cd09-0410-ab3c-d52691b4dbfc

65 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/change-iframe-src.html
LayoutTests/http/tests/inspector/console-cd-completions.html
LayoutTests/http/tests/inspector/console-cd.html
LayoutTests/http/tests/inspector/console-resource-errors.html
LayoutTests/http/tests/inspector/console-test.js
LayoutTests/http/tests/inspector/inspector-test.js
LayoutTests/http/tests/inspector/network/disabled-cache-crash.html
LayoutTests/http/tests/inspector/network/network-cachedresources-with-same-urls.html
LayoutTests/http/tests/inspector/network/network-clear-cache.html-disabled
LayoutTests/http/tests/inspector/network/network-clear-cookies.html-disabled
LayoutTests/http/tests/inspector/network/network-content-replacement-embed.html
LayoutTests/http/tests/inspector/network/network-content-replacement-xhr.html
LayoutTests/http/tests/inspector/network/network-disable-cache-memory.html
LayoutTests/http/tests/inspector/network/network-disable-cache-xhrs.html
LayoutTests/http/tests/inspector/network/network-embed.html
LayoutTests/http/tests/inspector/network/network-iframe-load-and-delete.html
LayoutTests/http/tests/inspector/network/network-initiator-from-console.html
LayoutTests/http/tests/inspector/network/network-initiator.html
LayoutTests/http/tests/inspector/network/network-request-revision-content.html
LayoutTests/http/tests/inspector/network/network-shared-worker.html
LayoutTests/http/tests/inspector/network/network-sidebar-width.html
LayoutTests/http/tests/inspector/network/network-size-chunked.html
LayoutTests/http/tests/inspector/network/network-size-sync.html
LayoutTests/http/tests/inspector/network/network-size.html
LayoutTests/http/tests/inspector/network/network-timing.html
LayoutTests/http/tests/inspector/network/network-worker.html
LayoutTests/http/tests/inspector/network/network-xhr-async.html
LayoutTests/http/tests/inspector/network/network-xhr-sync.html
LayoutTests/http/tests/inspector/protocol-test.js
LayoutTests/http/tests/inspector/resource-tree/resource-tree-frame-add.html
LayoutTests/http/tests/inspector/resource-tree/resource-tree-frame-navigate.html
LayoutTests/http/tests/inspector/resource-tree/resource-tree-no-xhrs.html
LayoutTests/inspector/console/console-assert.html
LayoutTests/inspector/console/console-trace-in-eval.html
LayoutTests/inspector/console/console-trace.html
LayoutTests/inspector/console/console-uncaught-exception.html
LayoutTests/inspector/debugger/debugger-autocontinue-on-syntax-error.html
LayoutTests/inspector/debugger/debugger-completions-on-call-frame.html
LayoutTests/inspector/styles/styles-iframe.html
LayoutTests/inspector/timeline/timeline-network-resource.html
LayoutTests/inspector/timeline/timeline-script-tag-1.html
LayoutTests/inspector/timeline/timeline-script-tag-2.html
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/inspector/compile-front-end.sh
Source/WebCore/inspector/front-end/BreakpointManager.js
Source/WebCore/inspector/front-end/ConsoleMessage.js
Source/WebCore/inspector/front-end/ConsoleModel.js [new file with mode: 0644]
Source/WebCore/inspector/front-end/ConsolePanel.js
Source/WebCore/inspector/front-end/ConsoleView.js
Source/WebCore/inspector/front-end/DebuggerModel.js
Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
Source/WebCore/inspector/front-end/NetworkLog.js [new file with mode: 0644]
Source/WebCore/inspector/front-end/NetworkManager.js
Source/WebCore/inspector/front-end/Resource.js
Source/WebCore/inspector/front-end/ResourceTreeModel.js
Source/WebCore/inspector/front-end/SourceFile.js
Source/WebCore/inspector/front-end/UISourceCode.js
Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
Source/WebCore/inspector/front-end/WebKit.qrc
Source/WebCore/inspector/front-end/externs.js
Source/WebCore/inspector/front-end/inspector.html
Source/WebCore/inspector/front-end/inspector.js

index 56fc293..66f1f69 100644 (file)
@@ -1,3 +1,58 @@
+2011-08-24  Pavel Feldman  <pfeldman@google.com>
+
+        Web Inspector: split ConsoleView into the View and the Model.
+        https://bugs.webkit.org/show_bug.cgi?id=66861
+
+        Reviewed by Yury Semikhatsky.
+
+        * http/tests/inspector/change-iframe-src.html:
+        * http/tests/inspector/console-cd-completions.html:
+        * http/tests/inspector/console-cd.html:
+        * http/tests/inspector/console-resource-errors.html:
+        * http/tests/inspector/console-test.js:
+        (initialize_ConsoleTest.InspectorTest.dumpConsoleMessages):
+        (initialize_ConsoleTest.InspectorTest.dumpConsoleMessagesWithClasses):
+        (initialize_ConsoleTest.InspectorTest.expandConsoleMessages):
+        (initialize_ConsoleTest):
+        * http/tests/inspector/inspector-test.js:
+        (initialize_InspectorTest.InspectorTest.evaluateInConsole):
+        (initialize_InspectorTest):
+        * http/tests/inspector/network/disabled-cache-crash.html:
+        * http/tests/inspector/network/network-cachedresources-with-same-urls.html:
+        * http/tests/inspector/network/network-clear-cache.html-disabled:
+        * http/tests/inspector/network/network-clear-cookies.html-disabled:
+        * http/tests/inspector/network/network-content-replacement-embed.html:
+        * http/tests/inspector/network/network-content-replacement-xhr.html:
+        * http/tests/inspector/network/network-disable-cache-memory.html:
+        * http/tests/inspector/network/network-disable-cache-xhrs.html:
+        * http/tests/inspector/network/network-embed.html:
+        * http/tests/inspector/network/network-iframe-load-and-delete.html:
+        * http/tests/inspector/network/network-initiator-from-console.html:
+        * http/tests/inspector/network/network-initiator.html:
+        * http/tests/inspector/network/network-request-revision-content.html:
+        * http/tests/inspector/network/network-shared-worker.html:
+        * http/tests/inspector/network/network-sidebar-width.html:
+        * http/tests/inspector/network/network-size-chunked.html:
+        * http/tests/inspector/network/network-size-sync.html:
+        * http/tests/inspector/network/network-size.html:
+        * http/tests/inspector/network/network-timing.html:
+        * http/tests/inspector/network/network-worker.html:
+        * http/tests/inspector/network/network-xhr-async.html:
+        * http/tests/inspector/network/network-xhr-sync.html:
+        * http/tests/inspector/resource-tree/resource-tree-frame-add.html:
+        * http/tests/inspector/resource-tree/resource-tree-frame-navigate.html:
+        * http/tests/inspector/resource-tree/resource-tree-no-xhrs.html:
+        * inspector/console/console-assert.html:
+        * inspector/console/console-trace-in-eval.html:
+        * inspector/console/console-trace.html:
+        * inspector/console/console-uncaught-exception.html:
+        * inspector/debugger/debugger-autocontinue-on-syntax-error.html:
+        * inspector/debugger/debugger-completions-on-call-frame.html:
+        * inspector/styles/styles-iframe.html:
+        * inspector/timeline/timeline-network-resource.html:
+        * inspector/timeline/timeline-script-tag-1.html:
+        * inspector/timeline/timeline-script-tag-2.html:
+
 2011-08-25  Pavel Podivilov  <podivilov@chromium.org>
 
         Unreviwed, fix error in chromium test_expectations.
index 9edad9a..94c07b0 100644 (file)
@@ -21,7 +21,7 @@ function test()
     function step1(node)
     {
         node.setAttribute("src", "src=\"http://localhost:8000/inspector/resources/iframe-from-different-domain-data.html\"");
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
     }
 
     function step2()
index 472d6e0..1c90a1e 100644 (file)
@@ -7,7 +7,7 @@
 function test()
 {
     InspectorTest.showConsolePanel();
-    var selector = WebInspector.console._contextSelectElement;
+    var selector = WebInspector.consoleView._contextSelectElement;
     var option = selector.firstChild;
     while (option) {
         if (option.textContent && option.textContent.indexOf("myIFrame") === 0)
@@ -22,7 +22,7 @@ function test()
     option.selected = true;
 
 
-    WebInspector.console._completions("", "myGlob", false, checkCompletions.bind(this));
+    WebInspector.consoleView._completions("", "myGlob", false, checkCompletions.bind(this));
     function checkCompletions(completions)
     {
         var expected = ["myGlobalVar", "myGlobalFunction"];
index 2eeecf7..78c8236 100644 (file)
@@ -8,7 +8,7 @@
 function test()
 {
     InspectorTest.showConsolePanel();
-    var selector = WebInspector.console._contextSelectElement;
+    var selector = WebInspector.consoleView._contextSelectElement;
     var option = selector.firstChild;
     while (option) {
         if (option.textContent && option.textContent.indexOf("myIFrame") === 0)
index 71795ac..c4fe5dc 100644 (file)
@@ -27,7 +27,7 @@ function loadIframe()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", addMessage, true);
+    InspectorTest.addConsoleSniffer(addMessage, true);
 
     var messageCount = 0;
     function addMessage(message)
index 90fbe80..c5f0164 100644 (file)
@@ -9,7 +9,7 @@ InspectorTest.showConsolePanel = function()
 InspectorTest.dumpConsoleMessages = function()
 {
     var result = [];
-    var messages = WebInspector.console.messages;
+    var messages = WebInspector.consoleView.messages;
     for (var i = 0; i < messages.length; ++i) {
         var element = messages[i].toMessageElement();
         InspectorTest.addResult(element.textContent.replace(/\u200b/g, ""));
@@ -19,7 +19,7 @@ InspectorTest.dumpConsoleMessages = function()
 
 InspectorTest.dumpConsoleMessagesWithClasses = function(sortMessages) {
     var result = [];
-    var messages = WebInspector.console.messages;
+    var messages = WebInspector.consoleView.messages;
     for (var i = 0; i < messages.length; ++i) {
         var element = messages[i].toMessageElement();
         result.push(element.textContent.replace(/\u200b/g, "") + " " + element.getAttribute("class"));
@@ -32,7 +32,7 @@ InspectorTest.dumpConsoleMessagesWithClasses = function(sortMessages) {
 
 InspectorTest.expandConsoleMessages = function()
 {
-    var messages = WebInspector.console.messages;
+    var messages = WebInspector.consoleView.messages;
     for (var i = 0; i < messages.length; ++i) {
         var element = messages[i].toMessageElement();
         var node = element;
index b37740a..e6d07e3 100644 (file)
@@ -29,12 +29,12 @@ InspectorTest.evaluateInConsole = function(code, callback)
 {
     callback = InspectorTest.safeWrap(callback);
 
-    WebInspector.console.visible = true;
-    WebInspector.console.prompt.text = code;
+    WebInspector.consoleView.visible = true;
+    WebInspector.consoleView.prompt.text = code;
     var event = document.createEvent("KeyboardEvent");
     event.initKeyboardEvent("keydown", true, true, null, "Enter", "");
-    WebInspector.console.promptElement.dispatchEvent(event);
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage",
+    WebInspector.consoleView.promptElement.dispatchEvent(event);
+    InspectorTest.addConsoleSniffer(
         function(commandResult) {
             callback(commandResult.toMessageElement().textContent);
         });
@@ -315,6 +315,11 @@ InspectorTest.addSniffer = function(receiver, methodName, override, opt_sticky)
     };
 }
 
+InspectorTest.addConsoleSniffer = function(override, opt_sticky)
+{
+    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_appendConsoleMessage", override, opt_sticky);
+}
+
 InspectorTest.override = function(receiver, methodName, override, opt_sticky)
 {
     override = InspectorTest.safeWrap(override);
index 30f976a..1fa994d 100644 (file)
@@ -37,13 +37,13 @@ function test()
 
     function step1(msg)
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("openWindow1()");
     }
 
     function step2(msg)
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step3);
+        InspectorTest.addConsoleSniffer(step3);
         InspectorTest.evaluateInPage("openWindow2()");
     }
 
index 5637905..ec1c259 100644 (file)
@@ -25,7 +25,7 @@ function imageLoaded()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2, true);
+    InspectorTest.addConsoleSniffer(step2, true);
     InspectorTest.evaluateInPage("loadImages()");
 
     function step2(msg)
index c0d1792..5a03774 100644 (file)
@@ -36,7 +36,7 @@ function test()
 
     function step1()
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("loadData()");
     }
 
@@ -50,7 +50,7 @@ function test()
 
     function step3(msg)
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step4);
+        InspectorTest.addConsoleSniffer(step4);
         InspectorTest.evaluateInPage("cacheCleared()");
     }
 
index 68b6c9c..26e0ea2 100644 (file)
@@ -36,7 +36,7 @@ function test()
 
     function step1()
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("loadData()");
     }
 
@@ -50,7 +50,7 @@ function test()
 
     function step3(msg)
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step4);
+        InspectorTest.addConsoleSniffer(step4);
         InspectorTest.evaluateInPage("cookiesCleared()");
     }
 
index 99ee3db..1b742cb 100644 (file)
@@ -62,7 +62,7 @@ function allURLsLoaded()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step1);
+    InspectorTest.addConsoleSniffer(step1);
     InspectorTest.evaluateInPage("onSnifferInstalled()");
 
     function dumpResource(resource, callback)
index 165cb1d..fb475c1 100644 (file)
@@ -41,7 +41,7 @@ function allXHRsLoaded()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step1);
+    InspectorTest.addConsoleSniffer(step1);
     InspectorTest.evaluateInPage("loadData()");
 
     function dumpResource(resource, callback)
index 61b7a2c..980d720 100644 (file)
@@ -22,7 +22,7 @@ function test()
 
     function loadScriptAndGetContent(callback)
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", scriptLoaded);
+        InspectorTest.addConsoleSniffer(scriptLoaded);
         InspectorTest.evaluateInPage("scheduleScriptLoad()");
 
         function scriptLoaded()
index 8b426aa..d50a4be 100644 (file)
@@ -41,7 +41,7 @@ function test()
 
     function step1()
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("loadData()");
     }
 
@@ -52,7 +52,7 @@ function test()
 
     function step3(msg)
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step4);
+        InspectorTest.addConsoleSniffer(step4);
         InspectorTest.evaluateInPage("cacheDisabled()");
     }
 
index ebf5d56..add189b 100644 (file)
@@ -66,7 +66,7 @@ function test()
 
     function step1()
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("onSnifferInstalled()");
     }
 
index 6bfa730..fe677b5 100644 (file)
@@ -38,7 +38,7 @@ function iframeLoadedChangeSrc()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    InspectorTest.addConsoleSniffer(step2);
     InspectorTest.evaluateInPage("loadIframe()");
 
     function step2()
index de2a3b7..f6d1f01 100644 (file)
@@ -18,13 +18,13 @@ var test = function()
 
     function step1()
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceStarted, onResource);
         var str = "";
         str += "var s = document.createElement(\"script\");";
         str += "s.src = \"resources/script.js\";";
         str += "document.head.appendChild(s);";
-        WebInspector.console.evalInInspectedWindow(str, "console", true, undefined, undefined, function(){})
+        WebInspector.consoleView.evalInInspectedWindow(str, "console", true, undefined, undefined, function(){})
     }
 
     function onResource(event)
index 1c4c06a..fd48cce 100644 (file)
@@ -65,7 +65,7 @@ var test = function()
         if (!findResourceByURL(/size=300/))
             return;
 
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step3);
+        InspectorTest.addConsoleSniffer(step3);
         InspectorTest.evaluateInPage("loadData()");
     }
 
index 21497f6..c4de94f 100644 (file)
@@ -11,7 +11,7 @@ function loadScript()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2, true);
+    InspectorTest.addConsoleSniffer(step2, true);
     InspectorTest.evaluateInPage("loadScript()");
 
     function step2(msg)
index 7687c30..fd9b595 100644 (file)
@@ -22,7 +22,7 @@ function test()
 
     function step1()
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("loadData()");
     }
 
index edc5db2..ce410eb 100644 (file)
@@ -15,7 +15,7 @@ function resourceLoaded()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    InspectorTest.addConsoleSniffer(step2);
     InspectorTest.evaluateInPage("loadData()");
 
     var oldSetting;
index ae32bfe..557c4f4 100644 (file)
@@ -17,7 +17,7 @@ function resourceLoaded()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    InspectorTest.addConsoleSniffer(step2);
     InspectorTest.evaluateInPage("loadImages()");
 
     function step2()
index a2614f7..2dc7ad3 100644 (file)
@@ -15,7 +15,7 @@ function resourceLoaded()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    InspectorTest.addConsoleSniffer(step2);
     InspectorTest.evaluateInPage("loadData()");
 
     function step2()
index 8a6244a..b582c00 100644 (file)
@@ -25,7 +25,7 @@ function resourceLoaded()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    InspectorTest.addConsoleSniffer(step2);
     InspectorTest.evaluateInPage("loadImages()");
 
     function step2()
index 649852d..a982e4c 100644 (file)
@@ -24,7 +24,7 @@ function resourceLoaded()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    InspectorTest.addConsoleSniffer(step2);
     InspectorTest.evaluateInPage("loadScripts()");
 
     function step2()
index cf4c175..f30ad1d 100644 (file)
@@ -22,7 +22,7 @@ function test()
 
     function step1()
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("loadData()");
     }
 
index 757a5d0..3562e93 100644 (file)
@@ -21,7 +21,7 @@ function test()
 
     function step1()
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("loadData()");
     }
 
index 65cd3a3..9cb0f04 100644 (file)
@@ -21,7 +21,7 @@ function test()
 
     function step1()
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("loadData()");
     }
 
index dfb4d13..802a0a7 100644 (file)
@@ -101,6 +101,8 @@ InspectorTest.runProtocolTestSuite = function(agentName, testSuite, nondetermini
     var domain = agentName.replace(/Agent$/,"");
     var domainMessagesHandler = InspectorBackend._domainDispatchers[domain];
     for (var eventName in domainMessagesHandler) {
+        if (typeof domainMessagesHandler[eventName] !== "function")
+            continue;
         this._agentCoverage[eventName] = "not checked";
         domainMessagesHandler[eventName] = InspectorTest._dumpEvent.bind(domainMessagesHandler, eventName, domainMessagesHandler[eventName]);
     }
index 27e3a46..8c0dd0f 100644 (file)
@@ -30,7 +30,7 @@ function test()
         InspectorTest.addResult("Before addition");
         InspectorTest.addResult("====================================");
         InspectorTest.dumpResourceTreeEverything();
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("createIframe()");
     }
 
index ca15292..86e529d 100644 (file)
@@ -31,7 +31,7 @@ function test()
         InspectorTest.addResult("Before navigation");
         InspectorTest.addResult("====================================");
         InspectorTest.dumpResourceTreeEverything();
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("navigateIframe()");
     }
 
index 21d1967..63ed345 100644 (file)
@@ -15,7 +15,7 @@ function resourceLoaded()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    InspectorTest.addConsoleSniffer(step2);
     InspectorTest.evaluateInPage("sendXHR()");
 
     function step2()
index dcb9957..7c1f6da 100644 (file)
@@ -27,7 +27,7 @@ function test()
         }
     }
     InspectorTest.evaluateInPage("setTimeout(a, 0)");
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", callback, true);
+    InspectorTest.addConsoleSniffer(callback, true);
 }
 
 </script>
index 003f243..64ce9e1 100644 (file)
@@ -35,7 +35,7 @@ function test()
         InspectorTest.completeTest();
     }
     InspectorTest.evaluateInPage("doEvalSource()");
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", callback);
+    InspectorTest.addConsoleSniffer(callback);
 }
 
 </script>
index be2c2f1..35bf253 100644 (file)
@@ -22,7 +22,7 @@ function test()
         InspectorTest.completeTest();
     }
     InspectorTest.evaluateInPage("setTimeout(a, 0)");
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", callback);
+    InspectorTest.addConsoleSniffer(callback);
 }
 
 </script>
index 995a3e7..20eb982 100644 (file)
@@ -6,7 +6,7 @@
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", addMessage, true);
+    InspectorTest.addConsoleSniffer(addMessage, true);
     InspectorTest.evaluateInPage("loadIframe()");
     function addMessage(message)
     {
index aa3a051..39f7168 100644 (file)
@@ -19,7 +19,7 @@ function test()
     function step1()
     {
         DebuggerAgent.setPauseOnExceptions(WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions);
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("loadIframe()");
     }
 
index ca0e354..9004393 100644 (file)
@@ -23,32 +23,32 @@ var test = function()
 
     function step2()
     {
-        WebInspector.console._completions("", "var", false, checkAgainstGolden.bind(this, [ "var1", "var2" ], [], step3));
+        WebInspector.consoleView._completions("", "var", false, checkAgainstGolden.bind(this, [ "var1", "var2" ], [], step3));
     }
 
     function step3()
     {
-        WebInspector.console._completions("", "di", false, checkAgainstGolden.bind(this, [ "dir", "dirxml" ], [], step4));
+        WebInspector.consoleView._completions("", "di", false, checkAgainstGolden.bind(this, [ "dir", "dirxml" ], [], step4));
     }
 
     function step4()
     {
-        WebInspector.console._completions("", "win", false, checkAgainstGolden.bind(this, [ "window" ], [], step5));
+        WebInspector.consoleView._completions("", "win", false, checkAgainstGolden.bind(this, [ "window" ], [], step5));
     }
 
     function step5()
     {
-        WebInspector.console._completions("", "t", false, checkAgainstGolden.bind(this, [ "this" ], [], step6));
+        WebInspector.consoleView._completions("", "t", false, checkAgainstGolden.bind(this, [ "this" ], [], step6));
     }
 
     function step6()
     {
-        WebInspector.console._completions("var1", "toExp", false, checkAgainstGolden.bind(this, [ "toExponential" ], [], step7));
+        WebInspector.consoleView._completions("var1", "toExp", false, checkAgainstGolden.bind(this, [ "toExponential" ], [], step7));
     }
 
     function step7()
     {
-        WebInspector.console._completions("123", "toExp", false, checkAgainstGolden.bind(this, [], [ "toExponential" ], step8));
+        WebInspector.consoleView._completions("123", "toExp", false, checkAgainstGolden.bind(this, [], [ "toExponential" ], step8));
     }
 
     function step8()
index 2661c2f..d882e2a 100644 (file)
@@ -19,7 +19,7 @@ function loadIframe()
 function test()
 {
     InspectorTest.evaluateInPage("loadIframe()");
-    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step0);
+    InspectorTest.addConsoleSniffer(step0);
 
     function step0()
     {
index 6f46bc3..8dc9815 100644 (file)
@@ -23,7 +23,7 @@ function test()
     function step1()
     {
         InspectorTest.evaluateInPage("performActions()");
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
     }
 
     function step2()
index 2272791..e8f6131 100644 (file)
@@ -16,7 +16,7 @@ function test()
     InspectorTest.startTimeline(step1);
     function step1()
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("performActions()");
     }
 
index 1e0ceb9..3e8f18e 100644 (file)
@@ -16,7 +16,7 @@ function test()
     InspectorTest.startTimeline(step1);
     function step1()
     {
-        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.addConsoleSniffer(step2);
         InspectorTest.evaluateInPage("performActions()");
     }
 
index 0d8e5f8..91281b9 100644 (file)
@@ -1,3 +1,75 @@
+2011-08-24  Pavel Feldman  <pfeldman@google.com>
+
+        Web Inspector: split ConsoleView into the View and the Model.
+        https://bugs.webkit.org/show_bug.cgi?id=66861
+
+        Reviewed by Yury Semikhatsky.
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/compile-front-end.sh:
+        * inspector/front-end/BreakpointManager.js:
+        * inspector/front-end/ConsoleMessage.js:
+        (WebInspector.ConsoleMessage.prototype._format):
+        * inspector/front-end/ConsoleModel.js: Added.
+        (WebInspector.ConsoleModel):
+        (WebInspector.ConsoleModel.prototype._setConsoleMessageExpiredCount):
+        (WebInspector.ConsoleModel.prototype.addMessage):
+        (WebInspector.ConsoleModel.prototype._incrementErrorWarningCount):
+        (WebInspector.ConsoleModel.prototype.requestClearMessages):
+        (WebInspector.ConsoleModel.prototype.clearMessages):
+        (WebInspector.ConsoleDispatcher):
+        (WebInspector.ConsoleDispatcher.prototype.messageAdded):
+        (WebInspector.ConsoleDispatcher.prototype.messageRepeatCountUpdated):
+        * inspector/front-end/ConsolePanel.js:
+        (WebInspector.ConsolePanel):
+        (WebInspector.ConsolePanel.prototype.performSearch):
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView):
+        (WebInspector.ConsoleView.prototype._consoleMessageAdded):
+        (WebInspector.ConsoleView.prototype._appendConsoleCommand):
+        (WebInspector.ConsoleView.prototype._appendConsoleCommandResult):
+        (WebInspector.ConsoleView.prototype._appendConsoleMessage):
+        (WebInspector.ConsoleView.prototype._consoleCleared):
+        (WebInspector.ConsoleView.prototype._registerShortcuts):
+        (WebInspector.ConsoleView.prototype._requestClearMessages):
+        * inspector/front-end/DebuggerModel.js:
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel):
+        (WebInspector.DebuggerPresentationModel.prototype.addSourceMappingListener):
+        (WebInspector.DebuggerPresentationModel.prototype.removeSourceMappingListener):
+        * inspector/front-end/NetworkLog.js: Copied from Source/WebCore/inspector/front-end/externs.js.
+        (WebInspector.NetworkLog):
+        (WebInspector.NetworkLog.prototype.get resources):
+        (WebInspector.NetworkLog.prototype._frameNavigated):
+        (WebInspector.NetworkLog.prototype._onResourceStarted):
+        * inspector/front-end/NetworkManager.js:
+        (WebInspector.NetworkDispatcher.prototype._updateResourceWithResponse):
+        (WebInspector.NetworkDispatcher.prototype._mimeTypeIsConsistentWithType):
+        * inspector/front-end/Resource.js:
+        (WebInspector.Resource.prototype.set finished):
+        * inspector/front-end/ResourceTreeModel.js:
+        (WebInspector.ResourceTreeModel):
+        * inspector/front-end/SourceFile.js:
+        (WebInspector.RawSourceCode.prototype._scriptForRawLocation):
+        (WebInspector.ScriptContentProvider.prototype.requestContent):
+        (WebInspector.ConcatenatedScriptsContentProvider.prototype._concatenateScriptsContent.appendChunk):
+        (WebInspector.ConcatenatedScriptsContentProvider.prototype._concatenateScriptsContent):
+        * inspector/front-end/UISourceCode.js:
+        (WebInspector.ContentProvider):
+        (WebInspector.ContentProvider.prototype.requestContent):
+        * inspector/front-end/WatchExpressionsSidebarPane.js:
+        (WebInspector.WatchExpressionsSection.prototype.update):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/externs.js:
+        (WebInspector.linkifyURLAsNode):
+        (WebInspector.formatLinkText):
+        * inspector/front-end/inspector.html:
+        * inspector/front-end/inspector.js:
+        (WebInspector._createGlobalStatusBarItems):
+        (WebInspector._updateErrorAndWarningCounts):
+        (WebInspector.showConsole):
+
 2011-08-24  Alexander Pavlov  <apavlov@chromium.org>
 
         Web Inspector: Directional arrow on element info box looks terrible
index 9d7b0cc..14be1a9 100644 (file)
             'inspector/front-end/Checkbox.js',
             'inspector/front-end/Color.js',
             'inspector/front-end/ConsoleMessage.js',
+            'inspector/front-end/ConsoleModel.js',
             'inspector/front-end/ConsolePanel.js',
             'inspector/front-end/ConsoleView.js',
             'inspector/front-end/JavaScriptContextManager.js',
             'inspector/front-end/MetricsSidebarPane.js',
             'inspector/front-end/NetworkItemView.js',
             'inspector/front-end/NetworkManager.js',
+            'inspector/front-end/NetworkLog.js',
             'inspector/front-end/NetworkPanel.js',
             'inspector/front-end/Object.js',
             'inspector/front-end/ObjectPropertiesSection.js',
index ad9051f..14935f2 100755 (executable)
                                        >
                                </File>
                                <File
+                                       RelativePath="..\inspector\front-end\ConsoleModel.js"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\inspector\front-end\ConsoleView.js"
                                        >
                                </File>
                                        >
                                </File>
                                <File
+                                       RelativePath="..\inspector\front-end\NetworkLog.js"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\inspector\front-end\networkPanel.css"
                                        >
                                </File>
index fa1202e..6b6c8b2 100755 (executable)
@@ -34,22 +34,32 @@ python Source/WebCore/inspector/generate-protocol-externs -o Source/WebCore/insp
 java -jar ~/closure/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE --language_in ECMASCRIPT5 --accept_const_keyword \
     --externs Source/WebCore/inspector/front-end/externs.js \
     --externs Source/WebCore/inspector/front-end/protocol-externs.js \
-    --module jsmodule_core:2 \
+    --module jsmodule_util:2 \
         --js Source/WebCore/inspector/front-end/utilities.js \
         --js Source/WebCore/inspector/front-end/treeoutline.js \
-    --module jsmodule_env:3 \
-        --js Source/WebCore/inspector/front-end/Settings.js \
-        --js Source/WebCore/inspector/front-end/UserMetrics.js \
+    --module jsmodule_host:1 \
         --js Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js \
-    --module jsmodule_sdk:8:jsmodule_core,jsmodule_env \
+    --module jsmodule_common:4:jsmodule_util,jsmodule_host \
         --js Source/WebCore/inspector/front-end/BinarySearch.js \
+        --js Source/WebCore/inspector/front-end/Object.js \
+        --js Source/WebCore/inspector/front-end/Settings.js \
+        --js Source/WebCore/inspector/front-end/UserMetrics.js \
+    --module jsmodule_sdk:15:jsmodule_common,jsmodule_host \
+        --js Source/WebCore/inspector/front-end/DebuggerModel.js \
+        --js Source/WebCore/inspector/front-end/BreakpointManager.js \
+        --js Source/WebCore/inspector/front-end/ConsoleMessage.js \
+        --js Source/WebCore/inspector/front-end/ConsoleModel.js \
+        --js Source/WebCore/inspector/front-end/DebuggerPresentationModel.js \
         --js Source/WebCore/inspector/front-end/CookieParser.js \
         --js Source/WebCore/inspector/front-end/DOMAgent.js \
-        --js Source/WebCore/inspector/front-end/DebuggerModel.js \
-        --js Source/WebCore/inspector/front-end/Object.js \
+        --js Source/WebCore/inspector/front-end/NetworkManager.js \
         --js Source/WebCore/inspector/front-end/Script.js \
+        --js Source/WebCore/inspector/front-end/ScriptFormatter.js \
+        --js Source/WebCore/inspector/front-end/SourceFile.js \
         --js Source/WebCore/inspector/front-end/RemoteObject.js \
+        --js Source/WebCore/inspector/front-end/Resource.js \
         --js Source/WebCore/inspector/front-end/ResourceCategory.js \
+        --js Source/WebCore/inspector/front-end/UISourceCode.js \
     --module jsmodule_misc:10:jsmodule_sdk \
         --js Source/WebCore/inspector/front-end/Checkbox.js \
         --js Source/WebCore/inspector/front-end/ContextMenu.js \
index 5f964d1..a82e9dc 100644 (file)
@@ -235,6 +235,9 @@ WebInspector.BreakpointManager.prototype = {
     }
 }
 
+/**
+ * @constructor
+ */
 WebInspector.Breakpoint = function(uiSourceCodeId, lineNumber, condition, enabled, persistent)
 {
     this.uiSourceCodeId = uiSourceCodeId;
index 333def9..a717fa5 100644 (file)
@@ -215,7 +215,7 @@ WebInspector.ConsoleMessage.prototype = {
             if (shouldFormatMessage && parameters[i].type === "string")
                 formattedResult.appendChild(document.createTextNode(parameters[i].description));
             else
-                formattedResult.appendChild(WebInspector.console._format(parameters[i]));
+                formattedResult.appendChild(WebInspector.consoleView._format(parameters[i]));
             if (i < parameters.length - 1)
                 formattedResult.appendChild(document.createTextNode(" "));
         }
@@ -229,7 +229,7 @@ WebInspector.ConsoleMessage.prototype = {
         function consoleFormatWrapper(force)
         {
             return function(obj) {
-                return WebInspector.console._format(obj, force);
+                return WebInspector.consoleView._format(obj, force);
             };
         }
 
diff --git a/Source/WebCore/inspector/front-end/ConsoleModel.js b/Source/WebCore/inspector/front-end/ConsoleModel.js
new file mode 100644 (file)
index 0000000..c9db595
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+/**
+ * @constructor
+ */
+WebInspector.ConsoleModel = function(drawer)
+{
+    this.messages = [];
+    this.warnings = 0;
+    this.errors = 0;
+    InspectorBackend.registerConsoleDispatcher(new WebInspector.ConsoleDispatcher(this));
+}
+
+WebInspector.ConsoleModel.Events = {
+    ConsoleCleared: "console-cleared",
+    MessageAdded: "console-message-added",
+}
+
+WebInspector.ConsoleModel.prototype = {
+    enableAgent: function()
+    {
+        if (WebInspector.settings.monitoringXHREnabled.get())
+            ConsoleAgent.setMonitoringXHREnabled(true);
+    
+        // There is no console agent for workers yet.
+        if (!WebInspector.WorkerManager.isWorkerFrontend())
+            ConsoleAgent.enable(this._setConsoleMessageExpiredCount.bind(this));
+    },
+
+    _setConsoleMessageExpiredCount: function(count)
+    {
+        if (count) {
+            var message = String.sprintf(WebInspector.UIString("%d console messages are not shown."), count);
+            this.addMessage(WebInspector.ConsoleMessage.createTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
+        }
+    },
+
+    addMessage: function(msg)
+    {
+        this.messages.push(msg);
+        this._incrementErrorWarningCount(msg);
+        this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.MessageAdded, msg);
+    },
+
+    _incrementErrorWarningCount: function(msg)
+    {
+        switch (msg.level) {
+            case WebInspector.ConsoleMessage.MessageLevel.Warning:
+                this.warnings += msg.repeatDelta;
+                break;
+            case WebInspector.ConsoleMessage.MessageLevel.Error:
+                this.errors += msg.repeatDelta;
+                break;
+        }
+    },
+
+    requestClearMessages: function()
+    {
+        ConsoleAgent.clearConsoleMessages();
+        this.clearMessages();
+    },
+
+    clearMessages: function()
+    {
+        this.messages = [];
+
+        this.errors = 0;
+        this.warnings = 0;
+
+        this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.ConsoleCleared);
+    }
+}
+
+WebInspector.ConsoleModel.prototype.__proto__ = WebInspector.Object.prototype;
+
+/**
+ * @constructor
+ * @implements {ConsoleAgent.Dispatcher}
+ * @param {WebInspector.ConsoleModel} console
+ */
+WebInspector.ConsoleDispatcher = function(console)
+{
+    this._console = console;
+}
+
+WebInspector.ConsoleDispatcher.prototype = {
+    messageAdded: function(payload)
+    {
+        var consoleMessage = new WebInspector.ConsoleMessage(
+            payload.source,
+            payload.type,
+            payload.level,
+            payload.line,
+            payload.url,
+            payload.repeatCount,
+            payload.text,
+            payload.parameters,
+            payload.stackTrace,
+            payload.networkRequestId ? WebInspector.networkResourceById(payload.networkRequestId) : undefined);
+        this._console.addMessage(consoleMessage);
+    },
+
+    messageRepeatCountUpdated: function(count)
+    {
+        var msg = this._console.previousMessage;
+        if (!msg)
+            return;
+
+        var prevRepeatCount = msg.totalRepeatCount;
+
+        if (!this._console.commandSincePreviousMessage) {
+            msg.repeatDelta = count - prevRepeatCount;
+            msg.repeatCount = msg.repeatCount + msg.repeatDelta;
+            msg.totalRepeatCount = count;
+            msg._updateRepeatCount();
+            this._console._incrementErrorWarningCount(msg);
+            this._console.dispatchEventToListeners(WebInspector.ConsoleModel.Events.MessageAdded, 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, msg._request);
+            msgCopy.totalRepeatCount = count;
+            msgCopy._formatMessage();
+            this._console.addMessage(msgCopy);
+        }
+    },
+
+    messagesCleared: function()
+    {
+        if (!WebInspector.settings.preserveConsoleLog.get())
+            this._console.clearMessages();
+    }
+}
+
+/**
+ * @type {?WebInspector.ConsoleModel}
+ */
+WebInspector.console = null;
index da4b743..d2e73cd 100644 (file)
@@ -29,8 +29,8 @@
 WebInspector.ConsolePanel = function()
 {
     WebInspector.Panel.call(this, "console");
-    WebInspector.console.addEventListener(WebInspector.ConsoleView.Events.EntryAdded, this._consoleMessageAdded, this);
-    WebInspector.console.addEventListener(WebInspector.ConsoleView.Events.ConsoleCleared, this._consoleCleared, this);
+    WebInspector.consoleView.addEventListener(WebInspector.ConsoleView.Events.EntryAdded, this._consoleMessageAdded, this);
+    WebInspector.consoleView.addEventListener(WebInspector.ConsoleView.Events.ConsoleCleared, this._consoleCleared, this);
 }
 
 WebInspector.ConsolePanel.prototype = {
@@ -98,7 +98,7 @@ WebInspector.ConsolePanel.prototype = {
         this._searchRegex = createSearchRegex(query, "g");
 
         this._searchResults = [];
-        var messages = WebInspector.console.messages;
+        var messages = WebInspector.consoleView.messages;
         for (var i = 0; i < messages.length; i++) {
             if (messages[i].matchesRegex(this._searchRegex)) {
                 this._searchResults.push(messages[i]);
index 801ee45..89cbb33 100644 (file)
@@ -38,7 +38,7 @@ WebInspector.ConsoleView = function(drawer)
 
     this.clearButton = document.getElementById("clear-console-status-bar-item");
     this.clearButton.title = WebInspector.UIString("Clear console log.");
-    this.clearButton.addEventListener("click", this._clearButtonClicked.bind(this), false);
+    this.clearButton.addEventListener("click", this._requestClearMessages.bind(this), false);
 
     this._contextSelectElement = document.getElementById("console-context");
     if (WebInspector.WorkerManager.isWorkerFrontend())
@@ -100,74 +100,18 @@ WebInspector.ConsoleView = function(drawer)
         "string": this._formatstring
     };
 
-    this._registerConsoleDomainDispatcher();
-
     WebInspector.settings.monitoringXHREnabled.addChangeListener(this._monitoringXHREnabledSettingChanged.bind(this));
+
+    WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._consoleMessageAdded, this);
+    WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared, this._consoleCleared, this);
 }
 
 WebInspector.ConsoleView.Events = {
   ConsoleCleared: "console-cleared",
   EntryAdded: "console-entry-added",
-  MessageAdded: "console-message-added"
 }
 
 WebInspector.ConsoleView.prototype = {
-    _registerConsoleDomainDispatcher: function() {
-        var console = this;
-        var dispatcher = {
-            messageAdded: function(payload)
-            {
-                var consoleMessage = new WebInspector.ConsoleMessage(
-                    payload.source,
-                    payload.type,
-                    payload.level,
-                    payload.line,
-                    payload.url,
-                    payload.repeatCount,
-                    payload.text,
-                    payload.parameters,
-                    payload.stackTrace,
-                    payload.networkRequestId ? WebInspector.networkResourceById(payload.networkRequestId) : undefined);
-                console.addMessage(consoleMessage);
-            },
-
-            messageRepeatCountUpdated: function(count)
-            {
-                var msg = console.previousMessage;
-                var prevRepeatCount = msg.totalRepeatCount;
-
-                if (!console.commandSincePreviousMessage) {
-                    msg.repeatDelta = count - prevRepeatCount;
-                    msg.repeatCount = msg.repeatCount + msg.repeatDelta;
-                    msg.totalRepeatCount = count;
-                    msg._updateRepeatCount();
-                    console._incrementErrorWarningCount(msg);
-                    console.dispatchEventToListeners(WebInspector.ConsoleView.Events.MessageAdded, 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, msg._request);
-                    msgCopy.totalRepeatCount = count;
-                    msgCopy._formatMessage();
-                    console.addMessage(msgCopy);
-                }
-            },
-
-            messagesCleared: function()
-            {
-                if (!WebInspector.settings.preserveConsoleLog.get())
-                    console.clearMessages();
-            },
-        }
-        InspectorBackend.registerConsoleDispatcher(dispatcher);
-    },
-
-    setConsoleMessageExpiredCount: function(count)
-    {
-        if (count) {
-            var message = String.sprintf(WebInspector.UIString("%d console messages are not shown."), count);
-            this.addMessage(WebInspector.ConsoleMessage.createTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
-        }
-    },
-
     addContext: function(context)
     {
         var option = document.createElement("option");
@@ -310,20 +254,28 @@ WebInspector.ConsoleView.prototype = {
         this._scrollIntoViewTimer = setTimeout(scrollIntoView.bind(this), 20);
     },
 
-    addMessage: function(msg)
+    _consoleMessageAdded: function(event)
     {
-        var shouldScrollToLastMessage = this.messagesElement.isScrolledToBottom();
+        this.commandSincePreviousMessage = false;
+        this.previousMessage = event.data;
+        this._appendConsoleMessage(event.data);
+    },
 
-        if (msg instanceof WebInspector.ConsoleMessage && !(msg instanceof WebInspector.ConsoleCommandResult)) {
-            this._incrementErrorWarningCount(msg);
-            this.dispatchEventToListeners(WebInspector.ConsoleView.Events.MessageAdded, msg);
-            this.commandSincePreviousMessage = false;
-            this.previousMessage = msg;
-        } else if (msg instanceof WebInspector.ConsoleCommand) {
-            if (this.previousMessage) {
-                this.commandSincePreviousMessage = true;
-            }
-        }
+    _appendConsoleCommand: function(msg)
+    {
+        if (this.previousMessage)
+            this.commandSincePreviousMessage = true;
+        this._appendConsoleMessage(msg);
+    },
+
+    _appendConsoleCommandResult: function(msg)
+    {
+        this._appendConsoleMessage(msg);
+    },
+
+    _appendConsoleMessage: function(msg)
+    {
+        var shouldScrollToLastMessage = this.messagesElement.isScrolledToBottom();
 
         this.messages.push(msg);
 
@@ -348,38 +300,17 @@ WebInspector.ConsoleView.prototype = {
         this.dispatchEventToListeners(WebInspector.ConsoleView.Events.EntryAdded, msg);
     },
 
-    _incrementErrorWarningCount: function(msg)
-    {
-        switch (msg.level) {
-            case WebInspector.ConsoleMessage.MessageLevel.Warning:
-                WebInspector.warnings += msg.repeatDelta;
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Error:
-                WebInspector.errors += msg.repeatDelta;
-                break;
-        }
-    },
-
-    requestClearMessages: function()
+    _consoleCleared: function()
     {
-        ConsoleAgent.clearConsoleMessages();
-        this.clearMessages();
-    },
-
-    clearMessages: function()
-    {
-        this.dispatchEventToListeners(WebInspector.ConsoleView.Events.ConsoleCleared);
-
         this.messages = [];
 
         this.currentGroup = this.topGroup;
         this.topGroup.messagesElement.removeChildren();
 
-        WebInspector.errors = 0;
-        WebInspector.warnings = 0;
-
         delete this.commandSincePreviousMessage;
         delete this.previousMessage;
+        
+        this.dispatchEventToListeners(WebInspector.ConsoleView.Events.ConsoleCleared);
     },
 
     completions: function(wordRange, bestMatchOnly, completionsReadyCallback)
@@ -514,11 +445,6 @@ WebInspector.ConsoleView.prototype = {
         completionsReadyCallback(results);
     },
 
-    _clearButtonClicked: function()
-    {
-        this.requestClearMessages();
-    },
-
     _handleContextMenuEvent: function(event)
     {
         if (!window.getSelection().isCollapsed) {
@@ -545,7 +471,7 @@ WebInspector.ConsoleView.prototype = {
         contextMenu.appendCheckboxItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Preserve log upon navigation" : "Preserve Log upon Navigation"), preserveLogItemAction.bind(this), WebInspector.settings.preserveConsoleLog.get());
 
         contextMenu.appendSeparator();
-        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear console" : "Clear Console"), this.requestClearMessages.bind(this));
+        contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear console" : "Clear Console"), this._requestClearMessages.bind(this));
         contextMenu.show(event);
     },
 
@@ -575,10 +501,10 @@ WebInspector.ConsoleView.prototype = {
         var shortcut = WebInspector.KeyboardShortcut;
         var shortcutK = shortcut.makeDescriptor("k", WebInspector.KeyboardShortcut.Modifiers.Meta);
         // This case requires a separate bound function as its isMacOnly property should not be shared among different shortcut handlers.
-        this._shortcuts[shortcutK.key] = this.requestClearMessages.bind(this);
+        var clearConsoleHandler = this._requestClearMessages.bind(this);
+        this._shortcuts[shortcutK.key] = clearConsoleHandler;
         this._shortcuts[shortcutK.key].isMacOnly = true;
 
-        var clearConsoleHandler = this.requestClearMessages.bind(this);
         var shortcutL = shortcut.makeDescriptor("l", WebInspector.KeyboardShortcut.Modifiers.Ctrl);
         this._shortcuts[shortcutL.key] = clearConsoleHandler;
 
@@ -606,6 +532,11 @@ WebInspector.ConsoleView.prototype = {
         section.addKey(shortcut.shortcutToString(shortcut.Keys.Enter), WebInspector.UIString("Execute command"));
     },
 
+    _requestClearMessages: function()
+    {
+        WebInspector.console.requestClearMessages();
+    },
+
     _promptKeyDown: function(event)
     {
         if (isEnterKey(event)) {
@@ -667,23 +598,22 @@ WebInspector.ConsoleView.prototype = {
             return;
 
         var commandMessage = new WebInspector.ConsoleCommand(str);
-        this.addMessage(commandMessage);
+        this._appendConsoleCommand(commandMessage);
 
-        var self = this;
         function printResult(result, wasThrown)
         {
             if (!result)
                 return;
 
-            self.prompt.history.push(str);
-            self.prompt.historyOffset = 0;
-            self.prompt.text = "";
+            this.prompt.history.push(str);
+            this.prompt.historyOffset = 0;
+            this.prompt.text = "";
 
-            WebInspector.settings.consoleHistory.set(self.prompt.history.slice(-30));
+            WebInspector.settings.consoleHistory.set(this.prompt.history.slice(-30));
 
-            self.addMessage(new WebInspector.ConsoleCommandResult(result, wasThrown, commandMessage));
+            this._appendConsoleCommandResult(new WebInspector.ConsoleCommandResult(result, wasThrown, commandMessage));
         }
-        this.evalInInspectedWindow(str, "console", true, undefined, undefined, printResult);
+        this.evalInInspectedWindow(str, "console", true, undefined, undefined, printResult.bind(this));
 
         WebInspector.userMetrics.ConsoleEvaluated.record();
     },
index 074f05b..575e1c0 100644 (file)
@@ -30,6 +30,7 @@
 
 /**
  * @constructor
+ * @extends {WebInspector.Object}
  */
 WebInspector.DebuggerModel = function()
 {
index cca14e5..edaf46a 100644 (file)
@@ -51,8 +51,8 @@ WebInspector.DebuggerPresentationModel = function()
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this);
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Reset, this._debuggerReset, this);
 
-    WebInspector.console.addEventListener(WebInspector.ConsoleView.Events.MessageAdded, this._consoleMessageAdded, this);
-    WebInspector.console.addEventListener(WebInspector.ConsoleView.Events.ConsoleCleared, this._consoleCleared, this);
+    WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._consoleMessageAdded, this);
+    WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared, this._consoleCleared, this);
 
     new WebInspector.DebuggerPresentationModelResourceBinding(this);
 }
@@ -113,12 +113,12 @@ WebInspector.DebuggerPresentationModel.prototype = {
         this._sourceFiles[sourceFileId].requestContent(callback);
     },
 
-    addSourceMappingListener: function(sourceURL, sourceId, listener)
+    addSourceMappingListener: function(sourceURL, scriptId, listener)
     {
         this._sourceMappingListeners.push(listener);
     },
 
-    removeSourceMappingListener: function(sourceURL, sourceId, listener)
+    removeSourceMappingListener: function(sourceURL, scriptId, listener)
     {
         // FIXME: implement this.
     },
diff --git a/Source/WebCore/inspector/front-end/NetworkLog.js b/Source/WebCore/inspector/front-end/NetworkLog.js
new file mode 100644 (file)
index 0000000..7ba60f3
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+/**
+ * @constructor
+ */
+WebInspector.NetworkLog = function()
+{
+    this._resources = [];
+    WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceStarted, this._onResourceStarted, this);
+    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
+}
+
+WebInspector.NetworkLog.prototype = {
+    get resources()
+    {
+        return this._resources;
+    },
+
+    _frameNavigated: function(event)
+    {
+        if (!event.data.isMainFrame)
+            return;
+        // Preserve resources from the new session.
+        var oldResources = this._resources.splice(0, this._resources.length);
+        for (var i = 0; i < oldResources.length; ++i) {
+            if (oldResources[i].loaderId === event.data.loaderId)
+                this._resources.push(oldResources[i]);
+        }
+    },
+
+    _onResourceStarted: function(event)
+    {
+        this._resources.push(event.data);
+    }
+}
index 7deb000..14b1f44 100644 (file)
@@ -30,6 +30,7 @@
 
 /**
  * @constructor
+ * @extends {WebInspector.Object}
  */
 WebInspector.NetworkManager = function()
 {
@@ -124,6 +125,42 @@ WebInspector.NetworkDispatcher.prototype = {
             resource.cached = true;
         else
             resource.timing = response.timing;
+
+        if (!this._mimeTypeIsConsistentWithType(resource)) {
+            WebInspector.console.addMessage(new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other,
+                WebInspector.ConsoleMessage.MessageType.Log,
+                WebInspector.ConsoleMessage.MessageLevel.Warning,
+                -1,
+                this.url,
+                1,
+                WebInspector.UIString("Resource interpreted as %s but transferred with MIME type %s.", WebInspector.Resource.Type.toUIString(this.type), this.mimeType)));
+        }
+    },
+
+    _mimeTypeIsConsistentWithType: function(resource)
+    {
+        // If status is an error, content is likely to be of an inconsistent type,
+        // as it's going to be an error message. We do not want to emit a warning
+        // for this, though, as this will already be reported as resource loading failure.
+        // Also, if a URL like http://localhost/wiki/load.php?debug=true&lang=en produces text/css and gets reloaded,
+        // it is 304 Not Modified and its guessed mime-type is text/php, which is wrong.
+        // Don't check for mime-types in 304-resources.
+        if (resource.hasErrorStatusCode() || resource.statusCode === 304)
+            return true;
+
+        if (typeof resource.type === "undefined"
+            || resource.type === WebInspector.Resource.Type.Other
+            || resource.type === WebInspector.Resource.Type.XHR
+            || resource.type === WebInspector.Resource.Type.WebSocket)
+            return true;
+
+        if (!resource.mimeType)
+            return true; // Might be not known for cached resources with null responses.
+
+        if (resource.mimeType in WebInspector.MIMETypes)
+            return resource.type in WebInspector.MIMETypes[resource.mimeType];
+
+        return false;
     },
 
     _updateResourceWithCachedResource: function(resource, cachedResource)
@@ -325,35 +362,6 @@ WebInspector.NetworkDispatcher.prototype = {
 }
 
 /**
- * @constructor
+ * @type {?WebInspector.NetworkManager}
  */
-WebInspector.NetworkLog = function()
-{
-    this._resources = [];
-    WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceStarted, this._onResourceStarted, this);
-    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
-}
-
-WebInspector.NetworkLog.prototype = {
-    get resources()
-    {
-        return this._resources;
-    },
-
-    _frameNavigated: function(event)
-    {
-        if (!event.data.isMainFrame)
-            return;
-        // Preserve resources from the new session.
-        var oldResources = this._resources.splice(0, this._resources.length);
-        for (var i = 0; i < oldResources.length; ++i) {
-            if (oldResources[i].loaderId === event.data.loaderId)
-                this._resources.push(oldResources[i]);
-        }
-    },
-
-    _onResourceStarted: function(event)
-    {
-        this._resources.push(event.data);
-    }
-}
+WebInspector.networkManager = null;
index c24e6d1..b4b35c9 100644 (file)
@@ -423,7 +423,6 @@ WebInspector.Resource.prototype = {
         this._finished = x;
 
         if (x) {
-            this._checkWarnings();
             this.dispatchEventToListeners("finished");
             if (this._pendingContentCallbacks.length)
                 this._innerRequestContent();
@@ -782,48 +781,6 @@ WebInspector.Resource.prototype = {
         this.dispatchEventToListeners("errors-warnings-cleared");
     },
 
-    _mimeTypeIsConsistentWithType: function()
-    {
-        // If status is an error, content is likely to be of an inconsistent type,
-        // as it's going to be an error message. We do not want to emit a warning
-        // for this, though, as this will already be reported as resource loading failure.
-        // Also, if a URL like http://localhost/wiki/load.php?debug=true&lang=en produces text/css and gets reloaded,
-        // it is 304 Not Modified and its guessed mime-type is text/php, which is wrong.
-        // Don't check for mime-types in 304-resources.
-        if (this.hasErrorStatusCode() || this.statusCode === 304)
-            return true;
-
-        if (typeof this.type === "undefined"
-            || this.type === WebInspector.Resource.Type.Other
-            || this.type === WebInspector.Resource.Type.XHR
-            || this.type === WebInspector.Resource.Type.WebSocket)
-            return true;
-
-        if (!this.mimeType)
-            return true; // Might be not known for cached resources with null responses.
-
-        if (this.mimeType in WebInspector.MIMETypes)
-            return this.type in WebInspector.MIMETypes[this.mimeType];
-
-        return false;
-    },
-
-    _checkWarnings: function()
-    {
-        if (this._mimeTypeIsConsistentWithType())
-            return;
-
-        WebInspector.console.addMessage(new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other,
-            WebInspector.ConsoleMessage.MessageType.Log,
-            WebInspector.ConsoleMessage.MessageLevel.Warning,
-            -1,
-            this.url,
-            1,
-            WebInspector.UIString("Resource interpreted as %s but transferred with MIME type %s.", WebInspector.Resource.Type.toUIString(this.type), this.mimeType),
-            null,
-            null));
-    },
-
     get content()
     {
         return this._content;
index 298d255..aaeea62 100644 (file)
@@ -38,8 +38,8 @@ WebInspector.ResourceTreeModel = function(networkManager)
     WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceUpdated, this._onResourceUpdated, this);
     WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._onResourceUpdated, this);
 
-    WebInspector.console.addEventListener(WebInspector.ConsoleView.Events.MessageAdded, this._consoleMessageAdded, this);
-    WebInspector.console.addEventListener(WebInspector.ConsoleView.Events.ConsoleCleared, this._consoleCleared, this);
+    WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._consoleMessageAdded, this);
+    WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared, this._consoleCleared, this);
 
     this.frontendReused();
     InspectorBackend.registerPageDispatcher(new WebInspector.PageDispatcher(this));
index d2076e5..42ea787 100644 (file)
 
 // RawSourceCode represents JavaScript resource or HTML resource with inlined scripts
 // as it came from network.
+
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ */
 WebInspector.RawSourceCode = function(id, script, formatter)
 {
     this._scripts = [script];
@@ -91,7 +96,7 @@ WebInspector.RawSourceCode.prototype = {
     {
         var closestScript = this._scripts[0];
         for (var i = 1; i < this._scripts.length; ++i) {
-            script = this._scripts[i];
+            var script = this._scripts[i];
             if (script.lineOffset > lineNumber || (script.lineOffset === lineNumber && script.columnOffset > columnNumber))
                 continue;
             if (script.lineOffset > closestScript.lineOffset ||
@@ -253,6 +258,10 @@ WebInspector.RawSourceCode.prototype = {
 WebInspector.RawSourceCode.prototype.__proto__ = WebInspector.Object.prototype;
 
 
+/**
+ * @constructor
+ * @implements {WebInspector.ContentProvider}
+ */
 WebInspector.ScriptContentProvider = function(script)
 {
     this._mimeType = "text/javascript";
@@ -260,19 +269,22 @@ WebInspector.ScriptContentProvider = function(script)
 };
 
 WebInspector.ScriptContentProvider.prototype = {
-requestContent: function(callback)
-{
-    function didRequestSource(source)
+    requestContent: function(callback)
     {
-        callback(this._mimeType, source);
+        function didRequestSource(source)
+        {
+            callback(this._mimeType, source);
+        }
+        this._script.requestSource(didRequestSource.bind(this));
     }
-    this._script.requestSource(didRequestSource.bind(this));
-}
 }
 
 WebInspector.ScriptContentProvider.prototype.__proto__ = WebInspector.ContentProvider.prototype;
 
-
+/**
+ * @constructor
+ * @implements {WebInspector.ContentProvider}
+ */
 WebInspector.ConcatenatedScriptsContentProvider = function(scripts)
 {
     this._mimeType = "text/html";
@@ -300,8 +312,8 @@ WebInspector.ConcatenatedScriptsContentProvider.prototype = {
        var content = "";
        var lineNumber = 0;
        var columnNumber = 0;
-       var scriptRanges = [];
-       function appendChunk(chunk, script)
+
+       function appendChunk(chunk)
        {
            var start = { lineNumber: lineNumber, columnNumber: columnNumber };
            content += chunk;
@@ -314,8 +326,6 @@ WebInspector.ConcatenatedScriptsContentProvider.prototype = {
                columnNumber = lineEndings[lineCount - 1] - lineEndings[lineCount - 2] - 1;
            }
            var end = { lineNumber: lineNumber, columnNumber: columnNumber };
-           if (script)
-               scriptRanges.push({ start: start, end: end, sourceId: script.sourceId });
        }
 
        var scriptOpenTag = "<script>";
@@ -329,7 +339,7 @@ WebInspector.ConcatenatedScriptsContentProvider.prototype = {
 
            // Add script tag.
            appendChunk(scriptOpenTag);
-           appendChunk(sources[i], scripts[i]);
+           appendChunk(sources[i]);
            appendChunk(scriptCloseTag);
        }
 
@@ -339,7 +349,10 @@ WebInspector.ConcatenatedScriptsContentProvider.prototype = {
 
 WebInspector.ConcatenatedScriptsContentProvider.prototype.__proto__ = WebInspector.ContentProvider.prototype;
 
-
+/**
+ * @constructor
+ * @implements {WebInspector.ContentProvider}
+ */
 WebInspector.ResourceContentProvider = function(resource)
 {
     this._mimeType = resource.type === WebInspector.Resource.Type.Script ? "text/javascript" : "text/html";
index 0361708..91fc70c 100644 (file)
@@ -28,6 +28,9 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @constructor
+ */
 WebInspector.UISourceCode = function(id, url, isContentScript, contentProvider)
 {
     this._id = id;
@@ -76,13 +79,10 @@ WebInspector.UISourceCode.prototype = {
     }
 }
 
-WebInspector.ContentProvider = function()
-{
-}
-
+/**
+ * @interface
+ */
+WebInspector.ContentProvider = function() { }
 WebInspector.ContentProvider.prototype = {
-    requestContent: function(callback)
-    {
-        // Should be implemented by subclasses.
-    }
+    requestContent: function(callback) { }
 }
index 65a400f..1d1ecc1 100644 (file)
@@ -186,7 +186,7 @@ WebInspector.WatchExpressionsSection.prototype = {
             if (!expression)
                 continue;
 
-            WebInspector.console.evalInInspectedWindow(expression, this._watchObjectGroupId, false, true, undefined, appendResult.bind(this, expression, i));
+            WebInspector.consoleView.evalInInspectedWindow(expression, this._watchObjectGroupId, false, true, undefined, appendResult.bind(this, expression, i));
         }
 
         if (!propertyCount) {
index 057417c..a238e26 100644 (file)
@@ -16,6 +16,7 @@
     <file>Checkbox.js</file>
     <file>Color.js</file>
     <file>ConsoleMessage.js</file>
+    <file>ConsoleModel.js</file>
     <file>ConsolePanel.js</file>
     <file>ConsoleView.js</file>
     <file>ContextMenu.js</file>
@@ -68,6 +69,7 @@
     <file>KeyboardShortcut.js</file>
     <file>MetricsSidebarPane.js</file>
     <file>NetworkItemView.js</file>
+    <file>NetworkLog.js</file>
     <file>NetworkManager.js</file>
     <file>NetworkPanel.js</file>
     <file>Object.js</file>
index 9198383..cc35914 100644 (file)
@@ -34,12 +34,26 @@ console.warn = function(message) {}
 console.assert = function(expr, message) {}
 
 var WebInspector = {}
-/** @param {string} url */
-WebInspector.linkifyURLAsNode = function(url) {}
+
+/**
+ * @param {string} url
+ * @param {string=} linkText
+ * @param {string=} classes
+ * @param {boolean=} isExternal
+ * @param {string=} tooltipText
+ */
+WebInspector.linkifyURLAsNode = function(url, linkText, classes, isExternal, tooltipText) {}
+
 /** @param {string} url */
 WebInspector.linkifyStringAsFragment = function(url) {}
 
 /**
+ * @param {string} url
+ * @param {number} lineNumber
+ */
+WebInspector.formatLinkText = function(url, lineNumber) {}
+
+/**
  * @param {string} str
  * @param {...*} varArgs
  */
index 8282f20..7af0046 100644 (file)
@@ -61,12 +61,14 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="IFrameView.js"></script>
     <script type="text/javascript" src="Drawer.js"></script>
     <script type="text/javascript" src="ConsoleMessage.js"></script>
+    <script type="text/javascript" src="ConsoleModel.js"></script>
     <script type="text/javascript" src="ConsoleView.js"></script>
     <script type="text/javascript" src="Panel.js"></script>
     <script type="text/javascript" src="TimelineGrid.js"></script>    
     <script type="text/javascript" src="Resource.js"></script>
     <script type="text/javascript" src="CSSStyleModel.js"></script>
     <script type="text/javascript" src="NetworkManager.js"></script>
+    <script type="text/javascript" src="NetworkLog.js"></script>
     <script type="text/javascript" src="ResourceTreeModel.js"></script>
     <script type="text/javascript" src="ResourceCategory.js"></script>
     <script type="text/javascript" src="TimelineManager.js"></script>
index e518192..b461d92 100644 (file)
@@ -183,7 +183,7 @@ var WebInspector = {
 
         var anchoredStatusBar = document.getElementById("anchored-status-bar-items");
         anchoredStatusBar.appendChild(this._dockToggleButton.element);
-        anchoredStatusBar.appendChild(this.console.toggleConsoleButton.element);
+        anchoredStatusBar.appendChild(this.consoleView.toggleConsoleButton.element);
         if (this.panels.elements)
             anchoredStatusBar.appendChild(this.panels.elements.nodeSearchButton.element);
 
@@ -289,43 +289,15 @@ var WebInspector = {
             WebInspector.drawer.updateHeight();
     },
 
-    get errors()
-    {
-        return this._errors || 0;
-    },
-
-    set errors(x)
-    {
-        x = Math.max(x, 0);
-
-        if (this._errors === x)
-            return;
-        this._errors = x;
-        this._updateErrorAndWarningCounts();
-    },
-
-    get warnings()
-    {
-        return this._warnings || 0;
-    },
-
-    set warnings(x)
-    {
-        x = Math.max(x, 0);
-
-        if (this._warnings === x)
-            return;
-        this._warnings = x;
-        this._updateErrorAndWarningCounts();
-    },
-
     _updateErrorAndWarningCounts: function()
     {
         var errorWarningElement = document.getElementById("error-warning-count");
         if (!errorWarningElement)
             return;
 
-        if (!this.errors && !this.warnings) {
+        var errors = WebInspector.console.errors;
+        var warnings = WebInspector.console.warnings;
+        if (!errors && !warnings) {
             errorWarningElement.addStyleClass("hidden");
             return;
         }
@@ -334,39 +306,39 @@ var WebInspector = {
 
         errorWarningElement.removeChildren();
 
-        if (this.errors) {
+        if (errors) {
             var errorElement = document.createElement("span");
             errorElement.id = "error-count";
-            errorElement.textContent = this.errors;
+            errorElement.textContent = errors;
             errorWarningElement.appendChild(errorElement);
         }
 
-        if (this.warnings) {
+        if (warnings) {
             var warningsElement = document.createElement("span");
             warningsElement.id = "warning-count";
-            warningsElement.textContent = this.warnings;
+            warningsElement.textContent = warnings;
             errorWarningElement.appendChild(warningsElement);
         }
 
-        if (this.errors) {
-            if (this.warnings) {
-                if (this.errors == 1) {
-                    if (this.warnings == 1)
-                        errorWarningElement.title = WebInspector.UIString("%d error, %d warning", this.errors, this.warnings);
+        if (errors) {
+            if (warnings) {
+                if (errors == 1) {
+                    if (warnings == 1)
+                        errorWarningElement.title = WebInspector.UIString("%d error, %d warning", errors, warnings);
                     else
-                        errorWarningElement.title = WebInspector.UIString("%d error, %d warnings", this.errors, this.warnings);
-                } else if (this.warnings == 1)
-                    errorWarningElement.title = WebInspector.UIString("%d errors, %d warning", this.errors, this.warnings);
+                        errorWarningElement.title = WebInspector.UIString("%d error, %d warnings", errors, warnings);
+                } else if (warnings == 1)
+                    errorWarningElement.title = WebInspector.UIString("%d errors, %d warning", errors, warnings);
                 else
-                    errorWarningElement.title = WebInspector.UIString("%d errors, %d warnings", this.errors, this.warnings);
-            } else if (this.errors == 1)
-                errorWarningElement.title = WebInspector.UIString("%d error", this.errors);
+                    errorWarningElement.title = WebInspector.UIString("%d errors, %d warnings", errors, warnings);
+            } else if (errors == 1)
+                errorWarningElement.title = WebInspector.UIString("%d error", errors);
             else
-                errorWarningElement.title = WebInspector.UIString("%d errors", this.errors);
-        } else if (this.warnings == 1)
-            errorWarningElement.title = WebInspector.UIString("%d warning", this.warnings);
-        else if (this.warnings)
-            errorWarningElement.title = WebInspector.UIString("%d warnings", this.warnings);
+                errorWarningElement.title = WebInspector.UIString("%d errors", errors);
+        } else if (warnings == 1)
+            errorWarningElement.title = WebInspector.UIString("%d warning", warnings);
+        else if (warnings)
+            errorWarningElement.title = WebInspector.UIString("%d warnings", warnings);
         else
             errorWarningElement.title = null;
     },
@@ -511,14 +483,19 @@ WebInspector.doLoadedDone = function()
     WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));
     WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel"));
 
+    this.console = new WebInspector.ConsoleModel();
+    this.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this);
+    this.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._updateErrorAndWarningCounts, this);
+
     this.drawer = new WebInspector.Drawer();
-    this.console = new WebInspector.ConsoleView(this.drawer);
-    this.drawer.visibleView = this.console;
+    this.consoleView = new WebInspector.ConsoleView(this.drawer);
+    this.drawer.visibleView = this.consoleView;
+
     this.networkManager = new WebInspector.NetworkManager();
     this.resourceTreeModel = new WebInspector.ResourceTreeModel();
     this.networkLog = new WebInspector.NetworkLog();
     this.domAgent = new WebInspector.DOMAgent();
-    new WebInspector.JavaScriptContextManager(this.resourceTreeModel, this.console);
+    new WebInspector.JavaScriptContextManager(this.resourceTreeModel, this.consoleView);
 
     InspectorBackend.registerInspectorDispatcher(this);
 
@@ -553,12 +530,7 @@ WebInspector.doLoadedDone = function()
 
     this.extensionServer.initExtensions();
 
-    if (WebInspector.settings.monitoringXHREnabled.get())
-        ConsoleAgent.setMonitoringXHREnabled(true);
-
-    // There is no console agent for workers yet.
-    if (!WebInspector.WorkerManager.isWorkerFrontend())
-        ConsoleAgent.enable(this.console.setConsoleMessageExpiredCount.bind(this.console));
+    this.console.enableAgent();
 
     DatabaseAgent.enable();
     DOMStorageAgent.enable();
@@ -1026,7 +998,7 @@ WebInspector.toggleSearchingForNode = function()
 
 WebInspector.showConsole = function()
 {
-    this.drawer.showView(this.console);
+    this.drawer.showView(this.consoleView);
 }
 
 WebInspector.showPanel = function(panel)