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

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

Issue 2439013002: Implement cross-origin attributes using access check interceptors. (Closed)
Patch Set: Revert to using the origin-safe method getters/setters to try to fix postMessage... 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptState.h" 5 #include "bindings/core/v8/ScriptState.h"
6 6
7 #include "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.h"
8 #include "core/dom/ExecutionContext.h" 8 #include "core/dom/ExecutionContext.h"
9 #include "core/frame/LocalDOMWindow.h" 9 #include "core/frame/LocalDOMWindow.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 26 matching lines...) Expand all
37 m_world(world), 37 m_world(world),
38 m_perContextData(V8PerContextData::create(context)) 38 m_perContextData(V8PerContextData::create(context))
39 #if ENABLE(ASSERT) 39 #if ENABLE(ASSERT)
40 , 40 ,
41 m_globalObjectDetached(false) 41 m_globalObjectDetached(false)
42 #endif 42 #endif
43 { 43 {
44 ASSERT(m_world); 44 ASSERT(m_world);
45 m_context.setWeak(this, &weakCallback); 45 m_context.setWeak(this, &weakCallback);
46 context->SetAlignedPointerInEmbedderData(v8ContextPerContextDataIndex, this); 46 context->SetAlignedPointerInEmbedderData(v8ContextPerContextDataIndex, this);
47 v8::Local<v8::Object> global = context->Global();
48 // TODO(jochen): Remove this once we correctly set internal fields on the
49 // global proxy.
50 if (global->InternalFieldCount()) {
51 int indicies[] = {v8DOMWrapperTypeIndex, v8DOMWrapperObjectIndex};
52 void* values[] = {nullptr, nullptr};
53 global->SetAlignedPointerInInternalFields(2, indicies, values);
54 }
55 } 47 }
56 48
57 ScriptState::~ScriptState() { 49 ScriptState::~ScriptState() {
58 ASSERT(!m_perContextData); 50 ASSERT(!m_perContextData);
59 ASSERT(m_context.isEmpty()); 51 ASSERT(m_context.isEmpty());
60 } 52 }
61 53
62 void ScriptState::detachGlobalObject() { 54 void ScriptState::detachGlobalObject() {
63 ASSERT(!m_context.isEmpty()); 55 ASSERT(!m_context.isEmpty());
64 context()->DetachGlobal(); 56 context()->DetachGlobal();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 v8::HandleScope handleScope(toIsolate(frame)); 97 v8::HandleScope handleScope(toIsolate(frame));
106 v8::Local<v8::Context> context = toV8Context(frame, world); 98 v8::Local<v8::Context> context = toV8Context(frame, world);
107 if (context.IsEmpty()) 99 if (context.IsEmpty())
108 return nullptr; 100 return nullptr;
109 ScriptState* scriptState = ScriptState::from(context); 101 ScriptState* scriptState = ScriptState::from(context);
110 ASSERT(scriptState->contextIsValid()); 102 ASSERT(scriptState->contextIsValid());
111 return scriptState; 103 return scriptState;
112 } 104 }
113 105
114 } // namespace blink 106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698