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 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "core/inspector/MainThreadDebugger.h" | 31 #include "core/inspector/MainThreadDebugger.h" |
32 | 32 |
33 #include "bindings/core/v8/BindingSecurity.h" | |
34 #include "bindings/core/v8/DOMWrapperWorld.h" | 33 #include "bindings/core/v8/DOMWrapperWorld.h" |
35 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
36 #include "bindings/core/v8/V8Node.h" | 35 #include "bindings/core/v8/V8Node.h" |
37 #include "bindings/core/v8/V8Window.h" | 36 #include "bindings/core/v8/V8Window.h" |
38 #include "core/dom/ContainerNode.h" | 37 #include "core/dom/ContainerNode.h" |
39 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
40 #include "core/dom/Element.h" | 39 #include "core/dom/Element.h" |
41 #include "core/dom/ExecutionContext.h" | 40 #include "core/dom/ExecutionContext.h" |
42 #include "core/dom/StaticNodeList.h" | 41 #include "core/dom/StaticNodeList.h" |
43 #include "core/frame/FrameConsole.h" | 42 #include "core/frame/FrameConsole.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 void MainThreadDebugger::muteConsole() | 179 void MainThreadDebugger::muteConsole() |
181 { | 180 { |
182 FrameConsole::mute(); | 181 FrameConsole::mute(); |
183 } | 182 } |
184 | 183 |
185 void MainThreadDebugger::unmuteConsole() | 184 void MainThreadDebugger::unmuteConsole() |
186 { | 185 { |
187 FrameConsole::unmute(); | 186 FrameConsole::unmute(); |
188 } | 187 } |
189 | 188 |
190 bool MainThreadDebugger::callingContextCanAccessContext(v8::Local<v8::Context> c
alling, v8::Local<v8::Context> target) | |
191 { | |
192 ExecutionContext* executionContext = toExecutionContext(target); | |
193 ASSERT(executionContext); | |
194 | |
195 if (executionContext->isMainThreadWorkletGlobalScope()) { | |
196 MainThreadWorkletGlobalScope* globalScope = toMainThreadWorkletGlobalSco
pe(executionContext); | |
197 return globalScope && BindingSecurity::shouldAllowAccessTo(m_isolate, to
LocalDOMWindow(toDOMWindow(calling)), globalScope, DoNotReportSecurityError); | |
198 } | |
199 | |
200 DOMWindow* window = toDOMWindow(target); | |
201 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW
indow(toDOMWindow(calling)), window, DoNotReportSecurityError); | |
202 } | |
203 | |
204 int MainThreadDebugger::ensureDefaultContextInGroup(int contextGroupId) | 189 int MainThreadDebugger::ensureDefaultContextInGroup(int contextGroupId) |
205 { | 190 { |
206 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); | 191 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); |
207 if (!frame) | 192 if (!frame) |
208 return 0; | 193 return 0; |
209 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 194 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
210 if (!scriptState) | 195 if (!scriptState) |
211 return 0; | 196 return 0; |
212 v8::HandleScope scopes(scriptState->isolate()); | 197 v8::HandleScope scopes(scriptState->isolate()); |
213 return V8Debugger::contextId(scriptState->context()); | 198 return V8Debugger::contextId(scriptState->context()); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 return; | 324 return; |
340 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get
Isolate())).FromMaybe(false)) | 325 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get
Isolate())).FromMaybe(false)) |
341 return; | 326 return; |
342 } | 327 } |
343 info.GetReturnValue().Set(nodes); | 328 info.GetReturnValue().Set(nodes); |
344 } | 329 } |
345 exceptionState.throwIfNeeded(); | 330 exceptionState.throwIfNeeded(); |
346 } | 331 } |
347 | 332 |
348 } // namespace blink | 333 } // namespace blink |
OLD | NEW |