| Differences between
and this patch
- a/LayoutTests/ChangeLog +11 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2011-09-07  Kentaro Hara  <haraken@google.com>
2
3
        Implement a ProgressEvent constructor for JSC
4
        https://bugs.webkit.org/show_bug.cgi?id=67537
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * fast/events/constructors/progress-event-constructor-expected.txt: Added.
9
        * fast/events/constructors/progress-event-constructor.html: Added. Checks the behavior of the ProgressEvent constructor.
10
        * platform/chromium/test_expectations.txt: Skipped progress-event-constructor.html, since V8 does not yet have the ProgressEvent constructor.
11
1
2011-09-06  Pavel Podivilov  <podivilov@chromium.org>
12
2011-09-06  Pavel Podivilov  <podivilov@chromium.org>
2
13
3
        Web Inspector: do not re-create RawSourceCode when toggling pretty-print mode.
14
        Web Inspector: do not re-create RawSourceCode when toggling pretty-print mode.
- a/LayoutTests/fast/events/constructors/progress-event-constructor-expected.txt +65 lines
Line 0 a/LayoutTests/fast/events/constructors/progress-event-constructor-expected.txt_sec1
1
This tests the constructor for the ProgressEvent DOM class.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS new ProgressEvent('eventType').bubbles is false
7
PASS new ProgressEvent('eventType').cancelable is false
8
PASS new ProgressEvent('eventType').lengthComputable is false
9
PASS new ProgressEvent('eventType').loaded is 0
10
PASS new ProgressEvent('eventType').total is 0
11
PASS new ProgressEvent('eventType', { bubbles: false }).bubbles is false
12
PASS new ProgressEvent('eventType', { bubbles: true }).bubbles is true
13
PASS new ProgressEvent('eventType', { cancelable: false }).cancelable is false
14
PASS new ProgressEvent('eventType', { cancelable: true }).cancelable is true
15
PASS new ProgressEvent('eventType', { lengthComputable: false }).lengthComputable is false
16
PASS new ProgressEvent('eventType', { lengthComputable: true }).lengthComputable is true
17
PASS new ProgressEvent('eventType', { loaded: 0 }).loaded is 0
18
PASS new ProgressEvent('eventType', { loaded: 1 }).loaded is 1
19
PASS new ProgressEvent('eventType', { loaded: 9007199254740990 }).loaded is 9007199254740990
20
PASS new ProgressEvent('eventType', { loaded: 9007199254740991 }).loaded is 9007199254740991
21
PASS new ProgressEvent('eventType', { loaded: 18446744073709551615 }).loaded is 0
22
PASS new ProgressEvent('eventType', { loaded: 12345678901234567890 }).loaded is 12345678901234567168
23
PASS new ProgressEvent('eventType', { loaded: -1 }).loaded is 18446744073709551615
24
PASS new ProgressEvent('eventType', { loaded: NaN }).loaded is 0
25
PASS new ProgressEvent('eventType', { loaded: 123.45 }).loaded is 123
26
PASS new ProgressEvent('eventType', { loaded: undefined }).loaded is 0
27
PASS new ProgressEvent('eventType', { loaded: null }).loaded is 0
28
PASS new ProgressEvent('eventType', { loaded: '' }).loaded is 0
29
PASS new ProgressEvent('eventType', { loaded: '1' }).loaded is 1
30
PASS new ProgressEvent('eventType', { loaded: '1a' }).loaded is 0
31
PASS new ProgressEvent('eventType', { loaded: 'abc' }).loaded is 0
32
PASS new ProgressEvent('eventType', { loaded: [] }).loaded is 0
33
PASS new ProgressEvent('eventType', { loaded: [1] }).loaded is 1
34
PASS new ProgressEvent('eventType', { loaded: [1, 2] }).loaded is 0
35
PASS new ProgressEvent('eventType', { loaded: {} }).loaded is 0
36
PASS new ProgressEvent('eventType', { loaded: {moe: 1} }).loaded is 0
37
PASS new ProgressEvent('eventType', { total: 0 }).total is 0
38
PASS new ProgressEvent('eventType', { total: 1 }).total is 1
39
PASS new ProgressEvent('eventType', { total: 9007199254740990 }).total is 9007199254740990
40
PASS new ProgressEvent('eventType', { total: 9007199254740991 }).total is 9007199254740991
41
PASS new ProgressEvent('eventType', { total: 18446744073709551615 }).total is 0
42
PASS new ProgressEvent('eventType', { total: 12345678901234567890 }).total is 12345678901234567168
43
PASS new ProgressEvent('eventType', { total: -1 }).total is 18446744073709551615
44
PASS new ProgressEvent('eventType', { total: NaN }).total is 0
45
PASS new ProgressEvent('eventType', { total: 123.45 }).total is 123
46
PASS new ProgressEvent('eventType', { total: undefined }).total is 0
47
PASS new ProgressEvent('eventType', { total: null }).total is 0
48
PASS new ProgressEvent('eventType', { total: '' }).total is 0
49
PASS new ProgressEvent('eventType', { total: '1' }).total is 1
50
PASS new ProgressEvent('eventType', { total: '1a' }).total is 0
51
PASS new ProgressEvent('eventType', { total: 'abc' }).total is 0
52
PASS new ProgressEvent('eventType', { total: [] }).total is 0
53
PASS new ProgressEvent('eventType', { total: [1] }).total is 1
54
PASS new ProgressEvent('eventType', { total: [1, 2] }).total is 0
55
PASS new ProgressEvent('eventType', { total: {} }).total is 0
56
PASS new ProgressEvent('eventType', { total: {moe: 1} }).total is 0
57
PASS new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).bubbles is true
58
PASS new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).cancelable is true
59
PASS new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).lengthComputable is true
60
PASS new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).loaded is 12345
61
PASS new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).total is 12345
62
PASS successfullyParsed is true
63
64
TEST COMPLETE
65
- a/LayoutTests/fast/events/constructors/progress-event-constructor.html +80 lines
Line 0 a/LayoutTests/fast/events/constructors/progress-event-constructor.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<link rel="stylesheet" href="../../js/resources/js-test-style.css">
5
<script src="../../js/resources/js-test-pre.js"></script>
6
</head>
7
<body>
8
<p id="description"></p>
9
<div id="console"></div>
10
<script>
11
12
description("This tests the constructor for the ProgressEvent DOM class.");
13
14
// No initializer is passed.
15
shouldBe("new ProgressEvent('eventType').bubbles", "false");
16
shouldBe("new ProgressEvent('eventType').cancelable", "false");
17
shouldBe("new ProgressEvent('eventType').lengthComputable", "false");
18
shouldBe("new ProgressEvent('eventType').loaded", "0");
19
shouldBe("new ProgressEvent('eventType').total", "0");
20
21
// bubbles is passed.
22
shouldBe("new ProgressEvent('eventType', { bubbles: false }).bubbles", "false");
23
shouldBe("new ProgressEvent('eventType', { bubbles: true }).bubbles", "true");
24
25
// cancelable is passed.
26
shouldBe("new ProgressEvent('eventType', { cancelable: false }).cancelable", "false");
27
shouldBe("new ProgressEvent('eventType', { cancelable: true }).cancelable", "true");
28
29
// lengthComputable is passed.
30
shouldBe("new ProgressEvent('eventType', { lengthComputable: false }).lengthComputable", "false");
31
shouldBe("new ProgressEvent('eventType', { lengthComputable: true }).lengthComputable", "true");
32
33
// loaded or total is passed.
34
["loaded", "total"].forEach(function (attr) {
35
    // [0, 2^53 - 1]. A value that is in the unsigned long long range and can be exactly represented as a double.
36
    shouldBe("new ProgressEvent('eventType', { " + attr + ": 0 })." + attr, "0");
37
    shouldBe("new ProgressEvent('eventType', { " + attr + ": 1 })." + attr, "1");
38
    shouldBe("new ProgressEvent('eventType', { " + attr + ": 9007199254740990 })." + attr, "9007199254740990");
39
    shouldBe("new ProgressEvent('eventType', { " + attr + ": 9007199254740991 })." + attr, "9007199254740991");
40
41
    // [2^53, 2^64 - 1]. A value that is in the unsigned long long range but cannot be represented as a double.
42
    // Spec: http://www.w3.org/TR/WebIDL/#es-unsigned-long-long
43
    shouldBe("new ProgressEvent('eventType', { " + attr + ": 18446744073709551615 })." + attr, "0");
44
    shouldBe("new ProgressEvent('eventType', { " + attr + ": 12345678901234567890 })." + attr, "12345678901234567168");
45
46
    // A negative number.
47
    shouldBe("new ProgressEvent('eventType', { " + attr + ": -1 })." + attr, "18446744073709551615");
48
49
    // NaN.
50
    shouldBe("new ProgressEvent('eventType', { " + attr + ": NaN })." + attr, "0");
51
52
    // A double.
53
    shouldBe("new ProgressEvent('eventType', { " + attr + ": 123.45 })." + attr, "123");
54
55
    // Non-numeric values.
56
    shouldBe("new ProgressEvent('eventType', { " + attr + ": undefined })." + attr, "0");
57
    shouldBe("new ProgressEvent('eventType', { " + attr + ": null })." + attr, "0");
58
    shouldBe("new ProgressEvent('eventType', { " + attr + ": '' })." + attr, "0");
59
    shouldBe("new ProgressEvent('eventType', { " + attr + ": '1' })." + attr, "1");
60
    shouldBe("new ProgressEvent('eventType', { " + attr + ": '1a' })." + attr, "0");
61
    shouldBe("new ProgressEvent('eventType', { " + attr + ": 'abc' })." + attr, "0");
62
    shouldBe("new ProgressEvent('eventType', { " + attr + ": [] })." + attr, "0");
63
    shouldBe("new ProgressEvent('eventType', { " + attr + ": [1] })." + attr, "1");
64
    shouldBe("new ProgressEvent('eventType', { " + attr + ": [1, 2] })." + attr, "0");
65
    shouldBe("new ProgressEvent('eventType', { " + attr + ": {} })." + attr, "0");
66
    shouldBe("new ProgressEvent('eventType', { " + attr + ": {moe: 1} })." + attr, "0");
67
});
68
69
// All initializers are passed.
70
shouldBe("new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).bubbles", "true");
71
shouldBe("new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).cancelable", "true");
72
shouldBe("new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).lengthComputable", "true");
73
shouldBe("new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).loaded", "12345");
74
shouldBe("new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).total", "12345");
75
76
var successfullyParsed = true;
77
</script>
78
<script src="../../js/resources/js-test-post.js"></script>
79
</body>
80
</html>
- a/LayoutTests/platform/chromium/test_expectations.txt +3 lines
Lines 501-506 BUGCR20519 WIN : fast/text/wide-zero-width-space.html = FAIL a/LayoutTests/platform/chromium/test_expectations.txt_sec1
501
// There's a missing glyph box in "full-time".
501
// There's a missing glyph box in "full-time".
502
BUGCR20547 WIN : fast/text/capitalize-boundaries.html = FAIL
502
BUGCR20547 WIN : fast/text/capitalize-boundaries.html = FAIL
503
503
504
// This will soon be fixed after implementing a ProgressEvent constructor for V8.
505
BUGWK67537 : fast/events/constructors/progress-event-constructor.html = FAIL
506
504
// Different button line-heights, our behavior looks wrong.
507
// Different button line-heights, our behavior looks wrong.
505
BUGCR20551 LINUX WIN : fast/replaced/table-percent-height.html = FAIL
508
BUGCR20551 LINUX WIN : fast/replaced/table-percent-height.html = FAIL
506
BUGCR20551 LINUX WIN : fast/replaced/table-percent-height-text-controls.html = FAIL
509
BUGCR20551 LINUX WIN : fast/replaced/table-percent-height-text-controls.html = FAIL
- a/Source/WebCore/ChangeLog +23 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-09-07  Kentaro Hara  <haraken@google.com>
2
3
        Implement a ProgressEvent constructor for JSC
4
        https://bugs.webkit.org/show_bug.cgi?id=67537
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        The spec for the ProgressEvent constructor is here:
9
        http://www.w3.org/TR/progress-events/#interface-progressevent
10
11
        Test: fast/events/constructors/progress-event-constructor.html
12
13
        * bindings/generic/EventConstructors.h: Added a definition for the ProgressEvent constructor.
14
        * bindings/js/JSDictionary.cpp:
15
        (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
16
        * bindings/js/JSEventConstructors.cpp: Added #includes for ProgressEvent.
17
        * dom/ProgressEvent.cpp:
18
        (WebCore::ProgressEventInit::ProgressEventInit):
19
        (WebCore::ProgressEvent::ProgressEvent):
20
        * dom/ProgressEvent.h: Added a definition for ProgressEventInit.
21
        (WebCore::ProgressEvent::create):
22
        * dom/ProgressEvent.idl: Makes ProgressEvent constructible.
23
1
2011-09-06  Pavel Podivilov  <podivilov@chromium.org>
24
2011-09-06  Pavel Podivilov  <podivilov@chromium.org>
2
25
3
        Web Inspector: do not re-create RawSourceCode when toggling pretty-print mode.
26
        Web Inspector: do not re-create RawSourceCode when toggling pretty-print mode.
- a/Source/WebCore/bindings/generic/EventConstructors.h +10 lines
Lines 42-51 namespace WebCore { a/Source/WebCore/bindings/generic/EventConstructors.h_sec1
42
        FILL_PROPERTY(detail) \
42
        FILL_PROPERTY(detail) \
43
    DICTIONARY_END(CustomEvent)
43
    DICTIONARY_END(CustomEvent)
44
44
45
#define INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_PROGRESS_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
46
    \
47
    DICTIONARY_START(ProgressEvent) \
48
        FILL_PARENT_PROPERTIES(Event) \
49
        FILL_PROPERTY(lengthComputable) \
50
        FILL_PROPERTY(loaded) \
51
        FILL_PROPERTY(total) \
52
    DICTIONARY_END(ProgressEvent)
53
45
54
46
#define INSTANTIATE_ALL_EVENT_INITIALIZING_CONSTRUCTORS(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
55
#define INSTANTIATE_ALL_EVENT_INITIALIZING_CONSTRUCTORS(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
47
    INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
56
    INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
48
    INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_CUSTOM_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
57
    INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_CUSTOM_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
58
    INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_PROGRESS_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
49
59
50
} // namespace WebCore
60
} // namespace WebCore
51
61
- a/Source/WebCore/bindings/js/JSDictionary.cpp -1 / +7 lines
Lines 37-42 using namespace JSC; a/Source/WebCore/bindings/js/JSDictionary.cpp_sec1
37
37
38
namespace WebCore {
38
namespace WebCore {
39
39
40
static const double D64 = 18446744073709551616.0;
41
40
JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propertyName, JSValue& finalResult)
42
JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propertyName, JSValue& finalResult)
41
{
43
{
42
    Identifier identifier(m_exec, propertyName);
44
    Identifier identifier(m_exec, propertyName);
Lines 77-83 void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned short& a/Source/WebCore/bindings/js/JSDictionary.cpp_sec2
77
79
78
void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long long& result)
80
void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long long& result)
79
{
81
{
80
    result = static_cast<unsigned long long>(value.toInteger(exec));
82
    double d = value.toNumber(exec);
83
    if (isnan(d) || isinf(d))
84
        result = 0;
85
    else
86
        result = static_cast<unsigned long long>(fmod(trunc(d), D64));
81
}
87
}
82
88
83
void JSDictionary::convertValue(ExecState* exec, JSValue value, double& result)
89
void JSDictionary::convertValue(ExecState* exec, JSValue value, double& result)
- a/Source/WebCore/bindings/js/JSEventConstructors.cpp +2 lines
Lines 31-36 a/Source/WebCore/bindings/js/JSEventConstructors.cpp_sec1
31
#include "JSCustomEvent.h"
31
#include "JSCustomEvent.h"
32
#include "JSDictionary.h"
32
#include "JSDictionary.h"
33
#include "JSEvent.h"
33
#include "JSEvent.h"
34
#include "JSProgressEvent.h"
35
#include "ProgressEvent.h"
34
#include <runtime/Error.h>
36
#include <runtime/Error.h>
35
37
36
using namespace JSC;
38
using namespace JSC;
- a/Source/WebCore/dom/ProgressEvent.cpp -1 / +16 lines
Lines 27-33 a/Source/WebCore/dom/ProgressEvent.cpp_sec1
27
#include "ProgressEvent.h"
27
#include "ProgressEvent.h"
28
28
29
namespace WebCore {
29
namespace WebCore {
30
    
30
31
ProgressEventInit::ProgressEventInit()
32
    : lengthComputable(false)
33
    , loaded(0)
34
    , total(0)
35
{
36
}
37
31
ProgressEvent::ProgressEvent()
38
ProgressEvent::ProgressEvent()
32
    : m_lengthComputable(false)
39
    : m_lengthComputable(false)
33
    , m_loaded(0)
40
    , m_loaded(0)
Lines 35-40 ProgressEvent::ProgressEvent() a/Source/WebCore/dom/ProgressEvent.cpp_sec2
35
{
42
{
36
}
43
}
37
44
45
ProgressEvent::ProgressEvent(const AtomicString& type, const ProgressEventInit& initializer)
46
    : Event(type, initializer)
47
    , m_lengthComputable(initializer.lengthComputable)
48
    , m_loaded(initializer.loaded)
49
    , m_total(initializer.total)
50
{
51
}
52
38
ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total)
53
ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total)
39
    : Event(type, false, true)
54
    : Event(type, false, true)
40
    , m_lengthComputable(lengthComputable)
55
    , m_lengthComputable(lengthComputable)
- a/Source/WebCore/dom/ProgressEvent.h -1 / +14 lines
Lines 29-35 a/Source/WebCore/dom/ProgressEvent.h_sec1
29
#include "Event.h"
29
#include "Event.h"
30
30
31
namespace WebCore {
31
namespace WebCore {
32
    
32
33
struct ProgressEventInit : public EventInit {
34
    ProgressEventInit();
35
36
    bool lengthComputable;
37
    unsigned long long loaded;
38
    unsigned long long total;
39
};
40
33
class ProgressEvent : public Event {
41
class ProgressEvent : public Event {
34
public:
42
public:
35
    static PassRefPtr<ProgressEvent> create()
43
    static PassRefPtr<ProgressEvent> create()
Lines 40-45 public: a/Source/WebCore/dom/ProgressEvent.h_sec2
40
    {
48
    {
41
        return adoptRef(new ProgressEvent(type, lengthComputable, loaded, total));
49
        return adoptRef(new ProgressEvent(type, lengthComputable, loaded, total));
42
    }
50
    }
51
    static PassRefPtr<ProgressEvent> create(const AtomicString& type, const ProgressEventInit& initializer)
52
    {
53
        return adoptRef(new ProgressEvent(type, initializer));
54
    }
43
55
44
    void initProgressEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg,
56
    void initProgressEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg,
45
        bool lengthComputableArg, unsigned long long loadedArg, unsigned long long totalArg);
57
        bool lengthComputableArg, unsigned long long loadedArg, unsigned long long totalArg);
Lines 51-56 public: a/Source/WebCore/dom/ProgressEvent.h_sec3
51
protected:
63
protected:
52
    ProgressEvent();
64
    ProgressEvent();
53
    ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total);
65
    ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total);
66
    ProgressEvent(const AtomicString& type, const ProgressEventInit& initializer);
54
67
55
private:
68
private:
56
    virtual bool isProgressEvent() const { return true; }
69
    virtual bool isProgressEvent() const { return true; }
- a/Source/WebCore/dom/ProgressEvent.idl -1 / +4 lines
Lines 25-31 a/Source/WebCore/dom/ProgressEvent.idl_sec1
25
25
26
module events {
26
module events {
27
27
28
    interface ProgressEvent : Event {
28
    interface [
29
        CanBeConstructed,
30
        CustomConstructFunction
31
    ] ProgressEvent : Event {
29
        readonly attribute boolean lengthComputable;
32
        readonly attribute boolean lengthComputable;
30
        readonly attribute unsigned long long loaded;
33
        readonly attribute unsigned long long loaded;
31
        readonly attribute unsigned long long total;
34
        readonly attribute unsigned long long total;

Return to Bug 67537