Diff
Modified: trunk/LayoutTests/ChangeLog (94770 => 94771)
--- trunk/LayoutTests/ChangeLog 2011-09-08 18:22:11 UTC (rev 94770)
+++ trunk/LayoutTests/ChangeLog 2011-09-08 18:28:42 UTC (rev 94771)
@@ -1,3 +1,14 @@
+2011-09-08 Kentaro Hara <hara...@google.com>
+
+ Implement a ProgressEvent constructor for JSC
+ https://bugs.webkit.org/show_bug.cgi?id=67537
+
+ Reviewed by Sam Weinig.
+
+ * fast/events/constructors/progress-event-constructor-expected.txt: Added.
+ * fast/events/constructors/progress-event-constructor.html: Added. Checks the behavior of the ProgressEvent constructor.
+ * platform/chromium/test_expectations.txt: Skipped progress-event-constructor.html, since V8 does not yet have the ProgressEvent constructor.
+
2011-09-08 Nate Chapin <jap...@chromium.org>
Rebaseline svg/W3C-SVG-1.1-SE/filters-image-05-f.svg text for chromium win/linux.
Added: trunk/LayoutTests/fast/events/constructors/progress-event-constructor-expected.txt (0 => 94771)
--- trunk/LayoutTests/fast/events/constructors/progress-event-constructor-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/constructors/progress-event-constructor-expected.txt 2011-09-08 18:28:42 UTC (rev 94771)
@@ -0,0 +1,67 @@
+This tests the constructor for the ProgressEvent DOM class.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS new ProgressEvent('eventType').bubbles is false
+PASS new ProgressEvent('eventType').cancelable is false
+PASS new ProgressEvent('eventType').lengthComputable is false
+PASS new ProgressEvent('eventType').loaded is 0
+PASS new ProgressEvent('eventType').total is 0
+PASS new ProgressEvent('eventType', { bubbles: false }).bubbles is false
+PASS new ProgressEvent('eventType', { bubbles: true }).bubbles is true
+PASS new ProgressEvent('eventType', { cancelable: false }).cancelable is false
+PASS new ProgressEvent('eventType', { cancelable: true }).cancelable is true
+PASS new ProgressEvent('eventType', { lengthComputable: false }).lengthComputable is false
+PASS new ProgressEvent('eventType', { lengthComputable: true }).lengthComputable is true
+PASS new ProgressEvent('eventType', { loaded: 0 }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: 1 }).loaded is 1
+PASS new ProgressEvent('eventType', { loaded: 9007199254740990 }).loaded is 9007199254740990
+PASS new ProgressEvent('eventType', { loaded: 9007199254740991 }).loaded is 9007199254740991
+PASS new ProgressEvent('eventType', { loaded: 18446744073709551615 }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: 12345678901234567890 }).loaded is 12345678901234567168
+PASS new ProgressEvent('eventType', { loaded: -1 }).loaded is 18446744073709551615
+PASS new ProgressEvent('eventType', { loaded: NaN }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: 123.45 }).loaded is 123
+PASS new ProgressEvent('eventType', { loaded: undefined }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: null }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: '' }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: '12345' }).loaded is 12345
+PASS new ProgressEvent('eventType', { loaded: '12345a' }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: 'abc' }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: [] }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: [12345] }).loaded is 12345
+PASS new ProgressEvent('eventType', { loaded: [12345, 67890] }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: {} }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: {moe: 12345} }).loaded is 0
+PASS new ProgressEvent('eventType', { loaded: {valueOf: function () { return 12345; }} }).loaded is 12345
+PASS new ProgressEvent('eventType', { total: 0 }).total is 0
+PASS new ProgressEvent('eventType', { total: 1 }).total is 1
+PASS new ProgressEvent('eventType', { total: 9007199254740990 }).total is 9007199254740990
+PASS new ProgressEvent('eventType', { total: 9007199254740991 }).total is 9007199254740991
+PASS new ProgressEvent('eventType', { total: 18446744073709551615 }).total is 0
+PASS new ProgressEvent('eventType', { total: 12345678901234567890 }).total is 12345678901234567168
+PASS new ProgressEvent('eventType', { total: -1 }).total is 18446744073709551615
+PASS new ProgressEvent('eventType', { total: NaN }).total is 0
+PASS new ProgressEvent('eventType', { total: 123.45 }).total is 123
+PASS new ProgressEvent('eventType', { total: undefined }).total is 0
+PASS new ProgressEvent('eventType', { total: null }).total is 0
+PASS new ProgressEvent('eventType', { total: '' }).total is 0
+PASS new ProgressEvent('eventType', { total: '12345' }).total is 12345
+PASS new ProgressEvent('eventType', { total: '12345a' }).total is 0
+PASS new ProgressEvent('eventType', { total: 'abc' }).total is 0
+PASS new ProgressEvent('eventType', { total: [] }).total is 0
+PASS new ProgressEvent('eventType', { total: [12345] }).total is 12345
+PASS new ProgressEvent('eventType', { total: [12345, 67890] }).total is 0
+PASS new ProgressEvent('eventType', { total: {} }).total is 0
+PASS new ProgressEvent('eventType', { total: {moe: 12345} }).total is 0
+PASS new ProgressEvent('eventType', { total: {valueOf: function () { return 12345; }} }).total is 12345
+PASS new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).bubbles is true
+PASS new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).cancelable is true
+PASS new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).lengthComputable is true
+PASS new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).loaded is 12345
+PASS new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).total is 12345
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/constructors/progress-event-constructor.html (0 => 94771)
--- trunk/LayoutTests/fast/events/constructors/progress-event-constructor.html (rev 0)
+++ trunk/LayoutTests/fast/events/constructors/progress-event-constructor.html 2011-09-08 18:28:42 UTC (rev 94771)
@@ -0,0 +1,81 @@
+<!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 ProgressEvent DOM class.");
+
+// No initializer is passed.
+shouldBe("new ProgressEvent('eventType').bubbles", "false");
+shouldBe("new ProgressEvent('eventType').cancelable", "false");
+shouldBe("new ProgressEvent('eventType').lengthComputable", "false");
+shouldBe("new ProgressEvent('eventType').loaded", "0");
+shouldBe("new ProgressEvent('eventType').total", "0");
+
+// bubbles is passed.
+shouldBe("new ProgressEvent('eventType', { bubbles: false }).bubbles", "false");
+shouldBe("new ProgressEvent('eventType', { bubbles: true }).bubbles", "true");
+
+// cancelable is passed.
+shouldBe("new ProgressEvent('eventType', { cancelable: false }).cancelable", "false");
+shouldBe("new ProgressEvent('eventType', { cancelable: true }).cancelable", "true");
+
+// lengthComputable is passed.
+shouldBe("new ProgressEvent('eventType', { lengthComputable: false }).lengthComputable", "false");
+shouldBe("new ProgressEvent('eventType', { lengthComputable: true }).lengthComputable", "true");
+
+// loaded or total is passed.
+["loaded", "total"].forEach(function (attr) {
+ // [0, 2^53 - 1]. A value that is in the unsigned long long range and can be exactly represented as a double.
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": 0 })." + attr, "0");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": 1 })." + attr, "1");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": 9007199254740990 })." + attr, "9007199254740990");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": 9007199254740991 })." + attr, "9007199254740991");
+
+ // [2^53, 2^64 - 1]. A value that is in the unsigned long long range but cannot be represented as a double.
+ // Spec: http://www.w3.org/TR/WebIDL/#es-unsigned-long-long
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": 18446744073709551615 })." + attr, "0");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": 12345678901234567890 })." + attr, "12345678901234567168");
+
+ // A negative number.
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": -1 })." + attr, "18446744073709551615");
+
+ // NaN.
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": NaN })." + attr, "0");
+
+ // A double.
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": 123.45 })." + attr, "123");
+
+ // Non-numeric values.
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": undefined })." + attr, "0");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": null })." + attr, "0");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": '' })." + attr, "0");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": '12345' })." + attr, "12345");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": '12345a' })." + attr, "0");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": 'abc' })." + attr, "0");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": [] })." + attr, "0");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": [12345] })." + attr, "12345");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": [12345, 67890] })." + attr, "0");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": {} })." + attr, "0");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": {moe: 12345} })." + attr, "0");
+ shouldBe("new ProgressEvent('eventType', { " + attr + ": {valueOf: function () { return 12345; }} })." + attr, "12345");
+});
+
+// All initializers are passed.
+shouldBe("new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).bubbles", "true");
+shouldBe("new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).cancelable", "true");
+shouldBe("new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).lengthComputable", "true");
+shouldBe("new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).loaded", "12345");
+shouldBe("new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).total", "12345");
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (94770 => 94771)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-09-08 18:22:11 UTC (rev 94770)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-09-08 18:28:42 UTC (rev 94771)
@@ -504,6 +504,9 @@
// There's a missing glyph box in "full-time".
BUGCR20547 WIN : fast/text/capitalize-boundaries.html = FAIL
+// This will soon be fixed after implementing a ProgressEvent constructor for V8.
+BUGWK67537 : fast/events/constructors/progress-event-constructor.html = FAIL
+
// Different button line-heights, our behavior looks wrong.
BUGCR20551 LINUX WIN : fast/replaced/table-percent-height.html = FAIL
BUGCR20551 LINUX WIN : fast/replaced/table-percent-height-text-controls.html = FAIL
Modified: trunk/Source/WebCore/ChangeLog (94770 => 94771)
--- trunk/Source/WebCore/ChangeLog 2011-09-08 18:22:11 UTC (rev 94770)
+++ trunk/Source/WebCore/ChangeLog 2011-09-08 18:28:42 UTC (rev 94771)
@@ -1,3 +1,26 @@
+2011-09-08 Kentaro Hara <hara...@google.com>
+
+ Implement a ProgressEvent constructor for JSC
+ https://bugs.webkit.org/show_bug.cgi?id=67537
+
+ Reviewed by Sam Weinig.
+
+ The spec for the ProgressEvent constructor is here:
+ http://www.w3.org/TR/progress-events/#interface-progressevent
+
+ Test: fast/events/constructors/progress-event-constructor.html
+
+ * bindings/generic/EventConstructors.h: Added a definition for the ProgressEvent constructor.
+ * bindings/js/JSDictionary.cpp:
+ (WebCore::JSDictionary::convertValue): Converts an ECMA-262 Number into an IDL unsigned long long value. Spec: http://www.w3.org/TR/WebIDL/#es-unsigned-long-long
+ * bindings/js/JSEventConstructors.cpp: Added #includes for ProgressEvent.
+ * dom/ProgressEvent.cpp:
+ (WebCore::ProgressEventInit::ProgressEventInit):
+ (WebCore::ProgressEvent::ProgressEvent):
+ * dom/ProgressEvent.h: Added a definition for ProgressEventInit.
+ (WebCore::ProgressEvent::create):
+ * dom/ProgressEvent.idl: Makes ProgressEvent constructible.
+
2011-09-08 Ryosuke Niwa <rn...@webkit.org>
Make bindings tests quiet after r94701.
Modified: trunk/Source/WebCore/bindings/generic/EventConstructors.h (94770 => 94771)
--- trunk/Source/WebCore/bindings/generic/EventConstructors.h 2011-09-08 18:22:11 UTC (rev 94770)
+++ trunk/Source/WebCore/bindings/generic/EventConstructors.h 2011-09-08 18:28:42 UTC (rev 94771)
@@ -42,10 +42,20 @@
FILL_PROPERTY(detail) \
DICTIONARY_END(CustomEvent)
+#define INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_PROGRESS_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
+ \
+ DICTIONARY_START(ProgressEvent) \
+ FILL_PARENT_PROPERTIES(Event) \
+ FILL_PROPERTY(lengthComputable) \
+ FILL_PROPERTY(loaded) \
+ FILL_PROPERTY(total) \
+ DICTIONARY_END(ProgressEvent)
+
#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) \
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/js/JSDictionary.cpp (94770 => 94771)
--- trunk/Source/WebCore/bindings/js/JSDictionary.cpp 2011-09-08 18:22:11 UTC (rev 94770)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.cpp 2011-09-08 18:28:42 UTC (rev 94771)
@@ -37,6 +37,8 @@
namespace WebCore {
+static const double UnsignedLongLongMax = 18446744073709551616.0; // 2^64
+
JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propertyName, JSValue& finalResult)
{
Identifier identifier(m_exec, propertyName);
@@ -77,7 +79,11 @@
void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long long& result)
{
- result = static_cast<unsigned long long>(value.toInteger(exec));
+ double d = value.toNumber(exec);
+ if (isnan(d) || isinf(d))
+ result = 0;
+ else
+ result = static_cast<unsigned long long>(fmod(trunc(d), UnsignedLongLongMax));
}
void JSDictionary::convertValue(ExecState* exec, JSValue value, double& result)
Modified: trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp (94770 => 94771)
--- trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp 2011-09-08 18:22:11 UTC (rev 94770)
+++ trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp 2011-09-08 18:28:42 UTC (rev 94771)
@@ -31,6 +31,8 @@
#include "JSCustomEvent.h"
#include "JSDictionary.h"
#include "JSEvent.h"
+#include "JSProgressEvent.h"
+#include "ProgressEvent.h"
#include <runtime/Error.h>
using namespace JSC;
Modified: trunk/Source/WebCore/dom/ProgressEvent.cpp (94770 => 94771)
--- trunk/Source/WebCore/dom/ProgressEvent.cpp 2011-09-08 18:22:11 UTC (rev 94770)
+++ trunk/Source/WebCore/dom/ProgressEvent.cpp 2011-09-08 18:28:42 UTC (rev 94771)
@@ -27,7 +27,14 @@
#include "ProgressEvent.h"
namespace WebCore {
-
+
+ProgressEventInit::ProgressEventInit()
+ : lengthComputable(false)
+ , loaded(0)
+ , total(0)
+{
+}
+
ProgressEvent::ProgressEvent()
: m_lengthComputable(false)
, m_loaded(0)
@@ -35,6 +42,14 @@
{
}
+ProgressEvent::ProgressEvent(const AtomicString& type, const ProgressEventInit& initializer)
+ : Event(type, initializer)
+ , m_lengthComputable(initializer.lengthComputable)
+ , m_loaded(initializer.loaded)
+ , m_total(initializer.total)
+{
+}
+
ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total)
: Event(type, false, true)
, m_lengthComputable(lengthComputable)
Modified: trunk/Source/WebCore/dom/ProgressEvent.h (94770 => 94771)
--- trunk/Source/WebCore/dom/ProgressEvent.h 2011-09-08 18:22:11 UTC (rev 94770)
+++ trunk/Source/WebCore/dom/ProgressEvent.h 2011-09-08 18:28:42 UTC (rev 94771)
@@ -29,7 +29,15 @@
#include "Event.h"
namespace WebCore {
-
+
+struct ProgressEventInit : public EventInit {
+ ProgressEventInit();
+
+ bool lengthComputable;
+ unsigned long long loaded;
+ unsigned long long total;
+};
+
class ProgressEvent : public Event {
public:
static PassRefPtr<ProgressEvent> create()
@@ -40,6 +48,10 @@
{
return adoptRef(new ProgressEvent(type, lengthComputable, loaded, total));
}
+ static PassRefPtr<ProgressEvent> create(const AtomicString& type, const ProgressEventInit& initializer)
+ {
+ return adoptRef(new ProgressEvent(type, initializer));
+ }
void initProgressEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg,
bool lengthComputableArg, unsigned long long loadedArg, unsigned long long totalArg);
@@ -51,6 +63,7 @@
protected:
ProgressEvent();
ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total);
+ ProgressEvent(const AtomicString&, const ProgressEventInit&);
private:
virtual bool isProgressEvent() const { return true; }
Modified: trunk/Source/WebCore/dom/ProgressEvent.idl (94770 => 94771)
--- trunk/Source/WebCore/dom/ProgressEvent.idl 2011-09-08 18:22:11 UTC (rev 94770)
+++ trunk/Source/WebCore/dom/ProgressEvent.idl 2011-09-08 18:28:42 UTC (rev 94771)
@@ -25,7 +25,10 @@
module events {
- interface ProgressEvent : Event {
+ interface [
+ CanBeConstructed,
+ CustomConstructFunction
+ ] ProgressEvent : Event {
readonly attribute boolean lengthComputable;
readonly attribute unsigned long long loaded;
readonly attribute unsigned long long total;