mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -10:00
While trying to implement the invoke getter from autocomplete popup, it became clear to me that the initial implementation in js-property-provider wasn't good enough, as we need to keep track of all the authorizations the user gave when working on a given expression. In order to handle this, JsPropertyProvider now returns an array of strings representing the path to the unsafe getter when no matching authorizations are provided. If authorizations are provided, we can check for each properties that the user authorized the execution. This way, we can handle deep object access after a getter (e.g. `x.myGetter.foo.bar.baz.entries`) without asking the user if they want to invoke `myGetter` on each step of the completion. This makes handling intermediary getters (e.g. `x.myGetter.foo.myOtherGetter.bar`) way easier as well. In the UI, the user will be prompted to invoke the getter one after the other (if for example they try to complete a pasted expression which contains multiple getters, they will have prompts for `myGetter`, and then for `myOtherGetter`). We wire-up the webconsole client and the webconsole actor for the autocomplete function, to make them ready for frontend use. The existing JsPropertyProvider getters test are updated to match the change of parameter (invokeGetter -> authorizedEvaluations), and some tests are added to make sure everything work as intended. Differential Revision: https://phabricator.services.mozilla.com/D12940