| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 if (tryCatch.HasCaught()) { | 83 if (tryCatch.HasCaught()) { |
| 84 ASSERT(exception.IsEmpty()); | 84 ASSERT(exception.IsEmpty()); |
| 85 return tryCatch.Exception(); | 85 return tryCatch.Exception(); |
| 86 } | 86 } |
| 87 ASSERT(!exception.IsEmpty()); | 87 ASSERT(!exception.IsEmpty()); |
| 88 | 88 |
| 89 // Attach an Error object to the DOMException. This is then lazily used to g
et the stack value. | 89 // Attach an Error object to the DOMException. This is then lazily used to g
et the stack value. |
| 90 v8::Local<v8::Value> error = v8::Exception::Error(v8String(isolate, domExcep
tion->message())); | 90 v8::Local<v8::Value> error = v8::Exception::Error(v8String(isolate, domExcep
tion->message())); |
| 91 ASSERT(!error.IsEmpty()); | 91 ASSERT(!error.IsEmpty()); |
| 92 v8::Local<v8::Object> exceptionObject = exception.As<v8::Object>(); | 92 v8::Local<v8::Object> exceptionObject = exception.As<v8::Object>(); |
| 93 v8CallOrCrash(exceptionObject->SetAccessor(isolate->GetCurrentContext(), v8A
tomicString(isolate, "stack"), domExceptionStackGetter, domExceptionStackSetter,
error)); | 93 exceptionObject->SetAccessor(isolate->GetCurrentContext(), v8AtomicString(is
olate, "stack"), domExceptionStackGetter, domExceptionStackSetter, error).ToChec
ked(); |
| 94 | 94 |
| 95 auto privateError = V8PrivateProperty::getDOMExceptionError(isolate); | 95 auto privateError = V8PrivateProperty::getDOMExceptionError(isolate); |
| 96 privateError.set(scriptState->context(), exceptionObject, error); | 96 privateError.set(scriptState->context(), exceptionObject, error); |
| 97 | 97 |
| 98 return exception; | 98 return exception; |
| 99 } | 99 } |
| 100 | 100 |
| 101 v8::Local<v8::Value> V8ThrowException::createGeneralError(v8::Isolate* isolate,
const String& message) | 101 v8::Local<v8::Value> V8ThrowException::createGeneralError(v8::Isolate* isolate,
const String& message) |
| 102 { | 102 { |
| 103 return v8::Exception::Error(v8String(isolate, message.isNull() ? "Error" : m
essage)); | 103 return v8::Exception::Error(v8String(isolate, message.isNull() ? "Error" : m
essage)); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } | 154 } |
| 155 | 155 |
| 156 v8::Local<v8::Value> V8ThrowException::throwException(v8::Local<v8::Value> excep
tion, v8::Isolate* isolate) | 156 v8::Local<v8::Value> V8ThrowException::throwException(v8::Local<v8::Value> excep
tion, v8::Isolate* isolate) |
| 157 { | 157 { |
| 158 if (!isolate->IsExecutionTerminating()) | 158 if (!isolate->IsExecutionTerminating()) |
| 159 isolate->ThrowException(exception); | 159 isolate->ThrowException(exception); |
| 160 return v8::Undefined(isolate); | 160 return v8::Undefined(isolate); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace blink | 163 } // namespace blink |
| OLD | NEW |