⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 201855 in webkit


Ignore:
Timestamp:
Jun 8, 2016, 11:20:55 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

REGRESSION: Web Inspector: Should be able to evaluate "{a:1, b:2}" in the console
https://bugs.webkit.org/show_bug.cgi?id=158548
<rdar://problem/26708513>

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-06-08
Reviewed by Timothy Hatcher.

Source/WebInspectorUI:

  • UserInterface/Controllers/RuntimeManager.js:

(WebInspector.RuntimeManager.prototype.evaluateInInspectedWindow):
Switch the many parameters to an options dictionary.
Include a new option for sourceURL appender, so that
Console evaluations can have its own append.

  • UserInterface/Controllers/JavaScriptLogViewController.js:

(WebInspector.JavaScriptLogViewController.prototype.consolePromptTextCommitted):
Use the appendWebInspectorConsoleEvaluationSourceURL appender.

  • UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:

(WebInspector.JavaScriptRuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.evaluated):

  • UserInterface/Views/ScopeChainDetailsSidebarPanel.js:

(WebInspector.ScopeChainDetailsSidebarPanel.prototype._generateWatchExpressionsSection.):
(WebInspector.ScopeChainDetailsSidebarPanel.prototype._generateWatchExpressionsSection):
Use the new options dictionary.

LayoutTests:

  • inspector/console/addInspectedNode.html:
  • inspector/console/command-line-api-copy.html:
  • inspector/console/command-line-api.html:
  • inspector/console/console-api.html:
  • inspector/console/console-table.html:
  • inspector/console/messagesCleared.html:
  • inspector/controller/runtime-controller.html:
  • inspector/debugger/command-line-api-exception-nested-catch.html:
  • inspector/debugger/command-line-api-exception.html:
  • inspector/model/remote-object-get-properties.html:
  • inspector/model/remote-object-weak-collection.html:
  • inspector/model/remote-object.html:
  • inspector/timeline/exception-in-injected-script-while-recording.html:

Update evaluateInInspectedWindow callsites to use options dictionary.

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r201852 r201855  
     12016-06-08  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        REGRESSION: Web Inspector: Should be able to evaluate "{a:1, b:2}" in the console
     4        https://bugs.webkit.org/show_bug.cgi?id=158548
     5        <rdar://problem/26708513>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * inspector/console/addInspectedNode.html:
     10        * inspector/console/command-line-api-copy.html:
     11        * inspector/console/command-line-api.html:
     12        * inspector/console/console-api.html:
     13        * inspector/console/console-table.html:
     14        * inspector/console/messagesCleared.html:
     15        * inspector/controller/runtime-controller.html:
     16        * inspector/debugger/command-line-api-exception-nested-catch.html:
     17        * inspector/debugger/command-line-api-exception.html:
     18        * inspector/model/remote-object-get-properties.html:
     19        * inspector/model/remote-object-weak-collection.html:
     20        * inspector/model/remote-object.html:
     21        * inspector/timeline/exception-in-injected-script-while-recording.html:
     22        Update evaluateInInspectedWindow callsites to use options dictionary.
     23
    1242016-06-08  Chris Dumez  <cdumez@apple.com>
    225
  • trunk/LayoutTests/inspector/console/addInspectedNode.html

    r189373 r201855  
    77{
    88    function evaluate$0(callback) {
    9         const objectGroup = "test";
    10         const includeCommandLineAPI = true;
    11         const ignorePauseOnExceptionsAndMute = false;
    12         const shouldReturnByValue = false;
    13         const shouldGeneratePreview = false;
    14         const shouldSaveResult = false;
    15         WebInspector.runtimeManager.evaluateInInspectedWindow("$0", objectGroup, includeCommandLineAPI, ignorePauseOnExceptionsAndMute, shouldReturnByValue, shouldGeneratePreview, shouldSaveResult, callback);
     9        WebInspector.runtimeManager.evaluateInInspectedWindow("$0", {objectGroup: "test", includeCommandLineAPI: true}, callback);
    1610    }
    1711
  • trunk/LayoutTests/inspector/console/command-line-api-copy.html

    r196270 r201855  
    2323
    2424    function commandLineAPICopyAndPaste(expression, callback) {
    25         const objectGroup = "test";
    26         const includeCommandLineAPI = true;
    27         const ignorePauseOnExceptionsAndMute = false;
    28         const shouldReturnByValue = false;
    29         const shouldGeneratePreview = false;
    30         const shouldSaveResult = false;
    3125        InspectorTest.assert(typeof expression === "string", "Test requires string expression to evaluate on the page.");
    32         WebInspector.runtimeManager.evaluateInInspectedWindow(`copy(${expression})`, objectGroup, includeCommandLineAPI, ignorePauseOnExceptionsAndMute, shouldReturnByValue, shouldGeneratePreview, shouldSaveResult, () => {
     26        WebInspector.runtimeManager.evaluateInInspectedWindow(`copy(${expression})`, {objectGroup: "test", includeCommandLineAPI: true}, () => {
    3327            InspectorTest.evaluateInPage("pasteAndReturnString()", (error, remoteObjectPayload) => {
    3428                let remoteObject = WebInspector.RemoteObject.fromPayload(remoteObjectPayload);
  • trunk/LayoutTests/inspector/console/command-line-api.html

    r189226 r201855  
    7070                }
    7171
    72                 const objectGroup = "test";
    73                 const includeCommandLineAPI = true;
    74                 const ignorePauseOnExceptionsAndMute = false;
    75                 const shouldReturnByValue = false;
    76                 const shouldGeneratePreview = false;
    77                 const shouldSaveResult = false;
    78                 WebInspector.runtimeManager.evaluateInInspectedWindow(`String(${input})`, objectGroup, includeCommandLineAPI, ignorePauseOnExceptionsAndMute, shouldReturnByValue, shouldGeneratePreview, shouldSaveResult, callback);
     72                WebInspector.runtimeManager.evaluateInInspectedWindow(`String(${input})`, {objectGroup: "test", includeCommandLineAPI: true}, callback);
    7973            }
    8074        })
  • trunk/LayoutTests/inspector/console/console-api.html

    r194887 r201855  
    6767
    6868    for (var step of steps)
    69         WebInspector.runtimeManager.evaluateInInspectedWindow(step, "test", false, true, false, true, false, function(){});
     69        WebInspector.runtimeManager.evaluateInInspectedWindow(step, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, function(){});
    7070}
    7171</script>
  • trunk/LayoutTests/inspector/console/console-table.html

    r199793 r201855  
    4545
    4646    for (var step of steps)
    47         WebInspector.runtimeManager.evaluateInInspectedWindow(step, "test", false, true, false, true, false, function(){});
     47        WebInspector.runtimeManager.evaluateInInspectedWindow(step, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, function(){});
    4848}
    4949</script>
  • trunk/LayoutTests/inspector/console/messagesCleared.html

    r189373 r201855  
    3636        description: "Calling `clear()` in the command line API should trigger Console.messagesCleared.",
    3737        test: (resolve, reject) => {
    38             const objectGroup = "test";
    39             const includeCommandLineAPI = true;
    40             const ignorePauseOnExceptionsAndMute = false;
    41             const shouldReturnByValue = false;
    42             const shouldGeneratePreview = false;
    43             const shouldSaveResult = false;
    44             WebInspector.runtimeManager.evaluateInInspectedWindow("clear()", objectGroup, includeCommandLineAPI, ignorePauseOnExceptionsAndMute, shouldReturnByValue, shouldGeneratePreview, shouldSaveResult, function(){});
     38            WebInspector.runtimeManager.evaluateInInspectedWindow("clear()", {objectGroup: "test", includeCommandLineAPI: true}, function(){});
    4539            WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.Cleared, (event) => {
    4640                InspectorTest.expectThat(event, "Cleared event should fire.");
  • trunk/LayoutTests/inspector/controller/runtime-controller.html

    r194149 r201855  
    1313        test: (resolve, reject) => {
    1414            function testSource(expression, callback) {
    15                 const objectGroup = "test";
    16                 const includeCommandLineAPI = false;
    17                 const ignorePauseOnExceptionsAndMute = false;
    18                 const shouldReturnByValue = false;
    19                 const shouldGeneratePreview = false;
    20                 const shouldSaveResult = false;
    21                 WebInspector.runtimeManager.evaluateInInspectedWindow(expression, objectGroup, includeCommandLineAPI, ignorePauseOnExceptionsAndMute, shouldReturnByValue, shouldGeneratePreview, shouldSaveResult, (result, wasThrown) => {
     15                WebInspector.runtimeManager.evaluateInInspectedWindow(expression, {objectGroup: "test"}, (result, wasThrown) => {
    2216                    InspectorTest.log("Source: " + expression);
    2317                    callback(result, wasThrown);
  • trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html

    r188059 r201855  
    1717
    1818    function dumpCommandLineAPIValue(prefix) {
    19         WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", "test", true, true, false, false, false, function(result, wasThrown) {
     19        WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
    2020            InspectorTest.log(prefix + ": $exception => " + result.description);
    2121        });
     
    2323
    2424    function checkIfExceptionValueMatchesVariable(varName) {
    25         WebInspector.runtimeManager.evaluateInInspectedWindow("$exception === " + varName, "test", true, true, false, false, false, function(result, wasThrown) {
     25        WebInspector.runtimeManager.evaluateInInspectedWindow("$exception === " + varName, {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
    2626            InspectorTest.log("  CATCH: $exception === " + varName + " ? " + result.description);
    2727        });
  • trunk/LayoutTests/inspector/debugger/command-line-api-exception.html

    r188059 r201855  
    4141
    4242    function dumpCommandLineAPIValue(prefix) {
    43         WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", "test", true, true, false, false, false, function(result, wasThrown) {
     43        WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
    4444            InspectorTest.log(prefix + ": $exception => " + result.description);
    4545        });
     
    4747
    4848    function checkIfExceptionValueMatchesCatchVariable() {
    49         WebInspector.runtimeManager.evaluateInInspectedWindow("$exception === e", "test", true, true, false, false, false, function(result, wasThrown) {
     49        WebInspector.runtimeManager.evaluateInInspectedWindow("$exception === e", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
    5050            InspectorTest.log("STEPPED OUT TO CATCH BLOCK: $exception === e ? " + result.description);
    5151        });
  • trunk/LayoutTests/inspector/model/remote-object-get-properties.html

    r188059 r201855  
    7676        InspectorTest.log("EXPRESSION: " + step.expression);
    7777
    78         WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, "test", false, true, false, false, false, function(remoteObject, wasThrown) {
     78        WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true}, function(remoteObject, wasThrown) {
    7979            InspectorTest.assert(remoteObject instanceof WebInspector.RemoteObject);
    8080            InspectorTest.log("type: " + remoteObject.type);
  • trunk/LayoutTests/inspector/model/remote-object-weak-collection.html

    r188059 r201855  
    5454        // Run the expression, and then run a garbage collection on a different
    5555        // event loop so no objects are kept alive by the stack.
    56         WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, "test", false, true, false, true, false, function(remoteObject, wasThrown) {
    57             WebInspector.runtimeManager.evaluateInInspectedWindow("GCController.collect()", "test", false, true, false, false, false, function() {
     56        WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, function(remoteObject, wasThrown) {
     57            WebInspector.runtimeManager.evaluateInInspectedWindow("GCController.collect()", {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true}, function() {
    5858                InspectorTest.assert(remoteObject instanceof WebInspector.RemoteObject);
    5959                remoteObject.getCollectionEntries(0, 100, function(entries) {
  • trunk/LayoutTests/inspector/model/remote-object.html

    r199529 r201855  
    216216            }
    217217
    218             WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, "test", false, true, false, true, false, function(remoteObject, wasThrown) {
     218            WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, function(remoteObject, wasThrown) {
    219219                InspectorTest.log("");
    220220                InspectorTest.log("-----------------------------------------------------");
  • trunk/LayoutTests/inspector/timeline/exception-in-injected-script-while-recording.html

    r188644 r201855  
    5151
    5252    function checkIfExceptionLoopsForever() {
    53         WebInspector.runtimeManager.evaluateInInspectedWindow("({}).x.x", "test", true, true, false, false, false, function(result, wasThrown) {
     53        WebInspector.runtimeManager.evaluateInInspectedWindow("({}).x.x", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
    5454            InspectorTest.addResult("An exception was " + (wasThrown ? "" : "not ") + "thrown from the injected script.");
    5555            WebInspector.debuggerManager.resume().then(function() {
  • trunk/Source/WebInspectorUI/ChangeLog

    r201843 r201855  
     12016-06-08  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        REGRESSION: Web Inspector: Should be able to evaluate "{a:1, b:2}" in the console
     4        https://bugs.webkit.org/show_bug.cgi?id=158548
     5        <rdar://problem/26708513>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Controllers/RuntimeManager.js:
     10        (WebInspector.RuntimeManager.prototype.evaluateInInspectedWindow):
     11        Switch the many parameters to an options dictionary.
     12        Include a new option for sourceURL appender, so that
     13        Console evaluations can have its own append.
     14
     15        * UserInterface/Controllers/JavaScriptLogViewController.js:
     16        (WebInspector.JavaScriptLogViewController.prototype.consolePromptTextCommitted):
     17        Use the appendWebInspectorConsoleEvaluationSourceURL appender.
     18
     19        * UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:
     20        (WebInspector.JavaScriptRuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.evaluated):
     21        * UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
     22        (WebInspector.ScopeChainDetailsSidebarPanel.prototype._generateWatchExpressionsSection.):
     23        (WebInspector.ScopeChainDetailsSidebarPanel.prototype._generateWatchExpressionsSection):
     24        Use the new options dictionary.
     25
    1262016-06-08  Brian Burg  <bburg@apple.com>
    227
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js

    r201222 r201855  
    232232        }
    233233
    234         text = appendWebInspectorConsoleEvaluationSourceURL(text);
    235 
    236         WebInspector.runtimeManager.evaluateInInspectedWindow(text, WebInspector.RuntimeManager.ConsoleObjectGroup, true, false, false, true, true, printResult.bind(this));
     234        let options = {
     235            objectGroup: WebInspector.RuntimeManager.ConsoleObjectGroup,
     236            includeCommandLineAPI: true,
     237            doNotPauseOnExceptionsAndMuteConsole: false,
     238            returnByValue: false,
     239            generatePreview: true,
     240            saveResult: true,
     241            sourceURLAppender: appendWebInspectorConsoleEvaluationSourceURL,
     242        };
     243
     244        WebInspector.runtimeManager.evaluateInInspectedWindow(text, options, printResult.bind(this));
    237245    }
    238246
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js

    r200505 r201855  
    103103        if (!base && activeCallFrame && !this._alwaysEvaluateInWindowContext)
    104104            activeCallFrame.collectScopeChainVariableNames(receivedPropertyNames.bind(this));
    105         else
    106             WebInspector.runtimeManager.evaluateInInspectedWindow(base, "completion", true, true, false, false, false, evaluated.bind(this));
     105        else {
     106            let options = {objectGroup: "completion", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true, returnByValue: false, generatePreview: false, saveResult: false};
     107            WebInspector.runtimeManager.evaluateInInspectedWindow(base, options, evaluated.bind(this));
     108        }
    107109
    108110        function updateLastPropertyNames(propertyNames)
     
    186188            else if (result.type === "object" || result.type === "function")
    187189                result.callFunctionJSON(inspectedPage_evalResult_getCompletions, undefined, receivedPropertyNames.bind(this));
    188             else if (result.type === "string" || result.type === "number" || result.type === "boolean" || result.type === "symbol")
    189                 WebInspector.runtimeManager.evaluateInInspectedWindow("(" + inspectedPage_evalResult_getCompletions + ")(\"" + result.type + "\")", "completion", false, true, true, false, false, receivedPropertyNamesFromEvaluate.bind(this));
    190             else
     190            else if (result.type === "string" || result.type === "number" || result.type === "boolean" || result.type === "symbol") {
     191                let options = {objectGroup: "completion", includeCommandLineAPI: false, doNotPauseOnExceptionsAndMuteConsole: true, returnByValue: false, generatePreview: false, saveResult: false};
     192                WebInspector.runtimeManager.evaluateInInspectedWindow("(" + inspectedPage_evalResult_getCompletions + ")(\"" + result.type + "\")", options, receivedPropertyNamesFromEvaluate.bind(this));
     193            } else
    191194                console.error("Unknown result type: " + result.type);
    192195        }
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js

    r194149 r201855  
    3636    // Public
    3737
    38     evaluateInInspectedWindow(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, saveResult, callback)
     38    evaluateInInspectedWindow(expression, options, callback)
    3939    {
     40        let {objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, saveResult, sourceURLAppender} = options;
     41
     42        includeCommandLineAPI = includeCommandLineAPI || false;
     43        doNotPauseOnExceptionsAndMuteConsole = doNotPauseOnExceptionsAndMuteConsole || false;
     44        returnByValue = returnByValue || false;
     45        generatePreview = generatePreview || false;
     46        saveResult = saveResult || false;
     47        sourceURLAppender = sourceURLAppender || appendWebInspectorSourceURL;
     48
     49        console.assert(objectGroup, "RuntimeManager.evaluateInInspectedWindow should always be called with an objectGroup");
     50        console.assert(typeof sourceURLAppender === "function");
     51
    4052        if (!expression) {
    4153            // There is no expression, so the completion should happen against global properties.
     
    4658        }
    4759
    48         expression = appendWebInspectorSourceURL(expression);
     60        expression = sourceURLAppender(expression);
    4961
    5062        function evalCallback(error, result, wasThrown, savedResultIndex)
  • trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js

    r201620 r201855  
    351351        for (let expression of watchExpressions) {
    352352            promises.push(new Promise(function(resolve, reject) {
    353                 WebInspector.runtimeManager.evaluateInInspectedWindow(expression, WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName, false, true, false, true, false, function(object, wasThrown) {
     353                let options = {objectGroup: WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName, includeCommandLineAPI: false, doNotPauseOnExceptionsAndMuteConsole: true, returnByValue: false, generatePreview: true, saveResult: false};
     354                WebInspector.runtimeManager.evaluateInInspectedWindow(expression, options, function(object, wasThrown) {
    354355                    let propertyDescriptor = new WebInspector.PropertyDescriptor({name: expression, value: object}, undefined, undefined, wasThrown);
    355356                    objectTree.appendExtraPropertyDescriptor(propertyDescriptor);
Note: See TracChangeset for help on using the changeset viewer.