Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: src/builtins.cc

Issue 1838063002: [date] Properly handle timezones with non-ASCII characters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index d2d641560754a8ce56da283c5cf81a4f8556b441..d34d6c2c9787af3c26b226fdf8eea020c4b98943 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -2750,7 +2750,11 @@ BUILTIN(DateConstructor) {
char buffer[128];
Vector<char> str(buffer, arraysize(buffer));
ToDateString(time_val, str, isolate->date_cache());
- return *isolate->factory()->NewStringFromAsciiChecked(str.start());
+ Handle<String> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result,
+ isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
+ return *result;
}
@@ -3330,7 +3334,11 @@ BUILTIN(DatePrototypeToDateString) {
char buffer[128];
Vector<char> str(buffer, arraysize(buffer));
ToDateString(date->value()->Number(), str, isolate->date_cache(), kDateOnly);
- return *isolate->factory()->NewStringFromAsciiChecked(str.start());
+ Handle<String> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result,
+ isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
+ return *result;
}
@@ -3370,7 +3378,11 @@ BUILTIN(DatePrototypeToString) {
char buffer[128];
Vector<char> str(buffer, arraysize(buffer));
ToDateString(date->value()->Number(), str, isolate->date_cache());
- return *isolate->factory()->NewStringFromAsciiChecked(str.start());
+ Handle<String> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result,
+ isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
+ return *result;
}
@@ -3381,7 +3393,11 @@ BUILTIN(DatePrototypeToTimeString) {
char buffer[128];
Vector<char> str(buffer, arraysize(buffer));
ToDateString(date->value()->Number(), str, isolate->date_cache(), kTimeOnly);
- return *isolate->factory()->NewStringFromAsciiChecked(str.start());
+ Handle<String> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result,
+ isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
+ return *result;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698