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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 if (ec == V8ReferenceError) | 63 if (ec == V8ReferenceError) |
64 return V8ThrowException::createReferenceError(isolate, sanitizedMessage)
; | 64 return V8ThrowException::createReferenceError(isolate, sanitizedMessage)
; |
65 | 65 |
66 v8::Handle<v8::Object> sanitizedCreationContext = creationContext; | 66 v8::Handle<v8::Object> sanitizedCreationContext = creationContext; |
67 | 67 |
68 // FIXME: Is the current context always the right choice? | 68 // FIXME: Is the current context always the right choice? |
69 Frame* frame = toFrameIfNotDetached(creationContext->CreationContext()); | 69 Frame* frame = toFrameIfNotDetached(creationContext->CreationContext()); |
70 if (!frame || !BindingSecurity::shouldAllowAccessToFrame(isolate, frame, DoN
otReportSecurityError)) | 70 if (!frame || !BindingSecurity::shouldAllowAccessToFrame(isolate, frame, DoN
otReportSecurityError)) |
71 sanitizedCreationContext = isolate->GetCurrentContext()->Global(); | 71 sanitizedCreationContext = isolate->GetCurrentContext()->Global(); |
72 | 72 |
| 73 v8::TryCatch tryCatch; |
73 | 74 |
74 RefPtrWillBeRawPtr<DOMException> domException = DOMException::create(ec, san
itizedMessage, unsanitizedMessage); | 75 RefPtrWillBeRawPtr<DOMException> domException = DOMException::create(ec, san
itizedMessage, unsanitizedMessage); |
75 v8::Handle<v8::Value> exception = toV8(domException.get(), sanitizedCreation
Context, isolate); | 76 v8::Handle<v8::Value> exception = toV8(domException.get(), sanitizedCreation
Context, isolate); |
76 | 77 |
77 if (exception.IsEmpty()) | 78 if (tryCatch.HasCaught()) { |
78 return v8Undefined(); | 79 ASSERT(exception.IsEmpty()); |
| 80 return tryCatch.Exception(); |
| 81 } |
| 82 ASSERT(!exception.IsEmpty()); |
79 | 83 |
80 // Attach an Error object to the DOMException. This is then lazily used to g
et the stack value. | 84 // Attach an Error object to the DOMException. This is then lazily used to g
et the stack value. |
81 v8::Handle<v8::Value> error = v8::Exception::Error(v8String(isolate, domExce
ption->message())); | 85 v8::Handle<v8::Value> error = v8::Exception::Error(v8String(isolate, domExce
ption->message())); |
82 ASSERT(!error.IsEmpty()); | 86 ASSERT(!error.IsEmpty()); |
83 ASSERT(exception->IsObject()); | 87 ASSERT(exception->IsObject()); |
84 exception->ToObject(isolate)->SetAccessor(v8AtomicString(isolate, "stack"),
domExceptionStackGetter, domExceptionStackSetter, error); | 88 exception->ToObject(isolate)->SetAccessor(v8AtomicString(isolate, "stack"),
domExceptionStackGetter, domExceptionStackSetter, error); |
85 V8HiddenValue::setHiddenValue(isolate, exception->ToObject(isolate), V8Hidde
nValue::error(isolate), error); | 89 V8HiddenValue::setHiddenValue(isolate, exception->ToObject(isolate), V8Hidde
nValue::error(isolate), error); |
86 | 90 |
87 return exception; | 91 return exception; |
88 } | 92 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 157 } |
154 | 158 |
155 v8::Handle<v8::Value> V8ThrowException::throwException(v8::Handle<v8::Value> exc
eption, v8::Isolate* isolate) | 159 v8::Handle<v8::Value> V8ThrowException::throwException(v8::Handle<v8::Value> exc
eption, v8::Isolate* isolate) |
156 { | 160 { |
157 if (!v8::V8::IsExecutionTerminating()) | 161 if (!v8::V8::IsExecutionTerminating()) |
158 isolate->ThrowException(exception); | 162 isolate->ThrowException(exception); |
159 return v8::Undefined(isolate); | 163 return v8::Undefined(isolate); |
160 } | 164 } |
161 | 165 |
162 } // namespace blink | 166 } // namespace blink |
OLD | NEW |