From 0f5045f0cd5b65b1ebbeff9dc029caa63f788d39 Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Wed, 28 Sep 2011 09:27:55 +0000 Subject: [PATCH] Implement an ErrorEvent constructor for V8 https://bugs.webkit.org/show_bug.cgi?id=68336 Patch by Kentaro Hara on 2011-09-28 Reviewed by Adam Barth. Source/WebCore: Test: fast/events/constructors/error-event-constructor.html * bindings/v8/OptionsObject.cpp: (WebCore::OptionsObject::getKeyValue): Returns an unsigned value corresponding to a given key. * bindings/v8/OptionsObject.h: * bindings/v8/custom/V8EventConstructors.cpp: Added the ErrorEvent constructor. * dom/ErrorEvent.idl: Added a 'V8CustomConstructor' attribute. LayoutTests: Enabled fast/events/constructors/error-event-constructor.html, since V8 now has the constructor for ErrorEvent. * platform/chromium/test_expectations.txt: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96208 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 12 ++++++++++++ LayoutTests/platform/chromium/test_expectations.txt | 3 --- Source/WebCore/ChangeLog | 15 +++++++++++++++ Source/WebCore/bindings/v8/OptionsObject.cpp | 13 +++++++++++++ Source/WebCore/bindings/v8/OptionsObject.h | 5 +++-- Source/WebCore/bindings/v8/custom/V8EventConstructors.cpp | 3 +++ Source/WebCore/dom/ErrorEvent.idl | 3 ++- 7 files changed, 48 insertions(+), 6 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 359c9c2..64bbeb7 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,15 @@ +2011-09-28 Kentaro Hara + + Implement an ErrorEvent constructor for V8 + https://bugs.webkit.org/show_bug.cgi?id=68336 + + Reviewed by Adam Barth. + + Enabled fast/events/constructors/error-event-constructor.html, + since V8 now has the constructor for ErrorEvent. + + * platform/chromium/test_expectations.txt: + 2011-09-28 Gabor Rapcsanyi [Qt][GTK] Skip http/tests/multipart/stop-crash.html because it fails after r96174. diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt index acbe74c..908483b 100644 --- a/LayoutTests/platform/chromium/test_expectations.txt +++ b/LayoutTests/platform/chromium/test_expectations.txt @@ -62,9 +62,6 @@ BUGCR24189 SKIP : fast/dom/open-and-close-by-DOM.html = FAIL // Implement java testing harness. BUGCR36681 SKIP : java = TEXT -// This will soon be fixed after implementing an ErrorEvent constructor for V8. -BUGWK68148 : fast/events/constructors/error-event-constructor.html = FAIL - // Quota API is not supported in DRT yet. BUGCR84572 SKIP : storage/storageinfo-query-usage.html = FAIL BUGCR84572 SKIP : storage/storageinfo-request-quota.html = FAIL diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 3c38388..2d4c7c7 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,18 @@ +2011-09-28 Kentaro Hara + + Implement an ErrorEvent constructor for V8 + https://bugs.webkit.org/show_bug.cgi?id=68336 + + Reviewed by Adam Barth. + + Test: fast/events/constructors/error-event-constructor.html + + * bindings/v8/OptionsObject.cpp: + (WebCore::OptionsObject::getKeyValue): Returns an unsigned value corresponding to a given key. + * bindings/v8/OptionsObject.h: + * bindings/v8/custom/V8EventConstructors.cpp: Added the ErrorEvent constructor. + * dom/ErrorEvent.idl: Added a 'V8CustomConstructor' attribute. + 2011-09-27 Andy Estes WebKitLinkedOnOrAfter() check is ineffective for Solar Walk app-specific hack. diff --git a/Source/WebCore/bindings/v8/OptionsObject.cpp b/Source/WebCore/bindings/v8/OptionsObject.cpp index 4338752..cc86cda 100644 --- a/Source/WebCore/bindings/v8/OptionsObject.cpp +++ b/Source/WebCore/bindings/v8/OptionsObject.cpp @@ -193,6 +193,19 @@ bool OptionsObject::getKeyValue(const String& key, unsigned short& value) const return true; } +bool OptionsObject::getKeyValue(const String& key, unsigned& value) const +{ + v8::Local v8Value; + if (!getKey(key, v8Value)) + return false; + + v8::Local v8Int32 = v8Value->ToInt32(); + if (v8Int32.IsEmpty()) + return false; + value = static_cast(v8Int32->Value()); + return true; +} + bool OptionsObject::getKeyValue(const String& key, unsigned long long& value) const { v8::Local v8Value; diff --git a/Source/WebCore/bindings/v8/OptionsObject.h b/Source/WebCore/bindings/v8/OptionsObject.h index e874535..63b4788 100644 --- a/Source/WebCore/bindings/v8/OptionsObject.h +++ b/Source/WebCore/bindings/v8/OptionsObject.h @@ -77,8 +77,9 @@ public: value = ScriptValue(v8Value); return true; } - bool getKeyValue(const String& key, unsigned short& value) const; - bool getKeyValue(const String& key, unsigned long long& value) const; + bool getKeyValue(const String&, unsigned short&) const; + bool getKeyValue(const String&, unsigned&) const; + bool getKeyValue(const String&, unsigned long long&) const; private: bool getKey(const String& key, v8::Local&) const; diff --git a/Source/WebCore/bindings/v8/custom/V8EventConstructors.cpp b/Source/WebCore/bindings/v8/custom/V8EventConstructors.cpp index 99f7a5a..02cd766 100644 --- a/Source/WebCore/bindings/v8/custom/V8EventConstructors.cpp +++ b/Source/WebCore/bindings/v8/custom/V8EventConstructors.cpp @@ -35,6 +35,7 @@ #include "CustomEvent.h" #include "Document.h" #include "DocumentFragment.h" +#include "ErrorEvent.h" #include "HashChangeEvent.h" #include "Node.h" #include "PageTransitionEvent.h" @@ -47,6 +48,7 @@ #include "V8CloseEvent.h" #include "V8CustomEvent.h" #include "V8Document.h" +#include "V8ErrorEvent.h" #include "V8Event.h" #include "V8HashChangeEvent.h" #include "V8Node.h" @@ -114,6 +116,7 @@ INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_WEBKIT_ANIMATION_EVENT(DICTIONARY_START INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_HASH_CHANGE_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_CLOSE_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_PAGE_TRANSITION_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) +INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_ERROR_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) } // namespace WebCore diff --git a/Source/WebCore/dom/ErrorEvent.idl b/Source/WebCore/dom/ErrorEvent.idl index 384decd..24ae602 100644 --- a/Source/WebCore/dom/ErrorEvent.idl +++ b/Source/WebCore/dom/ErrorEvent.idl @@ -33,7 +33,8 @@ module events { interface [ NoStaticTables, CanBeConstructed, - CustomConstructFunction + CustomConstructFunction, + V8CustomConstructor ] ErrorEvent : Event { readonly attribute DOMString message; -- 2.7.4