ExtensionBrowser.webidl (3438B)
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * You are granted a license to use, reproduce and create derivative works of 7 * this document. 8 * 9 * This IDL file is related to interface mixin for the additional globals that should be 10 * available in windows and service workers allowed to access the WebExtensions API and 11 * the WebExtensions browser API namespace. 12 * 13 * More info about generating webidl API bindings for WebExtensions API at: 14 * 15 * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html 16 * 17 * A short summary of the special setup used by these WebIDL files (meant to aid 18 * webidl peers reviews and sign-offs) is available in the following section: 19 * 20 * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions 21 */ 22 23 // WebExtensions API interface mixin (used to include ExtensionBrowser interface 24 // in the ServiceWorkerGlobalScope and Window). 25 [Exposed=(ServiceWorker)] 26 interface mixin ExtensionGlobalsMixin { 27 [Replaceable, SameObject, BinaryName="AcquireExtensionBrowser", 28 BindingAlias="chrome", Func="extensions::ExtensionAPIAllowed"] 29 readonly attribute ExtensionBrowser browser; 30 }; 31 32 [Exposed=(ServiceWorker), LegacyNoInterfaceObject] 33 interface ExtensionBrowser { 34 // A mock API only exposed in tests to unit test the internals 35 // meant to be reused by the real WebExtensions API bindings 36 // in xpcshell tests. 37 [Replaceable, SameObject, BinaryName="GetExtensionMockAPI", 38 Func="mozilla::extensions::ExtensionMockAPI::IsAllowed", 39 Pref="extensions.webidl-api.expose_mock_interface"] 40 readonly attribute ExtensionMockAPI mockExtensionAPI; 41 42 // `browser.alarms` API namespace 43 [Replaceable, SameObject, BinaryName="GetExtensionAlarms", 44 Func="mozilla::extensions::ExtensionAlarms::IsAllowed"] 45 readonly attribute ExtensionAlarms alarms; 46 47 // `browser.browserSettings` API namespace 48 [Replaceable, SameObject, BinaryName="GetExtensionBrowserSettings", 49 Func="mozilla::extensions::ExtensionBrowserSettings::IsAllowed"] 50 readonly attribute ExtensionBrowserSettings browserSettings; 51 52 // `browser.dns` API namespace 53 [Replaceable, SameObject, BinaryName="GetExtensionDns", 54 Func="mozilla::extensions::ExtensionDns::IsAllowed"] 55 readonly attribute ExtensionDns dns; 56 57 // `browser.proxy` API namespace 58 [Replaceable, SameObject, BinaryName="GetExtensionProxy", 59 Func="mozilla::extensions::ExtensionProxy::IsAllowed"] 60 readonly attribute ExtensionProxy proxy; 61 62 // `browser.runtime` API namespace 63 [Replaceable, SameObject, BinaryName="GetExtensionRuntime", 64 Func="mozilla::extensions::ExtensionRuntime::IsAllowed"] 65 readonly attribute ExtensionRuntime runtime; 66 67 // `browser.scripting` API namespace 68 [Replaceable, SameObject, BinaryName="GetExtensionScripting", 69 Func="mozilla::extensions::ExtensionScripting::IsAllowed"] 70 readonly attribute ExtensionScripting scripting; 71 72 // `browser.test` API namespace, available in tests. 73 [Replaceable, SameObject, BinaryName="GetExtensionTest", 74 Func="mozilla::extensions::ExtensionTest::IsAllowed"] 75 readonly attribute ExtensionTest test; 76 };