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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 const char* histogramName = "WebCore.V8WindowShell.createContext.MainWorld"; | 297 const char* histogramName = "WebCore.V8WindowShell.createContext.MainWorld"; |
298 if (!m_world->isMainWorld()) | 298 if (!m_world->isMainWorld()) |
299 histogramName = "WebCore.V8WindowShell.createContext.IsolatedWorld"; | 299 histogramName = "WebCore.V8WindowShell.createContext.IsolatedWorld"; |
300 HistogramSupport::histogramCustomCounts(histogramName, contextCreationDurati
onInMilliseconds, 0, 10000, 50); | 300 HistogramSupport::histogramCustomCounts(histogramName, contextCreationDurati
onInMilliseconds, 0, 10000, 50); |
301 } | 301 } |
302 | 302 |
303 bool V8WindowShell::installDOMWindow() | 303 bool V8WindowShell::installDOMWindow() |
304 { | 304 { |
305 DOMWrapperWorld::setInitializingWindow(true); | 305 DOMWrapperWorld::setInitializingWindow(true); |
306 DOMWindow* window = m_frame->domWindow(); | 306 DOMWindow* window = m_frame->domWindow(); |
307 v8::Local<v8::Object> windowWrapper = V8ObjectConstructor::newInstance(V8Per
ContextData::from(m_context.newLocal(m_isolate))->constructorForType(&V8Window::
info)); | 307 v8::Local<v8::Object> windowWrapper = V8ObjectConstructor::newInstance(V8Per
ContextData::from(m_context.newLocal(m_isolate))->constructorForType(&V8Window::
wrapperTypeInfo)); |
308 if (windowWrapper.IsEmpty()) | 308 if (windowWrapper.IsEmpty()) |
309 return false; | 309 return false; |
310 | 310 |
311 V8Window::installPerContextEnabledProperties(windowWrapper, window, m_isolat
e); | 311 V8Window::installPerContextEnabledProperties(windowWrapper, window, m_isolat
e); |
312 | 312 |
313 V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object>::Cast(windowWrapper->GetP
rototype()), &V8Window::info, window); | 313 V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object>::Cast(windowWrapper->GetP
rototype()), &V8Window::wrapperTypeInfo, window); |
314 | 314 |
315 // Install the windowWrapper as the prototype of the innerGlobalObject. | 315 // Install the windowWrapper as the prototype of the innerGlobalObject. |
316 // The full structure of the global object is as follows: | 316 // The full structure of the global object is as follows: |
317 // | 317 // |
318 // outerGlobalObject (Empty object, remains after navigation) | 318 // outerGlobalObject (Empty object, remains after navigation) |
319 // -- has prototype --> innerGlobalObject (Holds global variables, changes
during navigation) | 319 // -- has prototype --> innerGlobalObject (Holds global variables, changes
during navigation) |
320 // -- has prototype --> DOMWindow instance | 320 // -- has prototype --> DOMWindow instance |
321 // -- has prototype --> Window.prototype | 321 // -- has prototype --> Window.prototype |
322 // -- has prototype --> Object.prototype | 322 // -- has prototype --> Object.prototype |
323 // | 323 // |
324 // Note: Much of this prototype structure is hidden from web content. The | 324 // Note: Much of this prototype structure is hidden from web content. The |
325 // outer, inner, and DOMWindow instance all appear to be the same | 325 // outer, inner, and DOMWindow instance all appear to be the same |
326 // JavaScript object. | 326 // JavaScript object. |
327 // | 327 // |
328 v8::Handle<v8::Object> innerGlobalObject = toInnerGlobalObject(m_context.new
Local(m_isolate)); | 328 v8::Handle<v8::Object> innerGlobalObject = toInnerGlobalObject(m_context.new
Local(m_isolate)); |
329 V8DOMWrapper::setNativeInfo(innerGlobalObject, &V8Window::info, window); | 329 V8DOMWrapper::setNativeInfo(innerGlobalObject, &V8Window::wrapperTypeInfo, w
indow); |
330 innerGlobalObject->SetPrototype(windowWrapper); | 330 innerGlobalObject->SetPrototype(windowWrapper); |
331 V8DOMWrapper::associateObjectWithWrapper<V8Window>(PassRefPtr<DOMWindow>(win
dow), &V8Window::info, windowWrapper, m_isolate, WrapperConfiguration::Dependent
); | 331 V8DOMWrapper::associateObjectWithWrapper<V8Window>(PassRefPtr<DOMWindow>(win
dow), &V8Window::wrapperTypeInfo, windowWrapper, m_isolate, WrapperConfiguration
::Dependent); |
332 DOMWrapperWorld::setInitializingWindow(false); | 332 DOMWrapperWorld::setInitializingWindow(false); |
333 return true; | 333 return true; |
334 } | 334 } |
335 | 335 |
336 void V8WindowShell::updateDocumentWrapper(v8::Handle<v8::Object> wrapper) | 336 void V8WindowShell::updateDocumentWrapper(v8::Handle<v8::Object> wrapper) |
337 { | 337 { |
338 ASSERT(m_world->isMainWorld()); | 338 ASSERT(m_world->isMainWorld()); |
339 m_document.set(m_isolate, wrapper); | 339 m_document.set(m_isolate, wrapper); |
340 } | 340 } |
341 | 341 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 void V8WindowShell::updateSecurityOrigin() | 502 void V8WindowShell::updateSecurityOrigin() |
503 { | 503 { |
504 ASSERT(m_world->isMainWorld()); | 504 ASSERT(m_world->isMainWorld()); |
505 if (m_context.isEmpty()) | 505 if (m_context.isEmpty()) |
506 return; | 506 return; |
507 v8::HandleScope handleScope(m_isolate); | 507 v8::HandleScope handleScope(m_isolate); |
508 setSecurityToken(); | 508 setSecurityToken(); |
509 } | 509 } |
510 | 510 |
511 } // WebCore | 511 } // WebCore |
OLD | NEW |