JsPropertyProvider should do a better job when input contains getter

RESOLVED FIXED in Firefox 65

Status

enhancement
P1
normal
RESOLVED FIXED
6 months ago
5 months ago

People

(Reporter: nchevobbe, Assigned: nchevobbe)

Tracking

65 Branch
Firefox 65

Firefox Tracking Flags

(firefox65 fixed)

Details

(Whiteboard: [boogaloo-mvp])

Attachments

(1 attachment)

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.

Comment 3

5 months ago
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c25f7e0a44fc
Add better handling of unsafe getters in JsPropertyProvider; r=bgrins.

Comment 4

5 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/c25f7e0a44fc
Status: ASSIGNED → RESOLVED
Last Resolved: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
You need to log in before you can comment on or make changes to this bug.