gimite / web-socket-js

HTML5 Web Socket implementation powered by Flash
BSD 3-Clause "New" or "Revised" License
2.73k stars 489 forks source link

IE9 web-socket-js only works once after each browser (re)start #41

Closed BonsaiDen closed 13 years ago

BonsaiDen commented 13 years ago

[WebSocket] TypeError: Object doesn't support this property or method that's what I get. Unfortunately IE's debugger still sucks, it doesn't give me any line number, when I let it break on error, it breaks on completely random lines in different files.

Also there seem to be some more issues with 0x00 bytes, but not in every case, some work, some truncate the string.

I'm trying to figure out what's going on, but it might take some time...

EDIT:
Quick update, clearing the cache makes it work exactly one more time, after that if I don't clear the cache again it fails again with the error described above.

Vagabond commented 13 years ago

I think I'm seeing this as well, I'll do more testing next week.

BonsaiDen commented 13 years ago

After stepping through nearly the complete scripts I've at least found the place where the error is being thrown at, it's line 350 in web_socket.js.

Update:
It's on line 219 in FABridge.js where this.target.getRoot is undefined for whatever reasons.

BonsaiDen commented 13 years ago

OK, so getRoot which I suppose is exposed by Flash, somehow isn't in this case. My best guess is that IE9 screws around with the object tag.

Vagabond commented 13 years ago

I can confirm that I'm seeing exactly the same behaviour (works once after clearing cache, same line number fails). No idea why.

BonsaiDen commented 13 years ago

Definitely a caching bug, appending "?" + Math.random() to WEB_SOCKET_SWF_LOCATION makes it work after each reload, well until Math.random() yields the same value a second time, then of course it will break yet again.

Hello1024 commented 13 years ago

It's not a caching bug - the effect of the cache here is simply to change the order things load, which in some cases makes it work sometimes.

I've narrowed the problem down to the flash callback functions (including getRoot) never being registered because they are registered through a series of constructors starting from the constructor of the main movie. I believe that instantiating the FABridge with a zero-time timer rather than in the websocket constructor should fix it. That allows IE to finish creating the DOM object node for the flash movie rather than being called re-entrantly to create the callback methods.

Note: This is untested, since I don't have a flash build environment set up right now...

(Summary: bug is in IE, but there is a fairly simple workaround using a timer)

gimite commented 13 years ago

I tested this with released version of IE9 and bundled sample.html and I couldn't reproduce it. Please let me know anyone still see this issue with released version of IE9.

gimite commented 13 years ago

Closing for now. Please reopen if anyone still see this issue.