Copy as Markdown

Other Tools

//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/toolkit/mozapps/update/nsIUpdateService.idl
//
/// `interface nsIUpdatePatch : nsISupports`
///
/// ```text
/// /**
/// * An interface that describes an object representing a patch file that can
/// * be downloaded and applied to a version of this application so that it
/// * can be updated.
/// */
/// ```
///
// 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 nsIUpdatePatch {
vtable: &'static nsIUpdatePatchVTable,
/// 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 nsIUpdatePatch.
unsafe impl XpCom for nsIUpdatePatch {
const IID: nsIID = nsID(0xdc8fb8a9, 0x3a53, 0x4031,
[0x94, 0x69, 0x2a, 0x51, 0x97, 0xea, 0x30, 0xe7]);
}
// 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 nsIUpdatePatch {
#[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 nsIUpdatePatch.
// 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 nsIUpdatePatchCoerce {
/// Cheaply cast a value of this type from a `nsIUpdatePatch`.
fn coerce_from(v: &nsIUpdatePatch) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIUpdatePatchCoerce for nsIUpdatePatch {
#[inline]
fn coerce_from(v: &nsIUpdatePatch) -> &Self {
v
}
}
impl nsIUpdatePatch {
/// Cast this `nsIUpdatePatch` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIUpdatePatchCoerce>(&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 nsIUpdatePatch {
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> nsIUpdatePatchCoerce for T {
#[inline]
fn coerce_from(v: &nsIUpdatePatch) -> &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 nsIUpdatePatch
// 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 nsIUpdatePatchVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute AString type; */
pub GetType: unsafe extern "system" fn (this: *const nsIUpdatePatch, aType: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString URL; */
pub GetURL: unsafe extern "system" fn (this: *const nsIUpdatePatch, aURL: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute AString finalURL; */
pub GetFinalURL: unsafe extern "system" fn (this: *const nsIUpdatePatch, aFinalURL: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute AString finalURL; */
pub SetFinalURL: unsafe extern "system" fn (this: *const nsIUpdatePatch, aFinalURL: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute unsigned long size; */
pub GetSize: unsafe extern "system" fn (this: *const nsIUpdatePatch, aSize: *mut u32) -> ::nserror::nsresult,
/* attribute AString state; */
pub GetState: unsafe extern "system" fn (this: *const nsIUpdatePatch, aState: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute AString state; */
pub SetState: unsafe extern "system" fn (this: *const nsIUpdatePatch, aState: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute long errorCode; */
pub GetErrorCode: unsafe extern "system" fn (this: *const nsIUpdatePatch, aErrorCode: *mut i32) -> ::nserror::nsresult,
/* attribute long errorCode; */
pub SetErrorCode: unsafe extern "system" fn (this: *const nsIUpdatePatch, aErrorCode: i32) -> ::nserror::nsresult,
/* attribute boolean selected; */
pub GetSelected: unsafe extern "system" fn (this: *const nsIUpdatePatch, aSelected: *mut bool) -> ::nserror::nsresult,
/* attribute boolean selected; */
pub SetSelected: unsafe extern "system" fn (this: *const nsIUpdatePatch, aSelected: bool) -> ::nserror::nsresult,
/* Element serialize (in Document updates); */
pub Serialize: unsafe extern "system" fn (this: *const nsIUpdatePatch, updates: *const libc::c_void, _retval: *mut *const libc::c_void) -> ::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 nsIUpdatePatch {
/// ```text
/// /**
/// * The type of this patch:
/// * "partial" A binary difference between two application versions
/// * "complete" A complete patch containing all of the replacement files
/// * to update to the new version
/// */
/// ```
///
/// `readonly attribute AString type;`
#[inline]
pub unsafe fn GetType(&self, aType: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetType)(self, aType)
}
/// ```text
/// /**
/// * The URL this patch was being downloaded from
/// */
/// ```
///
/// `readonly attribute AString URL;`
#[inline]
pub unsafe fn GetURL(&self, aURL: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetURL)(self, aURL)
}
/// ```text
/// /**
/// * The final URL this patch was being downloaded from
/// */
/// ```
///
/// `attribute AString finalURL;`
#[inline]
pub unsafe fn GetFinalURL(&self, aFinalURL: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetFinalURL)(self, aFinalURL)
}
/// ```text
/// /**
/// * The final URL this patch was being downloaded from
/// */
/// ```
///
/// `attribute AString finalURL;`
#[inline]
pub unsafe fn SetFinalURL(&self, aFinalURL: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).SetFinalURL)(self, aFinalURL)
}
/// ```text
/// /**
/// * The size of this file, in bytes.
/// */
/// ```
///
/// `readonly attribute unsigned long size;`
#[inline]
pub unsafe fn GetSize(&self, aSize: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetSize)(self, aSize)
}
/// ```text
/// /**
/// * The state of this patch
/// */
/// ```
///
/// `attribute AString state;`
#[inline]
pub unsafe fn GetState(&self, aState: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetState)(self, aState)
}
/// ```text
/// /**
/// * The state of this patch
/// */
/// ```
///
/// `attribute AString state;`
#[inline]
pub unsafe fn SetState(&self, aState: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).SetState)(self, aState)
}
/// ```text
/// /**
/// * A numeric error code that conveys additional information about the state of
/// * a failed update. If the update is not in the "failed" state the value is
/// * zero. The possible values are located in common/updatererrors.h and values between
/// * 80 and 99 are in nsUpdateService.js.
/// */
/// ```
///
/// `attribute long errorCode;`
#[inline]
pub unsafe fn GetErrorCode(&self, aErrorCode: *mut i32) -> ::nserror::nsresult {
((*self.vtable).GetErrorCode)(self, aErrorCode)
}
/// ```text
/// /**
/// * A numeric error code that conveys additional information about the state of
/// * a failed update. If the update is not in the "failed" state the value is
/// * zero. The possible values are located in common/updatererrors.h and values between
/// * 80 and 99 are in nsUpdateService.js.
/// */
/// ```
///
/// `attribute long errorCode;`
#[inline]
pub unsafe fn SetErrorCode(&self, aErrorCode: i32) -> ::nserror::nsresult {
((*self.vtable).SetErrorCode)(self, aErrorCode)
}
/// ```text
/// /**
/// * true if this patch is currently selected as the patch to be downloaded and
/// * installed for this update transaction, false if another patch from this
/// * update has been selected.
/// */
/// ```
///
/// `attribute boolean selected;`
#[inline]
pub unsafe fn GetSelected(&self, aSelected: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetSelected)(self, aSelected)
}
/// ```text
/// /**
/// * true if this patch is currently selected as the patch to be downloaded and
/// * installed for this update transaction, false if another patch from this
/// * update has been selected.
/// */
/// ```
///
/// `attribute boolean selected;`
#[inline]
pub unsafe fn SetSelected(&self, aSelected: bool) -> ::nserror::nsresult {
((*self.vtable).SetSelected)(self, aSelected)
}
/// ```text
/// /**
/// * Serializes this patch object into a DOM Element
/// * @param updates
/// * The document to serialize into
/// * @returns The DOM Element created by the serialization process
/// */
/// ```
///
/// `Element serialize (in Document updates);`
#[inline]
pub unsafe fn Serialize(&self, updates: *const libc::c_void, _retval: *mut *const libc::c_void) -> ::nserror::nsresult {
((*self.vtable).Serialize)(self, updates, _retval)
}
}
/// `interface nsIUpdate : nsISupports`
///
/// ```text
/// /**
/// * An interface that describes an object representing an available update to
/// * the current application - this update may have several available patches
/// * from which one must be selected to download and install, for example we
/// * might select a binary difference patch first and attempt to apply that,
/// * then if the application process fails fall back to downloading a complete
/// * file-replace patch. This object also contains information about the update
/// * that the front end and other application services can use to learn more
/// * about what is going on.
/// */
/// ```
///
// 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 nsIUpdate {
vtable: &'static nsIUpdateVTable,
/// 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 nsIUpdate.
unsafe impl XpCom for nsIUpdate {
const IID: nsIID = nsID(0xe094c045, 0xf4ff, 0x41fd,
[0x92, 0xda, 0xcd, 0x2e, 0xff, 0xd2, 0xc7, 0xc9]);
}
// 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 nsIUpdate {
#[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 nsIUpdate.
// 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 nsIUpdateCoerce {
/// Cheaply cast a value of this type from a `nsIUpdate`.
fn coerce_from(v: &nsIUpdate) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIUpdateCoerce for nsIUpdate {
#[inline]
fn coerce_from(v: &nsIUpdate) -> &Self {
v
}
}
impl nsIUpdate {
/// Cast this `nsIUpdate` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIUpdateCoerce>(&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 nsIUpdate {
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> nsIUpdateCoerce for T {
#[inline]
fn coerce_from(v: &nsIUpdate) -> &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 nsIUpdate
// 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 nsIUpdateVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute AString type; */
pub GetType: unsafe extern "system" fn (this: *const nsIUpdate, aType: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString name; */
pub GetName: unsafe extern "system" fn (this: *const nsIUpdate, aName: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString displayVersion; */
pub GetDisplayVersion: unsafe extern "system" fn (this: *const nsIUpdate, aDisplayVersion: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString appVersion; */
pub GetAppVersion: unsafe extern "system" fn (this: *const nsIUpdate, aAppVersion: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString platformVersion; */
pub GetPlatformVersion: unsafe extern "system" fn (this: *const nsIUpdate, aPlatformVersion: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString previousAppVersion; */
pub GetPreviousAppVersion: unsafe extern "system" fn (this: *const nsIUpdate, aPreviousAppVersion: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString buildID; */
pub GetBuildID: unsafe extern "system" fn (this: *const nsIUpdate, aBuildID: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString detailsURL; */
pub GetDetailsURL: unsafe extern "system" fn (this: *const nsIUpdate, aDetailsURL: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString serviceURL; */
pub GetServiceURL: unsafe extern "system" fn (this: *const nsIUpdate, aServiceURL: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString channel; */
pub GetChannel: unsafe extern "system" fn (this: *const nsIUpdate, aChannel: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute boolean unsupported; */
pub GetUnsupported: unsafe extern "system" fn (this: *const nsIUpdate, aUnsupported: *mut bool) -> ::nserror::nsresult,
/* attribute long long promptWaitTime; */
pub GetPromptWaitTime: unsafe extern "system" fn (this: *const nsIUpdate, aPromptWaitTime: *mut i64) -> ::nserror::nsresult,
/* attribute long long promptWaitTime; */
pub SetPromptWaitTime: unsafe extern "system" fn (this: *const nsIUpdate, aPromptWaitTime: i64) -> ::nserror::nsresult,
/* attribute boolean isCompleteUpdate; */
pub GetIsCompleteUpdate: unsafe extern "system" fn (this: *const nsIUpdate, aIsCompleteUpdate: *mut bool) -> ::nserror::nsresult,
/* attribute boolean isCompleteUpdate; */
pub SetIsCompleteUpdate: unsafe extern "system" fn (this: *const nsIUpdate, aIsCompleteUpdate: bool) -> ::nserror::nsresult,
/* attribute long long installDate; */
pub GetInstallDate: unsafe extern "system" fn (this: *const nsIUpdate, aInstallDate: *mut i64) -> ::nserror::nsresult,
/* attribute long long installDate; */
pub SetInstallDate: unsafe extern "system" fn (this: *const nsIUpdate, aInstallDate: i64) -> ::nserror::nsresult,
/* attribute AString statusText; */
pub GetStatusText: unsafe extern "system" fn (this: *const nsIUpdate, aStatusText: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute AString statusText; */
pub SetStatusText: unsafe extern "system" fn (this: *const nsIUpdate, aStatusText: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute nsIUpdatePatch selectedPatch; */
pub GetSelectedPatch: unsafe extern "system" fn (this: *const nsIUpdate, aSelectedPatch: *mut *const nsIUpdatePatch) -> ::nserror::nsresult,
/* attribute AString state; */
pub GetState: unsafe extern "system" fn (this: *const nsIUpdate, aState: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute AString state; */
pub SetState: unsafe extern "system" fn (this: *const nsIUpdate, aState: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute long errorCode; */
pub GetErrorCode: unsafe extern "system" fn (this: *const nsIUpdate, aErrorCode: *mut i32) -> ::nserror::nsresult,
/* attribute long errorCode; */
pub SetErrorCode: unsafe extern "system" fn (this: *const nsIUpdate, aErrorCode: i32) -> ::nserror::nsresult,
/* attribute boolean elevationFailure; */
pub GetElevationFailure: unsafe extern "system" fn (this: *const nsIUpdate, aElevationFailure: *mut bool) -> ::nserror::nsresult,
/* attribute boolean elevationFailure; */
pub SetElevationFailure: unsafe extern "system" fn (this: *const nsIUpdate, aElevationFailure: bool) -> ::nserror::nsresult,
/* readonly attribute unsigned long patchCount; */
pub GetPatchCount: unsafe extern "system" fn (this: *const nsIUpdate, aPatchCount: *mut u32) -> ::nserror::nsresult,
/* nsIUpdatePatch getPatchAt (in unsigned long index); */
pub GetPatchAt: unsafe extern "system" fn (this: *const nsIUpdate, index: u32, _retval: *mut *const nsIUpdatePatch) -> ::nserror::nsresult,
/* Element serialize (in Document updates); */
pub Serialize: unsafe extern "system" fn (this: *const nsIUpdate, updates: *const libc::c_void, _retval: *mut *const libc::c_void) -> ::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 nsIUpdate {
/// ```text
/// /**
/// * The type of update:
/// * "major" A major new version of the Application
/// * "minor" A minor update to the Application (e.g. security update)
/// */
/// ```
///
/// `readonly attribute AString type;`
#[inline]
pub unsafe fn GetType(&self, aType: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetType)(self, aType)
}
/// ```text
/// /**
/// * The name of the update, or "<Application Name> <Update Version>"
/// */
/// ```
///
/// `readonly attribute AString name;`
#[inline]
pub unsafe fn GetName(&self, aName: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetName)(self, aName)
}
/// ```text
/// /**
/// * The string to display in the user interface for the version. If you want
/// * a real version number use appVersion.
/// */
/// ```
///
/// `readonly attribute AString displayVersion;`
#[inline]
pub unsafe fn GetDisplayVersion(&self, aDisplayVersion: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetDisplayVersion)(self, aDisplayVersion)
}
/// ```text
/// /**
/// * The Application version of this update.
/// */
/// ```
///
/// `readonly attribute AString appVersion;`
#[inline]
pub unsafe fn GetAppVersion(&self, aAppVersion: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetAppVersion)(self, aAppVersion)
}
/// ```text
/// /**
/// * The platform version of this update.
/// */
/// ```
///
/// `readonly attribute AString platformVersion;`
#[inline]
pub unsafe fn GetPlatformVersion(&self, aPlatformVersion: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetPlatformVersion)(self, aPlatformVersion)
}
/// ```text
/// /**
/// * The Application version prior to the application being updated.
/// */
/// ```
///
/// `readonly attribute AString previousAppVersion;`
#[inline]
pub unsafe fn GetPreviousAppVersion(&self, aPreviousAppVersion: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetPreviousAppVersion)(self, aPreviousAppVersion)
}
/// ```text
/// /**
/// * The Build ID of this update. Used to determine a particular build, down
/// * to the hour, minute and second of its creation. This allows the system
/// * to differentiate between several nightly builds with the same |version|
/// * for example.
/// */
/// ```
///
/// `readonly attribute AString buildID;`
#[inline]
pub unsafe fn GetBuildID(&self, aBuildID: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetBuildID)(self, aBuildID)
}
/// ```text
/// /**
/// * The URL to a page which offers details about the content of this
/// * update. Ideally, this page is not the release notes but some other page
/// * that summarizes the differences between this update and the previous,
/// * which also links to the release notes.
/// */
/// ```
///
/// `readonly attribute AString detailsURL;`
#[inline]
pub unsafe fn GetDetailsURL(&self, aDetailsURL: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetDetailsURL)(self, aDetailsURL)
}
/// ```text
/// /**
/// * The URL to the Update Service that supplied this update.
/// */
/// ```
///
/// `readonly attribute AString serviceURL;`
#[inline]
pub unsafe fn GetServiceURL(&self, aServiceURL: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetServiceURL)(self, aServiceURL)
}
/// ```text
/// /**
/// * The channel used to retrieve this update from the Update Service.
/// */
/// ```
///
/// `readonly attribute AString channel;`
#[inline]
pub unsafe fn GetChannel(&self, aChannel: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetChannel)(self, aChannel)
}
/// ```text
/// /**
/// * Whether the update is no longer supported on this system.
/// */
/// ```
///
/// `readonly attribute boolean unsupported;`
#[inline]
pub unsafe fn GetUnsupported(&self, aUnsupported: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetUnsupported)(self, aUnsupported)
}
/// ```text
/// /**
/// * Allows overriding the default amount of time in seconds before prompting the
/// * user to apply an update. If not specified, the value of
/// * app.update.promptWaitTime will be used.
/// */
/// ```
///
/// `attribute long long promptWaitTime;`
#[inline]
pub unsafe fn GetPromptWaitTime(&self, aPromptWaitTime: *mut i64) -> ::nserror::nsresult {
((*self.vtable).GetPromptWaitTime)(self, aPromptWaitTime)
}
/// ```text
/// /**
/// * Allows overriding the default amount of time in seconds before prompting the
/// * user to apply an update. If not specified, the value of
/// * app.update.promptWaitTime will be used.
/// */
/// ```
///
/// `attribute long long promptWaitTime;`
#[inline]
pub unsafe fn SetPromptWaitTime(&self, aPromptWaitTime: i64) -> ::nserror::nsresult {
((*self.vtable).SetPromptWaitTime)(self, aPromptWaitTime)
}
/// ```text
/// /**
/// * Whether or not the update being downloaded is a complete replacement of
/// * the user's existing installation or a patch representing the difference
/// * between the new version and the previous version.
/// */
/// ```
///
/// `attribute boolean isCompleteUpdate;`
#[inline]
pub unsafe fn GetIsCompleteUpdate(&self, aIsCompleteUpdate: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetIsCompleteUpdate)(self, aIsCompleteUpdate)
}
/// ```text
/// /**
/// * Whether or not the update being downloaded is a complete replacement of
/// * the user's existing installation or a patch representing the difference
/// * between the new version and the previous version.
/// */
/// ```
///
/// `attribute boolean isCompleteUpdate;`
#[inline]
pub unsafe fn SetIsCompleteUpdate(&self, aIsCompleteUpdate: bool) -> ::nserror::nsresult {
((*self.vtable).SetIsCompleteUpdate)(self, aIsCompleteUpdate)
}
/// ```text
/// /**
/// * When the update was installed.
/// */
/// ```
///
/// `attribute long long installDate;`
#[inline]
pub unsafe fn GetInstallDate(&self, aInstallDate: *mut i64) -> ::nserror::nsresult {
((*self.vtable).GetInstallDate)(self, aInstallDate)
}
/// ```text
/// /**
/// * When the update was installed.
/// */
/// ```
///
/// `attribute long long installDate;`
#[inline]
pub unsafe fn SetInstallDate(&self, aInstallDate: i64) -> ::nserror::nsresult {
((*self.vtable).SetInstallDate)(self, aInstallDate)
}
/// ```text
/// /**
/// * A message associated with this update, if any.
/// */
/// ```
///
/// `attribute AString statusText;`
#[inline]
pub unsafe fn GetStatusText(&self, aStatusText: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetStatusText)(self, aStatusText)
}
/// ```text
/// /**
/// * A message associated with this update, if any.
/// */
/// ```
///
/// `attribute AString statusText;`
#[inline]
pub unsafe fn SetStatusText(&self, aStatusText: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).SetStatusText)(self, aStatusText)
}
/// ```text
/// /**
/// * The currently selected patch for this update.
/// */
/// ```
///
/// `readonly attribute nsIUpdatePatch selectedPatch;`
#[inline]
pub unsafe fn GetSelectedPatch(&self, aSelectedPatch: *mut *const nsIUpdatePatch) -> ::nserror::nsresult {
((*self.vtable).GetSelectedPatch)(self, aSelectedPatch)
}
/// ```text
/// /**
/// * The state of the selected patch:
/// * "downloading" The update is being downloaded.
/// * "pending" The update is ready to be applied.
/// * "pending-service" The update is ready to be applied with the service.
/// * "pending-elevate" The update is ready to be applied but requires elevation.
/// * "applying" The update is being applied.
/// * "applied" The update is ready to be switched to.
/// * "applied-os" The update is OS update and to be installed.
/// * "applied-service" The update is ready to be switched to with the service.
/// * "succeeded" The update was successfully applied.
/// * "download-failed" The update failed to be downloaded.
/// * "failed" The update failed to be applied.
/// */
/// ```
///
/// `attribute AString state;`
#[inline]
pub unsafe fn GetState(&self, aState: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetState)(self, aState)
}
/// ```text
/// /**
/// * The state of the selected patch:
/// * "downloading" The update is being downloaded.
/// * "pending" The update is ready to be applied.
/// * "pending-service" The update is ready to be applied with the service.
/// * "pending-elevate" The update is ready to be applied but requires elevation.
/// * "applying" The update is being applied.
/// * "applied" The update is ready to be switched to.
/// * "applied-os" The update is OS update and to be installed.
/// * "applied-service" The update is ready to be switched to with the service.
/// * "succeeded" The update was successfully applied.
/// * "download-failed" The update failed to be downloaded.
/// * "failed" The update failed to be applied.
/// */
/// ```
///
/// `attribute AString state;`
#[inline]
pub unsafe fn SetState(&self, aState: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).SetState)(self, aState)
}
/// ```text
/// /**
/// * A numeric error code that conveys additional information about the state of
/// * a failed update. If the update is not in the "failed" state the value is
/// * zero. The possible values are located in common/updatererrors.h and values between
/// * 80 and 99 are in nsUpdateService.js.
/// */
/// ```
///
/// `attribute long errorCode;`
#[inline]
pub unsafe fn GetErrorCode(&self, aErrorCode: *mut i32) -> ::nserror::nsresult {
((*self.vtable).GetErrorCode)(self, aErrorCode)
}
/// ```text
/// /**
/// * A numeric error code that conveys additional information about the state of
/// * a failed update. If the update is not in the "failed" state the value is
/// * zero. The possible values are located in common/updatererrors.h and values between
/// * 80 and 99 are in nsUpdateService.js.
/// */
/// ```
///
/// `attribute long errorCode;`
#[inline]
pub unsafe fn SetErrorCode(&self, aErrorCode: i32) -> ::nserror::nsresult {
((*self.vtable).SetErrorCode)(self, aErrorCode)
}
/// ```text
/// /**
/// * Whether an elevation failure has been encountered for this update.
/// */
/// ```
///
/// `attribute boolean elevationFailure;`
#[inline]
pub unsafe fn GetElevationFailure(&self, aElevationFailure: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetElevationFailure)(self, aElevationFailure)
}
/// ```text
/// /**
/// * Whether an elevation failure has been encountered for this update.
/// */
/// ```
///
/// `attribute boolean elevationFailure;`
#[inline]
pub unsafe fn SetElevationFailure(&self, aElevationFailure: bool) -> ::nserror::nsresult {
((*self.vtable).SetElevationFailure)(self, aElevationFailure)
}
/// ```text
/// /**
/// * The number of patches supplied by this update.
/// */
/// ```
///
/// `readonly attribute unsigned long patchCount;`
#[inline]
pub unsafe fn GetPatchCount(&self, aPatchCount: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetPatchCount)(self, aPatchCount)
}
/// ```text
/// /**
/// * Retrieves a patch.
/// * @param index
/// * The index of the patch to retrieve.
/// * @returns The nsIUpdatePatch at the specified index.
/// */
/// ```
///
/// `nsIUpdatePatch getPatchAt (in unsigned long index);`
#[inline]
pub unsafe fn GetPatchAt(&self, index: u32, _retval: *mut *const nsIUpdatePatch) -> ::nserror::nsresult {
((*self.vtable).GetPatchAt)(self, index, _retval)
}
/// ```text
/// /**
/// * Serializes this update object into a DOM Element
/// * @param updates
/// * The document to serialize into
/// * @returns The DOM Element created by the serialization process
/// */
/// ```
///
/// `Element serialize (in Document updates);`
#[inline]
pub unsafe fn Serialize(&self, updates: *const libc::c_void, _retval: *mut *const libc::c_void) -> ::nserror::nsresult {
((*self.vtable).Serialize)(self, updates, _retval)
}
}
/// `interface nsIUpdateCheckResult : nsISupports`
///
/// ```text
/// /**
/// * An interface describing the result of an update check.
/// */
/// ```
///
// 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 nsIUpdateCheckResult {
vtable: &'static nsIUpdateCheckResultVTable,
/// 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 nsIUpdateCheckResult.
unsafe impl XpCom for nsIUpdateCheckResult {
const IID: nsIID = nsID(0xbff08110, 0xe79f, 0x4a9f,
[0xa5, 0x6c, 0x34, 0x81, 0x70, 0xf9, 0x20, 0x8a]);
}
// 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 nsIUpdateCheckResult {
#[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 nsIUpdateCheckResult.
// 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 nsIUpdateCheckResultCoerce {
/// Cheaply cast a value of this type from a `nsIUpdateCheckResult`.
fn coerce_from(v: &nsIUpdateCheckResult) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIUpdateCheckResultCoerce for nsIUpdateCheckResult {
#[inline]
fn coerce_from(v: &nsIUpdateCheckResult) -> &Self {
v
}
}
impl nsIUpdateCheckResult {
/// Cast this `nsIUpdateCheckResult` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIUpdateCheckResultCoerce>(&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 nsIUpdateCheckResult {
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> nsIUpdateCheckResultCoerce for T {
#[inline]
fn coerce_from(v: &nsIUpdateCheckResult) -> &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 nsIUpdateCheckResult
// 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 nsIUpdateCheckResultVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute boolean checksAllowed; */
pub GetChecksAllowed: unsafe extern "system" fn (this: *const nsIUpdateCheckResult, aChecksAllowed: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean succeeded; */
pub GetSucceeded: unsafe extern "system" fn (this: *const nsIUpdateCheckResult, aSucceeded: *mut bool) -> ::nserror::nsresult,
/* readonly attribute jsval request; */
/// Unable to generate binding because `special type jsval unsupported`
pub GetRequest: *const ::libc::c_void,
/* readonly attribute Array<nsIUpdate> updates; */
pub GetUpdates: unsafe extern "system" fn (this: *const nsIUpdateCheckResult, aUpdates: *mut thin_vec::ThinVec<Option<RefPtr<nsIUpdate>>>) -> ::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 nsIUpdateCheckResult {
/// ```text
/// /**
/// * True if update checks are allowed. otherwise false.
/// */
/// ```
///
/// `readonly attribute boolean checksAllowed;`
#[inline]
pub unsafe fn GetChecksAllowed(&self, aChecksAllowed: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetChecksAllowed)(self, aChecksAllowed)
}
/// ```text
/// /**
/// * True if the update check succeeded, otherwise false. Guaranteed to be false
/// * if checksAllowed is false.
/// */
/// ```
///
/// `readonly attribute boolean succeeded;`
#[inline]
pub unsafe fn GetSucceeded(&self, aSucceeded: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetSucceeded)(self, aSucceeded)
}
/// ```text
/// /**
/// * The XMLHttpRequest handling the update check. Depending on exactly how the
/// * check failed, it's possible for this to be null.
/// */
/// ```
///
/// `readonly attribute jsval request;`
const _GetRequest: () = ();
/// ```text
/// /**
/// * If `!checksAllowed`, this will always be an empty array.
/// *
/// * If `succeeded`, this will be an array of nsIUpdate objects listing
/// * available updates. The length will be 0 if there are no available updates.
/// *
/// * If `checksAllowed && !succeeded`, this will be an array containing exactly
/// * one nsIUpdate object. Most of the attributes will have no useful value
/// * since we did not successfully retrieve an update, but `errorCode` and
/// * `statusText` will be set to values that describe the error encountered when
/// * checking for updates.
/// */
/// ```
///
/// `readonly attribute Array<nsIUpdate> updates;`
#[inline]
pub unsafe fn GetUpdates(&self, aUpdates: *mut thin_vec::ThinVec<Option<RefPtr<nsIUpdate>>>) -> ::nserror::nsresult {
((*self.vtable).GetUpdates)(self, aUpdates)
}
}
/// `interface nsIUpdateCheck : nsISupports`
///
/// ```text
/// /**
/// * An interface describing an update check that may still be in-progress or may
/// * be completed.
/// */
/// ```
///
// 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 nsIUpdateCheck {
vtable: &'static nsIUpdateCheckVTable,
/// 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 nsIUpdateCheck.
unsafe impl XpCom for nsIUpdateCheck {
const IID: nsIID = nsID(0x2620aa24, 0x27aa, 0x463a,
[0xb6, 0xd2, 0x07, 0x34, 0x69, 0x5c, 0x1f, 0x7a]);
}
// 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 nsIUpdateCheck {
#[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 nsIUpdateCheck.
// 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 nsIUpdateCheckCoerce {
/// Cheaply cast a value of this type from a `nsIUpdateCheck`.
fn coerce_from(v: &nsIUpdateCheck) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIUpdateCheckCoerce for nsIUpdateCheck {
#[inline]
fn coerce_from(v: &nsIUpdateCheck) -> &Self {
v
}
}
impl nsIUpdateCheck {
/// Cast this `nsIUpdateCheck` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIUpdateCheckCoerce>(&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 nsIUpdateCheck {
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> nsIUpdateCheckCoerce for T {
#[inline]
fn coerce_from(v: &nsIUpdateCheck) -> &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 nsIUpdateCheck
// 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 nsIUpdateCheckVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute long id; */
pub GetId: unsafe extern "system" fn (this: *const nsIUpdateCheck, aId: *mut i32) -> ::nserror::nsresult,
/* readonly attribute Promise result; */
/// Unable to generate binding because `special type promise unsupported`
pub GetResult: *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 nsIUpdateCheck {
/// ```text
/// /**
/// * An id that represents a particular update check. Can be passed to
/// * nsIUpdateChecker::stopCheck.
/// *
/// * Ids are guaranteed to be truthy (non-zero) and non-repeating. This is
/// * just for caller convenience so that (a) it's not an error to cancel a check
/// * that already completed and (b) they can easily check `if (idVar)` to see if
/// * they stored an id.
/// */
/// ```
///
/// `readonly attribute long id;`
#[inline]
pub unsafe fn GetId(&self, aId: *mut i32) -> ::nserror::nsresult {
((*self.vtable).GetId)(self, aId)
}
/// ```text
/// /**
/// * A promise that resolves to the results of the update check, which will be
/// * of type nsIUpdateCheckResult.
/// */
/// ```
///
/// `readonly attribute Promise result;`
const _GetResult: () = ();
}
/// `interface nsIUpdateCheckerInternal : nsISupports`
///
/// ```text
/// /**
/// * An interface into the internals of the update checker. These should only be
/// * accessed from within update code and tests.
/// */
/// ```
///
// 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 nsIUpdateCheckerInternal {
vtable: &'static nsIUpdateCheckerInternalVTable,
/// 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 nsIUpdateCheckerInternal.
unsafe impl XpCom for nsIUpdateCheckerInternal {
const IID: nsIID = nsID(0xe27f0336, 0xad86, 0x4c31,
[0xbf, 0xee, 0x1d, 0x96, 0x10, 0x05, 0x21, 0xf5]);
}
// 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 nsIUpdateCheckerInternal {
#[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 nsIUpdateCheckerInternal.
// 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 nsIUpdateCheckerInternalCoerce {
/// Cheaply cast a value of this type from a `nsIUpdateCheckerInternal`.
fn coerce_from(v: &nsIUpdateCheckerInternal) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIUpdateCheckerInternalCoerce for nsIUpdateCheckerInternal {
#[inline]
fn coerce_from(v: &nsIUpdateCheckerInternal) -> &Self {
v
}
}
impl nsIUpdateCheckerInternal {
/// Cast this `nsIUpdateCheckerInternal` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIUpdateCheckerInternalCoerce>(&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 nsIUpdateCheckerInternal {
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> nsIUpdateCheckerInternalCoerce for T {
#[inline]
fn coerce_from(v: &nsIUpdateCheckerInternal) -> &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 nsIUpdateCheckerInternal
// 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 nsIUpdateCheckerInternalVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* nsIUpdateCheck checkForUpdates (in long checkType); */
pub CheckForUpdates: unsafe extern "system" fn (this: *const nsIUpdateCheckerInternal, checkType: i32, _retval: *mut *const nsIUpdateCheck) -> ::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 nsIUpdateCheckerInternal {
/// ```text
/// /**
/// * This is identical to the corresponding function in `nsIUpdateChecker`, but
/// * this version does not ensure the update system has been initialized before
/// * being called.
/// */
/// ```
///
/// `nsIUpdateCheck checkForUpdates (in long checkType);`
#[inline]
pub unsafe fn CheckForUpdates(&self, checkType: i32, _retval: *mut *const nsIUpdateCheck) -> ::nserror::nsresult {
((*self.vtable).CheckForUpdates)(self, checkType, _retval)
}
}
/// `interface nsIUpdateChecker : nsISupports`
///
/// ```text
/// /**
/// * An interface describing an object that knows how to check for updates. It can
/// * perform multiple update checks simultaneously or consolidate multiple check
/// * requests into a single web request, depending on whether the parameters
/// * specified for update checking match.
/// */
/// ```
///
// 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 nsIUpdateChecker {
vtable: &'static nsIUpdateCheckerVTable,
/// 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 nsIUpdateChecker.
unsafe impl XpCom for nsIUpdateChecker {
const IID: nsIID = nsID(0x877ace25, 0x8bc5, 0x452a,
[0x85, 0x86, 0x9c, 0x1c, 0xf2, 0x87, 0x19, 0x94]);
}
// 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 nsIUpdateChecker {
#[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 nsIUpdateChecker.
// 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 nsIUpdateCheckerCoerce {
/// Cheaply cast a value of this type from a `nsIUpdateChecker`.
fn coerce_from(v: &nsIUpdateChecker) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIUpdateCheckerCoerce for nsIUpdateChecker {
#[inline]
fn coerce_from(v: &nsIUpdateChecker) -> &Self {
v
}
}
impl nsIUpdateChecker {
/// Cast this `nsIUpdateChecker` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIUpdateCheckerCoerce>(&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 nsIUpdateChecker {
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> nsIUpdateCheckerCoerce for T {
#[inline]
fn coerce_from(v: &nsIUpdateChecker) -> &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 nsIUpdateChecker
// 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 nsIUpdateCheckerVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* nsIUpdateCheck checkForUpdates (in long checkType); */
pub CheckForUpdates: unsafe extern "system" fn (this: *const nsIUpdateChecker, checkType: i32, _retval: *mut *const nsIUpdateCheck) -> ::nserror::nsresult,
/* Promise getUpdateURL (in long checkType); */
/// Unable to generate binding because `special type promise unsupported`
pub GetUpdateURL: *const ::libc::c_void,
/* void stopCheck (in long id); */
pub StopCheck: unsafe extern "system" fn (this: *const nsIUpdateChecker, id: i32) -> ::nserror::nsresult,
/* void stopAllChecks (); */
pub StopAllChecks: unsafe extern "system" fn (this: *const nsIUpdateChecker) -> ::nserror::nsresult,
/* readonly attribute nsIUpdateCheckerInternal internal; */
pub GetInternal: unsafe extern "system" fn (this: *const nsIUpdateChecker, aInternal: *mut *const nsIUpdateCheckerInternal) -> ::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 nsIUpdateChecker {
/// ```text
/// /**
/// * Enumerated constants. See the `checkType` parameter of `checkForUpdates`
/// * for details.
/// */
/// ```
///
pub const BACKGROUND_CHECK: i32 = 1;
pub const FOREGROUND_CHECK: i32 = 2;
/// ```text
/// /**
/// * Checks for available updates.
/// * @param checkType
/// * Must be either BACKGROUND_CHECK or FOREGROUND_CHECK. If
/// * FOREGROUND_CHECK is specified, the normal
/// * nsIApplicationUpdateService.canCheckForUpdates check will be
/// * overridden and the "force" parameter will be included in the
/// * update URL.
/// *
/// * Regarding the "force" parameter:
/// * Sometimes the update server throttles updates, arbitrarily
/// * refraining from returning the newest version to some clients. The
/// * force parameter overrides this behavior and tells it to
/// * unconditionally return the newest available version.
/// *
/// * It's worth noting that the update server technically supports
/// * forcing the decision in the other direction too, preventing
/// * the newest version from being returned, but this interface doesn't
/// * actually support setting the force parameter this way. If the
/// * force parameter is used, it always forces getting the newest
/// * version.
/// * @returns An nsIUpdateCheck object that describes the update check and
/// * provides a Promise that resolves to the update check results.
/// */
/// ```
///
/// `nsIUpdateCheck checkForUpdates (in long checkType);`
#[inline]
pub unsafe fn CheckForUpdates(&self, checkType: i32, _retval: *mut *const nsIUpdateCheck) -> ::nserror::nsresult {
((*self.vtable).CheckForUpdates)(self, checkType, _retval)
}
/// ```text
/// /**
/// * Gets the update URL.
/// * @param checkType
/// * Must be either BACKGROUND_CHECK or FOREGROUND_CHECK. See the
/// * checkType parameter of nsIUpdateChecker.checkForUpdates for more
/// * details.
/// * @returns A Promise that resolves to the URL to be used to check for
/// * updates, as a string. This URL should resolve to an XML describing
/// * the updates that are available to the current Firefox
/// * installation.
/// */
/// ```
///
/// `Promise getUpdateURL (in long checkType);`
const _GetUpdateURL: () = ();
/// ```text
/// /**
/// * Ends a pending update check. Has no effect if the id is invalid or the
/// * check corresponding to the id has already completed.
/// *
/// * Note that because `nsIUpdateChecker` potentially combines multiple update
/// * checks, it is not guaranteed that this will actually cause the update
/// * request to be aborted. It also doesn't guarantee that
/// * `nsIUpdateCheck.result` will resolve when this is called. This merely marks
/// * the check id as cancelled and only if there are no other check ids waiting
/// * on the request does it abort it.
/// *
/// * @param id
/// * The id of a check to stop (accessible via nsIUpdateCheck).
/// */
/// ```
///
/// `void stopCheck (in long id);`
#[inline]
pub unsafe fn StopCheck(&self, id: i32) -> ::nserror::nsresult {
((*self.vtable).StopCheck)(self, id)
}
/// ```text
/// /**
/// * Ends all pending update checks.
/// */
/// ```
///
/// `void stopAllChecks ();`
#[inline]
pub unsafe fn StopAllChecks(&self, ) -> ::nserror::nsresult {
((*self.vtable).StopAllChecks)(self, )
}
/// ```text
/// /**
/// * See nsIUpdateCheckerInternal for details.
/// */
/// ```
///
/// `readonly attribute nsIUpdateCheckerInternal internal;`
#[inline]
pub unsafe fn GetInternal(&self, aInternal: *mut *const nsIUpdateCheckerInternal) -> ::nserror::nsresult {
((*self.vtable).GetInternal)(self, aInternal)
}
}
/// `interface nsIApplicationUpdateServiceInternal : nsISupports`
///
/// ```text
/// /**
/// * An interface into the internals of the update service. These should only be
/// * accessed from within update code and tests.
/// */
/// ```
///
// 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 nsIApplicationUpdateServiceInternal {
vtable: &'static nsIApplicationUpdateServiceInternalVTable,
/// 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 nsIApplicationUpdateServiceInternal.
unsafe impl XpCom for nsIApplicationUpdateServiceInternal {
const IID: nsIID = nsID(0x7f39bc95, 0xeaf8, 0x4adc,
[0x99, 0x0b, 0x0f, 0xc0, 0x73, 0x4f, 0x85, 0xfa]);
}
// 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 nsIApplicationUpdateServiceInternal {
#[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 nsIApplicationUpdateServiceInternal.
// 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 nsIApplicationUpdateServiceInternalCoerce {
/// Cheaply cast a value of this type from a `nsIApplicationUpdateServiceInternal`.
fn coerce_from(v: &nsIApplicationUpdateServiceInternal) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIApplicationUpdateServiceInternalCoerce for nsIApplicationUpdateServiceInternal {
#[inline]
fn coerce_from(v: &nsIApplicationUpdateServiceInternal) -> &Self {
v
}
}
impl nsIApplicationUpdateServiceInternal {
/// Cast this `nsIApplicationUpdateServiceInternal` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIApplicationUpdateServiceInternalCoerce>(&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 nsIApplicationUpdateServiceInternal {
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> nsIApplicationUpdateServiceInternalCoerce for T {
#[inline]
fn coerce_from(v: &nsIApplicationUpdateServiceInternal) -> &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 nsIApplicationUpdateServiceInternal
// 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 nsIApplicationUpdateServiceInternalVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* Promise init (in boolean force); */
/// Unable to generate binding because `special type promise unsupported`
pub Init: *const ::libc::c_void,
/* Promise downloadUpdate (in nsIUpdate update); */
/// Unable to generate binding because `special type promise unsupported`
pub DownloadUpdate: *const ::libc::c_void,
/* Promise stopDownload (); */
/// Unable to generate binding because `special type promise unsupported`
pub StopDownload: *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 nsIApplicationUpdateServiceInternal {
/// ```text
/// /**
/// * To initialize the update system, use the init method on
/// * `nsIApplicationUpdateService` or `nsIApplicationUpdateServiceStub`. This
/// * method is invoked as part of the update initialization process, but is not
/// * an entry point to it.
/// *
/// * @param force
/// * If `true`, run the initialization again, even if we already have.
/// * Should only be used in testing.
/// * @returns Promise<undefined>
/// */
/// ```
///
/// `Promise init (in boolean force);`
const _Init: () = ();
/// ```text
/// /**
/// * These are identical to the corresponding functions in
/// * `nsIApplicationUpdateService`, but these versions do not ensure the update
/// * system has been initialized before being called.
/// */
/// ```
///
/// `Promise downloadUpdate (in nsIUpdate update);`
const _DownloadUpdate: () = ();
/// `Promise stopDownload ();`
const _StopDownload: () = ();
}
/// `interface nsIApplicationUpdateService : nsISupports`
///
/// ```text
/// /**
/// * An interface describing a global application service that handles performing
/// * background update checks and provides utilities for selecting and
/// * downloading update patches.
/// */
/// ```
///
// 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 nsIApplicationUpdateService {
vtable: &'static nsIApplicationUpdateServiceVTable,
/// 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 nsIApplicationUpdateService.
unsafe impl XpCom for nsIApplicationUpdateService {
const IID: nsIID = nsID(0x1107d207, 0xa263, 0x403a,
[0xb2, 0x68, 0x05, 0x77, 0x2e, 0xc1, 0x07, 0x57]);
}
// 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 nsIApplicationUpdateService {
#[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 nsIApplicationUpdateService.
// 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 nsIApplicationUpdateServiceCoerce {
/// Cheaply cast a value of this type from a `nsIApplicationUpdateService`.
fn coerce_from(v: &nsIApplicationUpdateService) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIApplicationUpdateServiceCoerce for nsIApplicationUpdateService {
#[inline]
fn coerce_from(v: &nsIApplicationUpdateService) -> &Self {
v
}
}
impl nsIApplicationUpdateService {
/// Cast this `nsIApplicationUpdateService` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIApplicationUpdateServiceCoerce>(&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 nsIApplicationUpdateService {
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> nsIApplicationUpdateServiceCoerce for T {
#[inline]
fn coerce_from(v: &nsIApplicationUpdateService) -> &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 nsIApplicationUpdateService
// 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 nsIApplicationUpdateServiceVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* Promise init (); */
/// Unable to generate binding because `special type promise unsupported`
pub Init: *const ::libc::c_void,
/* Promise checkForBackgroundUpdates (); */
/// Unable to generate binding because `special type promise unsupported`
pub CheckForBackgroundUpdates: *const ::libc::c_void,
/* Promise selectUpdate (in Array<nsIUpdate> updates); */
/// Unable to generate binding because `special type promise unsupported`
pub SelectUpdate: *const ::libc::c_void,
/* void addDownloadListener (in nsIRequestObserver listener); */
pub AddDownloadListener: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, listener: *const nsIRequestObserver) -> ::nserror::nsresult,
/* void removeDownloadListener (in nsIRequestObserver listener); */
pub RemoveDownloadListener: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, listener: *const nsIRequestObserver) -> ::nserror::nsresult,
/* Promise downloadUpdate (in nsIUpdate update); */
/// Unable to generate binding because `special type promise unsupported`
pub DownloadUpdate: *const ::libc::c_void,
/* Promise onCheckComplete (in nsIUpdateCheckResult result); */
/// Unable to generate binding because `special type promise unsupported`
pub OnCheckComplete: *const ::libc::c_void,
/* Promise stopDownload (); */
/// Unable to generate binding because `special type promise unsupported`
pub StopDownload: *const ::libc::c_void,
/* readonly attribute boolean disabled; */
pub GetDisabled: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aDisabled: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean canUsuallyCheckForUpdates; */
pub GetCanUsuallyCheckForUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCanUsuallyCheckForUpdates: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean canCheckForUpdates; */
pub GetCanCheckForUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCanCheckForUpdates: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean elevationRequired; */
pub GetElevationRequired: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aElevationRequired: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean canUsuallyApplyUpdates; */
pub GetCanUsuallyApplyUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCanUsuallyApplyUpdates: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean canApplyUpdates; */
pub GetCanApplyUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCanApplyUpdates: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean isOtherInstanceHandlingUpdates; */
pub GetIsOtherInstanceHandlingUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aIsOtherInstanceHandlingUpdates: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean canUsuallyStageUpdates; */
pub GetCanUsuallyStageUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCanUsuallyStageUpdates: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean canStageUpdates; */
pub GetCanStageUpdates: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCanStageUpdates: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean canUsuallyUseBits; */
pub GetCanUsuallyUseBits: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCanUsuallyUseBits: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean canUseBits; */
pub GetCanUseBits: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCanUseBits: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean manualUpdateOnly; */
pub GetManualUpdateOnly: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aManualUpdateOnly: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean isAppBaseDirWritable; */
pub GetIsAppBaseDirWritable: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aIsAppBaseDirWritable: *mut bool) -> ::nserror::nsresult,
/* attribute boolean onlyDownloadUpdatesThisSession; */
pub GetOnlyDownloadUpdatesThisSession: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aOnlyDownloadUpdatesThisSession: *mut bool) -> ::nserror::nsresult,
/* attribute boolean onlyDownloadUpdatesThisSession; */
pub SetOnlyDownloadUpdatesThisSession: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aOnlyDownloadUpdatesThisSession: bool) -> ::nserror::nsresult,
/* AString getStateName (in long state); */
pub GetStateName: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, state: i32, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute long currentState; */
pub GetCurrentState: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aCurrentState: *mut i32) -> ::nserror::nsresult,
/* readonly attribute Promise stateTransition; */
/// Unable to generate binding because `special type promise unsupported`
pub GetStateTransition: *const ::libc::c_void,
/* readonly attribute nsIApplicationUpdateServiceInternal internal; */
pub GetInternal: unsafe extern "system" fn (this: *const nsIApplicationUpdateService, aInternal: *mut *const nsIApplicationUpdateServiceInternal) -> ::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 nsIApplicationUpdateService {
/// ```text
/// /**
/// * The below are the possible return values for `downloadUpdate()`.
/// */
/// ```
///
pub const DOWNLOAD_SUCCESS: i32 = 1;
pub const DOWNLOAD_FAILURE_CANNOT_RESUME_IN_BACKGROUND: i32 = 2;
pub const DOWNLOAD_FAILURE_GENERIC: i32 = 3;
/// ```text
/// /**
/// * Enumerated constants describing the update states that the updater can be
/// * in.
/// * Note that update checking is not part of the states that this interface
/// * can recognize and report. This is for two reasons: 1) there are multiple
/// * kinds of update checks (ex: foreground and background) and it would make
/// * the current update state more complicated if we wanted to track both, and
/// * 2) there isn't really any reason to concern ourselves with current update
/// * checks because nsIUpdateChecker will seamlessly combine multiple identical
/// * update checks into a single request without the caller having to worry
/// * about its internal state.
/// */
/// ```
///
pub const STATE_IDLE: i32 = 1;
pub const STATE_DOWNLOADING: i32 = 2;
pub const STATE_STAGING: i32 = 4;
pub const STATE_PENDING: i32 = 5;
pub const STATE_SWAP: i32 = 6;
/// ```text
/// /**
/// * Initializes the update system. It is typically not necessary to call this
/// * since the public methods that require initialization to be meaningful
/// * ensure that initialization has been performed. But this can be useful to
/// * spur the updater to resume or complete any in-progress updates from
/// * previous browser sessions.
/// *
/// * @returns Promise<undefined>
/// */
/// ```
///
/// `Promise init ();`
const _Init: () = ();
/// ```text
/// /**
/// * Checks for available updates in the background using the listener provided
/// * by the application update service for background checks.
/// * @returns A promise resolving to `true` if the update check was started, or
/// * one resolving to `false` if not. Note that the check starting does
/// * not necessarily mean that the check will succeed or that an
/// * update will be downloaded.
/// */
/// ```
///
/// `Promise checkForBackgroundUpdates ();`
const _CheckForBackgroundUpdates: () = ();
/// ```text
/// /**
/// * Selects the best update to install from a list of available updates.
/// * @param updates
/// * An array of updates that are available
/// * @returns Promise<nsIUpdate>
/// * Resolves with the best update to install.
/// */
/// ```
///
/// `Promise selectUpdate (in Array<nsIUpdate> updates);`
const _SelectUpdate: () = ();
/// ```text
/// /**
/// * Adds a listener that receives progress and state information about the
/// * update that is currently being downloaded, e.g. to update a user
/// * interface. Registered listeners will be called for all downloads and all
/// * updates during a browser session; they are not automatically removed
/// * following the first (successful or failed) download.
/// * @param listener
/// * An object implementing nsIRequestObserver and optionally
/// * nsIProgressEventSink that is to be notified of state and
/// * progress information as the update is downloaded.
/// */
/// ```
///
/// `void addDownloadListener (in nsIRequestObserver listener);`
#[inline]
pub unsafe fn AddDownloadListener(&self, listener: *const nsIRequestObserver) -> ::nserror::nsresult {
((*self.vtable).AddDownloadListener)(self, listener)
}
/// ```text
/// /**
/// * Removes a listener that is receiving progress and state information
/// * about the update that is currently being downloaded.
/// * @param listener
/// * The listener object to remove.
/// */
/// ```
///
/// `void removeDownloadListener (in nsIRequestObserver listener);`
#[inline]
pub unsafe fn RemoveDownloadListener(&self, listener: *const nsIRequestObserver) -> ::nserror::nsresult {
((*self.vtable).RemoveDownloadListener)(self, listener)
}
/// ```text
/// /**
/// * Starts downloading the update passed. Once the update is downloaded, it
/// * will automatically be prepared for installation.
/// *
/// * @param update
/// * The update to download.
/// * @returns A promise that resolves with the integer value of one of the
/// * `DOWNLOAD_*` constants above indicating whether or not the
/// * download was started.
/// */
/// ```
///
/// `Promise downloadUpdate (in nsIUpdate update);`
const _DownloadUpdate: () = ();
/// ```text
/// /**
/// * This is the function called internally by the Application Update Service
/// * when an update check is complete. Though this can be used to potentially
/// * start an update download, `downloadUpdate` should used for that.
/// * This is mostly exposed in the interface in order to make it accessible for
/// * testing.
/// */
/// ```
///
/// `Promise onCheckComplete (in nsIUpdateCheckResult result);`
const _OnCheckComplete: () = ();
/// ```text
/// /**
/// * Stop the active update download process. This is the equivalent of
/// * calling nsIRequest::Cancel on the download's nsIRequest. When downloading
/// * with nsIIncrementalDownload, this will leave the partial download in place.
/// * When downloading with BITS, any partial download progress will be removed.
/// *
/// * @returns A Promise that resolves once the download has been stopped.
/// */
/// ```
///
/// `Promise stopDownload ();`
const _StopDownload: () = ();
/// ```text
/// /**
/// * There are a few things that can disable the Firefox updater at runtime
/// * such as Enterprise Policies. If this attribute is set to true, update
/// * should not be performed and most update interfaces will return errors.
/// */
/// ```
///
/// `readonly attribute boolean disabled;`
#[inline]
pub unsafe fn GetDisabled(&self, aDisabled: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetDisabled)(self, aDisabled)
}
/// ```text
/// /**
/// * Whether or not the Update Service can usually check for updates. This is a
/// * function of whether or not application update is disabled by the
/// * application and the platform the application is running on.
/// */
/// ```
///
/// `readonly attribute boolean canUsuallyCheckForUpdates;`
#[inline]
pub unsafe fn GetCanUsuallyCheckForUpdates(&self, aCanUsuallyCheckForUpdates: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetCanUsuallyCheckForUpdates)(self, aCanUsuallyCheckForUpdates)
}
/// ```text
/// /**
/// * Whether or not the Update Service can check for updates right now. This is
/// * a function of whether or not application update is disabled by the
/// * application, the platform the application is running on, and transient
/// * factors such as whether other instances are running.
/// */
/// ```
///
/// `readonly attribute boolean canCheckForUpdates;`
#[inline]
pub unsafe fn GetCanCheckForUpdates(&self, aCanCheckForUpdates: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetCanCheckForUpdates)(self, aCanCheckForUpdates)
}
/// ```text
/// /**
/// * Whether or not the installation requires elevation. Currently only
/// * implemented on OSX, returns false on other platforms.
/// */
/// ```
///
/// `readonly attribute boolean elevationRequired;`
#[inline]
pub unsafe fn GetElevationRequired(&self, aElevationRequired: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetElevationRequired)(self, aElevationRequired)
}
/// ```text
/// /**
/// * Whether or not the Update Service can usually download and install updates.
/// * On Windows, this is a function of whether or not the maintenance service
/// * is installed and enabled. On other systems, and as a fallback on Windows,
/// * this depends on whether the current user has write access to the install
/// * directory.
/// */
/// ```
///
/// `readonly attribute boolean canUsuallyApplyUpdates;`
#[inline]
pub unsafe fn GetCanUsuallyApplyUpdates(&self, aCanUsuallyApplyUpdates: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetCanUsuallyApplyUpdates)(self, aCanUsuallyApplyUpdates)
}
/// ```text
/// /**
/// * Whether or not the Update Service can download and install updates right now.
/// * On Windows, this is a function of whether or not the maintenance service
/// * is installed and enabled. On other systems, and as a fallback on Windows,
/// * this depends on whether the current user has write access to the install
/// * directory. On all systems, this includes transient factors such as whether
/// * other instances are running.
/// */
/// ```
///
/// `readonly attribute boolean canApplyUpdates;`
#[inline]
pub unsafe fn GetCanApplyUpdates(&self, aCanApplyUpdates: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetCanApplyUpdates)(self, aCanApplyUpdates)
}
/// ```text
/// /**
/// * Whether or not a different instance is handling updates of this
/// * installation. This currently only ever returns true on Windows
/// * when 2 instances of an application are open. Only one of the instances
/// * will actually handle updates for the installation.
/// */
/// ```
///
/// `readonly attribute boolean isOtherInstanceHandlingUpdates;`
#[inline]
pub unsafe fn GetIsOtherInstanceHandlingUpdates(&self, aIsOtherInstanceHandlingUpdates: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetIsOtherInstanceHandlingUpdates)(self, aIsOtherInstanceHandlingUpdates)
}
/// ```text
/// /**
/// * Whether the Update Service is usually able to stage updates.
/// */
/// ```
///
/// `readonly attribute boolean canUsuallyStageUpdates;`
#[inline]
pub unsafe fn GetCanUsuallyStageUpdates(&self, aCanUsuallyStageUpdates: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetCanUsuallyStageUpdates)(self, aCanUsuallyStageUpdates)
}
/// ```text
/// /**
/// * Whether the Update Service is able to stage updates right now. On all
/// * systems, this includes transient factors such as whether other instances
/// * are running.
/// */
/// ```
///
/// `readonly attribute boolean canStageUpdates;`
#[inline]
pub unsafe fn GetCanStageUpdates(&self, aCanStageUpdates: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetCanStageUpdates)(self, aCanStageUpdates)
}
/// ```text
/// /**
/// * On Windows, whether the Update Service can usually use BITS.
/// */
/// ```
///
/// `readonly attribute boolean canUsuallyUseBits;`
#[inline]
pub unsafe fn GetCanUsuallyUseBits(&self, aCanUsuallyUseBits: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetCanUsuallyUseBits)(self, aCanUsuallyUseBits)
}
/// ```text
/// /**
/// * On Windows, whether the Update Service can use BITS right now. This
/// * includes transient factors such as whether other instances are running.
/// */
/// ```
///
/// `readonly attribute boolean canUseBits;`
#[inline]
pub unsafe fn GetCanUseBits(&self, aCanUseBits: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetCanUseBits)(self, aCanUseBits)
}
/// ```text
/// /**
/// * Indicates whether or not the enterprise policy that allows only manual
/// * updating is active. One of the features of this policy is not being
/// * notified of updates; you are intended to need to manually tell Firefox
/// * that you want to update each time that you want to do so.
/// *
/// * This policy has some implications for the way that update checks work. We
/// * don't want to do background update checks. Without being able to notify
/// * the user, there's not really anything to do if we find one. However, we
/// * will allow "automatic" update checks when loading the update interfaces
/// * in about:preferences, the About Dialog, etc. When those interfaces are
/// * open, we do have a way of telling the user about an update without
/// * bothering them with a doorhanger.
/// */
/// ```
///
/// `readonly attribute boolean manualUpdateOnly;`
#[inline]
pub unsafe fn GetManualUpdateOnly(&self, aManualUpdateOnly: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetManualUpdateOnly)(self, aManualUpdateOnly)
}
/// ```text
/// /**
/// * Determines if the base directory is writable. If not, we assume that
/// * further permissions are required and that we are dealing with an elevated
/// * installation.
/// */
/// ```
///
/// `readonly attribute boolean isAppBaseDirWritable;`
#[inline]
pub unsafe fn GetIsAppBaseDirWritable(&self, aIsAppBaseDirWritable: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetIsAppBaseDirWritable)(self, aIsAppBaseDirWritable)
}
/// ```text
/// /**
/// * This can be set to true to prevent updates being processed beyond starting
/// * an update download. This should only be used when we are being run as a
/// * background task.
/// * This exists to prevent a particularly fast update download from beginning
/// * to stage while the background task is shutting down.
/// */
/// ```
///
/// `attribute boolean onlyDownloadUpdatesThisSession;`
#[inline]
pub unsafe fn GetOnlyDownloadUpdatesThisSession(&self, aOnlyDownloadUpdatesThisSession: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetOnlyDownloadUpdatesThisSession)(self, aOnlyDownloadUpdatesThisSession)
}
/// ```text
/// /**
/// * This can be set to true to prevent updates being processed beyond starting
/// * an update download. This should only be used when we are being run as a
/// * background task.
/// * This exists to prevent a particularly fast update download from beginning
/// * to stage while the background task is shutting down.
/// */
/// ```
///
/// `attribute boolean onlyDownloadUpdatesThisSession;`
#[inline]
pub unsafe fn SetOnlyDownloadUpdatesThisSession(&self, aOnlyDownloadUpdatesThisSession: bool) -> ::nserror::nsresult {
((*self.vtable).SetOnlyDownloadUpdatesThisSession)(self, aOnlyDownloadUpdatesThisSession)
}
/// ```text
/// /**
/// * Gets a string describing the state (mostly intended to be make console
/// * logs easier to read).
/// */
/// ```
///
/// `AString getStateName (in long state);`
#[inline]
pub unsafe fn GetStateName(&self, state: i32, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetStateName)(self, state, _retval)
}
/// ```text
/// /**
/// * The current state of the application updater. Returns one of the enumerated
/// * constants, above.
/// *
/// * The expected flow looks like this:
/// * STATE_IDLE -> STATE_DOWNLOADING -> STATE_STAGING -> STATE_PENDING
/// * If a failure is encountered at some time, we go back to STATE_IDLE.
/// * If staging is not enabled, STATE_STAGING will be skipped.
/// *
/// * We may download additional updates after we reach STATE_PENDING. If we do,
/// * the state will remain at STATE_PENDING while we download the new update. If
/// * we restart during that time, the pending update will be installed and the
/// * partially downloaded update will be discarded. If a download completes
/// * successfully, there will be a brief period where STATE_PENDING is no longer
/// * correct, because the Update Service is in the process of removing the old
/// * update and replacing it with the new update. So if we restart during that
/// * period, the update will not be correctly installed. Thus, we switch away
/// * from STATE_PENDING to STATE_SWAP during that time. Assuming that the swap
/// * is successful, the state will then switch back STATE_STAGING (assuming that
/// * staging is enabled), then to STATE_PENDING. So the full expected state flow
/// * looks more like this:
/// * STATE_IDLE -> STATE_DOWNLOADING -> STATE_STAGING -> STATE_PENDING ->
/// * STATE_SWAP -> STATE_STAGING -> STATE_PENDING ->
/// * STATE_SWAP -> STATE_STAGING -> STATE_PENDING -> ...
/// * (Omitting STATE_STAGING if staging is not enabled).
/// */
/// ```
///
/// `readonly attribute long currentState;`
#[inline]
pub unsafe fn GetCurrentState(&self, aCurrentState: *mut i32) -> ::nserror::nsresult {
((*self.vtable).GetCurrentState)(self, aCurrentState)
}
/// ```text
/// /**
/// * A Promise that resolves immediately after `currentState` changes.
/// */
/// ```
///
/// `readonly attribute Promise stateTransition;`
const _GetStateTransition: () = ();
/// ```text
/// /**
/// * See nsIApplicationUpdateServiceInternal for details.
/// */
/// ```
///
/// `readonly attribute nsIApplicationUpdateServiceInternal internal;`
#[inline]
pub unsafe fn GetInternal(&self, aInternal: *mut *const nsIApplicationUpdateServiceInternal) -> ::nserror::nsresult {
((*self.vtable).GetInternal)(self, aInternal)
}
}
/// `interface nsIUpdateProcessor : nsISupports`
///
/// ```text
/// /**
/// * An interface describing a component which handles the job of processing
/// * an update after it's been downloaded.
/// */
/// ```
///
// 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 nsIUpdateProcessor {
vtable: &'static nsIUpdateProcessorVTable,
/// 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 nsIUpdateProcessor.
unsafe impl XpCom for nsIUpdateProcessor {
const IID: nsIID = nsID(0x74439497, 0xd796, 0x4915,
[0x8c, 0xef, 0x3d, 0xfe, 0x43, 0x02, 0x7e, 0x4d]);
}
// 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 nsIUpdateProcessor {
#[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 nsIUpdateProcessor.
// 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 nsIUpdateProcessorCoerce {
/// Cheaply cast a value of this type from a `nsIUpdateProcessor`.
fn coerce_from(v: &nsIUpdateProcessor) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIUpdateProcessorCoerce for nsIUpdateProcessor {
#[inline]
fn coerce_from(v: &nsIUpdateProcessor) -> &Self {
v
}
}
impl nsIUpdateProcessor {
/// Cast this `nsIUpdateProcessor` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIUpdateProcessorCoerce>(&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 nsIUpdateProcessor {
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> nsIUpdateProcessorCoerce for T {
#[inline]
fn coerce_from(v: &nsIUpdateProcessor) -> &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 nsIUpdateProcessor
// 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 nsIUpdateProcessorVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void processUpdate (); */
pub ProcessUpdate: unsafe extern "system" fn (this: *const nsIUpdateProcessor) -> ::nserror::nsresult,
/* boolean getServiceRegKeyExists (); */
pub GetServiceRegKeyExists: unsafe extern "system" fn (this: *const nsIUpdateProcessor, _retval: *mut bool) -> ::nserror::nsresult,
/* long attemptAutomaticApplicationRestartWithLaunchArgs (in Array<AString> argvExtra); */
pub AttemptAutomaticApplicationRestartWithLaunchArgs: unsafe extern "system" fn (this: *const nsIUpdateProcessor, argvExtra: *const thin_vec::ThinVec<::nsstring::nsString>, _retval: *mut i32) -> ::nserror::nsresult,
/* void waitForProcessExit (in unsigned long pid, in unsigned long timeoutMS); */
pub WaitForProcessExit: unsafe extern "system" fn (this: *const nsIUpdateProcessor, pid: u32, timeoutMS: u32) -> ::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 nsIUpdateProcessor {
/// ```text
/// /**
/// * Stages an update while the application is running.
/// */
/// ```
///
/// `void processUpdate ();`
#[inline]
pub unsafe fn ProcessUpdate(&self, ) -> ::nserror::nsresult {
((*self.vtable).ProcessUpdate)(self, )
}
/// ```text
/// /**
/// * The installer writes an installation-specific registry key if the
/// * Maintenance Service can be used for this installation. This function checks
/// * for that key's existence (it does not read or verify the key's contents).
/// *
/// * This function should only be called on Windows.
/// *
/// * @returns true if the registry key exists, false if it does not.
/// * @throws NS_ERROR_NOT_AVAILABLE
/// * If registry access fails.
/// * @throws NS_ERROR_NOT_IMPLEMENTED
/// * If this is called on a non-Windows platform.
/// */
/// ```
///
/// `boolean getServiceRegKeyExists ();`
#[inline]
pub unsafe fn GetServiceRegKeyExists(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetServiceRegKeyExists)(self, _retval)
}
/// ```text
/// /**
/// * Attempts to restart the application manually on program exit with the same
/// * arguments it was started with, while accepting additional arguments.
/// *
/// * This function should only be called on Windows.
/// *
/// * @param argvExtra
/// * An array of strings to be passed to the application upon
/// * restart as additional arguments.
/// * @returns pidRet
/// * Returns the pid of a newly spawned child process. This value
/// * is only valid if the function returns successfully.
/// * @throws NS_ERROR_ABORT
/// * If the child process failed to spawn correctly.
/// * @throws NS_ERROR_NOT_IMPLEMENTED
/// * If this is called on a non-Windows platform.
/// * @throws NS_ERROR_NOT_AVAILABLE
/// * If the command line cannot be read.
/// */
/// ```
///
/// `long attemptAutomaticApplicationRestartWithLaunchArgs (in Array<AString> argvExtra);`
#[inline]
pub unsafe fn AttemptAutomaticApplicationRestartWithLaunchArgs(&self, argvExtra: *const thin_vec::ThinVec<::nsstring::nsString>, _retval: *mut i32) -> ::nserror::nsresult {
((*self.vtable).AttemptAutomaticApplicationRestartWithLaunchArgs)(self, argvExtra, _retval)
}
/// ```text
/// /**
/// * This function is meant to be used in conjunction with
/// * RegisterApplicationRestartWithLaunchArgs() if you want the child process
/// * that invokes this function to wait for the parent process
/// * to finish execution. When the application has the argument
/// * -restart-pid <pid> this function waits for the application with
/// * <pid> to exit.
/// *
/// * This function should only be called on Windows.
/// *
/// * @param pid
/// * Which process ID to wait for.
/// * @param timeoutMS
/// * How long to wait for the process to exit in milliseconds.
/// * @throws NS_OK
/// * On successful wait.
/// * @throws NS_ERROR_NOT_IMPLEMENTED
/// * If this is called on a non-Windows platform.
/// * @throws NS_ERROR_INVALID_ARG
/// * If -restart-pid has no pid parameter.
/// * @throws NS_ERROR_ILLEGAL_VALUE
/// * If pid cannot be converted into unsigned int.
/// * @throws NS_ERROR_FAILURE
/// * If timeout elapses without process exit.
/// */
/// ```
///
/// `void waitForProcessExit (in unsigned long pid, in unsigned long timeoutMS);`
#[inline]
pub unsafe fn WaitForProcessExit(&self, pid: u32, timeoutMS: u32) -> ::nserror::nsresult {
((*self.vtable).WaitForProcessExit)(self, pid, timeoutMS)
}
}
/// `interface nsIUpdateSyncManager : nsISupports`
///
/// ```text
/// /**
/// * Upon creation, which should happen early during startup, the sync manager
/// * creates/opens and locks a file. All other running instances of the same
/// * installation of the app also open the same lock, so we can use it to
/// * determine whether any other instance is running. If so, we'll temporarily
/// * hold off on performing update tasks until there are no other instances or
/// * until a timeout expires, whichever comes first. That way we can avoid
/// * updating behind the back of copies that are still running, so we don't force
/// * all running instances to restart (see bug 1366808, where an error was added
/// * informing the user of the need to restart any running instances that have
/// * been updated).
/// */
/// ```
///
// 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 nsIUpdateSyncManager {
vtable: &'static nsIUpdateSyncManagerVTable,
/// 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 nsIUpdateSyncManager.
unsafe impl XpCom for nsIUpdateSyncManager {
const IID: nsIID = nsID(0xcf4c4487, 0x66d9, 0x4e18,
[0xa2, 0xe9, 0x39, 0x00, 0x22, 0x45, 0x33, 0x2f]);
}
// 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 nsIUpdateSyncManager {
#[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 nsIUpdateSyncManager.
// 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 nsIUpdateSyncManagerCoerce {
/// Cheaply cast a value of this type from a `nsIUpdateSyncManager`.
fn coerce_from(v: &nsIUpdateSyncManager) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIUpdateSyncManagerCoerce for nsIUpdateSyncManager {
#[inline]
fn coerce_from(v: &nsIUpdateSyncManager) -> &Self {
v
}
}
impl nsIUpdateSyncManager {
/// Cast this `nsIUpdateSyncManager` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIUpdateSyncManagerCoerce>(&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 nsIUpdateSyncManager {
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> nsIUpdateSyncManagerCoerce for T {
#[inline]
fn coerce_from(v: &nsIUpdateSyncManager) -> &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 nsIUpdateSyncManager
// 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 nsIUpdateSyncManagerVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* boolean isOtherInstanceRunning (); */
pub IsOtherInstanceRunning: unsafe extern "system" fn (this: *const nsIUpdateSyncManager, _retval: *mut bool) -> ::nserror::nsresult,
/* void resetLock ([optional] in nsIFile anAppFile); */
pub ResetLock: unsafe extern "system" fn (this: *const nsIUpdateSyncManager, anAppFile: *const nsIFile) -> ::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 nsIUpdateSyncManager {
/// ```text
/// /**
/// * Returns whether another instance of this application is running.
/// * @returns true if another instance has the lock open, false if not
/// */
/// ```
///
/// `boolean isOtherInstanceRunning ();`
#[inline]
pub unsafe fn IsOtherInstanceRunning(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).IsOtherInstanceRunning)(self, _retval)
}
/// ```text
/// /**
/// * Should only be used for testing.
/// *
/// * Closes and reopens the lock file, possibly under a different name if a
/// * parameter is given (or the path hash has changed, which should only happen
/// * if a test is forcing it).
/// */
/// ```
///
/// `void resetLock ([optional] in nsIFile anAppFile);`
#[inline]
pub unsafe fn ResetLock(&self, anAppFile: *const nsIFile) -> ::nserror::nsresult {
((*self.vtable).ResetLock)(self, anAppFile)
}
}
/// `interface nsIUpdateMutex : nsISupports`
///
/// ```text
/// /**
/// * An object interface suitable for acquiring the update mutex for the current
/// * installation path.
/// *
/// * The update mutex gives protection against 2 instances running from the same
/// * installation path updating at the same time:
/// * 1) By running multiple profiles from the same installation path.
/// * 2) By running in 2 different user sessions from the same installation path.
/// *
/// * nsIUpdateMutex objects do not hold the update mutex when they are created:
/// * acquiring the update mutex requires an explicit call to tryLock().
/// *
/// * The update mutex is automatically released if the application instance
/// * holding it dies. This is guaranteed by the primitives that are used under
/// * the hood by nsIUpdateMutex objects.
/// *
/// * nsIUpdateMutex objects are independent of one another. If acquisition is
/// * successful through one object, any attempt to acquire the update mutex
/// * through another object will fail, until the update mutex is released
/// * through the first object or the instance where the object lives dies. This
/// * applies even if both objects live in the same instance.
/// */
/// ```
///
// 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 nsIUpdateMutex {
vtable: &'static nsIUpdateMutexVTable,
/// 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 nsIUpdateMutex.
unsafe impl XpCom for nsIUpdateMutex {
const IID: nsIID = nsID(0xdbfa19d2, 0xf3d3, 0x4354,
[0xa9, 0x92, 0xe9, 0x9f, 0x75, 0xc2, 0x2c, 0x4a]);
}
// 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 nsIUpdateMutex {
#[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 nsIUpdateMutex.
// 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 nsIUpdateMutexCoerce {
/// Cheaply cast a value of this type from a `nsIUpdateMutex`.
fn coerce_from(v: &nsIUpdateMutex) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIUpdateMutexCoerce for nsIUpdateMutex {
#[inline]
fn coerce_from(v: &nsIUpdateMutex) -> &Self {
v
}
}
impl nsIUpdateMutex {
/// Cast this `nsIUpdateMutex` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIUpdateMutexCoerce>(&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 nsIUpdateMutex {
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> nsIUpdateMutexCoerce for T {
#[inline]
fn coerce_from(v: &nsIUpdateMutex) -> &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 nsIUpdateMutex
// 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 nsIUpdateMutexVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* boolean isLocked (); */
pub IsLocked: unsafe extern "system" fn (this: *const nsIUpdateMutex, _retval: *mut bool) -> ::nserror::nsresult,
/* boolean tryLock (); */
pub TryLock: unsafe extern "system" fn (this: *const nsIUpdateMutex, _retval: *mut bool) -> ::nserror::nsresult,
/* void unlock (); */
pub Unlock: unsafe extern "system" fn (this: *const nsIUpdateMutex) -> ::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 nsIUpdateMutex {
/// ```text
/// /**
/// * Checks the current acquisition status for the current object.
/// *
/// * @returns true if the update mutex for the current installation is being
/// * held by the current instance through the current object.
/// */
/// ```
///
/// `boolean isLocked ();`
#[inline]
pub unsafe fn IsLocked(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).IsLocked)(self, _retval)
}
/// ```text
/// /**
/// * Attempts to acquire the update mutex for the current installation path.
/// *
/// * @returns true if the update mutex was successfully acquired or was already
/// * held by the current instance through the current object.
/// */
/// ```
///
/// `boolean tryLock ();`
#[inline]
pub unsafe fn TryLock(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).TryLock)(self, _retval)
}
/// ```text
/// /**
/// * Manually releases the update mutex for the current installation path. Does
/// * nothing if the update mutex is not being held by the current instance
/// * through the current object.
/// */
/// ```
///
/// `void unlock ();`
#[inline]
pub unsafe fn Unlock(&self, ) -> ::nserror::nsresult {
((*self.vtable).Unlock)(self, )
}
}
/// `interface nsIUpdateManagerInternal : nsISupports`
///
/// ```text
/// /**
/// * An interface into the internals of the update manager. These should only be
/// * accessed from within update code and tests.
/// */
/// ```
///
// 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 nsIUpdateManagerInternal {
vtable: &'static nsIUpdateManagerInternalVTable,
/// 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 nsIUpdateManagerInternal.
unsafe impl XpCom for nsIUpdateManagerInternal {
const IID: nsIID = nsID(0xa5739dda, 0xb94f, 0x47e1,
[0xa6, 0xf3, 0x22, 0x4d, 0x46, 0xd6, 0xcb, 0x8c]);
}
// 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 nsIUpdateManagerInternal {
#[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 nsIUpdateManagerInternal.
// 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 nsIUpdateManagerInternalCoerce {
/// Cheaply cast a value of this type from a `nsIUpdateManagerInternal`.
fn coerce_from(v: &nsIUpdateManagerInternal) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIUpdateManagerInternalCoerce for nsIUpdateManagerInternal {
#[inline]
fn coerce_from(v: &nsIUpdateManagerInternal) -> &Self {
v
}
}
impl nsIUpdateManagerInternal {
/// Cast this `nsIUpdateManagerInternal` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIUpdateManagerInternalCoerce>(&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 nsIUpdateManagerInternal {
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> nsIUpdateManagerInternalCoerce for T {
#[inline]
fn coerce_from(v: &nsIUpdateManagerInternal) -> &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 nsIUpdateManagerInternal
// 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 nsIUpdateManagerInternalVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* Promise reload (in boolean skipFiles); */
/// Unable to generate binding because `special type promise unsupported`
pub Reload: *const ::libc::c_void,
/* Array<nsIUpdate> getHistory (); */
pub GetHistory: unsafe extern "system" fn (this: *const nsIUpdateManagerInternal, _retval: *mut thin_vec::ThinVec<Option<RefPtr<nsIUpdate>>>) -> ::nserror::nsresult,
/* void addUpdateToHistory (in nsIUpdate update); */
pub AddUpdateToHistory: unsafe extern "system" fn (this: *const nsIUpdateManagerInternal, update: *const nsIUpdate) -> ::nserror::nsresult,
/* attribute nsIUpdate readyUpdate; */
pub GetReadyUpdate: unsafe extern "system" fn (this: *const nsIUpdateManagerInternal, aReadyUpdate: *mut *const nsIUpdate) -> ::nserror::nsresult,
/* attribute nsIUpdate readyUpdate; */
pub SetReadyUpdate: unsafe extern "system" fn (this: *const nsIUpdateManagerInternal, aReadyUpdate: *const nsIUpdate) -> ::nserror::nsresult,
/* attribute nsIUpdate downloadingUpdate; */
pub GetDownloadingUpdate: unsafe extern "system" fn (this: *const nsIUpdateManagerInternal, aDownloadingUpdate: *mut *const nsIUpdate) -> ::nserror::nsresult,
/* attribute nsIUpdate downloadingUpdate; */
pub SetDownloadingUpdate: unsafe extern "system" fn (this: *const nsIUpdateManagerInternal, aDownloadingUpdate: *const nsIUpdate) -> ::nserror::nsresult,
/* Promise refreshUpdateStatus (); */
/// Unable to generate binding because `special type promise unsupported`
pub RefreshUpdateStatus: *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 nsIUpdateManagerInternal {
/// ```text
/// /**
/// * Reloads the update manager's data.
/// * @param skipFiles
/// * If `true`, don't reload data from the XMLs, just clear out existing
/// * data.
/// *
/// * @returns Promise<undefined>
/// */
/// ```
///
/// `Promise reload (in boolean skipFiles);`
const _Reload: () = ();
/// ```text
/// /**
/// * These are identical to the functions with the same name in
/// * `nsIUpdateManager`, but these versions do not ensure the update system has
/// * been initialized before being called.
/// */
/// ```
///
/// `Array<nsIUpdate> getHistory ();`
#[inline]
pub unsafe fn GetHistory(&self, _retval: *mut thin_vec::ThinVec<Option<RefPtr<nsIUpdate>>>) -> ::nserror::nsresult {
((*self.vtable).GetHistory)(self, _retval)
}
/// `void addUpdateToHistory (in nsIUpdate update);`
#[inline]
pub unsafe fn AddUpdateToHistory(&self, update: *const nsIUpdate) -> ::nserror::nsresult {
((*self.vtable).AddUpdateToHistory)(self, update)
}
/// `attribute nsIUpdate readyUpdate;`
#[inline]
pub unsafe fn GetReadyUpdate(&self, aReadyUpdate: *mut *const nsIUpdate) -> ::nserror::nsresult {
((*self.vtable).GetReadyUpdate)(self, aReadyUpdate)
}
/// `attribute nsIUpdate readyUpdate;`
#[inline]
pub unsafe fn SetReadyUpdate(&self, aReadyUpdate: *const nsIUpdate) -> ::nserror::nsresult {
((*self.vtable).SetReadyUpdate)(self, aReadyUpdate)
}
/// `attribute nsIUpdate downloadingUpdate;`
#[inline]
pub unsafe fn GetDownloadingUpdate(&self, aDownloadingUpdate: *mut *const nsIUpdate) -> ::nserror::nsresult {
((*self.vtable).GetDownloadingUpdate)(self, aDownloadingUpdate)
}
/// `attribute nsIUpdate downloadingUpdate;`
#[inline]
pub unsafe fn SetDownloadingUpdate(&self, aDownloadingUpdate: *const nsIUpdate) -> ::nserror::nsresult {
((*self.vtable).SetDownloadingUpdate)(self, aDownloadingUpdate)
}
/// `Promise refreshUpdateStatus ();`
const _RefreshUpdateStatus: () = ();
}
/// `interface nsIUpdateManager : nsISupports`
///
/// ```text
/// /**
/// * An interface describing a global application service that maintains a list
/// * of updates previously performed as well as the current active update.
/// */
/// ```
///
// 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 nsIUpdateManager {
vtable: &'static nsIUpdateManagerVTable,
/// 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 nsIUpdateManager.
unsafe impl XpCom for nsIUpdateManager {
const IID: nsIID = nsID(0x0f1098e9, 0xa447, 0x4af9,
[0xb0, 0x30, 0x6f, 0x8f, 0x35, 0xc8, 0x5f, 0x89]);
}
// 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 nsIUpdateManager {
#[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 nsIUpdateManager.
// 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 nsIUpdateManagerCoerce {
/// Cheaply cast a value of this type from a `nsIUpdateManager`.
fn coerce_from(v: &nsIUpdateManager) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIUpdateManagerCoerce for nsIUpdateManager {
#[inline]
fn coerce_from(v: &nsIUpdateManager) -> &Self {
v
}
}
impl nsIUpdateManager {
/// Cast this `nsIUpdateManager` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIUpdateManagerCoerce>(&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 nsIUpdateManager {
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> nsIUpdateManagerCoerce for T {
#[inline]
fn coerce_from(v: &nsIUpdateManager) -> &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 nsIUpdateManager
// 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 nsIUpdateManagerVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* Promise getHistory (); */
/// Unable to generate binding because `special type promise unsupported`
pub GetHistory: *const ::libc::c_void,
/* Promise getReadyUpdate (); */
/// Unable to generate binding because `special type promise unsupported`
pub GetReadyUpdate: *const ::libc::c_void,
/* Promise getDownloadingUpdate (); */
/// Unable to generate binding because `special type promise unsupported`
pub GetDownloadingUpdate: *const ::libc::c_void,
/* Promise updateInstalledAtStartup (); */
/// Unable to generate binding because `special type promise unsupported`
pub UpdateInstalledAtStartup: *const ::libc::c_void,
/* Promise lastUpdateInstalled (); */
/// Unable to generate binding because `special type promise unsupported`
pub LastUpdateInstalled: *const ::libc::c_void,
/* Promise addUpdateToHistory (in nsIUpdate update); */
/// Unable to generate binding because `special type promise unsupported`
pub AddUpdateToHistory: *const ::libc::c_void,
/* void saveUpdates (); */
pub SaveUpdates: unsafe extern "system" fn (this: *const nsIUpdateManager) -> ::nserror::nsresult,
/* Promise refreshUpdateStatus (); */
/// Unable to generate binding because `special type promise unsupported`
pub RefreshUpdateStatus: *const ::libc::c_void,
/* Promise elevationOptedIn (); */
/// Unable to generate binding because `special type promise unsupported`
pub ElevationOptedIn: *const ::libc::c_void,
/* Promise cleanupDownloadingUpdate (); */
/// Unable to generate binding because `special type promise unsupported`
pub CleanupDownloadingUpdate: *const ::libc::c_void,
/* Promise cleanupReadyUpdate (); */
/// Unable to generate binding because `special type promise unsupported`
pub CleanupReadyUpdate: *const ::libc::c_void,
/* Promise cleanupActiveUpdates (); */
/// Unable to generate binding because `special type promise unsupported`
pub CleanupActiveUpdates: *const ::libc::c_void,
/* Promise doInstallCleanup (); */
/// Unable to generate binding because `special type promise unsupported`
pub DoInstallCleanup: *const ::libc::c_void,
/* Promise doUninstallCleanup (); */
/// Unable to generate binding because `special type promise unsupported`
pub DoUninstallCleanup: *const ::libc::c_void,
/* readonly attribute nsIUpdateManagerInternal internal; */
pub GetInternal: unsafe extern "system" fn (this: *const nsIUpdateManager, aInternal: *mut *const nsIUpdateManagerInternal) -> ::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 nsIUpdateManager {
/// ```text
/// /**
/// * @returns Promise<Array<nsIUpdate>>
/// * Resolves with an array describing the update history. The first
/// * element in the array represents the most recent item in the
/// * history.
/// */
/// ```
///
/// `Promise getHistory ();`
const _GetHistory: () = ();
/// ```text
/// /**
/// * Returns a Promise that resolves with the nsIUpdate that has been
/// * downloaded, or null if there isn't one.
/// */
/// ```
///
/// `Promise getReadyUpdate ();`
const _GetReadyUpdate: () = ();
/// ```text
/// /**
/// * Returns a Promise that resolves with the nsIUpdate that is currently
/// * downloading, or null if there isn't one.
/// * An update is no longer considered to be downloading once onStopRequest is
/// * called. This means that both onStopRequest handlers for download listeners
/// * and observers of the "update-downloaded" topic should expect the update
/// * that was just downloaded to be stored in readyUpdate, not
/// * downloadingUpdate.
/// */
/// ```
///
/// `Promise getDownloadingUpdate ();`
const _GetDownloadingUpdate: () = ();
/// ```text
/// /**
/// * Returns a Promise that resolves with the update that Firefox installed at the
/// * launch of the current session. If no update was installed, null will be returned
/// * @returns Promise<nsIUpdate>
/// */
/// ```
///
/// `Promise updateInstalledAtStartup ();`
const _UpdateInstalledAtStartup: () = ();
/// ```text
/// /**
/// * Returns a Promise that resolves with the most recent update that has been installed,
/// * the value will be null if it does not exist
/// * @returns Promise<nsIUpdate>
/// */
/// ```
///
/// `Promise lastUpdateInstalled ();`
const _LastUpdateInstalled: () = ();
/// ```text
/// /**
/// * Adds the specified update to the update history. The update history is
/// * limited to 10 items, so this may also remove the last item from the
/// * history.
/// * @param update
/// * The update to add to the history.
/// * @returns Promise<undefined>
/// */
/// ```
///
/// `Promise addUpdateToHistory (in nsIUpdate update);`
const _AddUpdateToHistory: () = ();
/// ```text
/// /**
/// * Saves all updates to disk.
/// */
/// ```
///
/// `void saveUpdates ();`
#[inline]
pub unsafe fn SaveUpdates(&self, ) -> ::nserror::nsresult {
((*self.vtable).SaveUpdates)(self, )
}
/// ```text
/// /**
/// * Refresh the update status based on the information in update.status.
/// *
/// * @returns A Promise that resolves after the update status is refreshed.
/// */
/// ```
///
/// `Promise refreshUpdateStatus ();`
const _RefreshUpdateStatus: () = ();
/// ```text
/// /**
/// * The user agreed to proceed with an elevated update and we are now
/// * permitted to show an elevation prompt.
/// *
/// * @returns Promise<undefined>
/// */
/// ```
///
/// `Promise elevationOptedIn ();`
const _ElevationOptedIn: () = ();
/// ```text
/// /**
/// * These functions clean up and remove an active update without applying
/// * it. The first function does this for the update that is currently being
/// * downloaded. The second function does this for the update that has already
/// * been downloaded. The third function does this for both updates.
/// * @returns Promise<undefined>
/// */
/// ```
///
/// `Promise cleanupDownloadingUpdate ();`
const _CleanupDownloadingUpdate: () = ();
/// `Promise cleanupReadyUpdate ();`
const _CleanupReadyUpdate: () = ();
/// `Promise cleanupActiveUpdates ();`
const _CleanupActiveUpdates: () = ();
/// ```text
/// /**
/// * Runs cleanup that ought to happen on a Firefox paveover install to
/// * prevent a stale update from being processed when Firefox is first
/// * launched.
/// * This is best-effort. It will not throw on cleanup failure.
/// *
/// * The returned promise does not resolve with any particular value. It simply
/// * conveys that the cleanup has completed.
/// */
/// ```
///
/// `Promise doInstallCleanup ();`
const _DoInstallCleanup: () = ();
/// ```text
/// /**
/// * Runs cleanup that ought to happen when Firefox is uninstalled to clean up
/// * old update data that is no longer needed.
/// * This is best-effort. It will not throw on cleanup failure.
/// *
/// * The returned promise does not resolve with any particular value. It simply
/// * conveys that the cleanup has completed.
/// */
/// ```
///
/// `Promise doUninstallCleanup ();`
const _DoUninstallCleanup: () = ();
/// ```text
/// /**
/// * See nsIUpdateManagerInternal for details.
/// */
/// ```
///
/// `readonly attribute nsIUpdateManagerInternal internal;`
#[inline]
pub unsafe fn GetInternal(&self, aInternal: *mut *const nsIUpdateManagerInternal) -> ::nserror::nsresult {
((*self.vtable).GetInternal)(self, aInternal)
}
}
/// `interface nsIApplicationUpdateServiceStub : nsISupports`
///
/// ```text
/// /**
/// * A lightweight interface that we can load early in startup that gives us very
/// * limited access to the update system without the startup costs of loading
/// * nsIApplicationUpdateService.
/// */
/// ```
///
// 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 nsIApplicationUpdateServiceStub {
vtable: &'static nsIApplicationUpdateServiceStubVTable,
/// 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 nsIApplicationUpdateServiceStub.
unsafe impl XpCom for nsIApplicationUpdateServiceStub {
const IID: nsIID = nsID(0x3ca17ada, 0x8501, 0x496f,
[0xbb, 0xe7, 0x6a, 0x9f, 0x1c, 0x28, 0xeb, 0x2d]);
}
// 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 nsIApplicationUpdateServiceStub {
#[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 nsIApplicationUpdateServiceStub.
// 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 nsIApplicationUpdateServiceStubCoerce {
/// Cheaply cast a value of this type from a `nsIApplicationUpdateServiceStub`.
fn coerce_from(v: &nsIApplicationUpdateServiceStub) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIApplicationUpdateServiceStubCoerce for nsIApplicationUpdateServiceStub {
#[inline]
fn coerce_from(v: &nsIApplicationUpdateServiceStub) -> &Self {
v
}
}
impl nsIApplicationUpdateServiceStub {
/// Cast this `nsIApplicationUpdateServiceStub` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIApplicationUpdateServiceStubCoerce>(&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 nsIApplicationUpdateServiceStub {
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> nsIApplicationUpdateServiceStubCoerce for T {
#[inline]
fn coerce_from(v: &nsIApplicationUpdateServiceStub) -> &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 nsIApplicationUpdateServiceStub
// 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 nsIApplicationUpdateServiceStubVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* Promise init (); */
/// Unable to generate binding because `special type promise unsupported`
pub Init: *const ::libc::c_void,
/* Promise initUpdate (); */
/// Unable to generate binding because `special type promise unsupported`
pub InitUpdate: *const ::libc::c_void,
/* readonly attribute boolean updateDisabled; */
pub GetUpdateDisabled: unsafe extern "system" fn (this: *const nsIApplicationUpdateServiceStub, aUpdateDisabled: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean updateDisabledForTesting; */
pub GetUpdateDisabledForTesting: unsafe extern "system" fn (this: *const nsIApplicationUpdateServiceStub, aUpdateDisabledForTesting: *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 nsIApplicationUpdateServiceStub {
/// ```text
/// /**
/// * This does the standard initialization of the update service stub. The
/// * primary effect of this is to initialize the update system (the same effect
/// * as `initUpdate`), but only if there are updates from a previous browser
/// * session. This allows us to avoid loading the update system so early if it
/// * would just be sitting idle until the update timer fires or the user visits
/// * the update UI.
/// *
/// * @returns Promise<undefined>
/// */
/// ```
///
/// `Promise init ();`
const _Init: () = ();
/// ```text
/// /**
/// * This is identical to `nsIApplicationUpdateService.init()`.
/// *
/// * @returns Promise<undefined>
/// */
/// ```
///
/// `Promise initUpdate ();`
const _InitUpdate: () = ();
/// ```text
/// /**
/// * This is identical to `nsIApplicationUpdateService.disabled`.
/// */
/// ```
///
/// `readonly attribute boolean updateDisabled;`
#[inline]
pub unsafe fn GetUpdateDisabled(&self, aUpdateDisabled: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetUpdateDisabled)(self, aUpdateDisabled)
}
/// ```text
/// /**
/// * This will be `true` if update is disabled specifically because we are
/// * running a test that didn't opt-in to updating.
/// */
/// ```
///
/// `readonly attribute boolean updateDisabledForTesting;`
#[inline]
pub unsafe fn GetUpdateDisabledForTesting(&self, aUpdateDisabledForTesting: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetUpdateDisabledForTesting)(self, aUpdateDisabledForTesting)
}
}