Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
michael@0 | 4 | type="text/css"?> |
michael@0 | 5 | <!-- |
michael@0 | 6 | https://bugzilla.mozilla.org/show_bug.cgi?id=895340 |
michael@0 | 7 | --> |
michael@0 | 8 | <window title="Mozilla Bug 895340" |
michael@0 | 9 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 10 | <script type="application/javascript" |
michael@0 | 11 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 12 | |
michael@0 | 13 | <!-- test results are displayed in the html:body --> |
michael@0 | 14 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 15 | <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=895340 " |
michael@0 | 16 | target="_blank">Mozilla Bug 895340 </a> |
michael@0 | 17 | </body> |
michael@0 | 18 | |
michael@0 | 19 | <!-- test code goes here --> |
michael@0 | 20 | <script type="application/javascript"><![CDATA[ |
michael@0 | 21 | |
michael@0 | 22 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 23 | |
michael@0 | 24 | const Cu = Components.utils; |
michael@0 | 25 | Cu.import("resource://gre/modules/Services.jsm", this); |
michael@0 | 26 | |
michael@0 | 27 | var finished = false; |
michael@0 | 28 | |
michael@0 | 29 | var console = Components.classes["@mozilla.org/consoleservice;1"] |
michael@0 | 30 | .getService(Components.interfaces.nsIConsoleService); |
michael@0 | 31 | |
michael@0 | 32 | let listener = { |
michael@0 | 33 | QueryInterface: function(iid) { |
michael@0 | 34 | if (!iid.equals(Components.interfaces.nsIConsoleListener) && |
michael@0 | 35 | !iid.equals(Components.interfaces.nsISupports)) |
michael@0 | 36 | { |
michael@0 | 37 | throw Components.results.NS_ERROR_NO_INTERFACE; |
michael@0 | 38 | } |
michael@0 | 39 | return this; |
michael@0 | 40 | } |
michael@0 | 41 | }; |
michael@0 | 42 | |
michael@0 | 43 | listener.observe = function(aMessage) { |
michael@0 | 44 | if (aMessage.message.indexOf("Will you report me?") != -1 && !finished) { |
michael@0 | 45 | finished = true; |
michael@0 | 46 | ok(true, "exception reported"); |
michael@0 | 47 | console.unregisterListener(listener); |
michael@0 | 48 | SimpleTest.finish(); |
michael@0 | 49 | } |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | console.registerListener(listener); |
michael@0 | 53 | |
michael@0 | 54 | /* Throw an exception and verify that it gets reported. */ |
michael@0 | 55 | let foo_obs = function() { |
michael@0 | 56 | throw new Error("Will you report me?"); |
michael@0 | 57 | }; |
michael@0 | 58 | |
michael@0 | 59 | Services.obs.addObserver(foo_obs, "foo", false); |
michael@0 | 60 | Services.obs.notifyObservers(null, "foo", "foo"); |
michael@0 | 61 | Services.obs.removeObserver(foo_obs, "foo"); |
michael@0 | 62 | ]]></script> |
michael@0 | 63 | </window> |