| OLD | NEW | 
| (Empty) |  | 
 |   1 <!DOCTYPE html> | 
 |   2 <html> | 
 |   3 <head> | 
 |   4 <title>When creating an import, use the registry of the master document</title> | 
 |   5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> | 
 |   6 <meta name="assert" content="When creating an import, use the registry of the ma
    ster document."> | 
 |   7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#creating-and-passin
    g-registries"> | 
 |   8 <script src="../../../../resources/testharness.js"></script> | 
 |   9 <script src="../../../../resources/testharnessreport.js"></script> | 
 |  10 <script src="../testcommon.js"></script> | 
 |  11 <link rel="stylesheet" href="../../../../resources/testharness.css"> | 
 |  12 </head> | 
 |  13 <body> | 
 |  14 <div id="log"></div> | 
 |  15 <script> | 
 |  16 var test1 = async_test('Registry of the imported document should be shared with 
    master document. ' + | 
 |  17     'Import is asynchronous'); | 
 |  18 test1.step(function() { | 
 |  19     var iframe = newIFrame('../resources/import-master-async.html'); | 
 |  20     document.body.appendChild(iframe); | 
 |  21     iframe.onload = test1.step_func(function() { | 
 |  22         var doc = iframe.contentDocument; | 
 |  23         var link = doc.querySelector('link[rel=import]'); | 
 |  24         link.onload = test1.step_func(function() { | 
 |  25             try { | 
 |  26                 var doc2 = link.import; | 
 |  27                 var name = 'x-frame'; | 
 |  28                 doc.registerElement(name); | 
 |  29                 assert_throws( | 
 |  30                     'NotSupportedError', | 
 |  31                     function() { doc2.registerElement(name); }, | 
 |  32                     'Registering a custom element type name that is already regi
    stered in a shared ' + | 
 |  33                         'registry should throw an exception'); | 
 |  34                 test1.done(); | 
 |  35             } finally { | 
 |  36                 iframe.remove(); | 
 |  37             } | 
 |  38         }); | 
 |  39     }); | 
 |  40 }); | 
 |  41  | 
 |  42  | 
 |  43 var test2 = async_test('Registry of the master document should be shared with im
    ported document. ' + | 
 |  44     'Import is asynchronous'); | 
 |  45 test2.step(function() { | 
 |  46     var iframe = newIFrame('../resources/import-master-async.html'); | 
 |  47     document.body.appendChild(iframe); | 
 |  48     iframe.onload = test2.step_func(function() { | 
 |  49         var doc = iframe.contentDocument; | 
 |  50         var link = doc.querySelector('link[rel=import]'); | 
 |  51         link.onload = test2.step_func(function() { | 
 |  52             try { | 
 |  53                 var doc2 = link.import; | 
 |  54                 var name = 'x-frame'; | 
 |  55                 doc2.registerElement(name); | 
 |  56                 assert_throws( | 
 |  57                     'NotSupportedError', | 
 |  58                     function() { doc.registerElement(name); }, | 
 |  59                     'Registering a custom element type name that is already regi
    stered in a shared ' + | 
 |  60                         'registry should throw an exception'); | 
 |  61                 test2.done(); | 
 |  62             } finally { | 
 |  63                 iframe.remove(); | 
 |  64             } | 
 |  65         }); | 
 |  66     }); | 
 |  67 }); | 
 |  68  | 
 |  69  | 
 |  70 testInIFrame('../resources/import-master.html', function(doc) { | 
 |  71     var link = doc.querySelector('link[rel=import]'); | 
 |  72     var doc2 = link.import; | 
 |  73     var name = 'x-frame'; | 
 |  74     doc.registerElement(name); | 
 |  75     assert_throws( | 
 |  76         'NotSupportedError', | 
 |  77         function() { doc2.registerElement(name); }, | 
 |  78         'Registering a custom element type name that is already registered in a 
    shared ' + | 
 |  79             'registry should throw an exception'); | 
 |  80 }, 'Registry of the imported document should be shared with master document. Imp
    ort is syncronous'); | 
 |  81  | 
 |  82  | 
 |  83 testInIFrame('../resources/import-master.html', function(doc) { | 
 |  84     var link = doc.querySelector('link[rel=import]'); | 
 |  85     var doc2 = link.import; | 
 |  86     var name = 'x-frame'; | 
 |  87     doc2.registerElement(name); | 
 |  88     assert_throws( | 
 |  89         'NotSupportedError', | 
 |  90         function() { doc.registerElement(name); }, | 
 |  91         'Registering a custom element type name that is already registered in a 
    shared ' + | 
 |  92             'registry should throw an exception'); | 
 |  93 }, 'Registry of the master document should be shared with imported document. Imp
    ort is syncronous'); | 
 |  94 </script> | 
 |  95 </body> | 
 |  96 </html> | 
| OLD | NEW |