Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=797909 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <meta charset="utf-8"> |
michael@0 | 8 | <title>Test for Bug 797909</title> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body onload="runTest()"> |
michael@0 | 13 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=797909">Mozilla Bug 797909</a> |
michael@0 | 14 | <p id="display"></p> |
michael@0 | 15 | <div id="content" style="display: none"> |
michael@0 | 16 | |
michael@0 | 17 | </div> |
michael@0 | 18 | <pre id="test"> |
michael@0 | 19 | <script type="application/javascript"> |
michael@0 | 20 | /** Test for Bug 797909 **/ |
michael@0 | 21 | |
michael@0 | 22 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 23 | |
michael@0 | 24 | function runTest() { |
michael@0 | 25 | iframe = document.getElementById("ifr"); |
michael@0 | 26 | try { |
michael@0 | 27 | var iframeDoc = iframe.contentWindow.document; |
michael@0 | 28 | ok(false, "Should have thrown an exception"); |
michael@0 | 29 | } catch (ex) { |
michael@0 | 30 | ok(true, "Got an exception"); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | iframe = document.createElement("iframe"); |
michael@0 | 34 | // set sandbox attribute |
michael@0 | 35 | iframe.sandbox = "allow-scripts"; |
michael@0 | 36 | // and then insert into the doc |
michael@0 | 37 | document.body.appendChild(iframe); |
michael@0 | 38 | |
michael@0 | 39 | try { |
michael@0 | 40 | var iframeDoc = iframe.contentWindow.document; |
michael@0 | 41 | ok(false, "Should have thrown an exception"); |
michael@0 | 42 | } catch (ex) { |
michael@0 | 43 | ok(true, "Got an exception"); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | iframe = document.createElement("iframe"); |
michael@0 | 47 | // set sandbox attribute |
michael@0 | 48 | iframe.sandbox = "allow-same-origin"; |
michael@0 | 49 | // and then insert into the doc |
michael@0 | 50 | document.body.appendChild(iframe); |
michael@0 | 51 | |
michael@0 | 52 | try { |
michael@0 | 53 | var iframeDoc = iframe.contentWindow.document; |
michael@0 | 54 | ok(true, "Shouldn't have thrown an exception"); |
michael@0 | 55 | } catch (ex) { |
michael@0 | 56 | ok(false, "Got an unexpected exception"); |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | SimpleTest.finish(); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | </script> |
michael@0 | 63 | </pre> |
michael@0 | 64 | <iframe id="ifr" sandbox = "allow-scripts"></iframe> |
michael@0 | 65 | </body> |
michael@0 | 66 | </html> |