2008-01-06 14:07:25 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=392338
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 392338</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2008-01-06 14:07:25 -08:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=392338">Mozilla Bug 392338</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 392338 **/
|
|
|
|
function obs () {
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
this.observerService = Components.classes["@mozilla.org/observer-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIObserverService);
|
|
|
|
this.observerService.addObserver(this,"http-on-modify-request", false);
|
|
|
|
this.window = window;
|
|
|
|
}
|
|
|
|
|
|
|
|
obs.prototype = {
|
|
|
|
observe: function obs_observe (theSubject, theTopic, theData)
|
|
|
|
{
|
2008-11-25 17:50:04 -08:00
|
|
|
this.timeToFinish = true;
|
2008-01-06 14:07:25 -08:00
|
|
|
try{
|
|
|
|
this.window.netscape.security
|
|
|
|
.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
var ir = theSubject.QueryInterface(this.window.Components.interfaces
|
|
|
|
.nsIChannel).notificationCallbacks;
|
2008-11-25 17:50:04 -08:00
|
|
|
if (!ir) {
|
|
|
|
this.timeToFinish = false;
|
2008-01-06 14:07:25 -08:00
|
|
|
return;
|
|
|
|
}
|
2008-11-25 17:50:04 -08:00
|
|
|
this.window.ok(true, "No exception thrown");
|
2008-01-06 14:07:25 -08:00
|
|
|
|
|
|
|
this.window.is(ir instanceof
|
|
|
|
this.window.Components.interfaces.nsIInterfaceRequestor,
|
|
|
|
true, "Must be an interface requestor");
|
|
|
|
|
2008-11-25 17:50:04 -08:00
|
|
|
if (ir instanceof this.window.Components.interfaces.nsIClassInfo) {
|
|
|
|
var count = {};
|
|
|
|
var interfaces = ir.
|
|
|
|
QueryInterface(this.window.Components
|
|
|
|
.interfaces.nsIClassInfo).
|
|
|
|
getInterfaces(count).
|
|
|
|
map(function(id) {
|
|
|
|
return this.window.Components
|
|
|
|
.interfacesByID[id].toString();
|
|
|
|
});
|
|
|
|
this.window.isnot(interfaces.indexOf("nsIInterfaceRequestor"), -1,
|
|
|
|
"Must have interface requestor classinfo");
|
|
|
|
}
|
2008-01-06 14:07:25 -08:00
|
|
|
} catch(ex) {
|
|
|
|
this.window.is(true, false, "Exception thrown " + ex);
|
|
|
|
} finally {
|
2008-11-25 17:50:04 -08:00
|
|
|
if (this.timeToFinish) {
|
|
|
|
this.remove();
|
|
|
|
this.window.SimpleTest.finish();
|
|
|
|
this.window = null;
|
|
|
|
}
|
2008-01-06 14:07:25 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
remove: function obs_remove()
|
|
|
|
{
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
this.observerService.removeObserver(this,"http-on-modify-request");
|
|
|
|
this.observerService = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var o;
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
addLoadEvent(function() {
|
|
|
|
var doc = document.implementation.createDocument("", "", null);
|
|
|
|
o = new obs();
|
|
|
|
doc.load(window.location.href);
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|