Backed out changeset 4b2c67fe7e6b (relanding bug 449168)
[wine-gecko.git] / netwerk / cookie / public / nsICookieService.idl
blob887e017cb50d1d575a6bd8dc48e2d92fcd716c0a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include "nsISupports.idl"
40 interface nsIURI;
41 interface nsIPrompt;
42 interface nsIChannel;
44 /**
45 * nsICookieService
47 * Provides methods for setting and getting cookies in the context of a
48 * page load. See nsICookieManager for methods to manipulate the cookie
49 * database directly. This separation of interface is mainly historical.
51 * This service broadcasts the following notifications when the cookie
52 * list is changed, or a cookie is rejected:
54 * topic : "cookie-changed"
55 * broadcast whenever the cookie list changes in some way. there
56 * are four possible data strings for this notification; one
57 * notification will be broadcast for each change, and will involve
58 * a single cookie.
59 * subject: an nsICookie2 interface pointer representing the cookie object
60 * that changed.
61 * data : "deleted"
62 * a cookie was deleted. the subject is the deleted cookie.
63 * "added"
64 * a cookie was added. the subject is the added cookie.
65 * "changed"
66 * a cookie was changed. the subject is the new cookie.
67 * "cleared"
68 * the entire cookie list was cleared. the subject is null.
70 * topic : "cookie-rejected"
71 * broadcast whenever a cookie was rejected from being set as a
72 * result of user prefs.
73 * subject: an nsIURI interface pointer representing the URI that attempted
74 * to set the cookie.
75 * data : none.
77 [scriptable, uuid(2aaa897a-293c-4d2b-a657-8c9b7136996d)]
78 interface nsICookieService : nsISupports
81 * Get the complete cookie string associated with the URI.
83 * @param aURI
84 * the URI of the document for which cookies are being queried.
85 * @param aChannel
86 * the channel used to load the document. this parameter may be null,
87 * but it is strongly recommended that a non-null value be provided to
88 * ensure that the cookie privacy preferences are honored.
90 * @return the resulting cookie string
92 string getCookieString(in nsIURI aURI, in nsIChannel aChannel);
95 * Get the complete cookie string associated with the URI.
97 * This function is NOT redundant with getCookieString, as the result
98 * will be different based on httponly (see bug 178993)
100 * @param aURI
101 * the URI of the document for which cookies are being queried.
102 * @param aFirstURI
103 * the URI that the user originally typed in or clicked on to initiate
104 * the load of the document referenced by aURI.
105 * @param aChannel
106 * the channel used to load the document. this parameter may be null,
107 * but it is strongly recommended that a non-null value be provided to
108 * ensure that the cookie privacy preferences are honored.
110 * @return the resulting cookie string
112 string getCookieStringFromHttp(in nsIURI aURI, in nsIURI aFirstURI, in nsIChannel aChannel);
115 * Set the cookie string associated with the URI.
117 * @param aURI
118 * the URI of the document for which cookies are being set.
119 * @param aPrompt
120 * the prompt to use for all user-level cookie notifications.
121 * @param aCookie
122 * the cookie string to set.
123 * @param aChannel
124 * the channel used to load the document. this parameter may be null,
125 * but it is strongly recommended that a non-null value be provided to
126 * ensure that the cookie privacy preferences are honored.
128 * XXX should be able to allow null aPrompt, since nsIPrompt can be queryied
129 * from aChannel.
131 void setCookieString(in nsIURI aURI, in nsIPrompt aPrompt, in string aCookie, in nsIChannel aChannel);
134 * Set the cookie string and expires associated with the URI.
136 * This function is NOT redundant with setCookieString, as the result
137 * will be different based on httponly (see bug 178993)
139 * @param aURI
140 * the URI of the document for which cookies are being set.
141 * @param aFirstURI
142 * the URI that the user originally typed in or clicked on to initiate
143 * the load of the document referenced by aURI.
144 * @param aPrompt
145 * the prompt to use for all user-level cookie notifications.
146 * @param aCookie
147 * the cookie string to set.
148 * @param aServerTime
149 * the expiry information of the cookie (the Date header from the HTTP
150 * response).
151 * @param aChannel
152 * the channel used to load the document. this parameter may be null,
153 * but it is strongly recommended that a non-null value be provided to
154 * ensure that the cookie privacy preferences are honored.
156 void setCookieStringFromHttp(in nsIURI aURI, in nsIURI aFirstURI, in nsIPrompt aPrompt, in string aCookie, in string aServerTime, in nsIChannel aChannel);