Skip to content

Instantly share code, notes, and snippets.

@mroderick
Last active July 18, 2018 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mroderick/086353f9a91c610f7d5780432ed0f05a to your computer and use it in GitHub Desktop.
Save mroderick/086353f9a91c610f7d5780432ed0f05a to your computer and use it in GitHub Desktop.
Firefox debugger bug

Firefox debugger bug

When using the debugger and re-using an argument name in a chain of promises, the debugger displays the second argument as undefined().

Try running the examples in Firefox and compare what the debugger displays about the argument to the second callback.

<!doctype html>
<html>
<head>
<script>
var promises = [
Promise.resolve('hello'),
Promise.resolve('world')
];
Promise.all(promises)
.then(function(values){
var morePromises = [
Promise.resolve('apple'),
Promise.resolve('pie')
];
return Promise.all(morePromises);
})
// this `values` is displayed as `undefined()`
.then(function(values){
debugger;
});
</script>
</head>
<body></body>
</html>
<!doctype html>
<html>
<head>
<script>
var promises = [
Promise.resolve('hello'),
Promise.resolve('world')
];
Promise.all(promises)
.then(function(values){
var morePromises = [
Promise.resolve('apple'),
Promise.resolve('pie')
];
return Promise.all(morePromises);
})
// this `otherValues` displays as expected
.then(function(otherValues){
debugger;
});
</script>
</head>
<body></body>
</html>
@mroderick
Copy link
Author

2018-07-18 at 14 26

@dazld
Copy link

dazld commented Jul 18, 2018

the only difference between the two is that one uses values as the arg name and the other otherValues..?

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