static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> context) { if (ScriptExecutionContext* scriptExecutionContext = toScriptExecutionContext(context)) { if (ContentSecurityPolicy* policy = toDocument(scriptExecutionContext)->contentSecurityPolicy()) return policy->allowEval(ScriptState::forContext(context)); } return false; }
ScriptExecutionContext* activeScriptExecutionContext() { v8::Handle<v8::Context> context = v8::Context::GetCalling(); if (context.IsEmpty()) { // Unfortunately, when processing script from a plug-in, we might not // have a calling context. In those cases, we fall back to the // entered context. context = v8::Context::GetEntered(); } return toScriptExecutionContext(context); }