Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/bugsnag: do not polyfill requestAnimationFrame #74

Closed
wants to merge 1 commit into from

Conversation

kyrylo
Copy link

@kyrylo kyrylo commented Sep 4, 2014

Fixes #72 (requestAnimationFrame wrapper doesn't honor the passed
timestamp)

What's the point, really? It doesn't have anything to do with
hijackTimeFunc at all.

Fixes #72 (`requestAnimationFrame` wrapper doesn't honor the passed
timestamp)

What's the point, really? It doesn't have anything to do with
 hijackTimeFunc at all.
@jmshal
Copy link

jmshal commented Sep 4, 2014

The point of having a function like requestAnimationFrame wrapped, is due to the fact the callback is invoked asynchronously. Meaning, doing something like the following, would not work.

try {
    window.requestAnimationFrame(function () {
        throw Error('Foobar');
    });
} catch (e) {
    // The following line never happens...
    console.log('Oh noes!', e);
}

So for older browsers, you loose a lot of information; because the error gets diverted to window.onerror. On new(er) browsers, this isn't a huge deal, because the actual Error object is passed. Wrapping the callback allows us to try catch the original function, when it's actually invoked.

@kyrylo kyrylo closed this Sep 4, 2014
@kyrylo kyrylo deleted the 72-fix-requestanimframe branch September 4, 2014 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants