Observer Notifications

  • Revision slug: Observer_Notifications
  • Revision title: Observer Notifications
  • Revision id: 53167
  • Created:
  • Creator: Mgjbot
  • Is current revision? No
  • Comment robot Adding: [[ja:Observer Notifications]] <<langbot>>

Revision Content

Observer topics

The following are topics that you can observe during the course of an application. Unless otherwise noted you register for the topics using the observer service.

Application startup

These are the topics that you can observe on startup, in order of appearance.

Topic Description
xpcom-startup Called when xpcom is initialized. Many things are not available for use at this point. You must register in the category manager to see this topic.
app-startup General event for application startup. You must register in the category manager to see this topic.
profile-do-change This is fired after the profile has been selected. You will not be able to access user preferences, bookmarks, or anything that uses the profile folder until this event occurs. This occurs after any profile migration.
profile-after-change This is fired after all the observers for profile-do-change have been notified.
final-ui-startup Triggered just before the first window for the application is displayed.

Application shutdown

These are the topics that you can observe on shutdown, in order of appearance.

Topic Description
quit-application-requested Something has requested that the application be shutdown. You can cancel the shutdown from here.
quit-application-granted All observers have agreed to the shutdown.
quit-application The application is about to quit.
profile-change-teardown Part of the shutdown, profile data is still available at this point.
profile-before-change Called just before the profile is lost.
xpcom-shutdown This is the end. Many things will not be available here.

HTTP requests

These are the topics that you can observe during a HTTP request (see Setting HTTP request headers and Creating Sandboxed HTTP Connections). Both are passed an {{template.Interface("nsIHttpChannel")}} as the subject parameter.

Topic Description
http-on-modify-request Called as a http request is made. The channel is available to allow you to modify headers and such.
http-on-examine-response Called after a response has been received from the webserver. Headers are available on the channel.
{{ wiki.languages( { "ja": "ja/Observer_Notifications" } ) }}

Revision Source

<h2 name="Observer_topics"> Observer topics </h2>
<p>The following are topics that you can observe during the course of an application. Unless otherwise noted you register for the topics using the <a href="en/NsIObserverService"> observer service</a>.
</p>
<h3 name="Application_startup"> Application startup </h3>
<p>These are the topics that you can observe on startup, in order of appearance.
</p>
<table class="standard-table">
  <tbody><tr>
    <th>Topic</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>xpcom-startup</td>
    <td>Called when xpcom is initialized. Many things are not available for use at this point. You must register in the category manager to see this topic.</td>
  </tr>
  <tr>
    <td>app-startup</td>
    <td>General event for application startup. You must register in the category manager to see this topic.</td>
  </tr>
  <tr>
    <td>profile-do-change</td>
    <td>This is fired after the profile has been selected. You will not be able to access user preferences, bookmarks, or anything that uses the profile folder until this event occurs. This occurs after any profile migration.</td>
  </tr>
  <tr>
    <td>profile-after-change</td>
    <td>This is fired after all the observers for profile-do-change have been notified.</td>
  </tr>
  <tr>
    <td>final-ui-startup</td>
    <td>Triggered just before the first window for the application is displayed.</td>
  </tr>
</tbody></table>
<h3 name="Application_shutdown"> Application shutdown </h3>
<p>These are the topics that you can observe on shutdown, in order of appearance.
</p>
<table class="standard-table">
  <tbody><tr>
    <th>Topic</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>quit-application-requested</td>
    <td>Something has requested that the application be shutdown. You can cancel the shutdown from here.</td>
  </tr>
  <tr>
    <td>quit-application-granted</td>
    <td>All observers have agreed to the shutdown.</td>
  </tr>
  <tr>
    <td>quit-application</td>
    <td>The application is about to quit.</td>
  </tr>
  <tr>
    <td>profile-change-teardown</td>
    <td>Part of the shutdown, profile data is still available at this point.</td>
  </tr>
  <tr>
    <td>profile-before-change</td>
    <td>Called just before the profile is lost.</td>
  </tr>
  <tr>
    <td>xpcom-shutdown</td>
    <td>This is the end. Many things will not be available here.</td>
  </tr>
</tbody></table>
<h3 name="HTTP_requests"> HTTP requests </h3>
<p>These are the topics that you can observe during a HTTP request (see <a href="en/Setting_HTTP_request_headers">Setting HTTP request headers</a> and <a href="en/Creating_Sandboxed_HTTP_Connections#HTTP_notifications"> Creating Sandboxed HTTP Connections</a>). Both are passed an {{template.Interface("nsIHttpChannel")}} as the subject parameter.
</p>
<table class="standard-table">
  <tbody><tr>
    <th>Topic</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>http-on-modify-request</td>
    <td>Called as a http request is made. The channel is available to allow you to modify headers and such.</td>
  </tr>
  <tr>
    <td>http-on-examine-response</td>
    <td>Called after a response has been received from the webserver. Headers are available on the channel.</td>
  </tr>
</tbody></table>
<div class="noinclude">
</div>
{{ wiki.languages( { "ja": "ja/Observer_Notifications" } ) }}
Revert to this revision