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

Side by Side Diff: Source/bindings/core/v8/V8WindowShell.cpp

Issue 456683002: bindings: Introduces type-check for the internal pointers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Finally fixed hidden misconversions to internal pointers. Created 6 years, 4 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 | Annotate | Revision Log
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype()); 277 return v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
278 } 278 }
279 279
280 bool V8WindowShell::installDOMWindow() 280 bool V8WindowShell::installDOMWindow()
281 { 281 {
282 LocalDOMWindow* window = m_frame->domWindow(); 282 LocalDOMWindow* window = m_frame->domWindow();
283 v8::Local<v8::Object> windowWrapper = V8ObjectConstructor::newInstance(m_iso late, m_scriptState->perContextData()->constructorForType(&V8Window::wrapperType Info)); 283 v8::Local<v8::Object> windowWrapper = V8ObjectConstructor::newInstance(m_iso late, m_scriptState->perContextData()->constructorForType(&V8Window::wrapperType Info));
284 if (windowWrapper.IsEmpty()) 284 if (windowWrapper.IsEmpty())
285 return false; 285 return false;
286 286
287 V8DOMWrapper::setNativeInfoForHiddenWrapper(v8::Handle<v8::Object>::Cast(win dowWrapper->GetPrototype()), &V8Window::wrapperTypeInfo, window); 287 V8DOMWrapper::setNativeInfoForHiddenWrapper(v8::Handle<v8::Object>::Cast(win dowWrapper->GetPrototype()), &V8Window::wrapperTypeInfo, V8Window::toInternalPoi nter(window));
288 288
289 // Install the windowWrapper as the prototype of the innerGlobalObject. 289 // Install the windowWrapper as the prototype of the innerGlobalObject.
290 // The full structure of the global object is as follows: 290 // The full structure of the global object is as follows:
291 // 291 //
292 // outerGlobalObject (Empty object, remains after navigation) 292 // outerGlobalObject (Empty object, remains after navigation)
293 // -- has prototype --> innerGlobalObject (Holds global variables, changes during navigation) 293 // -- has prototype --> innerGlobalObject (Holds global variables, changes during navigation)
294 // -- has prototype --> LocalDOMWindow instance 294 // -- has prototype --> LocalDOMWindow instance
295 // -- has prototype --> Window.prototype 295 // -- has prototype --> Window.prototype
296 // -- has prototype --> Object.prototype 296 // -- has prototype --> Object.prototype
297 // 297 //
298 // Note: Much of this prototype structure is hidden from web content. The 298 // Note: Much of this prototype structure is hidden from web content. The
299 // outer, inner, and LocalDOMWindow instance all appear to be the same 299 // outer, inner, and LocalDOMWindow instance all appear to be the same
300 // JavaScript object. 300 // JavaScript object.
301 // 301 //
302 // Note: With Oilpan, the LocalDOMWindow object is garbage collected. 302 // Note: With Oilpan, the LocalDOMWindow object is garbage collected.
303 // Persistent references to this inner global object view of the Local DOMWindow 303 // Persistent references to this inner global object view of the Local DOMWindow
304 // aren't kept, as that would prevent the global object from ever bein g released. 304 // aren't kept, as that would prevent the global object from ever bein g released.
305 // It is safe not to do so, as the wrapper for the LocalDOMWindow bein g installed here 305 // It is safe not to do so, as the wrapper for the LocalDOMWindow bein g installed here
306 // already keeps a persistent reference, and it along with the inner g lobal object 306 // already keeps a persistent reference, and it along with the inner g lobal object
307 // views of the LocalDOMWindow will die together once that wrapper cle ars the persistent 307 // views of the LocalDOMWindow will die together once that wrapper cle ars the persistent
308 // reference. 308 // reference.
309 v8::Handle<v8::Object> innerGlobalObject = toInnerGlobalObject(m_scriptState ->context()); 309 v8::Handle<v8::Object> innerGlobalObject = toInnerGlobalObject(m_scriptState ->context());
310 V8DOMWrapper::setNativeInfoForHiddenWrapper(innerGlobalObject, &V8Window::wr apperTypeInfo, window); 310 V8DOMWrapper::setNativeInfoForHiddenWrapper(innerGlobalObject, &V8Window::wr apperTypeInfo, V8Window::toInternalPointer(window));
311 innerGlobalObject->SetPrototype(windowWrapper); 311 innerGlobalObject->SetPrototype(windowWrapper);
312 V8DOMWrapper::associateObjectWithWrapper<V8Window>(PassRefPtrWillBeRawPtr<Lo calDOMWindow>(window), &V8Window::wrapperTypeInfo, windowWrapper, m_isolate, Wra pperConfiguration::Dependent); 312 V8DOMWrapper::associateObjectWithWrapper<V8Window>(PassRefPtrWillBeRawPtr<Lo calDOMWindow>(window), &V8Window::wrapperTypeInfo, windowWrapper, m_isolate, Wra pperConfiguration::Dependent);
313 V8Window::installPerContextEnabledProperties(windowWrapper, window, m_isolat e); 313 V8Window::installPerContextEnabledProperties(windowWrapper, window, m_isolat e);
314 return true; 314 return true;
315 } 315 }
316 316
317 void V8WindowShell::updateDocumentWrapper(v8::Handle<v8::Object> wrapper) 317 void V8WindowShell::updateDocumentWrapper(v8::Handle<v8::Object> wrapper)
318 { 318 {
319 ASSERT(m_world->isMainWorld()); 319 ASSERT(m_world->isMainWorld());
320 m_document.set(m_isolate, wrapper); 320 m_document.set(m_isolate, wrapper);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 void V8WindowShell::updateSecurityOrigin(SecurityOrigin* origin) 484 void V8WindowShell::updateSecurityOrigin(SecurityOrigin* origin)
485 { 485 {
486 ASSERT(m_world->isMainWorld()); 486 ASSERT(m_world->isMainWorld());
487 if (!isContextInitialized()) 487 if (!isContextInitialized())
488 return; 488 return;
489 setSecurityToken(origin); 489 setSecurityToken(origin);
490 } 490 }
491 491
492 } // namespace blink 492 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698