Changeset 111212 in webkit


Ignore:
Timestamp:
Mar 19, 2012 12:02:27 PM (12 years ago)
Author:
vsevik@chromium.org
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:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r111211 r111212  
     12012-03-19  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Implement snippets evaluation.
     4        https://bugs.webkit.org/show_bug.cgi?id=81334
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/debugger/snippets-model-expected.txt:
     9        * inspector/debugger/snippets-model.html:
     10
    1112012-03-19  Joshua Bell  <jsbell@chromium.org>
    212
  • trunk/LayoutTests/inspector/debugger/snippets-model-expected.txt

    r110864 r111212  
    3838Running: testEvaluate
    3939Last evaluation source url for snippet: snippets://1_1
     40Snippet script added, sourceURL = snippets://1_1
    4041Last evaluation source url for snippet: snippets://2_2
     42Snippet script added, sourceURL = snippets://2_2
    4143Last evaluation source url for snippet: snippets://1_3
     44Snippet script added, sourceURL = snippets://1_3
    4245
  • trunk/LayoutTests/inspector/debugger/snippets-model.html

    r110864 r111212  
    1313
    1414    // FIXME: Remove once snippets are taken out of experiments.
    15     if (!WebInspector.experimentsSettings.snippetsSupport.isEnabled())
    16         WebInspector.snippetsModel = new WebInspector.SnippetsModel();
     15    WebInspector.experimentsSettings.snippetsSupport = {};
     16    WebInspector.experimentsSettings.snippetsSupport.isEnabled = function() { return true; };
    1717
    1818    InspectorTest.runTestSuite([
     
    104104                    callback();
    105105                }
    106 
    107                 // FIXME: This should be removed once snippets evaluation itself is implemented.
    108                 callback();
    109106            }
    110107
  • trunk/Source/WebCore/ChangeLog

    r111208 r111212  
     12012-03-19  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Implement snippets evaluation.
     4        https://bugs.webkit.org/show_bug.cgi?id=81334
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/front-end/ConsoleView.js:
     9        (WebInspector.ConsoleView.prototype.evaluateUsingTextPrompt):
     10        (WebInspector.ConsoleView.prototype._enterKeyPressed):
     11        * inspector/front-end/ScriptMapping.js:
     12        (WebInspector.MainScriptMapping):
     13        * inspector/front-end/SnippetsModel.js:
     14        * inspector/front-end/externs.js:
     15        (WebInspector.evaluateInConsole):
     16        * inspector/front-end/inspector.js:
     17        (WebInspector.evaluateInConsole):
     18
    1192012-03-19  Tommy Widenflycht  <tommyw@google.com>
    220
  • trunk/Source/WebCore/inspector/front-end/ConsoleView.js

    r109927 r111212  
    619619    },
    620620
    621     evaluateUsingTextPrompt: function(expression)
    622     {
    623         this._appendCommand(expression, this.prompt.text);
     621    evaluateUsingTextPrompt: function(expression, showResultOnly)
     622    {
     623        this._appendCommand(expression, this.prompt.text, false, showResultOnly);
    624624    },
    625625
     
    637637        if (!str.length)
    638638            return;
    639         this._appendCommand(str, "");
    640     },
    641 
    642     _appendCommand: function(text, newPromptText)
    643     {
    644         var commandMessage = new WebInspector.ConsoleCommand(text);
    645         WebInspector.console.interruptRepeatCount();
    646         this._appendConsoleMessage(commandMessage);
     639        this._appendCommand(str, "", true, false);
     640    },
     641
     642    _appendCommand: function(text, newPromptText, useCommandLineAPI, showResultOnly)
     643    {
     644        if (!showResultOnly) {
     645            var commandMessage = new WebInspector.ConsoleCommand(text);
     646            WebInspector.console.interruptRepeatCount();
     647            this._appendConsoleMessage(commandMessage);
     648        }
     649        this.prompt.text = newPromptText;
    647650
    648651        function printResult(result, wasThrown)
     
    651654                return;
    652655
    653             this.prompt.pushHistoryItem(text);
    654             this.prompt.text = newPromptText;
    655 
    656             WebInspector.settings.consoleHistory.set(this.prompt.historyData.slice(-30));
     656            if (!showResultOnly) {
     657                this.prompt.pushHistoryItem(text);
     658                WebInspector.settings.consoleHistory.set(this.prompt.historyData.slice(-30));
     659            }
    657660
    658661            this._appendConsoleMessage(new WebInspector.ConsoleCommandResult(result, wasThrown, commandMessage, this._linkifier));
  • trunk/Source/WebCore/inspector/front-end/ScriptMapping.js

    r110868 r111212  
    7676    this._compilerMapping = new WebInspector.CompilerScriptMapping();
    7777    this._mappings.push(this._compilerMapping);
    78 
    79     for (var i = 0; i < this._mappings.length; ++i)
    80         this._mappings[i].addEventListener(WebInspector.ScriptMapping.Events.UISourceCodeListChanged, this._handleUISourceCodeListChanged, this);
    81 
    82     if (WebInspector.experimentsSettings.snippetsSupport.isEnabled()) {
    83         this._snippetsMapping = new WebInspector.SnippetsScriptMapping();
    84         this._mappings.push(this._snippetsMapping);
    85     }
     78    this._snippetsMapping = new WebInspector.SnippetsScriptMapping();
     79    this._mappings.push(this._snippetsMapping);
    8680
    8781    for (var i = 0; i < this._mappings.length; ++i)
  • trunk/Source/WebCore/inspector/front-end/SnippetsModel.js

    r110864 r111212  
    130130        snippet._lastEvaluationSourceURL = sourceURL;
    131131        var expression = "\n//@ sourceURL=" + sourceURL + "\n" + snippet.content;
    132         // FIXME: evaluate snippet here.
     132        WebInspector.evaluateInConsole(expression, true);
    133133    },
    134134
  • trunk/Source/WebCore/inspector/front-end/externs.js

    r108495 r111212  
    119119WebInspector.populateResourceContextMenu = function(contextMenu, url, preferredLineNumber) {}
    120120
    121 WebInspector.evaluateInConsole = function(expression) {}
     121/**
     122 * @param {string} expression
     123 * @param {boolean=} showResultOnly
     124 */
     125WebInspector.evaluateInConsole = function(expression, showResultOnly) {}
    122126
    123127var InjectedFakeWorker = function() {}
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r110576 r111212  
    407407
    408408    this.debuggerModel = new WebInspector.DebuggerModel();
    409     if (WebInspector.experimentsSettings.snippetsSupport.isEnabled())
    410         this.snippetsModel = new WebInspector.SnippetsModel();
     409    this.snippetsModel = new WebInspector.SnippetsModel();
    411410    this.debuggerPresentationModel = new WebInspector.DebuggerPresentationModel();
    412411
     
    983982}
    984983
    985 WebInspector.evaluateInConsole = function(expression)
     984WebInspector.evaluateInConsole = function(expression, showResultOnly)
    986985{
    987986    this.showConsole();
    988     this.consoleView.evaluateUsingTextPrompt(expression);
     987    this.consoleView.evaluateUsingTextPrompt(expression, showResultOnly);
    989988}
    990989
Note: See TracChangeset for help on using the changeset viewer.