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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp

Issue 2151573002: [DevTools] Fix window object init on chrome://* pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 MainThreadDebugger::instance()->didClearContextsForFrame(frame()); 256 MainThreadDebugger::instance()->didClearContextsForFrame(frame());
257 } 257 }
258 258
259 void ScriptController::collectIsolatedContexts(Vector<std::pair<ScriptState*, Se curityOrigin*>>& result) 259 void ScriptController::collectIsolatedContexts(Vector<std::pair<ScriptState*, Se curityOrigin*>>& result)
260 { 260 {
261 m_windowProxyManager->collectIsolatedContexts(result); 261 m_windowProxyManager->collectIsolatedContexts(result);
262 } 262 }
263 263
264 void ScriptController::updateDocument() 264 void ScriptController::updateDocument()
265 { 265 {
266 bool forceMainWorldInitialization = false;
267 if (canExecuteScripts(NotAboutToExecuteScript) && !frame()->loader().stateMa chine()->creatingInitialEmptyDocument()) {
268 Settings* settings = frame()->settings();
269 forceMainWorldInitialization = settings && settings->forceMainWorldIniti alization();
270 }
271
272 // For an uninitialized main window windowProxy, do not incur the cost of co ntext initialization. 266 // For an uninitialized main window windowProxy, do not incur the cost of co ntext initialization.
273 if (!forceMainWorldInitialization && !m_windowProxyManager->mainWorldProxy() ->isGlobalInitialized()) 267 if (!m_windowProxyManager->mainWorldProxy()->isGlobalInitialized())
274 return; 268 return;
275 269
276 if (!initializeMainWorld()) 270 if (!initializeMainWorld())
277 windowProxy(DOMWrapperWorld::mainWorld())->updateDocument(); 271 windowProxy(DOMWrapperWorld::mainWorld())->updateDocument();
278 } 272 }
279 273
280 void ScriptController::namedItemAdded(HTMLDocument* doc, const AtomicString& nam e) 274 void ScriptController::namedItemAdded(HTMLDocument* doc, const AtomicString& nam e)
281 { 275 {
282 windowProxy(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name); 276 windowProxy(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name);
283 } 277 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 for (size_t i = 0; i < resultArray->Length(); ++i) { 426 for (size_t i = 0; i < resultArray->Length(); ++i) {
433 v8::Local<v8::Value> value; 427 v8::Local<v8::Value> value;
434 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) 428 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value))
435 return; 429 return;
436 results->append(value); 430 results->append(value);
437 } 431 }
438 } 432 }
439 } 433 }
440 434
441 } // namespace blink 435 } // namespace blink
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_sanity_browsertest.cc ('k') | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698