mozilla

Revision 83233 of nsINavHistoryService

  • Revision slug: XPCOM_Interface_Reference/nsINavHistoryService
  • Revision title: nsINavHistoryService
  • Revision id: 83233
  • Created:
  • Creator: Bomfog
  • Is current revision? No
  • Comment Reverted to earlier version; 2 words added, 6 words removed; page display name reset to default

Revision Content

{{ Firefox3() }}

The

nsINavHistoryService interface provides complex query functions, more fine-grained getters and setters.


{{ InterfaceStatus("nsINavHistoryService", "toolkit/components/places/public/nsINavHistoryService.idl", "unfrozen", "Mozilla 1.9", "yes") }}

Inherits from:

nsISupports

Implemented by:

"@mozilla.org/browser/nav-history-service;1". To use this service, use:
var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"]
                               .getService(Components.interfaces.nsINavHistoryService);

Method overview

AString getPageTitle(in nsIURI aURI);void markPageAsFollowedBookmark(in nsIURI aURI);boolean canAddURI(in nsIURI aURI);void setPageDetails(in nsIURI aURI, in AString aTitle, in unsigned long aVisitCount, in boolean aHidden, in boolean aTyped);long long addVisit(in nsIURI aURI, in PRTime aTime, in long long aReferringVisit, in long aTransitionType, in boolean aIsRedirect, in long long aSessionID);nsINavHistoryQuery getNewQuery();nsINavHistoryQueryOptions getNewQueryOptions();nsINavHistoryResult executeQuery(in nsINavHistoryQuery aQuery, in nsINavHistoryQueryOptions options);nsINavHistoryResult executeQueries({{ mediawiki.external('array,size_is(aQueryCount)') }} in nsINavHistoryQuery aQueries, in unsigned long aQueryCount, in nsINavHistoryQueryOptions options);void queryStringToQueries(in AUTF8String aQueryString, {{ mediawiki.external('array, size_is(aResultCount)') }} out nsINavHistoryQuery aQueries, out unsigned long aResultCount, out nsINavHistoryQueryOptions options);AUTF8String queriesToQueryString({{ mediawiki.external('array, size_is(aQueryCount)') }} in nsINavHistoryQuery aQueries, in unsigned long aQueryCount, in nsINavHistoryQueryOptions options);void addObserver(in nsINavHistoryObserver observer, in boolean ownsWeak);void removeObserver(in nsINavHistoryObserver observer);void runInBatchMode(in nsINavHistoryBatchCallback aCallback, in nsISupports aClosure);void importHistory(in nsIFile file);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Attributes

hasHistoryEntriesbooleanTrue if there is any history. This can be used in UI to determine whether the "clear history" button should be enabled or not. This is much better than using BrowserHistory.count since that can be very slow if there is a lot of history (it must enumerate each item). This is pretty fast. historyDisabledbooleanTrue if history is disabled. currently, history is disabled if the browser.history_expire_days pref is "0".
Attribute Type Description
 
   
 
   

Constants

TRANSITION_LINKTRANSITION_TYPEDTRANSITION_BOOKMARKTRANSITION_EMBEDTRANSITION_REDIRECT_PERMANENTTRANSITION_REDIRECT_TEMPORARYTRANSITION_DOWNLOAD
Constant Value Description
 
1 This transition type means the user followed a link and got a new toplevel window.
 
2 This transition is set when the user followed a bookmark to get to the page.
 
3 This transition is set when the user followed a bookmark to get to the page.
 
4 This transition type is set when some inner content is loaded. This is true of all images on a page, and the contents of the iframe. It is also true of any content in a frame, regardless if whether or not the user clicked something to get there.
 
5 This transition is set when the transition was a permanent redirect.
 
6 This transition is set when the transition was a temporary redirect.
 
7 This transition is set when the transition is a download.

Methods

getPageTitle()

This method retrieves the original title of the page.

 AString getPageTitle(
   in nsIURI aURI
 );
Parameters
aURI
The page whose title needs to be retrieved.
Return value

Returns the original title of the page.

markPageAsFollowedBookmark()

This method is just like

markPageAsTyped (in {{ Interface("nsIBrowserHistory") }}, also implemented by the history service), but for bookmarks. It declares that the given URI is being opened as a result of following a bookmark. If this URI is loaded soon after this message has been received, that transition will be marked as following a bookmark.
 void markPageAsFollowedBookmark(
   in nsIURI aURI
 );
Parameters
aURI
The page that is to be marked as followed by a bookmark.

canAddURI()

This method checks if the given URI would be added to the history or not. Many types of URIs, such as

"chrome:" URIs, are not stored when addURI is called. This function allows you to determine whether it will be or not.

You don't have to worry about calling this,

addPageToSession/addURI will always check before actually adding the page. This function is public because some components may want to check if this page would go in the history (i.e. for annotations).
 boolean canAddURI(
   in nsIURI aURI
 );
Parameters
aURI
The URI that needs to be added to the history system.
Return value

Returns

true if this URI would be added to the history, otherwise returns false.

setPageDetails()

This method sets the full information for a given page. If the page does not exist, it will be added to the database. If it does, the existing values will be overwritten. This is an updated version of

addPageWithDetails for backup/restore type operations.
 void setPageDetails(
   in nsIURI aURI, 
   in AString aTitle, 
   in unsigned long aVisitCount, 
   in boolean aHidden,
   in boolean aTyped
 );
Parameters
aURI
The page to be added or changed.
aTitle
The title as specified by the page.
aVisitCount
The number of times this page has been visited. Setting this to
"0" may make the page invisible in some views.
aHidden
Whether the page is hidden or not. If the page has only
TRANSITION_EMBED visits, this will be true, otherwise it will be false.
aTyped
True if this URI has ever been typed, otherwise false.

addVisit()

This method adds a visit for a specific page. This will probably not be commonly used other than for backup/restore type operations. If the URI does not have an entry in the history database already, one will be created with no visits, no title, hidden, not typed. Adding a visit will automatically increment the visit count for the visited page and will unhide it and/or mark it typed according to the transition type.

 long long addVisit(
   in nsIURI aURI, 
   in PRTime aTime,
   in long long aReferringVisit, 
   in long aTransitionType,
   in boolean aIsRedirect, 
   in long long aSessionID
 );
Parameters
aURI
The visited page.
aTime
The time page was visited (microseconds).
aReferringVisit
The ID of the visit that generated this one. Use
"0" for no referrer. This must be a valid visit already in the Database or "0".
aTransitionType
The type of transition: one of
TRANSITION_* defined above.
aIsRedirect
True if the given visit redirects to somewhere else (i.e you will create a visit out of here that is a redirect transition). This causes this page to be hidden in normal history views (unless it has been unhidden by visiting it with a non-redirect).
aSessionID
The session ID that this page belongs to. Use
"0" for no session.
Return value

Returns the ID of the created visit. This will be

"0" if the URI is not valid for adding to history (canAddURI = false).

getNewQuery()

This method returns a new query object that you can pass to

executeQuer{{ mediawiki.external('y/ies') }} methods. It will be initialized to all empty (so using it will give you all history).
 nsINavHistoryQuery getNewQuery();
Parameters

None.

Return value

Returns a new query object.

getNewQueryOptions()

This method returns a new options object that you can pass to

executeQuer{{ mediawiki.external('y/ies') }} methods after setting the desired options.
 nsINavHistoryQueryOptions getNewQueryOptions();
Parameters

None.

Return value

Returns a new options object.

executeQuery()

This method executes a query with a single query object and options. All the parameters set on the query object will be ANDed together.

 nsINavHistoryResult executeQuery(
   in nsINavHistoryQuery aQuery,
   in nsINavHistoryQueryOptions options
 );
Parameters
aQuery
The query object.
options
The options object.
Return value

Returns a new result object.

executeQueries()

This method is similar to

executeQuery method. It executes an array of queries. All of the query objects are ORed together. Within a query, all the terms are ANDed together as in executeQuery method.
 nsINavHistoryResult executeQueries(
   [array,size_is(aQueryCount)] in nsINavHistoryQuery aQueries,
   in unsigned long aQueryCount,
   in nsINavHistoryQueryOptions options
 );
Parameters
aQueries
The queries object.
aQueryCount
The count of queries.
options
The options object.
Return value

Returns a new result object.

queryStringToQueries()

This method converts a query URI-like string to an array of actual query objects for use to

executeQueries method. The output query array may be empty if there is no information. However, there will always be an options structure returned (if nothing is defined, it will just have the default values).
 void queryStringToQueries(
   in AUTF8String aQueryString,
   [array, size_is(aResultCount)] out nsINavHistoryQuery aQueries,
   out unsigned long aResultCount,
   out nsINavHistoryQueryOptions options
 );
Parameters
aQueryString
The query URI-like string.
aQueries
The queries object.
aResultCount
The count of converted queries.
options
The options object.

queriesToQueryString()

This method converts a query into an equivalent string that can be persisted. Inverse of

queryStringToQueries method.
 AUTF8String queriesToQueryString(
   [array, size_is(aQueryCount)] in nsINavHistoryQuery aQueries,
   in unsigned long aQueryCount,
   in nsINavHistoryQueryOptions options
 );
Parameters
aQueries
The queries object.
aQueryCount
The count queries.
options
The options object.
Return value

Returns the converted query into an equivalent string query.

addObserver()

This method adds a history observer. If

ownsWeak is false, the history service will keep an owning reference to the observer. If ownsWeak is true, then aObserver must implement {{ Interface("nsISupportsWeakReference") }}, and the history service will keep a weak reference to the observer.
 void addObserver(
   in nsINavHistoryObserver observer, 
   in boolean ownsWeak
 );
Parameters
observer
The history observer to be added.
ownsWeak
The owning reference state
(boolean).

removeObserver()

This method removes a history observer.

 void removeObserver(
   in nsINavHistoryObserver observer
 );
Parameters
observer
The history observer to be removed.

runInBatchMode()

This method runs the passed callback in batch mode. Use this when a lot of things are about to change. Calls can be nested, observers will only be notified when all batches begin/end.

 void runInBatchMode(
   in nsINavHistoryBatchCallback aCallback,
   in nsISupports aClosure
 );
Parameters
aCallback
{{ Interface("nsINavHistoryBatchCallback") }} interface to call.
aClosure
Opaque parameter passed to {{ Interface("nsINavBookmarksBatchCallback") }}.

importHistory()

This method imports the given Mork history file.

 void importHistory(
   in nsIFile file
 );
Parameters
file
The Mork history file to import.

See also

Revision Source

<p>
{{ Firefox3() }}
</p><p>The </p><code>nsINavHistoryService</code> interface provides complex query functions, more fine-grained getters and setters.
<p><br>
{{ InterfaceStatus("nsINavHistoryService", "toolkit/components/places/public/nsINavHistoryService.idl", "unfrozen", "Mozilla 1.9", "yes") }}
</p><p>Inherits from: </p><a href="en/NsISupports">nsISupports</a>
<p>Implemented by: </p><code>"@mozilla.org/browser/nav-history-service;1"</code>. To use this service, use:

<pre class="eval">var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"]
                               .getService(Components.interfaces.nsINavHistoryService);
</pre>
<h2 name="Method_overview">Method overview</h2>
<code>AString <a href="#getPageTitle.28.29">getPageTitle</a>(in <a href="en/NsIURI">nsIURI</a> aURI);</code><code>void <a href="#markPageAsFollowedBookmark.28.29">markPageAsFollowedBookmark</a>(in <a href="en/NsIURI">nsIURI</a> aURI);</code><code>boolean <a href="#canAddURI.28.29">canAddURI</a>(in <a href="en/NsIURI">nsIURI</a> aURI);</code><code>void <a href="#setPageDetails.28.29">setPageDetails</a>(in <a href="en/NsIURI">nsIURI</a> aURI, in AString aTitle, in unsigned long aVisitCount, in boolean aHidden, in boolean aTyped);</code><code>long long <a href="#addVisit.28.29">addVisit</a>(in <a href="en/NsIURI">nsIURI</a> aURI, in PRTime aTime, in long long aReferringVisit, in long aTransitionType, in boolean aIsRedirect, in long long aSessionID);</code><code><a href="en/NsINavHistoryQuery">nsINavHistoryQuery</a> <a href="#getNewQuery.28.29">getNewQuery</a>();</code><code><a href="en/NsINavHistoryQueryOptions">nsINavHistoryQueryOptions</a> <a href="#getNewQueryOptions.28.29">getNewQueryOptions</a>();</code><code><a href="en/NsINavHistoryResult">nsINavHistoryResult</a> <a href="#executeQuery.28.29">executeQuery</a>(in <a href="en/NsINavHistoryQuery">nsINavHistoryQuery</a> aQuery, in <a href="en/NsINavHistoryQueryOptions">nsINavHistoryQueryOptions</a> options);</code><code><a href="en/NsINavHistoryResult">nsINavHistoryResult</a> <a href="#executeQueries.28.29">executeQueries</a>({{ mediawiki.external('array,size_is(aQueryCount)') }} in <a href="en/NsINavHistoryQuery">nsINavHistoryQuery</a> aQueries, in unsigned long aQueryCount, in <a href="en/NsINavHistoryQueryOptions">nsINavHistoryQueryOptions</a> options);</code><code>void <a href="#queryStringToQueries.28.29">queryStringToQueries</a>(in <a href="en/AUTF8String">AUTF8String</a> aQueryString, {{ mediawiki.external('array, size_is(aResultCount)') }} out <a href="en/NsINavHistoryQuery">nsINavHistoryQuery</a> aQueries, out unsigned long aResultCount, out <a href="en/NsINavHistoryQueryOptions">nsINavHistoryQueryOptions</a> options);</code><code><a href="en/AUTF8String">AUTF8String</a> <a href="#queriesToQueryString.28.29">queriesToQueryString</a>({{ mediawiki.external('array, size_is(aQueryCount)') }} in <a href="en/NsINavHistoryQuery">nsINavHistoryQuery</a> aQueries, in unsigned long aQueryCount, in <a href="en/NsINavHistoryQueryOptions">nsINavHistoryQueryOptions</a> options);</code><code>void <a href="#addObserver.28.29">addObserver</a>(in <a href="en/NsINavHistoryObserver">nsINavHistoryObserver</a> observer, in boolean ownsWeak);</code><code>void <a href="#removeObserver.28.29">removeObserver</a>(in <a href="en/NsINavHistoryObserver">nsINavHistoryObserver</a> observer);</code><code>void <a href="#runInBatchMode.28.29">runInBatchMode</a>(in <a href="en/NsINavHistoryBatchCallback">nsINavHistoryBatchCallback</a> aCallback, in <a href="en/NsISupports">nsISupports</a> aClosure);</code><code>void <a href="#importHistory.28.29">importHistory</a>(in <a href="en/NsIFile">nsIFile</a> file);</code><table class="standard-table"> <tbody><tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

<tr>
<td>  </td></tr>

</tbody></table>
<h2 name="Attributes">Attributes</h2>
<code>hasHistoryEntries</code><code>boolean</code><code>True</code> if there is any history. This can be used in UI to determine whether the "clear history" button should be enabled or not. This is much better than using <code>BrowserHistory.count</code> since that can be very slow if there is a lot of history (it must enumerate each item). This is pretty fast.

<code>historyDisabled</code><code>boolean</code><code>True</code> if history is disabled. currently, history is disabled if the <code>browser.history_expire_days</code> pref is <code>"0"</code>.

<table class="standard-table"> <tbody><tr>
<td class="header">Attribute
</td><td class="header">Type
</td><td class="header">Description
</td></tr> <tr>
<td> </td></tr>
<tr><td> </td>
<td>  </td></tr><tr>
<td> </td></tr>
<tr><td> </td>
<td>  </td></tr></tbody></table>
<h2 name="Constants">Constants</h2>
<code>TRANSITION_LINK</code><code>TRANSITION_TYPED</code><code>TRANSITION_BOOKMARK</code><code>TRANSITION_EMBED</code><code>TRANSITION_REDIRECT_PERMANENT</code><code>TRANSITION_REDIRECT_TEMPORARY</code><code>TRANSITION_DOWNLOAD</code><table class="standard-table"> <tbody><tr>
<td class="header">Constant
</td><td class="header">Value
</td><td class="header">Description
</td></tr> <tr>
<td> </td></tr>
<tr><td> 1
</td><td>This transition type means the user followed a link and got a new toplevel window.
</td>
</tr><tr>
<td> </td></tr>
<tr><td> 2
</td><td>This transition is set when the user followed a bookmark to get to the page.
</td>
</tr><tr>
<td> </td></tr>
<tr><td> 3
</td><td>This transition is set when the user followed a bookmark to get to the page.
</td>
</tr><tr>
<td> </td></tr>
<tr><td> 4
</td><td>This transition type is set when some inner content is loaded. This is true of all images on a page, and the contents of the iframe. It is also true of any content in a frame, regardless if whether or not the user clicked something to get there.
</td>
</tr><tr>
<td> </td></tr>
<tr><td> 5
</td><td>This transition is set when the transition was a permanent redirect.
</td>
</tr><tr>
<td> </td></tr>
<tr><td> 6
</td><td>This transition is set when the transition was a temporary redirect.
</td>
</tr><tr>
<td> </td></tr>
<tr><td> 7
</td><td>This transition is set when the transition is a download.
</td>
</tr></tbody></table>
<h2 name="Methods"> Methods </h2>
<h3 name="getPageTitle.28.29"> getPageTitle() </h3>
<p>This method retrieves the original title of the page.
</p>
<pre class="eval"> AString getPageTitle(
   in nsIURI aURI
 );
</pre>
<h6 name="Parameters">Parameters</h6>
<dl><dt><code>aURI</code>
</dt><dd>The page whose title needs to be retrieved.
</dd></dl>
<h6 name="Return_value">Return value</h6>
<p>Returns the original title of the page.
</p>
<h3 name="markPageAsFollowedBookmark.28.29"> markPageAsFollowedBookmark() </h3>
<p>This method is just like </p><code>markPageAsTyped</code> (in {{ Interface("nsIBrowserHistory") }}, also implemented by the history service), but for bookmarks. It declares that the given URI is being opened as a result of following a bookmark. If this URI is loaded soon after this message has been received, that transition will be marked as following a bookmark.

<pre class="eval"> void markPageAsFollowedBookmark(
   in nsIURI aURI
 );
</pre>
<h6 name="Parameters_2">Parameters</h6>
<dl><dt><code>aURI</code>
</dt><dd>The page that is to be marked as followed by a bookmark.
</dd></dl>
<h3 name="canAddURI.28.29"> canAddURI() </h3>
<p>This method checks if the given URI would be added to the history or not. Many types of URIs, such as </p><code>"chrome:"</code> URIs, are not stored when <code>addURI</code> is called. This function allows you to determine whether it will be or not. <p>You don't have to worry about calling this, </p><code>addPageToSession</code>/<code>addURI</code> will always check before actually adding the page. This function is public because some components may want to check if this page would go in the history (i.e. for annotations).

<pre class="eval"> boolean canAddURI(
   in nsIURI aURI
 );
</pre>
<h6 name="Parameters_3">Parameters</h6>
<dl><dt><code>aURI</code>
</dt><dd>The URI that needs to be added to the history system.
</dd></dl>
<h6 name="Return_value_2">Return value</h6>
<p>Returns </p><code>true</code> if this URI would be added to the history, otherwise returns <code>false</code>.

<h3 name="setPageDetails.28.29"> setPageDetails() </h3>
<p>This method sets the full information for a given page. If the page does not exist, it will be added to the database. If it does, the existing values <strong>will be overwritten</strong>. This is an updated version of </p><code>addPageWithDetails</code> for backup/restore type operations.

<pre class="eval"> void setPageDetails(
   in nsIURI aURI, 
   in AString aTitle, 
   in unsigned long aVisitCount, 
   in boolean aHidden,
   in boolean aTyped
 );
</pre>
<h6 name="Parameters_4">Parameters</h6>
<dl><dt><code>aURI</code>
</dt><dd>The page to be added or changed.
</dd><dt><code>aTitle</code>
</dt><dd>The title as specified by the page.
</dd><dt><code>aVisitCount</code>
</dt><dd>The number of times this page has been visited. Setting this to </dd><code>"0"</code> may make the page invisible in some views.
<dt><code>aHidden</code>
</dt><dd>Whether the page is hidden or not. If the page has only </dd><code>TRANSITION_EMBED</code> visits, this will be <code>true</code>, otherwise it will be <code>false</code>.
<dt><code>aTyped</code>
</dt><dd><code>True</code> if this URI has ever been typed, otherwise <code>false</code>.
</dd></dl>
<h3 name="addVisit.28.29"> addVisit() </h3>
<p>This method adds a visit for a specific page. This will probably not be commonly used other than for backup/restore type operations. If the URI does not have an entry in the history database already, one will be created with no visits, no title, hidden, not typed. Adding a visit will automatically increment the visit count for the visited page and will unhide it and/or mark it typed according to the transition type.
</p>
<pre class="eval"> long long addVisit(
   in nsIURI aURI, 
   in PRTime aTime,
   in long long aReferringVisit, 
   in long aTransitionType,
   in boolean aIsRedirect, 
   in long long aSessionID
 );
</pre>
<h6 name="Parameters_5">Parameters</h6>
<dl><dt><code>aURI</code>
</dt><dd>The visited page.
</dd><dt><code>aTime</code>
</dt><dd>The time page was visited (microseconds).
</dd><dt><code>aReferringVisit</code>
</dt><dd>The ID of the visit that generated this one. Use </dd><code>"0"</code> for no referrer. This must be a valid visit already in the Database or <code>"0"</code>.
<dt><code>aTransitionType</code>
</dt><dd>The type of transition: one of </dd><code>TRANSITION_*</code> defined above.
<dt><code>aIsRedirect</code>
</dt><dd><code>True</code> if the given visit redirects to somewhere else (i.e you will create a visit out of here that is a redirect transition). This causes this page to be hidden in normal history views (unless it has been unhidden by visiting it with a non-redirect).
</dd><dt><code>aSessionID</code>
</dt><dd>The session ID that this page belongs to. Use </dd><code>"0"</code> for no session.
</dl>
<h6 name="Return_value_3">Return value</h6>
<p>Returns the ID of the created visit. This will be </p><code>"0"</code> if the URI is not valid for adding to history (<code>canAddURI = false</code>).

<h3 name="getNewQuery.28.29"> getNewQuery() </h3>
<p>This method returns a new query object that you can pass to </p><code>executeQuer{{ mediawiki.external('y/ies') }}</code> methods. It will be initialized to all empty (so using it will give you all history).

<pre class="eval"> nsINavHistoryQuery getNewQuery();
</pre>
<h6 name="Parameters_6">Parameters</h6>
<p>None.
</p>
<h6 name="Return_value_4">Return value</h6>
<p>Returns a new query object.
</p>
<h3 name="getNewQueryOptions.28.29"> getNewQueryOptions() </h3>
<p>This method returns a new options object that you can pass to </p><code>executeQuer{{ mediawiki.external('y/ies') }}</code> methods after setting the desired options.

<pre class="eval"> nsINavHistoryQueryOptions getNewQueryOptions();
</pre>
<h6 name="Parameters_7">Parameters</h6>
<p>None.
</p>
<h6 name="Return_value_5">Return value</h6>
<p>Returns a new options object.
</p>
<h3 name="executeQuery.28.29"> executeQuery() </h3>
<p>This method executes a query with a single query object and options. All the parameters set on the query object will be ANDed together.
</p>
<pre class="eval"> nsINavHistoryResult executeQuery(
   in nsINavHistoryQuery aQuery,
   in nsINavHistoryQueryOptions options
 );
</pre>
<h6 name="Parameters_8">Parameters</h6>
<dl><dt><code>aQuery</code>
</dt><dd>The query object.
</dd><dt><code>options</code>
</dt><dd>The options object.
</dd></dl>
<h6 name="Return_value_6">Return value</h6>
<p>Returns a new result object.
</p>
<h3 name="executeQueries.28.29"> executeQueries() </h3>
<p>This method is similar to </p><a href="#executeQuery.28.29">executeQuery</a> method. It executes an array of queries. All of the query objects are ORed together. Within a query, all the terms are ANDed together as in <a href="#executeQuery.28.29">executeQuery</a> method.

<pre class="eval"> nsINavHistoryResult executeQueries(
   [array,size_is(aQueryCount)] in nsINavHistoryQuery aQueries,
   in unsigned long aQueryCount,
   in nsINavHistoryQueryOptions options
 );
</pre>
<h6 name="Parameters_9">Parameters</h6>
<dl><dt><code>aQueries</code>
</dt><dd>The queries object.
</dd><dt><code>aQueryCount</code>
</dt><dd>The count of queries.
</dd><dt><code>options</code>
</dt><dd>The options object.
</dd></dl>
<h6 name="Return_value_7">Return value</h6>
<p>Returns a new result object.
</p>
<h3 name="queryStringToQueries.28.29"> queryStringToQueries() </h3>
<p>This method converts a query URI-like string to an array of actual query objects for use to </p><a href="#executeQueries.28.29">executeQueries</a> method. The output query array may be empty if there is no information. However, there will always be an options structure returned (if nothing is defined, it will just have the default values).

<pre class="eval"> void queryStringToQueries(
   in AUTF8String aQueryString,
   [array, size_is(aResultCount)] out nsINavHistoryQuery aQueries,
   out unsigned long aResultCount,
   out nsINavHistoryQueryOptions options
 );
</pre>
<h6 name="Parameters_10">Parameters</h6>
<dl><dt><code>aQueryString</code>
</dt><dd>The query URI-like string.
</dd><dt><code>aQueries</code>
</dt><dd>The queries object.
</dd><dt><code>aResultCount</code>
</dt><dd>The count of converted queries.
</dd><dt><code>options</code>
</dt><dd>The options object.
</dd></dl>
<h3 name="queriesToQueryString.28.29"> queriesToQueryString() </h3>
<p>This method converts a query into an equivalent string that can be persisted. Inverse of </p><a href="#queryStringToQueries.28.29">queryStringToQueries</a> method.

<pre class="eval"> AUTF8String queriesToQueryString(
   [array, size_is(aQueryCount)] in nsINavHistoryQuery aQueries,
   in unsigned long aQueryCount,
   in nsINavHistoryQueryOptions options
 );
</pre>
<h6 name="Parameters_11">Parameters</h6>
<dl><dt><code>aQueries</code>
</dt><dd>The queries object.
</dd><dt><code>aQueryCount</code>
</dt><dd>The count queries.
</dd><dt><code>options</code>
</dt><dd>The options object.
</dd></dl>
<h6 name="Return_value_8">Return value</h6>
<p>Returns the converted query into an equivalent string query.
</p>
<h3 name="addObserver.28.29"> addObserver() </h3>
<p>This method adds a history observer. If </p><code>ownsWeak</code> is <code>false</code>, the history service will keep an owning reference to the observer. If <code>ownsWeak</code> is <code>true</code>, then <code>aObserver</code> must implement {{ Interface("nsISupportsWeakReference") }}, and the history service will keep a weak reference to the observer.

<pre class="eval"> void addObserver(
   in nsINavHistoryObserver observer, 
   in boolean ownsWeak
 );
</pre>
<h6 name="Parameters_12">Parameters</h6>
<dl><dt><code>observer</code>
</dt><dd>The history observer to be added.
</dd><dt><code>ownsWeak</code>
</dt><dd>The owning reference state </dd><code>(boolean)</code>.
</dl>
<h3 name="removeObserver.28.29"> removeObserver() </h3>
<p>This method removes a history observer.
</p>
<pre class="eval"> void removeObserver(
   in nsINavHistoryObserver observer
 );
</pre>
<h6 name="Parameters_13">Parameters</h6>
<dl><dt><code>observer</code>
</dt><dd>The history observer to be removed.
</dd></dl>
<h3 name="runInBatchMode.28.29"> runInBatchMode() </h3>
<p>This method runs the passed callback in batch mode. Use this when a lot of things are about to change. Calls can be nested, observers will only be notified when all batches begin/end.
</p>
<pre class="eval"> void runInBatchMode(
   in nsINavHistoryBatchCallback aCallback,
   in nsISupports aClosure
 );
</pre>
<h6 name="Parameters_14">Parameters</h6>
<dl><dt><code>aCallback</code>
</dt><dd>{{ Interface("nsINavHistoryBatchCallback") }} interface to call.
</dd><dt><code>aClosure</code>
</dt><dd>Opaque parameter passed to {{ Interface("nsINavBookmarksBatchCallback") }}.
</dd></dl>
<h3 name="importHistory.28.29"> importHistory() </h3>
<p>This method imports the given Mork history file.
</p>
<pre class="eval"> void importHistory(
   in nsIFile file
 );
</pre>
<h6 name="Parameters_15">Parameters</h6>
<dl><dt><code>file</code>
</dt><dd>The Mork history file to import.
</dd></dl>
<h3 name="See_also">See also</h3>
<ul><a href="en/Places">Places</a>
<a href="en/Using_the_Places_history_service">Using the Places history service</a>
<a href="en/Querying_Places">Querying Places</a>
<a href="en/NsINavHistoryBatchCallback">nsINavHistoryBatchCallback</a>
<a href="en/NsINavHistoryContainerResultNode">nsINavHistoryContainerResultNode</a>
<a href="en/NsINavHistoryFullVisitResultNode">nsINavHistoryFullVisitResultNode</a>
<a href="en/NsINavHistoryObserver">nsINavHistoryObserver</a>
<a href="en/NsINavHistoryQuery">nsINavHistoryQuery</a>
<a href="en/NsINavHistoryQueryOptions">nsINavHistoryQueryOptions</a>
<a href="en/NsINavHistoryQueryResultNode">nsINavHistoryQueryResultNode</a>
<a href="en/NsINavHistoryResult">nsINavHistoryResult</a>
<a href="en/NsINavHistoryResultNode">nsINavHistoryResultNode</a>
<a href="en/NsINavHistoryResultTreeViewer">nsINavHistoryResultTreeViewer</a>
<a href="en/NsINavHistoryResultViewObserver">nsINavHistoryResultViewObserver</a>
<a href="en/NsINavHistoryResultViewer">nsINavHistoryResultViewer</a>
<a href="en/NsINavHistoryVisitResultNode">nsINavHistoryVisitResultNode</a>
</ul>
Revert to this revision