Console freezes when inspecting deeply nested proxy

RESOLVED FIXED in Firefox 68

Status

defect
P2
normal
RESOLVED FIXED
2 years ago
2 months ago

People

(Reporter: Oriol, Assigned: Oriol)

Tracking

(Blocks 1 bug)

unspecified
Firefox 68
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox57 wontfix, firefox68 fixed)

Details

Attachments

(1 attachment)

Enter this code to the console:

      var proxy = {};
      for (var i=0; i<100; ++i) proxy = new Proxy(proxy, proxy);
      proxy;

The console stops working (or the browser freezes in non-e10s).

That's because a proxy grip always contains a grip of the target and the handler.
When I do:

      var proxy = {};
      for (var i=0; i<50; ++i) proxy = new Proxy(proxy, proxy);
      proxy;

I see a freeze, but when I do:

      var proxy = {};
      for (var i=0; i<100; ++i) proxy = new Proxy(proxy, proxy);
      proxy;

I see broken behavior where the chrome doesn't freeze but no evaluation result returns and it breaks future input into the console
Whiteboard: [console-html][triage]
Flags: qe-verify+
Priority: -- → P4
QA Contact: iulia.cristescu
Whiteboard: [console-html][triage] → [reserve-console-html]
Related with https://github.com/devtools-html/devtools-core/issues/602, I think the solution should be:

 - Proxy grips stop exposing a grip of the target and the handler
 - A preview of the target is created and exposed as the preview of the proxy
 - A new protocol request is added to ask for the target and the handler when the proxy is inspected

This will require some changes in object inspector, and maybe reps. And VariablesView should also be adapted (unless it's going to be removed soon).

So for the moment it may be easier to just stop exposing a grip of the target and the handler when hooks.getGripDepth() > 1
(In reply to Oriol Brufau [:Oriol] from comment #2)
> This will require some changes in object inspector, and maybe reps. And
> VariablesView should also be adapted (unless it's going to be removed soon).

Let's not add any specific fixes to the Variables View. It still needs to work at least until the Browser Console is migrated to the new frontend and we figure something out what do do Scratchpad, but we're planning to remove it at that point.
Flags: qe-verify+
Priority: P4 → P2
QA Contact: iulia.cristescu
Whiteboard: [reserve-console-html] → [newconsole-mvp]
Not specific to new frontend
Whiteboard: [newconsole-mvp]
Product: Firefox → DevTools
Assignee: nobody → oriol-bugzilla
Status: NEW → ASSIGNED
Type: enhancement → defect

(In reply to Brian Grinstead [:bgrins] from comment #3)

Let's not add any specific fixes to the Variables View. It still needs to
work at least until the Browser Console is migrated to the new frontend and
we figure something out what do do Scratchpad, but we're planning to remove
it at that point.

Any news about removing VariablesView? I had to include a fix for it to avoid breaking Scratchpad. Why not switch Scratchpad to use reps?

(In reply to Oriol Brufau [:Oriol] from comment #6)

(In reply to Brian Grinstead [:bgrins] from comment #3)

Let's not add any specific fixes to the Variables View. It still needs to
work at least until the Browser Console is migrated to the new frontend and
we figure something out what do do Scratchpad, but we're planning to remove
it at that point.

Any news about removing VariablesView? I had to include a fix for it to avoid breaking Scratchpad. Why not switch Scratchpad to use reps?

The general plan is to add true multiline support to the webconsole and then remove Scratchpad (since the Browser Console + editor mode would cover most of the same ground), rather than modifying Scratchpad to support reps.

Keywords: checkin-needed

Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a0a023dac829
Avoid exponential behavior when inspecting nested proxies. r=nchevobbe

Keywords: checkin-needed
Backout by dvarga@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/57f669c6fab1
Backed out changeset a0a023dac829 for debugger failure at object-inspector/types

Pushed by cbrindusan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1b3234069aba
Avoid exponential behavior when inspecting nested proxies. r=nchevobbe

Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 68
See Also: → 1552648
You need to log in before you can comment on or make changes to this bug.