|
|
|
|
| 17 |
#include "mozilla/JSEventHandler.h" |
17 |
#include "mozilla/JSEventHandler.h" |
| 18 |
#include "mozilla/Maybe.h" |
18 |
#include "mozilla/Maybe.h" |
| 19 |
#include "mozilla/MemoryReporting.h" |
19 |
#include "mozilla/MemoryReporting.h" |
| 20 |
#include "mozilla/Preferences.h" |
20 |
#include "mozilla/Preferences.h" |
| 21 |
#include "mozilla/dom/BindingUtils.h" |
21 |
#include "mozilla/dom/BindingUtils.h" |
| 22 |
#include "mozilla/dom/Element.h" |
22 |
#include "mozilla/dom/Element.h" |
| 23 |
#include "mozilla/dom/Event.h" |
23 |
#include "mozilla/dom/Event.h" |
| 24 |
#include "mozilla/dom/EventTargetBinding.h" |
24 |
#include "mozilla/dom/EventTargetBinding.h" |
|
|
25 |
#include "mozilla/dom/LoadedScript.h" |
| 25 |
#include "mozilla/dom/PopupBlocker.h" |
26 |
#include "mozilla/dom/PopupBlocker.h" |
|
|
27 |
#include "mozilla/dom/ScriptLoader.h" |
| 26 |
#include "mozilla/dom/ScriptSettings.h" |
28 |
#include "mozilla/dom/ScriptSettings.h" |
| 27 |
#include "mozilla/dom/TouchEvent.h" |
29 |
#include "mozilla/dom/TouchEvent.h" |
| 28 |
#include "mozilla/TimelineConsumers.h" |
30 |
#include "mozilla/TimelineConsumers.h" |
| 29 |
#include "mozilla/EventTimelineMarker.h" |
31 |
#include "mozilla/EventTimelineMarker.h" |
| 30 |
#include "mozilla/TimeStamp.h" |
32 |
#include "mozilla/TimeStamp.h" |
| 31 |
|
33 |
|
| 32 |
#include "EventListenerService.h" |
34 |
#include "EventListenerService.h" |
| 33 |
#include "nsCOMArray.h" |
35 |
#include "nsCOMArray.h" |
|
Lines 985-1000
nsresult EventListenerManager::CompileEv
|
Link Here
|
|---|
|
| 985 |
|
987 |
|
| 986 |
JS::Rooted<JSObject*> handler(cx); |
988 |
JS::Rooted<JSObject*> handler(cx); |
| 987 |
result = nsJSUtils::CompileFunction(jsapi, scopeChain, options, |
989 |
result = nsJSUtils::CompileFunction(jsapi, scopeChain, options, |
| 988 |
nsAtomCString(typeAtom), argCount, |
990 |
nsAtomCString(typeAtom), argCount, |
| 989 |
argNames, *body, handler.address()); |
991 |
argNames, *body, handler.address()); |
| 990 |
NS_ENSURE_SUCCESS(result, result); |
992 |
NS_ENSURE_SUCCESS(result, result); |
| 991 |
NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE); |
993 |
NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE); |
| 992 |
|
994 |
|
|
|
995 |
JS::Rooted<JSFunction*> func(cx, JS_GetObjectFunction(handler)); |
| 996 |
MOZ_ASSERT(func); |
| 997 |
JS::Rooted<JSScript*> jsScript(cx, JS_GetFunctionScript(cx, func)); |
| 998 |
MOZ_ASSERT(jsScript); |
| 999 |
RefPtr<LoadedScript> loaderScript = ScriptLoader::GetActiveScript(cx); |
| 1000 |
if (loaderScript) { |
| 1001 |
loaderScript->AssociateWithScript(jsScript); |
| 1002 |
} |
| 1003 |
|
| 993 |
MOZ_ASSERT(js::IsObjectInContextCompartment(handler, cx)); |
1004 |
MOZ_ASSERT(js::IsObjectInContextCompartment(handler, cx)); |
| 994 |
JS::Rooted<JSObject*> handlerGlobal(cx, JS::CurrentGlobalOrNull(cx)); |
1005 |
JS::Rooted<JSObject*> handlerGlobal(cx, JS::CurrentGlobalOrNull(cx)); |
| 995 |
|
1006 |
|
| 996 |
if (jsEventHandler->EventName() == nsGkAtoms::onerror && win) { |
1007 |
if (jsEventHandler->EventName() == nsGkAtoms::onerror && win) { |
| 997 |
RefPtr<OnErrorEventHandlerNonNull> handlerCallback = |
1008 |
RefPtr<OnErrorEventHandlerNonNull> handlerCallback = |
| 998 |
new OnErrorEventHandlerNonNull(static_cast<JSContext*>(nullptr), |
1009 |
new OnErrorEventHandlerNonNull(static_cast<JSContext*>(nullptr), |
| 999 |
handler, handlerGlobal, |
1010 |
handler, handlerGlobal, |
| 1000 |
/* aIncumbentGlobal = */ nullptr); |
1011 |
/* aIncumbentGlobal = */ nullptr); |