| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 LocalFrame* root = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); | 187 LocalFrame* root = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); |
| 188 if (!root) | 188 if (!root) |
| 189 return; | 189 return; |
| 190 | 190 |
| 191 // Only report existing contexts if the page did commit load, otherwise we m
ay | 191 // Only report existing contexts if the page did commit load, otherwise we m
ay |
| 192 // unintentionally initialize contexts in the frames which may trigger some
listeners | 192 // unintentionally initialize contexts in the frames which may trigger some
listeners |
| 193 // that are expected to be triggered only after the load is committed, see h
ttp://crbug.com/131623 | 193 // that are expected to be triggered only after the load is committed, see h
ttp://crbug.com/131623 |
| 194 if (!root->loader().stateMachine()->committedFirstRealDocumentLoad()) | 194 if (!root->loader().stateMachine()->committedFirstRealDocumentLoad()) |
| 195 return; | 195 return; |
| 196 | 196 |
| 197 OwnPtrWillBeRawPtr<InspectedFrames> inspectedFrames = InspectedFrames::creat
e(root); | 197 RawPtr<InspectedFrames> inspectedFrames = InspectedFrames::create(root); |
| 198 | 198 |
| 199 Vector<std::pair<ScriptState*, SecurityOrigin*>> isolatedContexts; | 199 Vector<std::pair<ScriptState*, SecurityOrigin*>> isolatedContexts; |
| 200 for (LocalFrame* frame : *inspectedFrames) { | 200 for (LocalFrame* frame : *inspectedFrames) { |
| 201 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 201 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
| 202 continue; | 202 continue; |
| 203 String frameId = IdentifiersFactory::frameId(frame); | 203 String frameId = IdentifiersFactory::frameId(frame); |
| 204 | 204 |
| 205 // Ensure execution context is created. | 205 // Ensure execution context is created. |
| 206 // If initializeMainWorld returns true, then is registered by didCreateS
criptContext | 206 // If initializeMainWorld returns true, then is registered by didCreateS
criptContext |
| 207 if (!frame->script().initializeMainWorld()) { | 207 if (!frame->script().initializeMainWorld()) { |
| 208 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 208 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
| 209 contexts.append(V8ContextInfo(scriptState->context(), contextGroupId
, true, "", "", frameId)); | 209 contexts.append(V8ContextInfo(scriptState->context(), contextGroupId
, true, "", "", frameId)); |
| 210 } | 210 } |
| 211 frame->script().collectIsolatedContexts(isolatedContexts); | 211 frame->script().collectIsolatedContexts(isolatedContexts); |
| 212 if (isolatedContexts.isEmpty()) | 212 if (isolatedContexts.isEmpty()) |
| 213 continue; | 213 continue; |
| 214 for (const auto& pair : isolatedContexts) { | 214 for (const auto& pair : isolatedContexts) { |
| 215 String originString = pair.second ? pair.second->toRawString() : ""; | 215 String originString = pair.second ? pair.second->toRawString() : ""; |
| 216 ScriptState* scriptState = pair.first; | 216 ScriptState* scriptState = pair.first; |
| 217 contexts.append(V8ContextInfo(scriptState->context(), contextGroupId
, false, originString, scriptState->world().isolatedWorldHumanReadableName(), fr
ameId)); | 217 contexts.append(V8ContextInfo(scriptState->context(), contextGroupId
, false, originString, scriptState->world().isolatedWorldHumanReadableName(), fr
ameId)); |
| 218 } | 218 } |
| 219 isolatedContexts.clear(); | 219 isolatedContexts.clear(); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace blink | 223 } // namespace blink |
| OLD | NEW |