Commit Graph

138 Commits

Author SHA1 Message Date
Tomislav Jovanovic
8d19b2cfdd Bug 1834825 - Implement Quarantined Domains list, r=willdurand,rpl
Differential Revision: https://phabricator.services.mozilla.com/D178967
2023-05-25 18:45:38 +00:00
Luca Greco
f65665d7bd Bug 1811443 - Support optional background.type "module" for WebExtensions Event Page scripts. r=willdurand,robwu
Differential Revision: https://phabricator.services.mozilla.com/D169922
2023-02-16 13:56:18 +00:00
Nika Layzell
fe3cb4a520 Bug 1443925 - Part 9: Allow checking webextension permissions from off-main-thread through WebExtensionPolicyCore, r=extension-reviewers,kmag
This requires migrating some members from WebExtensionPolicy to
WebExtensionPolicyCore. The mHostPermissions member could not be fully
transferred, as the WebIDL reflector needs to be cached for
WebExtensionPolicy.allowedOrigins, however the threadsafe core is shared.

Differential Revision: https://phabricator.services.mozilla.com/D163039
2022-12-02 00:53:52 +00:00
Nika Layzell
44f98642a9 Bug 1443925 - Part 8: Make WebExtensionPolicy::IsRestrictedURI threadsafe, r=extension-reviewers,kmag
This migrates the restricted domain preference handling to be performed on the
ExtensionPolicyService, wrapping it in an RWLock, making it threadsafe to
interact with.

Differential Revision: https://phabricator.services.mozilla.com/D163038
2022-12-02 00:53:52 +00:00
Nika Layzell
cd62781ca1 Bug 1793995 - Part 8: Move WebAccessibleResources into the threadsafe core, r=kmag
This will be required in the future to make getting protocol flags for
moz-extension:// URIs threadsafe.

Differential Revision: https://phabricator.services.mozilla.com/D158886
2022-10-13 21:47:00 +00:00
Nika Layzell
1de98126f3 Bug 1793995 - Part 7: Use threadsafe refcounting for WebAccessibleResource, r=kmag
Now that all fields and methods in WebAccessibleResource have been made
threadsafe, we can make the type itself be threadsafe.

Differential Revision: https://phabricator.services.mozilla.com/D158885
2022-10-13 21:47:00 +00:00
Nika Layzell
42719ba39a Bug 1793995 - Part 6: Allow looking up a WebExtensionPolicyCore from any thread, r=kmag
In order to make WebAccessibleResource threadsafe, as well as other places, it
needs to be possible to look up a `WebExtensionPolicyCore` from any thread.
This is handled by using a static method on the ExtensionPolicyService for this
task, and keeping a seperate mutex-guarded static table under the hood.

Theoretically the table within `ExtensionPolicyService()` could also be
removed, however I held off on doing that in case it would have a negative
performance impact to take extra locks and follow extra pointers.

Differential Revision: https://phabricator.services.mozilla.com/D158884
2022-10-13 21:47:00 +00:00
Nika Layzell
4834741830 Bug 1793995 - Part 5: Factor out the threadsafe core of MatchPattern and MatchPatternSet, r=kmag
Similar to MatchGlob, this is fairly straightforward, but is complicated
slightly by `MatchPatternSet`, which allows being destructured into the
contained `MatchPattern` instances in a `[Constant]` method. To handle this a
cache is added for the wrappers in the cycle-collected `MatchPatternSet`.

Differential Revision: https://phabricator.services.mozilla.com/D158883
2022-10-13 21:46:59 +00:00
Nika Layzell
3c70e3f986 Bug 1793995 - Part 4: Split out the threadsafe core from MatchGlob, r=kmag
The outer cycle-collected wrapper type is unfortunately still required by
WebIDL in order to keep the JS API working.

Differential Revision: https://phabricator.services.mozilla.com/D158882
2022-10-13 21:46:59 +00:00
Nika Layzell
8f137b4b72 Bug 1793995 - Part 1: Move immutable parts of WebExtensionPolicy to a threadsafe core type, r=kmag
This threadsafe core type also acts as a weak reference to the main-thread
WebExtensionPolicy when needed. This will be used when information about a
WebExtension is needed to be accessible off-main-thread in the future.

Differential Revision: https://phabricator.services.mozilla.com/D158879
2022-10-13 21:46:58 +00:00
Nika Layzell
bf15ab74e6 Bug 1693271 - Part 1: Use RustRegex for MatchGlob, r=kmag
This also involves making MatchGlob operate on UTF8String instead of DOMString,
as the rust `regex` crate operates on utf-8 strings. This should have no
functional impact on callers.

Differential Revision: https://phabricator.services.mozilla.com/D158877
2022-10-13 21:46:57 +00:00
Cristian Tuns
8d27a1d79c Backed out 15 changesets (bug 1794001, bug 1793995, bug 1693271) for causing build bustages CLOSED TREE
Backed out changeset 5d4b0c23342f (bug 1793995)
Backed out changeset 79a5023e7822 (bug 1793995)
Backed out changeset 4330821df43f (bug 1793995)
Backed out changeset a653699a5cef (bug 1793995)
Backed out changeset 264a0154514e (bug 1793995)
Backed out changeset 6773cada61a8 (bug 1793995)
Backed out changeset d55a78f3627a (bug 1793995)
Backed out changeset 16299839e25e (bug 1793995)
Backed out changeset 10c5cf69b3f0 (bug 1693271)
Backed out changeset 84e7bf515c94 (bug 1693271)
Backed out changeset b8dbabe61a9a (bug 1794001)
Backed out changeset 3cfe4087793d (bug 1794001)
Backed out changeset dd03b0396eb9 (bug 1794001)
Backed out changeset d4f9b4a3029a (bug 1794001)
Backed out changeset 148d136ce549 (bug 1794001)
2022-10-12 22:12:26 -04:00
Nika Layzell
8fa22ba877 Bug 1793995 - Part 8: Move WebAccessibleResources into the threadsafe core, r=kmag
This will be required in the future to make getting protocol flags for
moz-extension:// URIs threadsafe.

Differential Revision: https://phabricator.services.mozilla.com/D158886
2022-10-12 23:57:25 +00:00
Nika Layzell
f4a4590244 Bug 1793995 - Part 7: Use threadsafe refcounting for WebAccessibleResource, r=kmag
Now that all fields and methods in WebAccessibleResource have been made
threadsafe, we can make the type itself be threadsafe.

Differential Revision: https://phabricator.services.mozilla.com/D158885
2022-10-12 23:57:25 +00:00
Nika Layzell
930c6b0e6f Bug 1793995 - Part 6: Allow looking up a WebExtensionPolicyCore from any thread, r=kmag
In order to make WebAccessibleResource threadsafe, as well as other places, it
needs to be possible to look up a `WebExtensionPolicyCore` from any thread.
This is handled by using a static method on the ExtensionPolicyService for this
task, and keeping a seperate mutex-guarded static table under the hood.

Theoretically the table within `ExtensionPolicyService()` could also be
removed, however I held off on doing that in case it would have a negative
performance impact to take extra locks and follow extra pointers.

Differential Revision: https://phabricator.services.mozilla.com/D158884
2022-10-12 23:57:24 +00:00
Nika Layzell
fe4da9f673 Bug 1793995 - Part 5: Factor out the threadsafe core of MatchPattern and MatchPatternSet, r=kmag
Similar to MatchGlob, this is fairly straightforward, but is complicated
slightly by `MatchPatternSet`, which allows being destructured into the
contained `MatchPattern` instances in a `[Constant]` method. To handle this a
cache is added for the wrappers in the cycle-collected `MatchPatternSet`.

Differential Revision: https://phabricator.services.mozilla.com/D158883
2022-10-12 23:57:24 +00:00
Nika Layzell
4d11c49d85 Bug 1793995 - Part 4: Split out the threadsafe core from MatchGlob, r=kmag
The outer cycle-collected wrapper type is unfortunately still required by
WebIDL in order to keep the JS API working.

Differential Revision: https://phabricator.services.mozilla.com/D158882
2022-10-12 23:57:23 +00:00
Nika Layzell
ccf9378b76 Bug 1793995 - Part 1: Move immutable parts of WebExtensionPolicy to a threadsafe core type, r=kmag
This threadsafe core type also acts as a weak reference to the main-thread
WebExtensionPolicy when needed. This will be used when information about a
WebExtension is needed to be accessible off-main-thread in the future.

Differential Revision: https://phabricator.services.mozilla.com/D158879
2022-10-12 23:57:22 +00:00
Nika Layzell
72b377b1c7 Bug 1693271 - Part 1: Use RustRegex for MatchGlob, r=kmag
This also involves making MatchGlob operate on UTF8String instead of DOMString,
as the rust `regex` crate operates on utf-8 strings. This should have no
functional impact on callers.

Differential Revision: https://phabricator.services.mozilla.com/D158877
2022-10-12 23:57:21 +00:00
Cristian Tuns
d6fbf59d81 Backed out 15 changesets (bug 1794001, bug 1693271, bug 1793995) for causing build bustages on RustRegex.h CLOSED TREE
Backed out changeset 93fa076646e1 (bug 1793995)
Backed out changeset 3deec78af656 (bug 1793995)
Backed out changeset 61d74f2cf5cf (bug 1793995)
Backed out changeset 8484584cc787 (bug 1793995)
Backed out changeset f7d78fffc836 (bug 1793995)
Backed out changeset 37ccdfa60f9a (bug 1793995)
Backed out changeset 06d7d4823419 (bug 1793995)
Backed out changeset 5cb4daddadb9 (bug 1793995)
Backed out changeset 8b71c15f24c7 (bug 1693271)
Backed out changeset 77c06db920fe (bug 1693271)
Backed out changeset e286fb05d64f (bug 1794001)
Backed out changeset ea8ba9ce54c8 (bug 1794001)
Backed out changeset 27715593ce6f (bug 1794001)
Backed out changeset d1030c02b560 (bug 1794001)
Backed out changeset 80b01e63ca54 (bug 1794001)
2022-10-12 12:57:05 -04:00
Nika Layzell
04cd0deb33 Bug 1793995 - Part 8: Move WebAccessibleResources into the threadsafe core, r=kmag
This will be required in the future to make getting protocol flags for
moz-extension:// URIs threadsafe.

Differential Revision: https://phabricator.services.mozilla.com/D158886
2022-10-12 15:39:57 +00:00
Nika Layzell
0076d1d934 Bug 1793995 - Part 7: Use threadsafe refcounting for WebAccessibleResource, r=kmag
Now that all fields and methods in WebAccessibleResource have been made
threadsafe, we can make the type itself be threadsafe.

Differential Revision: https://phabricator.services.mozilla.com/D158885
2022-10-12 15:39:56 +00:00
Nika Layzell
2b29d750bf Bug 1793995 - Part 6: Allow looking up a WebExtensionPolicyCore from any thread, r=kmag
In order to make WebAccessibleResource threadsafe, as well as other places, it
needs to be possible to look up a `WebExtensionPolicyCore` from any thread.
This is handled by using a static method on the ExtensionPolicyService for this
task, and keeping a seperate mutex-guarded static table under the hood.

Theoretically the table within `ExtensionPolicyService()` could also be
removed, however I held off on doing that in case it would have a negative
performance impact to take extra locks and follow extra pointers.

Differential Revision: https://phabricator.services.mozilla.com/D158884
2022-10-12 15:39:56 +00:00
Nika Layzell
f843a2468a Bug 1793995 - Part 5: Factor out the threadsafe core of MatchPattern and MatchPatternSet, r=kmag
Similar to MatchGlob, this is fairly straightforward, but is complicated
slightly by `MatchPatternSet`, which allows being destructured into the
contained `MatchPattern` instances in a `[Constant]` method. To handle this a
cache is added for the wrappers in the cycle-collected `MatchPatternSet`.

Differential Revision: https://phabricator.services.mozilla.com/D158883
2022-10-12 15:39:55 +00:00
Nika Layzell
d0f9d4e070 Bug 1793995 - Part 4: Split out the threadsafe core from MatchGlob, r=kmag
The outer cycle-collected wrapper type is unfortunately still required by
WebIDL in order to keep the JS API working.

Differential Revision: https://phabricator.services.mozilla.com/D158882
2022-10-12 15:39:55 +00:00
Nika Layzell
a87a62c0d2 Bug 1793995 - Part 1: Move immutable parts of WebExtensionPolicy to a threadsafe core type, r=kmag
This threadsafe core type also acts as a weak reference to the main-thread
WebExtensionPolicy when needed. This will be used when information about a
WebExtension is needed to be accessible off-main-thread in the future.

Differential Revision: https://phabricator.services.mozilla.com/D158879
2022-10-12 15:39:53 +00:00
Nika Layzell
9b90ca6ec6 Bug 1693271 - Part 1: Use RustRegex for MatchGlob, r=kmag
This also involves making MatchGlob operate on UTF8String instead of DOMString,
as the rust `regex` crate operates on utf-8 strings. This should have no
functional impact on callers.

Differential Revision: https://phabricator.services.mozilla.com/D158877
2022-10-12 15:39:52 +00:00
Nika Layzell
e8dc2c0ae7 Bug 1793997 - Don't require unified build for toolkit/components/extensions, r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D158871
2022-10-11 23:06:07 +00:00
Rob Wu
e4229303f7 Bug 1789751 - Remove localhost from MV3 CSP r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D156758
2022-09-10 23:49:49 +00:00
Rob Wu
9288673133 Bug 1766881 - Drop object-src requirement from extension CSP r=mixedpuppy
object-src used to be required because it controls plugins, and we did
not want to load unsafe sources as plugins. With NPAPI plugin support
having been dropped a long time ago, this reason no longer exist.
The requirement for "secure" object-src CSP directive meant that
extensions had to specify a boilerplate object-src if they wanted to
modify script-src.

This patch removes the object-src requirement from extension CSP,
which simplifies the usage and learning curve of CSP usage in
extensions.

With this change, extensions can now load "unsafe" (remote) content
via `<embed>` and `<object>` tags. This relaxation does not reduce
the security because this was already possible with `<iframe>` tags.

Differential Revision: https://phabricator.services.mozilla.com/D156747
2022-09-10 23:49:48 +00:00
Shane Caraveo
ef50590a13 Bug 1786564 allow access to static theme resources in extensions r=rpl,necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D156618
2022-09-07 20:16:19 +00:00
Shane Caraveo
7b13a7a057 Bug 1783442 Fix cases where case sensitivy matters in WebExtensionPolicy r=zombie
Differential Revision: https://phabricator.services.mozilla.com/D153867
2022-08-08 15:39:37 +00:00
Shane Caraveo
bcdf31e048 Bug 1773115 fix extension global matching for web accessible resources r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D153865
2022-08-08 15:39:36 +00:00
Tomislav Jovanovic
d41fd58a7a Bug 1781801 - Make activeTab target sameOriginWithTop iframes in MV3 r=willdurand
Differential Revision: https://phabricator.services.mozilla.com/D153766
2022-08-08 13:34:10 +00:00
Shane Caraveo
cf6598bc39 Bug 1773115 ensure extension access to its own web accessible resources r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D150498
2022-08-02 17:08:59 +00:00
Shane Caraveo
4e3ceb6b90 Bug 1711168 support extension matching in webAccessibleResources r=zombie,smaug,rpl
Differential Revision: https://phabricator.services.mozilla.com/D115114
2022-08-02 17:08:58 +00:00
Butkovits Atila
b01ed36979 Backed out 3 changesets (bug 1711168, bug 1773115) for causing failures at test_ext_web_accessible_resources.html. CLOSED TREE
Backed out changeset 703c909eb009 (bug 1773115)
Backed out changeset 902385a7ce60 (bug 1711168)
Backed out changeset 3d061ce03de7 (bug 1711168)
2022-07-27 00:13:26 +03:00
Shane Caraveo
ac5fcd6217 Bug 1773115 ensure extension access to its own web accessible resources r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D150498
2022-07-26 19:39:15 +00:00
Shane Caraveo
addcb41d12 Bug 1711168 support extension matching in webAccessibleResources r=zombie,smaug,rpl
Differential Revision: https://phabricator.services.mozilla.com/D115114
2022-07-26 19:39:14 +00:00
Kagami Sascha Rosylight
72fd693b02 Bug 1769290 - Part 17: Apply mozilla-js-handle-rooted-typedef against toolkit/components/extensions r=andi,extension-reviewers,rpl
Differential Revision: https://phabricator.services.mozilla.com/D151784
2022-07-14 17:00:22 +00:00
Tomislav Jovanovic
ead2b98c2f Bug 1774641 - Run content scripts on action click with ungranted host permission r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D149621
2022-06-23 21:08:56 +00:00
smolnar
85cbea3145 Backed out 2 changesets (bug 1774641) for causing browser-chrome failures in browser/components/extensions/test/browser/browser_ext_browserAction_activeScript.js CLOSED TREE
Backed out changeset e381563e7786 (bug 1774641)
Backed out changeset b57a7dca9b97 (bug 1774641)
2022-06-23 17:54:12 +03:00
Tomislav Jovanovic
5ef3e62f87 Bug 1774641 - Run content scripts on action click with ungranted host permission r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D149621
2022-06-23 13:04:09 +00:00
Tom Schuster
aa9abf5dc5 Bug 1740263 - Continue to allow WASM by default in Webextensions v2. r=mixedpuppy,robwu
Differential Revision: https://phabricator.services.mozilla.com/D142953
2022-05-19 14:13:51 +00:00
Iulian Moraru
979c59be19 Backed out 6 changesets (bug 1740263) for causing bp-hybrid bustages on nsScriptSecurityManager. CLOSED TREE
Backed out changeset 2f5ec6ad0f81 (bug 1740263)
Backed out changeset a1e7766cdb94 (bug 1740263)
Backed out changeset 3978ccb95455 (bug 1740263)
Backed out changeset e34ba774b3f8 (bug 1740263)
Backed out changeset 8365b10be28e (bug 1740263)
Backed out changeset d923462c9cd0 (bug 1740263)
2022-05-19 03:28:08 +03:00
Tom Schuster
d5bd140683 Bug 1740263 - Continue to allow WASM by default in Webextensions v2. r=mixedpuppy,robwu
Differential Revision: https://phabricator.services.mozilla.com/D142953
2022-05-18 21:39:30 +00:00
Tomislav Jovanovic
c75f78076e Bug 1745819 - Require origin permission for content scripts in mv3 r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D141557
2022-03-25 17:57:57 +00:00
smolnar
5d6babbf2f Backed out changeset cfe47d0d9f1e (bug 1745819) for causing build bustages in toolkit/components/extensions/WebExtensionPolicy.cpp CLOSED TREE 2022-03-25 18:12:25 +02:00
Tomislav Jovanovic
bf99daf439 Bug 1745819 - Require origin permission for content scripts in mv3 r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D141557
2022-03-25 15:04:29 +00:00
Iulian Moraru
6628ab192e Backed out changeset b4f503076020 (bug 1745819) for causing mochitest failures on test_ext_scripting_contentScripts.html. CLOSED TREE 2022-03-25 03:07:49 +02:00