OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 if (object->IsInt32()) | 405 if (object->IsInt32()) |
406 return int32ToWebCoreString(object->Int32Value()); | 406 return int32ToWebCoreString(object->Int32Value()); |
407 | 407 |
408 v8::TryCatch block; | 408 v8::TryCatch block; |
409 v8::Handle<v8::String> v8String = object->ToString(); | 409 v8::Handle<v8::String> v8String = object->ToString(); |
410 // Handle the case where an exception is thrown as part of invoking toString
on the object. | 410 // Handle the case where an exception is thrown as part of invoking toString
on the object. |
411 if (block.HasCaught()) { | 411 if (block.HasCaught()) { |
412 throwError(block.Exception()); | 412 throwError(block.Exception()); |
413 return StringImpl::empty(); | 413 return StringImpl::empty(); |
414 } | 414 } |
| 415 // This path is unexpected. However there is hypothesis that it |
| 416 // might be combination of v8 and v8 bindings bugs. For now |
| 417 // just bailout as we'll crash if attempt to convert empty handle into a str
ing. |
| 418 if (v8String.IsEmpty()) { |
| 419 ASSERT_NOT_REACHED(); |
| 420 return StringImpl::empty(); |
| 421 } |
415 return v8StringToWebCoreString<String>(v8String, DoNotExternalize); | 422 return v8StringToWebCoreString<String>(v8String, DoNotExternalize); |
416 } | 423 } |
417 | 424 |
418 AtomicString v8NonStringValueToAtomicWebCoreString(v8::Handle<v8::Value> object) | 425 AtomicString v8NonStringValueToAtomicWebCoreString(v8::Handle<v8::Value> object) |
419 { | 426 { |
420 ASSERT(!object->IsString()); | 427 ASSERT(!object->IsString()); |
421 return AtomicString(v8NonStringValueToWebCoreString(object)); | 428 return AtomicString(v8NonStringValueToWebCoreString(object)); |
422 } | 429 } |
423 | 430 |
424 static bool stringImplCacheEnabled = false; | 431 static bool stringImplCacheEnabled = false; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 void setElementStringAttr(const v8::AccessorInfo& info, | 579 void setElementStringAttr(const v8::AccessorInfo& info, |
573 const QualifiedName& name, | 580 const QualifiedName& name, |
574 v8::Local<v8::Value> value) | 581 v8::Local<v8::Value> value) |
575 { | 582 { |
576 Element* imp = V8Element::toNative(info.Holder()); | 583 Element* imp = V8Element::toNative(info.Holder()); |
577 AtomicString v = toAtomicWebCoreStringWithNullCheck(value); | 584 AtomicString v = toAtomicWebCoreStringWithNullCheck(value); |
578 imp->setAttribute(name, v); | 585 imp->setAttribute(name, v); |
579 } | 586 } |
580 | 587 |
581 } // namespace WebCore | 588 } // namespace WebCore |
OLD | NEW |