| Index: third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp b/third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp
|
| index 044479be964d9b630767ca742ad2ca3292b6c31e..a649dede7e10e2326b9f4de8914bd2ffaa16597b 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp
|
| @@ -102,8 +102,8 @@ void LocalWindowProxy::initialize() {
|
|
|
| SecurityOrigin* origin = 0;
|
| if (m_world->isMainWorld()) {
|
| - // ActivityLogger for main world is updated within updateDocument().
|
| - updateDocument();
|
| + // ActivityLogger for main world is updated within updateDocumentInternal().
|
| + updateDocumentInternal();
|
| origin = frame()->document()->getSecurityOrigin();
|
| // FIXME: Can this be removed when CSP moves to browser?
|
| ContentSecurityPolicy* csp = frame()->document()->contentSecurityPolicy();
|
| @@ -243,12 +243,22 @@ void LocalWindowProxy::updateDocument() {
|
| // to update. The update is done when the window proxy gets initialized later.
|
| if (m_lifecycle == Lifecycle::ContextUninitialized)
|
| return;
|
| - // TODO(yukishiino): Is it okay to not update document when the context
|
| - // is detached? It's not trivial to fix this because udpateDocumentProperty
|
| - // requires a not-yet-detached context to instantiate a document wrapper.
|
| - if (m_lifecycle == Lifecycle::ContextDetached)
|
| +
|
| + // If this WindowProxy was previously initialized, reinitialize it now to
|
| + // preserve JS object identity. Otherwise, extant references to the
|
| + // WindowProxy will be broken.
|
| + if (m_lifecycle == Lifecycle::ContextDetached) {
|
| + initialize();
|
| + DCHECK_EQ(Lifecycle::ContextInitialized, m_lifecycle);
|
| + // Initialization internally updates the document properties, so just
|
| + // return afterwards.
|
| return;
|
| + }
|
| +
|
| + updateDocumentInternal();
|
| +}
|
|
|
| +void LocalWindowProxy::updateDocumentInternal() {
|
| updateActivityLogger();
|
| updateDocumentProperty();
|
| updateSecurityOrigin(frame()->document()->getSecurityOrigin());
|
|
|