Title: [200482] trunk/Source/_javascript_Core
- Revision
- 200482
- Author
- [email protected]
- Date
- 2016-05-05 15:11:59 -0700 (Thu, 05 May 2016)
Log Message
JSContext Inspector: Better CommandLineAPI in JSContext inspection
https://bugs.webkit.org/show_bug.cgi?id=157387
<rdar://problem/22630583>
Patch by Joseph Pecoraro <[email protected]> on 2016-05-05
Reviewed by Timothy Hatcher.
* inspector/InjectedScriptSource.js:
(InjectedScript.prototype._evaluateOn):
(BasicCommandLineAPI.inScopeVariables):
(BasicCommandLineAPI):
When creating a BasicCommandLineAPI, pass the call frame so
that we don't shadow variables in the callstack.
(BasicCommandLineAPI.methods):
(clear):
(table):
(profile):
(profileEnd):
(keys):
(values):
Some just pass through to console, others are tiny methods.
Implement them, and give them the expected toString string.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (200481 => 200482)
--- trunk/Source/_javascript_Core/ChangeLog 2016-05-05 21:58:23 UTC (rev 200481)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-05-05 22:11:59 UTC (rev 200482)
@@ -1,3 +1,28 @@
+2016-05-05 Joseph Pecoraro <[email protected]>
+
+ JSContext Inspector: Better CommandLineAPI in JSContext inspection
+ https://bugs.webkit.org/show_bug.cgi?id=157387
+ <rdar://problem/22630583>
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/InjectedScriptSource.js:
+ (InjectedScript.prototype._evaluateOn):
+ (BasicCommandLineAPI.inScopeVariables):
+ (BasicCommandLineAPI):
+ When creating a BasicCommandLineAPI, pass the call frame so
+ that we don't shadow variables in the callstack.
+
+ (BasicCommandLineAPI.methods):
+ (clear):
+ (table):
+ (profile):
+ (profileEnd):
+ (keys):
+ (values):
+ Some just pass through to console, others are tiny methods.
+ Implement them, and give them the expected toString string.
+
2016-05-05 Filip Pizlo <[email protected]>
Reduce maximum JIT pool size on X86_64.
Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (200481 => 200482)
--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2016-05-05 21:58:23 UTC (rev 200481)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2016-05-05 22:11:59 UTC (rev 200482)
@@ -475,7 +475,7 @@
if (this.CommandLineAPI)
commandLineAPI = new this.CommandLineAPI(this._commandLineAPIImpl, isEvalOnCallFrame ? object : null);
else
- commandLineAPI = new BasicCommandLineAPI;
+ commandLineAPI = new BasicCommandLineAPI(isEvalOnCallFrame ? object : null);
}
if (isEvalOnCallFrame) {
@@ -1406,8 +1406,21 @@
}
}
-function BasicCommandLineAPI()
+function BasicCommandLineAPI(callFrame)
{
+ function inScopeVariables(member)
+ {
+ if (!callFrame)
+ return false;
+
+ var scopeChain = callFrame.scopeChain;
+ for (var i = 0; i < scopeChain.length; ++i) {
+ if (member in scopeChain[i])
+ return true;
+ }
+ return false;
+ }
+
this.$_ = injectedScript._lastResult;
this.$exception = injectedScript._exceptionValue;
@@ -1418,7 +1431,35 @@
continue;
this.__defineGetter__("$" + i, bind(injectedScript._savedResult, injectedScript, i));
}
+
+ // Command Line API methods.
+ for (var i = 0; i < BasicCommandLineAPI.methods.length; ++i) {
+ var method = BasicCommandLineAPI.methods[i];
+ var name = method.name;
+ if (name in inspectedGlobalObject || inScopeVariables(name))
+ continue;
+ this[name] = method;
+ }
}
+BasicCommandLineAPI.methods = [
+ function dir() { return inspectedGlobalObject.console.dir(...arguments); },
+ function clear() { return inspectedGlobalObject.console.clear(...arguments); },
+ function table() { return inspectedGlobalObject.console.table(...arguments); },
+ function profile() { return inspectedGlobalObject.console.profile(...arguments); },
+ function profileEnd() { return inspectedGlobalObject.console.profileEnd(...arguments); },
+
+ function keys(object) { return Object.keys(object); },
+ function values(object) {
+ var result = [];
+ for (var key in object)
+ result.push(object[key]);
+ return result;
+ },
+];
+
+for (let method of BasicCommandLineAPI.methods)
+ method.toString = function() { return "function " + method.name + "() { [Command Line API] }"; };
+
return injectedScript;
})
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes