| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 ASSERT(!m_clientMessageLoop); | 94 ASSERT(!m_clientMessageLoop); |
| 95 ASSERT(clientMessageLoop); | 95 ASSERT(clientMessageLoop); |
| 96 m_clientMessageLoop = clientMessageLoop; | 96 m_clientMessageLoop = clientMessageLoop; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void MainThreadDebugger::contextCreated(ScriptState* scriptState, LocalFrame* fr
ame, SecurityOrigin* origin) | 99 void MainThreadDebugger::contextCreated(ScriptState* scriptState, LocalFrame* fr
ame, SecurityOrigin* origin) |
| 100 { | 100 { |
| 101 ASSERT(isMainThread()); | 101 ASSERT(isMainThread()); |
| 102 v8::HandleScope handles(scriptState->isolate()); | 102 v8::HandleScope handles(scriptState->isolate()); |
| 103 DOMWrapperWorld& world = scriptState->world(); | 103 DOMWrapperWorld& world = scriptState->world(); |
| 104 bool isMainContext = frame->localFrameRoot() == frame && world.isMainWorld()
; | 104 if (frame->localFrameRoot() == frame && world.isMainWorld()) |
| 105 if (isMainContext) | |
| 106 debugger()->resetContextGroup(contextGroupId(frame)); | 105 debugger()->resetContextGroup(contextGroupId(frame)); |
| 107 debugger()->contextCreated(V8ContextInfo(scriptState->context(), contextGrou
pId(frame), isMainContext, world.isMainWorld(), origin ? origin->toRawString() :
"", world.isIsolatedWorld() ? world.isolatedWorldHumanReadableName() : "", Iden
tifiersFactory::frameId(frame))); | 106 debugger()->contextCreated(V8ContextInfo(scriptState->context(), contextGrou
pId(frame), world.isMainWorld(), origin ? origin->toRawString() : "", world.isIs
olatedWorld() ? world.isolatedWorldHumanReadableName() : "", IdentifiersFactory:
:frameId(frame))); |
| 108 } | 107 } |
| 109 | 108 |
| 110 void MainThreadDebugger::contextWillBeDestroyed(ScriptState* scriptState) | 109 void MainThreadDebugger::contextWillBeDestroyed(ScriptState* scriptState) |
| 111 { | 110 { |
| 112 v8::HandleScope handles(scriptState->isolate()); | 111 v8::HandleScope handles(scriptState->isolate()); |
| 113 debugger()->contextDestroyed(scriptState->context()); | 112 debugger()->contextDestroyed(scriptState->context()); |
| 114 } | 113 } |
| 115 | 114 |
| 116 int MainThreadDebugger::contextGroupId(LocalFrame* frame) | 115 int MainThreadDebugger::contextGroupId(LocalFrame* frame) |
| 117 { | 116 { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 185 |
| 187 if (executionContext->isWorkletGlobalScope()) { | 186 if (executionContext->isWorkletGlobalScope()) { |
| 188 MainThreadWorkletGlobalScope* globalScope = toMainThreadWorkletGlobalSco
pe(executionContext); | 187 MainThreadWorkletGlobalScope* globalScope = toMainThreadWorkletGlobalSco
pe(executionContext); |
| 189 return globalScope && BindingSecurity::shouldAllowAccessTo(m_isolate, to
LocalDOMWindow(toDOMWindow(calling)), globalScope, DoNotReportSecurityError); | 188 return globalScope && BindingSecurity::shouldAllowAccessTo(m_isolate, to
LocalDOMWindow(toDOMWindow(calling)), globalScope, DoNotReportSecurityError); |
| 190 } | 189 } |
| 191 | 190 |
| 192 DOMWindow* window = toDOMWindow(target); | 191 DOMWindow* window = toDOMWindow(target); |
| 193 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW
indow(toDOMWindow(calling)), window, DoNotReportSecurityError); | 192 return window && BindingSecurity::shouldAllowAccessTo(m_isolate, toLocalDOMW
indow(toDOMWindow(calling)), window, DoNotReportSecurityError); |
| 194 } | 193 } |
| 195 | 194 |
| 195 int MainThreadDebugger::ensureDefaultContextInGroup(int contextGroupId) |
| 196 { |
| 197 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); |
| 198 if (!frame) |
| 199 return 0; |
| 200 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
| 201 if (!scriptState) |
| 202 return 0; |
| 203 v8::HandleScope scopes(scriptState->isolate()); |
| 204 return V8Debugger::contextId(scriptState->context()); |
| 205 } |
| 206 |
| 196 } // namespace blink | 207 } // namespace blink |
| OLD | NEW |