mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 391568, Mutation events not fired if listeners are only in anonymous content. r+sr=bz, a=sicking
This commit is contained in:
parent
93f893c4c4
commit
fb735cb14f
@ -3034,6 +3034,16 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
|
||||
nsIContent* content = static_cast<nsIContent*>(aNode);
|
||||
nsIContent* insertionParent =
|
||||
doc->BindingManager()->GetInsertionParent(content);
|
||||
if (insertionParent) {
|
||||
aNode = insertionParent;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
aNode = aNode->GetNodeParent();
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ _TEST_FILES = \
|
||||
test_bug336682.js \
|
||||
test_bug367781.html \
|
||||
test_bug379120.html \
|
||||
test_bug391568.xhtml \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
77
content/events/test/test_bug391568.xhtml
Normal file
77
content/events/test/test_bug391568.xhtml
Normal file
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=391568
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 391568</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script>
|
||||
var constructorFired = 0;
|
||||
</script>
|
||||
<xbl:bindings>
|
||||
<xbl:binding id="test">
|
||||
<xbl:content><span>
|
||||
(anonumous content)
|
||||
<span><xbl:children/></span>
|
||||
(anonumous content)</span>
|
||||
</xbl:content>
|
||||
|
||||
<xbl:implementation>
|
||||
<xbl:constructor>
|
||||
++window.constructorFired;
|
||||
document.getAnonymousNodes(this)[0].addEventListener(
|
||||
"DOMCharacterDataModified",
|
||||
function(evt) {
|
||||
++window.characterdatamodified;
|
||||
},
|
||||
true);
|
||||
</xbl:constructor>
|
||||
</xbl:implementation>
|
||||
</xbl:binding>
|
||||
</xbl:bindings>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=391568">Mozilla Bug 391568</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<span style="-moz-binding: url(#test);"><span id="real1">(real content)</span></span>
|
||||
<span style="-moz-binding: url(#test);"><span id="real2">(real content)</span></span>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 391568 **/
|
||||
|
||||
var characterdatamodified = 0;
|
||||
|
||||
document.getElementById('real1').addEventListener(
|
||||
"DOMCharacterDataModified",
|
||||
function(evt) {},
|
||||
true);
|
||||
|
||||
function testListeners() {
|
||||
if (constructorFired < 2) {
|
||||
setTimeout(testListeners, 0);
|
||||
return;
|
||||
}
|
||||
document.getElementById('real1').firstChild.data = "(real content 2)";
|
||||
ok(characterdatamodified == 1,
|
||||
"There is a DOMCharacterDataModified listener in anonymous content which didn't get called (1)!");
|
||||
document.getElementById('real2').firstChild.data = "(real content 2)";
|
||||
ok(characterdatamodified == 2,
|
||||
"There is a DOMCharacterDataModified listener in anonymous content which didn't get called (2)!");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(testListeners);
|
||||
]]>
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -263,14 +263,16 @@ AddObjectEntry(PLDHashTable& table, nsISupports* aKey, nsISupports* aValue)
|
||||
// helper routine for looking up an existing entry. Note that the
|
||||
// return result is NOT addreffed
|
||||
static nsISupports*
|
||||
LookupObject(PLDHashTable& table, nsISupports* aKey)
|
||||
LookupObject(PLDHashTable& table, nsIContent* aKey)
|
||||
{
|
||||
ObjectEntry *entry =
|
||||
static_cast<ObjectEntry*>
|
||||
(PL_DHashTableOperate(&table, aKey, PL_DHASH_LOOKUP));
|
||||
if (aKey && aKey->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
|
||||
ObjectEntry *entry =
|
||||
static_cast<ObjectEntry*>
|
||||
(PL_DHashTableOperate(&table, aKey, PL_DHASH_LOOKUP));
|
||||
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry))
|
||||
return entry->GetValue();
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry))
|
||||
return entry->GetValue();
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user