Changeset 35874 for trunk

Show
Ignore:
Timestamp:
08/21/08 09:36:06 (3 months ago)
Author:
timothy@apple.com
Message:

After trying to add the expression, try again with quotes for
easier edition.

https://bugs.webkit.org/show_bug.cgi?id=20466

Reviewed by Tim Hatcher.

  • page/inspector/ObjectPropertiesSection.js: Added an evaluateExpression function.
Location:
trunk/WebCore
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r35873 r35874  
     12008-08-21  Anthony Ricaud  <rik24d@gmail.com> 
     2 
     3        After trying to add the expression, try again with quotes for 
     4        easier edition. 
     5 
     6        https://bugs.webkit.org/show_bug.cgi?id=20466 
     7 
     8        Reviewed by Tim Hatcher. 
     9 
     10        * page/inspector/ObjectPropertiesSection.js: Added an 
     11        evaluateExpression function. 
     12 
    1132008-08-21  Anthony Ricaud  <rik24d@gmail.com> 
    214 
  • trunk/WebCore/page/inspector/ObjectPropertiesSection.js

    r35835 r35874  
    215215    }, 
    216216 
     217    evaluateExpression: function(expression) 
     218    { 
     219        // Evaluate in the currently selected call frame if the debugger is paused. 
     220        // Otherwise evaluate in against the inspected window. 
     221        if (WebInspector.panels.scripts.paused && this.treeOutline.section.editInSelectedCallFrameWhenPaused) 
     222            return WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false); 
     223        return InspectorController.inspectedWindow().eval(expression); 
     224    }, 
     225 
    217226    applyExpression: function(expression, updateInterface) 
    218227    { 
     
    236245        } 
    237246 
    238         // Surround the expression in parenthesis so the result of the eval is the result 
    239         // of the whole expression not the last potential sub-expression. 
    240         expression = "(" + expression + ")"; 
    241  
    242247        try { 
    243             // Evaluate in the currently selected call frame if the debugger is paused. 
    244             // Otherwise evaluate in against the inspected window. 
    245             if (WebInspector.panels.scripts.paused && this.treeOutline.section.editInSelectedCallFrameWhenPaused) 
    246                 var result = WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false); 
    247             else 
    248                 var result = InspectorController.inspectedWindow().eval(expression); 
     248            // Surround the expression in parenthesis so the result of the eval is the result 
     249            // of the whole expression not the last potential sub-expression. 
     250            var result = this.evaluateExpression("(" + expression + ")"); 
    249251 
    250252            // Store the result in the property. 
    251253            this.parentObject[this.propertyName] = result; 
    252254        } catch(e) { 
    253             // The expression failed so don't change the value. So just update and return. 
    254             if (updateInterface) 
    255                 this.update(); 
    256             return; 
     255            try { 
     256                // Try to update as a string 
     257                var result = this.evaluateExpression("\"" + expression.escapeCharacters("\"") + "\""); 
     258 
     259                // Store the result in the property. 
     260                this.parentObject[this.propertyName] = result; 
     261            } catch(e) { 
     262                // The expression failed so don't change the value. So just update and return. 
     263                if (updateInterface) 
     264                    this.update(); 
     265                return; 
     266            } 
    257267        } 
    258268