Revision: 5480
Author:   [email protected]
Date:     Wed Jul 10 16:24:53 2013
Log:      querySelector[All] throws rather than returning too few results.
https://codereview.appspot.com/11135043

Fixes <https://code.google.com/p/google-caja/issues/detail?id=1669>.

Updated jQuery UI test counts. The regressions are from r5464, but this
patch fixes the major one in 'accordion'.

[email protected]

http://code.google.com/p/google-caja/source/detail?r=5480

Modified:
 /trunk/src/com/google/caja/plugin/domado.js
 /trunk/tests/com/google/caja/plugin/es53-test-domado-dom-guest.html
 /trunk/tests/com/google/caja/plugin/third-party-tests.json

=======================================
--- /trunk/src/com/google/caja/plugin/domado.js Tue Jul  2 14:37:42 2013
+++ /trunk/src/com/google/caja/plugin/domado.js Wed Jul 10 16:24:53 2013
@@ -3329,11 +3329,18 @@
         }
       }

+      function querySelectorFail(tokens) {
+ var error = new Error('Erroneous or unsupported selector syntax: ' +
+            tokens.join(''));
+        error.name = 'SyntaxError';
+        throw error;
+      }
       function tameQuerySelector(rootFeralNode, guestSelector, returnAll) {
         var virtualizedSelectors = sanitizeCssSelectors(
           lexCss(guestSelector),
           idClass,
-          tagPolicy);
+          tagPolicy,
+          querySelectorFail);
         var historyInsensitiveVirtualizedSelectors =
           virtualizedSelectors[0].join(',');
         if (returnAll) {
=======================================
--- /trunk/tests/com/google/caja/plugin/es53-test-domado-dom-guest.html Tue Jul 2 14:37:42 2013 +++ /trunk/tests/com/google/caja/plugin/es53-test-domado-dom-guest.html Wed Jul 10 16:24:53 2013
@@ -894,9 +894,23 @@
         ['a', 'b']);
     assertQueryResult('#testQuerySelector p', ['a', 'b']);
assertEquals('scoped query', 2, container.querySelectorAll('p').length);
+    expectFailure(function() {
+      document.querySelector(':unrecognized');
+    }, 'syntax error solo', function(e) {
+      return e.name === 'SyntaxError';
+    });
+    expectFailure(function() {
+      document.querySelector('good,:unrecognized');
+    }, 'syntax error one of two', function(e) {
+      return e.name === 'SyntaxError';
+    });
     expectFailure(function() {
       document.querySelector(',');
-    }, 'syntax error');
+    }, 'syntax error one of two', function(e) {
+      // https://code.google.com/p/google-caja/issues/detail?id=1804
+      //return e.name === 'SyntaxError';
+      return true;
+    });

     // test non-liveness
     var list = container.querySelectorAll('p');
=======================================
--- /trunk/tests/com/google/caja/plugin/third-party-tests.json Mon Jun 24 11:58:58 2013 +++ /trunk/tests/com/google/caja/plugin/third-party-tests.json Wed Jul 10 16:24:53 2013
@@ -203,7 +203,7 @@
       },
       {
         "guest": "button",
-        "expected-pass": "all"
+        "expected-pass": 78
       },
       {
         "guest": "core",
@@ -225,7 +225,7 @@
       },
       {
         "guest": "dialog",
-        "expected-pass": { "firefox": 220, "chrome": 227 },
+        "expected-pass": { "firefox": 219, "chrome": 226 },
         "comment": [
           "Current failure categories:",
             "What may be event simulation failures",
@@ -278,7 +278,7 @@
       },
       {
         "guest": "tabs",
-        "expected-pass": { "firefox": 487, "chrome": 519 },
+        "expected-pass": { "firefox": 485, "chrome": 517 },
         "comment": [
           "Current modifications made to test suite:",
"Work around lost-signal problems due to lack of event simulation",

--

--- You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to