Open
Bug 1639648
Opened 4 years ago
Updated 1 year ago
Support eagerly evaluating getters
Categories
(DevTools :: Console, enhancement)
DevTools
Console
Tracking
(Not tracked)
NEW
People
(Reporter: jlast, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
Attachments
(1 file)
We currently show a button next to getters to evaluate them. It would be nice if we could first try to eagerly evaluate them so that we don't hide the value unnecessarily.
Comment 1•4 years ago
|
||
Something like Element.prototype.children
can be eagerly evaluated, but if I inspect Element.prototype
in the console, showing
TypeError: "'get children' called on an object that does not implement interface Element.
for every single getter will just be distracting IMO.
Reporter | ||
Comment 2•4 years ago
|
||
diff --git a/devtools/server/actors/webconsole/eval-with-debugger.js b/devtools/server/actors/webconsole/eval-with-debugger.js
index 9d24ec2be8ef1..61a71d17451fb 100644
--- a/devtools/server/actors/webconsole/eval-with-debugger.js
+++ b/devtools/server/actors/webconsole/eval-with-debugger.js
@@ -53,6 +53,27 @@ function isObject(value) {
return Object(value) === value;
}
+exports.eagerlyEvaluateGetter = function({ value, frame, dbgWindow }) {
+ const noSideEffectDebugger = makeSideeffectFreeDebugger();
+
+ let result;
+ try {
+ const global = Cu.getGlobalForObject(value);
+ const dbgGlobal = noSideEffectDebugger.makeGlobalObjectReference(global);
+ const dbgObject = dbgGlobal.makeDebuggeeValue(value);
+ result = dbgObject.apply(frame);
+ } finally {
+ // We need to be absolutely sure that the sideeffect-free debugger's
+ // debuggees are removed because otherwise we risk them terminating
+ // execution of later code in the case of unexpected exceptions.
+ if (noSideEffectDebugger) {
+ noSideEffectDebugger.removeAllDebuggees();
+ }
+ }
+
+ return result;
+};
+
Reporter | ||
Comment 3•4 years ago
|
||
I agree. we should not show errors.
Updated•4 years ago
|
Assignee: nobody → wartmanm
Status: NEW → ASSIGNED
Comment hidden (off-topic) |
Comment 6•2 years ago
|
||
Sorry, there was a problem with the detection of inactive users. I'm reverting the change.
Assignee: nobody → wartmanm
Status: NEW → ASSIGNED
Updated•1 year ago
|
No longer blocks: console-instant-eval
Depends on: 1806595
Updated•1 year ago
|
Assignee: wartmanm → nobody
Status: ASSIGNED → NEW
You need to log in
before you can comment on or make changes to this bug.
Description
•