Skip to content
Permalink
Browse files

Update web-platform-tests to revision 7da6acfd668e66adae5ab4e2d389810…

…d3b1460be
  • Loading branch information
jgraham committed Oct 6, 2015
1 parent 50db64a commit bae87d193d29a96680795fa1427f3fd08a42b061
Showing 307 changed files with 35,828 additions and 211 deletions.

Large diffs are not rendered by default.

@@ -1 +1 @@
d588ce8d8503bf0b340abfb13e2bd6a228cab900
a350b215cc3e943985a66f1485c7eac7f4b9832e
@@ -20,7 +20,7 @@

e.target.transaction.abort();

assert_throws("InvalidStateError", function(){
assert_throws("TransactionInactiveError", function(){
index.openCursor();
});
t.done();
@@ -20,7 +20,7 @@

e.target.transaction.abort();

assert_throws("InvalidStateError", function(){
assert_throws("TransactionInactiveError", function(){
index.openKeyCursor();
});
t.done();
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html>
<head>
<title>script-src disallowed wildcard use</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<!-- enforcing policy:
script-src 'nonce-nonce' *; connect-src 'self';
-->
<script nonce="nonce">
var t1 = async_test('data: URIs should not match *');
t1.step(function() {
var script = document.createElement("script");
script.src = 'data:application/javascript,';
script.addEventListener('load', t1.step_func(function() {
assert_unreached('Should not successfully load data URI.');
}));
script.addEventListener('error', t1.step_func(function() {
t1.done();
}));
document.head.appendChild(script);
});

var t2 = async_test('blob: URIs should not match *');
t2.step(function() {
var b = new Blob([''], { type: 'application/javascript' });
var script = document.createElement('script');
script.addEventListener('load', t2.step_func(function() {
assert_unreached('Should not successfully load blob URI.');
}));
script.addEventListener('error', t2.step_func(function() {
t2.done();
}));

script.src = URL.createObjectURL(b);
document.head.appendChild(script);
});

var t3 = async_test('filesystem URIs should not match *');
if (window.webkitRequestFileSystem) {
window.webkitRequestFileSystem(TEMPORARY, 1024*1024 /*1MB*/, function(fs) {
fs.root.getFile('fail.js', {create: true}, function(fileEntry) {
fileEntry.createWriter(function(fileWriter) {
var script = document.createElement('script');

script.addEventListener('load', t3.step_func(function() {
assert_unreached('Should not successfully load filesystem URI.');
}));
script.addEventListener('error', t3.step_func(function() {
t3.done();
}));

script.src = fileEntry.toURL('application/javascript');
document.body.appendChild(script);
});
});
});
} else {
t3.done();
}
</script>
</body>
</html>
@@ -0,0 +1,6 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: script-src-wildcards-disallowed={{$id:uuid()}}; Path=/content-security-policy/blink-contrib-2
Content-Security-Policy: script-src 'nonce-nonce' *; connect-src 'self'; report-uri /content-security-policy/support/report.py?op=put&reportID={{$id}}
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>script-hash allowed from default-src</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<script>done();</script>
</head>

<body>
<div id="log"></div>
<script async defer src="../support/checkReport.sub.js?reportExists=false"></script>
</body>
</html>
@@ -0,0 +1,6 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: scripthash-default-src={{$id:uuid()}}; Path=/content-security-policy/blink-contrib-2
Content-Security-Policy: default-src 'self' 'sha256-sc3CeiHrlck5tH2tTC4MnBYFnI9D5zp8f9odqnmGQjE='; connect-src 'self'; report-uri /content-security-policy/support/report.py?op=put&reportID={{$id}}
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>stylehash allowed from default-src</title>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
</head>

<body>
<p id="p">Test</p>
<style>p#p { color: green; }</style>
<script>
var color = window.getComputedStyle(document.querySelector('#p')).color;
assert_equals(color, "rgb(0, 128, 0)");
done();
</script>

<div id="log"></div>
<script async defer src="../support/checkReport.sub.js?reportExists=false"></script>
</body>
</html>
@@ -0,0 +1,6 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: stylehash-default-src={{$id:uuid()}}; Path=/content-security-policy/blink-contrib-2
Content-Security-Policy: default-src 'self' 'sha256-SXMrww9+PS7ymkxYbv91id+HfXeO7p1uCY0xhNb4MIw='; script-src 'self' 'unsafe-inline'; connect-src 'self'; report-uri /content-security-policy/support/report.py?op=put&reportID={{$id}}
@@ -47,7 +47,6 @@
"domConfig",
"normalizeDocument",
"renameNode",
"charset",
"defaultCharset",
"height",
"width"
@@ -7,20 +7,37 @@
<script src=productions.js></script>
<div id=log>
<script>
var xml_document;
setup(function() {
xml_document = document.implementation.createDocument(null, null, null);
});

invalid_names.forEach(function(name) {
test(function() {
assert_throws("INVALID_CHARACTER_ERR", function() {
document.createAttribute(name, "test");
});
}, "createAttribute(" + format_value(name) + ")");
}, "HTML document.createAttribute(" + format_value(name) + ")");

test(function() {
assert_throws("INVALID_CHARACTER_ERR", function() {
xml_document.createAttribute(name, "test");
});
}, "XML document.createAttribute(" + format_value(name) + ")");
});

var tests = ["title", "TITLE", null, undefined];
tests.forEach(function(name) {
test(function() {
var attribute = document.createAttribute(name);
attr_is(attribute, "", String(name).toLowerCase(), null, null, String(name).toLowerCase());
assert_equals(attribute.ownerElement, null);
}, "HTML document.createAttribute(" + format_value(name) + ")");

test(function() {
var attribute = xml_document.createAttribute(name);
attr_is(attribute, "", String(name), null, null, String(name));
assert_equals(attribute.ownerElement, null);
}, "createAttribute(" + format_value(name) + ")");
}, "XML document.createAttribute(" + format_value(name) + ")");
});
</script>
@@ -0,0 +1,51 @@
<!doctype html>
<title>XPath tests</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script>
setup({ explicit_done: true });

function find_child_element(context, element) {
for (var i = 0; i < context.childNodes.length; i++) {
var child = context.childNodes[i];
if (child.nodeType === Node.ELEMENT_NODE && child.tagName === element)
return child;
}
}

function xpath_test(test_el) {
/* note this func adopts the tree! */
var new_doc = document.implementation.createDocument("", "");
var xpath = find_child_element(test_el, "xpath");
var tree = find_child_element(test_el, "tree");
var actual_tree = new_doc.adoptNode(tree.firstElementChild);
new_doc.appendChild(actual_tree);
test(function() {
var result = new_doc.evaluate(xpath.textContent, // expression
actual_tree, // context node
new_doc.createNSResolver(actual_tree), // resolver
XPathResult.ANY_TYPE, // type
null); // result
var matched = [];
var cur;
while ((cur = result.iterateNext()) !== null) {
matched.push(cur);
}
assert_equals(matched.length, 1, "Should match one node");
});
}

var xhr = new XMLHttpRequest();
xhr.open("GET", "xml_xpath_tests.xml");
xhr.onload = function(e) {
var tests = xhr.responseXML.documentElement;
for (var i = 0; i < tests.childNodes.length; i++) {
var child = tests.childNodes[i];
if (child.nodeType === Node.ELEMENT_NODE) {
xpath_test(child);
}
}
done();
};
xhr.send();
</script>

0 comments on commit bae87d1

Please sign in to comment.
You can’t perform that action at this time.