summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/declarativeWebRequest.json
blob: c3d19dd5ea5bf3db63cc9fd680e73ef797ad3590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

[
  {
    "namespace": "declarativeWebRequest",
    "documentation_permissions_required": ["declarative", "declarativeWebRequest"],
    "types": [
      {
        "id": "RequestMatcher",
        "type": "object",
        "description": "Matches network events by various criteria.",
        "properties": {
          "url": {
            "$ref": "declarative.UrlFilter",
            "description": "Matches if the condition of the UrlFilter are fulfilled for the URL of the request.",
            "optional": true
          },
          "resourceType": {
            "type": "array",
            "optional": true,
            "description": "Matches if the request type of a request is contained in the list. Requests that cannot match any of the types will be filtered out.",
            "items": { "type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"] }
          },
          "instanceType": { "type": "string", "enum": ["declarativeWebRequest.RequestMatcher"] }
        }
      },
      {
        "id": "CancelRequest",
        "description": "Declarative event action that cancels a network request.",
        "type": "object",
        "properties": {
          "instanceType": { "type": "string", "enum": ["declarativeWebRequest.CancelRequest"] }
        }
      },
      {
        "id": "RedirectRequest",
        "description": "Declarative event action that redirects a network request.",
        "type": "object",
        "properties": {
          "instanceType": { "type": "string", "enum": ["declarativeWebRequest.RedirectRequest"] },
          "redirectUrl": { "type": "string", "description": "Destination to where the request is redirected."}
        }
      }
    ],
    "functions": [
    ],
    "events": [
      {
        "name": "onRequest",
        "options": {
          "supportsListeners": false,
          "supportsRules": true,
          "conditions": ["declarativeWebRequest.RequestMatcher"],
          "actions": [
            "declarativeWebRequest.CancelRequest",
            "declarativeWebRequest.RedirectRequest"
          ]
        }
      }
    ]
  }
]