toolbox-team / reddit-moderator-toolbox-legacy

LEGACY VERSION do not use
http://www.reddit.com/r/toolbox
Apache License 2.0
66 stars 40 forks source link

Temporary loading of extension in firefox with reddit open causes jquery ReferenceErrors. #769

Open creesch opened 8 years ago

creesch commented 8 years ago

With firefox developer edition:

  1. open reddit in a tab,
  2. install temporarely the addon,
  3. a ReferenceError is logged in the console

This issue is more for administration than anything else. I reported it on the mozilla irc network #webextensions and this issue is for any followups.

rpl commented 8 years ago

@creesch I've reproduced this issue and I did a brief debug session on it locally, but with a slightly different STR composed by the following steps:

  1. open reddit in a tab
  2. install temporarely the addon
  3. no ReferenceError is logged <---
  4. reload the addon from about:debugging (or disable/enable it from about:addons)
  5. after a while a no ReferenceError is logged (it will be logged on every mutation in the page DOM, because the line that raise the exception is in a mutation observer) <---
  6. reload the page or navigate to an other reddit page
  7. no ReferenceError is logged anymore <---

given the above STR, it looks like this is likely to be related to:

The raised exception seems that is generated while there are still some of the listener attached by the old instance of the content script on DOM elements of the page (e.g. the mutation observer created at line 1954 of tbutils.js) , which are then completely removed when the tab navigates to a different page (or it is reloaded, which has the same effect).

creesch commented 8 years ago

Alright, thanks for the followup!