Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Ruleset for JavaScript declarativeNetRequest API #4382

Draft
wants to merge 37 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f38c582
Add top level properties
moritztim Jan 21, 2025
d7b99f7
Add top level description
moritztim Jan 21, 2025
9572c0e
Add maximum
moritztim Jan 21, 2025
0934961
Add domainType property
moritztim Jan 21, 2025
3991a89
Add domains definition
moritztim Jan 21, 2025
b86490b
Create canonical domain regex
moritztim Jan 22, 2025
8ffe2dd
Add domains related properties
moritztim Jan 22, 2025
e7e9a89
Add docs links
moritztim Jan 22, 2025
5d66227
Add missing property
moritztim Jan 22, 2025
6356bb4
generalize stringArray
moritztim Jan 22, 2025
bb05f21
Add missing sentence and link
moritztim Jan 22, 2025
7ae389f
Mark explicitly as deprecated
moritztim Jan 22, 2025
2b38065
fix typo
moritztim Jan 22, 2025
6124f1b
add more properties
moritztim Jan 22, 2025
68c6055
Define requestMethod
moritztim Jan 22, 2025
368a6dd
Add exclusive properties
moritztim Jan 22, 2025
760c744
Add remaining properties
moritztim Jan 22, 2025
f82cf2b
Specify HeaderInfo
moritztim Jan 22, 2025
71e0802
formatting
moritztim Jan 22, 2025
d540769
Add action
moritztim Jan 22, 2025
0b6228e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
2ab60aa
rename to fit convention
moritztim Jan 22, 2025
25a040c
bruh moment
moritztim Jan 22, 2025
078d282
add id
moritztim Jan 22, 2025
4f18bbd
add to catalog
moritztim Jan 22, 2025
eac4271
Add missing type declaration
moritztim Jan 22, 2025
3f8d6ac
define resourceType
moritztim Jan 22, 2025
3be0e24
add modifyHeaders
moritztim Jan 22, 2025
e3f480b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
803877a
implement limitations and restrictions
moritztim Jan 22, 2025
ffa559a
allow for overlap between string and const
moritztim Jan 22, 2025
121cd0e
Allow for other types
moritztim Jan 22, 2025
b67f78a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
2e4c175
fix casing
moritztim Jan 22, 2025
32fb20e
fix matching multiple schemas
moritztim Jan 22, 2025
2b7027d
fix matching multiple schemas here too
moritztim Jan 22, 2025
f2e823a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
implement limitations and restrictions
  • Loading branch information
moritztim committed Jan 22, 2025
commit 803877a88c9d83a525ab20fe1ac14960bede8d89
73 changes: 68 additions & 5 deletions src/schemas/json/declarative-net-request-ruleset.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,30 @@
"description": "tabs.TAB_ID_NONE\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/TAB_ID_NONE"
}
]
},
"chromeAppendableHeader": {
"enum": [
"Accept",
"Accept-Encoding",
"Accept-Language",
"Access-Control-Request-Headers",
"Cache-Control",
"Connection",
"Content-Language",
"Cookie",
"Forwarded",
"If-Match",
"If-None-Match",
"Keep-Alive",
"Range",
"Te",
"Trailer",
"Transfer-Encoding",
"Upgrade",
"Via",
"Want-Digest",
"X-Forwarded-For"
]
}
},
"items": {
Expand Down Expand Up @@ -519,17 +543,56 @@
"required": ["header", "operation"],
"properties": {
"header": {
"type": "string",
"description": "The name of the header to be modified.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ModifyHeaderInfo#header"
"anyOf": [
{
"type": "string",
"description": "The name of the header to be modified.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ModifyHeaderInfo#header"
},
{
"$ref": "#/definitions/chromeAppendableHeader"
}
]
},
"operation": {
"type": "string",
"description": "The operation to be performed on a header.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ModifyHeaderInfo#operation",
"enum": ["append", "set", "remove"]
}
},
"if": {
"not": {
"properties": {
"operation": {
"const": "remove"
}
}
}
},
"then": {
"properties": {
"value": {
"type": "string",
"description": "The new value for the header. Must be specified for append and set operations.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ModifyHeaderInfo#value"
}
},
"value": {
"type": "string",
"description": "The new value for the header. Must be specified for append and set operations. Not allowed for the \"remove\" operation.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ModifyHeaderInfo#value"
"if": {
"properties": {
"operation": {
"const": "append"
},
"header": {
"not": {
"$ref": "#/definitions/chromeAppendableHeader"
}
}
}
},
"then": {
"properties": {
"header": {
"description": "The new value for the header. Must be specified for append and set operations.\n\nNote:This operation is not supported for this header by chrome. See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ModifyHeaderInfo#header_limits.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ModifyHeaderInfo#value"
}
}
}
}
}
Expand Down
Loading