Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jesuschrist
Copy link

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.

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.
@oyvindkinsey
Copy link
Owner

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

@jesuschrist
Copy link
Author

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
Copy link
Owner

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.

kennethkufluk added a commit to kennethkufluk/easyXDM that referenced this pull request Mar 2, 2016
As shown in pull request oyvindkinsey#120 and currently shown on twitter.com home timeline when scrolling rapidly, the waitForReady function can complain that the frame is null. The probable cause is that the waitForReady method isn't torn down in the destroy method. So if an iframe is destroyed before it initialises, it can throw this kind of error.

twitter.com:
`Uncaught TypeError: Cannot read property 'contentWindow' of null`

I've pulled out the function and added an unbind. I think this makes sense.
(Edited through github editor - needs verification/testing)
necolas pushed a commit to necolas/xdm.js that referenced this pull request Mar 8, 2016
As shown in pull request oyvindkinsey/easyXDM#120 and currently shown on
twitter.com home timeline when scrolling rapidly, the waitForReady
function can complain that the frame is null. The probable cause is that
the waitForReady method isn't torn down in the destroy method. So if an
iframe is destroyed before it initialises, it can throw this kind of
error.

twitter.com:
  `Uncaught TypeError: Cannot read property 'contentWindow' of null`

I've pulled out the function and added an unbind. I think this makes
sense.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants