Site-Specific Preferences: Difference between revisions

Jump to navigation Jump to search
Line 238: Line 238:
The controller API is implemented as a ContentPrefController JavaScript object in the chrome window context of browser windows.
The controller API is implemented as a ContentPrefController JavaScript object in the chrome window context of browser windows.


Question: is "controller" conceptually an accurate description of this component?
<strong>Shouldn't this be called a "helper" and the "handler" be called a "controller" given the handler's clear "controller" role as mediator between the datastore "model" and the setting "view"?</strong>


It implements the following API for pref handlers to register themselves for notification of changes to preferences for the page currently being displayed in the browser:
It implements the following API for pref handlers to register themselves for notification of changes to preferences for the page currently being displayed in the browser:
Line 245: Line 245:
   void removeObserver(in AString name, in nsIObserver observer);
   void removeObserver(in AString name, in nsIObserver observer);


Question: should the controller let observers tell it to hold weak references to them?
<strong>Should the controller hold weak references to observers?</strong>


The controller registers itself as a web progress listener and DOMContentLoaded event listener for the tab browser widget and then notifies its observers when the widget's location changes (nsIWebProgressListener::onLocationChange) or a DOMContentLoaded event fires for a browser in the widget.
The controller registers itself as a web progress listener and DOMContentLoaded event listener for the tab browser widget and then notifies its observers when the widget's location changes (nsIWebProgressListener::onLocationChange) or a DOMContentLoaded event fires for a browser in the widget.
Line 253: Line 253:
For DOMContentLoaded events, the controller notifies observers with the "content-pref-dom-content-loaded" topic, the document object whose content was loaded as the subject, and the value of the site-specific preference for the document (if any) as the data.
For DOMContentLoaded events, the controller notifies observers with the "content-pref-dom-content-loaded" topic, the document object whose content was loaded as the subject, and the value of the site-specific preference for the document (if any) as the data.


Question: are these the right topic names for these notifications?
<strong>Are these the right topic names for these notifications?</strong>


== Text Zoom Handler ==
== Text Zoom Handler ==
canmove, Confirmed users
2,056

edits

Navigation menu