According to the Mozilla documentation at https://developer.mozilla.org/en-US/Add ... cuteScript this function should take 2 parameters and returns a Promise, meaning you should do something like this:
Code: Select all
browser.tabs.executeScript(tab_id, { file: 'script.js' }).then(function(result) {
alert('Script injected');
});
Now obviously I could just add a line to the end of my script reading "true;" but that seems horrible.
Altermatively, if I use the following syntax (which is the same as chrome's syntax) then it works fine:
Code: Select all
browser.tabs.executeScript(tab_id, { file: 'script.js' }, function(result) {
alert('Script injected');
});
However obviously here I am using a third parameter (the callback function) which is not mentioned in the Mozilla documentation.
So my question is this:
Is calling with 3 parameters completely valid or is it just luck that it works and it could stop working any moment?
Thanks,
Martin