зеркало из https://github.com/mozilla/gecko-dev.git
Bug 979497, make sure to use the right event type atom throughout CompileEventHandlerInternal, r=jst
This commit is contained in:
Родитель
9a5c438d5b
Коммит
4857e64040
|
@ -809,7 +809,8 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
|
||||||
|
|
||||||
JS::Rooted<JSObject*> scope(cx, listener->GetEventScope());
|
JS::Rooted<JSObject*> scope(cx, listener->GetEventScope());
|
||||||
|
|
||||||
nsIAtom* attrName = aListenerStruct->mTypeAtom;
|
nsCOMPtr<nsIAtom> typeAtom = aListenerStruct->mTypeAtom;
|
||||||
|
nsIAtom* attrName = typeAtom;
|
||||||
|
|
||||||
if (aListenerStruct->mHandlerIsString) {
|
if (aListenerStruct->mHandlerIsString) {
|
||||||
// OK, we didn't find an existing compiled event handler. Flag us
|
// OK, we didn't find an existing compiled event handler. Flag us
|
||||||
|
@ -850,6 +851,7 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
|
||||||
body = &handlerBody;
|
body = &handlerBody;
|
||||||
aElement = element;
|
aElement = element;
|
||||||
}
|
}
|
||||||
|
aListenerStruct = nullptr;
|
||||||
|
|
||||||
uint32_t lineNo = 0;
|
uint32_t lineNo = 0;
|
||||||
nsAutoCString url (NS_LITERAL_CSTRING("-moz-evil:lying-event-listener"));
|
nsAutoCString url (NS_LITERAL_CSTRING("-moz-evil:lying-event-listener"));
|
||||||
|
@ -864,7 +866,7 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
|
||||||
uint32_t argCount;
|
uint32_t argCount;
|
||||||
const char **argNames;
|
const char **argNames;
|
||||||
nsContentUtils::GetEventArgNames(aElement->GetNameSpaceID(),
|
nsContentUtils::GetEventArgNames(aElement->GetNameSpaceID(),
|
||||||
aListenerStruct->mTypeAtom,
|
typeAtom,
|
||||||
&argCount, &argNames);
|
&argCount, &argNames);
|
||||||
|
|
||||||
JSAutoCompartment ac(cx, context->GetWindowProxy());
|
JSAutoCompartment ac(cx, context->GetWindowProxy());
|
||||||
|
@ -894,11 +896,13 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
|
||||||
|
|
||||||
JS::Rooted<JSObject*> handlerFun(cx);
|
JS::Rooted<JSObject*> handlerFun(cx);
|
||||||
result = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options,
|
result = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options,
|
||||||
nsAtomCString(aListenerStruct->mTypeAtom),
|
nsAtomCString(typeAtom),
|
||||||
argCount, argNames, *body, handlerFun.address());
|
argCount, argNames, *body, handlerFun.address());
|
||||||
NS_ENSURE_SUCCESS(result, result);
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
handler = handlerFun;
|
handler = handlerFun;
|
||||||
NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE);
|
||||||
|
} else {
|
||||||
|
aListenerStruct = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler) {
|
if (handler) {
|
||||||
|
@ -906,7 +910,6 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
|
||||||
// Bind it
|
// Bind it
|
||||||
JS::Rooted<JSObject*> boundHandler(cx);
|
JS::Rooted<JSObject*> boundHandler(cx);
|
||||||
context->BindCompiledEventHandler(mTarget, scope, handler, &boundHandler);
|
context->BindCompiledEventHandler(mTarget, scope, handler, &boundHandler);
|
||||||
aListenerStruct = nullptr;
|
|
||||||
// Note - We pass null for aIncumbentGlobal below. We could also pass the
|
// Note - We pass null for aIncumbentGlobal below. We could also pass the
|
||||||
// compilation global, but since the handler is guaranteed to be scripted,
|
// compilation global, but since the handler is guaranteed to be scripted,
|
||||||
// there's no need to use an override, since the JS engine will always give
|
// there's no need to use an override, since the JS engine will always give
|
||||||
|
|
Загрузка…
Ссылка в новой задаче