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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 DOMWindow* window = m_frame->domWindow(); | 345 DOMWindow* window = m_frame->domWindow(); |
346 const WrapperTypeInfo* wrapperTypeInfo = window->wrapperTypeInfo(); | 346 const WrapperTypeInfo* wrapperTypeInfo = window->wrapperTypeInfo(); |
347 v8::Local<v8::Object> windowWrapper; | 347 v8::Local<v8::Object> windowWrapper; |
348 v8::Local<v8::Function> constructor = m_scriptState->perContextData()->const
ructorForType(wrapperTypeInfo); | 348 v8::Local<v8::Function> constructor = m_scriptState->perContextData()->const
ructorForType(wrapperTypeInfo); |
349 if (constructor.IsEmpty()) | 349 if (constructor.IsEmpty()) |
350 return false; | 350 return false; |
351 if (!V8ObjectConstructor::newInstance(m_isolate, constructor).ToLocal(&windo
wWrapper)) | 351 if (!V8ObjectConstructor::newInstance(m_isolate, constructor).ToLocal(&windo
wWrapper)) |
352 return false; | 352 return false; |
353 windowWrapper = V8DOMWrapper::associateObjectWithWrapper(m_isolate, window,
wrapperTypeInfo, windowWrapper); | 353 windowWrapper = V8DOMWrapper::associateObjectWithWrapper(m_isolate, window,
wrapperTypeInfo, windowWrapper); |
354 | 354 |
355 V8DOMWrapper::setNativeInfo(v8::Local<v8::Object>::Cast(windowWrapper->GetPr
ototype()), wrapperTypeInfo, window); | 355 v8::Local<v8::Object> windowPrototype = v8::Local<v8::Object>::Cast(windowWr
apper->GetPrototype()); |
| 356 RELEASE_ASSERT(!windowPrototype.IsEmpty()); |
| 357 V8DOMWrapper::setNativeInfo(windowPrototype, wrapperTypeInfo, window); |
| 358 v8::Local<v8::Object> windowProperties = v8::Local<v8::Object>::Cast(windowP
rototype->GetPrototype()); |
| 359 RELEASE_ASSERT(!windowProperties.IsEmpty()); |
| 360 V8DOMWrapper::setNativeInfo(windowProperties, wrapperTypeInfo, window); |
356 | 361 |
357 // Install the windowWrapper as the prototype of the innerGlobalObject. | 362 // Install the windowWrapper as the prototype of the innerGlobalObject. |
358 // The full structure of the global object is as follows: | 363 // The full structure of the global object is as follows: |
359 // | 364 // |
360 // outerGlobalObject (Empty object, remains after navigation) | 365 // outerGlobalObject (Empty object, remains after navigation) |
361 // -- has prototype --> innerGlobalObject (Holds global variables, changes
during navigation) | 366 // -- has prototype --> innerGlobalObject (Holds global variables, changes
during navigation) |
362 // -- has prototype --> DOMWindow instance | 367 // -- has prototype --> DOMWindow instance |
363 // -- has prototype --> Window.prototype | 368 // -- has prototype --> Window.prototype |
| 369 // -- has prototype --> WindowProperties (named properties object) |
364 // -- has prototype --> EventTarget.prototype | 370 // -- has prototype --> EventTarget.prototype |
365 // -- has prototype --> Object.prototype | 371 // -- has prototype --> Object.prototype |
366 // | 372 // |
367 // Note: Much of this prototype structure is hidden from web content. The | 373 // Note: Much of this prototype structure is hidden from web content. The |
368 // outer, inner, and DOMWindow instance all appear to be the same | 374 // outer, inner, and DOMWindow instance all appear to be the same |
369 // JavaScript object. | 375 // JavaScript object. |
370 v8::Local<v8::Context> context = m_scriptState->context(); | 376 v8::Local<v8::Context> context = m_scriptState->context(); |
371 v8::Local<v8::Object> innerGlobalObject = toInnerGlobalObject(m_scriptState-
>context()); | 377 v8::Local<v8::Object> innerGlobalObject = toInnerGlobalObject(m_scriptState-
>context()); |
372 V8DOMWrapper::setNativeInfo(innerGlobalObject, wrapperTypeInfo, window); | 378 V8DOMWrapper::setNativeInfo(innerGlobalObject, wrapperTypeInfo, window); |
373 if (!v8CallBoolean(innerGlobalObject->SetPrototype(context, windowWrapper))) | 379 if (!v8CallBoolean(innerGlobalObject->SetPrototype(context, windowWrapper))) |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 } | 564 } |
559 | 565 |
560 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) | 566 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) |
561 { | 567 { |
562 if (!isContextInitialized()) | 568 if (!isContextInitialized()) |
563 return; | 569 return; |
564 setSecurityToken(origin); | 570 setSecurityToken(origin); |
565 } | 571 } |
566 | 572 |
567 } // namespace blink | 573 } // namespace blink |
OLD | NEW |