Skip to content

Commit

Permalink
Fix #53, handle non-standard setTimeout lateness.
Browse files Browse the repository at this point in the history
Firefox < 13 passes an numeric argument, lateness, to
the callback for `setTimeout, which caused $yetify to re-init.

Verify the config argument is an object, instead of a number.

See: https://developer.mozilla.org/en/window.setTimeout
  • Loading branch information
reid committed Mar 20, 2012
1 parent e70cc41 commit d9a26f9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/hub/view/public/inject.js
Expand Up @@ -44,7 +44,6 @@ function $yetify(firstRunConfiguration) {


// TODO Throttle test navigation for Opera and slow mobile devices. // TODO Throttle test navigation for Opera and slow mobile devices.
socket.on("complete", function () { socket.on("complete", function () {
if (!config.mountpoint) return;
document.location.href = config.mountpoint; document.location.href = config.mountpoint;
}); });


Expand All @@ -53,7 +52,11 @@ function $yetify(firstRunConfiguration) {
}); });
} }


if (firstRunConfiguration) { // $yetify will be called again from setTimeout.
// In Firefox < 13, the first argument may be a `lateness` argument.
// https://developer.mozilla.org/en/window.setTimeout
// Make sure this argument is an object before initializing.
if ("object" === typeof firstRunConfiguration) {
init(firstRunConfiguration); init(firstRunConfiguration);
if (document.compatMode !== "CSS1Compat") { if (document.compatMode !== "CSS1Compat") {
throw new Error("Yeti requires HTML files with doctypes."); throw new Error("Yeti requires HTML files with doctypes.");
Expand Down

0 comments on commit d9a26f9

Please sign in to comment.