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

Unified Diff: Source/core/testing/v8/WebCoreTestSupport.cpp

Issue 306853002: Replace Context::Scope with ScriptState::Scope (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | « Source/core/inspector/InspectorOverlay.cpp ('k') | Source/web/InspectorFrontendClientImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/v8/WebCoreTestSupport.cpp
diff --git a/Source/core/testing/v8/WebCoreTestSupport.cpp b/Source/core/testing/v8/WebCoreTestSupport.cpp
index 10d5777ee15e44ff27518a87a0e6ac0884b11be1..fd62089cca9fdba7af12324a2407acafc99237e4 100644
--- a/Source/core/testing/v8/WebCoreTestSupport.cpp
+++ b/Source/core/testing/v8/WebCoreTestSupport.cpp
@@ -41,15 +41,12 @@ namespace WebCoreTestSupport {
void injectInternalsObject(v8::Local<v8::Context> context)
{
- // This can happen if no JavaScript was used in the main frame.
- if (context.IsEmpty())
- return;
-
- v8::Context::Scope contextScope(context);
- v8::HandleScope scope(context->GetIsolate());
- ExecutionContext* scriptContext = currentExecutionContext(context->GetIsolate());
- if (scriptContext->isDocument())
- context->Global()->Set(v8::String::NewFromUtf8(context->GetIsolate(), Internals::internalsId), toV8(Internals::create(toDocument(scriptContext)), v8::Handle<v8::Object>(), context->GetIsolate()));
+ ScriptState* scriptState = ScriptState::from(context);
+ ScriptState::Scope scope(scriptState);
+ v8::Handle<v8::Object> global = scriptState->context()->Global();
+ ExecutionContext* executionContext = scriptState->executionContext();
+ if (executionContext->isDocument())
+ global->Set(v8::String::NewFromUtf8(scriptState->isolate(), Internals::internalsId), toV8(Internals::create(toDocument(executionContext)), global, scriptState->isolate()));
}
void resetInternalsObject(v8::Local<v8::Context> context)
@@ -58,11 +55,9 @@ void resetInternalsObject(v8::Local<v8::Context> context)
if (context.IsEmpty())
return;
- v8::Context::Scope contextScope(context);
- v8::HandleScope scope(context->GetIsolate());
-
- ExecutionContext* scriptContext = currentExecutionContext(context->GetIsolate());
- Page* page = toDocument(scriptContext)->frame()->page();
+ ScriptState* scriptState = ScriptState::from(context);
+ ScriptState::Scope scope(scriptState);
+ Page* page = toDocument(scriptState->executionContext())->frame()->page();
ASSERT(page);
Internals::resetToConsistentState(page);
InternalSettings::from(*page)->resetToConsistentState();
« no previous file with comments | « Source/core/inspector/InspectorOverlay.cpp ('k') | Source/web/InspectorFrontendClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698