old add-on builds staying in browser memory when using online add-on builder

14 views
Skip to first unread message

Daniel Goodwin

unread,
Mar 15, 2011, 2:06:15 PM3/15/11
to mozilla-la...@googlegroups.com
I am using Minefield 4.0b13pre (but also is an issue the FF4.0 rc) on a Mac (10.6.6) and I'm running into a problem with the online add-on builder. It appears that older builds of the add-on are not being removed from the browsers memory...

To reproduce:

1) Open a browser with two windows:

- http://builder.addons.mozilla.org
- the other tab can point anywhere, ex: mozilla.com
 
2) Create an add-on (at http://builder.addons.mozilla.org) with the code of:

var tabs = require("tabs");
tabs.on('activate', function(tab) {
  console.log('this is a test.')
});

(I'm using add-on kit 1.0b3)

3) Open your error console to watch the log

4) Click the Test button in the online builder, wait for the build/install to complete

5) Now click on the other tab you have open (mozilla.com)

6) You will see the message "this is a test" logged to the console

7) Go back to the online editor, you will see a second log of "this is a test" from switching back to the first tab

Everything looks good to this point...

8) Change the log message to: "this is a test 2"

9) Clear the error console

10) Rebuild the add-on (click 'Test')

11) Switch to the other tab…

12) You will see two log messages:

info: this is a test
info: this is a test 2

So I believe the browser is not properly dumping the old add-on build. Probably not an issue if you are doing the command line development because the cfx commands restarts the browser, right? Until I figured out what was going on, I believed that the add-on system was completely hosed and almost gave up… something I don't want any add-on developers to do.

KWierso

unread,
Mar 15, 2011, 2:16:13 PM3/15/11
to mozilla-labs-jetpack
I think you'd have to have your addon listen for the unload/upgrade/
disable events and remove all of your current code in there as
necessary.
https://jetpack.mozillalabs.com/sdk/1.0b3/docs/dev-guide/addon-development/implementing-simple-addon.html

Daniel

unread,
Mar 15, 2011, 2:17:30 PM3/15/11
to mozilla-la...@googlegroups.com
On initial review of the user-flow you mentioned, I don't think it is an issue with the Add-on Builder. All of the SDK modules (to my knowledge) were built to take advantage of the 'unload' functionality in the SDK that allows the module to perform a clean-up step when uninstalled. The Builder goes through a regular uninstall step as would occur in normal add-on usage.

There are two scenarios that could cause this:

1) The tabs module is not property removing set events on its unload step
2) The Builder is not requesting that the add-on be uninstalled

The reason I feel #2 is unlikely, is because you are able to test install another add-on, and installing two to test in the Builder is not allowed in the code. Calling install again while one is installed presently automatically fires an unload on the add-on that is currently installed before letting the action proceed.

Anyone else have an idea on why this could be happening?

- Daniel

KWierso

unread,
Mar 15, 2011, 6:06:31 PM3/15/11
to mozilla-labs-jetpack
Is it also possible that the anonymous functions can't be removed?
https://developer.mozilla.org/en/DOM/element.addEventListener#Memory_issues

Drew Willcoxon

unread,
Mar 15, 2011, 11:10:44 PM3/15/11
to mozilla-la...@googlegroups.com
I wonder whether this has to do with
https://bugzilla.mozilla.org/show_bug.cgi?id=620541.

Drew

> 11) Switch to the other tab�


>
> 12) You will see two log messages:
>
> info: this is a test
> info: this is a test 2
>
> So I believe the browser is not properly dumping the old add-on build.
> Probably not an issue if you are doing the command line development
> because the cfx commands restarts the browser, right? Until I figured
> out what was going on, I believed that the add-on system was completely

> hosed and almost gave up� something I don't want any add-on developers
> to do.
>
> --
> You received this message because you are subscribed to the Google
> Groups "mozilla-labs-jetpack" group.
> To post to this group, send email to mozilla-la...@googlegroups.com.
> To unsubscribe from this group, send email to
> mozilla-labs-jet...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mozilla-labs-jetpack?hl=en.

Nickolay Ponomarev

unread,
Mar 16, 2011, 7:14:35 PM3/16/11
to mozilla-la...@googlegroups.com
On Tue, Mar 15, 2011 at 9:17 PM, Daniel <dani...@gmail.com> wrote:
On initial review of the user-flow you mentioned, I don't think it is an issue with the Add-on Builder. All of the SDK modules (to my knowledge) were built to take advantage of the 'unload' functionality in the SDK that allows the module to perform a clean-up step when uninstalled. The Builder goes through a regular uninstall step as would occur in normal add-on usage.

There are two scenarios that could cause this:

1) The tabs module is not property removing set events on its unload step

Indeed, there doesn't appear to be a matching cleanup code for this:
https://github.com/mozilla/addon-sdk/blob/master/packages/api-utils/lib/windows/tabs.js
        tabContainer.addEventListener(type.dom,
                                      this._onTabEvent.bind(this, type),
                                      false);

Could someone file a bug about this?

Nickolay
Reply all
Reply to author
Forward
0 new messages