Fix bug 392338. r=mrbkap, sr=jst, a=schrep

This commit is contained in:
bzbarsky@mit.edu 2008-01-06 14:07:25 -08:00
Родитель 81f1689c47
Коммит c4e353cd56
3 изменённых файлов: 89 добавлений и 0 удалений

Просмотреть файл

@ -47,6 +47,7 @@ include $(topsrcdir)/config/rules.mk
_TEST_FILES = test_bug232004.xhtml \
test_bug343870.xhtml \
test_bug355213.xhtml \
test_bug392338.html \
test_bug399502.xhtml \
$(NULL)

Просмотреть файл

@ -0,0 +1,87 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=392338
-->
<head>
<title>Test for Bug 392338</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<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)
{
try{
this.window.netscape.security
.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var ir = theSubject.QueryInterface(this.window.Components.interfaces
.nsIChannel).notificationCallbacks;
if (!(ir instanceof this.window.Components.interfaces.nsIDOMDocument)) {
return;
}
this.window.is(ir instanceof
this.window.Components.interfaces.nsIInterfaceRequestor,
true, "Must be an interface requestor");
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");
} catch(ex) {
this.window.is(true, false, "Exception thrown " + ex);
} finally {
this.remove();
this.window.SimpleTest.finish();
this.window = null;
}
},
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>

Просмотреть файл

@ -1951,6 +1951,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(XMLDocument, nsIDOMXMLDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXMLDocument)
DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor)
DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END