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

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

Issue 1932343002: [DevTools] Don't run microtasks after call to InjectedScript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) 100 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false))
101 scope.ignoreExceptionsAndMuteConsole(); 101 scope.ignoreExceptionsAndMuteConsole();
102 102
103 if (includeCommandLineAPI.fromMaybe(false) && !scope.installCommandLineAPI() ) 103 if (includeCommandLineAPI.fromMaybe(false) && !scope.installCommandLineAPI() )
104 return; 104 return;
105 105
106 bool evalIsDisabled = !scope.context()->IsCodeGenerationFromStringsAllowed() ; 106 bool evalIsDisabled = !scope.context()->IsCodeGenerationFromStringsAllowed() ;
107 // Temporarily enable allow evals for inspector. 107 // Temporarily enable allow evals for inspector.
108 if (evalIsDisabled) 108 if (evalIsDisabled)
109 scope.context()->AllowCodeGenerationFromStrings(true); 109 scope.context()->AllowCodeGenerationFromStrings(true);
110 v8::MaybeLocal<v8::Value> maybeResultValue = m_debugger->compileAndRunIntern alScript(scope.context(), toV8String(m_debugger->isolate(), expression)); 110
111 v8::MaybeLocal<v8::Value> maybeResultValue;
112 v8::Local<v8::Script> script = m_debugger->compileInternalScript(scope.conte xt(), toV8String(m_debugger->isolate(), expression), String16());
113 if (!script.IsEmpty())
114 maybeResultValue = m_debugger->runCompiledScript(scope.context(), script );
115
111 if (evalIsDisabled) 116 if (evalIsDisabled)
112 scope.context()->AllowCodeGenerationFromStrings(false); 117 scope.context()->AllowCodeGenerationFromStrings(false);
113 118
114 // Re-initialize after running client's code, as it could have destroyed con text or session. 119 // Re-initialize after running client's code, as it could have destroyed con text or session.
115 if (!scope.initialize()) 120 if (!scope.initialize())
116 return; 121 return;
117 scope.injectedScript()->wrapEvaluateResult(errorString, 122 scope.injectedScript()->wrapEvaluateResult(errorString,
118 maybeResultValue, 123 maybeResultValue,
119 scope.tryCatch(), 124 scope.tryCatch(),
120 objectGroup.fromMaybe(""), 125 objectGroup.fromMaybe(""),
(...skipping 29 matching lines...) Expand all
150 v8::Local<v8::Value> argumentValue; 155 v8::Local<v8::Value> argumentValue;
151 if (!scope.injectedScript()->resolveCallArgument(errorString, argume nts->get(i)).ToLocal(&argumentValue)) 156 if (!scope.injectedScript()->resolveCallArgument(errorString, argume nts->get(i)).ToLocal(&argumentValue))
152 return; 157 return;
153 argv[i] = argumentValue; 158 argv[i] = argumentValue;
154 } 159 }
155 } 160 }
156 161
157 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) 162 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false))
158 scope.ignoreExceptionsAndMuteConsole(); 163 scope.ignoreExceptionsAndMuteConsole();
159 164
160 v8::MaybeLocal<v8::Value> maybeFunctionValue = m_debugger->compileAndRunInte rnalScript(scope.context(), toV8String(m_debugger->isolate(), "(" + expression + ")")); 165 v8::MaybeLocal<v8::Value> maybeFunctionValue = m_debugger->compileAndRunInte rnalScript(scope.context(), toV8String(m_debugger->isolate(), "(" + expression + ")"));
dgozman 2016/04/30 00:07:01 Change this place as well and add a test.
dgozman 2016/04/30 00:08:32 Nevermind. I did misread this.
161 // Re-initialize after running client's code, as it could have destroyed con text or session. 166 // Re-initialize after running client's code, as it could have destroyed con text or session.
162 if (!scope.initialize()) 167 if (!scope.initialize())
163 return; 168 return;
164 169
165 if (scope.tryCatch().HasCaught()) { 170 if (scope.tryCatch().HasCaught()) {
166 scope.injectedScript()->wrapEvaluateResult(errorString, maybeFunctionVal ue, scope.tryCatch(), scope.objectGroupName(), false, false, result, wasThrown, nullptr); 171 scope.injectedScript()->wrapEvaluateResult(errorString, maybeFunctionVal ue, scope.tryCatch(), scope.objectGroupName(), false, false, result, wasThrown, nullptr);
167 return; 172 return;
168 } 173 }
169 174
170 v8::Local<v8::Value> functionValue; 175 v8::Local<v8::Value> functionValue;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 422 }
418 } 423 }
419 424
420 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints) 425 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints)
421 { 426 {
422 if (m_enabled) 427 if (m_enabled)
423 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints )); 428 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints ));
424 } 429 }
425 430
426 } // namespace blink 431 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698