зеркало из https://github.com/mozilla/gecko-dev.git
Bug 936604, null check event handler in event listener service, r=bz
This commit is contained in:
Родитель
b90e87e13b
Коммит
9ba15f226b
|
@ -94,7 +94,7 @@ nsEventListenerInfo::GetJSVal(JSContext* aCx,
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIJSEventListener> jsl = do_QueryInterface(mListener);
|
||||
if (jsl) {
|
||||
if (jsl && jsl->GetHandler().HasEventHandler()) {
|
||||
JS::Handle<JSObject*> handler(jsl->GetHandler().Ptr()->Callable());
|
||||
if (handler) {
|
||||
aAc.construct(aCx, handler);
|
||||
|
|
|
@ -60,6 +60,14 @@ function runTests() {
|
|||
is(jsdvalue.jsType, 3, "Event listener should be a function! (1)");
|
||||
*/
|
||||
|
||||
root.removeAttribute("onclick");
|
||||
root.setAttribute("onclick", "...invalid script...");
|
||||
SimpleTest.expectUncaughtException(true);
|
||||
infos = els.getListenerInfoFor(root, {});
|
||||
SimpleTest.expectUncaughtException(false);
|
||||
is(infos.length, 1);
|
||||
is(infos[0].listenerObject, null);
|
||||
|
||||
root.removeAttribute("onclick");
|
||||
infos = els.getListenerInfoFor(root, {});
|
||||
is(infos.length, 0, "Element shouldn't have listeners (2)");
|
||||
|
|
Загрузка…
Ссылка в новой задаче