Commit 4e50edda authored by kouhei@chromium.org's avatar kouhei@chromium.org

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

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

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

git-svn-id: svn://svn.chromium.org/blink/trunk@173044 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 51405d80
......@@ -476,8 +476,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