Chrome Extension: Inspect Views required for actions to occur

627 views
Skip to first unread message

Kurt Collins

unread,
May 13, 2018, 11:14:49 AM5/13/18
to Chromium-Extensions-Announce
I've been developing a Chrome Extension, but I'm relatively new to extension development. So I apologize for my newb-ness. I've been running into a weird bug, though, and I'd appreciate any input that could point me in the right direction.

I've developed an extension that grabs content from the active tab and saves it to a database via some custom API calls. All of this happens after doing an OAuth handshake with Github. What's weird, though, is that unless the Inspect Views Background Page is open, then it neither grabs content from the active nor does it make any API calls. However, as soon as I re-open the Inspect Views console, everything works perfectly.

Any idea what this could be? I just need to be pointed in the right direction.

PhistucK

unread,
May 13, 2018, 11:35:48 AM5/13/18
to ku...@kurt.sx, Chromium-extensions
Without seeing code, it is hard to understand where lies the issue.
On the surface, if the background page showed "(inactive)" (or similar) next to it before you inspected it, then it sounds like you might be able to solve it with a manifest change -
"background": {"persistent": true, script: [...]}
However, this has performance and memory implications, so if you can avoid that and find a better solution, that would be better. For that, seeing some of the code would help.

What is supposed to make the extension grab content from the active tab? A browser action click? A timer?


PhistucK


--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/bcc76884-1b05-448c-aa49-96927b00cf92%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

Kurt Collins

unread,
May 13, 2018, 11:43:54 AM5/13/18
to PhistucK, Chromium-extensions
PhistucK –

I would have added code, but I didn't know what code related to it.

Thanks so much for the advice regarding the manifest change! That was exactly what it was! Setting persistent to true is all it took.

Very much appreciated!

Kurt Collins | US: +1 (415) 385-3003 | FR: +33 (0)7 88 78 49 76

PhistucK

unread,
May 14, 2018, 3:33:58 AM5/14/18
to ku...@kurt.sx, Chromium-extensions
As long as it is justified, that is cool, but think of your users. This is one more process that is always active. Do you need it to be active all of the time?

PhistucK

Kurt Collins

unread,
May 14, 2018, 1:36:10 PM5/14/18
to PhistucK, Chromium-extensions

The weird thing is that it was set to false before and everything was working fine. I don't know what code I would have changed that suddenly stopped the plug-in from working.


Normally, with persistent set to false, network actions need to be triggered by an event. Is that correct?


PhistucK

unread,
May 16, 2018, 3:21:53 AM5/16/18
to Kurt Collins, Chromium-extensions
With event pages (persistent: false) - Chrome extension/application events (or chrome.alarms, but not setInterval or setTimeout and similar) "wake up" the background script, otherwise is it unloaded (therefore not running JavaScript).

PhistucK

Reply all
Reply to author
Forward
0 new messages