Copy as Markdown

Other Tools

//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/toolkit/components/antitracking/nsIURLQueryStrippingListService.idl
//
/// `interface nsIURLQueryStrippingListObserver : nsISupports`
///
/// ```text
/// /**
/// * Observer for query stripping list updates.
/// */
/// ```
///
// 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 nsIURLQueryStrippingListObserver {
vtable: &'static nsIURLQueryStrippingListObserverVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// 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 nsIURLQueryStrippingListObserver.
unsafe impl XpCom for nsIURLQueryStrippingListObserver {
const IID: nsIID = nsID(0xef56ae12, 0xb1bb, 0x43e6,
[0xb1, 0xd8, 0x16, 0x45, 0x9c, 0xb9, 0x8d, 0xfd]);
}
// 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 nsIURLQueryStrippingListObserver {
#[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 nsIURLQueryStrippingListObserver.
// 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 nsIURLQueryStrippingListObserverCoerce {
/// Cheaply cast a value of this type from a `nsIURLQueryStrippingListObserver`.
fn coerce_from(v: &nsIURLQueryStrippingListObserver) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIURLQueryStrippingListObserverCoerce for nsIURLQueryStrippingListObserver {
#[inline]
fn coerce_from(v: &nsIURLQueryStrippingListObserver) -> &Self {
v
}
}
impl nsIURLQueryStrippingListObserver {
/// Cast this `nsIURLQueryStrippingListObserver` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIURLQueryStrippingListObserverCoerce>(&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 nsIURLQueryStrippingListObserver {
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> nsIURLQueryStrippingListObserverCoerce for T {
#[inline]
fn coerce_from(v: &nsIURLQueryStrippingListObserver) -> &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 nsIURLQueryStrippingListObserver
// 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 nsIURLQueryStrippingListObserverVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void onQueryStrippingListUpdate (in ACString aStripList, in ACString aAllowList); */
pub OnQueryStrippingListUpdate: unsafe extern "system" fn (this: *const nsIURLQueryStrippingListObserver, aStripList: *const ::nsstring::nsACString, aAllowList: *const ::nsstring::nsACString) -> ::nserror::nsresult,
/* [implicit_jscontext] void onStripOnShareUpdate (in Array<AString> aStripRules); */
/// Unable to generate binding because `jscontext is unsupported`
pub OnStripOnShareUpdate: *const ::libc::c_void,
}
// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIURLQueryStrippingListObserver {
/// ```text
/// /**
/// * Called by nsIQueryStrippingListService when the list of query stripping
/// * changes and when the observer is first registered. Note that the lists
/// * could have duplicate entries because we would combine the lists from the
/// * pref and remote settings.
/// *
/// * @param aStripList
/// * A space-separated list of query parameters that will be stripped.
/// * @param aAllowList
/// * A comma-separated list of hosts (eTLD+1) that are exempt from query
/// * stripping.
/// */
/// ```
///
/// `void onQueryStrippingListUpdate (in ACString aStripList, in ACString aAllowList);`
#[inline]
pub unsafe fn OnQueryStrippingListUpdate(&self, aStripList: *const ::nsstring::nsACString, aAllowList: *const ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).OnQueryStrippingListUpdate)(self, aStripList, aAllowList)
}
/// ```text
/// /**
/// * Called by nsIQueryStrippingListService when the list of query stripping
/// * parameters for strip-on-share feature is updated and when the observer is first registered.
/// *
/// * @param aStripRules
/// * An Array of stringified strip rules.
/// * A stringified rule has the form of:
/// * "'queryParams': ['param1', 'param2', ...], 'topLevelSites': ['www.site.com', 'www.site.de', ...]"
/// */
/// ```
///
/// `[implicit_jscontext] void onStripOnShareUpdate (in Array<AString> aStripRules);`
const _OnStripOnShareUpdate: () = ();
}
/// `interface nsIURLQueryStrippingListService : nsISupports`
///
/// ```text
/// /**
/// * A service that monitors updates to the query stripping list from sources such
/// * as a local pref and remote settings updates.
/// */
/// ```
///
// 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 nsIURLQueryStrippingListService {
vtable: &'static nsIURLQueryStrippingListServiceVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// 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 nsIURLQueryStrippingListService.
unsafe impl XpCom for nsIURLQueryStrippingListService {
const IID: nsIID = nsID(0xafff16f0, 0x3fd2, 0x4153,
[0x9c, 0xcd, 0xc6, 0xd9, 0xab, 0xd8, 0x79, 0xe4]);
}
// 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 nsIURLQueryStrippingListService {
#[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 nsIURLQueryStrippingListService.
// 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 nsIURLQueryStrippingListServiceCoerce {
/// Cheaply cast a value of this type from a `nsIURLQueryStrippingListService`.
fn coerce_from(v: &nsIURLQueryStrippingListService) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIURLQueryStrippingListServiceCoerce for nsIURLQueryStrippingListService {
#[inline]
fn coerce_from(v: &nsIURLQueryStrippingListService) -> &Self {
v
}
}
impl nsIURLQueryStrippingListService {
/// Cast this `nsIURLQueryStrippingListService` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIURLQueryStrippingListServiceCoerce>(&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 nsIURLQueryStrippingListService {
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> nsIURLQueryStrippingListServiceCoerce for T {
#[inline]
fn coerce_from(v: &nsIURLQueryStrippingListService) -> &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 nsIURLQueryStrippingListService
// 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 nsIURLQueryStrippingListServiceVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void registerAndRunObserver (in nsIURLQueryStrippingListObserver aObserver); */
pub RegisterAndRunObserver: unsafe extern "system" fn (this: *const nsIURLQueryStrippingListService, aObserver: *const nsIURLQueryStrippingListObserver) -> ::nserror::nsresult,
/* void registerAndRunObserverStripOnShare (in nsIURLQueryStrippingListObserver aObserver); */
pub RegisterAndRunObserverStripOnShare: unsafe extern "system" fn (this: *const nsIURLQueryStrippingListService, aObserver: *const nsIURLQueryStrippingListObserver) -> ::nserror::nsresult,
/* void unregisterObserver (in nsIURLQueryStrippingListObserver aObserver); */
pub UnregisterObserver: unsafe extern "system" fn (this: *const nsIURLQueryStrippingListService, aObserver: *const nsIURLQueryStrippingListObserver) -> ::nserror::nsresult,
/* void unregisterStripOnShareObserver (in nsIURLQueryStrippingListObserver aObserver); */
pub UnregisterStripOnShareObserver: unsafe extern "system" fn (this: *const nsIURLQueryStrippingListService, aObserver: *const nsIURLQueryStrippingListObserver) -> ::nserror::nsresult,
/* void clearLists (); */
pub ClearLists: unsafe extern "system" fn (this: *const nsIURLQueryStrippingListService) -> ::nserror::nsresult,
/* Promise testWaitForInit (); */
/// Unable to generate binding because `special type promise unsupported`
pub TestWaitForInit: *const ::libc::c_void,
/* Promise testSetList (in jsval testFile); */
/// Unable to generate binding because `special type jsval unsupported`
pub TestSetList: *const ::libc::c_void,
/* boolean testHasStripOnShareObservers (); */
pub TestHasStripOnShareObservers: unsafe extern "system" fn (this: *const nsIURLQueryStrippingListService, _retval: *mut bool) -> ::nserror::nsresult,
/* boolean testHasQPSObservers (); */
pub TestHasQPSObservers: unsafe extern "system" fn (this: *const nsIURLQueryStrippingListService, _retval: *mut bool) -> ::nserror::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 nsIURLQueryStrippingListService {
/// ```text
/// /**
/// * Register a new observer to query stripping list updates. When the observer
/// * is registered it is called immediately once. Afterwards it will be called
/// * whenever the specified pref changes or when remote settings for
/// * partitioning updates.
/// *
/// * @param aObserver
/// * An nsIURLQueryStrippingListObserver object or function that
/// * will receive updates to the strip list and the allow list. Will be
/// * called immediately with the current list value.
/// */
/// ```
///
/// `void registerAndRunObserver (in nsIURLQueryStrippingListObserver aObserver);`
#[inline]
pub unsafe fn RegisterAndRunObserver(&self, aObserver: *const nsIURLQueryStrippingListObserver) -> ::nserror::nsresult {
((*self.vtable).RegisterAndRunObserver)(self, aObserver)
}
/// ```text
/// /**
/// * Register a new observer to strip-on-share stripping list updates
/// * (this is the strip-on-share list combined with the QPS list).
/// * When the observer is registered it is called immediately once. Afterwards it will be called
/// * when there is an remote settings update to the QPS strip list.
/// *
/// * @param aObserver
/// * An nsIURLQueryStrippingListObserver object or function that
/// * will receive updates to the strip list and the allow list. Will be
/// * called immediately with the current list value.
/// */
/// ```
///
/// `void registerAndRunObserverStripOnShare (in nsIURLQueryStrippingListObserver aObserver);`
#[inline]
pub unsafe fn RegisterAndRunObserverStripOnShare(&self, aObserver: *const nsIURLQueryStrippingListObserver) -> ::nserror::nsresult {
((*self.vtable).RegisterAndRunObserverStripOnShare)(self, aObserver)
}
/// ```text
/// /**
/// * Unregister an observer.
/// *
/// * @param aObserver
/// * The nsIURLQueryStrippingListObserver object to unregister.
/// */
/// ```
///
/// `void unregisterObserver (in nsIURLQueryStrippingListObserver aObserver);`
#[inline]
pub unsafe fn UnregisterObserver(&self, aObserver: *const nsIURLQueryStrippingListObserver) -> ::nserror::nsresult {
((*self.vtable).UnregisterObserver)(self, aObserver)
}
/// ```text
/// /**
/// * Unregister an observer for strip-on-share.
/// *
/// * @param aObserver
/// * The nsIURLQueryStrippingListObserver object to unregister.
/// */
/// ```
///
/// `void unregisterStripOnShareObserver (in nsIURLQueryStrippingListObserver aObserver);`
#[inline]
pub unsafe fn UnregisterStripOnShareObserver(&self, aObserver: *const nsIURLQueryStrippingListObserver) -> ::nserror::nsresult {
((*self.vtable).UnregisterStripOnShareObserver)(self, aObserver)
}
/// ```text
/// /**
/// * Clear all Lists.
/// *
/// * Note that this is for testing purpose.
/// */
/// ```
///
/// `void clearLists ();`
#[inline]
pub unsafe fn ClearLists(&self, ) -> ::nserror::nsresult {
((*self.vtable).ClearLists)(self, )
}
/// ```text
/// /**
/// * Test-only method used to wait for the list service to initialize fully.
/// * Resolves once the service has reached a fully disabled (false) or fully
/// * enabled state (true).
/// * May also be called when the service is already fully initialized or
/// * disabled, in this case it will resolve immediately.
/// */
/// ```
///
/// `Promise testWaitForInit ();`
const _TestWaitForInit: () = ();
/// ```text
/// /**
/// * Add new lists with different params
/// *
/// * Note that this is for testing purpose.
/// */
/// ```
///
/// `Promise testSetList (in jsval testFile);`
const _TestSetList: () = ();
/// ```text
/// /**
/// * Check if Strip on Share observers are unregistered
/// *
/// * Note that this is for testing purpose.
/// */
/// ```
///
/// `boolean testHasStripOnShareObservers ();`
#[inline]
pub unsafe fn TestHasStripOnShareObservers(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).TestHasStripOnShareObservers)(self, _retval)
}
/// ```text
/// /**
/// * Check if QPS observers are unregistered
/// *
/// * Note that this is for testing purpose.
/// */
/// ```
///
/// `boolean testHasQPSObservers ();`
#[inline]
pub unsafe fn TestHasQPSObservers(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).TestHasQPSObservers)(self, _retval)
}
}