dom/base/test/test_openDialogChromeOnly.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/test/test_openDialogChromeOnly.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=931768
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 931768</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +  <script type="application/javascript">
    1.15 +
    1.16 +  /** Test for Bug 931768 **/
    1.17 +
    1.18 +  try {
    1.19 +    openDialog("chrome://browser/content/browser.xul");
    1.20 +    ok(false, "Calling openDialog from unprivileged script should throw.");
    1.21 +  } catch (e) {
    1.22 +    // FIXME e should be a ReferenceError once we switch Window to new WebIDL bindings
    1.23 +    ok(e.name == "SecurityError",
    1.24 +       "openDialog shouldn't be callable to unprivileged script.");
    1.25 +    todo(e instanceof ReferenceError,
    1.26 +         "openDialog shouldn't be available to unprivileged script.");
    1.27 +  }
    1.28 +</script>
    1.29 +</body>
    1.30 +
    1.31 +
    1.32 +  </script>
    1.33 +</head>
    1.34 +<body>
    1.35 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=931768">Mozilla Bug 931768</a>
    1.36 +<p id="display">
    1.37 +</p>
    1.38 +<div id="content" style="display: none">
    1.39 +
    1.40 +</div>
    1.41 +<pre id="test">
    1.42 +</pre>
    1.43 +</body>
    1.44 +</html>

mercurial