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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 if (ec == V8TypeError) | 56 if (ec == V8TypeError) |
57 return V8ThrowException::createTypeError(isolate, sanitizedMessage); | 57 return V8ThrowException::createTypeError(isolate, sanitizedMessage); |
58 if (ec == V8RangeError) | 58 if (ec == V8RangeError) |
59 return V8ThrowException::createRangeError(isolate, sanitizedMessage); | 59 return V8ThrowException::createRangeError(isolate, sanitizedMessage); |
60 if (ec == V8SyntaxError) | 60 if (ec == V8SyntaxError) |
61 return V8ThrowException::createSyntaxError(isolate, sanitizedMessage); | 61 return V8ThrowException::createSyntaxError(isolate, sanitizedMessage); |
62 if (ec == V8ReferenceError) | 62 if (ec == V8ReferenceError) |
63 return V8ThrowException::createReferenceError(isolate, sanitizedMessage)
; | 63 return V8ThrowException::createReferenceError(isolate, sanitizedMessage)
; |
64 | 64 |
65 RefPtrWillBeRawPtr<DOMException> domException = DOMException::create(ec, san
itizedMessage, unsanitizedMessage); | 65 RefPtrWillBeRawPtr<DOMException> domException = DOMException::create(ec, san
itizedMessage, unsanitizedMessage); |
66 v8::Handle<v8::Value> exception = toV8(domException, creationContext, isolat
e); | 66 v8::Handle<v8::Value> exception = toV8(domException.get(), creationContext,
isolate); |
67 | 67 |
68 if (exception.IsEmpty()) | 68 if (exception.IsEmpty()) |
69 return v8Undefined(); | 69 return v8Undefined(); |
70 | 70 |
71 // Attach an Error object to the DOMException. This is then lazily used to g
et the stack value. | 71 // Attach an Error object to the DOMException. This is then lazily used to g
et the stack value. |
72 v8::Handle<v8::Value> error = v8::Exception::Error(v8String(isolate, domExce
ption->message())); | 72 v8::Handle<v8::Value> error = v8::Exception::Error(v8String(isolate, domExce
ption->message())); |
73 ASSERT(!error.IsEmpty()); | 73 ASSERT(!error.IsEmpty()); |
74 ASSERT(exception->IsObject()); | 74 ASSERT(exception->IsObject()); |
75 exception->ToObject()->SetAccessor(v8AtomicString(isolate, "stack"), domExce
ptionStackGetter, domExceptionStackSetter, error); | 75 exception->ToObject()->SetAccessor(v8AtomicString(isolate, "stack"), domExce
ptionStackGetter, domExceptionStackSetter, error); |
76 V8HiddenValue::setHiddenValue(isolate, exception->ToObject(), V8HiddenValue:
:error(isolate), error); | 76 V8HiddenValue::setHiddenValue(isolate, exception->ToObject(), V8HiddenValue:
:error(isolate), error); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 | 145 |
146 v8::Handle<v8::Value> V8ThrowException::throwException(v8::Handle<v8::Value> exc
eption, v8::Isolate* isolate) | 146 v8::Handle<v8::Value> V8ThrowException::throwException(v8::Handle<v8::Value> exc
eption, v8::Isolate* isolate) |
147 { | 147 { |
148 if (!v8::V8::IsExecutionTerminating()) | 148 if (!v8::V8::IsExecutionTerminating()) |
149 isolate->ThrowException(exception); | 149 isolate->ThrowException(exception); |
150 return v8::Undefined(isolate); | 150 return v8::Undefined(isolate); |
151 } | 151 } |
152 | 152 |
153 } // namespace blink | 153 } // namespace blink |
OLD | NEW |