OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>document.contentType</title> |
| 3 <link rel="help" href="http://dom.spec.whatwg.org/#dom-document-contenttype"> |
| 4 <script src="../../resources/js-test.js"></script> |
| 5 <body> |
| 6 <p> |
| 7 <iframe data-mt="text/html"></iframe> |
| 8 <iframe data-mt="text/xml"></iframe> |
| 9 <iframe data-mt="application/xml"></iframe> |
| 10 <iframe data-mt="image/svg+xml"></iframe> |
| 11 </p> |
| 12 <script> |
| 13 window.jsTestIsAsync = true; |
| 14 |
| 15 window.onmessage = function(e) { |
| 16 if (e.data) |
| 17 shouldBe('"' + e.data.obtained + '"', '"' + e.data.expected + '"'); |
| 18 else |
| 19 testFailed("Null message payload"); |
| 20 |
| 21 if (--expectedMessagesCount == 0) |
| 22 finishJSTest(); |
| 23 }; |
| 24 |
| 25 var documentContents = '<script xmlns="http://www.w3.org/1999/xhtml">' + |
| 26 'parent.postMessage(' + |
| 27 '{obtained: document.contentType, expected: "{0}"}, "*");' + |
| 28 '<' + '/script>'; |
| 29 |
| 30 var iframes = document.getElementsByTagName('iframe'); |
| 31 for (var k = 0, f; f = iframes[k]; k++) { |
| 32 f.src = 'data:' + f.dataset.mt + ',' + |
| 33 encodeURIComponent(documentContents.replace('{0}', f.dataset.mt)); |
| 34 } |
| 35 |
| 36 var expectedMessagesCount = iframes.length; |
| 37 |
| 38 </script> |
OLD | NEW |