toolkit/components/extensions/schemas/captive_portal.json
author criss <ccozmuta@mozilla.com>
Mon, 18 Oct 2021 16:30:48 +0300
changeset 596179 ee8efced380b871deac4fba285955953a4a89ef5
parent 523723 8049568017b73a3143572004fb750fc9cbab7617
permissions -rw-r--r--
Backed out changeset 21276955f659 (bug 1720926) for causing hybrid bustages on nsIPrincipal. CLOSED TREE

[
  {
    "namespace": "manifest",
    "types": [
      {
        "$extend": "PermissionNoPrompt",
        "choices": [{
          "type": "string",
          "enum": [
            "captivePortal"
          ]
        }]
      }
    ]
  },
  {
    "namespace": "captivePortal",
    "description": "This API provides the ability detect the captive portal state of the users connection.",
    "permissions": ["captivePortal"],
    "properties": {
      "canonicalURL": {
        "$ref": "types.Setting",
        "description": "Return the canonical captive-portal detection URL. Read-only."
      }
    },
    "functions": [
      {
        "name": "getState",
        "type": "function",
        "description": "Returns the current portal state, one of `unknown`, `not_captive`, `unlocked_portal`, `locked_portal`.",
        "async": true,
        "parameters": []
      },
      {
        "name": "getLastChecked",
        "type": "function",
        "description": "Returns the time difference between NOW and the last time a request was completed in milliseconds.",
        "async": true,
        "parameters": []
      }
    ],
    "events": [
      {
        "name": "onStateChanged",
        "type": "function",
        "description": "Fired when the captive portal state changes.",
        "parameters": [
          {
            "type": "object",
            "name": "details",
            "properties": {
              "state": {
                "type": "string",
                "enum": ["unknown", "not_captive", "unlocked_portal", "locked_portal"],
                "description": "The current captive portal state."
              }
            }
          }
        ]
      },
      {
        "name": "onConnectivityAvailable",
        "type": "function",
        "description": "This notification will be emitted when the captive portal service has determined that we can connect to the internet. The service will pass either `captive` if there is an unlocked captive portal present, or `clear` if no captive portal was detected.",
        "parameters": [
          {
            "name": "status",
            "enum": ["captive", "clear"],
            "type": "string"
          }
        ]
      }
    ]
  }
]