OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 DCHECK(isMainThread()); | 105 DCHECK(isMainThread()); |
106 if (frame->localFrameRoot() == frame) | 106 if (frame->localFrameRoot() == frame) |
107 debugger()->resetContextGroup(contextGroupId(frame)); | 107 debugger()->resetContextGroup(contextGroupId(frame)); |
108 } | 108 } |
109 | 109 |
110 void MainThreadDebugger::contextCreated(ScriptState* scriptState, LocalFrame* fr ame, SecurityOrigin* origin) | 110 void MainThreadDebugger::contextCreated(ScriptState* scriptState, LocalFrame* fr ame, SecurityOrigin* origin) |
111 { | 111 { |
112 ASSERT(isMainThread()); | 112 ASSERT(isMainThread()); |
113 v8::HandleScope handles(scriptState->isolate()); | 113 v8::HandleScope handles(scriptState->isolate()); |
114 DOMWrapperWorld& world = scriptState->world(); | 114 DOMWrapperWorld& world = scriptState->world(); |
115 DLOG(WARNING) << toDOMWindow(scriptState->isolate()->GetCallingContext()); | |
115 debugger()->contextCreated(V8ContextInfo(scriptState->context(), contextGrou pId(frame), world.isMainWorld(), origin ? origin->toRawString() : "", world.isIs olatedWorld() ? world.isolatedWorldHumanReadableName() : "", IdentifiersFactory: :frameId(frame), scriptState->getExecutionContext()->isDocument())); | 116 debugger()->contextCreated(V8ContextInfo(scriptState->context(), contextGrou pId(frame), world.isMainWorld(), origin ? origin->toRawString() : "", world.isIs olatedWorld() ? world.isolatedWorldHumanReadableName() : "", IdentifiersFactory: :frameId(frame), scriptState->getExecutionContext()->isDocument())); |
116 } | 117 } |
117 | 118 |
118 void MainThreadDebugger::contextWillBeDestroyed(ScriptState* scriptState) | 119 void MainThreadDebugger::contextWillBeDestroyed(ScriptState* scriptState) |
119 { | 120 { |
120 v8::HandleScope handles(scriptState->isolate()); | 121 v8::HandleScope handles(scriptState->isolate()); |
121 debugger()->contextDestroyed(scriptState->context()); | 122 debugger()->contextDestroyed(scriptState->context()); |
122 } | 123 } |
123 | 124 |
124 int MainThreadDebugger::contextGroupId(LocalFrame* frame) | 125 int MainThreadDebugger::contextGroupId(LocalFrame* frame) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 FrameConsole::unmute(); | 188 FrameConsole::unmute(); |
188 } | 189 } |
189 | 190 |
190 bool MainThreadDebugger::callingContextCanAccessContext(v8::Local<v8::Context> c alling, v8::Local<v8::Context> target) | 191 bool MainThreadDebugger::callingContextCanAccessContext(v8::Local<v8::Context> c alling, v8::Local<v8::Context> target) |
191 { | 192 { |
192 ExecutionContext* executionContext = toExecutionContext(target); | 193 ExecutionContext* executionContext = toExecutionContext(target); |
193 ASSERT(executionContext); | 194 ASSERT(executionContext); |
194 | 195 |
195 if (executionContext->isMainThreadWorkletGlobalScope()) { | 196 if (executionContext->isMainThreadWorkletGlobalScope()) { |
196 MainThreadWorkletGlobalScope* globalScope = toMainThreadWorkletGlobalSco pe(executionContext); | 197 MainThreadWorkletGlobalScope* globalScope = toMainThreadWorkletGlobalSco pe(executionContext); |
197 return globalScope && BindingSecurity::shouldAllowAccessTo(m_isolate, to LocalDOMWindow(toDOMWindow(calling)), globalScope, DoNotReportSecurityError); | 198 DLOG(WARNING) << toLocalDOMWindow(toDOMWindow(calling)); |
199 DLOG(WARNING) << toLocalDOMWindow(toDOMWindow(target)); | |
200 if (globalScope) { | |
dgozman
2016/06/24 22:03:15
This code only runs if |target| is a worklet. You
Gleb Lanbin
2016/06/25 00:17:26
not sure if it helps. In my case when I stop insid
dgozman
2016/06/27 21:16:41
Take a look at how BindingSecurity::shouldAllowAcc
| |
201 bool isAllowedToWorklet = BindingSecurity::shouldAllowAccessTo(m_iso late, toLocalDOMWindow(toDOMWindow(calling)), globalScope, DoNotReportSecurityEr ror); | |
202 bool isAllowedFromWorklet = BindingSecurity::shouldAllowAccessTo(m_i solate, toLocalDOMWindow(toDOMWindow(target)), globalScope, DoNotReportSecurityE rror); | |
203 return isAllowedToWorklet || isAllowedFromWorklet; | |
204 } | |
205 return false; | |
198 } | 206 } |
199 | 207 |
200 DOMWindow* window = toDOMWindow(target); | 208 DOMWindow* window = toDOMWindow(target); |
201 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW indow(toDOMWindow(calling)), window, DoNotReportSecurityError); | 209 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW indow(toDOMWindow(calling)), window, DoNotReportSecurityError); |
202 } | 210 } |
203 | 211 |
204 int MainThreadDebugger::ensureDefaultContextInGroup(int contextGroupId) | 212 int MainThreadDebugger::ensureDefaultContextInGroup(int contextGroupId) |
205 { | 213 { |
206 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); | 214 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); |
207 if (!frame) | 215 if (!frame) |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 return; | 347 return; |
340 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false)) | 348 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false)) |
341 return; | 349 return; |
342 } | 350 } |
343 info.GetReturnValue().Set(nodes); | 351 info.GetReturnValue().Set(nodes); |
344 } | 352 } |
345 exceptionState.throwIfNeeded(); | 353 exceptionState.throwIfNeeded(); |
346 } | 354 } |
347 | 355 |
348 } // namespace blink | 356 } // namespace blink |
OLD | NEW |