Confirmed users
657
edits
(Describe the private-browsing-enter notification) |
(Document the subject param for the browser:private-browsing notification) |
||
Line 18: | Line 18: | ||
===Private Browsing notifications=== | ===Private Browsing notifications=== | ||
Extensions can be notified of private browsing status changes, i.e., when the user enters or leaves the private browsing mode. This is done via standard XPCOM observer service mechanisms. The notification's name is <tt>browser:private-browsing</tt>. The data parameter can be either <tt>enter</tt> (indicating that the private browsing mode has been initiated) or <tt>exit</tt> (indicating that the private browsing mode has been terminated). | Extensions can be notified of private browsing status changes, i.e., when the user enters or leaves the private browsing mode. This is done via standard XPCOM observer service mechanisms. The notification's name is <tt>browser:private-browsing</tt>. The data parameter can be either <tt>enter</tt> (indicating that the private browsing mode has been initiated) or <tt>exit</tt> (indicating that the private browsing mode has been terminated). The subject parameter is an object implementing the <tt>nsISupportsPRBool</tt> interface, whose <tt>data</tt> member determines whether we're leaving the private browsing mode because Firefox is being shutdown or not (<tt>true</tt> if Firefox is being shut down, <tt>false</tt> otherwise). | ||
The second code sample below implements a full blown listener for the private browsing mode, which can both be used to query its current status, and set a watcher to watch for entering and/or leaving the private mode. | The second code sample below implements a full blown listener for the private browsing mode, which can both be used to query its current status, and set a watcher to watch for entering and/or leaving the private mode. |