Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
aa27dd07
Commit
aa27dd07
authored
Apr 11, 2018
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Date.prototype.toISOString implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4fde6d41
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
0 deletions
+85
-0
date.c
dlls/jscript/date.c
+48
-0
documentmode.js
dlls/mshtml/tests/documentmode.js
+2
-0
es5.js
dlls/mshtml/tests/es5.js
+35
-0
No files found.
dlls/jscript/date.c
View file @
aa27dd07
...
...
@@ -49,6 +49,7 @@ typedef struct {
static
const
WCHAR
toStringW
[]
=
{
't'
,
'o'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
toLocaleStringW
[]
=
{
't'
,
'o'
,
'L'
,
'o'
,
'c'
,
'a'
,
'l'
,
'e'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
valueOfW
[]
=
{
'v'
,
'a'
,
'l'
,
'u'
,
'e'
,
'O'
,
'f'
,
0
};
static
const
WCHAR
toISOStringW
[]
=
{
't'
,
'o'
,
'I'
,
'S'
,
'O'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
toUTCStringW
[]
=
{
't'
,
'o'
,
'U'
,
'T'
,
'C'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
toGMTStringW
[]
=
{
't'
,
'o'
,
'G'
,
'M'
,
'T'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
toDateStringW
[]
=
{
't'
,
'o'
,
'D'
,
'a'
,
't'
,
'e'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
...
...
@@ -632,6 +633,52 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
return
S_OK
;
}
static
HRESULT
Date_toISOString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
DateInstance
*
date
;
WCHAR
buf
[
64
],
*
p
=
buf
;
double
year
;
static
const
WCHAR
short_year_formatW
[]
=
{
'%'
,
'0'
,
'4'
,
'd'
,
0
};
static
const
WCHAR
long_year_formatW
[]
=
{
'%'
,
'0'
,
'6'
,
'd'
,
0
};
static
const
WCHAR
formatW
[]
=
{
'-'
,
'%'
,
'0'
,
'2'
,
'd'
,
'-'
,
'%'
,
'0'
,
'2'
,
'd'
,
'T'
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
'.'
,
'%'
,
'0'
,
'3'
,
'd'
,
'Z'
,
0
};
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
JS_E_DATE_EXPECTED
,
NULL
);
year
=
year_from_time
(
date
->
time
);
if
(
isnan
(
year
)
||
year
>
999999
||
year
<
-
999999
)
{
FIXME
(
"year %lf should throw an exception
\n
"
,
year
);
return
E_FAIL
;
}
if
(
year
<
0
)
{
*
p
++
=
'-'
;
p
+=
sprintfW
(
p
,
long_year_formatW
,
-
(
int
)
year
);
}
else
if
(
year
>
9999
)
{
*
p
++
=
'+'
;
p
+=
sprintfW
(
p
,
long_year_formatW
,
(
int
)
year
);
}
else
{
p
+=
sprintfW
(
p
,
short_year_formatW
,
(
int
)
year
);
}
sprintfW
(
p
,
formatW
,
(
int
)
month_from_time
(
date
->
time
)
+
1
,
(
int
)
date_from_time
(
date
->
time
),
(
int
)
hour_from_time
(
date
->
time
),
(
int
)
min_from_time
(
date
->
time
),
(
int
)
sec_from_time
(
date
->
time
),
(
int
)
ms_from_time
(
date
->
time
));
if
(
r
)
{
jsstr_t
*
ret
;
if
(
!
(
ret
=
jsstr_alloc
(
buf
)))
return
E_OUTOFMEMORY
;
*
r
=
jsval_string
(
ret
);
}
return
S_OK
;
}
static
HRESULT
Date_valueOf
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
...
...
@@ -1923,6 +1970,7 @@ static const builtin_prop_t Date_props[] = {
{
setYearW
,
Date_setYear
,
PROPF_METHOD
|
1
},
{
toDateStringW
,
Date_toDateString
,
PROPF_METHOD
},
{
toGMTStringW
,
Date_toGMTString
,
PROPF_METHOD
},
{
toISOStringW
,
Date_toISOString
,
PROPF_METHOD
|
PROPF_ES5
},
{
toLocaleDateStringW
,
Date_toLocaleDateString
,
PROPF_METHOD
},
{
toLocaleStringW
,
Date_toLocaleString
,
PROPF_METHOD
},
{
toLocaleTimeStringW
,
Date_toLocaleTimeString
,
PROPF_METHOD
},
...
...
dlls/mshtml/tests/documentmode.js
View file @
aa27dd07
...
...
@@ -80,6 +80,7 @@ function test_window_props() {
var
v
=
document
.
documentMode
;
test_exposed
(
"postMessage"
,
true
);
test_exposed
(
"addEventListener"
,
v
>=
9
);
test_exposed
(
"removeEventListener"
,
v
>=
9
);
test_exposed
(
"dispatchEvent"
,
v
>=
9
);
...
...
@@ -136,6 +137,7 @@ function test_javascript() {
test_exposed
(
"JSON"
,
g
,
v
>=
8
);
test_exposed
(
"now"
,
Date
,
true
);
test_exposed
(
"toISOString"
,
Date
.
prototype
,
v
>=
9
);
test_exposed
(
"isArray"
,
Array
,
v
>=
9
);
test_exposed
(
"indexOf"
,
Array
.
prototype
,
v
>=
9
);
...
...
dlls/mshtml/tests/es5.js
View file @
aa27dd07
...
...
@@ -27,6 +27,40 @@ function test_date_now() {
next_test
();
}
function
test_toISOString
()
{
var
s
;
function
expect
(
date
,
expected
)
{
var
s
=
date
.
toISOString
();
ok
(
s
===
expected
,
"toISOString returned "
+
s
+
" expected "
+
expected
);
}
function
expect_exception
(
func
)
{
try
{
func
();
}
catch
(
e
)
{
return
;
}
ok
(
false
,
"expected exception"
);
}
expect
(
new
Date
(
0
),
"1970-01-01T00:00:00.000Z"
);
expect
(
new
Date
(
0xdeadbeef
),
"1970-02-13T05:45:28.559Z"
);
expect
(
new
Date
(
10928309128301
),
"2316-04-22T01:25:28.301Z"
);
expect
(
new
Date
(
-
1
),
"1969-12-31T23:59:59.999Z"
);
expect
(
new
Date
(
-
62167219200000
),
"0000-01-01T00:00:00.000Z"
);
expect
(
new
Date
(
-
62167219200001
),
"-000001-12-31T23:59:59.999Z"
);
expect
(
new
Date
(
-
6216721920000100
),
"-195031-12-03T23:59:59.900Z"
);
expect
(
new
Date
(
1092830912830100
),
"+036600-06-07T22:27:10.100Z"
);
trace
(
""
+
0xdeadbeef
);
expect_exception
(
function
()
{
new
Date
(
NaN
).
toISOString
();
});
expect_exception
(
function
()
{
new
Date
(
31494784780800001
).
toISOString
();
});
next_test
();
}
function
test_indexOf
()
{
function
expect
(
array
,
args
,
exr
)
{
var
r
=
Array
.
prototype
.
indexOf
.
apply
(
array
,
args
);
...
...
@@ -115,6 +149,7 @@ function test_identifier_keywords() {
var
tests
=
[
test_date_now
,
test_toISOString
,
test_indexOf
,
test_isArray
,
test_identifier_keywords
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment