Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Chrome 13 Edge-case Bugfix in waitForReady when 'frame' is undefined #120

Open
wants to merge 1 commit into from

2 participants

@jesuschrist

In a particular users Chrome browser (who was using various extensions), 'frame' wasn't defined by the time the waitForReady function was fired, thus causing it's initialization failure. The console was complaining about this immediately after it printed "firing onReady" in the debug output. While it wasn't affecting anyone in our development team, verifying that 'frame' exists first seems like the correct thing to do and fixed this users problem.

@jesuschrist jesuschrist Fix for a Chrome edgecase in waitForReady when 'frame' undefined
In a particular users Chrome browser (who was using various extensions), 'frame' wasn't defined by the time the waitForReady function was fired, thus causing it's initialization failure.  The console was complaining about this immediately after it printed "firing onReady" in the debug output.  While it wasn't affecting anyone in our development team, verifying that 'frame' exists first seems like the correct thing to do and fixed this users problem.
f9004f5
@oyvindkinsey

I cannot see how this is considered a fix since this situation is impossible unless something really fishy is going on...

@jesuschrist

I agree that it's fishy, but I don't think that means a fix shouldn't be considered. It was happening on 1 out of 8 users computers in our organization, 15% of the time. This means it could be potentially be affecting 2% of users. Bugs like this are annoying.

They were running several very popular Chrome extensions. I tried selectively disabling them to narrow the issue but with as infrequently as it was happening, it wasn't worth the effort to figure out which extension it was (even if I narrow it down, I'm not going to go fix the extension, I'm going to fix our code which is used by our end-users).

With debug on, I spotted the bug in his console after a day of waiting and made this modification. The problem went away, and that was over a month ago now - so this is definitely a fix.

I realize it's a fix for a fishy situation, but if it can be easily accounted for, it should be. This doesn't add complexity to the code, and solves a particular edge-case (which could be happening in other situations). I'm happy to be able to account for it.

@oyvindkinsey

Sure, I get this, but my point is that the message config.channel + "-ready" is only supposed to be sent one time and so your fix effectively makes this a no-op.

I'd rather try to figure out why this message would be sent multiple times, and one time prematurely instead of just covering over it. The real fix would be to make sure that this particular message isn't sent unless it should be sent.

As I see it, this code branch, https://github.com/oyvindkinsey/easyXDM/blob/master/src/stack/PostMessageTransport.js#L141, is for some reason entered outside the regular flow, and it is this that must be addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 21, 2011
  1. @jesuschrist

    Fix for a Chrome edgecase in waitForReady when 'frame' undefined

    jesuschrist authored
    In a particular users Chrome browser (who was using various extensions), 'frame' wasn't defined by the time the waitForReady function was fired, thus causing it's initialization failure.  The console was complaining about this immediately after it printed "firing onReady" in the debug output.  While it wasn't affecting anyone in our development team, verifying that 'frame' exists first seems like the correct thing to do and fixed this users problem.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/stack/PostMessageTransport.js
View
2  src/stack/PostMessageTransport.js
@@ -108,7 +108,7 @@ easyXDM.stack.PostMessageTransport = function(config){
if (config.isHost) {
// add the event handler for listening
var waitForReady = function(event){
- if (event.data == config.channel + "-ready") {
+ if (frame && event.data == config.channel + "-ready") {
// #ifdef debug
trace("firing onReady");
// #endif
Something went wrong with that request. Please try again.