gecko/js/xpconnect/tests/chrome/test_ccbeginfail.xul

68 lines
2.0 KiB
XML

<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=710761
-->
<window title="Mozilla Bug 710761"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=710761"
target="_blank">Mozilla Bug 710761</a>
</body>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
/** Test for Bug 710761 **/
let noCallbacks = true;
var beginFailListener = {
QueryInterface: function QueryInterface(aIID) {
if (aIID.equals(Components.interfaces.nsICycleCollectorListener) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
/* nsICycleCollectorListener */
begin: function () {
throw Components.results.NS_ERROR_FAILURE;
},
noteRefCountedObject: function (addr, rc, descr) {
noCallbacks = false;
},
noteGCedObject: function (addr, marked, descr) {
noCallbacks = false;
},
noteEdge: function (addr, descr) {
noCallbacks = false;
},
beginResults: function () {
noCallbacks = false;
},
describeRoot: function (addr, known) {
noCallbacks = false;
},
describeGarbage: function (addr) {
noCallbacks = false;
},
end: function () {
noCallbacks = false;
},
};
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.cycleCollect(beginFailListener);
ok(noCallbacks, "If cycle collector listener begin fails, no further callbacks should be called.");
]]>
</script>
</window>