2009-07-21 Jian Li <jianli@chromium.org>
authorjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Jul 2009 17:34:52 +0000 (17:34 +0000)
committerjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Jul 2009 17:34:52 +0000 (17:34 +0000)
        Reviewed by Eric Seidel.

        Implement ErrorEvent API.
        https://bugs.webkit.org/show_bug.cgi?id=27387

        * DerivedSources.cpp:
        * DerivedSources.make:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * WebCoreSources.bkl:
        * bindings/js/JSEventCustom.cpp:
        (WebCore::toJS):
        * dom/ErrorEvent.cpp: Added.
        * dom/ErrorEvent.h: Added.
        * dom/ErrorEvent.idl: Added.
        * dom/Event.cpp:
        (WebCore::Event::isErrorEvent):
        * dom/Event.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@46179 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
WebCore/ChangeLog
WebCore/DerivedSources.cpp
WebCore/DerivedSources.make
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/WebCoreSources.bkl
WebCore/bindings/js/JSEventCustom.cpp
WebCore/dom/ErrorEvent.cpp [new file with mode: 0644]
WebCore/dom/ErrorEvent.h [new file with mode: 0644]
WebCore/dom/ErrorEvent.idl [new file with mode: 0644]
WebCore/dom/Event.cpp
WebCore/dom/Event.h

index 54cd06e..d7e69b0 100644 (file)
@@ -1,3 +1,27 @@
+2009-07-21  Jian Li  <jianli@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Implement ErrorEvent API.
+        https://bugs.webkit.org/show_bug.cgi?id=27387
+
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * WebCoreSources.bkl:
+        * bindings/js/JSEventCustom.cpp:
+        (WebCore::toJS):
+        * dom/ErrorEvent.cpp: Added.
+        * dom/ErrorEvent.h: Added.
+        * dom/ErrorEvent.idl: Added.
+        * dom/Event.cpp:
+        (WebCore::Event::isErrorEvent):
+        * dom/Event.h:
+
 2009-07-21  Priit Laes  <plaes@plaes.org>
 
         Reviewed by Gustavo Noronha.
index 1912705..5f9d2ea 100644 (file)
@@ -69,6 +69,7 @@
 #include "JSElement.cpp"
 #include "JSEntity.cpp"
 #include "JSEntityReference.cpp"
+#include "JSErrorEvent.cpp"
 #include "JSEvent.cpp"
 #include "JSEventException.cpp"
 #include "JSFile.cpp"
index 0890844..5624629 100644 (file)
@@ -92,6 +92,7 @@ DOM_CLASSES = \
     ElementTimeControl \
     Entity \
     EntityReference \
+    ErrorEvent \
     Event \
     EventException \
     EventListener \
index 80010e7..456cb6b 100644 (file)
@@ -124,6 +124,7 @@ IDL_BINDINGS += \
        WebCore/dom/Element.idl \
        WebCore/dom/Entity.idl \
        WebCore/dom/EntityReference.idl \
+       WebCore/dom/ErrorEvent.idl \
        WebCore/dom/Event.idl \
        WebCore/dom/EventException.idl \
        WebCore/dom/KeyboardEvent.idl \
@@ -662,6 +663,8 @@ webcore_sources += \
        WebCore/dom/Entity.h \
        WebCore/dom/EntityReference.cpp \
        WebCore/dom/EntityReference.h \
+       WebCore/dom/ErrorEvent.cpp \
+       WebCore/dom/ErrorEvent.h \
        WebCore/dom/Event.cpp \
        WebCore/dom/Event.h \
        WebCore/dom/EventException.h \
index 9bb6630..a353c4f 100644 (file)
@@ -44,6 +44,7 @@
             'dom/Element.idl',
             'dom/Entity.idl',
             'dom/EntityReference.idl',
+            'dom/ErrorEvent.idl',
             'dom/Event.idl',
             'dom/EventException.idl',
             'dom/EventListener.idl',
             'dom/Entity.h',
             'dom/EntityReference.cpp',
             'dom/EntityReference.h',
+            'dom/ErrorEvent.cpp',
+            'dom/ErrorEvent.h',
             'dom/Event.cpp',
             'dom/Event.h',
             'dom/EventException.h',
index bc62ba8..8252a70 100644 (file)
@@ -307,6 +307,7 @@ IDL_BINDINGS += \
     dom/Element.idl \
     dom/Entity.idl \
     dom/EntityReference.idl \
+    dom/ErrorEvent.idl \
     dom/Event.idl \
     dom/EventException.idl \
 #    dom/EventListener.idl \
@@ -643,6 +644,7 @@ SOURCES += \
     dom/Element.cpp \
     dom/Entity.cpp \
     dom/EntityReference.cpp \
+    dom/ErrorEvent.cpp \
     dom/Event.cpp \
     dom/EventNames.cpp \
     dom/EventTarget.cpp \
index a5ef33b..1bf7ca5 100644 (file)
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSErrorEvent.cpp"\r
+                               >\r
+                               <FileConfiguration\r
+                                       Name="Debug|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_Internal|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_Cairo|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release_Cairo|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                       </File>\r
+                       <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSErrorEvent.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEvent.cpp"\r
                                >\r
                                <FileConfiguration\r
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="..\dom\ErrorEvent.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\dom\ErrorEvent.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="..\dom\Event.cpp"\r
                                >\r
                        </File>\r
index e5cff5d..204b66b 100644 (file)
                2E4346580F546A9900B0F1BA /* CrossThreadCopier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E4346560F546A9900B0F1BA /* CrossThreadCopier.cpp */; };
                2E4346590F546A9900B0F1BA /* CrossThreadCopier.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E4346570F546A9900B0F1BA /* CrossThreadCopier.h */; };
                2EA768040FE7126400AB9C8A /* WorkerScriptLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EA768030FE7126400AB9C8A /* WorkerScriptLoaderClient.h */; };
+               2ECF7ADC10162B3800427DE7 /* JSErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2ECF7ADA10162B3800427DE7 /* JSErrorEvent.cpp */; };
+               2ECF7ADD10162B3800427DE7 /* JSErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECF7ADB10162B3800427DE7 /* JSErrorEvent.h */; };
+               2ECF7AE110162B5800427DE7 /* ErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2ECF7ADE10162B5800427DE7 /* ErrorEvent.cpp */; };
+               2ECF7AE210162B5800427DE7 /* ErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECF7ADF10162B5800427DE7 /* ErrorEvent.h */; };
+               2ECF7AE310162B5800427DE7 /* ErrorEvent.idl in Resources */ = {isa = PBXBuildFile; fileRef = 2ECF7AE010162B5800427DE7 /* ErrorEvent.idl */; };
                31288E720E3005D6003619AE /* WebKitCSSKeyframeRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E6E0E3005D6003619AE /* WebKitCSSKeyframeRule.cpp */; };
                31288E730E3005D6003619AE /* WebKitCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 31288E6F0E3005D6003619AE /* WebKitCSSKeyframeRule.h */; };
                31288E740E3005D6003619AE /* WebKitCSSKeyframesRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E700E3005D6003619AE /* WebKitCSSKeyframesRule.cpp */; };
                2E4346560F546A9900B0F1BA /* CrossThreadCopier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossThreadCopier.cpp; sourceTree = "<group>"; };
                2E4346570F546A9900B0F1BA /* CrossThreadCopier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossThreadCopier.h; sourceTree = "<group>"; };
                2EA768030FE7126400AB9C8A /* WorkerScriptLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerScriptLoaderClient.h; path = workers/WorkerScriptLoaderClient.h; sourceTree = "<group>"; };
+               2ECF7ADA10162B3800427DE7 /* JSErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSErrorEvent.cpp; sourceTree = "<group>"; };
+               2ECF7ADB10162B3800427DE7 /* JSErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSErrorEvent.h; sourceTree = "<group>"; };
+               2ECF7ADE10162B5800427DE7 /* ErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorEvent.cpp; sourceTree = "<group>"; };
+               2ECF7ADF10162B5800427DE7 /* ErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorEvent.h; sourceTree = "<group>"; };
+               2ECF7AE010162B5800427DE7 /* ErrorEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ErrorEvent.idl; sourceTree = "<group>"; };
                31288E6E0E3005D6003619AE /* WebKitCSSKeyframeRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSKeyframeRule.cpp; sourceTree = "<group>"; };
                31288E6F0E3005D6003619AE /* WebKitCSSKeyframeRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSKeyframeRule.h; sourceTree = "<group>"; };
                31288E700E3005D6003619AE /* WebKitCSSKeyframesRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSKeyframesRule.cpp; sourceTree = "<group>"; };
                A83B79120CCB003F000B0825 /* Events */ = {
                        isa = PBXGroup;
                        children = (
+                               2ECF7ADA10162B3800427DE7 /* JSErrorEvent.cpp */,
+                               2ECF7ADB10162B3800427DE7 /* JSErrorEvent.h */,
                                14E8378309F85D1C00B85AE4 /* JSEvent.cpp */,
                                14E8378D09F85D4F00B85AE4 /* JSEvent.h */,
                                BC60D9BD0D2A269A00B9918F /* JSEventException.cpp */,
                                A8EA7EB90A1945D000A8EF5F /* EntityReference.cpp */,
                                A8EA7EB80A1945D000A8EF5F /* EntityReference.h */,
                                85089CCB0A98C33A00A275AA /* EntityReference.idl */,
+                               2ECF7ADE10162B5800427DE7 /* ErrorEvent.cpp */,
+                               2ECF7ADF10162B5800427DE7 /* ErrorEvent.h */,
+                               2ECF7AE010162B5800427DE7 /* ErrorEvent.idl */,
                                85031B2B0A44EFC700F992E0 /* Event.cpp */,
                                85031B2C0A44EFC700F992E0 /* Event.h */,
                                14E836D209F8512000B85AE4 /* Event.idl */,
                                15C77093100D3CA8005BA267 /* JSValidityState.h in Headers */,
                                15C770A6100D41CD005BA267 /* DOMValidityState.h in Headers */,
                                377C4CDF1014E9F600B9AE42 /* PlaceholderDocument.h in Headers */,
+                               2ECF7ADD10162B3800427DE7 /* JSErrorEvent.h in Headers */,
+                               2ECF7AE210162B5800427DE7 /* ErrorEvent.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                41E1B1D20FF5986900576B3B /* AbstractWorker.idl in Resources */,
                                41E1B1D50FF5986900576B3B /* SharedWorker.idl in Resources */,
                                15C7708C100D3C6A005BA267 /* ValidityState.idl in Resources */,
+                               2ECF7AE310162B5800427DE7 /* ErrorEvent.idl in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                15C77094100D3CA8005BA267 /* JSValidityState.cpp in Sources */,
                                15C770A5100D41CD005BA267 /* DOMValidityState.mm in Sources */,
                                377C4CE01014E9F600B9AE42 /* PlaceholderDocument.cpp in Sources */,
+                               2ECF7ADC10162B3800427DE7 /* JSErrorEvent.cpp in Sources */,
+                               2ECF7AE110162B5800427DE7 /* ErrorEvent.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index a479f8c..139d4cc 100644 (file)
@@ -280,6 +280,7 @@ This file contains the list of files needed to build WebCore.
         DerivedSources/WebCore/JSElement.cpp
         DerivedSources/WebCore/JSEntity.cpp
         DerivedSources/WebCore/JSEntityReference.cpp
+        DerivedSources/WebCore/JSErrorEvent.cpp
         DerivedSources/WebCore/JSEvent.cpp
         DerivedSources/WebCore/JSEventException.cpp
         DerivedSources/WebCore/JSFile.cpp
@@ -449,6 +450,7 @@ This file contains the list of files needed to build WebCore.
         dom/Element.cpp
         dom/Entity.cpp
         dom/EntityReference.cpp
+        dom/ErrorEvent.cpp
         dom/Event.cpp
         dom/EventNames.cpp
         dom/EventTarget.cpp
index 03b97d8..dcac8ca 100644 (file)
@@ -32,6 +32,7 @@
 #include "Clipboard.h"
 #include "Event.h"
 #include "JSClipboard.h"
+#include "JSErrorEvent.h"
 #include "JSKeyboardEvent.h"
 #include "JSMessageEvent.h"
 #include "JSMouseEvent.h"
@@ -44,6 +45,7 @@
 #include "JSWebKitTransitionEvent.h"
 #include "JSWheelEvent.h"
 #include "JSXMLHttpRequestProgressEvent.h"
+#include "ErrorEvent.h"
 #include "KeyboardEvent.h"
 #include "MessageEvent.h"
 #include "MouseEvent.h"
@@ -123,6 +125,10 @@ JSValue toJS(ExecState* exec, Event* event)
         wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, WebKitAnimationEvent, event);
     else if (event->isWebKitTransitionEvent())
         wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, WebKitTransitionEvent, event);
+#if ENABLE(WORKERS)
+    else if (event->isErrorEvent())
+        wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, ErrorEvent, event);
+#endif
     else
         wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, Event, event);
 
diff --git a/WebCore/dom/ErrorEvent.cpp b/WebCore/dom/ErrorEvent.cpp
new file mode 100644 (file)
index 0000000..2627d01
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(WORKERS)
+
+#include "ErrorEvent.h"
+
+#include "EventNames.h"
+
+namespace WebCore {
+
+ErrorEvent::ErrorEvent()
+{
+}
+
+ErrorEvent::ErrorEvent(const String& message, const String& fileName, unsigned lineNumber)
+    : Event(eventNames().errorEvent, false, true)
+    , m_message(message)
+    , m_fileName(fileName)
+    , m_lineNumber(lineNumber)
+{
+}
+
+ErrorEvent::~ErrorEvent()
+{
+}
+
+void ErrorEvent::initErrorEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& message, const String& fileName, unsigned lineNumber)
+{
+    if (dispatched())
+        return;
+        
+    initEvent(type, canBubble, cancelable);
+    
+    m_message = message;
+    m_fileName = fileName;
+    m_lineNumber = lineNumber;
+}
+
+bool ErrorEvent::isErrorEvent() const 
+{
+    return true;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
diff --git a/WebCore/dom/ErrorEvent.h b/WebCore/dom/ErrorEvent.h
new file mode 100644 (file)
index 0000000..bd38d1a
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ErrorEvent_h
+#define ErrorEvent_h
+
+#if ENABLE(WORKERS)
+
+#include "Event.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+    class ErrorEvent : public Event {
+    public:
+        static PassRefPtr<ErrorEvent> create()
+        {
+            return adoptRef(new ErrorEvent);
+        }
+        static PassRefPtr<ErrorEvent> create(const String& message, const String& fileName, unsigned lineNumber)
+        {
+            return adoptRef(new ErrorEvent(message, fileName, lineNumber));
+        }
+        virtual ~ErrorEvent();
+
+        void initErrorEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& message, const String& fileName, unsigned lineNumber);
+
+        const String& message() const { return m_message; }
+        const String& filename() const { return m_fileName; }
+        const unsigned lineno() const { return m_lineNumber; }
+
+        virtual bool isErrorEvent() const;
+
+    private:    
+        ErrorEvent();
+        ErrorEvent(const String& message, const String& fileName, unsigned lineNumber);
+
+        String m_message;
+        String m_fileName;
+        unsigned m_lineNumber;
+    };
+
+} // namespace WebCore
+
+#endif // ENABLE(WORKERS)
+
+#endif // ErrorEvent_h
diff --git a/WebCore/dom/ErrorEvent.idl b/WebCore/dom/ErrorEvent.idl
new file mode 100644 (file)
index 0000000..6125e1e
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module events {
+
+    interface [
+        Conditional=WORKERS,
+        GenerateConstructor,
+        NoStaticTables
+    ] ErrorEvent : Event {
+
+        readonly attribute DOMString message;
+        readonly attribute DOMString filename;
+        readonly attribute unsigned long lineno;
+
+        void initErrorEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString messageArg, in DOMString filenameArg, in unsigned long linenoArg);
+    };
+
+}
index b4b87ed..9d1d079 100644 (file)
@@ -158,6 +158,13 @@ bool Event::isStorageEvent() const
 }
 #endif
 
+#if ENABLE(WORKERS)
+bool Event::isErrorEvent() const
+{
+    return false;
+}
+#endif
+    
 bool Event::storesResultAsString() const
 {
     return false;
index 6984215..823ff20 100644 (file)
@@ -119,7 +119,10 @@ namespace WebCore {
 #if ENABLE(DOM_STORAGE)
         virtual bool isStorageEvent() const;
 #endif
-
+#if ENABLE(WORKERS)
+        virtual bool isErrorEvent() const;
+#endif
+        
         bool propagationStopped() const { return m_propagationStopped; }
 
         bool defaultPrevented() const { return m_defaultPrevented; }