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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 promiseRejectHandler(data, *scriptController->getRejectedPromises(), | 285 promiseRejectHandler(data, *scriptController->getRejectedPromises(), |
286 scriptState); | 286 scriptState); |
287 } | 287 } |
288 | 288 |
289 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, | 289 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, |
290 v8::AccessType type, | 290 v8::AccessType type, |
291 v8::Local<v8::Value> data) { | 291 v8::Local<v8::Value> data) { |
292 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 292 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
293 Frame* target = findFrame(isolate, host, data); | 293 Frame* target = findFrame(isolate, host, data); |
294 if (!target) | 294 BindingSecurity::failedAccessCheckFor(isolate, target); |
295 return; | |
296 DOMWindow* targetWindow = target->domWindow(); | |
297 | |
298 // FIXME: We should modify V8 to pass in more contextual information (context, | |
299 // property, and object). | |
300 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, | |
301 isolate->GetCurrentContext()->Global(), | |
302 isolate); | |
303 exceptionState.throwSecurityError( | |
304 targetWindow->sanitizedCrossDomainAccessErrorMessage( | |
305 currentDOMWindow(isolate)), | |
306 targetWindow->crossDomainAccessErrorMessage(currentDOMWindow(isolate))); | |
307 } | 295 } |
308 | 296 |
309 static bool codeGenerationCheckCallbackInMainThread( | 297 static bool codeGenerationCheckCallbackInMainThread( |
310 v8::Local<v8::Context> context) { | 298 v8::Local<v8::Context> context) { |
311 if (ExecutionContext* executionContext = toExecutionContext(context)) { | 299 if (ExecutionContext* executionContext = toExecutionContext(context)) { |
312 if (ContentSecurityPolicy* policy = | 300 if (ContentSecurityPolicy* policy = |
313 toDocument(executionContext)->contentSecurityPolicy()) | 301 toDocument(executionContext)->contentSecurityPolicy()) |
314 return policy->allowEval(ScriptState::from(context), | 302 return policy->allowEval(ScriptState::from(context), |
315 ContentSecurityPolicy::SendReport, | 303 ContentSecurityPolicy::SendReport, |
316 ContentSecurityPolicy::WillThrowException); | 304 ContentSecurityPolicy::WillThrowException); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 isolate->AddMessageListener(messageHandlerInWorker); | 489 isolate->AddMessageListener(messageHandlerInWorker); |
502 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); | 490 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); |
503 | 491 |
504 uint32_t here; | 492 uint32_t here; |
505 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) - | 493 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) - |
506 kWorkerMaxStackSize); | 494 kWorkerMaxStackSize); |
507 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 495 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
508 } | 496 } |
509 | 497 |
510 } // namespace blink | 498 } // namespace blink |
OLD | NEW |