Diff
Modified: trunk/LayoutTests/ChangeLog (94961 => 94962)
--- trunk/LayoutTests/ChangeLog 2011-09-12 17:31:05 UTC (rev 94961)
+++ trunk/LayoutTests/ChangeLog 2011-09-12 17:40:55 UTC (rev 94962)
@@ -1,3 +1,16 @@
+2011-09-12 Kentaro Hara <hara...@google.com>
+
+ Implement a HashChangeEvent constructor for JSC
+ https://bugs.webkit.org/show_bug.cgi?id=67924
+
+ Reviewed by Sam Weinig.
+
+ hash-change-event-constructor.html checks the behavior of the HashChangeEvent constructor.
+
+ * fast/events/constructors/hash-change-event-constructor-expected.txt: Added.
+ * fast/events/constructors/hash-change-event-constructor.html: Added.
+ * platform/chromium/test_expectations.txt: Skipped hash-change-event-constructor.html, since V8 does not yet have the HashChangeEvent constructor.
+
2011-09-12 Nate Chapin <jap...@chromium.org>
Add video-zoom-controls.html to chromium expectations
Added: trunk/LayoutTests/fast/events/constructors/hash-change-event-constructor-expected.txt (0 => 94962)
--- trunk/LayoutTests/fast/events/constructors/hash-change-event-constructor-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/constructors/hash-change-event-constructor-expected.txt 2011-09-12 17:40:55 UTC (rev 94962)
@@ -0,0 +1,47 @@
+This tests the constructor for the HashChangeEvent DOM class.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS new HashChangeEvent('eventType').bubbles is false
+PASS new HashChangeEvent('eventType').cancelable is false
+PASS new HashChangeEvent('eventType').oldURL is ""
+PASS new HashChangeEvent('eventType').newURL is ""
+PASS new HashChangeEvent('eventType', { bubbles: false }).bubbles is false
+PASS new HashChangeEvent('eventType', { bubbles: true }).bubbles is true
+PASS new HashChangeEvent('eventType', { cancelable: false }).cancelable is false
+PASS new HashChangeEvent('eventType', { cancelable: true }).cancelable is true
+PASS new HashChangeEvent('eventType', { oldURL: 'doremi' }).oldURL is "doremi"
+PASS new HashChangeEvent('eventType', { oldURL: '' }).oldURL is ""
+PASS new HashChangeEvent('eventType', { oldURL: undefined }).oldURL is "undefined"
+PASS new HashChangeEvent('eventType', { oldURL: null }).oldURL is "null"
+PASS new HashChangeEvent('eventType', { oldURL: false }).oldURL is "false"
+PASS new HashChangeEvent('eventType', { oldURL: true }).oldURL is "true"
+PASS new HashChangeEvent('eventType', { oldURL: 12345 }).oldURL is "12345"
+PASS new HashChangeEvent('eventType', { oldURL: 18446744073709551615 }).oldURL is "18446744073709552000"
+PASS new HashChangeEvent('eventType', { oldURL: NaN }).oldURL is "NaN"
+PASS new HashChangeEvent('eventType', { oldURL: [] }).oldURL is ""
+PASS new HashChangeEvent('eventType', { oldURL: [1, 2, 3] }).oldURL is "1,2,3"
+PASS new HashChangeEvent('eventType', { oldURL: {doremi: 12345} }).oldURL is "[object Object]"
+PASS new HashChangeEvent('eventType', { oldURL: {valueOf: function () { return 'doremi'; } } }).oldURL is "[object Object]"
+PASS new HashChangeEvent('eventType', { newURL: 'doremi' }).newURL is "doremi"
+PASS new HashChangeEvent('eventType', { newURL: '' }).newURL is ""
+PASS new HashChangeEvent('eventType', { newURL: undefined }).newURL is "undefined"
+PASS new HashChangeEvent('eventType', { newURL: null }).newURL is "null"
+PASS new HashChangeEvent('eventType', { newURL: false }).newURL is "false"
+PASS new HashChangeEvent('eventType', { newURL: true }).newURL is "true"
+PASS new HashChangeEvent('eventType', { newURL: 12345 }).newURL is "12345"
+PASS new HashChangeEvent('eventType', { newURL: 18446744073709551615 }).newURL is "18446744073709552000"
+PASS new HashChangeEvent('eventType', { newURL: NaN }).newURL is "NaN"
+PASS new HashChangeEvent('eventType', { newURL: [] }).newURL is ""
+PASS new HashChangeEvent('eventType', { newURL: [1, 2, 3] }).newURL is "1,2,3"
+PASS new HashChangeEvent('eventType', { newURL: {doremi: 12345} }).newURL is "[object Object]"
+PASS new HashChangeEvent('eventType', { newURL: {valueOf: function () { return 'doremi'; } } }).newURL is "[object Object]"
+PASS new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).bubbles is true
+PASS new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).cancelable is true
+PASS new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).oldURL is "doremi"
+PASS new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).newURL is "andre"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/constructors/hash-change-event-constructor.html (0 => 94962)
--- trunk/LayoutTests/fast/events/constructors/hash-change-event-constructor.html (rev 0)
+++ trunk/LayoutTests/fast/events/constructors/hash-change-event-constructor.html 2011-09-12 17:40:55 UTC (rev 94962)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("This tests the constructor for the HashChangeEvent DOM class.");
+
+// No initializer is passed.
+shouldBe("new HashChangeEvent('eventType').bubbles", "false");
+shouldBe("new HashChangeEvent('eventType').cancelable", "false");
+shouldBeEqualToString("new HashChangeEvent('eventType').oldURL", "");
+shouldBeEqualToString("new HashChangeEvent('eventType').newURL", "");
+
+// bubbles is passed.
+shouldBe("new HashChangeEvent('eventType', { bubbles: false }).bubbles", "false");
+shouldBe("new HashChangeEvent('eventType', { bubbles: true }).bubbles", "true");
+
+// cancelable is passed.
+shouldBe("new HashChangeEvent('eventType', { cancelable: false }).cancelable", "false");
+shouldBe("new HashChangeEvent('eventType', { cancelable: true }).cancelable", "true");
+
+// oldURL or newURL is passed.
+["oldURL", "newURL"].forEach(function (attr) {
+ // Strings.
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": 'doremi' })." + attr, "doremi");
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": '' })." + attr, "");
+
+ // Non-strings.
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": undefined })." + attr, "undefined");
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": null })." + attr, "null");
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": false })." + attr, "false");
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": true })." + attr, "true");
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": 12345 })." + attr, "12345");
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": 18446744073709551615 })." + attr, "18446744073709552000");
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": NaN })." + attr, "NaN");
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": [] })." + attr, "");
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": [1, 2, 3] })." + attr, "1,2,3");
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": {doremi: 12345} })." + attr, "[object Object]");
+ shouldBeEqualToString("new HashChangeEvent('eventType', { " + attr + ": {valueOf: function () { return 'doremi'; } } })." + attr, "[object Object]");
+});
+
+// All initializers are passed.
+shouldBe("new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).bubbles", "true");
+shouldBe("new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).cancelable", "true");
+shouldBeEqualToString("new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).oldURL", "doremi");
+shouldBeEqualToString("new HashChangeEvent('eventType', { bubbles: true, cancelable: true, oldURL: 'doremi', newURL: 'andre' }).newURL", "andre");
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (94961 => 94962)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-09-12 17:31:05 UTC (rev 94961)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-09-12 17:40:55 UTC (rev 94962)
@@ -83,6 +83,9 @@
BUGCR10395 SKIP : svg/custom/image-with-prefix-in-webarchive.svg = PASS FAIL
BUGCR10395 SKIP : http/tests/webarchive = PASS FAIL
+// This will soon be fixed after implementing a HashChangeEvent constructor for V8.
+BUGWK67924 : fast/events/constructors/hash-change-event-constructor.html = FAIL
+
// According to the Chromium bug, we need to write some sort of workaround for
// how clipboards on Windows work, or something? That doesn't explain why this
// fails for other platforms...
Modified: trunk/Source/WebCore/ChangeLog (94961 => 94962)
--- trunk/Source/WebCore/ChangeLog 2011-09-12 17:31:05 UTC (rev 94961)
+++ trunk/Source/WebCore/ChangeLog 2011-09-12 17:40:55 UTC (rev 94962)
@@ -1,3 +1,23 @@
+2011-09-12 Kentaro Hara <hara...@google.com>
+
+ Implement a HashChangeEvent constructor for JSC
+ https://bugs.webkit.org/show_bug.cgi?id=67924
+
+ Reviewed by Sam Weinig.
+
+ The spec for the HashChangeEvent constructor is here:
+ http://www.whatwg.org/specs/web-apps/current-work/#hashchangeevent
+
+ Test: fast/events/constructors/hash-change-event-constructor.html
+
+ * bindings/generic/EventConstructors.h: Added a definition for the HashChangeEvent constructor.
+ * bindings/js/JSEventConstructors.cpp: Added #includes for HashChangeEvent.
+ * dom/HashChangeEvent.h: Added a definition for HashChangeEventInit.
+ (WebCore::HashChangeEventInit::HashChangeEventInit):
+ (WebCore::HashChangeEvent::create):
+ (WebCore::HashChangeEvent::HashChangeEvent):
+ * dom/HashChangeEvent.idl: Makes HashChangeEvent constructible.
+
2011-09-12 Mike Reed <r...@google.com>
[skia] remove dead code, no functionality change
Modified: trunk/Source/WebCore/bindings/generic/EventConstructors.h (94961 => 94962)
--- trunk/Source/WebCore/bindings/generic/EventConstructors.h 2011-09-12 17:31:05 UTC (rev 94961)
+++ trunk/Source/WebCore/bindings/generic/EventConstructors.h 2011-09-12 17:40:55 UTC (rev 94962)
@@ -59,12 +59,21 @@
FILL_PROPERTY(elapsedTime) \
DICTIONARY_END(WebKitAnimationEvent)
+#define INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_HASH_CHANGE_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
+ \
+ DICTIONARY_START(HashChangeEvent) \
+ FILL_PARENT_PROPERTIES(Event) \
+ FILL_PROPERTY(oldURL) \
+ FILL_PROPERTY(newURL) \
+ DICTIONARY_END(HashChangeEvent)
+
#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_CUSTOM_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_PROGRESS_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_WEBKIT_ANIMATION_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
+ INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_HASH_CHANGE_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp (94961 => 94962)
--- trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp 2011-09-12 17:31:05 UTC (rev 94961)
+++ trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp 2011-09-12 17:40:55 UTC (rev 94962)
@@ -28,9 +28,11 @@
#include "CustomEvent.h"
#include "Event.h"
+#include "HashChangeEvent.h"
#include "JSCustomEvent.h"
#include "JSDictionary.h"
#include "JSEvent.h"
+#include "JSHashChangeEvent.h"
#include "JSProgressEvent.h"
#include "JSWebKitAnimationEvent.h"
#include "ProgressEvent.h"
Modified: trunk/Source/WebCore/dom/HashChangeEvent.h (94961 => 94962)
--- trunk/Source/WebCore/dom/HashChangeEvent.h 2011-09-12 17:31:05 UTC (rev 94961)
+++ trunk/Source/WebCore/dom/HashChangeEvent.h 2011-09-12 17:40:55 UTC (rev 94962)
@@ -26,6 +26,15 @@
namespace WebCore {
+struct HashChangeEventInit : public EventInit {
+ HashChangeEventInit()
+ {
+ };
+
+ String oldURL;
+ String newURL;
+};
+
class HashChangeEvent : public Event {
public:
virtual bool isHashChangeEvent() const { return true; }
@@ -40,6 +49,11 @@
return adoptRef(new HashChangeEvent(oldURL, newURL));
}
+ static PassRefPtr<HashChangeEvent> create(const AtomicString& type, const HashChangeEventInit& initializer)
+ {
+ return adoptRef(new HashChangeEvent(type, initializer));
+ }
+
void initHashChangeEvent(const AtomicString& eventType, bool canBubble, bool cancelable, const String& oldURL, const String& newURL)
{
if (dispatched())
@@ -66,6 +80,13 @@
{
}
+ HashChangeEvent(const AtomicString& type, const HashChangeEventInit& initializer)
+ : Event(type, initializer)
+ , m_oldURL(initializer.oldURL)
+ , m_newURL(initializer.newURL)
+ {
+ }
+
String m_oldURL;
String m_newURL;
};
Modified: trunk/Source/WebCore/dom/HashChangeEvent.idl (94961 => 94962)
--- trunk/Source/WebCore/dom/HashChangeEvent.idl 2011-09-12 17:31:05 UTC (rev 94961)
+++ trunk/Source/WebCore/dom/HashChangeEvent.idl 2011-09-12 17:40:55 UTC (rev 94962)
@@ -21,7 +21,8 @@
// Introduced in http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#event-hashchange
interface [
- GenerateConstructor
+ CanBeConstructed,
+ CustomConstructFunction
] HashChangeEvent : Event {
void initHashChangeEvent(in [Optional=CallWithDefaultValue] DOMString type,
in [Optional=CallWithDefaultValue] boolean canBubble,