Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp

Issue 2439013002: Implement cross-origin attributes using access check interceptors. (Closed)
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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)
295 return;
296 DOMWindow* targetWindow = target->domWindow();
297
298 // FIXME: We should modify V8 to pass in more contextual information (context, 294 // FIXME: We should modify V8 to pass in more contextual information (context,
299 // property, and object). 295 // property, and object).
300 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, 296 BindingSecurity::failedAccessCheckFor(isolate, target);
301 isolate->GetCurrentContext()->Global(),
302 isolate);
303 exceptionState.throwSecurityError(
304 targetWindow->sanitizedCrossDomainAccessErrorMessage(
305 currentDOMWindow(isolate)),
306 targetWindow->crossDomainAccessErrorMessage(currentDOMWindow(isolate)));
307 } 297 }
308 298
309 static bool codeGenerationCheckCallbackInMainThread( 299 static bool codeGenerationCheckCallbackInMainThread(
310 v8::Local<v8::Context> context) { 300 v8::Local<v8::Context> context) {
311 if (ExecutionContext* executionContext = toExecutionContext(context)) { 301 if (ExecutionContext* executionContext = toExecutionContext(context)) {
312 if (ContentSecurityPolicy* policy = 302 if (ContentSecurityPolicy* policy =
313 toDocument(executionContext)->contentSecurityPolicy()) 303 toDocument(executionContext)->contentSecurityPolicy())
314 return policy->allowEval(ScriptState::from(context), 304 return policy->allowEval(ScriptState::from(context),
315 ContentSecurityPolicy::SendReport, 305 ContentSecurityPolicy::SendReport,
316 ContentSecurityPolicy::WillThrowException); 306 ContentSecurityPolicy::WillThrowException);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 isolate->AddMessageListener(messageHandlerInWorker); 491 isolate->AddMessageListener(messageHandlerInWorker);
502 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); 492 isolate->SetFatalErrorHandler(reportFatalErrorInWorker);
503 493
504 uint32_t here; 494 uint32_t here;
505 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) - 495 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) -
506 kWorkerMaxStackSize); 496 kWorkerMaxStackSize);
507 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); 497 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker);
508 } 498 }
509 499
510 } // namespace blink 500 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698