| Index: src/uri.h | 
| diff --git a/src/uri.h b/src/uri.h | 
| index 1e73ddd3d22464a654404704e043a9420b77a9cc..81ec0c58cff93c4d896b97f5b83e64e78a5e96e8 100644 | 
| --- a/src/uri.h | 
| +++ b/src/uri.h | 
| @@ -127,11 +127,9 @@ Handle<String> URIUnescape::UnescapeSlow( | 
|  | 
| int dest_position = 0; | 
| Handle<String> second_part; | 
| -  ASSERT(unescaped_length <= String::kMaxLength); | 
| if (one_byte) { | 
| Handle<SeqOneByteString> dest = | 
| isolate->factory()->NewRawOneByteString(unescaped_length); | 
| -    ASSERT(!dest.is_null()); | 
| DisallowHeapAllocation no_allocation; | 
| Vector<const Char> vector = GetCharVector<Char>(string); | 
| for (int i = start_index; i < length; dest_position++) { | 
| @@ -144,7 +142,6 @@ Handle<String> URIUnescape::UnescapeSlow( | 
| } else { | 
| Handle<SeqTwoByteString> dest = | 
| isolate->factory()->NewRawTwoByteString(unescaped_length); | 
| -    ASSERT(!dest.is_null()); | 
| DisallowHeapAllocation no_allocation; | 
| Vector<const Char> vector = GetCharVector<Char>(string); | 
| for (int i = start_index; i < length; dest_position++) { | 
| @@ -266,7 +263,11 @@ Handle<String> URIEscape::Escape(Isolate* isolate, Handle<String> string) { | 
|  | 
| // We don't allow strings that are longer than a maximal length. | 
| ASSERT(String::kMaxLength < 0x7fffffff - 6);  // Cannot overflow. | 
| -      if (escaped_length > String::kMaxLength) break;  // Provoke exception. | 
| +      if (escaped_length > String::kMaxLength) { | 
| +        AllowHeapAllocation allocate_error_and_return; | 
| +        isolate->ThrowInvalidStringLength(); | 
| +        return Handle<String>::null(); | 
| +      } | 
| } | 
| } | 
|  | 
| @@ -275,7 +276,6 @@ Handle<String> URIEscape::Escape(Isolate* isolate, Handle<String> string) { | 
|  | 
| Handle<SeqOneByteString> dest = | 
| isolate->factory()->NewRawOneByteString(escaped_length); | 
| -  RETURN_IF_EMPTY_HANDLE_VALUE(isolate, dest, Handle<String>()); | 
| int dest_position = 0; | 
|  | 
| { DisallowHeapAllocation no_allocation; | 
|  |