OLD | NEW |
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 290 } |
291 | 291 |
292 bool WindowProxy::installDOMWindow() | 292 bool WindowProxy::installDOMWindow() |
293 { | 293 { |
294 LocalDOMWindow* window = m_frame->domWindow(); | 294 LocalDOMWindow* window = m_frame->domWindow(); |
295 const WrapperTypeInfo* wrapperTypeInfo = window->wrapperTypeInfo(); | 295 const WrapperTypeInfo* wrapperTypeInfo = window->wrapperTypeInfo(); |
296 v8::Local<v8::Object> windowWrapper = V8ObjectConstructor::newInstance(m_iso
late, m_scriptState->perContextData()->constructorForType(wrapperTypeInfo)); | 296 v8::Local<v8::Object> windowWrapper = V8ObjectConstructor::newInstance(m_iso
late, m_scriptState->perContextData()->constructorForType(wrapperTypeInfo)); |
297 if (windowWrapper.IsEmpty()) | 297 if (windowWrapper.IsEmpty()) |
298 return false; | 298 return false; |
299 | 299 |
300 V8DOMWrapper::setNativeInfoForHiddenWrapper(v8::Handle<v8::Object>::Cast(win
dowWrapper->GetPrototype()), wrapperTypeInfo, window->toScriptWrappableBase()); | 300 V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object>::Cast(windowWrapper->GetP
rototype()), wrapperTypeInfo, window->toScriptWrappableBase()); |
301 | 301 |
302 // Install the windowWrapper as the prototype of the innerGlobalObject. | 302 // Install the windowWrapper as the prototype of the innerGlobalObject. |
303 // The full structure of the global object is as follows: | 303 // The full structure of the global object is as follows: |
304 // | 304 // |
305 // outerGlobalObject (Empty object, remains after navigation) | 305 // outerGlobalObject (Empty object, remains after navigation) |
306 // -- has prototype --> innerGlobalObject (Holds global variables, changes
during navigation) | 306 // -- has prototype --> innerGlobalObject (Holds global variables, changes
during navigation) |
307 // -- has prototype --> LocalDOMWindow instance | 307 // -- has prototype --> LocalDOMWindow instance |
308 // -- has prototype --> Window.prototype | 308 // -- has prototype --> Window.prototype |
309 // -- has prototype --> Object.prototype | 309 // -- has prototype --> Object.prototype |
310 // | 310 // |
311 // Note: Much of this prototype structure is hidden from web content. The | 311 // Note: Much of this prototype structure is hidden from web content. The |
312 // outer, inner, and LocalDOMWindow instance all appear to be the same | 312 // outer, inner, and LocalDOMWindow instance all appear to be the same |
313 // JavaScript object. | 313 // JavaScript object. |
314 // | |
315 // Note: With Oilpan, the LocalDOMWindow object is garbage collected. | |
316 // Persistent references to this inner global object view of the Local
DOMWindow | |
317 // aren't kept, as that would prevent the global object from ever bein
g released. | |
318 // It is safe not to do so, as the wrapper for the LocalDOMWindow bein
g installed here | |
319 // already keeps a persistent reference, and it along with the inner g
lobal object | |
320 // views of the LocalDOMWindow will die together once that wrapper cle
ars the persistent | |
321 // reference. | |
322 v8::Handle<v8::Object> innerGlobalObject = toInnerGlobalObject(m_scriptState
->context()); | 314 v8::Handle<v8::Object> innerGlobalObject = toInnerGlobalObject(m_scriptState
->context()); |
323 V8DOMWrapper::setNativeInfoForHiddenWrapper(innerGlobalObject, wrapperTypeIn
fo, window->toScriptWrappableBase()); | 315 V8DOMWrapper::setNativeInfo(innerGlobalObject, wrapperTypeInfo, window->toSc
riptWrappableBase()); |
324 innerGlobalObject->SetPrototype(windowWrapper); | 316 innerGlobalObject->SetPrototype(windowWrapper); |
325 V8DOMWrapper::associateObjectWithWrapperNonTemplate(window, wrapperTypeInfo,
windowWrapper, m_isolate); | 317 V8DOMWrapper::associateObjectWithWrapperNonTemplate(window, wrapperTypeInfo,
windowWrapper, m_isolate); |
326 wrapperTypeInfo->installConditionallyEnabledProperties(windowWrapper, m_isol
ate); | 318 wrapperTypeInfo->installConditionallyEnabledProperties(windowWrapper, m_isol
ate); |
327 return true; | 319 return true; |
328 } | 320 } |
329 | 321 |
330 void WindowProxy::updateDocumentWrapper(v8::Handle<v8::Object> wrapper) | 322 void WindowProxy::updateDocumentWrapper(v8::Handle<v8::Object> wrapper) |
331 { | 323 { |
332 ASSERT(m_world->isMainWorld()); | 324 ASSERT(m_world->isMainWorld()); |
333 m_document.set(m_isolate, wrapper); | 325 m_document.set(m_isolate, wrapper); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 | 488 |
497 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) | 489 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) |
498 { | 490 { |
499 ASSERT(m_world->isMainWorld()); | 491 ASSERT(m_world->isMainWorld()); |
500 if (!isContextInitialized()) | 492 if (!isContextInitialized()) |
501 return; | 493 return; |
502 setSecurityToken(origin); | 494 setSecurityToken(origin); |
503 } | 495 } |
504 | 496 |
505 } // namespace blink | 497 } // namespace blink |
OLD | NEW |