Commit 487ce9d8 authored by Luca Greco's avatar Luca Greco
Browse files

Bug 1723838 - WebIDL bindings for the 'dns' WebExtensions API namespace. r=willdurand,webidl,smaug

parent fb2f3314
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1687,6 +1687,11 @@ DOMInterfaces = {
    'nativeType': 'mozilla::extensions::ExtensionMockAPI',
},

'ExtensionDns': {
    'headerFile': 'mozilla/extensions/ExtensionDns.h',
    'nativeType': 'mozilla::extensions::ExtensionDns',
},

'ExtensionEventManager': {
    'headerFile': 'mozilla/extensions/ExtensionEventManager.h',
    'nativeType': 'mozilla::extensions::ExtensionEventManager',
+5 −0
Original line number Diff line number Diff line
@@ -35,6 +35,11 @@ interface ExtensionBrowser {
   Func="mozilla::extensions::ExtensionAlarms::IsAllowed"]
  readonly attribute ExtensionAlarms alarms;

  // `browser.dns` API namespace
  [Replaceable, SameObject, BinaryName="GetExtensionDns",
   Func="mozilla::extensions::ExtensionDns::IsAllowed"]
  readonly attribute ExtensionDns dns;

  // `browser.runtime` API namespace
  [Replaceable, SameObject, BinaryName="GetExtensionRuntime",
   Func="mozilla::extensions::ExtensionRuntime::IsAllowed"]
+30 −0
Original line number Diff line number Diff line
/*
 *  THIS IS AN AUTOGENERATED FILE.  DO NOT EDIT
 *
 *  The content of this file has been generated based on the WebExtensions API
 *  JSONSchema using the following command:
 *
 *  export SCRIPT_DIR="toolkit/components/extensions/webidl-api"
 *  mach python $SCRIPT_DIR/GenerateWebIDLBindings.py -- dns
 *
 *  More info about generating webidl API bindings for WebExtensions API at:
 *
 *  https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html
 */

/* 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/.
 *
 * You are granted a license to use, reproduce and create derivative works of
 * this document.
 */

// WebIDL definition for the "dns" WebExtensions API
[Exposed=(ServiceWorker), LegacyNoInterfaceObject]
interface ExtensionDns {
  // API methods.

  [Throws, WebExtensionStub="AsyncAmbiguous"]
  any resolve(any... args);
};
+1 −0
Original line number Diff line number Diff line
@@ -1110,6 +1110,7 @@ WEBIDL_FILES += [
WEBIDL_FILES += [
    "ExtensionAlarms.webidl",
    "ExtensionBrowser.webidl",
    "ExtensionDns.webidl",
    "ExtensionEventManager.webidl",
    # ExtensionMockAPI is not a real WebExtensions API, and it is only enabled in tests.
    "ExtensionMockAPI.webidl",
+13 −4
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ add_task(async function startup() {
  await AddonTestUtils.promiseStartupManager();
});

add_task(async function test_dns_resolve() {
async function test_dns_resolve() {
  let extension = getExtension();
  await extension.startup();
  await extension.awaitMessage("ready");
@@ -137,9 +137,9 @@ add_task(async function test_dns_resolve() {
  }

  await extension.unload();
});
}

add_task(async function test_dns_resolve_socks() {
async function test_dns_resolve_socks() {
  let extension = getExtension();
  await extension.startup();
  await extension.awaitMessage("ready");
@@ -173,4 +173,13 @@ add_task(async function test_dns_resolve_socks() {
    `expected error ${result.message}`
  );
  await extension.unload();
});
}

add_task(test_dns_resolve);
add_task(
  {
    // TODO(Bug 1748313): remove the skip_if once we have introduced the proxy API namespace.
    skip_if: () => ExtensionTestUtils.isInBackgroundServiceWorkerTests(),
  },
  test_dns_resolve_socks
);
Loading