Changeset 95352 in webkit


Ignore:
Timestamp:
Sep 16, 2011 7:01:29 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Implement an ErrorEvent constructor for JSC
https://bugs.webkit.org/show_bug.cgi?id=68148

Patch by Kentaro Hara <haraken@chromium.org> on 2011-09-16
Reviewed by Sam Weinig.

Source/WebCore:

The spec for the ErrorEvent constructor is here:
http://dev.w3.org/html5/workers/#errorevent

Test: fast/events/constructors/error-event-constructor.html

  • bindings/generic/EventConstructors.h: Added a definition for the ErrorEvent constructor.
  • bindings/js/JSEventConstructors.cpp: Added #includes for ErrorEvent.
  • dom/ErrorEvent.cpp:

(WebCore::ErrorEventInit::ErrorEventInit):
(WebCore::ErrorEvent::ErrorEvent):
(WebCore::ErrorEvent::initErrorEvent):
(WebCore::ErrorEvent::isErrorEvent):

  • dom/ErrorEvent.h: Added a definition for ErrorEventInit.

(WebCore::ErrorEvent::create):
(WebCore::ErrorEvent::message):
(WebCore::ErrorEvent::filename):
(WebCore::ErrorEvent::lineno):

  • dom/ErrorEvent.idl: Makes ErrorEvent constructible.

LayoutTests:

error-event-constructor.html checks the behavior of the ErrorEvent constructor.

  • fast/dom/constructed-objects-prototypes-expected.txt: Now window has ErrorEvent.
  • fast/events/constructors/error-event-constructor-expected.txt: Added.
  • fast/events/constructors/error-event-constructor.html: Added.
  • platform/chromium/test_expectations.txt: Skipped error-event-constructor.html, since V8 does not yet have the ErrorEvent constructor.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95351 r95352  
     12011-09-16  Kentaro Hara  <haraken@chromium.org>
     2
     3        Implement an ErrorEvent constructor for JSC
     4        https://bugs.webkit.org/show_bug.cgi?id=68148
     5
     6        Reviewed by Sam Weinig.
     7
     8        error-event-constructor.html checks the behavior of the ErrorEvent constructor.
     9
     10        * fast/dom/constructed-objects-prototypes-expected.txt: Now window has ErrorEvent.
     11        * fast/events/constructors/error-event-constructor-expected.txt: Added.
     12        * fast/events/constructors/error-event-constructor.html: Added.
     13        * platform/chromium/test_expectations.txt: Skipped error-event-constructor.html, since V8 does not yet have the ErrorEvent constructor.
     14
    1152011-09-16  Adam Barth  <abarth@webkit.org>
    216
  • trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt

    r95279 r95352  
    1010PASS (new inner.DOMParser()).isInner is true
    1111PASS (new inner.DOMParser()).constructor.isInner is true
     12PASS (new inner.ErrorEvent()).isInner is true
     13PASS (new inner.ErrorEvent()).constructor.isInner is true
    1214PASS (new inner.Event()).isInner is true
    1315PASS (new inner.Event()).constructor.isInner is true
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r95350 r95352  
    6060// Implement java testing harness.
    6161BUGCR36681 SKIP : java = TEXT
     62
     63// This will soon be fixed after implementing an ErrorEvent constructor for V8.
     64BUGWK68148 : fast/events/constructors/error-event-constructor.html = FAIL
    6265
    6366// Quota API is not supported in DRT yet.
  • trunk/Source/WebCore/ChangeLog

    r95350 r95352  
     12011-09-16  Kentaro Hara  <haraken@chromium.org>
     2
     3        Implement an ErrorEvent constructor for JSC
     4        https://bugs.webkit.org/show_bug.cgi?id=68148
     5
     6        Reviewed by Sam Weinig.
     7
     8        The spec for the ErrorEvent constructor is here:
     9        http://dev.w3.org/html5/workers/#errorevent
     10
     11        Test: fast/events/constructors/error-event-constructor.html
     12
     13        * bindings/generic/EventConstructors.h: Added a definition for the ErrorEvent constructor.
     14        * bindings/js/JSEventConstructors.cpp: Added #includes for ErrorEvent.
     15        * dom/ErrorEvent.cpp:
     16        (WebCore::ErrorEventInit::ErrorEventInit):
     17        (WebCore::ErrorEvent::ErrorEvent):
     18        (WebCore::ErrorEvent::initErrorEvent):
     19        (WebCore::ErrorEvent::isErrorEvent):
     20        * dom/ErrorEvent.h: Added a definition for ErrorEventInit.
     21        (WebCore::ErrorEvent::create):
     22        (WebCore::ErrorEvent::message):
     23        (WebCore::ErrorEvent::filename):
     24        (WebCore::ErrorEvent::lineno):
     25        * dom/ErrorEvent.idl: Makes ErrorEvent constructible.
     26
    1272011-09-16  Kentaro Hara  <haraken@google.com>
    228
  • trunk/Source/WebCore/bindings/generic/EventConstructors.h

    r95262 r95352  
    8282    DICTIONARY_END(PopStateEvent)
    8383
     84#define INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_ERROR_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
     85    \
     86    DICTIONARY_START(ErrorEvent) \
     87        FILL_PARENT_PROPERTIES(Event) \
     88        FILL_PROPERTY(message) \
     89        FILL_PROPERTY(filename) \
     90        FILL_PROPERTY(lineno) \
     91    DICTIONARY_END(ErrorEvent)
     92
    8493
    8594#define INSTANTIATE_ALL_EVENT_INITIALIZING_CONSTRUCTORS(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
     
    91100    INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_PAGE_TRANSITION_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
    92101    INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_POP_STATE_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
     102    INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_ERROR_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
    93103
    94104} // namespace WebCore
  • trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp

    r95262 r95352  
    2828
    2929#include "CustomEvent.h"
     30#include "ErrorEvent.h"
    3031#include "Event.h"
    3132#include "HashChangeEvent.h"
    3233#include "JSCustomEvent.h"
    3334#include "JSDictionary.h"
     35#include "JSErrorEvent.h"
    3436#include "JSEvent.h"
    3537#include "JSHashChangeEvent.h"
  • trunk/Source/WebCore/dom/ErrorEvent.cpp

    r76216 r95352  
    3737namespace WebCore {
    3838
     39ErrorEventInit::ErrorEventInit()
     40    : message()
     41    , filename()
     42    , lineno(0)
     43{
     44}
     45
    3946ErrorEvent::ErrorEvent()
     47{
     48}
     49
     50ErrorEvent::ErrorEvent(const AtomicString& type, const ErrorEventInit& initializer)
     51    : Event(type, initializer)
     52    , m_message(initializer.message)
     53    , m_fileName(initializer.filename)
     54    , m_lineNumber(initializer.lineno)
    4055{
    4156}
     
    5772    if (dispatched())
    5873        return;
    59        
     74
    6075    initEvent(type, canBubble, cancelable);
    61    
     76
    6277    m_message = message;
    6378    m_fileName = fileName;
     
    6580}
    6681
    67 bool ErrorEvent::isErrorEvent() const 
     82bool ErrorEvent::isErrorEvent() const
    6883{
    6984    return true;
  • trunk/Source/WebCore/dom/ErrorEvent.h

    r76216 r95352  
    3737namespace WebCore {
    3838
    39     class ErrorEvent : public Event {
    40     public:
    41         static PassRefPtr<ErrorEvent> create()
    42         {
    43             return adoptRef(new ErrorEvent);
    44         }
    45         static PassRefPtr<ErrorEvent> create(const String& message, const String& fileName, unsigned lineNumber)
    46         {
    47             return adoptRef(new ErrorEvent(message, fileName, lineNumber));
    48         }
    49         virtual ~ErrorEvent();
     39struct ErrorEventInit : public EventInit {
     40    ErrorEventInit();
    5041
    51         void initErrorEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& message, const String& fileName, unsigned lineNumber);
     42    String message;
     43    String filename;
     44    unsigned lineno;
     45};
    5246
    53         const String& message() const { return m_message; }
    54         const String& filename() const { return m_fileName; }
    55         unsigned lineno() const { return m_lineNumber; }
     47class ErrorEvent : public Event {
     48public:
     49    static PassRefPtr<ErrorEvent> create()
     50    {
     51        return adoptRef(new ErrorEvent);
     52    }
     53    static PassRefPtr<ErrorEvent> create(const String& message, const String& fileName, unsigned lineNumber)
     54    {
     55        return adoptRef(new ErrorEvent(message, fileName, lineNumber));
     56    }
     57    static PassRefPtr<ErrorEvent> create(const AtomicString& type, const ErrorEventInit& initializer)
     58    {
     59        return adoptRef(new ErrorEvent(type, initializer));
     60    }
     61    virtual ~ErrorEvent();
    5662
    57         virtual bool isErrorEvent() const;
     63    void initErrorEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& message, const String& fileName, unsigned lineNumber);
    5864
    59     private:   
    60         ErrorEvent();
    61         ErrorEvent(const String& message, const String& fileName, unsigned lineNumber);
     65    const String& message() const { return m_message; }
     66    const String& filename() const { return m_fileName; }
     67    unsigned lineno() const { return m_lineNumber; }
    6268
    63         String m_message;
    64         String m_fileName;
    65         unsigned m_lineNumber;
    66     };
     69    virtual bool isErrorEvent() const;
     70
     71private:
     72    ErrorEvent();
     73    ErrorEvent(const String& message, const String& fileName, unsigned lineNumber);
     74    ErrorEvent(const AtomicString&, const ErrorEventInit&);
     75
     76    String m_message;
     77    String m_fileName;
     78    unsigned m_lineNumber;
     79};
    6780
    6881} // namespace WebCore
  • trunk/Source/WebCore/dom/ErrorEvent.idl

    r94493 r95352  
    3232
    3333    interface [
    34         NoStaticTables
     34        NoStaticTables,
     35        CanBeConstructed,
     36        CustomConstructFunction
    3537    ] ErrorEvent : Event {
    3638
Note: See TracChangeset for help on using the changeset viewer.