tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug1065185.html (2065B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1065185
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 1065185</title>
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
     11  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
     12  <script type="application/javascript">
     13 
     14  /** Test for Bug 1065185 */
     15  SimpleTest.waitForExplicitFinish();
     16 
     17  function doMonitor(rgxps) {
     18    var messages = rgxps.map((x) => ({ errorMessage: x, isWarning: true }));
     19    info("Expecting console messages: " + messages.toSource());
     20    SimpleTest.monitorConsole(() => SimpleTest.executeSoon(() => window[0].location.reload()), messages, /* forbidUnexpected = */ true);
     21  }
     22  function endMonitor() {
     23    SimpleTest.executeSoon(SimpleTest.endMonitorConsole.bind(SimpleTest));
     24  }
     25 
     26  var gLoadCount = 0;
     27  function loaded() {
     28    switch(gLoadCount++) {
     29      case 0:
     30        doMonitor([/access to property "a"/i]);
     31        window[0].wrappedJSObject.probe = { a: 2 };
     32        is(window[0].eval('probe.a'), undefined, "Accessed exposed prop");
     33        endMonitor();
     34        break;
     35      case 1:
     36        doMonitor([/access to property "a"/i]);
     37        window[0].wrappedJSObject.probe = { a: 2 };
     38        is(window[0].eval('probe.a'), undefined, "Non-exposed prop undefined");
     39        is(window[0].eval('probe.a'), undefined, "Non-exposed prop undefined again");
     40        endMonitor();
     41        break;
     42      case 2:
     43        SimpleTest.finish();
     44        break;
     45      default:
     46        ok(false, "Unexpected load");
     47        SimpleTest.finish();
     48        break;
     49    }
     50  }
     51 
     52  </script>
     53 </head>
     54 <body>
     55 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1065185">Mozilla Bug 1065185</a>
     56 <p id="display"></p>
     57 <div id="content" style="display: none">
     58 
     59 </div>
     60 <pre id="test">
     61 </pre>
     62 <iframe onload="loaded();" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" />
     63 </body>
     64 </html>