ExtensionMockAPI.webidl (1914B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 * You can obtain one at http://mozilla.org/MPL/2.0/. 4 * 5 * You are granted a license to use, reproduce and create derivative works of 6 * this document. 7 * 8 * This IDL file is related to the WebExtensions API object only used in 9 * unit tests. 10 * 11 * More info about generating webidl API bindings for WebExtensions API at: 12 * 13 * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html 14 * 15 * A short summary of the special setup used by these WebIDL files (meant to aid 16 * webidl peers reviews and sign-offs) is available in the following section: 17 * 18 * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions 19 */ 20 21 // WebIDL definition for the "mockExtensionAPI" WebExtensions API, 22 // only available in tests and locked behind an about:config preference 23 // ("extensions.webidl-api.expose_mock_interface"). 24 [Exposed=(ServiceWorker), LegacyNoInterfaceObject] 25 interface ExtensionMockAPI { 26 // Test API methods scenarios. 27 28 [Throws, WebExtensionStub] 29 any methodSyncWithReturn(any... args); 30 31 [Throws, WebExtensionStub="NoReturn"] 32 undefined methodNoReturn(any... args); 33 34 [Throws, WebExtensionStub="Async"] 35 any methodAsync(any arg0, optional Function cb); 36 37 [Throws, WebExtensionStub="AsyncAmbiguous"] 38 any methodAmbiguousArgsAsync(any... args); 39 40 [Throws, WebExtensionStub="ReturnsPort"] 41 ExtensionPort methodReturnsPort(DOMString testName); 42 43 // Test API properties. 44 45 [Replaceable] 46 readonly attribute any propertyAsErrorObject; 47 48 [Replaceable] 49 readonly attribute DOMString propertyAsString; 50 51 // Test API events. 52 53 [Replaceable, SameObject] 54 readonly attribute ExtensionEventManager onTestEvent; 55 };