Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIFile; |
michael@0 | 9 | interface nsILoginInfo; |
michael@0 | 10 | interface nsIPropertyBag; |
michael@0 | 11 | |
michael@0 | 12 | [scriptable, uuid(fe0a4e80-d36f-43cc-a37b-4e1906e77257)] |
michael@0 | 13 | |
michael@0 | 14 | /* |
michael@0 | 15 | * NOTE: This interface is intended to be implemented by modules |
michael@0 | 16 | * providing storage mechanisms for the login manager. |
michael@0 | 17 | * Other code should use the login manager's interfaces |
michael@0 | 18 | * (nsILoginManager), and should not call storage modules |
michael@0 | 19 | * directly. |
michael@0 | 20 | */ |
michael@0 | 21 | interface nsILoginManagerStorage : nsISupports { |
michael@0 | 22 | /** |
michael@0 | 23 | * Initialize the component. Not invoked automatically. |
michael@0 | 24 | */ |
michael@0 | 25 | void init(); |
michael@0 | 26 | |
michael@0 | 27 | |
michael@0 | 28 | /** |
michael@0 | 29 | * Initialize the component, but override the default filename |
michael@0 | 30 | * locations. This is primarily used to the unit tests and profile |
michael@0 | 31 | * migration. |
michael@0 | 32 | * |
michael@0 | 33 | * @param aFile |
michael@0 | 34 | * If non-null, file to use for login storage. |
michael@0 | 35 | * |
michael@0 | 36 | */ |
michael@0 | 37 | void initWithFile(in nsIFile aFile); |
michael@0 | 38 | |
michael@0 | 39 | |
michael@0 | 40 | /** |
michael@0 | 41 | * Store a new login in the storage module. |
michael@0 | 42 | * |
michael@0 | 43 | * @param aLogin |
michael@0 | 44 | * The login to be added. |
michael@0 | 45 | * |
michael@0 | 46 | * Default values for the login's nsILoginMetaInfo properties will be |
michael@0 | 47 | * created. However, if the caller specifies non-default values, they will |
michael@0 | 48 | * be used instead. |
michael@0 | 49 | */ |
michael@0 | 50 | void addLogin(in nsILoginInfo aLogin); |
michael@0 | 51 | |
michael@0 | 52 | |
michael@0 | 53 | /** |
michael@0 | 54 | * Remove a login from the storage module. |
michael@0 | 55 | * |
michael@0 | 56 | * @param aLogin |
michael@0 | 57 | * The login to be removed. |
michael@0 | 58 | * |
michael@0 | 59 | * The specified login must exactly match a stored login. However, the |
michael@0 | 60 | * values of any nsILoginMetaInfo properties are ignored. |
michael@0 | 61 | */ |
michael@0 | 62 | void removeLogin(in nsILoginInfo aLogin); |
michael@0 | 63 | |
michael@0 | 64 | |
michael@0 | 65 | /** |
michael@0 | 66 | * Modify an existing login in the storage module. |
michael@0 | 67 | * |
michael@0 | 68 | * @param oldLogin |
michael@0 | 69 | * The login to be modified. |
michael@0 | 70 | * @param newLoginData |
michael@0 | 71 | * The new login values (either a nsILoginInfo or nsIProperyBag) |
michael@0 | 72 | * |
michael@0 | 73 | * If newLoginData is a nsILoginInfo, all of the old login's nsILoginInfo |
michael@0 | 74 | * properties are changed to the values from newLoginData (but the old |
michael@0 | 75 | * login's nsILoginMetaInfo properties are unmodified). |
michael@0 | 76 | * |
michael@0 | 77 | * If newLoginData is a nsIPropertyBag, only the specified properties |
michael@0 | 78 | * will be changed. The nsILoginMetaInfo properties of oldLogin can be |
michael@0 | 79 | * changed in this manner. |
michael@0 | 80 | * |
michael@0 | 81 | * If the propertybag contains an item named "timesUsedIncrement", the |
michael@0 | 82 | * login's timesUsed property will be incremented by the item's value. |
michael@0 | 83 | */ |
michael@0 | 84 | void modifyLogin(in nsILoginInfo oldLogin, in nsISupports newLoginData); |
michael@0 | 85 | |
michael@0 | 86 | |
michael@0 | 87 | /** |
michael@0 | 88 | * Remove all stored logins. |
michael@0 | 89 | * |
michael@0 | 90 | * The browser sanitization feature allows the user to clear any stored |
michael@0 | 91 | * passwords. This interface allows that to be done without getting each |
michael@0 | 92 | * login first (which might require knowing the master password). |
michael@0 | 93 | * |
michael@0 | 94 | */ |
michael@0 | 95 | void removeAllLogins(); |
michael@0 | 96 | |
michael@0 | 97 | |
michael@0 | 98 | /** |
michael@0 | 99 | * Fetch all logins in the login manager. An array is always returned; |
michael@0 | 100 | * if there are no logins the array is empty. |
michael@0 | 101 | * |
michael@0 | 102 | * @param count |
michael@0 | 103 | * The number of elements in the array. JS callers can simply use |
michael@0 | 104 | * the array's .length property and omit this param. |
michael@0 | 105 | * @param logins |
michael@0 | 106 | * An array of nsILoginInfo objects. |
michael@0 | 107 | * |
michael@0 | 108 | * NOTE: This can be called from JS as: |
michael@0 | 109 | * var logins = pwmgr.getAllLogins(); |
michael@0 | 110 | * (|logins| is an array). |
michael@0 | 111 | */ |
michael@0 | 112 | void getAllLogins([optional] out unsigned long count, |
michael@0 | 113 | [retval, array, size_is(count)] out nsILoginInfo logins); |
michael@0 | 114 | |
michael@0 | 115 | |
michael@0 | 116 | /** |
michael@0 | 117 | * Fetch all logins in the login manager. An array is always returned; |
michael@0 | 118 | * if there are no logins the array is empty. This does not decrypt logins |
michael@0 | 119 | * before returning the array |
michael@0 | 120 | * |
michael@0 | 121 | * @param count |
michael@0 | 122 | * The number of elements in the array. JS callers can simply use |
michael@0 | 123 | * the array's .length property and omit this param. |
michael@0 | 124 | * @param logins |
michael@0 | 125 | * An array of nsILoginInfo objects. |
michael@0 | 126 | * |
michael@0 | 127 | * NOTE: This can be called from JS as: |
michael@0 | 128 | * var logins = pwmgr.getAllEncryptedLogins(); |
michael@0 | 129 | * (|logins| is an array). |
michael@0 | 130 | */ |
michael@0 | 131 | void getAllEncryptedLogins([optional] out unsigned long count, |
michael@0 | 132 | [retval, array, size_is(count)] out nsILoginInfo logins); |
michael@0 | 133 | |
michael@0 | 134 | |
michael@0 | 135 | /** |
michael@0 | 136 | * Search for logins in the login manager. An array is always returned; |
michael@0 | 137 | * if there are no logins the array is empty. |
michael@0 | 138 | * |
michael@0 | 139 | * @param count |
michael@0 | 140 | * The number of elements in the array. JS callers can simply use |
michael@0 | 141 | * the array's .length property, and supply an dummy object for |
michael@0 | 142 | * this out param. For example: |searchLogins({}, matchData)| |
michael@0 | 143 | * @param matchData |
michael@0 | 144 | * The data used to search. This does not follow the same |
michael@0 | 145 | * requirements as findLogins for those fields. Wildcard matches are |
michael@0 | 146 | * simply not specified. |
michael@0 | 147 | * @param logins |
michael@0 | 148 | * An array of nsILoginInfo objects. |
michael@0 | 149 | * |
michael@0 | 150 | * NOTE: This can be called from JS as: |
michael@0 | 151 | * var logins = pwmgr.searchLogins({}, matchData); |
michael@0 | 152 | * (|logins| is an array). |
michael@0 | 153 | */ |
michael@0 | 154 | void searchLogins(out unsigned long count, in nsIPropertyBag matchData, |
michael@0 | 155 | [retval, array, size_is(count)] out nsILoginInfo logins); |
michael@0 | 156 | |
michael@0 | 157 | |
michael@0 | 158 | /** |
michael@0 | 159 | * Obtain a list of all hosts for which password saving is disabled. |
michael@0 | 160 | * |
michael@0 | 161 | * @param count |
michael@0 | 162 | * The number of elements in the array. JS callers can simply use |
michael@0 | 163 | * the array's .length property and omit this param. |
michael@0 | 164 | * @param hostnames |
michael@0 | 165 | * An array of hostname strings, in origin URL format without a |
michael@0 | 166 | * pathname. For example: "https://www.site.com". |
michael@0 | 167 | * |
michael@0 | 168 | * NOTE: This can be called from JS as: |
michael@0 | 169 | * var logins = pwmgr.getAllDisabledHosts(); |
michael@0 | 170 | */ |
michael@0 | 171 | void getAllDisabledHosts([optional] out unsigned long count, |
michael@0 | 172 | [retval, array, size_is(count)] out wstring hostnames); |
michael@0 | 173 | |
michael@0 | 174 | |
michael@0 | 175 | /** |
michael@0 | 176 | * Check to see if saving logins has been disabled for a host. |
michael@0 | 177 | * |
michael@0 | 178 | * @param aHost |
michael@0 | 179 | * The hostname to check. This argument should be in the origin |
michael@0 | 180 | * URL format, without a pathname. For example: "http://foo.com". |
michael@0 | 181 | */ |
michael@0 | 182 | boolean getLoginSavingEnabled(in AString aHost); |
michael@0 | 183 | |
michael@0 | 184 | |
michael@0 | 185 | /** |
michael@0 | 186 | * Disable (or enable) storing logins for the specified host. When |
michael@0 | 187 | * disabled, the login manager will not prompt to store logins for |
michael@0 | 188 | * that host. Existing logins are not affected. |
michael@0 | 189 | * |
michael@0 | 190 | * @param aHost |
michael@0 | 191 | * The hostname to set. This argument should be in the origin |
michael@0 | 192 | * URL format, without a pathname. For example: "http://foo.com". |
michael@0 | 193 | * @param isEnabled |
michael@0 | 194 | * Specify if saving logins should be enabled (true) or |
michael@0 | 195 | * disabled (false) |
michael@0 | 196 | */ |
michael@0 | 197 | void setLoginSavingEnabled(in AString aHost, in boolean isEnabled); |
michael@0 | 198 | |
michael@0 | 199 | |
michael@0 | 200 | /** |
michael@0 | 201 | * Search for logins matching the specified criteria. Called when looking |
michael@0 | 202 | * for logins that might be applicable to a form or authentication request. |
michael@0 | 203 | * |
michael@0 | 204 | * @param count |
michael@0 | 205 | * The number of elements in the array. JS callers can simply use |
michael@0 | 206 | * the array's .length property, and supply an dummy object for |
michael@0 | 207 | * this out param. For example: |findLogins({}, hostname, ...)| |
michael@0 | 208 | * @param aHostname |
michael@0 | 209 | * The hostname to restrict searches to, in URL format. For |
michael@0 | 210 | * example: "http://www.site.com". |
michael@0 | 211 | * @param aActionURL |
michael@0 | 212 | * For form logins, this argument should be the URL to which the |
michael@0 | 213 | * form will be submitted. For protocol logins, specify null. |
michael@0 | 214 | * @param aHttpRealm |
michael@0 | 215 | * For protocol logins, this argument should be the HTTP Realm |
michael@0 | 216 | * for which the login applies. This is obtained from the |
michael@0 | 217 | * WWW-Authenticate header. See RFC2617. For form logins, |
michael@0 | 218 | * specify null. |
michael@0 | 219 | * @param logins |
michael@0 | 220 | * An array of nsILoginInfo objects. |
michael@0 | 221 | * |
michael@0 | 222 | * NOTE: This can be called from JS as: |
michael@0 | 223 | * var logins = pwmgr.findLogins({}, hostname, ...); |
michael@0 | 224 | * |
michael@0 | 225 | */ |
michael@0 | 226 | void findLogins(out unsigned long count, in AString aHostname, |
michael@0 | 227 | in AString aActionURL, in AString aHttpRealm, |
michael@0 | 228 | [retval, array, size_is(count)] out nsILoginInfo logins); |
michael@0 | 229 | |
michael@0 | 230 | |
michael@0 | 231 | /** |
michael@0 | 232 | * Search for logins matching the specified criteria, as with |
michael@0 | 233 | * findLogins(). This interface only returns the number of matching |
michael@0 | 234 | * logins (and not the logins themselves), which allows a caller to |
michael@0 | 235 | * check for logins without causing the user to be prompted for a master |
michael@0 | 236 | * password to decrypt the logins. |
michael@0 | 237 | * |
michael@0 | 238 | * @param aHostname |
michael@0 | 239 | * The hostname to restrict searches to. Specify an empty string |
michael@0 | 240 | * to match all hosts. A null value will not match any logins, and |
michael@0 | 241 | * will thus always return a count of 0. |
michael@0 | 242 | * @param aActionURL |
michael@0 | 243 | * The URL to which a form login will be submitted. To match any |
michael@0 | 244 | * form login, specify an empty string. To not match any form |
michael@0 | 245 | * login, specify null. |
michael@0 | 246 | * @param aHttpRealm |
michael@0 | 247 | * The HTTP Realm for which the login applies. To match logins for |
michael@0 | 248 | * any realm, specify an empty string. To not match logins for any |
michael@0 | 249 | * realm, specify null. |
michael@0 | 250 | */ |
michael@0 | 251 | unsigned long countLogins(in AString aHostname, in AString aActionURL, |
michael@0 | 252 | in AString aHttpRealm); |
michael@0 | 253 | /** |
michael@0 | 254 | * True when a master password prompt is being shown. |
michael@0 | 255 | */ |
michael@0 | 256 | readonly attribute boolean uiBusy; |
michael@0 | 257 | |
michael@0 | 258 | /** |
michael@0 | 259 | * True when the master password has already been entered, and so a caller |
michael@0 | 260 | * can ask for decrypted logins without triggering a prompt. |
michael@0 | 261 | */ |
michael@0 | 262 | readonly attribute boolean isLoggedIn; |
michael@0 | 263 | }; |