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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 { | 48 { |
49 if (ec <= 0 || v8::V8::IsExecutionTerminating()) | 49 if (ec <= 0 || v8::V8::IsExecutionTerminating()) |
50 return v8Undefined(); | 50 return v8Undefined(); |
51 | 51 |
52 ASSERT(ec == SecurityError || unsanitizedMessage.isEmpty()); | 52 ASSERT(ec == SecurityError || unsanitizedMessage.isEmpty()); |
53 | 53 |
54 // FIXME: Handle other WebIDL exception types. | 54 // FIXME: Handle other WebIDL exception types. |
55 if (ec == TypeError) | 55 if (ec == TypeError) |
56 return V8ThrowException::createTypeError(sanitizedMessage, isolate); | 56 return V8ThrowException::createTypeError(sanitizedMessage, isolate); |
57 | 57 |
58 RefPtr<DOMException> domException = DOMException::create(ec, sanitizedMessag
e, unsanitizedMessage); | 58 RefPtrWillBeRawPtr<DOMException> domException = DOMException::create(ec, san
itizedMessage, unsanitizedMessage); |
59 v8::Handle<v8::Value> exception = toV8(domException, creationContext, isolat
e); | 59 v8::Handle<v8::Value> exception = toV8(domException, creationContext, isolat
e); |
60 | 60 |
61 if (exception.IsEmpty()) | 61 if (exception.IsEmpty()) |
62 return v8Undefined(); | 62 return v8Undefined(); |
63 | 63 |
64 // Attach an Error object to the DOMException. This is then lazily used to g
et the stack value. | 64 // Attach an Error object to the DOMException. This is then lazily used to g
et the stack value. |
65 v8::Handle<v8::Value> error = v8::Exception::Error(v8String(isolate, domExce
ption->message())); | 65 v8::Handle<v8::Value> error = v8::Exception::Error(v8String(isolate, domExce
ption->message())); |
66 ASSERT(!error.IsEmpty()); | 66 ASSERT(!error.IsEmpty()); |
67 ASSERT(exception->IsObject()); | 67 ASSERT(exception->IsObject()); |
68 exception->ToObject()->SetAccessor(v8AtomicString(isolate, "stack"), domExce
ptionStackGetter, domExceptionStackSetter, error); | 68 exception->ToObject()->SetAccessor(v8AtomicString(isolate, "stack"), domExce
ptionStackGetter, domExceptionStackSetter, error); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 119 } |
120 | 120 |
121 v8::Handle<v8::Value> V8ThrowException::throwError(v8::Handle<v8::Value> excepti
on, v8::Isolate* isolate) | 121 v8::Handle<v8::Value> V8ThrowException::throwError(v8::Handle<v8::Value> excepti
on, v8::Isolate* isolate) |
122 { | 122 { |
123 if (!v8::V8::IsExecutionTerminating()) | 123 if (!v8::V8::IsExecutionTerminating()) |
124 isolate->ThrowException(exception); | 124 isolate->ThrowException(exception); |
125 return v8::Undefined(isolate); | 125 return v8::Undefined(isolate); |
126 } | 126 } |
127 | 127 |
128 } // namespace WebCore | 128 } // namespace WebCore |
OLD | NEW |