image/imgILoader.idl
author Andrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 19 Apr 2018 16:12:26 -0400
changeset 416926 9a2ba1c7b0ec32f81e067acd2610e47b9be7d764
parent 242676 ef516c84ef5496c3a8576e85c3e6ecb7b0776104
child 484681 0c3bcd3598fffa21e9cb612a1b9d267db2d4e03e
permissions -rw-r--r--
Bug 1451159 - [testing/profiles] Store profile data in actual profile look alike folders r=gbrown This moves testing/profiles/prefs_general.js to testing/profiles/common/user.js. It also adds an 'extensions' folder to the common profile. Dropping extension files here will get them installed in all test harnesses (useful for testing on try). The idea is that all test harnesses will eventually use this 'common' profile. We'll also create some new per harness profiles, e.g testing/profiles/mochitest and testing/profiles/reftest. This way there will be a single location developers can go to set preferences, both for a specific harness, and across all harnesses. MozReview-Commit-ID: 8sqBqLiypgU

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface imgINotificationObserver;
interface imgIRequest;

interface nsIChannel;
interface nsILoadGroup;
interface nsIPrincipal;
interface nsIStreamListener;
interface nsIURI;

interface nsISimpleEnumerator;

#include "nsIRequest.idl" // for nsLoadFlags
#include "nsIContentPolicy.idl" // for nsContentPolicyType

/**
 * imgILoader interface
 *
 * @author Stuart Parmenter <pavlov@netscape.com>
 * @version 0.3
 * @see imagelib2
 */
[scriptable, builtinclass, uuid(e61377d2-910e-4c65-a64b-428d150e1fd1)]
interface imgILoader : nsISupports
{
  // Extra flags to pass to loadImage if you want a load to use CORS
  // validation.
  const unsigned long LOAD_CORS_ANONYMOUS = 1 << 16;
  const unsigned long LOAD_CORS_USE_CREDENTIALS = 1 << 17;

  /**
   * Start the load and decode of an image.
   * @param aURI the URI to load
   * @param aInitialDocumentURI the URI that 'initiated' the load -- used for
   *           3rd party cookie blocking
   * @param aReferrerURI the 'referring' URI
   * @param aReferrerPolicy the policy to apply to sending referrers.
   *           examples: "default", "never", "always", "origin"
   *           (see W3C referrer-policy spec for valid policy strings)
   * @param aLoadingPrincipal the principal of the loading document
   * @param aLoadGroup Loadgroup to put the image load into
   * @param aObserver the observer (may be null)
   * @param aCX some random data
   * @param aLoadFlags Load flags for the request
   * @param aCacheKey cache key to use for a load if the original
   *                  image came from a request that had post data
   * @param aContentPolicyType [optional] the nsContentPolicyType to
   *                           use for this load. Defaults to
   *                           nsIContentPolicy::TYPE_IMAGE


   * ImageLib does NOT keep a strong ref to the observer; this prevents
   * reference cycles.  This means that callers of loadImage should
   * make sure to Cancel() the resulting request before the observer
   * goes away.
   */
  imgIRequest loadImageXPCOM(in nsIURI aURI,
                             in nsIURI aInitialDocumentURL,
                             in nsIURI aReferrerURI,
                             in AString aReferrerPolicy,
                             in nsIPrincipal aLoadingPrincipal,
                             in nsILoadGroup aLoadGroup,
                             in imgINotificationObserver aObserver,
                             in nsISupports aCX,
                             in nsLoadFlags aLoadFlags,
                             in nsISupports cacheKey,
                             [optional]
                             in nsContentPolicyType aContentPolicyType);

  /**
   * Start the load and decode of an image.
   * @param aChannel the channel to load the image from.  This must
   *                 already be opened before ths method is called, and there
   *                 must have been no OnDataAvailable calls for it yet.
   * @param aObserver the observer (may be null)
   * @param cx some random data
   * @param aListener [out]
   *        A listener that you must send the channel's notifications and data
   *        to.  Can be null, in which case imagelib has found a cached image
   *        and is not interested in the data. @aChannel will be canceled for
   *        you in this case.
   *
   * ImageLib does NOT keep a strong ref to the observer; this prevents
   * reference cycles.  This means that callers of loadImageWithChannel should
   * make sure to Cancel() the resulting request before the observer goes away.
   */
  imgIRequest loadImageWithChannelXPCOM(in nsIChannel aChannel,
                                        in imgINotificationObserver aObserver,
                                        in nsISupports cx,
                                        out nsIStreamListener aListener);
};