| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 namespace blink { | 62 namespace blink { |
| 63 | 63 |
| 64 static LocalFrame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> da
ta, v8::Isolate* isolate) | 64 static LocalFrame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> da
ta, v8::Isolate* isolate) |
| 65 { | 65 { |
| 66 const WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); | 66 const WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); |
| 67 | 67 |
| 68 if (V8Window::wrapperTypeInfo.equals(type)) { | 68 if (V8Window::wrapperTypeInfo.equals(type)) { |
| 69 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototype
Chain(host, isolate); | 69 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototype
Chain(host, isolate); |
| 70 if (windowWrapper.IsEmpty()) | 70 if (windowWrapper.IsEmpty()) |
| 71 return 0; | 71 return 0; |
| 72 return V8Window::toImpl(windowWrapper)->frame(); | 72 DOMWindow* window = V8Window::toImpl(windowWrapper); |
| 73 if (!window->isLocalDOMWindow()) |
| 74 return 0; |
| 75 return toLocalDOMWindow(window)->frame(); |
| 73 } | 76 } |
| 74 | 77 |
| 75 if (V8History::wrapperTypeInfo.equals(type)) | 78 if (V8History::wrapperTypeInfo.equals(type)) |
| 76 return V8History::toImpl(host)->frame(); | 79 return V8History::toImpl(host)->frame(); |
| 77 | 80 |
| 78 if (V8Location::wrapperTypeInfo.equals(type)) | 81 if (V8Location::wrapperTypeInfo.equals(type)) |
| 79 return V8Location::toImpl(host)->frame(); | 82 return V8Location::toImpl(host)->frame(); |
| 80 | 83 |
| 81 // This function can handle only those types listed above. | 84 // This function can handle only those types listed above. |
| 82 ASSERT_NOT_REACHED(); | 85 ASSERT_NOT_REACHED(); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 ScriptState* scriptState = ScriptState::from(context); | 297 ScriptState* scriptState = ScriptState::from(context); |
| 295 promiseRejectMessageQueue().append(PromiseRejectMessage(ScriptValue(scriptSt
ate, promise), callStack)); | 298 promiseRejectMessageQueue().append(PromiseRejectMessage(ScriptValue(scriptSt
ate, promise), callStack)); |
| 296 } | 299 } |
| 297 | 300 |
| 298 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8
::AccessType type, v8::Local<v8::Value> data) | 301 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8
::AccessType type, v8::Local<v8::Value> data) |
| 299 { | 302 { |
| 300 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 303 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 301 LocalFrame* target = findFrame(host, data, isolate); | 304 LocalFrame* target = findFrame(host, data, isolate); |
| 302 if (!target) | 305 if (!target) |
| 303 return; | 306 return; |
| 304 LocalDOMWindow* targetWindow = target->domWindow(); | 307 LocalDOMWindow* targetWindow = target->localDOMWindow(); |
| 305 | 308 |
| 306 // FIXME: We should modify V8 to pass in more contextual information (contex
t, property, and object). | 309 // FIXME: We should modify V8 to pass in more contextual information (contex
t, property, and object). |
| 307 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, isolate-
>GetCurrentContext()->Global(), isolate); | 310 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, isolate-
>GetCurrentContext()->Global(), isolate); |
| 308 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr
rorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessa
ge(callingDOMWindow(isolate))); | 311 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr
rorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessa
ge(callingDOMWindow(isolate))); |
| 309 exceptionState.throwIfNeeded(); | 312 exceptionState.throwIfNeeded(); |
| 310 } | 313 } |
| 311 | 314 |
| 312 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte
xt) | 315 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte
xt) |
| 313 { | 316 { |
| 314 if (ExecutionContext* executionContext = toExecutionContext(context)) { | 317 if (ExecutionContext* executionContext = toExecutionContext(context)) { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 438 |
| 436 v8::V8::AddMessageListener(messageHandlerInWorker); | 439 v8::V8::AddMessageListener(messageHandlerInWorker); |
| 437 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 440 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
| 438 | 441 |
| 439 uint32_t here; | 442 uint32_t here; |
| 440 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); | 443 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); |
| 441 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 444 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
| 442 } | 445 } |
| 443 | 446 |
| 444 } // namespace blink | 447 } // namespace blink |
| OLD | NEW |