Index: src/i18n.cc |
diff --git a/src/i18n.cc b/src/i18n.cc |
index bb7423c845a2a2bed4ccb2b1fb6053e7d247714f..58b8a8dc5c7a5d9df902b01201763df958fd5a3c 100644 |
--- a/src/i18n.cc |
+++ b/src/i18n.cc |
@@ -759,7 +759,16 @@ |
icu::SimpleDateFormat* DateFormat::UnpackDateFormat( |
Isolate* isolate, |
Handle<JSObject> obj) { |
- return reinterpret_cast<icu::SimpleDateFormat*>(obj->GetInternalField(0)); |
+ Handle<String> key = |
+ isolate->factory()->NewStringFromStaticChars("dateFormat"); |
+ Maybe<bool> maybe = JSReceiver::HasOwnProperty(obj, key); |
+ CHECK(maybe.IsJust()); |
+ if (maybe.FromJust()) { |
+ return reinterpret_cast<icu::SimpleDateFormat*>( |
+ obj->GetInternalField(0)); |
+ } |
+ |
+ return NULL; |
} |
void DateFormat::DeleteDateFormat(const v8::WeakCallbackInfo<void>& data) { |
@@ -814,7 +823,15 @@ |
icu::DecimalFormat* NumberFormat::UnpackNumberFormat( |
Isolate* isolate, |
Handle<JSObject> obj) { |
- return reinterpret_cast<icu::DecimalFormat*>(obj->GetInternalField(0)); |
+ Handle<String> key = |
+ isolate->factory()->NewStringFromStaticChars("numberFormat"); |
+ Maybe<bool> maybe = JSReceiver::HasOwnProperty(obj, key); |
+ CHECK(maybe.IsJust()); |
+ if (maybe.FromJust()) { |
+ return reinterpret_cast<icu::DecimalFormat*>(obj->GetInternalField(0)); |
+ } |
+ |
+ return NULL; |
} |
void NumberFormat::DeleteNumberFormat(const v8::WeakCallbackInfo<void>& data) { |
@@ -866,7 +883,14 @@ |
icu::Collator* Collator::UnpackCollator(Isolate* isolate, |
Handle<JSObject> obj) { |
- return reinterpret_cast<icu::Collator*>(obj->GetInternalField(0)); |
+ Handle<String> key = isolate->factory()->NewStringFromStaticChars("collator"); |
+ Maybe<bool> maybe = JSReceiver::HasOwnProperty(obj, key); |
+ CHECK(maybe.IsJust()); |
+ if (maybe.FromJust()) { |
+ return reinterpret_cast<icu::Collator*>(obj->GetInternalField(0)); |
+ } |
+ |
+ return NULL; |
} |
void Collator::DeleteCollator(const v8::WeakCallbackInfo<void>& data) { |
@@ -921,7 +945,15 @@ |
icu::BreakIterator* BreakIterator::UnpackBreakIterator(Isolate* isolate, |
Handle<JSObject> obj) { |
- return reinterpret_cast<icu::BreakIterator*>(obj->GetInternalField(0)); |
+ Handle<String> key = |
+ isolate->factory()->NewStringFromStaticChars("breakIterator"); |
+ Maybe<bool> maybe = JSReceiver::HasOwnProperty(obj, key); |
+ CHECK(maybe.IsJust()); |
+ if (maybe.FromJust()) { |
+ return reinterpret_cast<icu::BreakIterator*>(obj->GetInternalField(0)); |
+ } |
+ |
+ return NULL; |
} |
void BreakIterator::DeleteBreakIterator( |