| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 if (LIKELY(m_v8Object->IsString())) | 209 if (LIKELY(m_v8Object->IsString())) |
| 210 return true; | 210 return true; |
| 211 | 211 |
| 212 if (LIKELY(m_v8Object->IsInt32())) { | 212 if (LIKELY(m_v8Object->IsInt32())) { |
| 213 setString(int32ToWebCoreString(m_v8Object->Int32Value())); | 213 setString(int32ToWebCoreString(m_v8Object->Int32Value())); |
| 214 return true; | 214 return true; |
| 215 } | 215 } |
| 216 | 216 |
| 217 m_mode = DoNotExternalize; | 217 m_mode = DoNotExternalize; |
| 218 v8::TryCatch block; | |
| 219 m_v8Object = m_v8Object->ToString(); | 218 m_v8Object = m_v8Object->ToString(); |
| 220 // Handle the case where an exception is thrown as part of invoking toSt
ring on the object. | 219 // Handle the case where an exception is thrown as part of invoking toSt
ring on the object. |
| 221 if (block.HasCaught()) { | 220 if (m_v8Object.IsEmpty()) |
| 222 block.ReThrow(); | |
| 223 return false; | 221 return false; |
| 224 } | |
| 225 return true; | 222 return true; |
| 226 } | 223 } |
| 227 operator String() const { return toString<String>(); } | 224 operator String() const { return toString<String>(); } |
| 228 operator AtomicString() const { return toString<AtomicString>(); } | 225 operator AtomicString() const { return toString<AtomicString>(); } |
| 229 | 226 |
| 230 private: | 227 private: |
| 231 bool isValid() const; | 228 bool isValid() const; |
| 232 String fallbackString() const; | 229 String fallbackString() const; |
| 233 | 230 |
| 234 void setString(const String& string) | 231 void setString(const String& string) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 285 } |
| 289 | 286 |
| 290 template<> inline String V8StringResource<TreatNullAndUndefinedAsNullString>::fa
llbackString() const | 287 template<> inline String V8StringResource<TreatNullAndUndefinedAsNullString>::fa
llbackString() const |
| 291 { | 288 { |
| 292 return String(); | 289 return String(); |
| 293 } | 290 } |
| 294 | 291 |
| 295 } // namespace blink | 292 } // namespace blink |
| 296 | 293 |
| 297 #endif // V8StringResource_h | 294 #endif // V8StringResource_h |
| OLD | NEW |