diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /xpcom/system | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xpcom/system')
-rw-r--r-- | xpcom/system/moz.build | 24 | ||||
-rw-r--r-- | xpcom/system/nsIBlocklistService.idl | 24 | ||||
-rw-r--r-- | xpcom/system/nsICrashReporter.idl | 175 | ||||
-rw-r--r-- | xpcom/system/nsIDeviceSensors.idl | 60 | ||||
-rw-r--r-- | xpcom/system/nsIGIOService.idl | 89 | ||||
-rw-r--r-- | xpcom/system/nsIGSettingsService.idl | 30 | ||||
-rw-r--r-- | xpcom/system/nsIGeolocationProvider.idl | 82 | ||||
-rw-r--r-- | xpcom/system/nsIHapticFeedback.idl | 22 | ||||
-rw-r--r-- | xpcom/system/nsIPlatformInfo.idl | 19 | ||||
-rw-r--r-- | xpcom/system/nsISystemInfo.idl | 40 | ||||
-rw-r--r-- | xpcom/system/nsIXULAppInfo.idl | 64 | ||||
-rw-r--r-- | xpcom/system/nsIXULRuntime.idl | 393 |
12 files changed, 1022 insertions, 0 deletions
diff --git a/xpcom/system/moz.build b/xpcom/system/moz.build new file mode 100644 index 0000000000..ced4fa16d2 --- /dev/null +++ b/xpcom/system/moz.build @@ -0,0 +1,24 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + "nsIBlocklistService.idl", + "nsICrashReporter.idl", + "nsIDeviceSensors.idl", + "nsIGeolocationProvider.idl", + "nsIGIOService.idl", + "nsIGSettingsService.idl", + "nsIHapticFeedback.idl", + "nsIPlatformInfo.idl", + "nsISystemInfo.idl", + "nsIXULAppInfo.idl", + "nsIXULRuntime.idl", +] + +XPIDL_MODULE = "xpcom_system" + +with Files("nsIBlocklistService.idl"): + BUG_COMPONENT = ("Toolkit", "Blocklist Implementation") diff --git a/xpcom/system/nsIBlocklistService.idl b/xpcom/system/nsIBlocklistService.idl new file mode 100644 index 0000000000..37fb864111 --- /dev/null +++ b/xpcom/system/nsIBlocklistService.idl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "nsISupports.idl" + +[scriptable, uuid(a6dcc76e-9f62-4cc1-a470-b483a1a6f096)] +interface nsIBlocklistService : nsISupports +{ + // Indicates that the item does not appear in the blocklist. + const unsigned long STATE_NOT_BLOCKED = 0; + // Indicates that the item is in the blocklist but the problem is not severe + // enough to warant forcibly blocking. + const unsigned long STATE_SOFTBLOCKED = 1; + // Indicates that the item should be blocked and never used. + const unsigned long STATE_BLOCKED = 2; + + // Unused; Please increment if we add more blocklist states. + const unsigned long STATE_MAX = 3; + + readonly attribute boolean isLoaded; +}; diff --git a/xpcom/system/nsICrashReporter.idl b/xpcom/system/nsICrashReporter.idl new file mode 100644 index 0000000000..6fd0967e75 --- /dev/null +++ b/xpcom/system/nsICrashReporter.idl @@ -0,0 +1,175 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIFile; +interface nsIURL; + +/** + * Provides access to crash reporting functionality. + * + * @status UNSTABLE - This interface is not frozen and will probably change in + * future releases. + */ + +[scriptable, uuid(4b74c39a-cf69-4a8a-8e63-169d81ad1ecf)] +interface nsICrashReporter : nsISupports +{ + /** + * Get the enabled status of the crash reporter. + */ + readonly attribute boolean crashReporterEnabled; + + /** + * Enable or disable crash reporting at runtime. Not available to script + * because the JS engine relies on proper exception handler chaining. + */ + [noscript] + void setEnabled(in bool enabled); + + /** + * Get or set the URL to which crash reports will be submitted. + * Only https and http URLs are allowed, as the submission is handled + * by OS-native networking libraries. + * + * @throw NS_ERROR_NOT_INITIALIZED if crash reporting is not initialized + * @throw NS_ERROR_INVALID_ARG on set if a non-http(s) URL is assigned + * @throw NS_ERROR_FAILURE on get if no URL is set + */ + attribute nsIURL serverURL; + + /** + * Get or set the path on the local system to which minidumps will be + * written when a crash happens. + * + * @throw NS_ERROR_NOT_INITIALIZED if crash reporting is not initialized + */ + attribute nsIFile minidumpPath; + + /** + * Get the minidump file corresponding to the specified ID. + * + * @param id + * ID of the crash. Likely a UUID. + * + * @return The minidump file associated with the ID. + * + * @throw NS_ERROR_FILE_NOT_FOUND if the minidump could not be found + */ + nsIFile getMinidumpForID(in AString id); + + /** + * Get the extra file corresponding to the specified ID. + * + * @param id + * ID of the crash. Likely a UUID. + * + * @return The extra file associated with the ID. + * + * @throw NS_ERROR_FILE_NOT_FOUND if the extra file could not be found + */ + nsIFile getExtraFileForID(in AString id); + + /** + * Add some extra data to be submitted with a crash report. + * + * @param key + * Name of a known crash annotation constant. + * @param data + * Data to be added. + * + * @throw NS_ERROR_NOT_INITIALIZED if crash reporting not initialized + * @throw NS_ERROR_INVALID_ARG if key contains an invalid value or data + * contains invalid characters. Invalid + * character for data is '\0'. + */ + void annotateCrashReport(in AUTF8String key, in AUTF8String data); + + /** + * Remove a crash report annotation. + * + * @param key + * Name of a known crash annotation constant. + * + * @throw NS_ERROR_NOT_INITIALIZED if crash reporting not initialized + * @throw NS_ERROR_INVALID_ARG if key contains an invalid value. + */ + void removeCrashReportAnnotation(in AUTF8String key); + + /** + * Checks if an annotation is allowed for inclusion in the crash ping. + * + * @param key + * Name of a known crash annotation constant. + * + * @return True if the specified value is a valid annotation and can be + included in the crash ping, false otherwise. + * @throw NS_ERROR_INVALID_ARG if key contains an invalid value. + */ + boolean isAnnotationAllowedForPing(in ACString value); + + /** + * Append some data to the "Notes" field, to be submitted with a crash report. + * Unlike annotateCrashReport, this method will append to existing data. + * + * @param data + * Data to be added. + * + * @throw NS_ERROR_NOT_INITIALIZED if crash reporting not initialized + * @throw NS_ERROR_INVALID_ARG if data contains invalid characters. + * The only invalid character is '\0'. + */ + void appendAppNotesToCrashReport(in ACString data); + + /** + * Register a given memory range to be included in the crash report. + * + * @param ptr + * The starting address for the bytes. + * @param size + * The number of bytes to include. + * + * @throw NS_ERROR_NOT_INITIALIZED if crash reporting not initialized + * @throw NS_ERROR_NOT_IMPLEMENTED if unavailable on the current OS + */ + void registerAppMemory(in unsigned long long ptr, in unsigned long long size); + + /** + * Write a minidump immediately, with the user-supplied exception + * information. This is implemented on Windows only, because + * SEH (structured exception handling) exists on Windows only. + * + * @param aExceptionInfo EXCEPTION_INFO* provided by Window's SEH + */ + [noscript] void writeMinidumpForException(in voidPtr aExceptionInfo); + + /** + * Append note containing an Obj-C exception's info. + * + * @param aException NSException object to append note for + */ + [noscript] void appendObjCExceptionInfoToAppNotes(in voidPtr aException); + + /** + * User preference for submitting crash reports. + */ + attribute boolean submitReports; + + /** + * Cause the crash reporter to re-evaluate where crash events should go. + * + * This should be called during application startup and whenever profiles + * change. + */ + void UpdateCrashEventsDir(); + + /** + * Save an anonymized memory report file for inclusion in a future crash + * report in this session. + * + * @throws NS_ERROR_NOT_INITIALIZED if crash reporting is disabled. + */ + void saveMemoryReport(); +}; diff --git a/xpcom/system/nsIDeviceSensors.idl b/xpcom/system/nsIDeviceSensors.idl new file mode 100644 index 0000000000..dcb67cb925 --- /dev/null +++ b/xpcom/system/nsIDeviceSensors.idl @@ -0,0 +1,60 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIDOMWindow; + +[scriptable, uuid(0462247e-fe8c-4aa5-b675-3752547e485f)] +interface nsIDeviceSensorData : nsISupports +{ + // Keep in sync with hal/HalSensor.h + + // 1. TYPE_ORIENTATION: absolute device orientation, not spec-conform and + // deprecated on Android. + // 2. TYPE_ROTATION_VECTOR: absolute device orientation affected by drift. + // 3. TYPE_GAME_ROTATION_VECTOR: relative device orientation less affected by drift. + // Preferred fallback priorities on Android are [3, 2, 1] for the general case + // and [2, 1] if absolute orientation (compass heading) is required. + const unsigned long TYPE_ORIENTATION = 0; + const unsigned long TYPE_ACCELERATION = 1; + const unsigned long TYPE_PROXIMITY = 2; + const unsigned long TYPE_LINEAR_ACCELERATION = 3; + const unsigned long TYPE_GYROSCOPE = 4; + const unsigned long TYPE_LIGHT = 5; + const unsigned long TYPE_ROTATION_VECTOR = 6; + const unsigned long TYPE_GAME_ROTATION_VECTOR = 7; + + readonly attribute unsigned long type; + + readonly attribute double x; + readonly attribute double y; + readonly attribute double z; +}; + +[scriptable, uuid(e46e47c7-55ff-44c4-abce-21b14ba07f86)] +interface nsIDeviceSensors : nsISupports +{ + /** + * Returns true if the given window has any listeners of the given type + */ + bool hasWindowListener(in unsigned long aType, in nsIDOMWindow aWindow); + + // Holds pointers, not AddRef objects -- it is up to the caller + // to call RemoveWindowListener before the window is deleted. + + [noscript] void addWindowListener(in unsigned long aType, in nsIDOMWindow aWindow); + [noscript] void removeWindowListener(in unsigned long aType, in nsIDOMWindow aWindow); + [noscript] void removeWindowAsListener(in nsIDOMWindow aWindow); +}; + +%{C++ + +#define NS_DEVICE_SENSORS_CID \ +{ 0xecba5203, 0x77da, 0x465a, \ +{ 0x86, 0x5e, 0x78, 0xb7, 0xaf, 0x10, 0xd8, 0xf7 } } + +#define NS_DEVICE_SENSORS_CONTRACTID "@mozilla.org/devicesensors;1" + +%} diff --git a/xpcom/system/nsIGIOService.idl b/xpcom/system/nsIGIOService.idl new file mode 100644 index 0000000000..432a519e3a --- /dev/null +++ b/xpcom/system/nsIGIOService.idl @@ -0,0 +1,89 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsIMIMEInfo.idl" + +interface nsIUTF8StringEnumerator; +interface nsIURI; +interface nsIFile; +interface nsIMutableArray; + +/* nsIGIOMimeApp holds information about an application that is looked up + with nsIGIOService::GetAppForMimeType. */ +// 66009894-9877-405b-9321-bf30420e34e6 prev uuid + +[scriptable, uuid(ca6bad0c-8a48-48ac-82c7-27bb8f510fbe)] +interface nsIGIOMimeApp : nsIHandlerApp +{ + const long EXPECTS_URIS = 0; + const long EXPECTS_PATHS = 1; + const long EXPECTS_URIS_FOR_NON_FILES = 2; + + readonly attribute AUTF8String id; + readonly attribute AUTF8String command; + readonly attribute long expectsURIs; // see constants above + readonly attribute nsIUTF8StringEnumerator supportedURISchemes; + + void setAsDefaultForMimeType(in AUTF8String mimeType); + void setAsDefaultForFileExtensions(in AUTF8String extensions); + void setAsDefaultForURIScheme(in AUTF8String uriScheme); +}; + +/* + * The VFS service makes use of two distinct registries. + * + * The application registry holds information about applications (uniquely + * identified by id), such as which MIME types and URI schemes they are + * capable of handling, whether they run in a terminal, etc. + * + * The MIME registry holds information about MIME types, such as which + * extensions map to a given MIME type. The MIME registry also stores the + * id of the application selected to handle each MIME type. + */ + +// prev id dea20bf0-4e4d-48c5-b932-dc3e116dc64b +[scriptable, builtinclass, uuid(eda22a30-84e1-4e16-9ca0-cd1553c2b34a)] +interface nsIGIOService : nsISupports +{ + + /*** MIME registry methods ***/ + + /* Obtain the MIME type registered for an extension. The extension + should not include a leading dot. */ + AUTF8String getMimeTypeFromExtension(in AUTF8String extension); + + /* Obtain the preferred application for opening a given URI scheme */ + nsIHandlerApp getAppForURIScheme(in AUTF8String aURIScheme); + + /* Obtain list of application capable of opening given URI scheme */ + nsIMutableArray getAppsForURIScheme(in AUTF8String aURIScheme); + + /* Obtain the preferred application for opening a given MIME type */ + nsIHandlerApp getAppForMimeType(in AUTF8String mimeType); + + /* Create application info for given command and name */ + nsIGIOMimeApp createAppFromCommand(in AUTF8String cmd, + in AUTF8String appName); + + /* Find the application info by given command */ + nsIGIOMimeApp findAppFromCommand(in AUTF8String cmd); + + /* Obtain a description for the given MIME type */ + AUTF8String getDescriptionForMimeType(in AUTF8String mimeType); + + /*** Misc. methods ***/ + [infallible] readonly attribute boolean isRunningUnderFlatpak; + [infallible] readonly attribute boolean isRunningUnderSnap; + + /* Open the given URI in the default application */ + [noscript] void showURI(in nsIURI uri); + [noscript] void revealFile(in nsIFile file); + [noscript] void launchFile(in ACString path); +}; + +%{C++ +#define NS_GIOSERVICE_CONTRACTID "@mozilla.org/gio-service;1" +%} diff --git a/xpcom/system/nsIGSettingsService.idl b/xpcom/system/nsIGSettingsService.idl new file mode 100644 index 0000000000..26d86a77e0 --- /dev/null +++ b/xpcom/system/nsIGSettingsService.idl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIArray; + +[scriptable, uuid(16d5b0ed-e756-4f1b-a8ce-9132e869acd8)] +interface nsIGSettingsCollection : nsISupports +{ + void setString(in AUTF8String key, in AUTF8String value); + void setBoolean(in AUTF8String key, in boolean value); + void setInt(in AUTF8String key, in long value); + AUTF8String getString(in AUTF8String key); + boolean getBoolean(in AUTF8String key); + long getInt(in AUTF8String key); + nsIArray getStringList(in AUTF8String key); +}; + +[scriptable, uuid(849c088b-57d1-4f24-b7b2-3dc4acb04c0a)] +interface nsIGSettingsService : nsISupports +{ + nsIGSettingsCollection getCollectionForSchema(in AUTF8String schema); +}; + +%{C++ +#define NS_GSETTINGSSERVICE_CONTRACTID "@mozilla.org/gsettings-service;1" +%} diff --git a/xpcom/system/nsIGeolocationProvider.idl b/xpcom/system/nsIGeolocationProvider.idl new file mode 100644 index 0000000000..ff2f5a5004 --- /dev/null +++ b/xpcom/system/nsIGeolocationProvider.idl @@ -0,0 +1,82 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + + +#include "nsISupports.idl" + +interface nsIURI; +interface nsIDOMGeoPosition; +interface nsIGeolocationPrompt; + +/** + + * Interface provides a way for a geolocation provider to + * notify the system that a new location is available. + */ +[scriptable, uuid(643dc5e9-b911-4b2c-8d44-603162696baf)] +interface nsIGeolocationUpdate : nsISupports { + + /** + * Notify the geolocation service that a new geolocation + * has been discovered. + * This must be called on the main thread + */ + void update(in nsIDOMGeoPosition position); + /** + * Notify the geolocation service of an error. + * This must be called on the main thread. + * The parameter refers to one of the constants in the + * nsIDOMGeoPositionError interface. + * Use this to report spurious errors coming from the + * provider; for errors occurring inside the methods in + * the nsIGeolocationProvider interface, just use the return + * value. + */ + [can_run_script] + void notifyError(in unsigned short error); +}; + + +/** + * Interface provides location information to the nsGeolocator + * via the nsIDOMGeolocationCallback interface. After + * startup is called, any geo location change should call + * callback.update(). + */ +[scriptable, uuid(AC4A133B-9F92-4F7C-B369-D40CB6B17650)] +interface nsIGeolocationProvider : nsISupports { + + /** + * Start up the provider. This is called before any other + * method. may be called multiple times. + */ + void startup(); + + /** + * watch + * When a location change is observed, notify the callback. + */ + void watch(in nsIGeolocationUpdate callback); + + /** + * shutdown + * Shuts down the location device. + */ + void shutdown(); + + /** + * hint to provide to use any amount of power to provide a better result + */ + void setHighAccuracy(in boolean enable); + +}; + +%{C++ +/* + This must be implemented by geolocation providers. It + must support nsIGeolocationProvider. +*/ +#define NS_GEOLOCATION_PROVIDER_CONTRACTID "@mozilla.org/geolocation/provider;1" +%} diff --git a/xpcom/system/nsIHapticFeedback.idl b/xpcom/system/nsIHapticFeedback.idl new file mode 100644 index 0000000000..25d0d8e7bb --- /dev/null +++ b/xpcom/system/nsIHapticFeedback.idl @@ -0,0 +1,22 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + + +[scriptable, uuid(91917c98-a8f3-4c98-8f10-4afb872f54c7)] +interface nsIHapticFeedback : nsISupports { + + const long ShortPress = 0; + const long LongPress = 1; + + /** + * Perform haptic feedback + * + * @param isLongPress + * indicate whether feedback is for a long press (vs. short press) + */ + void performSimpleAction(in long isLongPress); +}; diff --git a/xpcom/system/nsIPlatformInfo.idl b/xpcom/system/nsIPlatformInfo.idl new file mode 100644 index 0000000000..fba78b6ecc --- /dev/null +++ b/xpcom/system/nsIPlatformInfo.idl @@ -0,0 +1,19 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[scriptable, uuid(ab6650cf-0806-4aea-b8f2-40fdae74f1cc)] +interface nsIPlatformInfo : nsISupports +{ + /** + * The version of the XULRunner platform. + */ + readonly attribute ACString platformVersion; + + /** + * The build ID/date of gecko and the XULRunner platform. + */ + readonly attribute ACString platformBuildID; +}; diff --git a/xpcom/system/nsISystemInfo.idl b/xpcom/system/nsISystemInfo.idl new file mode 100644 index 0000000000..0cadb7e498 --- /dev/null +++ b/xpcom/system/nsISystemInfo.idl @@ -0,0 +1,40 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + + +[scriptable, uuid(09a0502b-cedc-4cae-bf7c-35662dbd1249)] +interface nsISystemInfo : nsISupports +{ + /** + * Asynchronously get info about what types of disks we're using for the + * profile and binary. + * Note: only implemented on Windows, will return null elsewhere. + */ + [implicit_jscontext] + readonly attribute Promise diskInfo; + + /** + * Asynchronously get CountryCode info. + * Note: only implemented on macOS and Windows, will return null elsewhere. + */ + [implicit_jscontext] + readonly attribute Promise countryCode; + + /** + * Asynchronously gets OS info on the system's install year. + * Note: only implemented on Windows, will return null elsewhere. + */ + [implicit_jscontext] + readonly attribute Promise osInfo; + + /** + * Asynchronously gets process info that indicates if the process is running + * under Wow64 and WowARM64. + * Note: only implemented on Windows, will return null elsewhere. + */ + [implicit_jscontext] + readonly attribute Promise processInfo; +}; diff --git a/xpcom/system/nsIXULAppInfo.idl b/xpcom/system/nsIXULAppInfo.idl new file mode 100644 index 0000000000..502052eb79 --- /dev/null +++ b/xpcom/system/nsIXULAppInfo.idl @@ -0,0 +1,64 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIPlatformInfo.idl" + +/** + * A scriptable interface to the nsXULAppAPI structure. See nsXULAppAPI.h for + * a detailed description of each attribute. + */ + +[scriptable, uuid(ddea4f31-3c5e-4769-ac68-21ab4b3d7845)] +interface nsIXULAppInfo : nsIPlatformInfo +{ + /** + * @see XREAppData.vendor + * @returns an empty string if XREAppData.vendor is not set. + */ + readonly attribute ACString vendor; + + /** + * @see XREAppData.name + */ + readonly attribute ACString name; + + /** + * @see XREAppData.ID + * @returns an empty string if XREAppData.ID is not set. + */ + readonly attribute ACString ID; + + /** + * The version of the XUL application. It is different than the + * version of the XULRunner platform. Be careful about which one you want. + * + * @see XREAppData.version + * @returns an empty string if XREAppData.version is not set. + */ + readonly attribute ACString version; + + /** + * The build ID/date of the application. For xulrunner applications, + * this will be different than the build ID of the platform. Be careful + * about which one you want. + */ + readonly attribute ACString appBuildID; + + /** + * @see XREAppData.UAName + * @returns an empty string if XREAppData.UAName is not set. + */ + readonly attribute ACString UAName; + + /** + * @see XREAppData.sourceURL + * @returns an empty string if XREAppData.sourceURL is not set. + */ + readonly attribute ACString sourceURL; + + /** + * @see XREAppData.updateURL + */ + readonly attribute ACString updateURL; +}; diff --git a/xpcom/system/nsIXULRuntime.idl b/xpcom/system/nsIXULRuntime.idl new file mode 100644 index 0000000000..8beadae9f1 --- /dev/null +++ b/xpcom/system/nsIXULRuntime.idl @@ -0,0 +1,393 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +%{C++ + +namespace mozilla { +// Simple C++ getter for nsIXULRuntime::browserTabsRemoteAutostart +// This getter is a temporary function that checks for special +// conditions in which e10s support is not great yet, and should +// therefore be disabled. Bug 1065561 tracks its removal. +bool BrowserTabsRemoteAutostart(); +uint32_t GetMaxWebProcessCount(); + +// Returns the value of the fission.autostart pref. Since fission can be +// disabled on a per-window basis, this should only be used when you need the +// global value of the pref. For other use cases, you should use +// nsILoadContext::UseRemoteSubframes instead. This will also check for special +// conditions, like safe mode, which may require fission to be disabled, or +// environment variables MOZ_FORCE_ENABLE_FISSION and MOZ_FORCE_DISABLE_FISSION, +// used by mach run to enable/disable fission regardless of pref settings. +bool FissionAutostart(); + +// Returns whether or not we are currently enrolled in the fission experiment. +bool FissionExperimentEnrolled(); + +// Returns true if FissionAutostart() is true or +// fission.disableSessionHistoryInParent is false. +bool SessionHistoryInParent(); + +// Returns true if SessionHistoryInParent() returns true and +// fission.bfcacheInParent is true. +bool BFCacheInParent(); +} + +%} + +/** + * Provides information about the XUL runtime. + * @status UNSTABLE - This interface is not frozen and will probably change in + * future releases. If you need this functionality to be + * stable/frozen, please contact Benjamin Smedberg. + */ + +[scriptable, uuid(03602fac-fa3f-4a50-9baa-b88456fb4a0f)] +interface nsIXULRuntime : nsISupports +{ + /** + * Whether the application was launched in safe mode. + */ + readonly attribute boolean inSafeMode; + + /** + * The status of a given normandy experiment. + */ + cenum ExperimentStatus : 8 { + // The user is not actively enrolled in the experiment. + eExperimentStatusUnenrolled = 0, + // The user is enrolled in the control group, and should see the default + // behavior. + eExperimentStatusControl = 1, + // The user is enrolled in the treatment group, and should see the + // experimental behavior which is being tested. + eExperimentStatusTreatment = 2, + // The user was enrolled in the experiment, but became ineligible due to + // manually modifying a relevant preference. + eExperimentStatusDisqualified = 3, + // The user was selected for the phased Fission rollout. + eExperimentStatusRollout = 4, + + eExperimentStatusCount, + }; + + // If you update this enum, don't forget to raise the limit in + // TelemetryEnvironmentTesting.sys.mjs and record the new value in + // environment.rst + cenum ContentWin32kLockdownState : 8 { + LockdownEnabled = 1, // no longer used + MissingWebRender = 2, + OperatingSystemNotSupported = 3, + PrefNotSet = 4, // no longer used + MissingRemoteWebGL = 5, + MissingNonNativeTheming = 6, + DisabledByEnvVar = 7, // - MOZ_ENABLE_WIN32K is set + DisabledBySafeMode = 8, + DisabledByE10S = 9, // - E10S is disabled for whatever reason + DisabledByUserPref = 10, // - The user manually set + // security.sandbox.content.win32k-disable to false + EnabledByUserPref = 11, // The user manually set + // security.sandbox.content.win32k-disable to true + DisabledByControlGroup = + 12, // The user is in the Control Group, so it is disabled + EnabledByTreatmentGroup = + 13, // The user is in the Treatment Group, so it is enabled + DisabledByDefault = 14, // The default value of the pref is false + EnabledByDefault = 15, // The default value of the pref is true + DecodersArentRemote = 16, + IncompatibleMitigationPolicy = 17, // Some incompatible Windows Exploit Mitigation policies are enabled + }; + + // This is the current value of the experiment for the session + readonly attribute nsIXULRuntime_ExperimentStatus win32kExperimentStatus; + // This will return what the browser thinks is the _current_ status of win32k lockdown + // but this should only be used for testing + readonly attribute nsIXULRuntime_ContentWin32kLockdownState win32kLiveStatusTestingOnly; + // This is the current value of win32k lockdown for the session. It is set at startup, + // and never changed. + readonly attribute nsIXULRuntime_ContentWin32kLockdownState win32kSessionStatus; + + // NOTE: Please do not add new values to this enum without also updating the + // mapping in aboutSupport.js + cenum FissionDecisionStatus : 8 { + eFissionStatusUnknown = 0, + // Fission is disabled because the user is in the control group of a + // Normandy experiment. + eFissionExperimentControl = 1, + // Fission is enabled because the user is in the treatment group of a + // Normandy experiment. + eFissionExperimentTreatment = 2, + // Fission is disabled because the `MOZ_FORCE_DISABLE_E10S` environment + // variable is set. + eFissionDisabledByE10sEnv = 3, + // Fission is enabled because the `MOZ_FORCE_ENABLE_FISSION` environment + // variable is set. + eFissionEnabledByEnv = 4, + // Fission is disabled because the `MOZ_FORCE_DISABLE_FISSION` environment + // variable is set. + eFissionDisabledByEnv = 5, + // Fission is enabled because the "fission.autostart" preference is true + // by default. + eFissionEnabledByDefault = 7, + // Fission is disabled because the "fission.autostart" preference is false + // by default. + eFissionDisabledByDefault = 8, + // Fission is enabled because the "fission.autostart" preference was + // turned on by the user. + eFissionEnabledByUserPref = 9, + // Fission is enabled because the "fission.autostart" preference was + // turned on by the user. + eFissionDisabledByUserPref = 10, + // Fission is disabled because e10s is disabled for some other reason. + eFissionDisabledByE10sOther = 11, + // Fission is enabled by a Normandy phased rollout. + eFissionEnabledByRollout = 12, + }; + + /** + * Whether Fission should be automatically enabled for new browser windows. + * This may not match the value of the 'fission.autostart' pref. + * + * This value is guaranteed to remain constant for the length of a browser + * session. + */ + readonly attribute boolean fissionAutostart; + + /** + * The deciding factor which caused Fission to be enabled or disabled in + * this session. The string version is the same of the name of the constant, + * without the leading `eFission`, and with an initial lower-case letter. + */ + readonly attribute nsIXULRuntime_FissionDecisionStatus fissionDecisionStatus; + readonly attribute ACString fissionDecisionStatusString; + + /** + * Whether session history is stored in the parent process. + */ + readonly attribute boolean sessionHistoryInParent; + + /** + * Whether to write console errors to a log file. If a component + * encounters startup errors that might prevent the app from showing + * proper UI, it should set this flag to "true". + */ + attribute boolean logConsoleErrors; + + /** + * A string tag identifying the current operating system. This is taken + * from the OS_TARGET configure variable. It will always be available. + */ + readonly attribute AUTF8String OS; + + /** + * A string tag identifying the binary ABI of the current processor and + * compiler vtable. This is taken from the TARGET_XPCOM_ABI configure + * variable. It may not be available on all platforms, especially + * unusual processor or compiler combinations. + * + * The result takes the form <processor>-<compilerABI>, for example: + * x86-msvc + * ppc-gcc3 + * + * This value should almost always be used in combination with "OS". + * + * @throw NS_ERROR_NOT_AVAILABLE if not available. + */ + readonly attribute AUTF8String XPCOMABI; + + /** + * A string tag identifying the target widget toolkit in use. + * This is taken from the MOZ_WIDGET_TOOLKIT configure variable. + */ + readonly attribute AUTF8String widgetToolkit; + + /** + * The legal values of processType. + */ + const unsigned long PROCESS_TYPE_DEFAULT = 0; + const unsigned long PROCESS_TYPE_CONTENT = 2; + const unsigned long PROCESS_TYPE_IPDLUNITTEST = 3; + const unsigned long PROCESS_TYPE_GMPLUGIN = 4; + const unsigned long PROCESS_TYPE_GPU = 5; + const unsigned long PROCESS_TYPE_VR = 6; + const unsigned long PROCESS_TYPE_RDD = 7; + const unsigned long PROCESS_TYPE_SOCKET = 8; + const unsigned long PROCESS_TYPE_REMOTESANDBOXBROKER = 9; + const unsigned long PROCESS_TYPE_FORKSERVER = 10; + const unsigned long PROCESS_TYPE_UTILITY = 11; + + /** + * The type of the caller's process. Returns one of the values above. + */ + readonly attribute unsigned long processType; + + /** + * The system process ID of the caller's process. + */ + readonly attribute unsigned long processID; + + /** + * A globally unique and non-recycled ID of the caller's process. + */ + readonly attribute uint64_t uniqueProcessID; + + /** + * The type of remote content process we're running in. + * null if we're in the parent/chrome process. This can contain + * a URI if Fission is enabled, so don't use it for any kind of + * telemetry. + */ + readonly attribute AUTF8String remoteType; + + /** + * If true, browser tabs may be opened by default in a different process + * from the main browser UI. + */ + readonly attribute boolean browserTabsRemoteAutostart; + + /** + * Returns the number of content processes to use for normal web pages. If + * this value is > 1, then e10s-multi should be considered to be "on". + * + * NB: If browserTabsRemoteAutostart is false, then this value has no + * meaning and e10s should be considered to be "off"! + */ + readonly attribute uint32_t maxWebProcessCount; + + /** + * The current e10s-multi experiment number. Set dom.ipc.multiOptOut to (at + * least) this to disable it until the next experiment. + */ + const uint32_t E10S_MULTI_EXPERIMENT = 1; + + /** + * If true, the accessibility service is running. + */ + readonly attribute boolean accessibilityEnabled; + + /** + * Executable of Windows service that activated accessibility. + */ + readonly attribute AString accessibilityInstantiator; + + /** + * Indicates whether the current Firefox build is 64-bit. + */ + readonly attribute boolean is64Bit; + + /** + * Indicates whether or not text recognition of images supported by the OS. + */ + readonly attribute boolean isTextRecognitionSupported; + + /** + * Signal the apprunner to invalidate caches on the next restart. + * This will cause components to be autoregistered and all + * fastload data to be re-created. + */ + void invalidateCachesOnRestart(); + + /** + * Starts a child process. This method is intented to pre-start a + * content child process so that when it is actually needed, it is + * ready to go. + * + * @throw NS_ERROR_NOT_AVAILABLE if not available. + */ + void ensureContentProcess(); + + /** + * Modification time of the profile lock before the profile was locked on + * this startup. Used to know the last time the profile was used and not + * closed cleanly. This is set to 0 if there was no existing profile lock. + */ + readonly attribute PRTime replacedLockTime; + + /** + * The default update channel (MOZ_UPDATE_CHANNEL). + */ + readonly attribute AUTF8String defaultUpdateChannel; + + /** + * The distribution ID for this build (MOZ_DISTRIBUTION_ID). + */ + readonly attribute AUTF8String distributionID; + + /** + * True if Windows DLL blocklist initialized correctly. This is + * primarily for automated testing purposes. + */ + readonly attribute boolean windowsDLLBlocklistStatus; + + /** + * True if this application was started by the OS as part of an automatic + * restart mechanism (such as RegisterApplicationRestart on Windows). + */ + readonly attribute boolean restartedByOS; + + /** Whether the chrome color-scheme is dark */ + readonly attribute boolean chromeColorSchemeIsDark; + + /** Whether the content color-scheme derived from the app theme is dark */ + readonly attribute boolean contentThemeDerivedColorSchemeIsDark; + + /** Whether the user prefers reduced motion */ + readonly attribute boolean prefersReducedMotion; + + /** Whether we should draw over the titlebar */ + readonly attribute boolean drawInTitlebar; + + /** Returns the desktop environment identifier. Only meaningful on GTK */ + readonly attribute ACString desktopEnvironment; + + /** Whether we use Wayland. Only meaningful on GTK */ + readonly attribute boolean isWayland; + + /** + * The path of the shortcut used to start the current process, or "" if none. + * + * Windows Main process only, otherwise throws NS_ERROR_NOT_AVAILABLE + * + * May be mising in some cases where the user did launch from a shortcut: + * - If the updater ran on startup + * - If the AUMID was set before the shortcut could be saved + * + * @throw NS_ERROR_NOT_AVAILABLE if not available. + */ + readonly attribute AString processStartupShortcut; + + /** + * Returns a value corresponding to one of the + * |mozilla::LauncherRegistryInfo::EnabledState| values. + */ + readonly attribute uint32_t launcherProcessState; + + /** + * Returns the last application version that used the current profile or null + * if the last version could not be found (compatibility.ini was either + * missing or invalid). Throws NS_ERROR_UNAVAILABLE if called from a content + * process. + */ + readonly attribute ACString lastAppVersion; + + /** + * Returns the last application build ID that used the current profile or null + * if the last build ID could not be found (compatibility.ini was either + * missing or invalid). Throws NS_ERROR_UNAVAILABLE if called from a content + * process. + */ + readonly attribute ACString lastAppBuildID; +}; + + +%{C++ + +namespace mozilla { + +nsIXULRuntime::ContentWin32kLockdownState GetWin32kLockdownState(); + +} + +%} |