Skip to content

Commit 9de0bd1

Browse files
Simplify the wait function.
1 parent 62a393a commit 9de0bd1

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

test.new/static/js/test_helpers.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,10 @@
3535
try {
3636
fn();
3737
} catch (e) {
38-
// In IE6, manually throwing errors doesn't trigger window.onerror.
39-
// Instead, we'll pass an actual error to the `done` callback.
40-
if (IS_IE6) {
41-
if (Object.isFunction(done)) {
42-
return done(new Error(e.message));
43-
}
44-
}
45-
46-
// In IE7, window.onerror will get triggered, but with a generic
47-
// error message. Instead we need to throw an actual Error object
48-
// because it does not grok this whole custom error thing.
49-
if (IS_IE7) {
50-
throw new Error(e.message);
51-
}
52-
53-
// In other browsers, we can just re-throw it and be fine.
54-
throw e;
38+
// Instead of relying on window.onerror to detect an error was
39+
// thrown (which is problematic in IE6-7), we invoke the callback
40+
// with an error the way Mocha expects.
41+
return done(e);
5542
}
5643
};
5744
return setTimeout(handler, duration);

0 commit comments

Comments
 (0)