Bug 1490079 [wpt PR 12936] - Mark tools/wpt Windows test failures as xfail, a=testonly
[gecko.git] / image / imgILoader.idl
blob36505da9d21f75a71f978feee91744c8013842d0
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
9 interface imgINotificationObserver;
10 interface imgIRequest;
12 interface nsIChannel;
13 interface nsILoadGroup;
14 interface nsIPrincipal;
15 interface nsIStreamListener;
16 interface nsIURI;
18 interface nsISimpleEnumerator;
20 #include "nsIRequest.idl" // for nsLoadFlags
21 #include "nsIContentPolicy.idl" // for nsContentPolicyType
23 /**
24 * imgILoader interface
26 * @author Stuart Parmenter <pavlov@netscape.com>
27 * @version 0.3
28 * @see imagelib2
30 [scriptable, builtinclass, uuid(e61377d2-910e-4c65-a64b-428d150e1fd1)]
31 interface imgILoader : nsISupports
33 // Extra flags to pass to loadImage if you want a load to use CORS
34 // validation.
35 const unsigned long LOAD_CORS_ANONYMOUS = 1 << 16;
36 const unsigned long LOAD_CORS_USE_CREDENTIALS = 1 << 17;
38 /**
39 * Start the load and decode of an image.
40 * @param aURI the URI to load
41 * @param aInitialDocumentURI the URI that 'initiated' the load -- used for
42 * 3rd party cookie blocking
43 * @param aReferrerURI the 'referring' URI
44 * @param aReferrerPolicy the policy to apply to sending referrers.
45 * examples: "default", "never", "always", "origin"
46 * (see W3C referrer-policy spec for valid policy strings)
47 * @param aLoadingPrincipal the principal of the loading document
48 * @param aLoadGroup Loadgroup to put the image load into
49 * @param aObserver the observer (may be null)
50 * @param aCX some random data
51 * @param aLoadFlags Load flags for the request
52 * @param aCacheKey cache key to use for a load if the original
53 * image came from a request that had post data
54 * @param aContentPolicyType [optional] the nsContentPolicyType to
55 * use for this load. Defaults to
56 * nsIContentPolicy::TYPE_IMAGE
59 * ImageLib does NOT keep a strong ref to the observer; this prevents
60 * reference cycles. This means that callers of loadImage should
61 * make sure to Cancel() the resulting request before the observer
62 * goes away.
64 imgIRequest loadImageXPCOM(in nsIURI aURI,
65 in nsIURI aInitialDocumentURL,
66 in nsIURI aReferrerURI,
67 in AString aReferrerPolicy,
68 in nsIPrincipal aLoadingPrincipal,
69 in nsILoadGroup aLoadGroup,
70 in imgINotificationObserver aObserver,
71 in nsISupports aCX,
72 in nsLoadFlags aLoadFlags,
73 in nsISupports cacheKey,
74 [optional]
75 in nsContentPolicyType aContentPolicyType);
77 /**
78 * Start the load and decode of an image.
79 * @param aChannel the channel to load the image from. This must
80 * already be opened before ths method is called, and there
81 * must have been no OnDataAvailable calls for it yet.
82 * @param aObserver the observer (may be null)
83 * @param cx some random data
84 * @param aListener [out]
85 * A listener that you must send the channel's notifications and data
86 * to. Can be null, in which case imagelib has found a cached image
87 * and is not interested in the data. @aChannel will be canceled for
88 * you in this case.
90 * ImageLib does NOT keep a strong ref to the observer; this prevents
91 * reference cycles. This means that callers of loadImageWithChannel should
92 * make sure to Cancel() the resulting request before the observer goes away.
94 imgIRequest loadImageWithChannelXPCOM(in nsIChannel aChannel,
95 in imgINotificationObserver aObserver,
96 in nsISupports cx,
97 out nsIStreamListener aListener);