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

Stop shimming async for requirejs #206

Merged
merged 1 commit into from
Jan 21, 2016
Merged

Stop shimming async for requirejs #206

merged 1 commit into from
Jan 21, 2016

Conversation

SimonWoolf
Copy link
Member

Most-frustrating-to-debug bug so far in IE8/9 project turns out not to have been an IE bug at all!

Was looking at a test that used async.parallel, where in IE8, async wasn't calling the result callback even though all the subtests were calling their callbacks. But console.log statements in the functions in async.js somehow weren't getting printed, even though the file was definitely getting loaded.

Turns out, when the tests were run in the browser, the async that was getting used is not the one pointed to by named_dependencies (node_modules/async/lib/async), but rather a rather old version that's copied-and-pasted inline into karma-nodeunit (!) -- https://github.com/karma-runner/karma-nodeunit/blob/master/lib/nodeunit.js#L500.

Why was it using that one? Because when setting up requirejs in the browser, we apparently put a shim which tells requirejs to use the global async object, whatever that may be -- ie whichever async was loaded most recently, which was the nodeunit one.

So: this PR removes the shim, and points to a branch of async in ably-forks with the issue that was causing async's requirejs-loader not to work with ably-js fixed.

It does support it, support was just slightly broken. Have forked async
to fix, now using that fork.

Using the global meant that it was actually using the global async that
was defined most recently. Which, for browser tests, happened to be the
(rather) old one that karma-nodeunit defines inline (!)
(https://github.com/karma-runner/karma-nodeunit/blob/master/lib/nodeunit.js#L500)
paddybyers added a commit that referenced this pull request Jan 21, 2016
Stop shimming async for requirejs
@paddybyers paddybyers merged commit 5d1619c into master Jan 21, 2016
@paddybyers
Copy link
Member

Thanks

@mattheworiordan mattheworiordan deleted the async-shim branch January 22, 2016 11:12
@mattheworiordan
Copy link
Member

Jeez, that's a shitty bug 😖

Nice one for finding and fixing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants