+2011-09-25 Kentaro Hara <haraken@chromium.org>
+
+ Implement a CloseEvent constructor for JSC
+ https://bugs.webkit.org/show_bug.cgi?id=68340
+
+ Reviewed by Oliver Hunt.
+
+ * fast/dom/constructed-objects-prototypes-expected.txt: Now window has CloseEvent.
+ * fast/events/constructors/close-event-constructor-expected.txt: Added.
+ * fast/events/constructors/close-event-constructor.html: Added.
+ * platform/chromium/test_expectations.txt: Skipped close-event-constructor.html, since V8 does not yet have the CloseEvent constructor.
+
2011-09-25 Dan Bernstein <mitz@apple.com>
<rdar://problem/10156263> ASSERT in WebCore::FrameView::scheduleRelayoutOfSubtree
PASS (new inner.Audio()).isInner is true
PASS (new inner.Audio()).constructor.isInner is true
+PASS (new inner.CloseEvent()).isInner is true
+PASS (new inner.CloseEvent()).constructor.isInner is true
PASS (new inner.CustomEvent()).isInner is true
PASS (new inner.CustomEvent()).constructor.isInner is true
PASS (new inner.DOMParser()).isInner is true
--- /dev/null
+This tests the constructor for the CloseEvent DOM class.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS new CloseEvent('eventType').bubbles is false
+PASS new CloseEvent('eventType').cancelable is false
+PASS new CloseEvent('eventType').wasClean is false
+PASS new CloseEvent('eventType').code is 0
+PASS new CloseEvent('eventType').reason is ""
+PASS new CloseEvent('eventType', { bubbles: false }).bubbles is false
+PASS new CloseEvent('eventType', { bubbles: true }).bubbles is true
+PASS new CloseEvent('eventType', { cancelable: false }).cancelable is false
+PASS new CloseEvent('eventType', { cancelable: true }).cancelable is true
+PASS new CloseEvent('eventType', { wasClean: false }).wasClean is false
+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: null }).reason is "null"
+PASS new CloseEvent('eventType', { reason: false }).reason is "false"
+PASS new CloseEvent('eventType', { reason: true }).reason is "true"
+PASS new CloseEvent('eventType', { reason: 12345 }).reason is "12345"
+PASS new CloseEvent('eventType', { reason: 18446744073709551615 }).reason is "18446744073709552000"
+PASS new CloseEvent('eventType', { reason: NaN }).reason is "NaN"
+PASS new CloseEvent('eventType', { reason: [] }).reason is ""
+PASS new CloseEvent('eventType', { reason: [1, 2, 3] }).reason is "1,2,3"
+PASS new CloseEvent('eventType', { reason: {koakuma: 12345} }).reason is "[object Object]"
+PASS new CloseEvent('eventType', { reason: {valueOf: function () { return 'koakuma'; } } }).reason is "[object Object]"
+PASS new CloseEvent('eventType', { code: 0 }).code is 0
+PASS new CloseEvent('eventType', { code: 1 }).code is 1
+PASS new CloseEvent('eventType', { code: 65534 }).code is 65534
+PASS new CloseEvent('eventType', { code: 65535 }).code is 65535
+PASS new CloseEvent('eventType', { code: 9007199254740991 }).code is 65535
+PASS new CloseEvent('eventType', { code: 18446744073709551615 }).code is 0
+PASS new CloseEvent('eventType', { code: 12345678901234567890 }).code is 2048
+PASS new CloseEvent('eventType', { code: -1 }).code is 65535
+PASS new CloseEvent('eventType', { code: 123.45 }).code is 123
+PASS new CloseEvent('eventType', { code: NaN }).code is 0
+PASS new CloseEvent('eventType', { code: undefined }).code is 0
+PASS new CloseEvent('eventType', { code: null }).code is 0
+PASS new CloseEvent('eventType', { code: '' }).code is 0
+PASS new CloseEvent('eventType', { code: '12345' }).code is 12345
+PASS new CloseEvent('eventType', { code: '12345a' }).code is 0
+PASS new CloseEvent('eventType', { code: 'abc' }).code is 0
+PASS new CloseEvent('eventType', { code: [] }).code is 0
+PASS new CloseEvent('eventType', { code: [12345] }).code is 12345
+PASS new CloseEvent('eventType', { code: [12345, 67890] }).code is 0
+PASS new CloseEvent('eventType', { code: {} }).code is 0
+PASS new CloseEvent('eventType', { code: {moemoe: 12345} }).code is 0
+PASS new CloseEvent('eventType', { code: {valueOf: function () { return 12345; }} }).code is 12345
+PASS new CloseEvent('eventType', { bubbles: true, cancelable: true, wasClean: true, code : 12345, reason: 'koakuma' }).bubbles is true
+PASS new CloseEvent('eventType', { bubbles: true, cancelable: true, wasClean: true, code : 12345, reason: 'koakuma' }).cancelable is true
+PASS new CloseEvent('eventType', { bubbles: true, cancelable: true, wasClean: true, code : 12345, reason: 'koakuma' }).wasClean is true
+PASS new CloseEvent('eventType', { bubbles: true, cancelable: true, wasClean: true, code : 12345, reason: 'koakuma' }).code is 12345
+PASS new CloseEvent('eventType', { bubbles: true, cancelable: true, wasClean: true, code : 12345, reason: 'koakuma' }).reason is "koakuma"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("This tests the constructor for the CloseEvent DOM class.");
+
+// No initializer is passed.
+shouldBe("new CloseEvent('eventType').bubbles", "false");
+shouldBe("new CloseEvent('eventType').cancelable", "false");
+shouldBe("new CloseEvent('eventType').wasClean", "false");
+shouldBe("new CloseEvent('eventType').code", "0");
+shouldBeEqualToString("new CloseEvent('eventType').reason", "");
+
+// bubbles is passed.
+shouldBe("new CloseEvent('eventType', { bubbles: false }).bubbles", "false");
+shouldBe("new CloseEvent('eventType', { bubbles: true }).bubbles", "true");
+
+// cancelable is passed.
+shouldBe("new CloseEvent('eventType', { cancelable: false }).cancelable", "false");
+shouldBe("new CloseEvent('eventType', { cancelable: true }).cancelable", "true");
+
+// wasClean is passed.
+shouldBe("new CloseEvent('eventType', { wasClean: false }).wasClean", "false");
+shouldBe("new CloseEvent('eventType', { wasClean: true }).wasClean", "true");
+
+// reason is passed.
+// Strings.
+shouldBeEqualToString("new CloseEvent('eventType', { reason: 'koakuma' }).reason", "koakuma");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: '' }).reason", "");
+
+// Non-strings.
+shouldBeEqualToString("new CloseEvent('eventType', { reason: undefined }).reason", "undefined");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: null }).reason", "null");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: false }).reason", "false");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: true }).reason", "true");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: 12345 }).reason", "12345");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: 18446744073709551615 }).reason", "18446744073709552000");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: NaN }).reason", "NaN");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: [] }).reason", "");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: [1, 2, 3] }).reason", "1,2,3");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: {koakuma: 12345} }).reason", "[object Object]");
+shouldBeEqualToString("new CloseEvent('eventType', { reason: {valueOf: function () { return 'koakuma'; } } }).reason", "[object Object]");
+
+// code is passed.
+// Numbers within the unsigned short range.
+shouldBe("new CloseEvent('eventType', { code: 0 }).code", "0");
+shouldBe("new CloseEvent('eventType', { code: 1 }).code", "1");
+shouldBe("new CloseEvent('eventType', { code: 65534 }).code", "65534");
+shouldBe("new CloseEvent('eventType', { code: 65535 }).code", "65535");
+
+// Numbers out of the unsigned short range.
+// 2^{53}-1, the largest number that can be exactly represented by double.
+shouldBe("new CloseEvent('eventType', { code: 9007199254740991 }).code", "65535");
+// 2^{64}-1
+shouldBe("new CloseEvent('eventType', { code: 18446744073709551615 }).code", "0");
+shouldBe("new CloseEvent('eventType', { code: 12345678901234567890 }).code", "2048");
+shouldBe("new CloseEvent('eventType', { code: -1 }).code", "65535");
+shouldBe("new CloseEvent('eventType', { code: 123.45 }).code", "123");
+shouldBe("new CloseEvent('eventType', { code: NaN }).code", "0");
+
+// Non-numeric values.
+shouldBe("new CloseEvent('eventType', { code: undefined }).code", "0");
+shouldBe("new CloseEvent('eventType', { code: null }).code", "0");
+shouldBe("new CloseEvent('eventType', { code: '' }).code", "0");
+shouldBe("new CloseEvent('eventType', { code: '12345' }).code", "12345");
+shouldBe("new CloseEvent('eventType', { code: '12345a' }).code", "0");
+shouldBe("new CloseEvent('eventType', { code: 'abc' }).code", "0");
+shouldBe("new CloseEvent('eventType', { code: [] }).code", "0");
+shouldBe("new CloseEvent('eventType', { code: [12345] }).code", "12345");
+shouldBe("new CloseEvent('eventType', { code: [12345, 67890] }).code", "0");
+shouldBe("new CloseEvent('eventType', { code: {} }).code", "0");
+shouldBe("new CloseEvent('eventType', { code: {moemoe: 12345} }).code", "0");
+shouldBe("new CloseEvent('eventType', { code: {valueOf: function () { return 12345; }} }).code", "12345");
+
+// All initializers are passed.
+shouldBe("new CloseEvent('eventType', { bubbles: true, cancelable: true, wasClean: true, code : 12345, reason: 'koakuma' }).bubbles", "true");
+shouldBe("new CloseEvent('eventType', { bubbles: true, cancelable: true, wasClean: true, code : 12345, reason: 'koakuma' }).cancelable", "true");
+shouldBe("new CloseEvent('eventType', { bubbles: true, cancelable: true, wasClean: true, code : 12345, reason: 'koakuma' }).wasClean", "true");
+shouldBe("new CloseEvent('eventType', { bubbles: true, cancelable: true, wasClean: true, code : 12345, reason: 'koakuma' }).code", "12345");
+shouldBeEqualToString("new CloseEvent('eventType', { bubbles: true, cancelable: true, wasClean: true, code : 12345, reason: 'koakuma' }).reason", "koakuma");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
BUGCR84572 SKIP : storage/storageinfo-request-quota.html = FAIL
BUGCR84572 SKIP : storage/storageinfo-no-callbacks.html = FAIL
+// This will soon be fixed after implementing a CloseEvent constructor for V8.
+BUGWK68340 : fast/events/constructors/close-event-constructor.html = FAIL
+
// Animation API is disabled. Dean Jackson has promised (as of Aug. 25, 2011)
// to re-enable these "in the next few weeks".
BUGPKASTING SKIP : animations/animation-api-1.html = TEXT
+2011-09-25 Kentaro Hara <haraken@chromium.org>
+
+ Implement a CloseEvent constructor for JSC
+ https://bugs.webkit.org/show_bug.cgi?id=68340
+
+ Reviewed by Oliver Hunt.
+
+ The spec of the CloseEvent constructor is here:
+ http://dev.w3.org/html5/websockets/#closeevent
+
+ Test: fast/events/constructors/close-event-constructor.html
+
+ * bindings/generic/EventConstructors.h: Added a definition for the CloseEvent constructor.
+ * bindings/js/JSEventConstructors.cpp: Added #includes for CloseEvent.
+ * websockets/CloseEvent.h: Added a definition for CloseEventInit.
+ (WebCore::CloseEventInit::CloseEventInit):
+ (WebCore::CloseEvent::create):
+ (WebCore::CloseEvent::CloseEvent):
+ * websockets/CloseEvent.idl: Makes CloseEvent constructible.
+
2011-09-25 Mark Rowe <mrowe@apple.com>
<rdar://problem/10177824> IconDatabase’s use of ThreadCondition leads to assertion failures in the face of spurious wakeups
FILL_PROPERTY(lineno) \
DICTIONARY_END(ErrorEvent)
+#define INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_CLOSE_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
+ \
+ DICTIONARY_START(CloseEvent) \
+ FILL_PARENT_PROPERTIES(Event) \
+ FILL_PROPERTY(wasClean) \
+ FILL_PROPERTY(code) \
+ FILL_PROPERTY(reason) \
+ DICTIONARY_END(CloseEvent)
+
#define INSTANTIATE_ALL_EVENT_INITIALIZING_CONSTRUCTORS(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_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_POP_STATE_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) \
+ INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_CLOSE_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
} // namespace WebCore
#include "config.h"
#include "EventConstructors.h"
+#include "CloseEvent.h"
#include "CustomEvent.h"
#include "ErrorEvent.h"
#include "Event.h"
#include "HashChangeEvent.h"
+#include "JSCloseEvent.h"
#include "JSCustomEvent.h"
#include "JSDictionary.h"
#include "JSErrorEvent.h"
namespace WebCore {
+struct CloseEventInit : public EventInit {
+ CloseEventInit()
+ : wasClean(false)
+ , code(0)
+ {
+ };
+
+ bool wasClean;
+ unsigned short code;
+ String reason;
+};
+
class CloseEvent : public Event {
public:
virtual bool isCloseEvent() const { return true; }
return adoptRef(new CloseEvent());
}
+ static PassRefPtr<CloseEvent> create(const AtomicString& type, const CloseEventInit& initializer)
+ {
+ return adoptRef(new CloseEvent(type, initializer));
+ }
+
void initCloseEvent(const AtomicString& type, bool canBubble, bool cancelable, bool wasClean, unsigned short code, const String& reason)
{
if (dispatched())
: Event(eventNames().closeEvent, false, false)
, m_wasClean(false)
, m_code(0)
- { }
+ {
+ }
+ CloseEvent(const AtomicString& type, const CloseEventInit& initializer)
+ : Event(type, initializer)
+ , m_wasClean(initializer.wasClean)
+ , m_code(initializer.code)
+ , m_reason(initializer.reason)
+ {
+ }
bool m_wasClean;
unsigned short m_code;
module events {
interface [
- NoStaticTables
+ NoStaticTables,
+ CanBeConstructed,
+ CustomConstructFunction
] CloseEvent : Event {
readonly attribute boolean wasClean;
readonly attribute unsigned short code;