Commit Graph

393 Commits

Author SHA1 Message Date
Tim Huang
8d683db77f Bug 1731982 - Part 5: Using StoragePrincipalHelper::GetPrincipal() in ClientChannelHelper. r=asuth
To support foreign partitioned prinicpal for Client, we use
StoragePrincipalHelper::GetPrincipal() to get the foreign partitioned
principal from the channel in the ClientChannelHelper. And use it to
create client.

Differential Revision: https://phabricator.services.mozilla.com/D127631
2021-10-15 20:00:03 +00:00
Cristian Tuns
d3df74e295 Backed out 9 changesets (bug 1731982) for causing wpt failures on localStorage. CLOSED TREE
Backed out changeset bbeba8b14a2f (bug 1731982)
Backed out changeset 645cc214c608 (bug 1731982)
Backed out changeset 3a8e2f9c15e8 (bug 1731982)
Backed out changeset 208dd7c57311 (bug 1731982)
Backed out changeset 76a13a728f13 (bug 1731982)
Backed out changeset a6bfce877a86 (bug 1731982)
Backed out changeset 5fc4e33a8232 (bug 1731982)
Backed out changeset 353e3b3e020a (bug 1731982)
Backed out changeset b07167090923 (bug 1731982)
2021-10-13 10:47:25 -04:00
Tim Huang
21e775c7ac Bug 1731982 - Part 5: Using StoragePrincipalHelper::GetPrincipal() in ClientChannelHelper. r=asuth
To support foreign partitioned prinicpal for Client, we use
StoragePrincipalHelper::GetPrincipal() to get the foreign partitioned
principal from the channel in the ClientChannelHelper. And use it to
create client.

Differential Revision: https://phabricator.services.mozilla.com/D127631
2021-10-13 11:18:53 +00:00
Noemi Erli
cb0b4097d6 Backed out 9 changesets (bug 1731982) for causing Bp-hybrid bustages CLOSED TREE
Backed out changeset 82bb76c2e531 (bug 1731982)
Backed out changeset 8240ef0e1771 (bug 1731982)
Backed out changeset f46f05792c6a (bug 1731982)
Backed out changeset 449c821bc56e (bug 1731982)
Backed out changeset cb813505b5a9 (bug 1731982)
Backed out changeset 06fad8cd9345 (bug 1731982)
Backed out changeset 4b8cf4756686 (bug 1731982)
Backed out changeset 5468bf77f732 (bug 1731982)
Backed out changeset 7800585e3d6a (bug 1731982)
2021-10-12 23:12:19 +03:00
Tim Huang
c7c5eaebff Bug 1731982 - Part 5: Using StoragePrincipalHelper::GetPrincipal() in ClientChannelHelper. r=asuth
To support foreign partitioned prinicpal for Client, we use
StoragePrincipalHelper::GetPrincipal() to get the foreign partitioned
principal from the channel in the ClientChannelHelper. And use it to
create client.

Differential Revision: https://phabricator.services.mozilla.com/D127631
2021-10-12 18:55:19 +00:00
Tom Schuster
5d023856bb Bug 1722576 - Rename PostMessageOptions to StructuredSerializeOptions. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D126717
2021-09-29 12:48:17 +00:00
Sandor Molnar
fe9f55e2fb Backed out 2 changesets (bug 1722576) for causing wpt failures in structured-clone.any.worker.html
Backed out changeset d31a1c199922 (bug 1722576)
Backed out changeset 4d0e3d6a1960 (bug 1722576)
2021-09-28 22:59:51 +03:00
Tom Schuster
6cec896db2 Bug 1722576 - Rename PostMessageOptions to StructuredSerializeOptions. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D126717
2021-09-28 17:09:18 +00:00
Eden Chuang
963f6a7e85 Bug 1730350 - Add comments to explains why !XRE_IsE10sParetnProcess() is needed in ClientManagerService. r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D125518
2021-09-15 08:19:24 +00:00
Nika Layzell
8defd39d49 Bug 1729458 - Part 3: Clean up future client sources during shutdown, r=asuth
Depends on D124800

Differential Revision: https://phabricator.services.mozilla.com/D125248
2021-09-14 15:02:59 +00:00
Sandor Molnar
5f8d191513 Backed out 3 changesets (bug 1729458) for causing multiple dt failures. CLOSED TREE
Backed out changeset 16b385e15fad (bug 1729458)
Backed out changeset 72b7a9c7bf30 (bug 1729458)
Backed out changeset 704dd03288b1 (bug 1729458)
2021-09-13 21:08:44 +03:00
Nika Layzell
22b78993fe Bug 1729458 - Part 3: Clean up future client sources during shutdown, r=asuth
Depends on D124800

Differential Revision: https://phabricator.services.mozilla.com/D125248
2021-09-13 15:23:32 +00:00
Luca Greco
1c1c9277e6 Bug 1729123 - Run diagnostic assertion on cm->IsShutdown only if dom.workers.testing.enabled is true. r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D124687
2021-09-06 19:36:25 +00:00
Luca Greco
052fc46425 Bug 1727405 - Add a diagnostic assert to check that ClientManager::GetOrCreateForCurrentThread is not returning a stale ClientManager instance that is already shutdown. r=asuth
While investigating an unexpected test failure triggered by a mochitest that was testing the identity WebExtensions API
(D121683 from Bug 1723852) I did notice that the actual underlying issue was triggered by a leak
(in particular the Extension API class in the initial draft of that D121683 patch was missing a RefPtr
in the NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE macro used for that class) but the issue was presenting
itself as an empty scriptURL in the ClientSource for the test case that was executed after the one that
triggered tha leak, and far enough from where it was actually triggered.

To make it easier to spot the issue nearer to the actual underlying issue, I think that it would be
reasonable to add a diagnostic assertion to ClientManager::GetOrCreateForCurrentThread that would
be triggered earlier if a leak was keeping the ClientManager instance alive in the idle DOM Worker
Thread.

Differential Revision: https://phabricator.services.mozilla.com/D123530
2021-09-02 21:24:58 +00:00
Alexandru Michis
ce2aeb6bf8 Backed out changeset 9e8267a443e5 (bug 1727405) for causing telemetry failures in ClientManager.cpp
CLOSED TREE
2021-09-01 01:36:24 +03:00
Luca Greco
0062a37d58 Bug 1727405 - Add a diagnostic assert to check that ClientManager::GetOrCreateForCurrentThread is not returning a stale ClientManager instance that is already shutdown. r=asuth
While investigating an unexpected test failure triggered by a mochitest that was testing the identity WebExtensions API
(D121683 from Bug 1723852) I did notice that the actual underlying issue was triggered by a leak
(in particular the Extension API class in the initial draft of that D121683 patch was missing a RefPtr
in the NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE macro used for that class) but the issue was presenting
itself as an empty scriptURL in the ClientSource for the test case that was executed after the one that
triggered tha leak, and far enough from where it was actually triggered.

To make it easier to spot the issue nearer to the actual underlying issue, I think that it would be
reasonable to add a diagnostic assertion to ClientManager::GetOrCreateForCurrentThread that would
be triggered earlier if a leak was keeping the ClientManager instance alive in the idle DOM Worker
Thread.

Differential Revision: https://phabricator.services.mozilla.com/D123530
2021-08-31 14:18:35 +00:00
Kagami Sascha Rosylight
eddf271c1f Bug 1726648 - Add a helper to trim brackets from nsID r=mccr8,smaug
Differential Revision: https://phabricator.services.mozilla.com/D123163
2021-08-23 10:54:11 +00:00
Iulian Moraru
a16afaadfe Backed out changeset d21b3f88a2b4 (bug 1726648) for causing build bustages. CLOSED TREE 2021-08-23 04:12:02 +03:00
Kagami Sascha Rosylight
0c5086660f Bug 1726648 - Add a helper to trim brackets from nsID r=mccr8,smaug
Differential Revision: https://phabricator.services.mozilla.com/D123163
2021-08-23 00:35:40 +00:00
Kagami Sascha Rosylight
d97053ccff Bug 1723050 - Part 7: Replace typedef by using in dom/clients/ r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D121299
2021-08-06 17:26:49 +00:00
Andrew Sutherland
6736ecda3b Bug 1503072 - Add mitigation to bypass SW on navigation fault. r=dom-worker-reviewers,necko-reviewers,valentin,edenchuang
We enable this mitigation by default because:
- The alternate UX is about:blank or corrupted content.  That's never good.
- We want to make sure that our test coverage handles this mitigation because
  it's want we want to ship.

However, we do explicitly disable it for all ServiceWorker WPT's via
`__dir__.ini` directive at the root of the service-workers test tree.

This is motivated by the
`/service-workers/service-worker/update-recovery.https.html` test which
intentionally tests a broken ServiceWorker being able to be updated.  It
explicitly tests that the intercepted broken iframe shouldn't successfully
load, but our mitigation makes it load, which breaks the test.

Depends on D111845

Differential Revision: https://phabricator.services.mozilla.com/D111993
2021-07-12 21:10:26 +00:00
Iulian Moraru
ef7b6b88df Backed out 3 changesets (bug 1503072) for causing bc failures on browser_navigation_fetch_fault_handling.js. CLOSED TREE
Backed out changeset f8c6503512f5 (bug 1503072)
Backed out changeset c04927c15fd8 (bug 1503072)
Backed out changeset b7550232d4f1 (bug 1503072)
2021-07-12 15:19:09 +03:00
Andrew Sutherland
bd86df06b4 Bug 1503072 - Add mitigation to bypass SW on navigation fault. r=dom-worker-reviewers,necko-reviewers,valentin,edenchuang
We enable this mitigation by default because:
- The alternate UX is about:blank or corrupted content.  That's never good.
- We want to make sure that our test coverage handles this mitigation because
  it's want we want to ship.

However, we do explicitly disable it for all ServiceWorker WPT's via
`__dir__.ini` directive at the root of the service-workers test tree.

This is motivated by the
`/service-workers/service-worker/update-recovery.https.html` test which
intentionally tests a broken ServiceWorker being able to be updated.  It
explicitly tests that the intercepted broken iframe shouldn't successfully
load, but our mitigation makes it load, which breaks the test.

Depends on D111845

Differential Revision: https://phabricator.services.mozilla.com/D111993
2021-07-12 11:13:35 +00:00
Nika Layzell
1aaeb179e2 Bug 1715144 - Part 1: Stop adding /ipc/glue to LOCAL_INCLUDES when including chromium-config.mozbuild, r=ipc-reviewers,necko-reviewers,mccr8,valentin
Differential Revision: https://phabricator.services.mozilla.com/D117103
2021-06-09 04:56:48 +00:00
Eden Chuang
0447732333 Bug 1584007 - check ClientSource existence r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D85362
2021-05-24 13:55:08 +00:00
Eden Chuang
e1283fcd46 Bug 1584007 - FutureClientSourceParent should keep ClientManagerService alive r=asuth
The strong reference will be dropped when FutureClientSourceParent is removed,
and we guarantee that all FutureClientSourceParents will either be removed or
replaced with a ClientSourceParent (or at least this is a guarantee that's
supposed to be true).

Differential Revision: https://phabricator.services.mozilla.com/D68041
2021-05-24 13:55:07 +00:00
Eden Chuang
3e3456e73e Bug 1584007 - let ClientChannelHelperParent manage FutureClientSourceParent lifetime r=dom-workers-and-storage-reviewers,mattwoodrow,asuth
ClientChannelHelperParent is the thing creating the ClientInfos which aren't
backed by existing ClientSources, so it may make sense for CCHP to tell the
ClientManagerService (CMS) to "expect" or "forget" a "future"
ClientSource(Parent).

When such a ClientInfo is created, CCHP notifies the CMS that a future
ClientSource may be created. This notification has to be observed before any
ClientHandles try to query CMS to a ClientSourceParent, which is the case
because the notification as well as ClientHandleParent constructors occur over
PBackground, and the notification sending method is called first.

CMS is told to forget the future ClientSource whenever a redirect occurs that
would result in the creation of a new ClientSource (i.e. a new ClientInfo). It's
also possible that the ClientInfo's LoadInfo's channel is cancelled. To account
for this, CHCP stores the most recent ClientInfo it's created and tells CMS
to _possibly_ forget the associated future ClientSource in its destructor. It's
possible that the channel completed its load, in which case this notification
is a no-op. This also relies on CHCP being destroyed after the reserved
ClientSource has a chance to both be created and register its
ClientSourceParent.

Differential Revision: https://phabricator.services.mozilla.com/D66529
2021-05-24 13:55:07 +00:00
Eden Chuang
9ca5730156 Bug 1584007 - allow ClientManager to register "future" ClientSources r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D66520
2021-05-24 13:55:06 +00:00
Eden Chuang
2ed195d384 Bug 1584007 - let ClientHandleParents wait on FutureClientSourceParents r=dom-workers-and-storage-reviewers,mattwoodrow,asuth
Differential Revision: https://phabricator.services.mozilla.com/D66154
2021-05-24 13:55:06 +00:00
Eden Chuang
883943e462 Bug 1584007 - let ClientManagerService store FutureClientSourceParent r=dom-workers-and-storage-reviewers,mattwoodrow,asuth
The changes only make it possible for ClientManagerService to store
FutureClientSourceParents, but it will not actually store them until
following changesets.

Differential Revision: https://phabricator.services.mozilla.com/D66145
2021-05-24 13:55:06 +00:00
Eden Chuang
e48c6ff8ce Bug 1584007 - initial implementation of FutureClientSourceParent r=dom-workers-and-storage-reviewers,mattwoodrow,asuth
Also implements SourceTableEntry and nsIDHasher to switch ClientManagerService's
nsDataHashTable to a mozilla::HashMap<nsID, SourceTableEntry> in following
changesets.

Differential Revision: https://phabricator.services.mozilla.com/D66144
2021-05-24 13:55:05 +00:00
Emilio Cobos Álvarez
5e03d6a488 Bug 1704651 - Wait for the right load in ClientOpenWindow. r=asuth
With fission+BFCache, we get a notification for the initial document,
and that fails the same-origin check (because about:blank isn't
same-origin with the opener) so we resolve the promise with null
rather than returning a client.

Instead, wait for the right load to arrive if the top level window
global is the initial document.

Differential Revision: https://phabricator.services.mozilla.com/D112072
2021-04-16 23:38:42 +00:00
Butkovits Atila
a8051422a4 Backed out changeset b099dbba4587 (bug 1704651) for causing leackcheck failures. CLOSED TREE 2021-04-15 18:49:25 +03:00
Emilio Cobos Álvarez
0677a9ec85 Bug 1704651 - Wait for the right load in ClientOpenWindow. r=asuth
With fission+BFCache, we get a notification for the initial document,
and that fails the same-origin check (because about:blank isn't
same-origin with the opener) so we resolve the promise with null
rather than returning a client.

Instead, wait for the right load to arrive if the top level window
global is the initial document.

Differential Revision: https://phabricator.services.mozilla.com/D112072
2021-04-15 12:11:02 +00:00
Nika Layzell
27ff2d45df Bug 1697927 - Part 1: Only expose HadOriginalOpener on BrowsingContext, r=farre
Differential Revision: https://phabricator.services.mozilla.com/D108860
2021-03-18 16:15:17 +00:00
Simon Giesecke
b9621d6376 Bug 1695162 - Use range-based for instead of custom hashtable iterators. r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D108585
2021-03-17 15:49:46 +00:00
Simon Giesecke
ad01a10a3b Bug 1634281 - Use nsTHashMap instead of nsDataHashtable. r=xpcom-reviewers,necko-reviewers,jgilbert,nika,valentin
Note that this patch only transforms the use of the nsDataHashtable type alias
to a directly equivalent use of nsTHashMap. It does not change the specification
of the hash key type to make use of the key class deduction that nsTHashMap
allows for in some cases. That can be done in a separate step, but requires more
attention.

Differential Revision: https://phabricator.services.mozilla.com/D106008
2021-03-10 10:47:47 +00:00
Chris Peterson
2d4ca059e8 Bug 1691889 - Replace MOZ_MUST_USE with [[nodiscard]] in dom/. r=peterv
The MOZ_MUST_USE macro is defined as clang's and gcc's nonstandard __attribute__((warn_unused_result)). Now that we compile as C++17 by default (bug 1560664), we can replace MOZ_MUST_USE with C++17's standard [[nodiscard]] attribute.

The [[nodiscard]] attribute must precede a function declaration's declaration specifiers (like static, extern, inline, or virtual). The __attribute__((warn_unused_result)) attribute does not have this order restriction.

Differential Revision: https://phabricator.services.mozilla.com/D107355
2021-03-10 08:19:25 +00:00
Simon Giesecke
8ecfb38a41 Bug 1691913 - Remove uses of nsDataHashtable::GetValue. r=xpcom-reviewers,necko-reviewers,dragana,nika
GetValue is going to be removed in a subsequent patch. It is no longer needed,
because it can be replaced by functions already provided by nsBaseHashtable,
in particular Lookup and Contains.

Also, its name was confusing, since it specifically returns a pointer that
allows and is intended for modifying the entry within the hashtable, rather
than returning by-value. According to the naming rules to be set on
nsBaseHashtable, it would also needed to be renamed to "Lookup*. Removing
its uses saves this effort.

Differential Revision: https://phabricator.services.mozilla.com/D105476
2021-03-01 09:59:30 +00:00
Simon Giesecke
4f75368dcb Bug 1691913 - Rename nsBaseHashtable::GetOrInsert(With) to LookupOrInsert(With). r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
The functions should be called "Lookup" rather than "Get" because they return
a DataType& (rather than UserDataType).

Differential Revision: https://phabricator.services.mozilla.com/D105472
2021-02-26 09:11:45 +00:00
Simon Giesecke
ba07b1d2f5 Bug 1688833 - Migrate LookupForAdd to WithEntryHandle in dom/clients. r=janv
Differential Revision: https://phabricator.services.mozilla.com/D104231
2021-02-09 18:19:45 +00:00
Nika Layzell
86a03e6701 Bug 1689147 - Part 5: Change comparable to an extended attribute, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D103370
2021-02-09 16:50:23 +00:00
Yaron Tausky
0afb6e885f Bug 1496997 - Remove child intercept code from dom/clients r=asuth,dom-workers-and-storage-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D101028
2021-01-25 22:49:49 +00:00
Simon Giesecke
4cab6ac723 Bug 1677466 - Move ParamTraits specializations with extra dependencies out of IPCMessageUtils.h. r=mccr8
This moves parts of IPCMessageUtils.h to two new header files and adapts
the include directives as necessary. The new header files are:
- EnumSerializer.h, which defines the templates for enum serializers
- IPCMessageUtilsSpecializations.h, which defines template specializations
  of ParamTraits with extra dependencies (building upon both IPCMessageUtils.h
  and EnumSerializer.h)

This should minimize the dependencies pulled in by every consumer of
IPCMessageUtils.h

Differential Revision: https://phabricator.services.mozilla.com/D94459
2020-12-10 11:09:21 +00:00
Simon Giesecke
1c53236b70 Bug 1679272 - Include ScopeExit.h exactly where used. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D98888
2020-12-07 14:25:59 +00:00
Simon Giesecke
dd80614fa0 Bug 1678062 - Remove unnecessary includes. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D97467

Depends on D96561
2020-11-23 16:12:02 +00:00
Simon Giesecke
ae75be244a Bug 1677466 - Split Endpoint.h and ProtocolMessageUtils.h from ProtocolUtils.h. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D93568

Depends on D93567
2020-11-23 16:06:42 +00:00
Simon Giesecke
31d9321c57 Bug 1660470 - Avoid including BindingIPCUtils.h from header files. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D93556

Depends on D93555
2020-11-23 16:05:44 +00:00
Simon Giesecke
252f99be51 Bug 1660470 - Avoid including ErrorIPCUtils.h from header files. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D93243

Depends on D93242
2020-11-23 16:04:28 +00:00
Simon Giesecke
40fc78c788 Bug 1660470 - Avoid including ClientIPCUtils.h from header files. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D93241

Depends on D93240
2020-11-23 16:04:17 +00:00