Commit 246e25c5 authored by kouhei@chromium.org's avatar kouhei@chromium.org

Reland: Do not initialize |v8::Context| on |ScriptController::updateDocument|.

> The reason for reverting is: broke interactive_ui_tests:
> 
> Referrer
> SearchReusesInstantTab
> TypedSearchURLDoesntReuseInstantTab.
I fixed these tests in https://src.chromium.org/viewvc/chrome?view=rev&revision=273996 .

Original Description:

Initializing |v8::Context| is a heavy operation, and should be avoided if necessary. This is meant to be delayed until first time |toV8Context| is called, but |ScriptController::updateDocument| was forcing creation.

This patch fixes the if branch so that it would not create a |v8::Context| if it does not exist.

BUG=368548, 368555

Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=173044

Review URL: https://codereview.chromium.org/263583002

git-svn-id: svn://svn.chromium.org/blink/trunk@175240 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 22f5f08f
......@@ -465,8 +465,8 @@ int ScriptController::contextDebugId(v8::Handle<v8::Context> context)
void ScriptController::updateDocument()
{
// For an uninitialized main window shell, do not incur the cost of context initialization during FrameLoader::init().
if ((!m_windowShell->isContextInitialized() || !m_windowShell->isGlobalInitialized()) && m_frame->loader().stateMachine()->creatingInitialEmptyDocument())
// For an uninitialized main window shell, do not incur the cost of context initialization.
if (!m_windowShell->isGlobalInitialized())
return;
if (!initializeMainWorld())
......
......@@ -41,6 +41,10 @@ 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());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment