Implement an ErrorEvent constructor for V8
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2011 09:27:55 +0000 (09:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2011 09:27:55 +0000 (09:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68336

Patch by Kentaro Hara <haraken@chromium.org> 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
LayoutTests/platform/chromium/test_expectations.txt
Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/OptionsObject.cpp
Source/WebCore/bindings/v8/OptionsObject.h
Source/WebCore/bindings/v8/custom/V8EventConstructors.cpp
Source/WebCore/dom/ErrorEvent.idl

index 359c9c2..64bbeb7 100644 (file)
@@ -1,3 +1,15 @@
+2011-09-28  Kentaro Hara  <haraken@chromium.org>
+
+        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  <rgabor@webkit.org>
 
         [Qt][GTK] Skip http/tests/multipart/stop-crash.html because it fails after r96174.
index acbe74c..908483b 100644 (file)
@@ -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
index 3c38388..2d4c7c7 100644 (file)
@@ -1,3 +1,18 @@
+2011-09-28  Kentaro Hara  <haraken@chromium.org>
+
+        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  <aestes@apple.com>
 
         WebKitLinkedOnOrAfter() check is ineffective for Solar Walk app-specific hack.
index 4338752..cc86cda 100644 (file)
@@ -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<v8::Value> v8Value;
+    if (!getKey(key, v8Value))
+        return false;
+
+    v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32();
+    if (v8Int32.IsEmpty())
+        return false;
+    value = static_cast<unsigned>(v8Int32->Value());
+    return true;
+}
+
 bool OptionsObject::getKeyValue(const String& key, unsigned long long& value) const
 {
     v8::Local<v8::Value> v8Value;
index e874535..63b4788 100644 (file)
@@ -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<v8::Value>&) const;
index 99f7a5a..02cd766 100644 (file)
@@ -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
index 384decd..24ae602 100644 (file)
@@ -33,7 +33,8 @@ module events {
     interface [
         NoStaticTables,
         CanBeConstructed,
-        CustomConstructFunction
+        CustomConstructFunction,
+        V8CustomConstructor
     ] ErrorEvent : Event {
 
         readonly attribute DOMString message;