Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 Copyright © 2001-2004 World Wide Web Consortium, | 3 Copyright © 2001-2004 World Wide Web Consortium, |
| 4 (Massachusetts Institute of Technology, European Research Consortium | 4 (Massachusetts Institute of Technology, European Research Consortium |
| 5 for Informatics and Mathematics, Keio University). All | 5 for Informatics and Mathematics, Keio University). All |
| 6 Rights Reserved. This work is distributed under the W3C® Software License [1] i n the | 6 Rights Reserved. This work is distributed under the W3C® Software License [1] i n the |
| 7 hope that it will be useful, but WITHOUT ANY WARRANTY; without even | 7 hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
| 8 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 8 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 9 | 9 |
| 10 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 | 10 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * | 74 * |
| 75 The XPathEvaluator can create a "XPathExpression" using the method | 75 The XPathEvaluator can create a "XPathExpression" using the method |
| 76 "createExpression(expression, resolver)". | 76 "createExpression(expression, resolver)". |
| 77 | 77 |
| 78 Retrieve the DOM document on which the | 78 Retrieve the DOM document on which the |
| 79 'createExpression("12a", null)' method is | 79 'createExpression("12a", null)' method is |
| 80 invoked with the document element. The method should fail to create | 80 invoked with the document element. The method should fail to create |
| 81 pre-compiled expression and throws | 81 pre-compiled expression and throws |
| 82 XPathException.INVALID_EXPRESSION_ERR | 82 SYNTAX_ERR |
| 83 since "12a" is not an XPath expression. | 83 since "12a" is not an XPath expression. |
| 84 | 84 |
| 85 * @author Philippe Le Hégaret | 85 * @author Philippe Le Hégaret |
| 86 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-createExpression | 86 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-createExpression |
| 87 */ | 87 */ |
| 88 function XPathEvaluator_createExpression_INVALID_EXPRESSION_ERR() { | 88 function XPathEvaluator_createExpression_INVALID_EXPRESSION_ERR() { |
| 89 var success; | 89 var success; |
| 90 if(checkInitialization(builder, "XPathEvaluator_createExpression_INVALID_EXP RESSION_ERR") != null) return; | 90 if(checkInitialization(builder, "XPathEvaluator_createExpression_INVALID_EXP RESSION_ERR") != null) return; |
| 91 var nullNSResolver = null; | 91 var nullNSResolver = null; |
| 92 | 92 |
| 93 var doc; | 93 var doc; |
| 94 var xpEvaluator; | 94 var xpEvaluator; |
| 95 var exp; | 95 var exp; |
| 96 | 96 |
| 97 var docRef = null; | 97 var docRef = null; |
| 98 if (typeof(this.doc) != 'undefined') { | 98 if (typeof(this.doc) != 'undefined') { |
| 99 docRef = this.doc; | 99 docRef = this.doc; |
| 100 } | 100 } |
| 101 doc = load(docRef, "doc", "staffNS"); | 101 doc = load(docRef, "doc", "staffNS"); |
| 102 xpEvaluator = createXPathEvaluator(doc); | 102 xpEvaluator = createXPathEvaluator(doc); |
| 103 | 103 |
| 104 { | 104 { |
| 105 success = false; | 105 success = false; |
| 106 try { | 106 try { |
| 107 exp = xpEvaluator.createExpression("12a",nullNSResolver); | 107 exp = xpEvaluator.createExpression("12a",nullNSResolver); |
| 108 } | 108 } |
| 109 catch(ex) { | 109 catch(ex) { |
| 110 success = (typeof(ex.code) != 'undefined' && ex.code == 51); | 110 success = ex.name == 'SyntaxError'; |
|
abarth-chromium
2013/06/18 19:30:33
This looks like a W3C test. Maybe we should updat
arv (Not doing code reviews)
2013/06/18 19:34:30
I'm fine either way. Changing the expectation mean
| |
| 111 } | 111 } |
| 112 assertTrue("throw_INVALID_EXPRESSION_ERR",success); | 112 assertTrue("throw_INVALID_EXPRESSION_ERR",success); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } | 115 } |
| 116 | 116 |
| 117 | 117 |
| 118 | 118 |
| 119 | 119 |
| 120 function runTest() { | 120 function runTest() { |
| 121 XPathEvaluator_createExpression_INVALID_EXPRESSION_ERR(); | 121 XPathEvaluator_createExpression_INVALID_EXPRESSION_ERR(); |
| 122 } | 122 } |
| OLD | NEW |