Update web-platform-tests to revision d011702f368b88b3bae86e7a8fd2ddd22e18b33c

This commit is contained in:
Ms2ger 2016-04-12 09:07:41 +02:00
parent f9608022ca
commit 299ad0f9d0
573 changed files with 38776 additions and 14942 deletions

View file

@ -19,7 +19,7 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation: The shadow nodes and named shadow elements are not accessible using shadow host's document DOM tree accessors.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>
@ -66,7 +66,6 @@ var HTML_CONTENT = [
'<embed></embed>',
'<form></form>',
'<script><' + '/script>',
'<applet></applet>',
'</body>'
].join('\n');
@ -91,7 +90,7 @@ function populateTestContentToShadowRoot(shadowRoot) {
function createDocumentForTesting() {
var doc = document.implementation.createHTMLDocument('');
populateTestContentToHostDocument(doc);
var shadowRoot = doc.documentElement.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
populateTestContentToShadowRoot(shadowRoot);
return doc;
}
@ -121,13 +120,17 @@ test(function () {
test(function () {
var doc = document.implementation.createHTMLDocument('');
populateTestContentToHostDocument(doc);
var shadowRoot = doc.documentElement.createShadowRoot();
// Note: this test is originally written to replace document.documentElement
// with shadow contents, but among Shadow DOM V1 allowed elements body is the
// most approximate to it, though some test may make lesser sense.
var shadowRoot = doc.body.attachShadow({mode: 'open'});
populateTestContentToShadowRoot(shadowRoot);
// Replace the content of <title> to distinguish elements in a host
// document and a shadow tree.
doc.getElementsByTagName('title')[0].textContent = 'Title of host document';
shadowRoot.getElementsByTagName('title')[0].textContent =
shadowRoot.querySelector('title').textContent =
'Title of shadow tree';
assert_equals(doc.title, 'Title of host document');
@ -165,7 +168,7 @@ test(function () {
generate_tests(
testHTMLCollection,
['anchors', 'applets', 'all'].map(
['anchors', 'all'].map(
function (accessor) {
return [
'Elements in a shadow tree should not be accessible from ' +
@ -213,7 +216,7 @@ test(function () {
var shadowRoot = doc.documentElement.createShadowRoot();
populateTestContentToShadowRoot(shadowRoot);
shadowRoot.getElementsByTagName('p')[0].id = 'test-id';
shadowRoot.querySelectorAll('p')[0].id = 'test-id';
assert_equals(doc.getElementById('test-id'), null);
},
'Elements in a shadow tree should not be accessible from owner ' +

View file

@ -18,7 +18,7 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation: The nodes are accessible using shadow root's DOM tree accessor methods.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>
@ -30,53 +30,33 @@ function assert_singleton_node_list(nodeList, expectedNode) {
test(function () {
var doc = document.implementation.createHTMLDocument('Test');
var shadowRoot = doc.body.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
var image = doc.createElement('img');
shadowRoot.appendChild(image);
assert_singleton_node_list(shadowRoot.getElementsByTagName('img'), image);
assert_singleton_node_list(shadowRoot.querySelectorAll('img'), image);
},
'Elements in a shadow tree should be accessible via shadow root\'s ' +
'getElementsByTagName() DOM tree accessor.'
);
test(function () {
var namespace = 'http://www.w3.org/1999/xhtml';
var doc = document.implementation.createDocument(namespace, 'html');
doc.documentElement.appendChild(doc.createElementNS(namespace, 'head'));
var body = doc.createElementNS(namespace, 'body');
var imageHost = doc.createElementNS(namespace, 'img');
body.appendChild(imageHost);
doc.documentElement.appendChild(body);
var shadowRoot = body.createShadowRoot();
var imageShadow = doc.createElementNS(namespace, 'img');
shadowRoot.appendChild(imageShadow);
assert_singleton_node_list(
shadowRoot.getElementsByTagNameNS(namespace, 'img'), imageShadow);
},
'Elements in a shadow tree should be accessible via shadow root\'s ' +
'getElementsByTagNameNS() DOM tree accessor.'
'querySelectorAll() DOM tree accessor.'
);
test(function () {
var doc = document.implementation.createHTMLDocument('Test');
var shadowRoot = doc.body.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
var div = doc.createElement('div');
div.className = 'div-class';
shadowRoot.appendChild(div);
assert_singleton_node_list(
shadowRoot.getElementsByClassName('div-class'), div);
shadowRoot.querySelectorAll('.div-class'), div);
},
'Elements in a shadow tree should be accessible via shadow root\'s ' +
'getElementsByClassName() DOM tree accessor.'
'Elements with a specific class in a shadow tree should be accessible via' +
'shadow root\'s querySelectorAll() DOM tree accessor.'
);
test(function () {
var doc = document.implementation.createHTMLDocument('Test');
var shadowRoot = doc.body.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
var div = doc.createElement('div');
div.id = 'div-id';
shadowRoot.appendChild(div);

View file

@ -19,7 +19,7 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation: The ownerDocument property of all nodes in shadow tree refers to the document of the shadow host.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>

View file

@ -19,7 +19,8 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation: The ownerDocument property of all nodes in shadow tree refers to the document of the shadow host.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
<script src="../../../resources/shadow-dom-utils.js"></script>
</head>
<body>
<div id="log"></div>
@ -28,8 +29,8 @@ function testElement(elementName) {
var doc = document.implementation.createHTMLDocument('Test');
var element = doc.createElement(elementName);
doc.body.appendChild(element);
var shadowRoot = element.createShadowRoot();
HTML5_ELEMENT_NAMES.forEach(function (name) {
var shadowRoot = element.attachShadow({mode: 'open'});
ATTACHSHADOW_SAFELISTED_ELEMENTS.forEach(function (name) {
shadowRoot.appendChild(doc.createElement(name));
});
@ -40,7 +41,7 @@ function testElement(elementName) {
}
}
var testParameters = HTML5_ELEMENT_NAMES.map(function (name) {
var testParameters = ATTACHSHADOW_SAFELISTED_ELEMENTS.map(function (name) {
return [
'ownerDocument property of any elements in a shadow tree should ' +
'match the document of the shadow host, when the host is a "' +

View file

@ -17,7 +17,7 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation: Nodes in a shadow tree must not be accessible through selector APIs of owner document.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>

View file

@ -18,7 +18,7 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation: Nodes in a shadow tree must be accessible through selector APIs of the shadow root.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>

View file

@ -18,7 +18,7 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation: The parentNode and parentElement attributes of the shadow root object must always return null.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>

View file

@ -16,7 +16,7 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation:The nodes with a unique id and named elements are not addressable from any attributes of elements in shadow host's document">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>

View file

@ -16,7 +16,7 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation:The nodes with a unique id and named elements are addressable from any attributes of elements in the same shadow DOM subtree">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>

View file

@ -18,7 +18,7 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation: no nodes other than shadow root descendants are accessible with shadow root DOM tree accessor methods">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>
@ -53,10 +53,10 @@ A_04_01_09.setup = function () {
ctx.d = newHTMLDocument();
A_04_01_09.setupBlock(ctx, 'd', ctx.d.body);
ctx.s1 = ctx.d_p1.createShadowRoot();
ctx.s1 = ctx.d_p1.attachShadow({mode: 'open'});
A_04_01_09.setupBlock(ctx, 's1', ctx.s1);
ctx.s2 = ctx.s1_p1.createShadowRoot();
ctx.s2 = ctx.s1_p1.attachShadow({mode: 'open'});
A_04_01_09.setupBlock(ctx, 's2', ctx.s2);
assert_true(ctx.d_div1 != null, 'setup:d_div1');
@ -69,78 +69,38 @@ A_04_01_09.setup = function () {
return ctx;
};
//check getElementsByTagName
//check querySelectorAll
test(function () {
var ctx = A_04_01_09.setup();
assert_nodelist_contents_equal_noorder(
ctx.s1.getElementsByTagName('div'), [ctx.s1_div1, ctx.s1_div2],
ctx.s1.querySelectorAll('div'), [ctx.s1_div1, ctx.s1_div2],
'nodes, other than shadow root descendants, should not be accessible with ' +
'ShadowRoot.getElementsByTagName (s1)');
assert_nodelist_contents_equal_noorder(
ctx.s2.getElementsByTagName('div'), [ctx.s2_div1, ctx.s2_div2],
ctx.s2.querySelectorAll('div'), [ctx.s2_div1, ctx.s2_div2],
'nodes, other than shadow root descendants, should not be accessible with ' +
'ShadowRoot.getElementsByTagName (s2)');
}, 'A_04_01_09_T01');
// getElementsByTagNameNS
//check querySelectorAll for class
test(function () {
var ctx = A_04_01_09.setup();
assert_nodelist_contents_equal_noorder(
ctx.s1.getElementsByTagNameNS('*', 'div'), [ctx.s1_div1, ctx.s1_div2],
'nodes, other than shadow root descendants, should not be accessible with ' +
'ShadowRoot.getElementsByTagNameNS (s1)');
assert_nodelist_contents_equal_noorder(
ctx.s2.getElementsByTagNameNS('*', 'div'), [ctx.s2_div1, ctx.s2_div2],
'nodes, other than shadow root descendants, should not be accessible with ' +
'ShadowRoot.getElementsByTagNameNS (s2)');
}, 'A_04_01_09_T02');
//check getElementsByClassName
test(function () {
var ctx = A_04_01_09.setup();
assert_nodelist_contents_equal_noorder(
ctx.s1.getElementsByClassName('cls'), [ctx.s1_div1, ctx.s1_p1, ctx.s1_div2],
ctx.s1.querySelectorAll('.cls'), [ctx.s1_div1, ctx.s1_p1, ctx.s1_div2],
'nodes, other than shadow root descendants, should not be accessible with ' +
'ShadowRoot.getElementsByClassName (s1)');
assert_nodelist_contents_equal_noorder(
ctx.s2.getElementsByClassName('cls'), [ctx.s2_div1, ctx.s2_p1, ctx.s2_div2],
ctx.s2.querySelectorAll('.cls'), [ctx.s2_div1, ctx.s2_p1, ctx.s2_div2],
'nodes, other than shadow root descendants, should not be accessible with ' +
'ShadowRoot.getElementsByClassName (s2)');
}, 'A_04_01_09_T03');
// check getElementById
test(function () {
var ctx = A_04_01_09.setup();
assert_equals(ctx.s1.getElementById('d_id1'), null, 'Expected no access to d_div1 from s1.getElementById()');
assert_equals(ctx.s1.getElementById('d_id2'), null, 'Expected no access to d_div2 from s1.getElementById()');
assert_equals(ctx.s2.getElementById('d_id1'), null, 'Expected no access to d_div1 from s2.getElementById()');
assert_equals(ctx.s2.getElementById('d_id2'), null, 'Expected no access to d_div1 from s2.getElementById()');
assert_equals(ctx.s1.getElementById('s1_id1'), ctx.s1_div1, 'Expected access to s1_div1 form s1.getElementById()');
assert_equals(ctx.s1.getElementById('s1_id2'), ctx.s1_div2, 'Expected access to s1_div2 form s1.getElementById()');
assert_equals(ctx.s2.getElementById('s2_id1'), ctx.s2_div1, 'Expected access to s2_div1 form s2.getElementById()');
assert_equals(ctx.s2.getElementById('s2_id2'), ctx.s2_div2, 'Expected access to s2_div2 form s2.getElementById()');
assert_equals(ctx.s1.getElementById('s2_id1'), null, 'Expected no access to s2_div1 form s1.getElementById()');
assert_equals(ctx.s1.getElementById('s2_id2'), null, 'Expected no access to s2_div2 form s1.getElementById()');
assert_equals(ctx.s2.getElementById('s1_id1'), null, 'Expected no access to s1_div1 form s2.getElementById()');
assert_equals(ctx.s2.getElementById('s1_id2'), null, 'Expected no access to s1_div2 form s2.getElementById()');
}, 'A_04_01_09_T04');
// check querySelector for id
test(function () {
var ctx = A_04_01_09.setup();

View file

@ -16,48 +16,30 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation:The style sheets, represented by the shadow nodes are not accessible using shadow host document's CSSOM extensions">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
<script src="../../../resources/shadow-dom-utils.js"></script>
</head>
<body>
<div id="log"></div>
<script>
// check that <style> element added to head is not exposed
var A_04_01_11_T1 = async_test('A_04_01_11_T01');
A_04_01_11_T1.step(function () {
var ctx = newContext();
var iframe = newIFrame(ctx, '../../resources/blank.html');
iframe.onload = A_04_01_11_T1.step_func(step_unit(function () {
var d = iframe.contentDocument;
var initialStyleSheetsCount = d.styleSheets.length;
var s = d.head.createShadowRoot();
var style = d.createElement('style');
s.appendChild(style);
assert_equals(d.styleSheets.length, initialStyleSheetsCount, 'style elements in shadow DOM must not be exposed via ' +
'the document.styleSheets collection ');
}, ctx, A_04_01_11_T1));
});
// check that <link> element added to head is not exposed
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
var initialStyleSheetsCount = d.styleSheets.length;
var d = newRenderedHTMLDocument(ctx);
var initialStyleSheetsCount = d.styleSheets.length;
var link = d.createElement('link');
link.setAttribute('rel', 'stylesheet');
d.body.appendChild(link);
var link = d.createElement('link');
link.setAttribute('rel', 'stylesheet');
d.body.appendChild(link);
//create Shadow root
var root = d.createElement('div');
d.body.appendChild(root);
var s = root.createShadowRoot();
//create Shadow root
var root = d.createElement('div');
d.body.appendChild(root);
var s = root.createShadowRoot();
s.appendChild(link);
s.appendChild(link);
assert_equals(d.styleSheets.length, initialStyleSheetsCount, 'stylesheet link elements in shadow DOM must not be ' +
assert_equals(d.styleSheets.length, initialStyleSheetsCount, 'stylesheet link elements in shadow DOM must not be ' +
'exposed via the document.styleSheets collection');

View file

@ -18,7 +18,7 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation: The nodes and named elements are not accessible from Window object named properties.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>
@ -42,49 +42,6 @@ test(function () {
'An iframe element in a shadow tree should not be accessible from ' +
'window\'s named properties with its "name" attribute value.'
);
var frameTest = async_test(
'A frame element in a shadow tree should not be accessible from ' +
'window\'s named properties with its "name" attribute value.');
frameTest.step(function () {
// To test a document with frames, an iframe containing frames is created.
var srcdoc = [
'<!DOCTYPE html>',
'<html>',
'<head>',
'<title>Frames Test</title>',
'<script src="../../testcommon.js"><' + '/script>',
'</head>',
'<frameset id="host" cols="50%,*">',
'<frame src="about:blank" name="host-frame1">',
'<frame src="about:blank" name="host-frame2">',
'</frameset>',
'</html>'
].join('\n');
var iframe = document.createElement('iframe');
iframe.srcdoc = srcdoc;
iframe.style.display = 'none';
iframe.addEventListener('load', frameTest.step_func(function (event) {
try {
var doc = iframe.contentDocument;
var win = iframe.contentWindow;
var shadowRoot = doc.getElementById('host').createShadowRoot();
shadowRoot.innerHTML =
'<frame src="about:blank" name="shadow-frame1">\n' +
'<frame src="about:blank" name="shadow-frame2">';
assert_false('shadow-frame1' in win);
assert_false('shadow-frame2' in win);
frameTest.done();
} finally {
if (iframe.parentNode)
iframe.parentNode.removeChild(iframe);
}
}));
document.body.appendChild(iframe);
});
</script>
</body>
</html>

View file

@ -18,7 +18,7 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation: The nodes and named elements are not accessible from Window object named properties.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>

View file

@ -18,7 +18,8 @@ policies and contribution forms [3].
<meta name="assert" content="Upper-boundary encapsulation: The nodes and named elements are not accessible from Window object named properties.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../../../html/resources/common.js"></script>
<script src="../../../resources/shadow-dom-utils.js"></script>
</head>
<body>
<div id="log"></div>