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

Unified Diff: third_party/WebKit/Source/core/inspector/InjectedScriptSource.js

Issue 1617393002: [DevTools] Not use with statement for evaluated console command (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/InjectedScriptSource.js
diff --git a/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js b/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js
index 38fd42ccea5a32eb10154962e46158452632fe31..f5af8ec996b85fcd14027767b48e3a8c0cbf99e9 100644
--- a/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js
+++ b/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js
@@ -850,18 +850,11 @@ InjectedScript.prototype = {
// the window object properties still take more precedent than our API functions.
var scopeExtensionForEval = (callFrame && injectCommandLineAPI) ? new CommandLineAPI(this._commandLineAPIImpl, callFrame) : undefined;
-
- injectCommandLineAPI = !scopeExtensionForEval && !callFrame && injectCommandLineAPI && !("__commandLineAPI" in inspectedGlobalObject);
var injectScopeChain = scopeChain && scopeChain.length && !("__scopeChainForEval" in inspectedGlobalObject);
try {
var prefix = "";
var suffix = "";
- if (injectCommandLineAPI) {
- InjectedScriptHost.setNonEnumProperty(inspectedGlobalObject, "__commandLineAPI", new CommandLineAPI(this._commandLineAPIImpl, callFrame));
- prefix = "with (typeof __commandLineAPI !== 'undefined' ? __commandLineAPI : { __proto__: null }) {";
- suffix = "}";
- }
if (injectScopeChain) {
InjectedScriptHost.setNonEnumProperty(inspectedGlobalObject, "__scopeChainForEval", scopeChain);
for (var i = 0; i < scopeChain.length; ++i) {
@@ -875,17 +868,11 @@ InjectedScript.prototype = {
if (prefix)
expression = prefix + "\n" + expression + "\n" + suffix;
- var wrappedResult = callFrame ? callFrame.evaluateWithExceptionDetails(expression, scopeExtensionForEval) : InjectedScriptHost.evaluateWithExceptionDetails(expression);
+ var wrappedResult = callFrame ? callFrame.evaluateWithExceptionDetails(expression, scopeExtensionForEval) : InjectedScriptHost.evaluateWithExceptionDetails(expression, injectCommandLineAPI ? new CommandLineAPI(this._commandLineAPIImpl, callFrame) : undefined);
if (objectGroup === "console" && !wrappedResult.exceptionDetails)
this._lastResult = wrappedResult.result;
return wrappedResult;
} finally {
- if (injectCommandLineAPI) {
- try {
- delete inspectedGlobalObject["__commandLineAPI"];
- } catch(e) {
- }
- }
if (injectScopeChain) {
try {
delete inspectedGlobalObject["__scopeChainForEval"];

Powered by Google App Engine
This is Rietveld 408576698