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

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

Issue 2429343004: [CachedAccessor] for window.document. (Closed)
Patch Set: Oh look, layouttests, document is a getter now. Created 4 years, 2 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
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 24 matching lines...) Expand all
35 #include "bindings/core/v8/V8Binding.h" 35 #include "bindings/core/v8/V8Binding.h"
36 #include "bindings/core/v8/V8DOMActivityLogger.h" 36 #include "bindings/core/v8/V8DOMActivityLogger.h"
37 #include "bindings/core/v8/V8Document.h" 37 #include "bindings/core/v8/V8Document.h"
38 #include "bindings/core/v8/V8GCForContextDispose.h" 38 #include "bindings/core/v8/V8GCForContextDispose.h"
39 #include "bindings/core/v8/V8HTMLCollection.h" 39 #include "bindings/core/v8/V8HTMLCollection.h"
40 #include "bindings/core/v8/V8HTMLDocument.h" 40 #include "bindings/core/v8/V8HTMLDocument.h"
41 #include "bindings/core/v8/V8HiddenValue.h" 41 #include "bindings/core/v8/V8HiddenValue.h"
42 #include "bindings/core/v8/V8Initializer.h" 42 #include "bindings/core/v8/V8Initializer.h"
43 #include "bindings/core/v8/V8ObjectConstructor.h" 43 #include "bindings/core/v8/V8ObjectConstructor.h"
44 #include "bindings/core/v8/V8PagePopupControllerBinding.h" 44 #include "bindings/core/v8/V8PagePopupControllerBinding.h"
45 #include "bindings/core/v8/V8PrivateProperty.h"
45 #include "bindings/core/v8/V8Window.h" 46 #include "bindings/core/v8/V8Window.h"
46 #include "core/frame/LocalFrame.h" 47 #include "core/frame/LocalFrame.h"
47 #include "core/frame/csp/ContentSecurityPolicy.h" 48 #include "core/frame/csp/ContentSecurityPolicy.h"
48 #include "core/html/DocumentNameCollection.h" 49 #include "core/html/DocumentNameCollection.h"
49 #include "core/html/HTMLCollection.h" 50 #include "core/html/HTMLCollection.h"
50 #include "core/html/HTMLIFrameElement.h" 51 #include "core/html/HTMLIFrameElement.h"
51 #include "core/inspector/InspectorInstrumentation.h" 52 #include "core/inspector/InspectorInstrumentation.h"
52 #include "core/inspector/MainThreadDebugger.h" 53 #include "core/inspector/MainThreadDebugger.h"
53 #include "core/loader/DocumentLoader.h" 54 #include "core/loader/DocumentLoader.h"
54 #include "core/loader/FrameLoader.h" 55 #include "core/loader/FrameLoader.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 toV8(frame->document(), context->Global(), context->GetIsolate()); 411 toV8(frame->document(), context->Global(), context->GetIsolate());
411 if (documentWrapper.IsEmpty()) 412 if (documentWrapper.IsEmpty())
412 return; 413 return;
413 ASSERT(documentWrapper == m_document.newLocal(m_isolate) || 414 ASSERT(documentWrapper == m_document.newLocal(m_isolate) ||
414 m_document.isEmpty()); 415 m_document.isEmpty());
415 if (m_document.isEmpty()) 416 if (m_document.isEmpty())
416 updateDocumentWrapper(v8::Local<v8::Object>::Cast(documentWrapper)); 417 updateDocumentWrapper(v8::Local<v8::Object>::Cast(documentWrapper));
417 checkDocumentWrapper(m_document.newLocal(m_isolate), frame->document()); 418 checkDocumentWrapper(m_document.newLocal(m_isolate), frame->document());
418 419
419 ASSERT(documentWrapper->IsObject()); 420 ASSERT(documentWrapper->IsObject());
420 // TODO(jochen): Don't replace the accessor with a data value. We need a way 421
421 // to tell v8 that the accessor's return value won't change after this point. 422 // Update cached accessor.
422 if (!v8CallBoolean(context->Global()->ForceSet( 423 CHECK(V8PrivateProperty::getWindowDocumentCachedAccessor(m_isolate).set(
jochen (gone - plz use gerrit) 2016/10/20 08:44:42 how does this work for isolated worlds? This metho
vogelheim 2016/10/20 13:27:59 Yes. main world: - accessor gets created with hid
423 context, v8AtomicString(m_isolate, "document"), documentWrapper, 424 context, context->Global(), documentWrapper));
424 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete))))
425 return;
426 } 425 }
427 426
428 void WindowProxy::updateActivityLogger() { 427 void WindowProxy::updateActivityLogger() {
429 m_scriptState->perContextData()->setActivityLogger( 428 m_scriptState->perContextData()->setActivityLogger(
430 V8DOMActivityLogger::activityLogger( 429 V8DOMActivityLogger::activityLogger(
431 m_world->worldId(), 430 m_world->worldId(),
432 m_frame->isLocalFrame() && toLocalFrame(m_frame)->document() 431 m_frame->isLocalFrame() && toLocalFrame(m_frame)->document()
433 ? toLocalFrame(m_frame)->document()->baseURI() 432 ? toLocalFrame(m_frame)->document()->baseURI()
434 : KURL())); 433 : KURL()));
435 } 434 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 v8String(m_isolate, name)); 575 v8String(m_isolate, name));
577 } 576 }
578 577
579 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) { 578 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) {
580 if (!isContextInitialized()) 579 if (!isContextInitialized())
581 return; 580 return;
582 setSecurityToken(origin); 581 setSecurityToken(origin);
583 } 582 }
584 583
585 } // namespace blink 584 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698