Update ProgressEvent to stop using legacy [ConstructorTemplate=Event]
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Oct 2016 20:57:37 +0000 (20:57 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Oct 2016 20:57:37 +0000 (20:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163221

Reviewed by Darin Adler.

Update ProgressEvent to stop using legacy [ConstructorTemplate=Event]
and use a regular constructor as in the specification:
- https://xhr.spec.whatwg.org/#firing-events-using-the-progressevent-interface

* dom/ProgressEvent.cpp:
(WebCore::ProgressEvent::ProgressEvent):
* dom/ProgressEvent.h:
(WebCore::ProgressEvent::create):
* dom/ProgressEvent.idl:

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

Source/WebCore/ChangeLog
Source/WebCore/dom/ProgressEvent.cpp
Source/WebCore/dom/ProgressEvent.h
Source/WebCore/dom/ProgressEvent.idl

index 9359d4a..81a9f2b 100644 (file)
@@ -1,3 +1,20 @@
+2016-10-10  Chris Dumez  <cdumez@apple.com>
+
+        Update ProgressEvent to stop using legacy [ConstructorTemplate=Event]
+        https://bugs.webkit.org/show_bug.cgi?id=163221
+
+        Reviewed by Darin Adler.
+
+        Update ProgressEvent to stop using legacy [ConstructorTemplate=Event]
+        and use a regular constructor as in the specification:
+        - https://xhr.spec.whatwg.org/#firing-events-using-the-progressevent-interface
+
+        * dom/ProgressEvent.cpp:
+        (WebCore::ProgressEvent::ProgressEvent):
+        * dom/ProgressEvent.h:
+        (WebCore::ProgressEvent::create):
+        * dom/ProgressEvent.idl:
+
 2016-10-10  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Address some review feedback from r206979 and r207010
index 40593c3..0e7092b 100644 (file)
@@ -30,8 +30,8 @@
 
 namespace WebCore {
 
-ProgressEvent::ProgressEvent(const AtomicString& type, const ProgressEventInit& initializer)
-    : Event(type, initializer)
+ProgressEvent::ProgressEvent(const AtomicString& type, const Init& initializer, IsTrusted isTrusted)
+    : Event(type, initializer, isTrusted)
     , m_lengthComputable(initializer.lengthComputable)
     , m_loaded(initializer.loaded)
     , m_total(initializer.total)
index 9cb87ce..5e59bd1 100644 (file)
 
 namespace WebCore {
 
-struct ProgressEventInit : public EventInit {
-    bool lengthComputable { false };
-    unsigned long long loaded { 0 };
-    unsigned long long total { 0 };
-};
-
 class ProgressEvent : public Event {
 public:
     static Ref<ProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total)
     {
         return adoptRef(*new ProgressEvent(type, lengthComputable, loaded, total));
     }
-    static Ref<ProgressEvent> createForBindings(const AtomicString& type, const ProgressEventInit& initializer)
+
+    struct Init : EventInit {
+        bool lengthComputable { false };
+        unsigned long long loaded { 0 };
+        unsigned long long total { 0 };
+    };
+
+    static Ref<ProgressEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
     {
-        return adoptRef(*new ProgressEvent(type, initializer));
+        return adoptRef(*new ProgressEvent(type, initializer, isTrusted));
     }
 
     bool lengthComputable() const { return m_lengthComputable; }
@@ -55,7 +56,7 @@ public:
 
 protected:
     ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total);
-    ProgressEvent(const AtomicString&, const ProgressEventInit&);
+    ProgressEvent(const AtomicString&, const Init&, IsTrusted);
 
 private:
     bool m_lengthComputable;
index 1a3b3a5..6409dce 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 [
-    ConstructorTemplate=Event,
+    Constructor(DOMString type, optional ProgressEventInit eventInitDict),
     Exposed=(Window,Worker),
 ] interface ProgressEvent : Event {
     [InitializedByEventConstructor] readonly attribute boolean lengthComputable;
@@ -32,3 +32,8 @@
     [InitializedByEventConstructor] readonly attribute unsigned long long total;
 };
 
+dictionary ProgressEventInit : EventInit {
+    boolean lengthComputable = false;
+    unsigned long long loaded = 0;
+    unsigned long long total = 0;
+};