- Revision
- 207169
- Author
- [email protected]
- Date
- 2016-10-11 15:03:04 -0700 (Tue, 11 Oct 2016)
Log Message
Update CloseEvent to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163293
Reviewed by Darin Adler.
Source/WebCore:
Update CloseEvent to stop using legacy [ConstructorTemplate=Event] and
use a regular constructor as in the specification:
- https://html.spec.whatwg.org/multipage/comms.html#the-closeevent-interfaces
No new tests, updated existing test.
* Modules/websockets/CloseEvent.h:
(WebCore::CloseEvent::create):
(WebCore::CloseEvent::CloseEvent):
* Modules/websockets/CloseEvent.idl:
LayoutTests:
Update existing test to reflect a small behavior change. Passing an explicit
undefined as 'reason' members now initializes the attribute to the empty
string (the member's default value) instead of the string "undefined". This
new behavior matches Chrome and Firefox.
* fast/events/constructors/close-event-constructor-expected.txt:
* fast/events/constructors/close-event-constructor.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (207168 => 207169)
--- trunk/LayoutTests/ChangeLog 2016-10-11 22:01:45 UTC (rev 207168)
+++ trunk/LayoutTests/ChangeLog 2016-10-11 22:03:04 UTC (rev 207169)
@@ -1,3 +1,18 @@
+2016-10-11 Chris Dumez <[email protected]>
+
+ Update CloseEvent to stop using legacy [ConstructorTemplate=Event]
+ https://bugs.webkit.org/show_bug.cgi?id=163293
+
+ Reviewed by Darin Adler.
+
+ Update existing test to reflect a small behavior change. Passing an explicit
+ undefined as 'reason' members now initializes the attribute to the empty
+ string (the member's default value) instead of the string "undefined". This
+ new behavior matches Chrome and Firefox.
+
+ * fast/events/constructors/close-event-constructor-expected.txt:
+ * fast/events/constructors/close-event-constructor.html:
+
2016-10-11 Alex Christensen <[email protected]>
Enable URLParser by default
Modified: trunk/LayoutTests/fast/events/constructors/close-event-constructor-expected.txt (207168 => 207169)
--- trunk/LayoutTests/fast/events/constructors/close-event-constructor-expected.txt 2016-10-11 22:01:45 UTC (rev 207168)
+++ trunk/LayoutTests/fast/events/constructors/close-event-constructor-expected.txt 2016-10-11 22:03:04 UTC (rev 207169)
@@ -16,7 +16,7 @@
PASS new CloseEvent('eventType', { wasClean: true }).wasClean is true
PASS new CloseEvent('eventType', { reason: 'koakuma' }).reason is "koakuma"
PASS new CloseEvent('eventType', { reason: '' }).reason is ""
-PASS new CloseEvent('eventType', { reason: undefined }).reason is "undefined"
+PASS new CloseEvent('eventType', { reason: undefined }).reason is ""
PASS new CloseEvent('eventType', { reason: null }).reason is "null"
PASS new CloseEvent('eventType', { reason: false }).reason is "false"
PASS new CloseEvent('eventType', { reason: true }).reason is "true"
Modified: trunk/LayoutTests/fast/events/constructors/close-event-constructor.html (207168 => 207169)
--- trunk/LayoutTests/fast/events/constructors/close-event-constructor.html 2016-10-11 22:01:45 UTC (rev 207168)
+++ trunk/LayoutTests/fast/events/constructors/close-event-constructor.html 2016-10-11 22:03:04 UTC (rev 207169)
@@ -33,7 +33,7 @@
shouldBeEqualToString("new CloseEvent('eventType', { reason: '' }).reason", "");
// Non-strings.
-shouldBeEqualToString("new CloseEvent('eventType', { reason: undefined }).reason", "undefined");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: undefined }).reason", "");
shouldBeEqualToString("new CloseEvent('eventType', { reason: null }).reason", "null");
shouldBeEqualToString("new CloseEvent('eventType', { reason: false }).reason", "false");
shouldBeEqualToString("new CloseEvent('eventType', { reason: true }).reason", "true");
Modified: trunk/Source/WebCore/ChangeLog (207168 => 207169)
--- trunk/Source/WebCore/ChangeLog 2016-10-11 22:01:45 UTC (rev 207168)
+++ trunk/Source/WebCore/ChangeLog 2016-10-11 22:03:04 UTC (rev 207169)
@@ -1,3 +1,21 @@
+2016-10-11 Chris Dumez <[email protected]>
+
+ Update CloseEvent to stop using legacy [ConstructorTemplate=Event]
+ https://bugs.webkit.org/show_bug.cgi?id=163293
+
+ Reviewed by Darin Adler.
+
+ Update CloseEvent to stop using legacy [ConstructorTemplate=Event] and
+ use a regular constructor as in the specification:
+ - https://html.spec.whatwg.org/multipage/comms.html#the-closeevent-interfaces
+
+ No new tests, updated existing test.
+
+ * Modules/websockets/CloseEvent.h:
+ (WebCore::CloseEvent::create):
+ (WebCore::CloseEvent::CloseEvent):
+ * Modules/websockets/CloseEvent.idl:
+
2016-10-11 Yusuke Suzuki <[email protected]>
[DOMJIT] DOMJIT::Patchpoint should have a way to receive constant folded arguments
Modified: trunk/Source/WebCore/Modules/websockets/CloseEvent.h (207168 => 207169)
--- trunk/Source/WebCore/Modules/websockets/CloseEvent.h 2016-10-11 22:01:45 UTC (rev 207168)
+++ trunk/Source/WebCore/Modules/websockets/CloseEvent.h 2016-10-11 22:03:04 UTC (rev 207169)
@@ -36,12 +36,6 @@
namespace WebCore {
-struct CloseEventInit : public EventInit {
- bool wasClean { false };
- unsigned short code { 0 };
- String reason;
-};
-
class CloseEvent : public Event {
public:
static Ref<CloseEvent> create(bool wasClean, unsigned short code, const String& reason)
@@ -49,9 +43,15 @@
return adoptRef(*new CloseEvent(wasClean, code, reason));
}
- static Ref<CloseEvent> createForBindings(const AtomicString& type, const CloseEventInit& initializer)
+ struct Init : EventInit {
+ bool wasClean { false };
+ unsigned short code { 0 };
+ String reason;
+ };
+
+ static Ref<CloseEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
{
- return adoptRef(*new CloseEvent(type, initializer));
+ return adoptRef(*new CloseEvent(type, initializer, isTrusted));
}
bool wasClean() const { return m_wasClean; }
@@ -70,8 +70,8 @@
{
}
- CloseEvent(const AtomicString& type, const CloseEventInit& initializer)
- : Event(type, initializer)
+ CloseEvent(const AtomicString& type, const Init& initializer, IsTrusted isTrusted)
+ : Event(type, initializer, isTrusted)
, m_wasClean(initializer.wasClean)
, m_code(initializer.code)
, m_reason(initializer.reason)
Modified: trunk/Source/WebCore/Modules/websockets/CloseEvent.idl (207168 => 207169)
--- trunk/Source/WebCore/Modules/websockets/CloseEvent.idl 2016-10-11 22:01:45 UTC (rev 207168)
+++ trunk/Source/WebCore/Modules/websockets/CloseEvent.idl 2016-10-11 22:03:04 UTC (rev 207169)
@@ -28,11 +28,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+// FIXME: This should be exposed to workers as well.
[
- ConstructorTemplate=Event
+ Constructor(DOMString type, optional CloseEventInit eventInitDict),
] interface CloseEvent : Event {
- [InitializedByEventConstructor] readonly attribute boolean wasClean;
- [InitializedByEventConstructor] readonly attribute unsigned short code;
- [InitializedByEventConstructor] readonly attribute USVString reason;
+ readonly attribute boolean wasClean;
+ readonly attribute unsigned short code;
+ readonly attribute USVString reason;
};
+dictionary CloseEventInit : EventInit {
+ boolean wasClean = false;
+ unsigned short code = 0;
+ USVString reason = "";
+};