KangoExtensions / kango

Kango framework issue tracker
74 stars 7 forks source link

Firefox behaves badly #152

Open ar7casper opened 8 years ago

ar7casper commented 8 years ago

Hi,

Developed an extension using kango using 1.8.0. Works great on Chrome & Safari, but FF is causing problems. These are the problems I've found so far -

  1. Storage - I ran a test, saved some data on the content script to the storage. Checked that it was saved. Then, next time I open the extension, the data disappears....
  2. Messaging doesn't always work, when a tab is opened, everything works great, but when the user interacts with the UI and does an action that sends a message to the background, the messaging back doesn't work.

I'm still investigating, trying to figure out what's wrong, but I've ruled out problems related to my code. (For instance, everything works great on Safari & Chrome)....

Are there any known issues that you know of?

Thanks.

thekevinbrown commented 8 years ago

That's odd. Firefox storage is working just fine for us in our extension. Are you saving async, or synchronously? In some contexts saving or retrieving Kango storage options wasn't working for us until we switched over to doing this:

http://kangoextensions.com/docs/api-reference/kango.html#kango.invokeAsync

e.g. it'd work in Chrome and FF but not Safari, or similar weird behaviour. I finally found this line in the docs:

Kango API available only in async mode (as in content scripts).

On this page: http://kangoextensions.com/docs/api-reference/kango-ui-optionsPage.html

iamolivinius commented 8 years ago
  1. Make sure you don't clear caches and/or history in Firefox on shutdown.
  2. This is how I do message passing with kango:

Background message listener Background message handler Content Script message source

Firefox tends to have weird behavior when it comes to using the window object as a global reference within content scripts. Another annoying fact is the Firefox frequently changes it's extensions API. (XUL, add-on SDK, now WebExtensions)

thekevinbrown commented 8 years ago

@iamolivinius, can you tell me more about FF's 'weird behaviour' with the window object from content scripts? We're seeing this: https://github.com/toolkit-for-ynab/toolkit-for-ynab/issues/132

Basically for every other browser, hitting save on our options page then reloading the app will apply your updated settings. For FF, this isn't true until you open a new tab. The way features are loaded in is via the window object so I suspect this is the issue. Would love to know a good fix for this.