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

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

Issue 2769803003: v8binding: Initializes WindowProxy iff it's uninitialized. (Closed)
Patch Set: Synced. Created 3 years, 8 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, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // has a security token which is the domain. The outer window cannot 133 // has a security token which is the domain. The outer window cannot
134 // have its own properties. window.foo = 'x' is delegated to the 134 // have its own properties. window.foo = 'x' is delegated to the
135 // inner window. 135 // inner window.
136 // 136 //
137 // When a frame navigates to a new page, the inner window is cut off 137 // When a frame navigates to a new page, the inner window is cut off
138 // the outer window, and the outer window identify is preserved for 138 // the outer window, and the outer window identify is preserved for
139 // the frame. However, a new inner window is created for the new page. 139 // the frame. However, a new inner window is created for the new page.
140 // If there are JS code holds a closure to the old inner window, 140 // If there are JS code holds a closure to the old inner window,
141 // it won't be able to reach the outer window via its global object. 141 // it won't be able to reach the outer window via its global object.
142 void WindowProxy::initializeIfNeeded() { 142 void WindowProxy::initializeIfNeeded() {
143 // TODO(haraken): It is wrong to re-initialize an already detached window 143 if (m_lifecycle == Lifecycle::ContextUninitialized ||
144 // proxy. This must be 'if(m_lifecycle == Lifecycle::ContextUninitialized)'. 144 m_lifecycle == Lifecycle::GlobalObjectDetached) {
145 if (m_lifecycle != Lifecycle::ContextInitialized) {
146 initialize(); 145 initialize();
147 } 146 }
148 } 147 }
149 148
150 v8::Local<v8::Object> WindowProxy::associateWithWrapper( 149 v8::Local<v8::Object> WindowProxy::associateWithWrapper(
151 DOMWindow* window, 150 DOMWindow* window,
152 const WrapperTypeInfo* wrapperTypeInfo, 151 const WrapperTypeInfo* wrapperTypeInfo,
153 v8::Local<v8::Object> wrapper) { 152 v8::Local<v8::Object> wrapper) {
154 if (m_world->domDataStore().set(m_isolate, window, wrapperTypeInfo, 153 if (m_world->domDataStore().set(m_isolate, window, wrapperTypeInfo,
155 wrapper)) { 154 wrapper)) {
156 wrapperTypeInfo->wrapperCreated(); 155 wrapperTypeInfo->wrapperCreated();
157 V8DOMWrapper::setNativeInfo(m_isolate, wrapper, wrapperTypeInfo, window); 156 V8DOMWrapper::setNativeInfo(m_isolate, wrapper, wrapperTypeInfo, window);
158 DCHECK(V8DOMWrapper::hasInternalFieldsSet(wrapper)); 157 DCHECK(V8DOMWrapper::hasInternalFieldsSet(wrapper));
159 } 158 }
160 SECURITY_CHECK(toScriptWrappable(wrapper) == window); 159 SECURITY_CHECK(toScriptWrappable(wrapper) == window);
161 return wrapper; 160 return wrapper;
162 } 161 }
163 162
164 } // namespace blink 163 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698