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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 v8::Handle<v8::Object> sanitizedCreationContext = creationContext; | 67 v8::Handle<v8::Object> sanitizedCreationContext = creationContext; |
68 | 68 |
69 // FIXME: Is the current context always the right choice? | 69 // FIXME: Is the current context always the right choice? |
70 Frame* frame = toFrameIfNotDetached(creationContext->CreationContext()); | 70 Frame* frame = toFrameIfNotDetached(creationContext->CreationContext()); |
71 if (!frame || !BindingSecurity::shouldAllowAccessToFrame(isolate, frame, DoN
otReportSecurityError)) | 71 if (!frame || !BindingSecurity::shouldAllowAccessToFrame(isolate, frame, DoN
otReportSecurityError)) |
72 sanitizedCreationContext = isolate->GetCurrentContext()->Global(); | 72 sanitizedCreationContext = isolate->GetCurrentContext()->Global(); |
73 | 73 |
74 v8::TryCatch tryCatch; | 74 v8::TryCatch tryCatch; |
75 | 75 |
76 RefPtrWillBeRawPtr<DOMException> domException = DOMException::create(ec, san
itizedMessage, unsanitizedMessage); | 76 DOMException* domException = DOMException::create(ec, sanitizedMessage, unsa
nitizedMessage); |
77 v8::Local<v8::Value> exception = toV8(domException.get(), sanitizedCreationC
ontext, isolate); | 77 v8::Local<v8::Value> exception = toV8(domException, sanitizedCreationContext
, isolate); |
78 | 78 |
79 if (tryCatch.HasCaught()) { | 79 if (tryCatch.HasCaught()) { |
80 ASSERT(exception.IsEmpty()); | 80 ASSERT(exception.IsEmpty()); |
81 return tryCatch.Exception(); | 81 return tryCatch.Exception(); |
82 } | 82 } |
83 ASSERT(!exception.IsEmpty()); | 83 ASSERT(!exception.IsEmpty()); |
84 | 84 |
85 // Attach an Error object to the DOMException. This is then lazily used to g
et the stack value. | 85 // Attach an Error object to the DOMException. This is then lazily used to g
et the stack value. |
86 v8::Local<v8::Value> error = v8::Exception::Error(v8String(isolate, domExcep
tion->message())); | 86 v8::Local<v8::Value> error = v8::Exception::Error(v8String(isolate, domExcep
tion->message())); |
87 ASSERT(!error.IsEmpty()); | 87 ASSERT(!error.IsEmpty()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 | 160 |
161 v8::Handle<v8::Value> V8ThrowException::throwException(v8::Handle<v8::Value> exc
eption, v8::Isolate* isolate) | 161 v8::Handle<v8::Value> V8ThrowException::throwException(v8::Handle<v8::Value> exc
eption, v8::Isolate* isolate) |
162 { | 162 { |
163 if (!v8::V8::IsExecutionTerminating()) | 163 if (!v8::V8::IsExecutionTerminating()) |
164 isolate->ThrowException(exception); | 164 isolate->ThrowException(exception); |
165 return v8::Undefined(isolate); | 165 return v8::Undefined(isolate); |
166 } | 166 } |
167 | 167 |
168 } // namespace blink | 168 } // namespace blink |
OLD | NEW |