Changeset 100246 in webkit


Ignore:
Timestamp:
Nov 15, 2011 12:08:59 AM (12 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: Command line $x fails for 3 of 4 types of XPath query
https://bugs.webkit.org/show_bug.cgi?id=72276

Reviewed by Timothy Hatcher.

Source/WebCore:

Test: inspector/console/console-xpath.html

  • inspector/InjectedScriptSource.js:

(.):

LayoutTests:

  • inspector/console/console-xpath-expected.txt: Added.
  • inspector/console/console-xpath.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r100245 r100246  
     12011-11-14  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: Command line $x fails for 3 of 4 types of XPath query
     4        https://bugs.webkit.org/show_bug.cgi?id=72276
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * inspector/console/console-xpath-expected.txt: Added.
     9        * inspector/console/console-xpath.html: Added.
     10
    1112011-11-14  Peter Kasting  <pkasting@google.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r100243 r100246  
     12011-11-14  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: Command line $x fails for 3 of 4 types of XPath query
     4        https://bugs.webkit.org/show_bug.cgi?id=72276
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        Test: inspector/console/console-xpath.html
     9
     10        * inspector/InjectedScriptSource.js:
     11        (.):
     12
    1132011-11-14  Ryosuke Niwa  <rniwa@webkit.org>
    214
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r100113 r100246  
    593593    $x: function(xpath, context)
    594594    {
    595         var nodes = [];
    596         try {
    597             var doc = (context && context.ownerDocument) || inspectedWindow.document;
    598             var results = doc.evaluate(xpath, context || doc, null, XPathResult.ANY_TYPE, null);
     595        var doc = (context && context.ownerDocument) || inspectedWindow.document;
     596        var result = doc.evaluate(xpath, context || doc, null, XPathResult.ANY_TYPE, null);
     597        switch (result.resultType) {
     598        case XPathResult.NUMBER_TYPE:
     599            return result.numberValue;
     600        case XPathResult.STRING_TYPE:
     601            return result.stringValue;
     602        case XPathResult.BOOLEAN_TYPE:
     603            return result.booleanValue;
     604        default:
     605            var nodes = [];
    599606            var node;
    600             while (node = results.iterateNext())
     607            while (node = result.iterateNext())
    601608                nodes.push(node);
    602         } catch (e) {
    603         }
    604         return nodes;
     609            return nodes;
     610        }
    605611    },
    606612
Note: See TracChangeset for help on using the changeset viewer.