hoyois / clicktoplugin

Prevents plug-ins from loading automatically in Safari
http://hoyois.github.com/safariextensions/clicktoplugin/
229 stars 43 forks source link

MutationObserver needs to be disconnected #146

Closed zbirkenbuel closed 9 years ago

zbirkenbuel commented 9 years ago

The MutationObserver that is added to each element is never disconnected. When a user clicks to enable an element, the tracking record (_[elementID]) is deleted but the observer is never disconnected. If the observer fires again there is a null ref exception when trying to access _[elementID].parentNode) (https://github.com/hoyois/clicktoplugin/blob/master/ClickToPlugin.safariextension/main.js#L445).

That either needs to be safety checked or the observer needs to be disconnected whenever a tracking record is deleted.

hoyois commented 9 years ago

Good point, thanks! I mistakenly assumed the observer would be garbage collected, but I guess it's still referenced by the node.

hoyois commented 9 years ago

Fixed in CTP 3.1.7.