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

Bug 1943050 new webExtension.api.userScripts #25913

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
42 changes: 42 additions & 0 deletions webextensions/api/runtime.json
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,48 @@
}
}
},
"onUserScriptConnect": {
"__compat": {
"support": {
"chrome": {
"version_added": "115",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115",
"version_added": "120",

"notes": "Available for use with Manifest V3 only."
},
"edge": "mirror",
"firefox": {
"version_added": "136",
"notes": "Available for use with Manifest V3 only."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Chrome, these two events are always available in the runtime namespace. In Firefox, the event requires the "userScripts" permission to be granted.

},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"onUserScriptMessage": {
"__compat": {
"support": {
"chrome": {
"version_added": "115",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115",
"version_added": "120",

"notes": "Available for use with Manifest V3 only."
},
"edge": "mirror",
"firefox": {
"version_added": "136",
"notes": "Available for use with Manifest V3 only."
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"openOptionsPage": {
"__compat": {
"mdn_url": "https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/runtime/openOptionsPage",
Expand Down
235 changes: 193 additions & 42 deletions webextensions/api/userScripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,74 @@
"webextensions": {
"api": {
"userScripts": {
"__compat": {
"mdn_url": "https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/userScripts",
"support": {
"chrome": {
"version_added": "115",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115",
"version_added": "120",

Unless stated otherwise, Chrome's userScripts API became available on release in version 120:

"notes": "Available for use with Manifest V3 only."
},
"edge": "mirror",
"firefox": {
"version_added": "136",
"notes": "Available for use with Manifest V3 only."
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
},
"ExecutionWorld": {
"__compat": {
"support": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"support": {
"mdn_url": "https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/userScripts/ExecutionWorld",
"support": {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, the mdn_url will be added automatically once MDN documentation is published, so we don't need to add it manually here.

"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": "136"
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"RegisteredUserScript": {
"__compat": {
"mdn_url": "https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/userScripts/RegisteredUserScript",
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": "136"
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also specify the worldId property separately in RegisteredUserScript (and WorldProperties, below), because Chrome introduced support in 133 (not 115 nor 120).

This is connected to the "multiple user script worlds feature":

},
"ScriptSource": {
"__compat": {
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": "68"
"version_added": "136"
},
"firefox_android": "mirror",
"opera": "mirror",
Expand All @@ -20,38 +78,93 @@
},
"safari_ios": "mirror"
}
},
"unregister": {
"__compat": {
"mdn_url": "https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/userScripts/RegisteredUserScript/unregister",
"support": {
"chrome": {
"version_added": false
},
"edge": "mirror",
"firefox": {
"version_added": "68"
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"UserScriptFilter": {
"__compat": {
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": "136"
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"onBeforeScript": {
"WorldProperties": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also specify the worldId property separately in WorldProperties, below, because Chrome introduced support in 133 (not 115 nor 120).

This is connected to the "multiple user script worlds feature":

Since there are only a few (3) properties in WorldProperties, we could consider enumerating them all?

"__compat": {
"mdn_url": "https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/userScripts/onBeforeScript",
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": "136"
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"configureWorld": {
"__compat": {
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": "68"
"version_added": "136"
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"getScripts": {
"__compat": {
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": "136"
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"getWorldConfigurations": {
"__compat": {
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
"edge": "mirror",
"firefox": {
"version_added": "136"
},
"firefox_android": "mirror",
"opera": "mirror",
Expand All @@ -67,11 +180,49 @@
"mdn_url": "https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/userScripts/register",
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": "136"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we somehow mention the legacy version of the API in a note?

},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"resetWorldConfiguration": {
"__compat": {
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
"edge": "mirror",
"firefox": {
"version_added": "136"
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"unregister": {
"__compat": {
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": "68"
"version_added": "136"
},
"firefox_android": "mirror",
"opera": "mirror",
Expand All @@ -80,24 +231,24 @@
},
"safari_ios": "mirror"
}
},
"cookieStoreId": {
"__compat": {
"support": {
"chrome": {
"version_added": false
},
"edge": "mirror",
"firefox": {
"version_added": "98"
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"update": {
"__compat": {
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": "136"
},
"firefox_android": "mirror",
"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
}
Expand Down
20 changes: 20 additions & 0 deletions webextensions/manifest/optional_permissions.json
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,26 @@
}
}
},
"userScripts": {
"__compat": {
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": "136",
"notes": "Provided as an optional-only permission."
},
"firefox_android": "mirror",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permission is not supported on Android either, until https://bugzilla.mozilla.org/show_bug.cgi?id=1949955 is fixed.

Suggested change
"firefox_android": "mirror",
"firefox_android": {
"version_added": false
},

"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"webNavigation": {
"__compat": {
"support": {
Expand Down
20 changes: 20 additions & 0 deletions webextensions/manifest/permissions.json
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,26 @@
}
}
},
"userScripts": {
"__compat": {
"support": {
"chrome": {
"version_added": "115"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "115"
"version_added": "120"

},
"edge": "mirror",
"firefox": {
"version_added": false,
"notes": "Provided as an optional-only permission."
},
"firefox_android": "mirror",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permission is not supported on Android either, until https://bugzilla.mozilla.org/show_bug.cgi?id=1949955 is fixed.

Suggested change
"firefox_android": "mirror",
"firefox_android": {
"version_added": false
},

"opera": "mirror",
"safari": {
"version_added": false
},
"safari_ios": "mirror"
}
}
},
"webNavigation": {
"__compat": {
"support": {
Expand Down
Loading