| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Dispose of the underlying V8 object before releasing our reference | 124 // Dispose of the underlying V8 object before releasing our reference |
| 125 // to it, so that if a plugin fails to release it properly we will | 125 // to it, so that if a plugin fails to release it properly we will |
| 126 // only leak the NPObject wrapper, not the object, its document, or | 126 // only leak the NPObject wrapper, not the object, its document, or |
| 127 // anything else they reference. | 127 // anything else they reference. |
| 128 disposeUnderlyingV8Object(isolate(), m_windowScriptNPObject); | 128 disposeUnderlyingV8Object(isolate(), m_windowScriptNPObject); |
| 129 _NPN_ReleaseObject(m_windowScriptNPObject); | 129 _NPN_ReleaseObject(m_windowScriptNPObject); |
| 130 m_windowScriptNPObject = 0; | 130 m_windowScriptNPObject = 0; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 void ScriptController::clearForClose() | |
| 135 { | |
| 136 double start = currentTime(); | |
| 137 m_windowProxyManager->clearForClose(); | |
| 138 Platform::current()->histogramCustomCounts("WebCore.ScriptController.clearFo
rClose", (currentTime() - start) * 1000, 0, 10000, 50); | |
| 139 } | |
| 140 | |
| 141 void ScriptController::updateSecurityOrigin(SecurityOrigin* origin) | 134 void ScriptController::updateSecurityOrigin(SecurityOrigin* origin) |
| 142 { | 135 { |
| 143 m_windowProxyManager->mainWorldProxy()->updateSecurityOrigin(origin); | 136 m_windowProxyManager->mainWorldProxy()->updateSecurityOrigin(origin); |
| 144 Vector<std::pair<ScriptState*, SecurityOrigin*>> isolatedContexts; | 137 Vector<std::pair<ScriptState*, SecurityOrigin*>> isolatedContexts; |
| 145 m_windowProxyManager->collectIsolatedContexts(isolatedContexts); | 138 m_windowProxyManager->collectIsolatedContexts(isolatedContexts); |
| 146 for (auto isolatedContext : isolatedContexts) | 139 for (auto isolatedContext : isolatedContexts) |
| 147 m_windowProxyManager->windowProxy(isolatedContext.first->world())->updat
eSecurityOrigin(isolatedContext.second); | 140 m_windowProxyManager->windowProxy(isolatedContext.first->world())->updat
eSecurityOrigin(isolatedContext.second); |
| 148 } | 141 } |
| 149 | 142 |
| 150 v8::MaybeLocal<v8::Value> ScriptController::callFunction(v8::Local<v8::Function>
function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) | 143 v8::MaybeLocal<v8::Value> ScriptController::callFunction(v8::Local<v8::Function>
function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 return npCreateV8ScriptObject(scriptState->isolate(), 0, v8::Local<v8::Objec
t>::Cast(v8plugin), window); | 392 return npCreateV8ScriptObject(scriptState->isolate(), 0, v8::Local<v8::Objec
t>::Cast(v8plugin), window); |
| 400 } | 393 } |
| 401 | 394 |
| 402 void ScriptController::clearWindowProxy() | 395 void ScriptController::clearWindowProxy() |
| 403 { | 396 { |
| 404 // V8 binding expects ScriptController::clearWindowProxy only be called | 397 // V8 binding expects ScriptController::clearWindowProxy only be called |
| 405 // when a frame is loading a new page. This creates a new context for the ne
w page. | 398 // when a frame is loading a new page. This creates a new context for the ne
w page. |
| 406 | 399 |
| 407 double start = currentTime(); | 400 double start = currentTime(); |
| 408 // The V8 context must be available for |clearScriptObjects()|. | 401 // The V8 context must be available for |clearScriptObjects()|. |
| 409 // The below call must be before |clearForNavigation()| which disposes the V
8 context. | 402 // The below call must be before |clearWindowProxy()| which disposes the V8
context. |
| 410 clearScriptObjects(); | 403 clearScriptObjects(); |
| 411 | 404 |
| 412 m_windowProxyManager->clearForNavigation(); | 405 m_windowProxyManager->clearWindowProxy(); |
| 413 Platform::current()->histogramCustomCounts("WebCore.ScriptController.clearWi
ndowProxy", (currentTime() - start) * 1000, 0, 10000, 50); | 406 Platform::current()->histogramCustomCounts("WebCore.ScriptController.clearWi
ndowProxy", (currentTime() - start) * 1000, 0, 10000, 50); |
| 414 } | 407 } |
| 415 | 408 |
| 416 void ScriptController::setCaptureCallStackForUncaughtExceptions(bool value) | 409 void ScriptController::setCaptureCallStackForUncaughtExceptions(bool value) |
| 417 { | 410 { |
| 418 v8::V8::SetCaptureStackTraceForUncaughtExceptions(value, ScriptCallStack::ma
xCallStackSizeToCapture, stackTraceOptions); | 411 v8::V8::SetCaptureStackTraceForUncaughtExceptions(value, ScriptCallStack::ma
xCallStackSizeToCapture, stackTraceOptions); |
| 419 } | 412 } |
| 420 | 413 |
| 421 void ScriptController::collectIsolatedContexts(Vector<std::pair<ScriptState*, Se
curityOrigin*>>& result) | 414 void ScriptController::collectIsolatedContexts(Vector<std::pair<ScriptState*, Se
curityOrigin*>>& result) |
| 422 { | 415 { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 for (size_t i = 0; i < resultArray->Length(); ++i) { | 590 for (size_t i = 0; i < resultArray->Length(); ++i) { |
| 598 v8::Local<v8::Value> value; | 591 v8::Local<v8::Value> value; |
| 599 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) | 592 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) |
| 600 return; | 593 return; |
| 601 results->append(value); | 594 results->append(value); |
| 602 } | 595 } |
| 603 } | 596 } |
| 604 } | 597 } |
| 605 | 598 |
| 606 } // namespace blink | 599 } // namespace blink |
| OLD | NEW |