Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / custom-elements / no-registry-test.html
1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <script>
5 test(function() {
6     var doc = document.implementation.createDocument(null, 'test', null);
7     assert_throws(
8         'NotSupportedError',
9         function() { doc.registerElement('x-element'); },
10         'Registering valid custom element in a document ' +
11             'without registry should fail');
12 }, 'Document of type other than HTML, not loaded into browsing context, must not have a registry');
13
14 async_test(function(t) {
15     var request = new XMLHttpRequest();
16     request.onreadystatechange = t.step_func(function() {
17         if (request.readyState == 4) {
18             assert_equals(request.status, 200, 'Test document is not loaded correctly');
19             var doc = request.response;
20             assert_true(doc instanceof HTMLDocument,
21                 'XMLHttpRequest\'s asynchronous response should be HTML document');
22             assert_throws(
23                 'NotSupportedError',
24                 function() { doc.registerElement('x-element'); },
25                 'Registering valid custom element in ' +
26                     'an XMLHttpRequest\'s response document should fail');
27             t.done();
28         }
29     });
30
31     request.open('GET', 'resources/blank.html', true);
32     request.responseType = 'document';
33     request.send();
34 }, 'XMLHttpRequest\'s asynchronous response HTML document must not have a registry');
35 </script>
36 </body>
37 </html>