Commit Graph

122 Commits

Author SHA1 Message Date
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
Tomislav Jovanovic
0447ea6c31 Bug 1745819 - Require origin permission for content scripts in mv3 r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D141557
2022-03-24 23:41:01 +00:00
Richa Sharma
8c1abbe67e Bug 1470651 - Support cookieStoreId option in contentScripts.register r=rpl,robwu
Differential Revision: https://phabricator.services.mozilla.com/D124537
2021-12-13 12:30:26 +00:00
Csoregi Natalia
bd7e96b52c Backed out changeset d847e5e30768 (bug 1470651) for failures on test_ext_contentScripts_register.js. CLOSED TREE 2021-12-07 16:09:50 +02:00
Richa Sharma
a2d7a552d9 Bug 1470651 - Support cookieStoreId option in contentScripts.register r=rpl,robwu
Differential Revision: https://phabricator.services.mozilla.com/D124537
2021-12-07 13:30:09 +00:00
Luca Greco
f77c91a2a9 Bug 1638097 - Add a temporarilyInstalled boolean property to WebExtensionPolicy. r=mixedpuppy
This patch adds a new `temporarilyInstalled` property to the WebExtensionPolicy object, set to
the value of the same property from a Extension.jsm perspective.

The new property is being introduced mainly to be used in a patch that follows to allow the
ServiceWorkerManager internals to access that from the C++ layer (but it may be also
become a useful knowledge for other C++ components in the future).

Differential Revision: https://phabricator.services.mozilla.com/D119529
2021-07-14 14:13:00 +00:00
Alexandru Michis
039be67939 Backed out changeset 19de2822bc0c (bug 1711168) for causing Bug 1719063.
CLOSED TREE
2021-07-08 22:56:34 +03:00
Shane Caraveo
740ccc1faf Bug 1711168 support extension matching in webAccessibleResources r=zombie,smaug
Differential Revision: https://phabricator.services.mozilla.com/D115114
2021-06-23 21:52:38 +00:00
Sonia Singla
d4569b4c00 Bug 1661517 - Removed extensions.allowPrivateBrowsingByDefault preference. r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D97094
2021-06-02 21:48:05 +00:00
Nika Layzell
d50d90be74 Bug 1535913 - Part 2: Hold a keepalive for extension BCGs in WebExtensionPolicy, r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D114889
2021-05-26 15:25:43 +00:00
Dorel Luca
d1b3de3fb7 Backed out 2 changesets (bug 1535913) for Hazzard failure
Backed out changeset 1675ff18e322 (bug 1535913)
Backed out changeset fbcd65f308c2 (bug 1535913)
2021-05-20 01:33:36 +03:00
Nika Layzell
1af647666c Bug 1535913 - Part 2: Hold a keepalive for extension BCGs in WebExtensionPolicy, r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D114889
2021-05-19 17:17:35 +00:00
Shane Caraveo
b7d786165e Bug 1697334 implement matches property in web_accessible_resources r=zombie,ckerschb,necko-reviewers,smaug
This patch implements support for the manifest V3 matches property
which limits what hosts may load an extensions web_accessible_resources.

Differential Revision: https://phabricator.services.mozilla.com/D107746
2021-05-14 03:15:15 +00:00
Shane Caraveo
364da57f68 Bug 1696580 Add support for object form of web_accessible_resources r=zombie
This is the initial level of support for MV3 web_accessible_resources, which simply moves the
resource list into an object notation.  It lays out the framework to support the additional functionality
that will be implemented in followup bugs.

Differential Revision: https://phabricator.services.mozilla.com/D107310
2021-05-14 03:15:15 +00:00
Shane Caraveo
32971d7a72 Bug 1594234 manifest v3 content security policy support r=robwu,geckoview-reviewers,agi
Implement manifest v3 CSP that is compatible with the current chrome implementation.

Support for content_security_policy.isolated_world (a.k.a. content_security_policy.content_scripts)
has been removed for consistency with
345390adf6%5E%21/

Differential Revision: https://phabricator.services.mozilla.com/D100573
2021-01-07 14:53:18 +00:00
Simon Giesecke
eae3689379 Bug 1673931 - Avoid including Document.h from header files. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D95046

Depends on D95045
2020-11-23 16:07:43 +00:00
Kashav Madan
a38531ab04 Bug 1666485 - Make BrowsingContext::CreatedDynamically non-synced, r=nika,kmag
Differential Revision: https://phabricator.services.mozilla.com/D89223
2020-09-23 13:43:38 +00:00