Chromium Code Reviews| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 FrameConsole::mute(); | 182 FrameConsole::mute(); |
| 183 } | 183 } |
| 184 | 184 |
| 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* targetExecutionContext = toExecutionContext(target); |
| 193 ASSERT(executionContext); | 193 DCHECK(targetExecutionContext); |
| 194 | 194 |
| 195 if (executionContext->isMainThreadWorkletGlobalScope()) { | 195 ExecutionContext* callingExecutionContext = toExecutionContext(calling); |
| 196 MainThreadWorkletGlobalScope* globalScope = toMainThreadWorkletGlobalSco pe(executionContext); | 196 DCHECK(callingExecutionContext); |
| 197 return globalScope && BindingSecurity::shouldAllowAccessTo(m_isolate, to LocalDOMWindow(toDOMWindow(calling)), globalScope, DoNotReportSecurityError); | 197 |
| 198 } | 198 if (targetExecutionContext->isMainThreadWorkletGlobalScope()) |
|
dgozman
2016/06/28 19:21:00
I'd even let BindingSecurity do these if checks fo
Gleb Lanbin
2016/06/28 19:51:37
discussed offline. moved the entire logic to Bindi
| |
| 199 return BindingSecurity::shouldAllowAccessTo(m_isolate, calling, callingE xecutionContext, toMainThreadWorkletGlobalScope(targetExecutionContext), DoNotRe portSecurityError); | |
| 200 | |
| 201 if (callingExecutionContext->isMainThreadWorkletGlobalScope()) | |
| 202 return BindingSecurity::shouldAllowAccessTo(m_isolate, target, targetExe cutionContext, toMainThreadWorkletGlobalScope(callingExecutionContext), DoNotRep ortSecurityError); | |
| 199 | 203 |
| 200 DOMWindow* window = toDOMWindow(target); | 204 DOMWindow* window = toDOMWindow(target); |
| 201 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW indow(toDOMWindow(calling)), window, DoNotReportSecurityError); | 205 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW indow(toDOMWindow(calling)), window, DoNotReportSecurityError); |
| 202 } | 206 } |
| 203 | 207 |
| 204 int MainThreadDebugger::ensureDefaultContextInGroup(int contextGroupId) | 208 int MainThreadDebugger::ensureDefaultContextInGroup(int contextGroupId) |
| 205 { | 209 { |
| 206 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); | 210 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); |
| 207 if (!frame) | 211 if (!frame) |
| 208 return 0; | 212 return 0; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 return; | 343 return; |
| 340 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false)) | 344 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false)) |
| 341 return; | 345 return; |
| 342 } | 346 } |
| 343 info.GetReturnValue().Set(nodes); | 347 info.GetReturnValue().Set(nodes); |
| 344 } | 348 } |
| 345 exceptionState.throwIfNeeded(); | 349 exceptionState.throwIfNeeded(); |
| 346 } | 350 } |
| 347 | 351 |
| 348 } // namespace blink | 352 } // namespace blink |
| OLD | NEW |