mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 883096 - Crash at nsEventListenerManager::GetListenerInfo, r=jst
--HG-- extra : rebase_source : 2073283f4b23586fac0a3ae4243a50b745912a20
This commit is contained in:
parent
2c2d131dc7
commit
5310ede209
@ -16,6 +16,7 @@ interface nsIEventListenerInfo : nsISupports
|
||||
{
|
||||
/**
|
||||
* The type of the event for which the listener was added.
|
||||
* Null if the listener is for all the events.
|
||||
*/
|
||||
readonly attribute AString type;
|
||||
readonly attribute boolean capturing;
|
||||
|
@ -1167,8 +1167,12 @@ nsEventListenerManager::GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList)
|
||||
CompileEventHandlerInternal(const_cast<nsListenerStruct*>(&ls),
|
||||
true, nullptr);
|
||||
}
|
||||
const nsDependentSubstring& eventType =
|
||||
Substring(nsDependentAtomString(ls.mTypeAtom), 2);
|
||||
nsAutoString eventType;
|
||||
if (ls.mAllEvents) {
|
||||
eventType.SetIsVoid(true);
|
||||
} else {
|
||||
eventType.Assign(Substring(nsDependentAtomString(ls.mTypeAtom), 2));
|
||||
}
|
||||
// EventListenerInfo is defined in XPCOM, so we have to go ahead
|
||||
// and convert to an XPCOM callback here...
|
||||
nsRefPtr<nsEventListenerInfo> info =
|
||||
|
@ -184,6 +184,15 @@ function testAllListener() {
|
||||
}
|
||||
|
||||
els.addListenerForAllEvents(root, allListener, false, true);
|
||||
var infos = els.getListenerInfoFor(root);
|
||||
var nullTypes = 0;
|
||||
for (var i = 0; i < infos.length; ++i) {
|
||||
if (infos[i].type == null) {
|
||||
++nullTypes;
|
||||
}
|
||||
}
|
||||
is(nullTypes, 1, "Should have one all-event-listener!");
|
||||
|
||||
els.addListenerForAllEvents(root, allListener, false, true, true);
|
||||
els.addListenerForAllEvents(root, allListenerTrustedOnly, false, false, true);
|
||||
l3.dispatchEvent(new Event("testevent", { bubbles: true }));
|
||||
|
Loading…
Reference in New Issue
Block a user