test_bug1065185.html 2.0 KB

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