brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

Correcting the wrong initialization of the _status object (with variables as keys names) #12981

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by amici Monday Dec 08, 2014 at 22:16 GMT Originally opened as https://github.com/adobe/brackets/pull/10122


Hello all,

While trying to make mine Brackets and LivePreview work with ChromiumI went into a bit of debugging and saw one possible problem, with initialization of _status object.

The way it was previously done had a problem since the variable names were tried to be used as object's keys in wrong way. The way they were used, it was actually creating: _status["HTML_READY"] = false; instead of: _status["htmlReady"] = false;

(The scenario with using variables for object's keys is described here: http://stackoverflow.com/a/19837961/261332)

So, when later we try to check if the wanted key's ("htmlReady") value is true (in _addListener()), it was giving false negatives, since "htmlReady" key was initially not existing in that object. What existed was "HTML_READY" key. Well, maybe it was really giving "good false negatives", since original value was false anyway... but why not fix it if possible.

This is my first git submit, so excuse me if I did something wrong. :) I probably did.


amici included the following code: https://github.com/adobe/brackets/pull/10122/commits

core-ai-bot commented 3 years ago

Comment by peterflynn Monday Dec 08, 2014 at 22:54 GMT


Note: I don't think there were ever false negatives here though. We only ever check for truthy, and both false and undefined are non-truthy. So the actual runtime behavior of the app was already correct as far as I can tell; this is just fixing a misleading / unneeded bit of initialization code.

core-ai-bot commented 3 years ago

Comment by amici Monday Dec 08, 2014 at 23:10 GMT


Yep, I think so too, it really wasn't probably making any damage, since initial setting is false anyway. But I did stumble on it while was debugging some other problem, and lost some time jumping around and making sure it's not causing my issues.. So why not fix it and prevent someone else's future grief. ;)

core-ai-bot commented 3 years ago

Comment by ficristo Monday Feb 13, 2017 at 19:32 GMT


@amici could you fix the conflicts? I'm fine to take this.