Commit graph

140 commits

Author SHA1 Message Date
Rob Wu
f0d077129a Bug 1841483 - activeTab should always match same-origin frames r=zombie
Differential Revision: https://phabricator.services.mozilla.com/D184179
2023-07-25 21:45:33 +00:00
Tomislav Jovanovic
da6d3f082a Bug 1838230 - Exposee read/write property WebExtensionPolicy::ignoreQuarantine r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D180872
2023-06-15 01:41:54 +00:00
Tomislav Jovanovic
ac05dd52f5 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
94cb12435e 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
5bd9a5e6a1 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
c3e1048e3e 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
aecc6a1a6b 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
a8bb1292e2 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
a4606b1d02 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
233d36d3c4 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
5b65c52eed 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
88e501708c 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
a525f604ba 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
00d5a50ae8 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
ecf37bac83 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
dcf9babb6e 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
f93aec2685 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
79f273e3a8 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
523f5e3554 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
d0bc1a4912 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
2d217d3622 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
9b9ee3e060 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
41e04d2867 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
ad09900fd3 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
754f6e44f0 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
8da7477620 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
39d5ab2ad8 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
2e012c9e0f 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
026c841ffb 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
f2e24180f6 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
a181c16953 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
9e70d31e32 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
663d7bf785 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
6757ad1a76 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
0d48ba1fc6 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
bc80bc678e 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
bc481f252f 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
f1212fb1db 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
ae6f4c94fc 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
8d60992fa4 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
a73cd6df49 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
084ef9d95b 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
1ae9b981aa 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
fe578cafc5 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
cfbbd2cf8d 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
cf003c21f0 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
4d59317ca4 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
1541cb59a7 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
283bdce6c6 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
f5e2b4ba7b 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