Follow-on fix for bug 457825. Use sheet principal for agent and user sheets. r=dbaron...
[wine-gecko.git] / caps / tests / mochitest / test_bug423375.html
blob11b67d3da0befc46417b4af86a90185108564515
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=423375
5 -->
6 <head>
7 <title>Test for Bug 423375</title>
8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=423375">Mozilla Bug 423375</a>
14 <p id="display"></p>
15 <div id="content" style="display: none">
16 <iframe id="load-frame"></iframe>
17 </div>
18 <pre id="test">
19 <script class="testbody" type="text/javascript">
21 /**
22 ** Test for Bug 423375
23 ** (content shouldn't be able to load chrome: or resource:)
24 **/
25 function tryLoad(url)
27 try {
28 window.frames[0].location = url;
29 return "loaded";
30 } catch (e if /Access.*denied/.test(String(e))) {
31 return "denied";
32 } catch (e) {
33 return "unexpected: " + e;
37 is(tryLoad("chrome://global/content/mozilla.xhtml"), "denied",
38 "content should have been prevented from loading chrome: URL");
39 is(tryLoad("resource://gre/res/html.css"), "denied",
40 "content should have been prevented from loading resource: URL");
41 </script>
42 </pre>
43 </body>
44 </html>