diff options
author | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2010-09-26 21:26:24 +0000 |
---|---|---|
committer | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2010-09-26 21:26:24 +0000 |
commit | db8ebd8725794ceeb38e660702635fa0d61981a7 (patch) | |
tree | faf4107e254488addfca4394b75692bb7154fe6a /third_party/WebKit/LayoutTests/fast/js/script-tests/date-constructor.js | |
parent | 4d68c3041af6a240fd481555bbe5ad7652d72493 (diff) | |
download | chromium_src-db8ebd8725794ceeb38e660702635fa0d61981a7.zip chromium_src-db8ebd8725794ceeb38e660702635fa0d61981a7.tar.gz chromium_src-db8ebd8725794ceeb38e660702635fa0d61981a7.tar.bz2 |
2010-09-26 Mark Hahnenberg <mhahnenb@gmail.com>
Reviewed by Oliver Hunt.
valueOf called in wrong order in atan2 and date constructors.
https://bugs.webkit.org/show_bug.cgi?id=26978
Fixed the issue where the parameters to the Date constructor
were being evaluated to numbers more than once.
* runtime/DateConstructor.cpp:
(JSC::constructDate):
(JSC::dateUTC):
2010-09-26 Mark Hahnenberg <mhahnenb@gmail.com>
Reviewed by Oliver Hunt.
valueOf called in wrong order in atan2 and date constructors.
https://bugs.webkit.org/show_bug.cgi?id=26978
Added regression test for the Date constructor issue.
* fast/js/date-constructor-expected.txt:
* fast/js/script-tests/date-constructor.js:
(year.valueOf):
(month.valueOf):
(date.valueOf):
(hours.valueOf):
(minutes.valueOf):
(seconds.valueOf):
(ms.valueOf):
git-svn-id: svn://svn.chromium.org/blink/trunk@68347 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/js/script-tests/date-constructor.js')
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/js/script-tests/date-constructor.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/js/script-tests/date-constructor.js b/third_party/WebKit/LayoutTests/fast/js/script-tests/date-constructor.js index ffe0b0a..203d49df 100644 --- a/third_party/WebKit/LayoutTests/fast/js/script-tests/date-constructor.js +++ b/third_party/WebKit/LayoutTests/fast/js/script-tests/date-constructor.js @@ -40,4 +40,22 @@ shouldBe('new Date(new Date(1111, 1, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneO // shouldBe('new Date(1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111).getTime() - timeZoneOffset', '-24085894227889'); // shouldBe('new Date(new Date(1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111)).getTime() - timeZoneOffset', '-24085894227889'); +// Regression test for Bug 26978 (https://bugs.webkit.org/show_bug.cgi?id=26978) +var testStr = ""; +var year = { valueOf: function() { testStr += 1; return 2007; } }; +var month = { valueOf: function() { testStr += 2; return 2; } }; +var date = { valueOf: function() { testStr += 3; return 4; } }; +var hours = { valueOf: function() { testStr += 4; return 13; } }; +var minutes = { valueOf: function() { testStr += 5; return 50; } }; +var seconds = { valueOf: function() { testStr += 6; return 0; } }; +var ms = { valueOf: function() { testStr += 7; return 999; } }; + +testStr = ""; +new Date(year, month, date, hours, minutes, seconds, ms); +shouldBe('testStr', '\"1234567\"'); + +testStr = ""; +Date.UTC(year, month, date, hours, minutes, seconds, ms); +shouldBe('testStr', '\"1234567\"'); + var successfullyParsed = true; |