summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/custom-elements/v0/creating-and-passing-registries/share-registry-import-document.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/custom-elements/v0/creating-and-passing-registries/share-registry-import-document.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/custom-elements/v0/creating-and-passing-registries/share-registry-import-document.html')
-rw-r--r--testing/web-platform/tests/custom-elements/v0/creating-and-passing-registries/share-registry-import-document.html95
1 files changed, 95 insertions, 0 deletions
diff --git a/testing/web-platform/tests/custom-elements/v0/creating-and-passing-registries/share-registry-import-document.html b/testing/web-platform/tests/custom-elements/v0/creating-and-passing-registries/share-registry-import-document.html
new file mode 100644
index 000000000..251e4f123
--- /dev/null
+++ b/testing/web-platform/tests/custom-elements/v0/creating-and-passing-registries/share-registry-import-document.html
@@ -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>