[Webkit-unassigned] [Bug 50366] XPath lexer misinterprets expression starting with "div".

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 2 15:45:25 PST 2010


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





--- Comment #3 from Yonathan Randolph <yonathan at gmail.com>  2010-12-02 15:45:25 PST ---
Created an attachment (id=75424)
 --> (https://bugs.webkit.org/attachment.cgi?id=75424&action=review)
Unit test for parsing div, mod, and *.

(In reply to comment #2)
> The only text in the spec I can see that's related is this disambiguation rule in <http://www.w3.org/TR/xpath/#exprlex>:
> 
> "Otherwise, the token must not be recognized as a MultiplyOperator, an OperatorName, a NodeType, a FunctionName, or an AxisName."
> 
> I'm not sure how exactly to interpret this - there is no case that allows an OperatorName in disambiguation rules! The proposed patch agrees with common sense, but may be operating at a level that's different from what's implied by the spec.

No, I had to read it twice too. The first bullet point tells you the only cases an ambiguous binary operators can happen:

"If there is a preceding token and the preceding token is not one of @, ::, (, [, , or an Operator, then a * must be recognized as a MultiplyOperator and an NCName must be recognized as an OperatorName."

The bug was that the parser didn't properly check for "If there is a preceding token". It tested m_nextPos (which changes with whitespace) rather than the previous token value.

> 
> > Does anyone know what tests I should add for this?
> 
> See existing tests in LayoutTests/fast/xpath, for example document-order.html or complex-id.html. The most recent changes to this file didn't affect observed behavior, so they didn't have regression tests.
> 
> Besides 'div', there should be a test for 'mod'.

I've added a test.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list