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 16 matching lines...) Expand all Loading... |
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" | 33 #include "bindings/core/v8/BindingSecurity.h" |
34 #include "bindings/core/v8/DOMWrapperWorld.h" | 34 #include "bindings/core/v8/DOMWrapperWorld.h" |
35 #include "bindings/core/v8/ScriptController.h" | 35 #include "bindings/core/v8/ScriptController.h" |
36 #include "bindings/core/v8/V8Window.h" | 36 #include "bindings/core/v8/V8Window.h" |
| 37 #include "core/dom/ExecutionContext.h" |
37 #include "core/frame/FrameConsole.h" | 38 #include "core/frame/FrameConsole.h" |
38 #include "core/frame/LocalDOMWindow.h" | 39 #include "core/frame/LocalDOMWindow.h" |
39 #include "core/frame/LocalFrame.h" | 40 #include "core/frame/LocalFrame.h" |
40 #include "core/frame/UseCounter.h" | 41 #include "core/frame/UseCounter.h" |
41 #include "core/inspector/IdentifiersFactory.h" | 42 #include "core/inspector/IdentifiersFactory.h" |
42 #include "core/inspector/InspectedFrames.h" | 43 #include "core/inspector/InspectedFrames.h" |
43 #include "core/inspector/InspectorTaskRunner.h" | 44 #include "core/inspector/InspectorTaskRunner.h" |
| 45 #include "core/workers/MainThreadWorkletGlobalScope.h" |
44 #include "platform/UserGestureIndicator.h" | 46 #include "platform/UserGestureIndicator.h" |
45 #include "platform/v8_inspector/public/V8Debugger.h" | 47 #include "platform/v8_inspector/public/V8Debugger.h" |
46 #include "wtf/OwnPtr.h" | 48 #include "wtf/OwnPtr.h" |
47 #include "wtf/PassOwnPtr.h" | 49 #include "wtf/PassOwnPtr.h" |
48 #include "wtf/ThreadingPrimitives.h" | 50 #include "wtf/ThreadingPrimitives.h" |
49 | 51 |
50 namespace blink { | 52 namespace blink { |
51 | 53 |
52 namespace { | 54 namespace { |
53 | 55 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 153 } |
152 | 154 |
153 void MainThreadDebugger::unmuteWarningsAndDeprecations() | 155 void MainThreadDebugger::unmuteWarningsAndDeprecations() |
154 { | 156 { |
155 FrameConsole::unmute(); | 157 FrameConsole::unmute(); |
156 UseCounter::unmuteForInspector(); | 158 UseCounter::unmuteForInspector(); |
157 } | 159 } |
158 | 160 |
159 bool MainThreadDebugger::callingContextCanAccessContext(v8::Local<v8::Context> c
alling, v8::Local<v8::Context> target) | 161 bool MainThreadDebugger::callingContextCanAccessContext(v8::Local<v8::Context> c
alling, v8::Local<v8::Context> target) |
160 { | 162 { |
| 163 ExecutionContext* executionContext = toExecutionContext(target); |
| 164 ASSERT(executionContext); |
| 165 |
| 166 if (executionContext->isWorkletGlobalScope()) { |
| 167 MainThreadWorkletGlobalScope* globalScope = toMainThreadWorkletGlobalSco
pe(executionContext); |
| 168 return globalScope && BindingSecurity::shouldAllowAccessTo(m_isolate, to
LocalDOMWindow(toDOMWindow(calling)), globalScope, DoNotReportSecurityError); |
| 169 } |
| 170 |
161 DOMWindow* window = toDOMWindow(target); | 171 DOMWindow* window = toDOMWindow(target); |
162 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW
indow(toDOMWindow(calling)), window, DoNotReportSecurityError); | 172 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW
indow(toDOMWindow(calling)), window, DoNotReportSecurityError); |
163 } | 173 } |
164 | 174 |
165 void MainThreadDebugger::contextsToReport(int contextGroupId, V8ContextInfoVecto
r& contexts) | 175 void MainThreadDebugger::contextsToReport(int contextGroupId, V8ContextInfoVecto
r& contexts) |
166 { | 176 { |
167 LocalFrame* root = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); | 177 LocalFrame* root = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); |
168 if (!root) | 178 if (!root) |
169 return; | 179 return; |
170 | 180 |
(...skipping 23 matching lines...) Expand all Loading... |
194 for (const auto& pair : isolatedContexts) { | 204 for (const auto& pair : isolatedContexts) { |
195 String originString = pair.second ? pair.second->toRawString() : ""; | 205 String originString = pair.second ? pair.second->toRawString() : ""; |
196 ScriptState* scriptState = pair.first; | 206 ScriptState* scriptState = pair.first; |
197 contexts.append(V8ContextInfo(scriptState->context(), false, originS
tring, scriptState->world().isolatedWorldHumanReadableName(), frameId)); | 207 contexts.append(V8ContextInfo(scriptState->context(), false, originS
tring, scriptState->world().isolatedWorldHumanReadableName(), frameId)); |
198 } | 208 } |
199 isolatedContexts.clear(); | 209 isolatedContexts.clear(); |
200 } | 210 } |
201 } | 211 } |
202 | 212 |
203 } // namespace blink | 213 } // namespace blink |
OLD | NEW |