1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549
// // DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/nsICookieManager.idl // /// `interface nsIPrivateModeCallback : nsISupports` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIPrivateModeCallback { vtable: *const nsIPrivateModeCallbackVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIPrivateModeCallback. unsafe impl XpCom for nsIPrivateModeCallback { const IID: nsIID = nsID(0x20709db8, 0x8dad, 0x4e45, [0xb3, 0x3e, 0x6e, 0x7c, 0x76, 0x1d, 0xfc, 0x5d]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIPrivateModeCallback { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIPrivateModeCallback. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIPrivateModeCallbackCoerce { /// Cheaply cast a value of this type from a `nsIPrivateModeCallback`. fn coerce_from(v: &nsIPrivateModeCallback) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIPrivateModeCallbackCoerce for nsIPrivateModeCallback { #[inline] fn coerce_from(v: &nsIPrivateModeCallback) -> &Self { v } } impl nsIPrivateModeCallback { /// Cast this `nsIPrivateModeCallback` to one of its base interfaces. #[inline] pub fn coerce<T: nsIPrivateModeCallbackCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIPrivateModeCallback { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIPrivateModeCallbackCoerce for T { #[inline] fn coerce_from(v: &nsIPrivateModeCallback) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIPrivateModeCallback // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIPrivateModeCallbackVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void callback (); */ pub Callback: unsafe extern "system" fn (this: *const nsIPrivateModeCallback) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIPrivateModeCallback { /// `void callback ();` #[inline] pub unsafe fn Callback(&self, ) -> nsresult { ((*self.vtable).Callback)(self, ) } } /// `interface nsICookieManager : nsISupports` /// /// ```text /// /** /// * An optional interface for accessing or removing the cookies /// * that are in the cookie list /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsICookieManager { vtable: *const nsICookieManagerVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsICookieManager. unsafe impl XpCom for nsICookieManager { const IID: nsIID = nsID(0xaaab6710, 0x0f2c, 0x11d5, [0xa5, 0x3b, 0x00, 0x10, 0xa4, 0x01, 0xeb, 0x10]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsICookieManager { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsICookieManager. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsICookieManagerCoerce { /// Cheaply cast a value of this type from a `nsICookieManager`. fn coerce_from(v: &nsICookieManager) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsICookieManagerCoerce for nsICookieManager { #[inline] fn coerce_from(v: &nsICookieManager) -> &Self { v } } impl nsICookieManager { /// Cast this `nsICookieManager` to one of its base interfaces. #[inline] pub fn coerce<T: nsICookieManagerCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsICookieManager { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsICookieManagerCoerce for T { #[inline] fn coerce_from(v: &nsICookieManager) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsICookieManager // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsICookieManagerVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void removeAll (); */ pub RemoveAll: unsafe extern "system" fn (this: *const nsICookieManager) -> nsresult, /* readonly attribute nsISimpleEnumerator enumerator; */ pub GetEnumerator: unsafe extern "system" fn (this: *const nsICookieManager, aEnumerator: *mut *const nsISimpleEnumerator) -> nsresult, /* readonly attribute nsISimpleEnumerator sessionEnumerator; */ pub GetSessionEnumerator: unsafe extern "system" fn (this: *const nsICookieManager, aSessionEnumerator: *mut *const nsISimpleEnumerator) -> nsresult, /* [implicit_jscontext,optional_argc] void remove (in AUTF8String aHost, in ACString aName, in AUTF8String aPath, in boolean aBlocked, [optional] in jsval aOriginAttributes); */ /// Unable to generate binding because `native type JS::Value is unsupported` pub Remove: *const ::libc::c_void, /* [notxpcom] nsresult removeNative (in AUTF8String aHost, in ACString aName, in AUTF8String aPath, in boolean aBlocked, in OriginAttributesPtr aOriginAttributes); */ /// Unable to generate binding because `native type mozilla::OriginAttributes is unsupported` pub RemoveNative: *const ::libc::c_void, /* [implicit_jscontext,optional_argc] void add (in AUTF8String aHost, in AUTF8String aPath, in ACString aName, in ACString aValue, in boolean aIsSecure, in boolean aIsHttpOnly, in boolean aIsSession, in int64_t aExpiry, [optional] in jsval aOriginAttributes, [optional] in int32_t aSameSite); */ /// Unable to generate binding because `native type JS::Value is unsupported` pub Add: *const ::libc::c_void, /* [notxpcom] nsresult addNative (in AUTF8String aHost, in AUTF8String aPath, in ACString aName, in ACString aValue, in boolean aIsSecure, in boolean aIsHttpOnly, in boolean aIsSession, in int64_t aExpiry, in OriginAttributesPtr aOriginAttributes, in int32_t aSameSite); */ /// Unable to generate binding because `native type mozilla::OriginAttributes is unsupported` pub AddNative: *const ::libc::c_void, /* [implicit_jscontext,optional_argc] boolean cookieExists (in nsICookie2 aCookie, [optional] in jsval aOriginAttributes); */ /// Unable to generate binding because `native type JS::Value is unsupported` pub CookieExists: *const ::libc::c_void, /* [notxpcom] nsresult cookieExistsNative (in nsICookie2 aCookie, in OriginAttributesPtr aOriginAttributes, out boolean aExists); */ /// Unable to generate binding because `native type mozilla::OriginAttributes is unsupported` pub CookieExistsNative: *const ::libc::c_void, /* unsigned long countCookiesFromHost (in AUTF8String aHost); */ pub CountCookiesFromHost: unsafe extern "system" fn (this: *const nsICookieManager, aHost: &::nsstring::nsACString, _retval: *mut libc::uint32_t) -> nsresult, /* [implicit_jscontext,optional_argc] nsISimpleEnumerator getCookiesFromHost (in AUTF8String aHost, [optional] in jsval aOriginAttributes); */ /// Unable to generate binding because `native type JS::Value is unsupported` pub GetCookiesFromHost: *const ::libc::c_void, /* void importCookies (in nsIFile aCookieFile); */ pub ImportCookies: unsafe extern "system" fn (this: *const nsICookieManager, aCookieFile: *const nsIFile) -> nsresult, /* nsISimpleEnumerator getCookiesWithOriginAttributes (in DOMString aPattern, [optional] in AUTF8String aHost); */ pub GetCookiesWithOriginAttributes: unsafe extern "system" fn (this: *const nsICookieManager, aPattern: &::nsstring::nsAString, aHost: &::nsstring::nsACString, _retval: *mut *const nsISimpleEnumerator) -> nsresult, /* void removeCookiesWithOriginAttributes (in DOMString aPattern, [optional] in AUTF8String aHost); */ pub RemoveCookiesWithOriginAttributes: unsafe extern "system" fn (this: *const nsICookieManager, aPattern: &::nsstring::nsAString, aHost: &::nsstring::nsACString) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsICookieManager { /// ```text /// /** /// * Called to remove all cookies from the cookie list /// */ /// ``` /// /// `void removeAll ();` #[inline] pub unsafe fn RemoveAll(&self, ) -> nsresult { ((*self.vtable).RemoveAll)(self, ) } /// ```text /// /** /// * Called to enumerate through each cookie in the cookie list. /// * The objects enumerated over are of type nsICookie /// * This enumerator should only be used for non-private browsing cookies. /// * To retrieve an enumerator for private browsing cookies, use /// * getCookiesWithOriginAttributes. /// */ /// ``` /// /// `readonly attribute nsISimpleEnumerator enumerator;` #[inline] pub unsafe fn GetEnumerator(&self, aEnumerator: *mut *const nsISimpleEnumerator) -> nsresult { ((*self.vtable).GetEnumerator)(self, aEnumerator) } /// ```text /// /** /// * Called to enumerate through each session cookie in the cookie list. /// * The objects enumerated over are of type nsICookie /// * This enumerator should only be used for non-private browsing cookies. /// */ /// ``` /// /// `readonly attribute nsISimpleEnumerator sessionEnumerator;` #[inline] pub unsafe fn GetSessionEnumerator(&self, aSessionEnumerator: *mut *const nsISimpleEnumerator) -> nsresult { ((*self.vtable).GetSessionEnumerator)(self, aSessionEnumerator) } /// ```text /// /** /// * Called to remove an individual cookie from the cookie list, specified /// * by host, name, and path. If the cookie cannot be found, no exception /// * is thrown. Typically, the arguments to this method will be obtained /// * directly from the desired nsICookie object. /// * /// * @param aHost The host or domain for which the cookie was set. @see /// * nsICookieManager::add for a description of acceptable host /// * strings. If the target cookie is a domain cookie, a leading /// * dot must be present. /// * @param aName The name specified in the cookie /// * @param aPath The path for which the cookie was set /// * @param aOriginAttributes The originAttributes of this cookie. This /// * attribute is optional to avoid breaking add-ons. /// * In 1 or 2 releases it will be mandatory: bug 1260399. /// * @param aBlocked Indicates if cookies from this host should be permanently /// * blocked. /// * /// */ /// ``` /// /// `[implicit_jscontext,optional_argc] void remove (in AUTF8String aHost, in ACString aName, in AUTF8String aPath, in boolean aBlocked, [optional] in jsval aOriginAttributes);` const _Remove: () = (); /// `[notxpcom] nsresult removeNative (in AUTF8String aHost, in ACString aName, in AUTF8String aPath, in boolean aBlocked, in OriginAttributesPtr aOriginAttributes);` const _RemoveNative: () = (); /// ```text /// /** /// * Add a cookie. nsICookieService is the normal way to do this. This /// * method is something of a backdoor. /// * /// * @param aHost /// * the host or domain for which the cookie is set. presence of a /// * leading dot indicates a domain cookie; otherwise, the cookie /// * is treated as a non-domain cookie (see RFC2109). The host string /// * will be normalized to ASCII or ACE; any trailing dot will be /// * stripped. To be a domain cookie, the host must have at least two /// * subdomain parts (e.g. '.foo.com', not '.com'), otherwise an /// * exception will be thrown. An empty string is acceptable /// * (e.g. file:// URI's). /// * @param aPath /// * path within the domain for which the cookie is valid /// * @param aName /// * cookie name /// * @param aValue /// * cookie data /// * @param aIsSecure /// * true if the cookie should only be sent over a secure connection. /// * @param aIsHttpOnly /// * true if the cookie should only be sent to, and can only be /// * modified by, an http connection. /// * @param aIsSession /// * true if the cookie should exist for the current session only. /// * see aExpiry. /// * @param aExpiry /// * expiration date, in seconds since midnight (00:00:00), January 1, /// * 1970 UTC. note that expiry time will also be honored for session cookies; /// * in this way, the more restrictive of the two will take effect. /// * @param aOriginAttributes /// * the originAttributes of this cookie. This attribute is optional to /// * avoid breaking add-ons. /// * @param aSameSite /// * the SameSite attribute. This attribute is optional to avoid breaking /// * addons /// */ /// ``` /// /// `[implicit_jscontext,optional_argc] void add (in AUTF8String aHost, in AUTF8String aPath, in ACString aName, in ACString aValue, in boolean aIsSecure, in boolean aIsHttpOnly, in boolean aIsSession, in int64_t aExpiry, [optional] in jsval aOriginAttributes, [optional] in int32_t aSameSite);` const _Add: () = (); /// `[notxpcom] nsresult addNative (in AUTF8String aHost, in AUTF8String aPath, in ACString aName, in ACString aValue, in boolean aIsSecure, in boolean aIsHttpOnly, in boolean aIsSession, in int64_t aExpiry, in OriginAttributesPtr aOriginAttributes, in int32_t aSameSite);` const _AddNative: () = (); /// ```text /// /** /// * Find whether a given cookie already exists. /// * /// * @param aCookie /// * the cookie to look for /// * @param aOriginAttributes /// * nsICookie2 contains an originAttributes but if nsICookie2 is /// * implemented in JS, we can't retrieve its originAttributes because /// * the getter is marked [implicit_jscontext]. This optional parameter /// * is a workaround. /// * /// * @return true if a cookie was found which matches the host, path, and name /// * fields of aCookie /// */ /// ``` /// /// `[implicit_jscontext,optional_argc] boolean cookieExists (in nsICookie2 aCookie, [optional] in jsval aOriginAttributes);` const _CookieExists: () = (); /// `[notxpcom] nsresult cookieExistsNative (in nsICookie2 aCookie, in OriginAttributesPtr aOriginAttributes, out boolean aExists);` const _CookieExistsNative: () = (); /// ```text /// /** /// * Count how many cookies exist within the base domain of 'aHost'. /// * Thus, for a host "weather.yahoo.com", the base domain would be "yahoo.com", /// * and any host or domain cookies for "yahoo.com" and its subdomains would be /// * counted. /// * /// * @param aHost /// * the host string to search for, e.g. "google.com". this should consist /// * of only the host portion of a URI. see @add for a description of /// * acceptable host strings. /// * /// * @return the number of cookies found. /// */ /// ``` /// /// `unsigned long countCookiesFromHost (in AUTF8String aHost);` #[inline] pub unsafe fn CountCookiesFromHost(&self, aHost: &::nsstring::nsACString, _retval: *mut libc::uint32_t) -> nsresult { ((*self.vtable).CountCookiesFromHost)(self, aHost, _retval) } /// ```text /// /** /// * Returns an enumerator of cookies that exist within the base domain of /// * 'aHost'. Thus, for a host "weather.yahoo.com", the base domain would be /// * "yahoo.com", and any host or domain cookies for "yahoo.com" and its /// * subdomains would be returned. /// * /// * @param aHost /// * the host string to search for, e.g. "google.com". this should consist /// * of only the host portion of a URI. see @add for a description of /// * acceptable host strings. /// * @param aOriginAttributes The originAttributes of cookies that would be /// * retrived. This attribute is optional to avoid /// * breaking add-ons. /// * /// * @return an nsISimpleEnumerator of nsICookie2 objects. /// * /// * @see countCookiesFromHost /// */ /// ``` /// /// `[implicit_jscontext,optional_argc] nsISimpleEnumerator getCookiesFromHost (in AUTF8String aHost, [optional] in jsval aOriginAttributes);` const _GetCookiesFromHost: () = (); /// ```text /// /** /// * Import an old-style cookie file. Imported cookies will be added to the /// * existing database. If the database contains any cookies the same as those /// * being imported (i.e. domain, name, and path match), they will be replaced. /// * /// * @param aCookieFile the file to import, usually cookies.txt /// */ /// ``` /// /// `void importCookies (in nsIFile aCookieFile);` #[inline] pub unsafe fn ImportCookies(&self, aCookieFile: *const nsIFile) -> nsresult { ((*self.vtable).ImportCookies)(self, aCookieFile) } /// ```text /// /** /// * Returns an enumerator of all cookies whose origin attributes matches aPattern /// * /// * @param aPattern origin attribute pattern in JSON format /// * /// * @param aHost /// * the host string to search for, e.g. "google.com". this should consist /// * of only the host portion of a URI. see @add for a description of /// * acceptable host strings. This attribute is optional. It will search /// * all hosts if this attribute is not given. /// */ /// ``` /// /// `nsISimpleEnumerator getCookiesWithOriginAttributes (in DOMString aPattern, [optional] in AUTF8String aHost);` #[inline] pub unsafe fn GetCookiesWithOriginAttributes(&self, aPattern: &::nsstring::nsAString, aHost: &::nsstring::nsACString, _retval: *mut *const nsISimpleEnumerator) -> nsresult { ((*self.vtable).GetCookiesWithOriginAttributes)(self, aPattern, aHost, _retval) } /// ```text /// /** /// * Remove all the cookies whose origin attributes matches aPattern /// * /// * @param aPattern origin attribute pattern in JSON format /// */ /// ``` /// /// `void removeCookiesWithOriginAttributes (in DOMString aPattern, [optional] in AUTF8String aHost);` #[inline] pub unsafe fn RemoveCookiesWithOriginAttributes(&self, aPattern: &::nsstring::nsAString, aHost: &::nsstring::nsACString) -> nsresult { ((*self.vtable).RemoveCookiesWithOriginAttributes)(self, aPattern, aHost) } }