Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: Source/bindings/v8/custom/V8DocumentCustom.cpp

Issue 297103002: Move modules-dependent Event code out of core. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review comments. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/build/scripts/templates/EventFactory.cpp.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8DocumentCustom.cpp
diff --git a/Source/bindings/v8/custom/V8DocumentCustom.cpp b/Source/bindings/v8/custom/V8DocumentCustom.cpp
index 425d5902913ae2ee48524b690fa8526a39038b60..2265abd77a2b095c895325ff7b2853a15862b9f6 100644
--- a/Source/bindings/v8/custom/V8DocumentCustom.cpp
+++ b/Source/bindings/v8/custom/V8DocumentCustom.cpp
@@ -33,6 +33,7 @@
#include "V8CanvasRenderingContext2D.h"
#include "V8DOMImplementation.h"
+#include "V8Event.h"
#include "V8Node.h"
#include "V8Touch.h"
#include "V8TouchList.h"
@@ -54,6 +55,7 @@
#include "core/xml/DocumentXPathEvaluator.h"
#include "core/xml/XPathNSResolver.h"
#include "core/xml/XPathResult.h"
+#include "modules/InitModules.h"
#include "wtf/RefPtr.h"
namespace WebCore {
@@ -83,4 +85,26 @@ void V8Document::evaluateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
v8SetReturnValueFast(info, result.release(), document.get());
}
+// Customize createEvent so it can call createEventModules in modules.
+// FIXME: Use method registration approach instead. http://crbug.com/358074
+void V8Document::createEventMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "createEvent", "Document", info.Holder(), info.GetIsolate());
+ if (UNLIKELY(info.Length() < 1)) {
+ throwMinimumArityTypeError(exceptionState, 1, info.Length());
+ return;
+ }
+ Document* impl = V8Document::toNative(info.Holder());
+ V8StringResource<> eventType;
+ {
+ TOSTRING_VOID_INTERNAL_NOTRYCATCH(eventType, info[0]);
+ }
+ RefPtrWillBeRawPtr<Event> result = createEventModules(eventType, exceptionState);
+ if (exceptionState.hadException()) {
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
+}
+
} // namespace WebCore
« no previous file with comments | « no previous file | Source/build/scripts/templates/EventFactory.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698