executeInBackground crashes with cryptic error if the function isn't an arrow function
Aran-Fey opened this issue · 0 comments
Aran-Fey commented
So I've discovered the hard way that executeInBackground
only works with arrow functions.
Consider this user script:
executeInBackground(() => console.log('hello'));
This correctly outputs "hello" to the extension console.
In contrast, these other snippets fail with very unhelpful errors:
function func(){
console.log('hello');
}
executeInBackground(func);
// Uncaught (in promise) Error: eval(...) is undefined
executeInBackground((function(){
console.log('hello');
}));
// Uncaught (in promise) Error: function statement requires a name