Revision: 5499
Author: ihab.awad
Date: Mon Jul 22 14:48:17 2013
Log: Diagnose problems with jQuery tests and file bugs
https://codereview.appspot.com/11291043
[email protected]
http://code.google.com/p/google-caja/source/detail?r=5499
Modified:
/trunk/tests/com/google/caja/plugin/generic-host-page.html
/trunk/tests/com/google/caja/plugin/qunit-test-driver.js
/trunk/tests/com/google/caja/plugin/third-party-tests.json
/trunk/third_party/js/jqueryjs/README-Caja.txt
/trunk/third_party/js/jqueryjs/test/unit/attributes.js
/trunk/third_party/js/jqueryjs/test/unit/event.js
=======================================
--- /trunk/tests/com/google/caja/plugin/generic-host-page.html Thu Jul 11
15:50:37 2013
+++ /trunk/tests/com/google/caja/plugin/generic-host-page.html Mon Jul 22
14:48:17 2013
@@ -77,7 +77,14 @@
<option>NOT_SUPPORTED</option>
</select></label>
·
- <label><input type="checkbox" name="debug" value="true"> Config
<code>debug</code></label>
+ <label>
+ <input type="checkbox" name="debug" value="true">
+ Config <code>debug</code>
+ </label>
+ <label>
+ <input type="checkbox" name="alert" value="true">
+ Provide <code>alert</code>
+ </label>
<br>
<textarea type="text" name="content"></textarea>
<button id="load" type="submit">Load</button>
@@ -115,8 +122,15 @@
caja.policy.net.ALL,
function(frame) {
status('frame.content().run()');
- frame.content('http://caja-host-url.invalid/', options.content)
- .run(function() {
+ frame.content('http://caja-host-url.invalid/', options.content);
+ if (options.alert) {
+ frame.api({
+ alert: frame.tame(frame.markFunction(function(s) {
+ window.alert('Guest alerts: ' + s);
+ }))
+ });
+ }
+ frame.run(function() {
status('Complete');
});
});
=======================================
--- /trunk/tests/com/google/caja/plugin/qunit-test-driver.js Fri Jun 21
14:57:00 2013
+++ /trunk/tests/com/google/caja/plugin/qunit-test-driver.js Mon Jul 22
14:48:17 2013
@@ -22,6 +22,11 @@
if (!testCase) {
throw new Error('Parameter "test-case" not specified in URL');
}
+
+if (getUrlParam('minified') === 'false') {
+ // Enable un-minified jQuery source files for easier debugging
+ testCase = testCase + '&dev=true';
+}
caja.makeFrameGroup(basicCajaConfig, function(frameGroup) {
frameGroup.makeES5Frame(
=======================================
--- /trunk/tests/com/google/caja/plugin/third-party-tests.json Thu Jul 11
15:50:37 2013
+++ /trunk/tests/com/google/caja/plugin/third-party-tests.json Mon Jul 22
14:48:17 2013
@@ -10,12 +10,12 @@
"expected-pass": 377,
"comment": [
"Current failure categories:",
- "window.eval not enabled for testing",
- "We don't implement XML yet.",
- "We don't implement document.getElementsByName.",
- "jQuery.proxy is not getting a thisArg it wants - this one
may",
- " actually be a strict-mode incompatibility in jQuery
itself.",
- "Other unexamined."
+ "https://code.google.com/p/google-caja/issues/detail?id=1199",
+ "https://code.google.com/p/google-caja/issues/detail?id=1785",
+ "https://code.google.com/p/google-caja/issues/detail?id=1786",
+ "https://code.google.com/p/google-caja/issues/detail?id=1787",
+ "https://code.google.com/p/google-caja/issues/detail?id=1788",
+ "https://code.google.com/p/google-caja/issues/detail?id=1790"
]
},
{
@@ -23,11 +23,7 @@
"expected-pass": "all",
"comment": [
"Current modifications made to test suite:",
- "Adjusted 'context is window' test assuming callee is
non-strict",
- "Current failure categories:",
- "'No callback iteration' test fails -- not obvious why, but",
- " suggesting type/identity issues.",
- ".has() test fails -- may be related."
+ "Adjusted 'context is window' test assuming callee is
non-strict"
]
},
{
@@ -35,9 +31,7 @@
"expected-pass": "all",
"comment": [
"Current modifications made to test suite:",
- "Adjusted tests assuming callee is non-strict",
- "Current failure categories:",
- "Some jQuery promises not having notify/reject/resolve
methods."
+ "Adjusted tests assuming callee is non-strict"
]
},
{
@@ -45,9 +39,8 @@
"expected-pass": 27,
"comment": [
"Current failure categories:",
- "We don't implement src= iframes yet.",
- "Support tests expecting different things than it actually
gets",
- " from the browser, presumably due to Domado unsupported
features."
+ "https://code.google.com/p/google-caja/issues/detail?id=1199",
+ "https://code.google.com/p/google-caja/issues/detail?id=1791"
]
},
{
@@ -55,32 +48,28 @@
"expected-pass": 286,
"comment": [
"Current failure categories:",
- "'Triggering the removeData should not throw exceptions.' is",
- " getting its hands on what looks like the tameContainerNode
of",
- " an iframe and thus noting the absence of addEventListener."
+ "https://code.google.com/p/google-caja/issues/detail?id=1792"
]
},
{
"guest": "queue",
- "expected-pass": "all",
- "comment": [
- "Current failure categories:",
- "foo.animate is not a function"
- ]
+ "expected-pass": "all"
},
{
"guest": "attributes",
"expected-pass": 428,
"comment": [
"Current failure categories:",
- "Seeing absolute instead of relative URLs (visible
rewriting).",
- "target= rewriting is visible to the guest.",
- "We don't implement XML yet.",
- ".checked is affecting checked= when it shouldn't.",
- "We don't implement document.createAttribute yet.",
- "Removing style= attributes is misbehaving.",
- "Something about retrieving tabindex.",
- "Other mismatches."
+ "https://code.google.com/p/google-caja/issues/detail?id=1787",
+ "https://code.google.com/p/google-caja/issues/detail?id=1795",
+ "https://code.google.com/p/google-caja/issues/detail?id=1786",
+ "https://code.google.com/p/google-caja/issues/detail?id=1812",
+ "https://code.google.com/p/google-caja/issues/detail?id=1798",
+ "https://code.google.com/p/google-caja/issues/detail?id=1785",
+ "https://code.google.com/p/google-caja/issues/detail?id=1799",
+ "https://code.google.com/p/google-caja/issues/detail?id=1800",
+ "https://code.google.com/p/google-caja/issues/detail?id=1155",
+ "https://code.google.com/p/google-caja/issues/detail?id=1807"
]
},
{
@@ -88,9 +77,13 @@
"expected-pass": 376,
"comment": [
"Current failure categories:",
- "Object [domado object HTMLInputElement] has no
method 'click'",
- "At least one lost-signal failure.",
- "Other unexamined."
+ "https://code.google.com/p/google-caja/issues/detail?id=1199",
+ "https://code.google.com/p/google-caja/issues/detail?id=1799",
+ "https://code.google.com/p/google-caja/issues/detail?id=1812",
+ "https://code.google.com/p/google-caja/issues/detail?id=1810",
+ "https://code.google.com/p/google-caja/issues/detail?id=1814",
+ "TODO(ihab.awad): This is as far as I got with diagnosis.",
+ " Some bugs probably remain in this file."
]
},
{
=======================================
--- /trunk/third_party/js/jqueryjs/README-Caja.txt Fri Jun 7 17:22:43 2013
+++ /trunk/third_party/js/jqueryjs/README-Caja.txt Mon Jul 22 14:48:17 2013
@@ -5,3 +5,6 @@
The built jQuery in dist/ was obtained independently from
<http://jquery.com/download/>, rather than locally building, to avoid
needing
to install the required build tools.
+
+Some tests in proxytests.html have been disabled due to ES5/3 not
supporting
+them. Other changes necessary are marked with comments "Patched for Caja".
=======================================
--- /trunk/third_party/js/jqueryjs/test/unit/attributes.js Fri Jun 7
17:22:43 2013
+++ /trunk/third_party/js/jqueryjs/test/unit/attributes.js Mon Jul 22
14:48:17 2013
@@ -54,7 +54,7 @@
});
test( "attr(String)", function() {
- expect( 50 );
+ expect( 47 /* Patched for Caja: 50 */ );
equal( jQuery("#text1").attr("type"), "text", "Check for type attribute"
);
equal( jQuery("#radio1").attr("type"), "radio", "Check for type
attribute" );
@@ -75,9 +75,13 @@
// [7472] & [3113] (form contains an input with name="action" or
name="id")
var extras = jQuery("<input id='id' name='id' /><input id='name'
name='name' /><input id='target' name='target' />").appendTo("#testForm");
- equal(
jQuery("#form").attr("action","newformaction").attr("action"), "newformaction", "Check
that action attribute was changed" );
+ // Patched for Caja: URL-valued attributes are converted into absolute
form in
+ // Caja. This test is therefore disabled.
+ // equal(
jQuery("#form").attr("action","newformaction").attr("action"), "newformaction", "Check
that action attribute was changed" );
equal( jQuery("#testForm").attr("target"), undefined, "Retrieving target
does not equal the input with name=target" );
- equal(
jQuery("#testForm").attr("target", "newTarget").attr("target"), "newTarget", "Set
target successfully on a form" );
+ // Patched for Caja: 'target' attributes are rewritten in Caja.
+ // This test is therefore disabled.
+ // equal(
jQuery("#testForm").attr("target", "newTarget").attr("target"), "newTarget", "Set
target successfully on a form" );
equal( jQuery("#testForm").removeAttr("id").attr("id"),
undefined, "Retrieving id does not equal the input with name=id after id is
removed [#7472]" );
// Bug #3685 (form contains input with name="name")
equal( jQuery("#testForm").attr("name"), undefined, "Retrieving name does
not retrieve input with name=name" );
@@ -150,7 +154,9 @@
equal( $form.attr("class"), "something", "Retrieve the class attribute on
a form." );
var $a = jQuery("<a href='#'
onclick='something()'>Click</a>").appendTo("#qunit-fixture");
- equal( $a.attr("onclick"), "something()", "Retrieve ^on attribute without
anonymous function wrapper." );
+ // Patched for Caja: 'onclick' JavaScript attributes are rewritten in
Caja.
+ // This test is therefore disabled.
+ // equal( $a.attr("onclick"), "something()", "Retrieve ^on attribute
without anonymous function wrapper." );
ok( jQuery("<div/>").attr("doesntexist") === undefined, "Make sure
undefined is returned when no attribute is found." );
ok( jQuery("<div/>").attr("title") === undefined, "Make sure undefined is
returned when no attribute is found." );
@@ -250,7 +256,7 @@
});
test( "attr(String, Object)", function() {
- expect( 71 );
+ expect( 70 /* Patched for Caja: 71 */ );
var div = jQuery("div").attr("foo", "bar"),
i = 0,
@@ -316,8 +322,11 @@
equal( $input.attr("checked"), "checked", "Set checked to 'checked'
(verified by .attr)" );
var $radios = jQuery("#checkedtest").find("input[type='radio']");
- $radios.eq( 1 ).trigger("click");
- equal( $radios.eq( 1 ).prop("checked"), true, "Second radio was checked
when clicked" );
+ // Patched for Caja: We cannot support click() securely in Caja with
reasonable
+ // effort. https://code.google.com/p/google-caja/issues/detail?id=1129
+ // This test is therefore disabled.
+ // $radios.eq( 1 ).trigger("click");
+ // equal( $radios.eq( 1 ).prop("checked"), true, "Second radio was
checked when clicked" );
equal( $radios.eq( 0 ).attr("checked"), "checked", "First radio is still
[checked]" );
$input = jQuery("#text1").attr( "readonly", false ).prop( "readOnly",
true );
@@ -358,17 +367,21 @@
jQuery("#foo").attr("contenteditable", true);
equal( jQuery("#foo").attr("contenteditable"), "true", "Enumerated
attributes are set properly" );
- var attributeNode = document.createAttribute("irrelevant"),
+ // TODO(ihab.awad): document.createAttribute() is nonexistent, so we need
to
+ // allow the rest of the tests to be executed.
+ var /* attributeNode = document.createAttribute("irrelevant"), */
commentNode = document.createComment("some comment"),
textNode = document.createTextNode("some text"),
obj = {};
-
- jQuery.each( [ commentNode, textNode, attributeNode ], function( i, elem
) {
+ jQuery.each( [ commentNode, textNode /* , attributeNode */ ], function(
i, elem ) {
var $elem = jQuery( elem );
$elem.attr( "nonexisting", "foo" );
strictEqual( $elem.attr("nonexisting"), undefined, "attr(name, value)
works correctly on comment and text nodes (bug #7500)." );
});
+ // TODO(ihab.awad): window.eval() unsupported, so must comment out to
allow
+ // other tests to proceed.
+ /*
// Register the property name to avoid generating a new global when
testing window
Globals.register("nonexisting");
jQuery.each( [ window, document, obj, "#firstp" ], function( i, elem ) {
@@ -378,6 +391,7 @@
equal( $elem.attr( "nonexisting", "foo"
).attr("nonexisting"), "foo", "attr falls back to prop on unsupported
arguments" );
elem.nonexisting = oldVal;
});
+ */
var table =
jQuery("#table").append("<tr><td>cell</td></tr><tr><td>cell</td><td>cell</td></tr><tr><td>cell</td><td>cell</td></tr>"),
td = table.find("td:first");
@@ -617,7 +631,7 @@
});
test( "prop(String, Object)", function() {
- expect( 31 );
+ expect( 30 /* TODO(ihab.awad): 31 */ );
equal( jQuery("#text1").prop("value"), "Test", "Check for value
attribute" );
equal( jQuery("#text1").prop( "value", "Test2"
).prop("defaultValue"), "Test", "Check for defaultValue attribute" );
@@ -666,11 +680,13 @@
equal( jQuery( option ).prop("selected"), true, "Make sure that a single
option is selected, even when in an optgroup." );
equal( jQuery( document ).prop("nodeName"), "#document", "prop works
correctly on document nodes (bug #7451)." );
- var attributeNode = document.createAttribute("irrelevant"),
+ // TODO(ihab.awad): document.createAttribute() is nonexistent, so we need
to
+ // allow the rest of the tests to be executed.
+ var /* attributeNode = document.createAttribute("irrelevant"), */
commentNode = document.createComment("some comment"),
textNode = document.createTextNode("some text"),
obj = {};
- jQuery.each( [ document, attributeNode, commentNode, textNode,
obj, "#firstp" ], function( i, ele ) {
+ jQuery.each( [ document, /* attributeNode, */ commentNode, textNode,
obj, "#firstp" ], function( i, ele ) {
strictEqual( jQuery( ele ).prop("nonexisting"), undefined, "prop works
correctly for non existing attributes (bug #7500)." );
});
@@ -747,8 +763,9 @@
});
test( "removeProp(String)", function() {
- expect( 6 );
- var attributeNode = document.createAttribute("irrelevant"),
+ expect( 5 /* TODO(ihab.awad): 6 */ );
+ // TODO(ihab.awad): document.createAttribute() not supported
+ var /* attributeNode = document.createAttribute("irrelevant"), */
commentNode = document.createComment("some comment"),
textNode = document.createTextNode("some text"),
obj = {};
@@ -764,7 +781,8 @@
$ele.prop( "nonexisting", "foo" ).removeProp("nonexisting");
strictEqual( ele["nonexisting"], undefined, "removeProp works correctly
on non DOM element nodes (bug #7500)." );
});
- jQuery.each( [ commentNode, textNode, attributeNode ], function( i, ele )
{
+ // TODO(ihab.awad): see above
+ jQuery.each( [ commentNode, textNode /*, attributeNode */ ], function( i,
ele ) {
var $ele = jQuery( ele );
$ele.prop( "nonexisting", "foo" ).removeProp("nonexisting");
strictEqual( ele["nonexisting"], undefined, "removeProp works correctly
on non DOM element nodes (bug #7500)." );
@@ -988,7 +1006,11 @@
jQuery("#kkk").val("gf");
- document["kk"].reset();
+ // TODO(ihab.awad): work around
+ // https://code.google.com/p/google-caja/issues/detail?id=1807
+ // to allow other tests to run
+ // document["kk"].reset();
+ document.getElementById('kk').reset();
equal( jQuery("#kkk")[ 0 ].value, "cf", "Check value of select after form
reset." );
equal( jQuery("#kkk").val(), "cf", "Check value of select after form
reset." );
=======================================
--- /trunk/third_party/js/jqueryjs/test/unit/event.js Fri Jun 7 17:22:43
2013
+++ /trunk/third_party/js/jqueryjs/test/unit/event.js Mon Jul 22 14:48:17
2013
@@ -1039,7 +1039,7 @@
});
test( "submit event bubbles on copied forms (#11649)", function() {
- expect( 3 );
+ expect( 0 /* Patched for Caja: 3 */ );
var $formByClone, $formByHTML,
$testForm = jQuery("#testForm"),
@@ -1846,6 +1846,12 @@
.remove();
});
+// Patched for Caja
+test('ihab got up to here', function() {
+ expect(1);
+ ok(true, 'IHAB DEBUGGED UP TO HERE THEN WENT UP AND REMOVED ALL THE
STUFF ABOUT click() FAILING');
+});
+
test("undelegate all bound events", function(){
expect(2);
@@ -1966,6 +1972,12 @@
test("delegate with submit", function() {
expect( 2 );
+ // Patched for Caja: This test fails for some reason (some of the events
are
+ // not delivered), though it cannot be reproduced in Caja independently.
+ // Leaving this comment as a placeholder; maybe fixing the rest of the
bugs
+ // will make this one go away (lots of the other tests mess with a shared
+ // DOM, so they are not independent...).
+
var count1 = 0, count2 = 0;
jQuery("#body").delegate("#testForm", "submit", function(ev) {
@@ -2077,6 +2089,8 @@
jQuery( "body" ).unbind( "focusin.focusinBubblesTest" );
});
+// Patched for Caja: Got this far with diagnosis and bug filing.
+
test("custom events with colons (#3533, #8272)", function() {
expect(1);
@@ -2339,7 +2353,8 @@
// Native click
cb.checked = true;
equal( cb.checked, true, "native - checkbox is initially checked" );
- cb.click();
+ // Patched for Caja: Remove when click() supported (see associated
bugs).
+ // cb.click();
equal( cb.checked, false, "native - checkbox is no longer checked" );
// jQuery click
--
---
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.