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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 MainThreadDebugger::instance()->didClearContextsForFrame(frame()); | 259 MainThreadDebugger::instance()->didClearContextsForFrame(frame()); |
260 } | 260 } |
261 | 261 |
262 void ScriptController::collectIsolatedContexts(Vector<std::pair<ScriptState*, Se
curityOrigin*>>& result) | 262 void ScriptController::collectIsolatedContexts(Vector<std::pair<ScriptState*, Se
curityOrigin*>>& result) |
263 { | 263 { |
264 m_windowProxyManager->collectIsolatedContexts(result); | 264 m_windowProxyManager->collectIsolatedContexts(result); |
265 } | 265 } |
266 | 266 |
267 void ScriptController::updateDocument() | 267 void ScriptController::updateDocument() |
268 { | 268 { |
| 269 bool forceMainWorldInitialization = false; |
| 270 if (canExecuteScripts(NotAboutToExecuteScript) && !frame()->loader().stateMa
chine()->creatingInitialEmptyDocument()) { |
| 271 Settings* settings = frame()->settings(); |
| 272 forceMainWorldInitialization = settings && settings->forceMainWorldIniti
alization(); |
| 273 } |
| 274 |
269 // For an uninitialized main window windowProxy, do not incur the cost of co
ntext initialization. | 275 // For an uninitialized main window windowProxy, do not incur the cost of co
ntext initialization. |
270 if (!m_windowProxyManager->mainWorldProxy()->isGlobalInitialized()) | 276 if (!forceMainWorldInitialization && !m_windowProxyManager->mainWorldProxy()
->isGlobalInitialized()) |
271 return; | 277 return; |
272 | 278 |
273 if (!initializeMainWorld()) | 279 if (!initializeMainWorld()) |
274 windowProxy(DOMWrapperWorld::mainWorld())->updateDocument(); | 280 windowProxy(DOMWrapperWorld::mainWorld())->updateDocument(); |
275 } | 281 } |
276 | 282 |
277 void ScriptController::namedItemAdded(HTMLDocument* doc, const AtomicString& nam
e) | 283 void ScriptController::namedItemAdded(HTMLDocument* doc, const AtomicString& nam
e) |
278 { | 284 { |
279 windowProxy(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name); | 285 windowProxy(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name); |
280 } | 286 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 for (size_t i = 0; i < resultArray->Length(); ++i) { | 435 for (size_t i = 0; i < resultArray->Length(); ++i) { |
430 v8::Local<v8::Value> value; | 436 v8::Local<v8::Value> value; |
431 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) | 437 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) |
432 return; | 438 return; |
433 results->append(value); | 439 results->append(value); |
434 } | 440 } |
435 } | 441 } |
436 } | 442 } |
437 | 443 |
438 } // namespace blink | 444 } // namespace blink |
OLD | NEW |