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

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

Issue 2429343004: [CachedAccessor] for window.document. (Closed)
Patch Set: Fix expectation for global-interface-listing-expected, windows. Created 4 years, 1 month 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
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 25 matching lines...) Expand all
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"
43 #include "bindings/core/v8/V8Initializer.h" 43 #include "bindings/core/v8/V8Initializer.h"
44 #include "bindings/core/v8/V8ObjectConstructor.h" 44 #include "bindings/core/v8/V8ObjectConstructor.h"
45 #include "bindings/core/v8/V8PagePopupControllerBinding.h" 45 #include "bindings/core/v8/V8PagePopupControllerBinding.h"
46 #include "bindings/core/v8/V8PrivateProperty.h"
46 #include "bindings/core/v8/V8Window.h" 47 #include "bindings/core/v8/V8Window.h"
47 #include "core/frame/LocalFrame.h" 48 #include "core/frame/LocalFrame.h"
48 #include "core/frame/csp/ContentSecurityPolicy.h" 49 #include "core/frame/csp/ContentSecurityPolicy.h"
49 #include "core/html/DocumentNameCollection.h" 50 #include "core/html/DocumentNameCollection.h"
50 #include "core/html/HTMLCollection.h" 51 #include "core/html/HTMLCollection.h"
51 #include "core/html/HTMLIFrameElement.h" 52 #include "core/html/HTMLIFrameElement.h"
52 #include "core/inspector/InspectorInstrumentation.h" 53 #include "core/inspector/InspectorInstrumentation.h"
53 #include "core/inspector/MainThreadDebugger.h" 54 #include "core/inspector/MainThreadDebugger.h"
54 #include "core/loader/DocumentLoader.h" 55 #include "core/loader/DocumentLoader.h"
55 #include "core/loader/FrameLoader.h" 56 #include "core/loader/FrameLoader.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 toV8(frame->document(), context->Global(), context->GetIsolate()); 417 toV8(frame->document(), context->Global(), context->GetIsolate());
417 if (documentWrapper.IsEmpty()) 418 if (documentWrapper.IsEmpty())
418 return; 419 return;
419 ASSERT(documentWrapper == m_document.newLocal(m_isolate) || 420 ASSERT(documentWrapper == m_document.newLocal(m_isolate) ||
420 m_document.isEmpty()); 421 m_document.isEmpty());
421 if (m_document.isEmpty()) 422 if (m_document.isEmpty())
422 updateDocumentWrapper(v8::Local<v8::Object>::Cast(documentWrapper)); 423 updateDocumentWrapper(v8::Local<v8::Object>::Cast(documentWrapper));
423 checkDocumentWrapper(m_document.newLocal(m_isolate), frame->document()); 424 checkDocumentWrapper(m_document.newLocal(m_isolate), frame->document());
424 425
425 ASSERT(documentWrapper->IsObject()); 426 ASSERT(documentWrapper->IsObject());
426 // TODO(jochen): Don't replace the accessor with a data value. We need a way 427
427 // to tell v8 that the accessor's return value won't change after this point. 428 // Update cached accessor.
428 if (!v8CallBoolean(context->Global()->ForceSet( 429 CHECK(V8PrivateProperty::getWindowDocumentCachedAccessor(m_isolate).set(
429 context, v8AtomicString(m_isolate, "document"), documentWrapper, 430 context, context->Global(), documentWrapper));
430 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete))))
431 return;
432 } 431 }
433 432
434 void WindowProxy::updateActivityLogger() { 433 void WindowProxy::updateActivityLogger() {
435 m_scriptState->perContextData()->setActivityLogger( 434 m_scriptState->perContextData()->setActivityLogger(
436 V8DOMActivityLogger::activityLogger( 435 V8DOMActivityLogger::activityLogger(
437 m_world->worldId(), 436 m_world->worldId(),
438 m_frame->isLocalFrame() && toLocalFrame(m_frame)->document() 437 m_frame->isLocalFrame() && toLocalFrame(m_frame)->document()
439 ? toLocalFrame(m_frame)->document()->baseURI() 438 ? toLocalFrame(m_frame)->document()->baseURI()
440 : KURL())); 439 : KURL()));
441 } 440 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 v8String(m_isolate, name)); 581 v8String(m_isolate, name));
583 } 582 }
584 583
585 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) { 584 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) {
586 if (!isContextInitialized()) 585 if (!isContextInitialized())
587 return; 586 return;
588 setSecurityToken(origin); 587 setSecurityToken(origin);
589 } 588 }
590 589
591 } // namespace blink 590 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698