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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); | 255 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); |
256 frame->settings()->setForceMainWorldInitialization(true); | 256 frame->settings()->setForceMainWorldInitialization(true); |
257 } | 257 } |
258 | 258 |
259 void MainThreadDebugger::endEnsureAllContextsInGroup(int contextGroupId) | 259 void MainThreadDebugger::endEnsureAllContextsInGroup(int contextGroupId) |
260 { | 260 { |
261 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); | 261 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); |
262 frame->settings()->setForceMainWorldInitialization(false); | 262 frame->settings()->setForceMainWorldInitialization(false); |
263 } | 263 } |
264 | 264 |
265 bool MainThreadDebugger::canExecuteScripts(int contextGroupId) | |
266 { | |
267 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); | |
kozy
2016/08/01 18:08:03
Could it return nullptr?
dgozman
2016/08/01 18:43:04
Nope. If it does, we crash. That's expected.
| |
268 return frame->script().canExecuteScripts(NotAboutToExecuteScript); | |
269 } | |
270 | |
265 void MainThreadDebugger::consoleAPIMessage(int contextGroupId, V8ConsoleAPIType type, const String16& message, const String16& url, unsigned lineNumber, unsigne d columnNumber, V8StackTrace* stackTrace) | 271 void MainThreadDebugger::consoleAPIMessage(int contextGroupId, V8ConsoleAPIType type, const String16& message, const String16& url, unsigned lineNumber, unsigne d columnNumber, V8StackTrace* stackTrace) |
266 { | 272 { |
267 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); | 273 LocalFrame* frame = WeakIdentifierMap<LocalFrame>::lookup(contextGroupId); |
268 if (!frame) | 274 if (!frame) |
269 return; | 275 return; |
270 if (type == V8ConsoleAPIType::kClear && frame->host()) | 276 if (type == V8ConsoleAPIType::kClear && frame->host()) |
271 frame->host()->consoleMessageStorage().clear(); | 277 frame->host()->consoleMessageStorage().clear(); |
272 // TODO(dgozman): do not wrap in ConsoleMessage. | 278 // TODO(dgozman): do not wrap in ConsoleMessage. |
273 ConsoleMessage* consoleMessage = ConsoleMessage::create(ConsoleAPIMessageSou rce, consoleAPITypeToMessageLevel(type), message, SourceLocation::create(url, li neNumber, columnNumber, stackTrace ? stackTrace->clone() : nullptr, 0)); | 279 ConsoleMessage* consoleMessage = ConsoleMessage::create(ConsoleAPIMessageSou rce, consoleAPITypeToMessageLevel(type), message, SourceLocation::create(url, li neNumber, columnNumber, stackTrace ? stackTrace->clone() : nullptr, 0)); |
274 frame->console().reportMessageToClient(consoleMessage); | 280 frame->console().reportMessageToClient(consoleMessage); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 return; | 385 return; |
380 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false)) | 386 if (!nodes->Set(context, index++, toV8(node, info.Holder(), info.Get Isolate())).FromMaybe(false)) |
381 return; | 387 return; |
382 } | 388 } |
383 info.GetReturnValue().Set(nodes); | 389 info.GetReturnValue().Set(nodes); |
384 } | 390 } |
385 exceptionState.throwIfNeeded(); | 391 exceptionState.throwIfNeeded(); |
386 } | 392 } |
387 | 393 |
388 } // namespace blink | 394 } // namespace blink |
OLD | NEW |