Closed Bug 1505393 Opened 6 years ago Closed 6 years ago

JsPropertyProvider should do a better job when input contains getter

Categories

(DevTools :: Console, enhancement, P1)

65 Branch
enhancement

Tracking

(firefox65 fixed)

RESOLVED FIXED
Firefox 65
Tracking Status
firefox65 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

Details

(Whiteboard: [boogaloo-mvp])

Attachments

(1 file)

When provided an input containing "unsafe" getters (i.e. which execution might have side-effects), jsPropertyProvider doesn't return anything.

We could make it a bit smarter and: 
- return that it encountered an unsafe getter, and its name, so we can use this information at frontend level.
- have a mode that will allow to invoke unsafe getters to retrieve properties of the value returned by such getter. 

---

This is preliminary work for Bug 1499289
Whiteboard: [boogaloo-mvp]
This patch adds two things to JsPropertyProvider:
- when provided an input which try to access an unsafe
getter properties, the function will indicate that an
unsafe getter should be invoked, with its name.
- a new boolean argument that when set to true would
invoke any unsafe getter that might be in the expression
to be completed.

For simplicity sake, the function only warns the user
of the presence of an unsafe getter when it's the last
property of the expression:

`object.myGetter.` will return that `myGetter` should be invoked
`object.myGetter.a.b.` will not (because then, a and b could
also be getters, and it's getting complex to handle both in
the function itself as in the UI).

Tests are added to ensure this works as expected.
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c25f7e0a44fc
Add better handling of unsafe getters in JsPropertyProvider; r=bgrins.
https://hg.mozilla.org/mozilla-central/rev/c25f7e0a44fc
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: