Commit Graph

2455 Commits

Author SHA1 Message Date
serge-sans-paille
f9b7740fc8 Bug 1818446 - Make caps/tests/gtest buildable outside of a unified build environment r=andi
Depends on D170728

Differential Revision: https://phabricator.services.mozilla.com/D170729
2023-02-27 13:43:01 +00:00
Butkovits Atila
2f6b1a7ad1 Backed out changeset 3cdcc72baa6e (bug 1776755) for causing failures at test_ext_contentscript_triggeringPrincipal.js. 2023-02-14 19:30:16 +02:00
june wilde
9f0c374a0a Bug 1776755 - Skip ordering ExpandedPrincipals to speed up creation; r=nika,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D161450
2023-02-14 15:03:40 +00:00
Peter Van der Beken
46c52d2b18 Bug 1795312 - Optimize serializing enums as JSON string keys for principals. r=farre
Depends on D166953

Differential Revision: https://phabricator.services.mozilla.com/D166954
2023-02-14 10:17:17 +00:00
Peter Van der Beken
cec60f10c8 Bug 1795312 - Avoid a Json::Value copy. r=farre
Depends on D166810

Differential Revision: https://phabricator.services.mozilla.com/D166953
2023-02-14 10:17:17 +00:00
Peter Van der Beken
05fc824ead Bug 1795312 - Cache the Json::StreamWriterBuilder for serializing principals. r=farre
Depends on D166783

Differential Revision: https://phabricator.services.mozilla.com/D166810
2023-02-14 10:17:17 +00:00
Andreas Farre
b09078e6a7 Bug 1795312 - Don't Base64 encode principals when serializing. r=peterv
Base64 encoding is done to top-level principal and the sub-principals
of expanded principals. Getting rid of the Base64 encoding entirely
also lets us use jsoncpp consider expanded principals to be entirely
serialized as JSON.

Differential Revision: https://phabricator.services.mozilla.com/D166783
2023-02-14 10:17:16 +00:00
Cristina Horotan
4f2132fd1e Backed out 5 changesets (bug 1795312) for causing build bustage at BasePrincipal.h on a CLOSED TREE
Backed out changeset c4f9e74d6164 (bug 1795312)
Backed out changeset 2594a213283c (bug 1795312)
Backed out changeset bc1c5b1c2d85 (bug 1795312)
Backed out changeset 38f9e767cc32 (bug 1795312)
Backed out changeset a732c5bcc392 (bug 1795312)
2023-02-08 19:33:48 +02:00
Andreas Farre
5a15e3845e Bug 1795312 - Remove newly introduced intermittent test. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D169205
2023-02-08 16:05:52 +00:00
Peter Van der Beken
40c317a4de Bug 1795312 - Optimize serializing enums as JSON string keys for principals. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D166954
2023-02-08 12:57:10 +00:00
Peter Van der Beken
ac65f99ac2 Bug 1795312 - Avoid a Json::Value copy. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D166953
2023-02-08 12:57:10 +00:00
Peter Van der Beken
6fc2cc9d41 Bug 1795312 - Cache the Json::StreamWriterBuilder for serializing principals. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D166810
2023-02-08 12:57:09 +00:00
Andreas Farre
ff25742a1d Bug 1795312 - Don't Base64 encode principals when serializing. r=peterv
Base64 encoding is done to top-level principal and the sub-principals
of expanded principals. Getting rid of the Base64 encoding entirely
also lets us use jsoncpp consider expanded principals to be entirely
serialized as JSON.

Differential Revision: https://phabricator.services.mozilla.com/D166783
2023-02-08 12:57:09 +00:00
Cristian Tuns
429b1e8615 Backed out changeset 2b1d90490648 (bug 1776755) for causing xpcshells failures CLOSED TREE 2023-02-07 12:53:31 -05:00
june wilde
46711bc1dc Bug 1776755 - Skip ordering ExpandedPrincipals to speed up creation; r=nika,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D161450
2023-02-07 16:47:29 +00:00
Andrew McCreight
0e20ed96ec Bug 961019 - Remove nsIClassInfo::MAIN_THREAD_ONLY. r=peterv,necko-reviewers
XPConnect has been single threaded for a long time, so this
flag doesn't do anything.

Differential Revision: https://phabricator.services.mozilla.com/D168442
2023-02-01 21:45:44 +00:00
Dave Townsend
b752598495 Bug 1792138: Show the extension's name in permission prompts for opening external links. r=ckerschb,robwu,fluent-reviewers,pbz,flod
In order to handle the content script case correctly we must expose the
contentScriptAddonPolicy to JavaScript. With that we can always see what
extension is trying to perform an action and use its name rather than internal
ID in the dialog.

Differential Revision: https://phabricator.services.mozilla.com/D161282
2023-01-07 17:53:19 +00:00
Sylvestre Ledru
1f8d23143a Bug 1802288 - remove trailing whitespaces in idl/webidl files r=credential-management-reviewers,webidl,smaug,sgalich
Differential Revision: https://phabricator.services.mozilla.com/D165559
2022-12-28 09:52:44 +00:00
Stanca Serban
bd29139bde Backed out changeset 514642d76faa (bug 1792138) for causing mochitests failures in test_ext_protocolHandlers.html. CLOSED TREE 2022-12-13 14:53:38 +02:00
Dave Townsend
e021cf6a60 Bug 1792138: Show the extension's name in permission prompts for opening external links. r=ckerschb,robwu,fluent-reviewers,pbz,flod
In order to handle the content script case correctly we must expose the
contentScriptAddonPolicy to JavaScript. With that we can always see what
extension is trying to perform an action and use its name rather than internal
ID in the dialog.

Differential Revision: https://phabricator.services.mozilla.com/D161282
2022-12-13 10:43:32 +00:00
Nika Layzell
8351f7cc2d Bug 1804093 - Part 5: Eliminate WorkerPrincipal and WorkletPrincipals, r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D163856
2022-12-12 22:08:36 +00:00
Nika Layzell
6bde10f55f Bug 1804093 - Part 4: Allow ReadKnownPrincipalType off-main-thread, r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D163855
2022-12-12 22:08:35 +00:00
Nika Layzell
4a23819d11 Bug 1443925 - Part 12: Add some basic tests for using nsIPrincipal off-main-thread, r=ckerschb
These are far from comprehensive, and act mostly as smoke-tests that the
principal code is usable from off-main-thread.

Differential Revision: https://phabricator.services.mozilla.com/D163042
2022-12-02 00:53:54 +00:00
Nika Layzell
2869537fdd Bug 1443925 - Part 11: Document thread safety requirements for most principal methods, r=ckerschb
After the previous changes, the majority of methods on nsIPrincipal are now
threadsafe. This patch documents which methods are still bound to the main
thread, and adds thread assertions to them to avoid potential misuse.

Differential Revision: https://phabricator.services.mozilla.com/D163041
2022-12-02 00:53:53 +00:00
Nika Layzell
664e7d8b0e Bug 1443925 - Part 10: Use AddonPolicyCore rather than AddonPolicy for principals, r=ckerschb,extension-reviewers,kmag
This changes out almost all places `AddonPolicy()` is used within nsIPrincipal
implementations, replacing it with the threadsafe `AddonPolicyCore()` method
and `WebExtensionPolicyCore` type.

Differential Revision: https://phabricator.services.mozilla.com/D163040
2022-12-02 00:53:53 +00:00
Nika Layzell
c6fde75b19 Bug 1443925 - Part 6: Allow specifying Domain when creating content principals, r=ckerschb,bholley
This is required for deserializing nsIPrincipal instances from PrincipalInfo to
be threadsafe, as setting domain with `SetDomain()` is only safe on the main
thread, due to it enumerating and updating JS wrappers.

Differential Revision: https://phabricator.services.mozilla.com/D163036
2022-12-02 00:53:51 +00:00
Nika Layzell
b582df1238 Bug 1443925 - Part 5: Make it possible to get the system principal from any thread, r=ckerschb
This is required because the script security manager which currently owns the
singleton is main-thread only. This change still ties the lifecycle of the
static to that service, but also makes it generally available from any thread.

Differential Revision: https://phabricator.services.mozilla.com/D163035
2022-12-02 00:53:51 +00:00
Nika Layzell
59c29d8099 Bug 1443925 - Part 4: Avoid fetching nsScriptSecurityManager in BasePrincipal::IsSameOrigin, r=ckerschb
The script security manager is not a threadsafe service, but the method just
calls SecurityCompareURIs (which was made threadsafe in part 3). Switch to
calling that directly.

Differential Revision: https://phabricator.services.mozilla.com/D163034
2022-12-02 00:53:50 +00:00
Nika Layzell
ee682d387a Bug 1443925 - Part 3: Make nsScriptSecurityManager::GetStrictFileOriginPolicy threadsafe, r=ckerschb
This is used in various places in principals, as well as in the implementation
of nsScriptSecurityManager::SecurityCompareURIs which is also now threadsafe
after this change.

Differential Revision: https://phabricator.services.mozilla.com/D163033
2022-12-02 00:53:50 +00:00
Nika Layzell
e2f6bee4ab Bug 1443925 - Part 2: Make basic manipulation of nsIPrincipal threadsafe, r=ckerschb
This patch only makes the very basics of nsIPrincipal manipulation threadsafe,
such as reference counting, and some trivial methods. The more complex methods
will be made threadsafe in following parts.

Differential Revision: https://phabricator.services.mozilla.com/D163032
2022-12-02 00:53:50 +00:00
Olli Pettay
6c2bd48298 Bug 1802511, optimize ContentPrincipal::SubsumesInternal by checking FastEquals, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D163242
2022-11-28 23:29:01 +00:00
Stanca Serban
3811bf75f5 Backed out changeset 02a9e51358f1 (bug 1792138) for causing mochitests failures on browser_ext_windows_create_url.js. CLOSED TREE 2022-11-17 18:38:00 +02:00
Dave Townsend
1573156d9c Bug 1792138: Show the extension's name in permission prompts for opening external links. r=ckerschb,robwu,fluent-reviewers,pbz,flod
In order to handle the content script case correctly we must expose the
contentScriptAddonPolicy to JavaScript. With that we can always see what
extension is trying to perform an action and use its name rather than internal
ID in the dialog.

Differential Revision: https://phabricator.services.mozilla.com/D161282
2022-11-17 14:44:57 +00:00
Stanca Serban
d7154c3939 Backed out changeset e14d08963786 (bug 1792138) for causing mochitest failures on browser_protocol_ask_dialog_permission.js. CLOSED TREE 2022-11-17 14:57:36 +02:00
Mark Banner
ec76a72706 Bug 1799314 - Convert consumers of testing modules to import ES modules direct (miscellaneous). r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D161917
2022-11-17 12:00:32 +00:00
Dave Townsend
409d66befd Bug 1792138: Show the extension's name in permission prompts for opening external links. r=ckerschb,robwu,fluent-reviewers,pbz,flod
In order to handle the content script case correctly we must expose the
contentScriptAddonPolicy to JavaScript. With that we can always see what
extension is trying to perform an action and use its name rather than internal
ID in the dialog.

Differential Revision: https://phabricator.services.mozilla.com/D161282
2022-11-17 11:08:48 +00:00
Jan Varga
f40ce49b02 Bug 1790207 - Forward declaration of mozilla::Result in nsIGlobalObject.h and other cleanup; r=dom-storage-reviewers,jesup
Depends on D162087

Differential Revision: https://phabricator.services.mozilla.com/D162088
2022-11-15 17:13:02 +00:00
Randell Jesup
229303901a Bug 1790207: Provide cross-origin security checks for OPFS r=nika,asuth
Differential Revision: https://phabricator.services.mozilla.com/D157892
2022-11-15 17:13:01 +00:00
june wilde
6b9eed58dd Bug 1764391 - truncate ExpandedPrincipals in LoadInfo::RedirectChain; r=freddyb,necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D157621
2022-10-18 18:01:58 +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
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
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
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
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
nchevobbe
ac16015106 Bug 1778959 - Expose nsIPrincipal.isLoopbackHost. r=bholley.
This will be used in SitePermsAddonInstallRequestPrototype to discriminate permission
requests coming from localhost, where we want to fallback to regular permission prompt.

Depends on D151477

Differential Revision: https://phabricator.services.mozilla.com/D157658
2022-09-30 22:07:18 +00:00
Andrew McCreight
2da84b8ac4 Bug 1792574, part 3 - Don't include nsMemory where it isn't needed. r=xpcom-reviewers,necko-reviewers,valentin,nika
There are only 3 places where nsMemory.h is still needed (image/RasterImage.cpp,
gfx/thebes/gfxFT2FontList.cpp, and nsMemory.cpp). Remove the rest.

Differential Revision: https://phabricator.services.mozilla.com/D158213
2022-09-28 15:17:46 +00:00
Nika Layzell
613c259d7c Bug 1694993 - Part 6: Preserve precursor principal through LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL, r=ckerschb,smaug
If we don't preserve the precursor principal in this case, we'll end up
doing an unnecessary process switch in some cases, which lead to a
test failure.

This patch also cleans up some logic around the first party origin
attribute with null principals, as the logic was only used in one place
and generally added some unnecessary complexity to NullPrincipal
itself.

Differential Revision: https://phabricator.services.mozilla.com/D155277
2022-09-20 23:29:08 +00:00
Nika Layzell
0316dc51b9 Bug 1790614 - Part 2: Use {ASSERT,ENSURE}_NS_{SUCCEEEDED,FAILED} in gtests, r=ahal,necko-reviewers
These macros will produce better outputs when they fail than these existing
patterns using `ENSURE_TRUE(NS_SUCCEEDED(...))` or similar, so this is a bulk
rewrite of existing tests to use them.

It should also help with discoverability when people base their tests off of
other existing tests.

Differential Revision: https://phabricator.services.mozilla.com/D157214
2022-09-15 14:51:50 +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
Shane Caraveo
3978bd8144 Bug 1783078 require web_accessible_resources for any extension loads from a content script r=robwu,ckerschb
Enforce requiring web accessible resources in MV3 and use a pref to turn on later for MV2.

Differential Revision: https://phabricator.services.mozilla.com/D153677
2022-08-05 04:36:30 +00:00