Chrome.tabs not available in plugins

First of all, thank you for creating such an awesome extension!

I’ve made some plugins that use chrome.tabs.create, which is not working because when it executes chrome.tabs does not exist. The same thing happens if I load the AntiProcrastination plugin locally.

Note that this does work when the plugin is run from the LipSurf options tab.

Any ideas? Sounds like a permissions problem.

You are using fn and not pageFn correct? pageFn runs in the context of the webpage, fn in the context of the extension.

It’s possible that there’s a bug with custom loaded plugins and fn I will look into that in a few days when I have time. Thanks for letting me know!

I’m using pageFn. I see now that the plugins that use chrome.tabs use fn, I didn’t notice that before. The documentation is confusing at the moment. For pageFn, you say:

The async function to run on the page when the command is called.

When you use “The” (as opposed to “An”), we read that as “The one and only async function to run when a command is called.”

Then for fn you say:

Code to run in the Chrome extension context.

Code to run when? It isn’t clear that it is also an async function that will be run when a command is called.

It would be very helpful to make it clear that there are two choices for handling commands, pageFn and fn, and make it clear what the difference is in terms of the execution environment (for example, chrome.tabs being available!) and what would happen if they were both defined.

Switched to fn and it’s working now.

I’ve updated the docs as-per your comments: https://github.com/LipSurf/plugins/commit/22dfc402b22805c31dee96b302e1ae35ce23c111

Let me know if you think anything else needs clarification!

Almost there! I left a commit comment.

Updated once more https://github.com/LipSurf/plugins/commit/f60c8f4f7a98715f4080f26d09daf641523a9273. Also, PRs welcome!