toolkit/components/places/nsIFaviconService.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;
    10 [scriptable, uuid(e81e0b0c-b9f1-4c2e-8f3c-b809933cf73c)]
    11 interface nsIFaviconService : nsISupports
    12 {
    13   // The favicon is being loaded from a private browsing window
    14   const unsigned long FAVICON_LOAD_PRIVATE = 1;
    15   // The favicon is being loaded from a non-private browsing window
    16   const unsigned long FAVICON_LOAD_NON_PRIVATE = 2;
    18   /**
    19    * For a given icon URI, this will return a URI that will result in the image.
    20    * In most cases, this is an annotation URI.  For chrome URIs, this will do
    21    * nothing but returning the input URI.
    22    *
    23    * No validity checking is done. If you pass an icon URI that we've never
    24    * seen, you'll get back a URI that references an invalid icon. The moz-anno
    25    * protocol handler's special case for "favicon" annotations will resolve
    26    * invalid icons to the default icon, although without caching.
    27    * For invalid chrome URIs, you'll get a broken image.
    28    *
    29    * @param aFaviconURI
    30    *        The URI of an icon in the favicon service.
    31    * @return A URI that will give you the icon image.  This is NOT the URI of
    32    *         the icon as set on the page, but a URI that will give you the
    33    *         data out of the favicon service.  For a normal page with a
    34    *         favicon we've stored, this will be an annotation URI which will
    35    *         then cause the corresponding favicon data to be loaded async from
    36    *         this service.  For pages where we don't have a favicon, this will
    37    *         be a chrome URI of the default icon. For chrome URIs, the
    38    *         output will be the same as the input.
    39    */
    40   nsIURI getFaviconLinkForIcon(in nsIURI aFaviconURI);
    42   /**
    43    * Expire all known favicons from the database.
    44    *
    45    * @note This is an async method.
    46    *       On successful completion a "places-favicons-expired" notification is
    47    *       dispatched through observer's service.
    48    */
    49   void expireAllFavicons();
    51   /**
    52    * Adds a given favicon's URI to the failed favicon cache.
    53    *
    54    * The lifespan of the favicon cache is up to the caching system.  This cache
    55    * will also be written when setAndLoadFaviconForPage hits an error while
    56    * fetching an icon.
    57    *
    58    * @param aFaviconURI
    59    *        The URI of an icon in the favicon service.
    60    */
    61   void addFailedFavicon(in nsIURI aFaviconURI);
    63   /**
    64    * Removes the given favicon from the failed favicon cache.  If the icon is
    65    * not in the cache, it will silently succeed.
    66    *
    67    * @param aFaviconURI
    68    *        The URI of an icon in the favicon service.
    69    */
    70   void removeFailedFavicon(in nsIURI aFaviconURI);
    72   /**
    73    * Checks to see if a favicon is in the failed favicon cache.
    74    * A positive return value means the icon is in the failed cache and you
    75    * probably shouldn't try to load it.  A false return value means that it's
    76    * worth trying to load it.
    77    * This allows you to avoid trying to load "foo.com/favicon.ico" for every
    78    * page on a site that doesn't have a favicon.
    79    *
    80    * @param aFaviconURI
    81    *        The URI of an icon in the favicon service.
    82    */
    83   boolean isFailedFavicon(in nsIURI aFaviconURI);
    85   /**
    86    * The default favicon URI
    87    */
    88   readonly attribute nsIURI defaultFavicon;
    89 };
    91 [scriptable, function, uuid(c85e5c82-b70f-4621-9528-beb2aa47fb44)]
    92 interface nsIFaviconDataCallback : nsISupports
    93 {
    94   /**
    95    * Called when the required favicon's information is available.
    96    *
    97    * It's up to the invoking method to state if the callback is always invoked,
    98    * or called on success only.  Check the method documentation to ensure that.
    99    *
   100    * The caller will receive the most information we can gather on the icon,
   101    * but it's not guaranteed that all of them will be set.  For some method
   102    * we could not know the favicon's data (it could just be too expensive to
   103    * get it, or the method does not require we actually have any data).
   104    * It's up to the caller to check aDataLen > 0 before using any data-related
   105    * information like mime-type or data itself.
   106    *
   107    * @param aFaviconURI
   108    *        Receives the "favicon URI" (not the "favicon link URI") associated
   109    *        to the requested page.  This can be null if there is no associated
   110    *        favicon URI, or the callback is notifying a failure.
   111    * @param aDataLen
   112    *        Size of the icon data in bytes.  Notice that a value of 0 does not
   113    *        necessarily mean that we don't have an icon.
   114    * @param aData
   115    *        Icon data, or an empty array if aDataLen is 0.
   116    * @param aMimeType
   117    *        Mime type of the icon, or an empty string if aDataLen is 0.
   118    *
   119    * @note If you want to open a network channel to access the favicon, it's
   120    *       recommended that you call the getFaviconLinkForIcon method to convert
   121    *       the "favicon URI" into a "favicon link URI".
   122    */
   123   void onComplete(in nsIURI aFaviconURI,
   124                   in unsigned long aDataLen,
   125                   [const,array,size_is(aDataLen)] in octet aData,
   126                   in AUTF8String aMimeType);
   127 };
   129 %{C++
   131 /**
   132  * Notification sent when all favicons are expired.
   133  */
   134 #define NS_PLACES_FAVICONS_EXPIRED_TOPIC_ID "places-favicons-expired"
   136 #define FAVICON_DEFAULT_URL "chrome://mozapps/skin/places/defaultFavicon.png"
   137 #define FAVICON_ERRORPAGE_URL "chrome://global/skin/icons/warning-16.png"
   139 %}

mercurial