OLD | NEW |
---|---|
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 MainThreadDebugger::instance()->didClearContextsForFrame(frame()); | 270 MainThreadDebugger::instance()->didClearContextsForFrame(frame()); |
271 } | 271 } |
272 | 272 |
273 void ScriptController::collectIsolatedContexts(Vector<std::pair<ScriptState*, Se curityOrigin*>>& result) | 273 void ScriptController::collectIsolatedContexts(Vector<std::pair<ScriptState*, Se curityOrigin*>>& result) |
274 { | 274 { |
275 m_windowProxyManager->collectIsolatedContexts(result); | 275 m_windowProxyManager->collectIsolatedContexts(result); |
276 } | 276 } |
277 | 277 |
278 void ScriptController::updateDocument() | 278 void ScriptController::updateDocument() |
279 { | 279 { |
280 bool forceMainWorldInitialization = false; | |
281 if (canExecuteScripts(NotAboutToExecuteScript) && !frame()->loader().stateMa chine()->creatingInitialEmptyDocument()) { | |
282 Settings* settings = frame()->settings(); | |
283 forceMainWorldInitialization = settings && settings->forceMainWorldIniti alization(); | |
284 } | |
285 | |
280 // For an uninitialized main window windowProxy, do not incur the cost of co ntext initialization. | 286 // For an uninitialized main window windowProxy, do not incur the cost of co ntext initialization. |
281 if (!m_windowProxyManager->mainWorldProxy()->isGlobalInitialized()) | 287 if (!forceMainWorldInitialization && !m_windowProxyManager->mainWorldProxy() ->isGlobalInitialized()) |
haraken
2016/07/01 02:28:03
Hmm, it looks a bit nasty to force the main world
dgozman
2016/07/06 17:02:20
Alternatives are LocalDOMWindow::installNewDocumen
| |
282 return; | 288 return; |
283 | 289 |
284 if (!initializeMainWorld()) | 290 if (!initializeMainWorld()) |
285 windowProxy(DOMWrapperWorld::mainWorld())->updateDocument(); | 291 windowProxy(DOMWrapperWorld::mainWorld())->updateDocument(); |
286 } | 292 } |
287 | 293 |
288 void ScriptController::namedItemAdded(HTMLDocument* doc, const AtomicString& nam e) | 294 void ScriptController::namedItemAdded(HTMLDocument* doc, const AtomicString& nam e) |
289 { | 295 { |
290 windowProxy(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name); | 296 windowProxy(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name); |
291 } | 297 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 for (size_t i = 0; i < resultArray->Length(); ++i) { | 446 for (size_t i = 0; i < resultArray->Length(); ++i) { |
441 v8::Local<v8::Value> value; | 447 v8::Local<v8::Value> value; |
442 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) | 448 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) |
443 return; | 449 return; |
444 results->append(value); | 450 results->append(value); |
445 } | 451 } |
446 } | 452 } |
447 } | 453 } |
448 | 454 |
449 } // namespace blink | 455 } // namespace blink |
OLD | NEW |