### POST /WebExtensionController/install Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/doc-files/CHANGELOG.md Installs a web extension using a specific installation method. ```APIDOC ## POST /WebExtensionController/install ### Description Installs a web extension into the GeckoView instance. ### Method POST ### Endpoint /WebExtensionController.WebExtensionController.html#install ### Parameters #### Request Body - **extensionId** (String) - Required - The ID of the extension. - **path** (String) - Required - Local path to the extension file. - **method** (InstallationMethod) - Required - The installation method to be used. ### Response #### Success Response (200) - **success** (Boolean) - Indicates if the installation was successful. ``` -------------------------------- ### Handle WebExtension Installation Events in Java Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.AddonManagerDelegate.html Callbacks for when a WebExtension is being installed, has been installed, or installation has failed. These methods are invoked on the UI thread and receive the WebExtension object as a parameter. The installation failed callback also includes an InstallException. ```Java @UiThread default void onInstalling(@NonNull WebExtension extension) { // Called whenever an extension is being installed. } @UiThread default void onInstalled(@NonNull WebExtension extension) { // Called whenever an extension has been installed. } @UiThread default void onInstallationFailed(@Nullable WebExtension extension, @NonNull WebExtension.InstallException installException) { // Called whenever an error happened when installing a WebExtension. } ``` -------------------------------- ### Get Start Time - Geckoview Download Info Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.Download.Info.html Returns the time when the download process began. This is a default method provided by the WebExtension.Download.Info interface. ```java default long startTime() ``` -------------------------------- ### Install WebExtension Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.html Installs a signed WebExtension from a URI. The method returns a GeckoResult that resolves to the installed WebExtension object. ```java GeckoResult result = webExtensionController.install("https://example.com/extension.xpi", null); ``` -------------------------------- ### Handle Extension Installation Prompt (Java) Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.PromptDelegate.html This method is invoked when a new extension is being installed. It provides an opportunity for the application to prompt the user for the necessary permissions required by the extension. It returns a GeckoResult containing the user's response. ```Java default @Nullable GeckoResult onInstallPromptRequest(@NonNull WebExtension extension, @NonNull String[] permissions, @NonNull String[] origins, @NonNull String[] dataCollectionPermissions) { // Implementation to prompt user for installation permissions return null; // Placeholder } ``` -------------------------------- ### WebExtensionController.InstallationMethod Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/package-summary.html The method used by the embedder to install a WebExtension. ```APIDOC ## WebExtensionController.InstallationMethod ### Description The method used by the embedder to install the [`WebExtension`](WebExtension.html "class in org.mozilla.geckoview"). ### Method N/A (Annotation) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Install WebExtension using URI in Java Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.html Installs a WebExtension from a given URI. The extension will persist across restarts. This method requires extensions to be signed by Mozilla and provides an opportunity to verify permissions. It returns a GeckoResult that completes with the installed WebExtension or an InstallException on error. ```Java public GeckoResult install(@NonNull String uri) ``` -------------------------------- ### Install Built-in WebExtension (Java) Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.html Installs a WebExtension that is bundled within the application's APK. These extensions have special privileges like native messaging access and do not require signing. The installation is initiated from a specified resource URI. ```Java public GeckoResult installBuiltIn(@NonNull String uri) ``` -------------------------------- ### WebExtension.InstallException Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/serialized-form.html Details about errors encountered during the installation of WebExtensions. ```APIDOC ## WebExtension.InstallException ### Description An exception thrown when there is an issue installing a WebExtension. ### Serialized Fields - **code** (int) - An error code from `WebExtension.InstallException.ErrorCodes`. - **extensionId** (String) - Optional ID of the extension causing the error. - **extensionName** (String) - Optional name of the extension causing the error. - **extensionVersion** (String) - Optional version of the extension causing the error. ``` -------------------------------- ### Get Download Start Time - Java Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.Download.Info.html Returns the time when the download began, measured in milliseconds since the UNIX epoch. This method is designed to be called on the UI thread. ```Java @UiThread default long startTime() ``` -------------------------------- ### Manage WebExtensions with WebExtensionController Source: https://context7.com/mozilla/geckoview/llms.txt This snippet demonstrates how to use the WebExtensionController to install, list, enable, disable, and uninstall WebExtensions. It also shows how to set a delegate for install prompts. Dependencies include the GeckoRuntime and WebExtensionController classes. ```java WebExtensionController controller = runtime.getWebExtensionController(); // Install extension from URL controller.install("https://example.com/extension.xpi") .then(extension -> { Log.d("GeckoView", "Installed: " + extension.id); return null; }) .exceptionally(e -> { Log.e("GeckoView", "Install failed", e); return null; }); // Install built-in extension from assets controller.installBuiltIn("resource://android/assets/extensions/myextension/") .then(extension -> { Log.d("GeckoView", "Built-in extension installed"); return null; }); // List installed extensions controller.list().then(extensions -> { for (WebExtension ext : extensions) { Log.d("GeckoView", "Extension: " + ext.id + " enabled: " + ext.metaData.enabled); } return null; }); // Enable/disable extension controller.disable(extension, WebExtensionController.EnableSource.USER) .then(disabledExt -> { Log.d("GeckoView", "Extension disabled"); return null; }); controller.enable(extension, WebExtensionController.EnableSource.USER) .then(enabledExt -> { Log.d("GeckoView", "Extension enabled"); return null; }); // Uninstall extension controller.uninstall(extension).then(result -> { Log.d("GeckoView", "Extension uninstalled"); return null; }); // Set prompt delegate for install requests controller.setPromptDelegate(new WebExtensionController.PromptDelegate() { @Override public GeckoResult onInstallPromptRequest( WebExtension extension, String[] permissions, String[] origins, String[] dataCollectionPermissions) { return showInstallPrompt(extension.metaData.name, permissions) .then(allowed -> GeckoResult.fromValue( allowed ? AllowOrDeny.ALLOW : AllowOrDeny.DENY)); } }); ``` -------------------------------- ### Install Built-in WebExtension Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.html Installs a WebExtension packaged within the application's APK. ```APIDOC ## POST /webextensions/builtin ### Description Installs a built-in extension from a specified URI within the APK. Built-in extensions have special privileges and are not signed. ### Method POST ### Endpoint /webextensions/builtin ### Parameters #### Request Body - **uri** (string) - Required - The resource URI pointing to the extension's folder within the APK (e.g., "resource://android/assets/example/"). ### Request Example ```json { "uri": "resource://android/assets/my-builtin-extension/" } ``` ### Response #### Success Response (200) - **WebExtension** (object) - The installed WebExtension instance. #### Response Example ```json { "id": "builtin-extension-id", "name": "My Built-in Extension", "version": "1.0.0" } ``` ``` -------------------------------- ### WebExtensionController.InstallationMethod Annotation Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.InstallationMethod.html Details about the WebExtensionController.InstallationMethod annotation, used to indicate the installation method of a WebExtension. ```APIDOC ## WebExtensionController.InstallationMethod Annotation ### Description This annotation specifies the method used by the embedder to install a `WebExtension`. ### Method Annotation Type ### Endpoint N/A (This is an annotation definition, not an API endpoint) ### Parameters N/A ### Request Example N/A ### Response N/A ### Error Handling N/A ``` -------------------------------- ### Handling WebExtension InstallException Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/serialized-form.html Example of how to catch and inspect the fields of a WebExtension.InstallException, which provides specific error codes and extension metadata. ```java try { // Attempt to install extension } catch (WebExtension.InstallException e) { int errorCode = e.code; String id = e.extensionId; String name = e.extensionName; Log.e("GeckoView", "Install failed for " + name + " (ID: " + id + ") with code: " + errorCode); } ``` -------------------------------- ### WebExtensionController.PromptDelegate Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/package-summary.html Delegate called when an extension is about to be installed or needs new permissions. ```APIDOC ## WebExtensionController.PromptDelegate ### Description This delegate will be called whenever an extension is about to be installed or it needs new permissions, e.g during an update or because it called `permissions.request`. ### Method N/A (Interface) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### WebExtension Install Error Codes Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.InstallException.ErrorCodes.html This section lists and describes the integer error codes that can be returned by the WebExtension.InstallException class, indicating specific reasons for installation failures. ```APIDOC ## WebExtension Install Error Codes ### Description Constants representing specific error conditions during web extension installation. ### ERROR_NETWORK_FAILURE public static final int ERROR_NETWORK_FAILURE The download failed due to network problems. ### ERROR_INCORRECT_HASH public static final int ERROR_INCORRECT_HASH The downloaded file did not match the provided hash. ### ERROR_CORRUPT_FILE public static final int ERROR_CORRUPT_FILE The downloaded file seems to be corrupted in some way. ### ERROR_FILE_ACCESS public static final int ERROR_FILE_ACCESS An error occurred trying to write to the filesystem. ### ERROR_SIGNEDSTATE_REQUIRED public static final int ERROR_SIGNEDSTATE_REQUIRED The extension must be signed and isn't. ### ERROR_UNEXPECTED_ADDON_TYPE public static final int ERROR_UNEXPECTED_ADDON_TYPE The downloaded extension had a different type than expected. ### ERROR_UNEXPECTED_ADDON_VERSION public static final int ERROR_UNEXPECTED_ADDON_VERSION The downloaded extension had a different version than expected. ### ERROR_INCORRECT_ID public static final int ERROR_INCORRECT_ID The extension did not have the expected ID. ### ERROR_INVALID_DOMAIN public static final int ERROR_INVALID_DOMAIN The extension did not have the expected ID. ### ERROR_BLOCKLISTED public static final int ERROR_BLOCKLISTED The extension is (hard) blocked. ``` -------------------------------- ### Define WebExtension Installation Method Constants Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.html Constants used to identify the source or method by which a WebExtension was installed in the GeckoView environment. ```java public static final String INSTALLATION_METHOD_MANAGER = "INSTALLATION_METHOD_MANAGER"; public static final String INSTALLATION_METHOD_FROM_FILE = "INSTALLATION_METHOD_FROM_FILE"; public static final String INSTALLATION_METHOD_ONBOARDING = "INSTALLATION_METHOD_ONBOARDING"; ``` -------------------------------- ### POST /webextension/install Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.html Installs a WebExtension from a given URI. The extension must be signed by Mozilla and will persist across GeckoRuntime restarts. ```APIDOC ## POST /webextension/install ### Description Installs a WebExtension from a provided URI. The library downloads the extension, validates the manifest and signature, and allows for permission verification. ### Method POST ### Endpoint /webextension/install ### Parameters #### Request Body - **uri** (String) - Required - The URI to the extension's .xpi package (supports https, file, or resource schemes). ### Request Example { "uri": "https://example.com/extension.xpi" } ### Response #### Success Response (200) - **WebExtension** (Object) - The installed extension object containing metadata and delegate configuration. #### Response Example { "extension": { "id": "example@mozilla.org", "metaData": {} } } ``` -------------------------------- ### WebExtension.InstallException Class Overview Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.InstallException.html Provides an overview of the WebExtension.InstallException class, its inheritance, and its purpose in handling extension installation errors. ```APIDOC ## Class WebExtension.InstallException Extension thrown when an error occurs during extension installation. ### Description This class extends `java.lang.Exception` and is used to indicate errors encountered during the installation process of web extensions within GeckoView. ### Fields * **code** (int) - Required - One of `WebExtension.InstallException.ErrorCodes` that provides more information about this exception. * **extensionId** (String) - Optional - An optional ID of the extension that caused the exception. * **extensionName** (String) - Optional - An optional name of the extension that caused the exception. * **extensionVersion** (String) - Optional - An optional version of the extension that caused the exception. ### Constructors * **InstallException()** - Protected - For testing purposes. ### Nested Classes * **WebExtension.InstallException.Codes** (`static @interface`) - Error code type definitions for WebExtension installation exceptions. * **WebExtension.InstallException.ErrorCodes** (`static class`) - Error code definitions for extension installation failures. ``` -------------------------------- ### GeckoRuntime Initialization and Management Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoRuntime.html APIs for creating, getting, and attaching the GeckoRuntime. ```APIDOC ## getDefault ### Description Get the default runtime for the given context. This will create and initialize the runtime with the default settings. Only use this for session-less apps. For regular apps, use create() instead. ### Method GET ### Endpoint N/A (Static method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **GeckoRuntime** (GeckoRuntime) - The (static) default runtime for the context. #### Response Example None ## attachTo ### Description Attach the runtime to the given context. ### Method POST ### Endpoint N/A (Instance method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **context** (Context) - Required - The new context to attach to. ### Request Example None ### Response #### Success Response (200) None #### Response Example None ## create (default settings) ### Description Create a new runtime with default settings and attach it to the given context. Create will throw if there is already an active Gecko instance running, to prevent that, bind the runtime to the process lifetime instead of the activity lifetime. ### Method POST ### Endpoint N/A (Static method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **context** (Context) - Required - The context of the runtime. ### Request Example None ### Response #### Success Response (200) - **GeckoRuntime** (GeckoRuntime) - An initialized runtime. #### Response Example None ## create (custom settings) ### Description Create a new runtime with the given settings and attach it to the given context. Create will throw if there is already an active Gecko instance running, to prevent that, bind the runtime to the process lifetime instead of the activity lifetime. ### Method POST ### Endpoint N/A (Static method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **context** (Context) - Required - The context of the runtime. - **settings** (GeckoRuntimeSettings) - Required - The settings for the runtime. ### Request Example None ### Response #### Success Response (200) - **GeckoRuntime** (GeckoRuntime) - An initialized runtime. #### Response Example None ``` -------------------------------- ### GET /GeckoSession/getWebCompatInfo Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/doc-files/CHANGELOG.md Retrieves web compatibility information for the current session. ```APIDOC ## GET /GeckoSession/getWebCompatInfo ### Description Retrieves web compatibility information as a JSON object. ### Method GET ### Endpoint GeckoSession.getWebCompatInfo() ### Response #### Success Response (200) - **data** (JSONObject) - The web compatibility information object. #### Response Example { "compat_mode": "standard", "version": "1.0" } ``` -------------------------------- ### Start Gecko Profiler (Java) Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/ProfilerController.html Starts the Gecko profiler with specified thread filters and features. This method provides an alternative to traditional USB debugging for profiling. It takes arrays of strings for filters and features as input. ```java public static void startProfiler(@NonNull String[] aFilters, @NonNull String[] aFeaturesArr) ``` -------------------------------- ### Configure Permission Delegate Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.html Demonstrates getting and setting the PermissionDelegate to handle web permissions within the session. ```java GeckoSession.PermissionDelegate delegate = session.getPermissionDelegate(); session.setPermissionDelegate(new MyPermissionDelegate()); ``` -------------------------------- ### Install Built-in WebExtension Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.html Ensures a built-in extension is installed. It checks if the extension is already present with the same version to avoid re-installation. Only URIs starting with 'resource://android' are permitted for built-in extensions located within the APK. ```java controller.ensureBuiltIn("resource://android/assets/example/", "example@example.com"); ``` -------------------------------- ### Initialize and Configure SurfaceInfo.Builder Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoDisplay.SurfaceInfo.Builder.html Demonstrates how to instantiate the Builder with a Surface and chain configuration methods to set surface control, providers, offsets, and dimensions. ```java GeckoDisplay.SurfaceInfo.Builder builder = new GeckoDisplay.SurfaceInfo.Builder(surface); builder.surfaceControl(control) .newSurfaceProvider(provider) .offset(0, 0) .size(1920, 1080) .build(); ``` -------------------------------- ### WebExtension.InstallException.ErrorCodes Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.InstallException.ErrorCodes.html A reference list of error codes used to identify why a WebExtension installation failed. ```APIDOC ## WebExtension.InstallException.ErrorCodes ### Description This class contains static final integer constants representing error conditions encountered during the installation of WebExtensions in GeckoView. ### Error Codes - **ERROR_ADMIN_INSTALL_ONLY** (int) - The extension can only be installed via Enterprise Policies. - **ERROR_BLOCKLISTED** (int) - The extension is hard-blocked. - **ERROR_CORRUPT_FILE** (int) - The downloaded file is corrupted. - **ERROR_FILE_ACCESS** (int) - An error occurred while writing to the filesystem. - **ERROR_INCOMPATIBLE** (int) - The extension is incompatible with the current version. - **ERROR_INCORRECT_HASH** (int) - The downloaded file hash does not match the expected value. - **ERROR_INCORRECT_ID** (int) - The extension ID does not match the expected ID. - **ERROR_INVALID_DOMAIN** (int) - The extension domain is invalid. - **ERROR_NETWORK_FAILURE** (int) - The download failed due to network issues. - **ERROR_POSTPONED** (int) - The installation is postponed until restart. - **ERROR_SIGNEDSTATE_REQUIRED** (int) - The extension is not signed as required. - **ERROR_SOFT_BLOCKED** (int) - The extension is soft-blocked. - **ERROR_UNEXPECTED_ADDON_TYPE** (int) - The extension type is different than expected. - **ERROR_UNEXPECTED_ADDON_VERSION** (int) - The extension version is different than expected. - **ERROR_UNSUPPORTED_ADDON_TYPE** (int) - The extension type is not supported. - **ERROR_USER_CANCELED** (int) - The user canceled the installation. ``` -------------------------------- ### Start Profiler Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/ProfilerController.html Initializes the Gecko profiler with specific thread filters and feature sets. ```APIDOC ## POST /profiler/start ### Description Starts the Gecko profiler with the provided thread filters and feature configurations. ### Method POST ### Endpoint /profiler/start ### Parameters #### Request Body - **aFilters** (String[]) - Required - Array of thread name substrings to filter profiling. - **aFeaturesArr** (String[]) - Required - Array of profiler features to enable. ### Request Example { "aFilters": ["Gecko", "Renderer"], "aFeaturesArr": ["js", "stackwalk"] } ``` -------------------------------- ### Accessing WebExtension.InstallException Fields Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.InstallException.html This snippet demonstrates the structure of the InstallException class, showing the fields available for inspecting the details of an installation failure. ```java public class WebExtension.InstallException extends Exception { public final int code; public final String extensionId; public final String extensionName; public final String extensionVersion; // Example usage in a catch block try { // Installation logic } catch (WebExtension.InstallException e) { Log.e("GeckoView", "Failed to install " + e.extensionName + ": " + e.code); } } ``` -------------------------------- ### WebExtension.InstallException.Codes Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.InstallException.Codes.html Definition of the annotation type used for categorizing WebExtension installation errors. ```APIDOC ## WebExtension.InstallException.Codes ### Description This annotation type defines the error codes associated with WebExtension installation exceptions in GeckoView. It is used to categorize specific failure states during the installation process. ### Type Annotation Interface ### Package org.mozilla.geckoview ### Usage Used within the `WebExtension.InstallException` class to provide structured error reporting for extension installation failures. ### Retention Policy SOURCE ### Example ```java @WebExtension.InstallException.Codes public @interface Codes { // Error code definitions } ``` ``` -------------------------------- ### GeckoRuntime - Initialize and Manage Engine Source: https://context7.com/mozilla/geckoview/llms.txt Demonstrates how to initialize the GeckoRuntime, configure settings, and manage its lifecycle. ```APIDOC ## GeckoRuntime - Initialize the Gecko Engine ### Description GeckoRuntime is the core environment for Gecko-based applications. It must be initialized once and manages the Gecko engine's lifecycle, crash handling, and global settings. ### Method Initialization typically occurs in the `Application.onCreate()` method. ### Endpoint N/A (Class-based initialization) ### Parameters #### Request Body - **context** (Context) - Required - The Android application context. - **settings** (GeckoRuntimeSettings) - Required - Configuration settings for the runtime. ### Request Example ```java import org.mozilla.geckoview.GeckoRuntime; import org.mozilla.geckoview.GeckoRuntimeSettings; // Create runtime settings with custom configuration GeckoRuntimeSettings settings = new GeckoRuntimeSettings.Builder() .javaScriptEnabled(true) .remoteDebuggingEnabled(BuildConfig.DEBUG) .consoleOutput(true) .aboutConfigEnabled(true) .build(); // Initialize the GeckoRuntime GeckoRuntime runtime = GeckoRuntime.create(context, settings); // Optionally warm up the runtime runtime.warmUp(); // Set delegate for runtime events runtime.setDelegate(new GeckoRuntime.Delegate() { @Override public void onShutdown() { Log.d("GeckoView", "Runtime is shutting down"); } }); // Access controllers WebExtensionController extensionController = runtime.getWebExtensionController(); ContentBlockingController blockingController = runtime.getContentBlockingController(); ``` ### Response #### Success Response (200) - **runtime** (GeckoRuntime) - The initialized GeckoRuntime instance. #### Response Example N/A (Initialization returns the instance directly) ``` -------------------------------- ### Define WebExtension Install Error Codes Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.InstallException.ErrorCodes.html A collection of constant integer fields representing specific failure scenarios during the installation of a WebExtension. These constants are used to identify why an installation attempt failed. ```java public static final int ERROR_INCOMPATIBLE = ...; public static final int ERROR_UNSUPPORTED_ADDON_TYPE = ...; public static final int ERROR_ADMIN_INSTALL_ONLY = ...; public static final int ERROR_SOFT_BLOCKED = ...; public static final int ERROR_USER_CANCELED = ...; public static final int ERROR_POSTPONED = ...; ``` -------------------------------- ### Initialize GeckoView Runtime Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/package-summary.html Demonstrates how to initialize the GeckoRuntime, which serves as the entry point for starting and configuring Gecko. This can be used to preload Gecko or set up features like crash reporting. ```java GeckoRuntime runtime = GeckoRuntime.create(context); // Configure features like crash reporting runtime.getSettings().setCrashReportingEnabled(true); // Preload Gecko if needed runtime.start(); ``` -------------------------------- ### Configure ContentBlocking Settings using Builder Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/ContentBlocking.Settings.Builder.html Demonstrates how to initialize the ContentBlocking.Settings.Builder and configure safe browsing providers and threat tables. ```java ContentBlocking.Settings.Builder builder = new ContentBlocking.Settings.Builder(); builder.safeBrowsingProviders(provider1, provider2); builder.safeBrowsingPhishingTable(new String[]{"phishing_list_1"}); builder.safeBrowsingMalwareTable(new String[]{"malware_list_1"}); ContentBlocking.Settings settings = builder.build(); ``` -------------------------------- ### Start and Stop Gecko Profiler Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/ProfilerController.html Shows how to initialize the profiler with specific filters and features, and how to stop it to retrieve the recorded profile data. ```java String[] filters = {"js", "stackwalk"}; String[] features = {"leaf"}; // Start the profiler ProfilerController.startProfiler(filters, features); // Stop and capture the profile GeckoResult profileData = ProfilerController.stopProfiler(); ``` -------------------------------- ### Collapse Selection to Start Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.SelectionActionDelegate.Selection.html Collapses the current text selection to its starting position. ```APIDOC ## POST /collapseToStart ### Description Collapses the current selection to its start position. ### Method POST ### Endpoint /collapseToStart ### Parameters No parameters are available for this endpoint. ### Request Body This endpoint does not accept a request body. ### Response #### Success Response (200) This endpoint does not return a response body upon success. #### Response Example (No response body) ``` -------------------------------- ### Constructing a LoginEntry using the Builder pattern Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/Autocomplete.LoginEntry.Builder.html Demonstrates how to instantiate the Builder, configure various login entry attributes, and finalize the object creation. ```java Autocomplete.LoginEntry entry = new Autocomplete.LoginEntry.Builder() .guid("example-guid") .origin("https://example.com") .username("user123") .httpRealm("realm-name") .build(); ``` -------------------------------- ### Constructing ModelManagementOptions using Builder Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/TranslationsController.RuntimeTranslation.ModelManagementOptions.Builder.html Demonstrates how to instantiate the Builder and use its fluent API to configure language, operation, and level settings before building the final object. ```java TranslationsController.RuntimeTranslation.ModelManagementOptions.Builder builder = new TranslationsController.RuntimeTranslation.ModelManagementOptions.Builder(); TranslationsController.RuntimeTranslation.ModelManagementOptions options = builder .languageToManage("es") .operation("download") .operationLevel("language") .build(); ``` -------------------------------- ### WebExtension.Download Initialization Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.Download.html Describes how to instantiate a download object within the GeckoView environment. ```APIDOC ## POST /WebExtensionController/createDownload ### Description Instantiates a new download object for a specific download ID. This method is the primary way to create a WebExtension.Download instance. ### Method POST ### Endpoint WebExtensionController.createDownload(int id) ### Parameters #### Path Parameters - **id** (int) - Required - The unique identifier for the download item. ### Request Example { "id": 12345 } ### Response #### Success Response (200) - **download** (WebExtension.Download) - The initialized download object. #### Response Example { "id": 12345, "state": "IN_PROGRESS" } ``` -------------------------------- ### List Installed Extensions Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.html Retrieves a list of all installed web extensions for the GeckoRuntime. This list can be used to set delegates for WebExtension objects. ```APIDOC ## GET /extensions ### Description Lists all installed web extensions for the current GeckoRuntime. ### Method GET ### Endpoint /extensions ### Parameters None ### Request Example None ### Response #### Success Response (200) - **extensions** (Array) - A list of installed WebExtension objects. #### Response Example ```json [ { "id": "extension_id_1", "name": "Example Extension 1", "version": "1.0.0" }, { "id": "extension_id_2", "name": "Example Extension 2", "version": "2.1.0" } ] ``` ``` -------------------------------- ### List Installed WebExtensions Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.html Retrieves a list of all currently installed WebExtensions within the GeckoRuntime. This method returns a GeckoResult that completes with a List of WebExtension objects. ```java controller.list(); ``` -------------------------------- ### WebExtension.DownloadInitData Constructor Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.DownloadInitData.html This section describes the constructor for the WebExtension.DownloadInitData class, used to create an instance with download and initial data. ```APIDOC ## WebExtension.DownloadInitData Constructor ### Description Creates a `DownloadInitData` object with the provided download and initial data. ### Method Constructor ### Endpoint N/A (Class Constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "download": { /* WebExtension.Download object */ }, "initData": { /* WebExtension.Download.Info object */ } } ``` ### Response #### Success Response (200) N/A (Constructor) #### Response Example N/A (Constructor) ``` -------------------------------- ### WebExtension Install Error Codes Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.InstallException.ErrorCodes.html A reference of constant integer error codes used to identify specific failure reasons during WebExtension installation processes. ```APIDOC ## Error Codes Reference ### Description These constants represent specific error states encountered during the installation of a WebExtension in GeckoView. ### Error Constants - **ERROR_INCOMPATIBLE** (int) - The extension is incompatible with the current platform. - **ERROR_UNSUPPORTED_ADDON_TYPE** (int) - The extension type is not supported by the platform. - **ERROR_ADMIN_INSTALL_ONLY** (int) - The extension can only be installed via Enterprise Policies. - **ERROR_SOFT_BLOCKED** (int) - The extension is soft-blocked. - **ERROR_USER_CANCELED** (int) - The extension install was canceled by the user. - **ERROR_POSTPONED** (int) - The extension install was postponed until the next restart. ### Usage These codes are typically returned within an `InstallException` object when an installation attempt fails. ``` -------------------------------- ### Add Profiler Marker with Name and Start Time Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/ProfilerController.html Adds a profiler marker to Gecko Profiler with a name and start time. The end time is automatically set to the current profiler time. This overload is useful for marking specific points in time or events with a duration starting from a known point. No-op if profiler is not active. ```java public static void addMarker(@NonNull String aMarkerName, @Nullable Double aStartTime) ``` -------------------------------- ### Get Page Content with Java Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/PageExtractionController.SessionPageExtractor.html Retrieves the content of the current page as a String. This method is part of the SessionPageExtractor and returns a GeckoResult which can be used to asynchronously get the page content. ```java public GeckoResult getPageContent() ``` -------------------------------- ### Initialize MediaSession.ElementMetadata Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/MediaSession.ElementMetadata.html Demonstrates how to instantiate the ElementMetadata class with specific media properties such as source, duration, dimensions, and track counts. ```java import org.mozilla.geckoview.MediaSession; // Example of creating an ElementMetadata instance MediaSession.ElementMetadata metadata = new MediaSession.ElementMetadata( "https://example.com/video.mp4", 120.5, 1920, 1080, 1, 1 ); ``` -------------------------------- ### Initialize ElementMetadata Instance Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/MediaSession.ElementMetadata.html Demonstrates how to instantiate the ElementMetadata class. This constructor requires the source URI, duration, dimensions, and track counts for both audio and video. ```java ElementMetadata metadata = new ElementMetadata("https://example.com/video.mp4", 120.5, 1920, 1080, 1, 1); ``` -------------------------------- ### Set CreditCard GUID using Builder Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/Autocomplete.CreditCard.Builder.html Sets a unique identifier (GUID) for the credit card entry. This method is part of the builder pattern for constructing Autocomplete.CreditCard objects. ```java public Autocomplete.CreditCard.Builder guid(String guid) { // Set the unique identifier for this credit card entry. return this; } ``` -------------------------------- ### Add Profiler Marker (Java) Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/ProfilerController.html Demonstrates how to add profiler markers to Gecko Profiler using different overloads of the addMarker method. This includes markers with just a name, with a name and start time, with a name, start time, end time, and extra text, or with a name, start time, and extra text. It also shows how to conditionally add a marker only if the profiler is active. ```Java ProfilerController.addMarker("marker name"); ProfilerController.addMarker("marker name", "extra information"); Double startTime = ProfilerController.getProfilerTime(); // ...some code you want to measure... ProfilerController.addMarker("name", startTime); Double startTime = ProfilerController.getProfilerTime(); // ...some code you want to measure (or end time can be collected in a callback)... Double endTime = ProfilerController.getProfilerTime(); // ...somewhere else in the codebase... ProfilerController.addMarker("name", startTime, endTime); Double startTime = ProfilerController.getProfilerTime(); // ...some code you want to measure... Double endTime = ProfilerController.getProfilerTime(); // ...somewhere else in the codebase... ProfilerController.addMarker("name", startTime, endTime, "extra information"); Double startTime = ProfilerController.getProfilerTime(); // ...some code you want to measure... if (ProfilerController.isProfilerActive()) { String info = aFunctionYouDoNotWantToCallWhenProfilerIsNotActive(); ProfilerController.addMarker("name", startTime, info); } ``` -------------------------------- ### Initialize GeckoWebExecutor and Perform Fetch Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoWebExecutor.html Demonstrates how to instantiate a GeckoWebExecutor using a GeckoRuntime and execute a network request using the fetch method. ```java GeckoRuntime runtime = GeckoRuntime.create(context); GeckoWebExecutor executor = new GeckoWebExecutor(runtime); WebRequest request = new WebRequest.Builder("https://example.com").build(); GeckoResult result = executor.fetch(request); ``` -------------------------------- ### Get SafeBrowsingProvider Get Hash URL Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/ContentBlocking.SafeBrowsingProvider.html Retrieves the URL used to fetch full hashes that match partial hashes for this SafeBrowsingProvider. This method returns a nullable string, referencing the endpoint for full hash lookups. ```java String getHashUrl = provider.getGetHashUrl(); ``` -------------------------------- ### Initialize GeckoSession Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.html Demonstrates how to instantiate a new GeckoSession instance using either default settings or a custom GeckoSessionSettings object. ```java GeckoSession session = new GeckoSession(); GeckoSession customSession = new GeckoSession(settings); ``` -------------------------------- ### GeckoResult Null Coercion Example (Java) Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoResult.html Illustrates how values propagated through GeckoResult can be coerced to null, particularly when using OnExceptionListener followed by OnValueListener. This example shows that the OnValueListener receives a null value if an exception occurred in a preceding step. ```Java divide(42, 2).then(new GeckoResult.OnExceptionListener() { @Override public GeckoResult onException(final Throwable exception) { // Not called } }).then(new GeckoResult.OnValueListener() { @Override public GeckoResult onValue(final String value) { // value == null } }); ``` -------------------------------- ### Constructing GeckoSessionSettings using the Builder pattern Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSessionSettings.Builder.html Demonstrates how to instantiate the builder, configure specific session settings like JavaScript support and private mode, and finalize the configuration using the build method. ```java GeckoSessionSettings settings = new GeckoSessionSettings.Builder() .allowJavascript(true) .usePrivateMode(true) .userAgentOverride("Mozilla/5.0 (Android 10; Mobile; rv:100.0) Gecko/100.0 Firefox/100.0") .build(); ``` -------------------------------- ### Handle WebExtension Ready Event in Java Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.AddonManagerDelegate.html Callback for when a WebExtension's startup has been completed. This is when relative URLs for extension assets can be resolved to full moz-extension URLs. Invoked on the UI thread. ```Java @UiThread default void onReady(@NonNull WebExtension extension) { // Called whenever an extension startup has been completed. } ``` -------------------------------- ### Initialize GeckoSessionSettings Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSessionSettings.html Demonstrates how to instantiate a new GeckoSessionSettings object using the default constructor or by copying an existing instance. ```java GeckoSessionSettings settings = new GeckoSessionSettings(); GeckoSessionSettings copy = new GeckoSessionSettings(settings); ``` -------------------------------- ### GET /GeckoRuntime/getContentBlockingController Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/doc-files/CHANGELOG.md Retrieves the ContentBlockingController instance from the GeckoRuntime. ```APIDOC ## GET /GeckoRuntime/getContentBlockingController ### Description Retrieves the controller responsible for managing content blocking settings within the GeckoRuntime. ### Method GET ### Endpoint GeckoRuntime.getContentBlockingController() ### Response #### Success Response (200) - **controller** (ContentBlockingController) - The instance of the content blocking controller. #### Response Example { "controller": "[ContentBlockingControllerInstance]" } ``` -------------------------------- ### Constructing an Autocomplete.Address using the Builder pattern Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/Autocomplete.Address.Builder.html Demonstrates how to instantiate the Builder, set various address fields, and finalize the creation of an Autocomplete.Address object. ```java Autocomplete.Address address = new Autocomplete.Address.Builder() .givenName("John") .familyName("Doe") .email("john.doe@example.com") .country("US") .addressLevel1("CA") .build(); ``` -------------------------------- ### Java GeckoSession History Delegate Methods Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.SessionState.html This snippet outlines common methods for the GeckoSession.HistoryDelegate in Java, such as getting an item by index, obtaining an iterator, getting a list iterator, and retrieving the size of the history. These methods are essential for navigating and managing the browsing history. ```Java /** * Retrieves the history item at the specified index. * @param index The index of the item to retrieve. * @return The GeckoSession.HistoryDelegate.HistoryItem at the given index. */ public GeckoSession.HistoryDelegate.HistoryItem get(int index) { // Implementation details... return null; // Placeholder } /** * Returns an iterator over the history items. * @return An Iterator for GeckoSession.HistoryDelegate.HistoryItem. */ public Iterator iterator() { // Implementation details... return null; // Placeholder } /** * Returns a list iterator over the history items, starting at the specified index. * @param index The index at which to start the list iterator. * @return A ListIterator for GeckoSession.HistoryDelegate.HistoryItem. */ public ListIterator listIterator(int index) { // Implementation details... return null; // Placeholder } /** * Returns the number of history items. * @return The total number of history items. */ public int size() { // Implementation details... return 0; // Placeholder } ``` -------------------------------- ### GET /resolve Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoWebExecutor.html Resolves a hostname to its corresponding IP addresses. ```APIDOC ## GET /resolve ### Description Resolves the specified host name to an array of InetAddress objects. ### Method GET ### Endpoint /resolve ### Parameters #### Query Parameters - **host** (String) - Required - The hostname to resolve. ### Request Example { "host": "example.org" } ### Response #### Success Response (200) - **addresses** (Array) - A list of resolved IP addresses. #### Response Example { "addresses": ["93.184.216.34"] } ``` -------------------------------- ### Autocomplete/Fetch API Example Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/Autocomplete.html Demonstrates how GeckoView fetches login information for a given domain and attempts to autofill login fields. If multiple login options exist, it triggers a user selection prompt. ```java StorageDelegate.onLoginFetch("example.com") ``` ```java GeckoSession.PromptDelegate.onLoginSelect ``` -------------------------------- ### GET getId Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/Autocomplete.AddressStructure.Field.SelectField.html Retrieves the unique identifier for the address field. ```APIDOC ## GET getId ### Description Returns the ID for the field, which maps 1:1 to a field on an Address. ### Method GET ### Endpoint /Autocomplete/AddressStructure/Field/SelectField/getId ### Parameters None ### Request Example N/A ### Response #### Success Response (200) - **id** (String) - The unique field identifier. #### Response Example { "id": "address-line-1" } ``` -------------------------------- ### Constructing a CreditCard using Builder Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/Autocomplete.CreditCard.Builder.html Demonstrates how to instantiate the Builder and use its fluent API to set credit card details before calling the build method. ```java Autocomplete.CreditCard card = new Autocomplete.CreditCard.Builder() .guid("example-guid-123") .name("John Doe") .number("1234567812345678") .expirationMonth("12") .expirationYear("2025") .build(); ``` -------------------------------- ### Configure GeckoView Runtime Settings Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoRuntimeSettings.Builder.html Example demonstrating how to use the GeckoRuntimeSettings.Builder to configure various browser features like tracker blocking, DNS settings, and web content support. ```java GeckoRuntimeSettings.Builder builder = new GeckoRuntimeSettings.Builder(); builder.setLnaEnabled(true) .setLnaBlockTrackers(true) .setWebFontsEnabled(true) .setWebManifest(true) .trustedRecursiveResolverMode(1) .trustedRecursiveResolverUri("https://mozilla.cloudflare-dns.com/dns-query"); GeckoRuntimeSettings settings = builder.build(); ``` -------------------------------- ### GET /view/dimensions Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoView.html Retrieves the current width and height dimensions of the view. ```APIDOC ## GET /view/dimensions ### Description Returns the width and height of the view in pixels. ### Method GET ### Endpoint /view/dimensions ### Parameters None ### Request Example GET /view/dimensions ### Response #### Success Response (200) - **width** (int) - The width of the view. - **height** (int) - The height of the view. #### Response Example { "width": 1080, "height": 1920 } ``` -------------------------------- ### GET /GeckoSession/ClientBounds Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.html Retrieve the bounds of the client area in client coordinates. ```APIDOC ## GET /GeckoSession/getClientBounds ### Description Gets the bounds of the client area in client coordinates and populates the provided RectF object. ### Method GET ### Endpoint getClientBounds(RectF rect) ### Parameters #### Request Body - **rect** (RectF) - Required - The RectF object to be populated with client bounds. ### Response #### Success Response (200) - **void** - The rect object is updated in-place. ``` -------------------------------- ### GET /GeckoSession/Accessibility Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.html Retrieve the SessionAccessibility instance associated with the current GeckoSession. ```APIDOC ## GET /GeckoSession/getAccessibility ### Description Retrieves the SessionAccessibility instance for the current session to handle accessibility features. ### Method GET ### Endpoint getAccessibility() ### Response #### Success Response (200) - **SessionAccessibility** (object) - The accessibility instance for the session. ``` -------------------------------- ### Define WebExtensionController.InstallationMethod Annotation Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.InstallationMethod.html The InstallationMethod annotation is used to specify the installation strategy for WebExtensions in GeckoView. It is a static annotation interface with SOURCE retention policy, intended for use by the embedder. ```java @Retention(RetentionPolicy.SOURCE) public static @interface WebExtensionController.InstallationMethod { } ``` -------------------------------- ### InstallException Methods Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.InstallException.html Details about the methods available in the InstallException class, including inherited methods. ```APIDOC ## InstallException Methods ### toString `public String toString()` Overrides: `toString` in class `Throwable` ## Inherited Methods from class java.lang.Object `clone`, `equals`, `finalize`, `getClass`, `hashCode`, `notify`, `notifyAll`, `wait`, `wait`, `wait` ``` -------------------------------- ### Get All Permissions Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/StorageController.html Retrieves all currently stored permissions across all contexts. ```APIDOC ## GET /geckoview/permissions/all ### Description Get all currently stored permissions. ### Method GET ### Endpoint /geckoview/permissions/all ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **permissions** (List) - A list of all currently stored ContentPermissions. #### Response Example ```json { "permissions": [ { "uri": "https://example.com", "permission": "geolocation", "mode": "allow" } ] } ``` ``` -------------------------------- ### PromptInstanceDelegate Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/allclasses-index.html Interface for managing prompt instances. ```APIDOC ## PromptInstanceDelegate ### Description Interface for managing prompt instances. ### Method N/A (Interface definition) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Response Example N/A ``` -------------------------------- ### Default GeckoRuntime API Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoRuntime.html Get the default GeckoRuntime for a given context. ```APIDOC ## GET /geckoruntime/default ### Description Get the default runtime for the given context. ### Method GET ### Endpoint /geckoruntime/default ### Parameters #### Query Parameters - **context** (Context) - Required - The Android context. ### Request Example None ### Response #### Success Response (200) - **geckoRuntime** (GeckoRuntime) - The default GeckoRuntime instance. #### Response Example ```json { "geckoRuntime": "GeckoRuntime" } ``` ``` -------------------------------- ### Initialize WebResponse.Builder with URI (Java) Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/WebResponse.Builder.html Constructs a new WebResponse.Builder instance with the specified URI. This is the initial step in building a WebResponse object. ```Java new WebResponse.Builder(String uri) ``` -------------------------------- ### GET /geckopref Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/GeckoPreferenceController.html Retrieves the value of a specific Gecko preference by its name. ```APIDOC ## GET /geckopref ### Description Retrieves the value of a given Gecko preference. This method returns a GeckoResult containing the preference object. ### Method GET ### Endpoint /geckopref ### Parameters #### Query Parameters - **prefName** (String) - Required - The name of the preference to retrieve (e.g., "some.pref.value"). ### Request Example GET /geckopref?prefName=browser.startup.homepage ### Response #### Success Response (200) - **GeckoPreference** (Object) - The typed Gecko preference corresponding to the requested name. #### Response Example { "prefName": "browser.startup.homepage", "value": "https://www.mozilla.org", "type": "PREF_TYPE_STRING" } ``` -------------------------------- ### Anti-Tracking Category Source: https://github.com/mozilla/geckoview/blob/gh-pages/javadoc/mozilla-central/org/mozilla/geckoview/ContentBlocking.BlockEvent.html Get the anti-tracking category flags for a blocked resource. ```APIDOC ## GET /content-blocking/resource/anti-tracking-category ### Description Retrieves the anti-tracking category flags for a given resource. ### Method GET ### Endpoint /content-blocking/resource/anti-tracking-category ### Parameters #### Query Parameters - **uri** (string) - Required - The URI of the blocked resource. ### Request Example ```json { "uri": "https://example.com/tracker.gif" } ``` ### Response #### Success Response (200) - **antiTrackingCategory** (integer) - One or more of the `ContentBlocking.AntiTracking` flags. #### Response Example ```json { "antiTrackingCategory": 1 } ``` ```