chromakode / xkcdfools

xkcd CLI + jQuery terminal implementation
GNU General Public License v2.0
564 stars 116 forks source link

Watch command #15

Closed brghena closed 7 years ago

brghena commented 14 years ago

I know its getting close to the end of the day (EST anyway), but working toward the ideal of code perfection its worth noting that something is not right with the "watch" command.

The try/catch seems to have grabbed the error and nicely printed it to screen: "An internal error occurred: TypeError: missing argument 1 when calling function this.commands[d].apply"

I'm not sure where the error is in the code though. Good luck!

chromakode commented 14 years ago

Unixkcd is in it for the long haul, so any reports are extremely helpful! What was the exact command string you typed in?

MinerX commented 14 years ago

guest@xkcd:/$ watch

An internal error occured: TypeError: missing argument 1 when calling function this.commands[d].apply

chromakode commented 14 years ago

Very strange! Watch isn't even a command. I wonder how that happened...

Are you able to reproduce this bug?

MinerX commented 14 years ago

i get this bug consistantly

brghena commented 14 years ago

Yup, it occurs for me every time watch is used as the primary command. I was thinking maybe some code for watch was started but never finished, but a search through the code led to no references to watch at all.

Also, only the exact word "watch" causes the bug. (i.e. "w", "wa", ... "watc" don't cause it). A slightly different error is caused by "watch" followed by a space and then any other string. Another TypeError: "this.commands[d].apply(this , f) is not a function" It looks like the system is attempting to call watch even though it doesn't exist. Its a little weird that it isn't caught by the default command case though.

brghena commented 14 years ago

Hmm... It looks like this bug doesn't affect Internet Explorer. I'm in Firefox 3.6.3 right now and I get the bug, but when I switch to IE everything works like it should (that's a first). The bug might be VERY tricky to fix if its a browser specific issue. Can anyone else get it in other browsers?

GigaPatches commented 14 years ago

It would appear that a 'watch' function gets added on to objects in Firefox, see: https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object/watch This is causing the 'in' operator to return true for watch. 'hasOwnProperty' does not seem to have this issue.

chromakode commented 14 years ago

Oh yeah! I forgot that Mozilla had that non-standard property. That makes sense. Well sleuthed, Jushar. Now we just need to research the best fix. :)