Closed Bug 1835680 Opened 2 years ago Closed 2 years ago

Typing in the console `a.__proto__` where a is a proxy with a recursive prototype hangs the browser

Categories

(DevTools :: Console, defect, P2)

Firefox 113
ARM64
macOS
defect

Tracking

(firefox115 fixed)

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: nicolo.ribaudo, Assigned: nchevobbe)

Details

(Whiteboard: [devtools:relnote])

Attachments

(1 file)

Thank you for helping make Firefox better. If you are reporting a defect, please complete the following:

What were you doing?

On any page, open the console and:

  1. Execute const a = new Proxy({}, { getPrototypeOf: () => a });
  2. Type a.__proto__

What happened?

The browser stops responding. Even if you close the tab and open a new tab, it will still hang. For example, opening again the devtools in a new tab will show an empty panel.

What should have happened?

Not hang

Anything else we should know?

I believe it's stuck in an infinite loop walking the prototype chain to get property names for autocompletion

Severity: -- → S3
Flags: needinfo?(nchevobbe)
Priority: -- → P2

In the JSPropertyProvider, we are walking up the prototype to retrieve properties.
For proxies with getPrototypeOf trap, this means that we were returning erroneous
values, as the prototype chain of the proxy isn't altered by the trap.
Worse, it could lead to infinite loop if the trap was setting a circular reference.

To avoid this, when dealing with a proxy, we retrieve the prototype of the proxy
target.

Test cases are added to ensure we don't regress this.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2f0f9d27fb0d [devtools] Use proxy target when walking up prototype chain for autocomplete. r=devtools-reviewers,jdescottes.

Backed out for causing mochitests failures in test_jsterm_autocomplete.html.

Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/68c7e6c6b7d2 [devtools] Use proxy target when walking up prototype chain for autocomplete. r=devtools-reviewers,jdescottes.
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
Whiteboard: [devtools:relnote]
Flags: needinfo?(nchevobbe)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: