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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 void MainThreadDebugger::unmuteConsole() | 185 void MainThreadDebugger::unmuteConsole() |
186 { | 186 { |
187 FrameConsole::unmute(); | 187 FrameConsole::unmute(); |
188 } | 188 } |
189 | 189 |
190 bool MainThreadDebugger::callingContextCanAccessContext(v8::Local<v8::Context> c alling, v8::Local<v8::Context> target) | 190 bool MainThreadDebugger::callingContextCanAccessContext(v8::Local<v8::Context> c alling, v8::Local<v8::Context> target) |
191 { | 191 { |
192 ExecutionContext* executionContext = toExecutionContext(target); | 192 ExecutionContext* executionContext = toExecutionContext(target); |
193 ASSERT(executionContext); | 193 ASSERT(executionContext); |
194 | 194 |
195 if (executionContext->isMainThreadWorkletGlobalScope()) { | 195 if (executionContext->isMainThreadWorkletGlobalScope()) { |
dgozman
2016/06/27 23:12:33
I think this code is too complicated now, and shou
Yuki
2016/06/28 04:38:53
Yes, please move this code into BindingSecurity.
Gleb Lanbin
2016/06/28 17:58:33
Done.
| |
196 ExecutionContext* callingExecutionContext = toExecutionContext(calling); | |
197 DCHECK(callingExecutionContext); | |
198 DOMWindow* callingDomWindow = toDOMWindow(calling); | |
199 if (callingExecutionContext->isMainThreadWorkletGlobalScope()) { | |
dgozman
2016/06/27 23:13:38
This looks pretty good. However, adding the revers
Gleb Lanbin
2016/06/28 17:58:33
Done.
| |
200 Frame* callingFrame = toMainThreadWorkletGlobalScope(callingExecutio nContext)->frame(); | |
201 callingDomWindow = callingFrame ? callingFrame->domWindow() : nullpt r; | |
202 } | |
196 MainThreadWorkletGlobalScope* globalScope = toMainThreadWorkletGlobalSco pe(executionContext); | 203 MainThreadWorkletGlobalScope* globalScope = toMainThreadWorkletGlobalSco pe(executionContext); |
197 return globalScope && BindingSecurity::shouldAllowAccessTo(m_isolate, to LocalDOMWindow(toDOMWindow(calling)), globalScope, DoNotReportSecurityError); | 204 return globalScope && callingDomWindow && BindingSecurity::shouldAllowAc cessTo(m_isolate, toLocalDOMWindow(callingDomWindow), globalScope, DoNotReportSe curityError); |
198 } | 205 } |
199 | 206 |
200 DOMWindow* window = toDOMWindow(target); | 207 DOMWindow* window = toDOMWindow(target); |
201 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW indow(toDOMWindow(calling)), window, DoNotReportSecurityError); | 208 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW indow(toDOMWindow(calling)), window, DoNotReportSecurityError); |
202 } | 209 } |
203 | 210 |
204 int MainThreadDebugger::ensureDefaultContextInGroup(int contextGroupId) | 211 int MainThreadDebugger::ensureDefaultContextInGroup(int contextGroupId) |
205 { | 212 { |
206 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); | 213 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); |
207 if (!frame) | 214 if (!frame) |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 return; | 346 return; |
340 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false)) | 347 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false)) |
341 return; | 348 return; |
342 } | 349 } |
343 info.GetReturnValue().Set(nodes); | 350 info.GetReturnValue().Set(nodes); |
344 } | 351 } |
345 exceptionState.throwIfNeeded(); | 352 exceptionState.throwIfNeeded(); |
346 } | 353 } |
347 | 354 |
348 } // namespace blink | 355 } // namespace blink |
OLD | NEW |