Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp

Issue 1808533002: DevTools: wrap console evaluation with user gesture indicator for convenience. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 void V8RuntimeAgentImpl::evaluate( 74 void V8RuntimeAgentImpl::evaluate(
75 ErrorString* errorString, 75 ErrorString* errorString,
76 const String16& expression, 76 const String16& expression,
77 const Maybe<String16>& objectGroup, 77 const Maybe<String16>& objectGroup,
78 const Maybe<bool>& includeCommandLineAPI, 78 const Maybe<bool>& includeCommandLineAPI,
79 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, 79 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole,
80 const Maybe<int>& executionContextId, 80 const Maybe<int>& executionContextId,
81 const Maybe<bool>& returnByValue, 81 const Maybe<bool>& returnByValue,
82 const Maybe<bool>& generatePreview, 82 const Maybe<bool>& generatePreview,
83 const Maybe<bool>& userGesture,
83 OwnPtr<RemoteObject>* result, 84 OwnPtr<RemoteObject>* result,
84 Maybe<bool>* wasThrown, 85 Maybe<bool>* wasThrown,
85 Maybe<ExceptionDetails>* exceptionDetails) 86 Maybe<ExceptionDetails>* exceptionDetails)
86 { 87 {
87 if (!executionContextId.isJust()) { 88 if (!executionContextId.isJust()) {
88 *errorString = "Cannot find default execution context"; 89 *errorString = "Cannot find default execution context";
89 return; 90 return;
90 } 91 }
91 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId.fromJust()); 92 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId.fromJust());
92 if (!injectedScript) { 93 if (!injectedScript) {
93 *errorString = "Cannot find execution context with given id"; 94 *errorString = "Cannot find execution context with given id";
94 return; 95 return;
95 } 96 }
96 IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteCon sole.fromMaybe(false) ? m_debugger : nullptr); 97 IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteCon sole.fromMaybe(false) ? m_debugger : nullptr);
97 injectedScript->evaluate(errorString, expression, objectGroup.fromMaybe(""), includeCommandLineAPI.fromMaybe(false), returnByValue.fromMaybe(false), generat ePreview.fromMaybe(false), result, wasThrown, exceptionDetails); 98 injectedScript->evaluate(errorString, expression, objectGroup.fromMaybe(""), includeCommandLineAPI.fromMaybe(false), returnByValue.fromMaybe(false), generat ePreview.fromMaybe(false), result, wasThrown, exceptionDetails);
98 } 99 }
99 100
100 void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString, 101 void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString,
101 const String16& objectId, 102 const String16& objectId,
102 const String16& expression, 103 const String16& expression,
103 const Maybe<protocol::Array<protocol::Runtime::CallArgument>>& optionalArgum ents, 104 const Maybe<protocol::Array<protocol::Runtime::CallArgument>>& optionalArgum ents,
104 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, 105 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole,
105 const Maybe<bool>& returnByValue, 106 const Maybe<bool>& returnByValue,
106 const Maybe<bool>& generatePreview, 107 const Maybe<bool>& generatePreview,
108 const Maybe<bool>& userGesture,
107 OwnPtr<RemoteObject>* result, 109 OwnPtr<RemoteObject>* result,
108 Maybe<bool>* wasThrown) 110 Maybe<bool>* wasThrown)
109 { 111 {
110 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(objectId); 112 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(objectId);
111 if (!remoteId) { 113 if (!remoteId) {
112 *errorString = "Invalid object id"; 114 *errorString = "Invalid object id";
113 return; 115 return;
114 } 116 }
115 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (remoteId.get()); 117 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (remoteId.get());
116 if (!injectedScript) { 118 if (!injectedScript) {
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 OwnPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe xt(toProtocolStringWithTypeCheck(message->Get())).build(); 435 OwnPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe xt(toProtocolStringWithTypeCheck(message->Get())).build();
434 exceptionDetails->setLine(message->GetLineNumber()); 436 exceptionDetails->setLine(message->GetLineNumber());
435 exceptionDetails->setColumn(message->GetStartColumn()); 437 exceptionDetails->setColumn(message->GetStartColumn());
436 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); 438 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace();
437 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) 439 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0)
438 exceptionDetails->setStack(m_debugger->createStackTrace(messageStackTrac e, messageStackTrace->GetFrameCount())->buildInspectorObject()); 440 exceptionDetails->setStack(m_debugger->createStackTrace(messageStackTrac e, messageStackTrace->GetFrameCount())->buildInspectorObject());
439 return exceptionDetails.release(); 441 return exceptionDetails.release();
440 } 442 }
441 443
442 } // namespace blink 444 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698