Removing a preference element throws an exception




5 years ago
3 years ago


(Reporter: mozilla, Unassigned)


17 Branch

Firefox Tracking Flags

(Not tracked)




5 years ago
User Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20100101 Firefox/17.0 (Beta/Release)
Build ID: 20130509111054

Steps to reproduce:

1. Open a prefwindow with some preference elements nested in a preferences element.
2. From javascript, remove one of the preference elements (eg. prefEl.parentNode.removeChild(prefEl)).

Actual results:

Timestamp: 31/08/13 00:32:21
Error: TypeError: this.preferences is null
Source File: chrome://global/content/bindings/preferences.xml
Line: 122

I believe this happens because this.preferences is a getter for the parentNode which no longer exists by the time the destructor runs.  This appears to leave a hanging preference observer, which will presumably leak forever.

Expected results:

Don't crash, and make sure the observer is removed.

Comment 1

3 years ago
Is this still reproducing on latest Firefox versions? e.g Firefox 43

If yes, could you provide a detailed test case so we can use to reproduce the issue?
Flags: needinfo?(mozilla)

Comment 2

3 years ago
Yes, this still happens in nightly.

Perhaps the simplest way to reproduce is to take any addon with a preferences dialog window, open the preferences dialog, open DOM Inspector, and manually remove any preference element from inside the preferences container.  The typeError will be thrown.
Flags: needinfo?(mozilla)

Comment 3

3 years ago
I see that per comment 2.
Component: Untriaged → XUL Widgets
Ever confirmed: true
OS: Linux → All
Product: Firefox → Toolkit
Hardware: x86 → All
You need to log in before you can comment on or make changes to this bug.