On 2010-08-31 23:52, John J Barton wrote:
On Aug 31, 6:05 pm, Nicolas Hatier<nicolas.hat...@gmail.com> wrote:
The internal model of the autocomplete system may cause issue, simply
because it evals statements. I understand this is a handy way to get the
properties of an object, but if the statement being typed is, for
instance, a function call which itself does a xmlHttpRequest to the
server, repeatedly eval'ing the statement could have very undesirable
effects.
Example. I have in my code a function doing a xmlHTTPRequest and
returning the result in the form of a "rendered" JSON object. If I
decide to test the call in the console, like this:
> MyXmlFunctionCall("MyRequest")
everything is Ok.
But if I want to test the result of the call directly, like that:
MyXmlFunctionCall("MyRequest").someProperty
The 'MyXmlFunctionCall("MyRequest")' part is called between 2 and 13
times by the internal eval(), one time for the dot and the first letter,
then one time for each of the letters I decide to type instead of using
autocomplete.
I'm not sure I have a solution for this. It's probably impossible for
Firebug to guess what type of function will be called with those eval().
Maybe Firebug should eval only objects and native function calls, and
not try to autocomplete the result of a user function. That would be a
start...
Or maybe cache the constant part at least. I think if the user says:
MyXmlFunctionCall("MyRequest")
then they should expect the function to be called. But they would not
expect to call it 2-13 times.
Exact. However, even if you manage to cache the constant part, it is
still likely to be called twice, once for autocomplete, and once when
evaluating the full command line (after pressing Enter).
Unfortunately my suggestion is harder to implement than yours.
If you decide to implement my suggestion, if someone wants to
autocomplete the result of a user function, he can put the result in a
variable and autocomplete on that variable.
Do you want me to input that in the issue tracking system as an enhancement?
Nicolas
jjb
Nicolas
--
You received this message because you are subscribed to the Google Groups
"Firebug" group.
To post to this group, send email to fire...@googlegroups.com.
To unsubscribe from this group, send email to
firebug+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/firebug?hl=en.