Bug 895805 - Ensure nsBindingManager hashtable is initialized before use. r=mrbkap

This commit is contained in:
William Chen 2013-07-25 22:58:39 -07:00
parent 7e76ab4eb6
commit 0d79ba91bc
3 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xbl="http://www.mozilla.org/xbl">
<head>
<title>Bug 895805 - Adopting bound element to another document.</title>
<xbl:bindings>
<xbl:binding id="crash">
<xbl:content>
<xbl:children />
Bug 895805 dummy binding
</xbl:content>
</xbl:binding>
</xbl:bindings>
<style type="text/css">
#test {
-moz-binding:url(#crash);
}
</style>
</head>
<body onload="init()">
<span id="test">Test</span>
<script>
function init() {
var boundElement = document.getElementById('test');
var otherDoc = document.implementation.createDocument('', '', null);
otherDoc.adoptNode(boundElement);
}
</script>
</body>
</html>

View File

@ -37,3 +37,4 @@ load 507628-1.xhtml
load 507991-1.xhtml
load set-field-bad-this.xhtml
load 830614-1.xul
load 895805-1.xhtml

View File

@ -1114,7 +1114,7 @@ nsBindingManager::Traverse(nsIContent *aContent,
return;
}
if (mBoundContentSet.Contains(aContent)) {
if (mBoundContentSet.IsInitialized() && mBoundContentSet.Contains(aContent)) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "[via binding manager] mBoundContentSet entry");
cb.NoteXPCOMChild(aContent);
}