toolkit/components/places/mozIAsyncFavicons.idl

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "nsISupports.idl"
     8 interface nsIURI;
     9 interface nsIFaviconDataCallback;
    11 [scriptable, uuid(8849feef-0ead-4e9b-b63b-8d862c42a736)]
    12 interface mozIAsyncFavicons : nsISupports
    13 {
    14   /**
    15    * Declares that a given page uses a favicon with the given URI and 
    16    * attempts to fetch and save the icon data by loading the favicon URI
    17    * through an async network request.
    18    *
    19    * If the icon data already exists, we won't try to reload the icon unless
    20    * aForceReload is true.  Similarly, if the icon is in the failed favicon
    21    * cache we won't do anything unless aForceReload is true, in which case
    22    * we'll try to reload the favicon.
    23    *
    24    * This function will only save favicons for pages that are already stored in
    25    * the database, like visited pages or bookmarks.  For any other URIs, it
    26    * will succeed but do nothing.  This function will also ignore the error
    27    * page favicon URI (see FAVICON_ERRORPAGE_URL below).
    28    *
    29    * Icons that fail to load will automatically be added to the failed favicon
    30    * cache, and this function will not save favicons for non-bookmarked URIs
    31    * when history is disabled.
    32    *
    33    * @note This function is identical to
    34    *       nsIFaviconService::setAndLoadFaviconForPage.
    35    *
    36    * @param aPageURI
    37    *        URI of the page whose favicon is being set.
    38    * @param aFaviconURI
    39    *        URI of the favicon to associate with the page.
    40    * @param aForceReload
    41    *        If aForceReload is false, we try to reload the favicon only if we
    42    *        don't have it or it has expired from the cache.  Setting
    43    *        aForceReload to true causes us to reload the favicon even if we
    44    *        have a usable copy.
    45    * @param aFaviconLoadType
    46    *        Set to FAVICON_LOAD_PRIVATE if the favicon is loaded from a private
    47    *        browsing window.  Set to FAVICON_LOAD_NON_PRIVATE otherwise.
    48    * @param aCallback
    49    *        Once we're done setting and/or fetching the favicon, we invoke this
    50    *        callback.
    51    *
    52    * @see nsIFaviconDataCallback in nsIFaviconService.idl.
    53    */
    54   void setAndFetchFaviconForPage(in nsIURI aPageURI,
    55                                  in nsIURI aFaviconURI,
    56                                  in boolean aForceReload,
    57                                  in unsigned long aFaviconLoadType,
    58                                  [optional] in nsIFaviconDataCallback aCallback);
    60   /**
    61    * Sets the data for a given favicon URI either by replacing existing data in
    62    * the database or taking the place of otherwise fetched icon data when
    63    * calling setAndFetchFaviconForPage later.
    64    *
    65    * Favicon data for favicon URIs that are not associated with a page URI via
    66    * setAndFetchFaviconForPage will be stored in memory, but may be expired at
    67    * any time, so you should make an effort to associate favicon URIs with page
    68    * URIs as soon as possible.
    69    *
    70    * It's better to not use this function for chrome: icon URIs since you can
    71    * reference the chrome image yourself. getFaviconLinkForIcon/Page will ignore
    72    * any associated data if the favicon URI is "chrome:" and just return the
    73    * same chrome URI.
    74    *
    75    * This function does NOT send out notifications that the data has changed.
    76    * Pages using this favicons that are visible in history or bookmarks views
    77    * will keep the old icon until they have been refreshed by other means.
    78    *
    79    * This function tries to optimize the favicon size, if it is bigger
    80    * than a defined limit we will try to convert it to a 16x16 png image.
    81    * If the conversion fails and favicon is still bigger than our max accepted
    82    * size it won't be saved.
    83    *
    84    * @param aFaviconURI
    85    *        URI of the favicon whose data is being set.
    86    * @param aData
    87    *        Binary contents of the favicon to save
    88    * @param aDataLength
    89    *        Length of binary data
    90    * @param aMimeType
    91    *        MIME type of the data to store.  This is important so that we know
    92    *        what to report when the favicon is used.  You should always set this
    93    *        param unless you are clearing an icon.
    94    * @param aExpiration
    95    *        Time in microseconds since the epoch when this favicon expires.
    96    *        Until this time, we won't try to load it again.
    97    * @throws NS_ERROR_FAILURE
    98    *         Thrown if the favicon is overbloated and won't be saved to the db.
    99    */
   100   void replaceFaviconData(in nsIURI aFaviconURI,
   101                           [const,array,size_is(aDataLen)] in octet aData,
   102                           in unsigned long aDataLen,
   103                           in AUTF8String aMimeType,
   104                           [optional] in PRTime aExpiration);
   106   /**
   107    * Same as replaceFaviconData but the data is provided by a string
   108    * containing a data URL.
   109    *
   110    * @see replaceFaviconData
   111    *
   112    * @param aFaviconURI
   113    *        URI of the favicon whose data is being set.
   114    * @param aDataURL
   115    *        string containing a data URL that represents the contents of
   116    *        the favicon to save
   117    * @param aExpiration
   118    *        Time in microseconds since the epoch when this favicon expires.
   119    *        Until this time, we won't try to load it again.
   120    * @throws NS_ERROR_FAILURE
   121    *         Thrown if the favicon is overbloated and won't be saved to the db.
   122    */
   123   void replaceFaviconDataFromDataURL(in nsIURI aFaviconURI,
   124                                      in AString aDataURL,
   125                                      [optional] in PRTime aExpiration);
   127   /**
   128    * Retrieves the favicon URI associated to the given page, if any.
   129    *
   130    * @param aPageURI
   131    *        URI of the page whose favicon URI we're looking up.
   132    * @param aCallback
   133    *        This callback is always invoked to notify the result of the lookup.
   134    *        The aURI parameter will be the favicon URI, or null when no favicon
   135    *        is associated with the page or an error occurred while fetching it.
   136    *
   137    * @note When the callback is invoked, aDataLen will be always 0, aData will
   138    *       be an empty array, and aMimeType will be an empty string, regardless
   139    *       of whether a favicon is associated with the page.
   140    *
   141    * @see nsIFaviconDataCallback in nsIFaviconService.idl.
   142    */
   143   void getFaviconURLForPage(in nsIURI aPageURI,
   144                             in nsIFaviconDataCallback aCallback);
   146   /**
   147    * Retrieves the favicon URI and data associated to the given page, if any.
   148    *
   149    * @param aPageURI
   150    *        URI of the page whose favicon URI and data we're looking up.
   151    * @param aCallback
   152    *        This callback is always invoked to notify the result of the lookup.  The aURI
   153    *        parameter will be the favicon URI, or null when no favicon is
   154    *        associated with the page or an error occurred while fetching it.  If
   155    *        aURI is not null, the other parameters may contain the favicon data.
   156    *        However, if no favicon data is currently associated with the favicon
   157    *        URI, aDataLen will be 0, aData will be an empty array, and aMimeType
   158    *        will be an empty string.
   159    *
   160    * @see nsIFaviconDataCallback in nsIFaviconService.idl.
   161    */
   162   void getFaviconDataForPage(in nsIURI aPageURI,
   163                              in nsIFaviconDataCallback aCallback);
   164 };

mercurial