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

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

Issue 451013003: Rename V8WindowShell to WindowProxy (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « Source/bindings/core/v8/WindowProxy.h ('k') | Source/bindings/core/v8/v8.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11 matching lines...) Expand all
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/core/v8/V8WindowShell.h" 32 #include "bindings/core/v8/WindowProxy.h"
33 33
34 #include "bindings/core/v8/DOMWrapperWorld.h" 34 #include "bindings/core/v8/DOMWrapperWorld.h"
35 #include "bindings/core/v8/ScriptController.h" 35 #include "bindings/core/v8/ScriptController.h"
36 #include "bindings/core/v8/V8Binding.h" 36 #include "bindings/core/v8/V8Binding.h"
37 #include "bindings/core/v8/V8DOMActivityLogger.h" 37 #include "bindings/core/v8/V8DOMActivityLogger.h"
38 #include "bindings/core/v8/V8Document.h" 38 #include "bindings/core/v8/V8Document.h"
39 #include "bindings/core/v8/V8GCForContextDispose.h" 39 #include "bindings/core/v8/V8GCForContextDispose.h"
40 #include "bindings/core/v8/V8HTMLCollection.h" 40 #include "bindings/core/v8/V8HTMLCollection.h"
41 #include "bindings/core/v8/V8HTMLDocument.h" 41 #include "bindings/core/v8/V8HTMLDocument.h"
42 #include "bindings/core/v8/V8HiddenValue.h" 42 #include "bindings/core/v8/V8HiddenValue.h"
(...skipping 24 matching lines...) Expand all
67 #include <v8.h> 67 #include <v8.h>
68 68
69 namespace blink { 69 namespace blink {
70 70
71 static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* docum ent) 71 static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* docum ent)
72 { 72 {
73 ASSERT(V8Document::toNative(wrapper) == document); 73 ASSERT(V8Document::toNative(wrapper) == document);
74 ASSERT(!document->isHTMLDocument() || (V8Document::toNative(v8::Handle<v8::O bject>::Cast(wrapper->GetPrototype())) == document)); 74 ASSERT(!document->isHTMLDocument() || (V8Document::toNative(v8::Handle<v8::O bject>::Cast(wrapper->GetPrototype())) == document));
75 } 75 }
76 76
77 PassOwnPtr<V8WindowShell> V8WindowShell::create(LocalFrame* frame, DOMWrapperWor ld& world, v8::Isolate* isolate) 77 PassOwnPtr<WindowProxy> WindowProxy::create(LocalFrame* frame, DOMWrapperWorld& world, v8::Isolate* isolate)
78 { 78 {
79 return adoptPtr(new V8WindowShell(frame, &world, isolate)); 79 return adoptPtr(new WindowProxy(frame, &world, isolate));
80 } 80 }
81 81
82 V8WindowShell::V8WindowShell(LocalFrame* frame, PassRefPtr<DOMWrapperWorld> worl d, v8::Isolate* isolate) 82 WindowProxy::WindowProxy(LocalFrame* frame, PassRefPtr<DOMWrapperWorld> world, v 8::Isolate* isolate)
83 : m_frame(frame) 83 : m_frame(frame)
84 , m_isolate(isolate) 84 , m_isolate(isolate)
85 , m_world(world) 85 , m_world(world)
86 { 86 {
87 } 87 }
88 88
89 void V8WindowShell::disposeContext(GlobalDetachmentBehavior behavior) 89 void WindowProxy::disposeContext(GlobalDetachmentBehavior behavior)
90 { 90 {
91 if (!isContextInitialized()) 91 if (!isContextInitialized())
92 return; 92 return;
93 93
94 v8::HandleScope handleScope(m_isolate); 94 v8::HandleScope handleScope(m_isolate);
95 v8::Handle<v8::Context> context = m_scriptState->context(); 95 v8::Handle<v8::Context> context = m_scriptState->context();
96 m_frame->loader().client()->willReleaseScriptContext(context, m_world->world Id()); 96 m_frame->loader().client()->willReleaseScriptContext(context, m_world->world Id());
97 97
98 if (behavior == DetachGlobal) 98 if (behavior == DetachGlobal)
99 context->DetachGlobal(); 99 context->DetachGlobal();
100 100
101 m_scriptState->disposePerContextData(); 101 m_scriptState->disposePerContextData();
102 102
103 // It's likely that disposing the context has created a lot of 103 // It's likely that disposing the context has created a lot of
104 // garbage. Notify V8 about this so it'll have a chance of cleaning 104 // garbage. Notify V8 about this so it'll have a chance of cleaning
105 // it up when idle. 105 // it up when idle.
106 V8GCForContextDispose::instanceTemplate().notifyContextDisposed(m_frame->isM ainFrame()); 106 V8GCForContextDispose::instanceTemplate().notifyContextDisposed(m_frame->isM ainFrame());
107 } 107 }
108 108
109 void V8WindowShell::clearForClose() 109 void WindowProxy::clearForClose()
110 { 110 {
111 if (!isContextInitialized()) 111 if (!isContextInitialized())
112 return; 112 return;
113 113
114 m_document.clear(); 114 m_document.clear();
115 disposeContext(DoNotDetachGlobal); 115 disposeContext(DoNotDetachGlobal);
116 } 116 }
117 117
118 void V8WindowShell::clearForNavigation() 118 void WindowProxy::clearForNavigation()
119 { 119 {
120 if (!isContextInitialized()) 120 if (!isContextInitialized())
121 return; 121 return;
122 122
123 ScriptState::Scope scope(m_scriptState.get()); 123 ScriptState::Scope scope(m_scriptState.get());
124 124
125 m_document.clear(); 125 m_document.clear();
126 126
127 // Clear the document wrapper cache before turning on access checks on 127 // Clear the document wrapper cache before turning on access checks on
128 // the old LocalDOMWindow wrapper. This way, access to the document wrapper 128 // the old LocalDOMWindow wrapper. This way, access to the document wrapper
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // via window.window, window.self, window.parent, etc. The outer window 163 // via window.window, window.self, window.parent, etc. The outer window
164 // has a security token which is the domain. The outer window cannot 164 // has a security token which is the domain. The outer window cannot
165 // have its own properties. window.foo = 'x' is delegated to the 165 // have its own properties. window.foo = 'x' is delegated to the
166 // inner window. 166 // inner window.
167 // 167 //
168 // When a frame navigates to a new page, the inner window is cut off 168 // When a frame navigates to a new page, the inner window is cut off
169 // the outer window, and the outer window identify is preserved for 169 // the outer window, and the outer window identify is preserved for
170 // the frame. However, a new inner window is created for the new page. 170 // the frame. However, a new inner window is created for the new page.
171 // If there are JS code holds a closure to the old inner window, 171 // If there are JS code holds a closure to the old inner window,
172 // it won't be able to reach the outer window via its global object. 172 // it won't be able to reach the outer window via its global object.
173 bool V8WindowShell::initializeIfNeeded() 173 bool WindowProxy::initializeIfNeeded()
174 { 174 {
175 if (isContextInitialized()) 175 if (isContextInitialized())
176 return true; 176 return true;
177 177
178 DOMWrapperWorld::setWorldOfInitializingWindow(m_world.get()); 178 DOMWrapperWorld::setWorldOfInitializingWindow(m_world.get());
179 bool result = initialize(); 179 bool result = initialize();
180 DOMWrapperWorld::setWorldOfInitializingWindow(0); 180 DOMWrapperWorld::setWorldOfInitializingWindow(0);
181 return result; 181 return result;
182 } 182 }
183 183
184 bool V8WindowShell::initialize() 184 bool WindowProxy::initialize()
185 { 185 {
186 TRACE_EVENT0("v8", "V8WindowShell::initialize"); 186 TRACE_EVENT0("v8", "WindowProxy::initialize");
187 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "InitializeWindow"); 187 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "InitializeWindow");
188 188
189 ScriptForbiddenScope::AllowUserAgentScript allowScript; 189 ScriptForbiddenScope::AllowUserAgentScript allowScript;
190 190
191 v8::HandleScope handleScope(m_isolate); 191 v8::HandleScope handleScope(m_isolate);
192 192
193 createContext(); 193 createContext();
194 194
195 if (!isContextInitialized()) 195 if (!isContextInitialized())
196 return false; 196 return false;
(...skipping 27 matching lines...) Expand all
224 SecurityOrigin* origin = m_world->isolatedWorldSecurityOrigin(); 224 SecurityOrigin* origin = m_world->isolatedWorldSecurityOrigin();
225 setSecurityToken(origin); 225 setSecurityToken(origin);
226 if (origin && InspectorInstrumentation::hasFrontends()) { 226 if (origin && InspectorInstrumentation::hasFrontends()) {
227 InspectorInstrumentation::didCreateIsolatedContext(m_frame, m_script State.get(), origin); 227 InspectorInstrumentation::didCreateIsolatedContext(m_frame, m_script State.get(), origin);
228 } 228 }
229 } 229 }
230 m_frame->loader().client()->didCreateScriptContext(context, m_world->extensi onGroup(), m_world->worldId()); 230 m_frame->loader().client()->didCreateScriptContext(context, m_world->extensi onGroup(), m_world->worldId());
231 return true; 231 return true;
232 } 232 }
233 233
234 void V8WindowShell::createContext() 234 void WindowProxy::createContext()
235 { 235 {
236 // The documentLoader pointer could be 0 during frame shutdown. 236 // The documentLoader pointer could be 0 during frame shutdown.
237 // FIXME: Can we remove this check? 237 // FIXME: Can we remove this check?
238 if (!m_frame->loader().documentLoader()) 238 if (!m_frame->loader().documentLoader())
239 return; 239 return;
240 240
241 // Create a new environment using an empty template for the shadow 241 // Create a new environment using an empty template for the shadow
242 // object. Reuse the global object if one has been created earlier. 242 // object. Reuse the global object if one has been created earlier.
243 v8::Handle<v8::ObjectTemplate> globalTemplate = V8Window::getShadowObjectTem plate(m_isolate); 243 v8::Handle<v8::ObjectTemplate> globalTemplate = V8Window::getShadowObjectTem plate(m_isolate);
244 if (globalTemplate.IsEmpty()) 244 if (globalTemplate.IsEmpty())
(...skipping 14 matching lines...) Expand all
259 extensionNames[index++] = extensions[i]->name(); 259 extensionNames[index++] = extensions[i]->name();
260 } 260 }
261 v8::ExtensionConfiguration extensionConfiguration(index, extensionNames.get( )); 261 v8::ExtensionConfiguration extensionConfiguration(index, extensionNames.get( ));
262 262
263 v8::Handle<v8::Context> context = v8::Context::New(m_isolate, &extensionConf iguration, globalTemplate, m_global.newLocal(m_isolate)); 263 v8::Handle<v8::Context> context = v8::Context::New(m_isolate, &extensionConf iguration, globalTemplate, m_global.newLocal(m_isolate));
264 if (context.IsEmpty()) 264 if (context.IsEmpty())
265 return; 265 return;
266 m_scriptState = ScriptState::create(context, m_world); 266 m_scriptState = ScriptState::create(context, m_world);
267 267
268 double contextCreationDurationInMilliseconds = (currentTime() - contextCreat ionStartInSeconds) * 1000; 268 double contextCreationDurationInMilliseconds = (currentTime() - contextCreat ionStartInSeconds) * 1000;
269 const char* histogramName = "WebCore.V8WindowShell.createContext.MainWorld"; 269 const char* histogramName = "WebCore.WindowProxy.createContext.MainWorld";
270 if (!m_world->isMainWorld()) 270 if (!m_world->isMainWorld())
271 histogramName = "WebCore.V8WindowShell.createContext.IsolatedWorld"; 271 histogramName = "WebCore.WindowProxy.createContext.IsolatedWorld";
272 blink::Platform::current()->histogramCustomCounts(histogramName, contextCrea tionDurationInMilliseconds, 0, 10000, 50); 272 blink::Platform::current()->histogramCustomCounts(histogramName, contextCrea tionDurationInMilliseconds, 0, 10000, 50);
273 } 273 }
274 274
275 static v8::Handle<v8::Object> toInnerGlobalObject(v8::Handle<v8::Context> contex t) 275 static v8::Handle<v8::Object> toInnerGlobalObject(v8::Handle<v8::Context> contex t)
276 { 276 {
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 WindowProxy::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, V8Window::toInternalPoi nter(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:
(...skipping 16 matching lines...) Expand all
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, V8Window::toInternalPointer(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::installConditionallyEnabledProperties(windowWrapper, m_isolate); 313 V8Window::installConditionallyEnabledProperties(windowWrapper, m_isolate);
314 return true; 314 return true;
315 } 315 }
316 316
317 void V8WindowShell::updateDocumentWrapper(v8::Handle<v8::Object> wrapper) 317 void WindowProxy::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);
321 } 321 }
322 322
323 void V8WindowShell::updateDocumentProperty() 323 void WindowProxy::updateDocumentProperty()
324 { 324 {
325 if (!m_world->isMainWorld()) 325 if (!m_world->isMainWorld())
326 return; 326 return;
327 327
328 ScriptState::Scope scope(m_scriptState.get()); 328 ScriptState::Scope scope(m_scriptState.get());
329 v8::Handle<v8::Context> context = m_scriptState->context(); 329 v8::Handle<v8::Context> context = m_scriptState->context();
330 v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document(), context->G lobal(), context->GetIsolate()); 330 v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document(), context->G lobal(), context->GetIsolate());
331 ASSERT(documentWrapper == m_document.newLocal(m_isolate) || m_document.isEmp ty()); 331 ASSERT(documentWrapper == m_document.newLocal(m_isolate) || m_document.isEmp ty());
332 if (m_document.isEmpty()) 332 if (m_document.isEmpty())
333 updateDocumentWrapper(v8::Handle<v8::Object>::Cast(documentWrapper)); 333 updateDocumentWrapper(v8::Handle<v8::Object>::Cast(documentWrapper));
334 checkDocumentWrapper(m_document.newLocal(m_isolate), m_frame->document()); 334 checkDocumentWrapper(m_document.newLocal(m_isolate), m_frame->document());
335 335
336 // If instantiation of the document wrapper fails, clear the cache 336 // If instantiation of the document wrapper fails, clear the cache
337 // and let the LocalDOMWindow accessor handle access to the document. 337 // and let the LocalDOMWindow accessor handle access to the document.
338 if (documentWrapper.IsEmpty()) { 338 if (documentWrapper.IsEmpty()) {
339 clearDocumentProperty(); 339 clearDocumentProperty();
340 return; 340 return;
341 } 341 }
342 ASSERT(documentWrapper->IsObject()); 342 ASSERT(documentWrapper->IsObject());
343 context->Global()->ForceSet(v8AtomicString(m_isolate, "document"), documentW rapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete)); 343 context->Global()->ForceSet(v8AtomicString(m_isolate, "document"), documentW rapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
344 344
345 // We also stash a reference to the document on the inner global object so t hat 345 // We also stash a reference to the document on the inner global object so t hat
346 // LocalDOMWindow objects we obtain from JavaScript references are guarantee d to have 346 // LocalDOMWindow objects we obtain from JavaScript references are guarantee d to have
347 // live Document objects. 347 // live Document objects.
348 V8HiddenValue::setHiddenValue(m_isolate, toInnerGlobalObject(context), V8Hid denValue::document(m_isolate), documentWrapper); 348 V8HiddenValue::setHiddenValue(m_isolate, toInnerGlobalObject(context), V8Hid denValue::document(m_isolate), documentWrapper);
349 } 349 }
350 350
351 void V8WindowShell::clearDocumentProperty() 351 void WindowProxy::clearDocumentProperty()
352 { 352 {
353 ASSERT(isContextInitialized()); 353 ASSERT(isContextInitialized());
354 if (!m_world->isMainWorld()) 354 if (!m_world->isMainWorld())
355 return; 355 return;
356 v8::HandleScope handleScope(m_isolate); 356 v8::HandleScope handleScope(m_isolate);
357 m_scriptState->context()->Global()->ForceDelete(v8AtomicString(m_isolate, "d ocument")); 357 m_scriptState->context()->Global()->ForceDelete(v8AtomicString(m_isolate, "d ocument"));
358 } 358 }
359 359
360 void V8WindowShell::updateActivityLogger() 360 void WindowProxy::updateActivityLogger()
361 { 361 {
362 m_scriptState->perContextData()->setActivityLogger(V8DOMActivityLogger::acti vityLogger( 362 m_scriptState->perContextData()->setActivityLogger(V8DOMActivityLogger::acti vityLogger(
363 m_world->worldId(), m_frame->document() ? m_frame->document()->baseURI() : KURL())); 363 m_world->worldId(), m_frame->document() ? m_frame->document()->baseURI() : KURL()));
364 } 364 }
365 365
366 void V8WindowShell::setSecurityToken(SecurityOrigin* origin) 366 void WindowProxy::setSecurityToken(SecurityOrigin* origin)
367 { 367 {
368 // If two tokens are equal, then the SecurityOrigins canAccess each other. 368 // If two tokens are equal, then the SecurityOrigins canAccess each other.
369 // If two tokens are not equal, then we have to call canAccess. 369 // If two tokens are not equal, then we have to call canAccess.
370 // Note: we can't use the HTTPOrigin if it was set from the DOM. 370 // Note: we can't use the HTTPOrigin if it was set from the DOM.
371 String token; 371 String token;
372 // We stick with an empty token if document.domain was modified or if we 372 // We stick with an empty token if document.domain was modified or if we
373 // are in the initial empty document, so that we can do a full canAccess 373 // are in the initial empty document, so that we can do a full canAccess
374 // check in those cases. 374 // check in those cases.
375 bool delaySet = m_world->isMainWorld() 375 bool delaySet = m_world->isMainWorld()
376 && (origin->domainWasSetInDOM() 376 && (origin->domainWasSetInDOM()
(...skipping 16 matching lines...) Expand all
393 393
394 if (m_world->isPrivateScriptIsolatedWorld()) 394 if (m_world->isPrivateScriptIsolatedWorld())
395 token = "private-script://" + token; 395 token = "private-script://" + token;
396 396
397 CString utf8Token = token.utf8(); 397 CString utf8Token = token.utf8();
398 // NOTE: V8 does identity comparison in fast path, must use a symbol 398 // NOTE: V8 does identity comparison in fast path, must use a symbol
399 // as the security token. 399 // as the security token.
400 context->SetSecurityToken(v8AtomicString(m_isolate, utf8Token.data(), utf8To ken.length())); 400 context->SetSecurityToken(v8AtomicString(m_isolate, utf8Token.data(), utf8To ken.length()));
401 } 401 }
402 402
403 void V8WindowShell::updateDocument() 403 void WindowProxy::updateDocument()
404 { 404 {
405 ASSERT(m_world->isMainWorld()); 405 ASSERT(m_world->isMainWorld());
406 if (!isGlobalInitialized()) 406 if (!isGlobalInitialized())
407 return; 407 return;
408 if (!isContextInitialized()) 408 if (!isContextInitialized())
409 return; 409 return;
410 updateActivityLogger(); 410 updateActivityLogger();
411 updateDocumentProperty(); 411 updateDocumentProperty();
412 updateSecurityOrigin(m_frame->document()->securityOrigin()); 412 updateSecurityOrigin(m_frame->document()->securityOrigin());
413 } 413 }
(...skipping 29 matching lines...) Expand all
443 v8SetReturnValue(info, result); 443 v8SetReturnValue(info, result);
444 return; 444 return;
445 } 445 }
446 v8::Handle<v8::Value> prototype = info.Holder()->GetPrototype(); 446 v8::Handle<v8::Value> prototype = info.Holder()->GetPrototype();
447 if (prototype->IsObject()) { 447 if (prototype->IsObject()) {
448 v8SetReturnValue(info, prototype.As<v8::Object>()->Get(property)); 448 v8SetReturnValue(info, prototype.As<v8::Object>()->Get(property));
449 return; 449 return;
450 } 450 }
451 } 451 }
452 452
453 void V8WindowShell::namedItemAdded(HTMLDocument* document, const AtomicString& n ame) 453 void WindowProxy::namedItemAdded(HTMLDocument* document, const AtomicString& nam e)
454 { 454 {
455 ASSERT(m_world->isMainWorld()); 455 ASSERT(m_world->isMainWorld());
456 456
457 if (!isContextInitialized()) 457 if (!isContextInitialized())
458 return; 458 return;
459 459
460 ScriptState::Scope scope(m_scriptState.get()); 460 ScriptState::Scope scope(m_scriptState.get());
461 ASSERT(!m_document.isEmpty()); 461 ASSERT(!m_document.isEmpty());
462 v8::Handle<v8::Object> documentHandle = m_document.newLocal(m_isolate); 462 v8::Handle<v8::Object> documentHandle = m_document.newLocal(m_isolate);
463 checkDocumentWrapper(documentHandle, document); 463 checkDocumentWrapper(documentHandle, document);
464 documentHandle->SetAccessor(v8String(m_isolate, name), getter); 464 documentHandle->SetAccessor(v8String(m_isolate, name), getter);
465 } 465 }
466 466
467 void V8WindowShell::namedItemRemoved(HTMLDocument* document, const AtomicString& name) 467 void WindowProxy::namedItemRemoved(HTMLDocument* document, const AtomicString& n ame)
468 { 468 {
469 ASSERT(m_world->isMainWorld()); 469 ASSERT(m_world->isMainWorld());
470 470
471 if (!isContextInitialized()) 471 if (!isContextInitialized())
472 return; 472 return;
473 473
474 if (document->hasNamedItem(name) || document->hasExtraNamedItem(name)) 474 if (document->hasNamedItem(name) || document->hasExtraNamedItem(name))
475 return; 475 return;
476 476
477 ScriptState::Scope scope(m_scriptState.get()); 477 ScriptState::Scope scope(m_scriptState.get());
478 ASSERT(!m_document.isEmpty()); 478 ASSERT(!m_document.isEmpty());
479 v8::Handle<v8::Object> documentHandle = m_document.newLocal(m_isolate); 479 v8::Handle<v8::Object> documentHandle = m_document.newLocal(m_isolate);
480 checkDocumentWrapper(documentHandle, document); 480 checkDocumentWrapper(documentHandle, document);
481 documentHandle->Delete(v8String(m_isolate, name)); 481 documentHandle->Delete(v8String(m_isolate, name));
482 } 482 }
483 483
484 void V8WindowShell::updateSecurityOrigin(SecurityOrigin* origin) 484 void WindowProxy::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
« no previous file with comments | « Source/bindings/core/v8/WindowProxy.h ('k') | Source/bindings/core/v8/v8.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698