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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp

Issue 1863363003: [DevTools] Bring back bypassing CSP for eval in Runtime.evaluate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
index bbb129843697593e23fd5d9a5d13ef7aed94e7f8..1eecc58b97cc5965a2728e75adddcc4bc5b1c2f7 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
@@ -116,7 +116,8 @@ void V8RuntimeAgentImpl::evaluate(
return;
v8::HandleScope scope(injectedScript->isolate());
- v8::Context::Scope contextScope(injectedScript->context()->context());
+ v8::Local<v8::Context> context = injectedScript->context()->context();
+ v8::Context::Scope contextScope(context);
if (!injectedScript->canAccessInspectedWindow()) {
*errorString = "Can not access given context";
@@ -132,7 +133,13 @@ void V8RuntimeAgentImpl::evaluate(
return;
InjectedScript::ScopedGlobalObjectExtension scopeExtension(injectedScript, commandLineAPI);
+ bool evalIsDisabled = !context->IsCodeGenerationFromStringsAllowed();
+ // Temporarily enable allow evals for inspector.
+ if (evalIsDisabled)
+ context->AllowCodeGenerationFromStrings(true);
v8::MaybeLocal<v8::Value> maybeResultValue = m_debugger->compileAndRunInternalScript(injectedScript->context()->context(), toV8String(injectedScript->isolate(), expression));
+ if (evalIsDisabled)
+ context->AllowCodeGenerationFromStrings(false);
// InjectedScript may be gone after any evaluate call - find it again.
injectedScript = m_connection->findInjectedScript(errorString, contextId);
if (!injectedScript)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698