Title: [111212] trunk
Revision
111212
Author
[email protected]
Date
2012-03-19 12:02:27 -0700 (Mon, 19 Mar 2012)

Log Message

Web Inspector: Implement snippets evaluation.
https://bugs.webkit.org/show_bug.cgi?id=81334

Reviewed by Pavel Feldman.

Source/WebCore:

* inspector/front-end/ConsoleView.js:
(WebInspector.ConsoleView.prototype.evaluateUsingTextPrompt):
(WebInspector.ConsoleView.prototype._enterKeyPressed):
* inspector/front-end/ScriptMapping.js:
(WebInspector.MainScriptMapping):
* inspector/front-end/SnippetsModel.js:
* inspector/front-end/externs.js:
(WebInspector.evaluateInConsole):
* inspector/front-end/inspector.js:
(WebInspector.evaluateInConsole):

LayoutTests:

* inspector/debugger/snippets-model-expected.txt:
* inspector/debugger/snippets-model.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (111211 => 111212)


--- trunk/LayoutTests/ChangeLog	2012-03-19 18:39:19 UTC (rev 111211)
+++ trunk/LayoutTests/ChangeLog	2012-03-19 19:02:27 UTC (rev 111212)
@@ -1,3 +1,13 @@
+2012-03-19  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Implement snippets evaluation.
+        https://bugs.webkit.org/show_bug.cgi?id=81334
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/debugger/snippets-model-expected.txt:
+        * inspector/debugger/snippets-model.html:
+
 2012-03-19  Joshua Bell  <[email protected]>
 
         IndexedDB: LayoutTests don't need explicit console div

Modified: trunk/LayoutTests/inspector/debugger/snippets-model-expected.txt (111211 => 111212)


--- trunk/LayoutTests/inspector/debugger/snippets-model-expected.txt	2012-03-19 18:39:19 UTC (rev 111211)
+++ trunk/LayoutTests/inspector/debugger/snippets-model-expected.txt	2012-03-19 19:02:27 UTC (rev 111212)
@@ -37,6 +37,9 @@
 
 Running: testEvaluate
 Last evaluation source url for snippet: snippets://1_1
+Snippet script added, sourceURL = snippets://1_1
 Last evaluation source url for snippet: snippets://2_2
+Snippet script added, sourceURL = snippets://2_2
 Last evaluation source url for snippet: snippets://1_3
+Snippet script added, sourceURL = snippets://1_3
 

Modified: trunk/LayoutTests/inspector/debugger/snippets-model.html (111211 => 111212)


--- trunk/LayoutTests/inspector/debugger/snippets-model.html	2012-03-19 18:39:19 UTC (rev 111211)
+++ trunk/LayoutTests/inspector/debugger/snippets-model.html	2012-03-19 19:02:27 UTC (rev 111212)
@@ -12,8 +12,8 @@
     }
 
     // FIXME: Remove once snippets are taken out of experiments.
-    if (!WebInspector.experimentsSettings.snippetsSupport.isEnabled())
-        WebInspector.snippetsModel = new WebInspector.SnippetsModel();
+    WebInspector.experimentsSettings.snippetsSupport = {};
+    WebInspector.experimentsSettings.snippetsSupport.isEnabled = function() { return true; };
 
     InspectorTest.runTestSuite([
         function testCreateRenameEditDelete(next)
@@ -103,9 +103,6 @@
                     InspectorTest.addResult("Snippet script added, sourceURL = " + script.sourceURL);
                     callback();
                 }
-
-                // FIXME: This should be removed once snippets evaluation itself is implemented.
-                callback();
             }
 
             evaluateSnippetAndDumpEvaluationDetails(snippet1, step2);

Modified: trunk/Source/WebCore/ChangeLog (111211 => 111212)


--- trunk/Source/WebCore/ChangeLog	2012-03-19 18:39:19 UTC (rev 111211)
+++ trunk/Source/WebCore/ChangeLog	2012-03-19 19:02:27 UTC (rev 111212)
@@ -1,3 +1,21 @@
+2012-03-19  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Implement snippets evaluation.
+        https://bugs.webkit.org/show_bug.cgi?id=81334
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype.evaluateUsingTextPrompt):
+        (WebInspector.ConsoleView.prototype._enterKeyPressed):
+        * inspector/front-end/ScriptMapping.js:
+        (WebInspector.MainScriptMapping):
+        * inspector/front-end/SnippetsModel.js:
+        * inspector/front-end/externs.js:
+        (WebInspector.evaluateInConsole):
+        * inspector/front-end/inspector.js:
+        (WebInspector.evaluateInConsole):
+
 2012-03-19  Tommy Widenflycht  <[email protected]>
 
         MediaStream API (JSEP): Introducing PeerConnection00Handler

Modified: trunk/Source/WebCore/inspector/front-end/ConsoleView.js (111211 => 111212)


--- trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2012-03-19 18:39:19 UTC (rev 111211)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2012-03-19 19:02:27 UTC (rev 111212)
@@ -618,9 +618,9 @@
         RuntimeAgent.evaluate(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptions, this._currentEvaluationContextId(), returnByValue, evalCallback);
     },
 
-    evaluateUsingTextPrompt: function(_expression_)
+    evaluateUsingTextPrompt: function(_expression_, showResultOnly)
     {
-        this._appendCommand(_expression_, this.prompt.text);
+        this._appendCommand(_expression_, this.prompt.text, false, showResultOnly);
     },
 
     _enterKeyPressed: function(event)
@@ -636,25 +636,28 @@
         var str = this.prompt.text;
         if (!str.length)
             return;
-        this._appendCommand(str, "");
+        this._appendCommand(str, "", true, false);
     },
 
-    _appendCommand: function(text, newPromptText)
+    _appendCommand: function(text, newPromptText, useCommandLineAPI, showResultOnly)
     {
-        var commandMessage = new WebInspector.ConsoleCommand(text);
-        WebInspector.console.interruptRepeatCount();
-        this._appendConsoleMessage(commandMessage);
+        if (!showResultOnly) {
+            var commandMessage = new WebInspector.ConsoleCommand(text);
+            WebInspector.console.interruptRepeatCount();
+            this._appendConsoleMessage(commandMessage);
+        }
+        this.prompt.text = newPromptText;
 
         function printResult(result, wasThrown)
         {
             if (!result)
                 return;
 
-            this.prompt.pushHistoryItem(text);
-            this.prompt.text = newPromptText;
+            if (!showResultOnly) {
+                this.prompt.pushHistoryItem(text);
+                WebInspector.settings.consoleHistory.set(this.prompt.historyData.slice(-30));
+            }
 
-            WebInspector.settings.consoleHistory.set(this.prompt.historyData.slice(-30));
-
             this._appendConsoleMessage(new WebInspector.ConsoleCommandResult(result, wasThrown, commandMessage, this._linkifier));
         }
         this.evalInInspectedWindow(text, "console", true, false, false, printResult.bind(this));

Modified: trunk/Source/WebCore/inspector/front-end/ScriptMapping.js (111211 => 111212)


--- trunk/Source/WebCore/inspector/front-end/ScriptMapping.js	2012-03-19 18:39:19 UTC (rev 111211)
+++ trunk/Source/WebCore/inspector/front-end/ScriptMapping.js	2012-03-19 19:02:27 UTC (rev 111212)
@@ -75,18 +75,12 @@
     this._mappings.push(this._resourceMapping);
     this._compilerMapping = new WebInspector.CompilerScriptMapping();
     this._mappings.push(this._compilerMapping);
+    this._snippetsMapping = new WebInspector.SnippetsScriptMapping();
+    this._mappings.push(this._snippetsMapping);
 
     for (var i = 0; i < this._mappings.length; ++i)
         this._mappings[i].addEventListener(WebInspector.ScriptMapping.Events.UISourceCodeListChanged, this._handleUISourceCodeListChanged, this);
 
-    if (WebInspector.experimentsSettings.snippetsSupport.isEnabled()) {
-        this._snippetsMapping = new WebInspector.SnippetsScriptMapping();
-        this._mappings.push(this._snippetsMapping);
-    }
-
-    for (var i = 0; i < this._mappings.length; ++i)
-        this._mappings[i].addEventListener(WebInspector.ScriptMapping.Events.UISourceCodeListChanged, this._handleUISourceCodeListChanged, this);
-
     this._mappingForScriptId = {};
     this._mappingForUISourceCode = new Map();
     this._liveLocationsForScriptId = {};

Modified: trunk/Source/WebCore/inspector/front-end/SnippetsModel.js (111211 => 111212)


--- trunk/Source/WebCore/inspector/front-end/SnippetsModel.js	2012-03-19 18:39:19 UTC (rev 111211)
+++ trunk/Source/WebCore/inspector/front-end/SnippetsModel.js	2012-03-19 19:02:27 UTC (rev 111212)
@@ -129,7 +129,7 @@
         var sourceURL = this._sourceURLForSnippet(snippet, evaluationIndex);
         snippet._lastEvaluationSourceURL = sourceURL;
         var _expression_ = "\n//@ sourceURL=" + sourceURL + "\n" + snippet.content;
-        // FIXME: evaluate snippet here.
+        WebInspector.evaluateInConsole(_expression_, true);
     },
 
     /**

Modified: trunk/Source/WebCore/inspector/front-end/externs.js (111211 => 111212)


--- trunk/Source/WebCore/inspector/front-end/externs.js	2012-03-19 18:39:19 UTC (rev 111211)
+++ trunk/Source/WebCore/inspector/front-end/externs.js	2012-03-19 19:02:27 UTC (rev 111212)
@@ -118,7 +118,11 @@
 
 WebInspector.populateResourceContextMenu = function(contextMenu, url, preferredLineNumber) {}
 
-WebInspector.evaluateInConsole = function(_expression_) {}
+/**
+ * @param {string} _expression_
+ * @param {boolean=} showResultOnly
+ */
+WebInspector.evaluateInConsole = function(_expression_, showResultOnly) {}
 
 var InjectedFakeWorker = function() {}
 

Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (111211 => 111212)


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2012-03-19 18:39:19 UTC (rev 111211)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2012-03-19 19:02:27 UTC (rev 111212)
@@ -406,8 +406,7 @@
     this.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUpdated, this._updateErrorAndWarningCounts, this);
 
     this.debuggerModel = new WebInspector.DebuggerModel();
-    if (WebInspector.experimentsSettings.snippetsSupport.isEnabled())
-        this.snippetsModel = new WebInspector.SnippetsModel();
+    this.snippetsModel = new WebInspector.SnippetsModel();
     this.debuggerPresentationModel = new WebInspector.DebuggerPresentationModel();
 
     this.drawer = new WebInspector.Drawer();
@@ -982,10 +981,10 @@
     WebInspector.panels.profiles.showProfileForURL(url);
 }
 
-WebInspector.evaluateInConsole = function(_expression_)
+WebInspector.evaluateInConsole = function(_expression_, showResultOnly)
 {
     this.showConsole();
-    this.consoleView.evaluateUsingTextPrompt(_expression_);
+    this.consoleView.evaluateUsingTextPrompt(_expression_, showResultOnly);
 }
 
 WebInspector.addMainEventListeners = function(doc)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to