MozillaZine

Content script attached to tab detaches when URL changes

Talk about add-ons and extension development.
smellyfinger
 
Posts: 28
Joined: January 11th, 2014, 9:54 am

Post Posted August 3rd, 2017, 5:04 pm

Hi guys

I have a WebExtension that needs to continuously monitor a tab even if it changes URL. I have attached an example addon to show the behavior here https://www.dropbox.com/s/zzzkxi02jmhoszj/FirefoxBR3.zip?dl=0. Press the addon toolbar button and it opens a new tab with google.com. Open the browser console in this tab and you'll see Hello messages printed continuously. Now perform a search and the printing stops and also the content script is not shown in the debugger anymore.

A similar addon used to work but that behavior seems to have changed (silently?) in recent versions of Firefox and my addon is now broken. I tested this on Firefox Developer Edition 55.

lithopsian
 
Posts: 3662
Joined: September 15th, 2010, 9:03 am

Post Posted August 4th, 2017, 5:59 am

Something very strange going on with addon scripts recently. I've had similar problems. Have you checked that the script is actually removed, or does it just stop getting events and messages? Does it happen when multiprocess is turned off?

smellyfinger
 
Posts: 28
Joined: January 11th, 2014, 9:54 am

Post Posted August 5th, 2017, 3:07 am

@lithopsian yes the content script the removed from the page according to the debugger window. I'm not sure how to disable multiprocess though.

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 2 guests