Update web-platform-tests to revision 697b971060b2d475a73c1c3755232a4674d61cf5

This commit is contained in:
Ms2ger 2016-05-10 11:29:19 +02:00
parent f60598909a
commit b97474fbba
236 changed files with 4817 additions and 893 deletions

View file

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<title>When an HTML Document is loaded in a browsing context, a new registry must be created and associated with this document</title>
<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<meta name="assert" content="When an HTML Document is loaded in a browsing context, a new registry must be created and associated with this document.">
<link rel="help" href="http://www.w3.org/TR/custom-elements/#creating-and-passing-registries">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../testcommon.js"></script>
</head>
<body>
<div id="log"></div>
<script>
testInIFrame('../resources/blank.html', function(doc) {
try {
doc.registerElement('x-element');
} catch (e) {
assert_unreached('Unexpected exception, while registering a valid custom element');
}
}, 'Document, loaded into browsing context, must have a new empty registry');
testInIFrame('../resources/blank.html', function(loadedDocument) {
var createdDocument = document.implementation.createHTMLDocument('Test Document');
// Let's check that loadedDocument and createdDocument use different registeries.
createdDocument.registerElement('x-element');
try {
loadedDocument.registerElement('x-element');
} catch (e) {
assert_unreached('Unexpected exception while registering a custom element ' +
'in a document, which has it\'s own registry');
}
}, 'Document, loaded into browsing context, must have a new empty registry, ' +
'which is different from other documents\' registries');
</script>
</body>
</html>

View file

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<title>New document without browsing context must not have a registry</title>
<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<meta name="assert" content="In all other cases, new documents must not have a registry.">
<link rel="help" href="http://www.w3.org/TR/custom-elements/#creating-and-passing-registries">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../testcommon.js"></script>
</head>
<body>
<div id="log"></div>
<script>
test(function() {
var doc = document.implementation.createDocument(null, 'test', null);
assert_throws(
'NotSupportedError',
function() { doc.registerElement('x-element'); },
'Registering valid custom element in a document ' +
'without registry should fail');
}, 'Document of type other than HTML, not loaded into browsing context, must not have a registry');
async_test(function(t) {
var request = new XMLHttpRequest();
request.onreadystatechange = t.step_func(function() {
if (request.readyState == 4){
assert_equals(200, request.status, 'Test document is not loaded correctly');
var doc = request.response;
assert_true(doc instanceof HTMLDocument,
'XMLHttpRequest\'s asynchronous response should be HTML document');
assert_throws(
'NotSupportedError',
function() { doc.registerElement('x-element'); },
'Registering valid custom element in ' +
'an XMLHttpRequest\'s response document should fail');
t.done();
}
});
request.open('GET', '../resources/blank.html', true);
request.responseType = 'document';
request.send();
}, 'XMLHttpRequest\'s asynchronous response HTML document must not have a registry');
</script>
</body>
</html>

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<title>Document, created with createHTMLDocument or createDocument with HTML namespace, should share registry with the associated document</title>
<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<meta name="assert" content="When DOMImplementation's createDocument method is invoked with namespace set to HTML Namespace or when the createHTMLDocument method is invoked, use the registry of the associated document to the new instance.">
<link rel="help" href="http://www.w3.org/TR/custom-elements/#creating-and-passing-registries">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../testcommon.js"></script>
</head>
<body>
<div id="log"></div>
<script>
test(function() {
var doc = newHTMLDocument();
var name = 'x-frame';
var GeneratedConstructor = doc.registerElement(name);
var doc2 = doc.implementation.createHTMLDocument('Document 2');
assert_throws(
'NotSupportedError',
function() { doc2.registerElement(name); },
'Registering a custom element type name that is already registered in a shared ' +
'registry should throw an exception');
var xframe = doc2.createElement(name);
assert_true(xframe instanceof GeneratedConstructor,
'Created element should be x-frame instance');
}, 'Document created by createHTMLDocument should share an existing registry');
test(function() {
var doc = newHTMLDocument();
var name = 'x-frame-1';
var GeneratedConstructor = doc.registerElement(name);
var doc2 = doc.implementation.createDocument(HTML_NAMESPACE, 'html', null);
assert_throws(
'NotSupportedError',
function() { doc2.registerElement(name); },
'Exception should be thrown for custom element, ' +
'which is already registered in shared registry');
var xframe = doc2.createElement(name);
assert_true(xframe instanceof GeneratedConstructor,
'Created element should be x-frame instance');
}, 'Document created by createDocument with HTML namespace should share an existing registry');
</script>
</body>
</html>

View file

@ -0,0 +1,95 @@
<!DOCTYPE html>
<html>
<head>
<title>When creating an import, use the registry of the master document</title>
<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<meta name="assert" content="When creating an import, use the registry of the master document.">
<link rel="help" href="http://www.w3.org/TR/custom-elements/#creating-and-passing-registries">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../testcommon.js"></script>
</head>
<body>
<div id="log"></div>
<script>
var test1 = async_test('Registry of the imported document should be shared with master document. ' +
'Import is asynchronous');
test1.step(function() {
var iframe = newIFrame('../resources/import-master-async.html');
document.body.appendChild(iframe);
iframe.onload = test1.step_func(function() {
var doc = iframe.contentDocument;
var link = doc.querySelector('link[rel=import]');
link.onload = test1.step_func(function() {
try {
var doc2 = link.import;
var name = 'x-frame';
doc.registerElement(name);
assert_throws(
'NotSupportedError',
function() { doc2.registerElement(name); },
'Registering a custom element type name that is already registered in a shared ' +
'registry should throw an exception');
test1.done();
} finally {
iframe.remove();
}
});
});
});
var test2 = async_test('Registry of the master document should be shared with imported document. ' +
'Import is asynchronous');
test2.step(function() {
var iframe = newIFrame('../resources/import-master-async.html');
document.body.appendChild(iframe);
iframe.onload = test2.step_func(function() {
var doc = iframe.contentDocument;
var link = doc.querySelector('link[rel=import]');
link.onload = test2.step_func(function() {
try {
var doc2 = link.import;
var name = 'x-frame';
doc2.registerElement(name);
assert_throws(
'NotSupportedError',
function() { doc.registerElement(name); },
'Registering a custom element type name that is already registered in a shared ' +
'registry should throw an exception');
test2.done();
} finally {
iframe.remove();
}
});
});
});
testInIFrame('../resources/import-master.html', function(doc) {
var link = doc.querySelector('link[rel=import]');
var doc2 = link.import;
var name = 'x-frame';
doc.registerElement(name);
assert_throws(
'NotSupportedError',
function() { doc2.registerElement(name); },
'Registering a custom element type name that is already registered in a shared ' +
'registry should throw an exception');
}, 'Registry of the imported document should be shared with master document. Import is syncronous');
testInIFrame('../resources/import-master.html', function(doc) {
var link = doc.querySelector('link[rel=import]');
var doc2 = link.import;
var name = 'x-frame';
doc2.registerElement(name);
assert_throws(
'NotSupportedError',
function() { doc.registerElement(name); },
'Registering a custom element type name that is already registered in a shared ' +
'registry should throw an exception');
}, 'Registry of the master document should be shared with imported document. Import is syncronous');
</script>
</body>
</html>