Commit Graph

6213 Commits

Author SHA1 Message Date
Gerald Squelart
782cf5d3ad Bug 1657033 - Use Span<const char> in JSONWriter - r=froydnj
In most situations, JSONWriter users already know string lengths (either directly, or through `nsCString` and friends), so we should keep this information through JSONWriter and not recompute it again.
This also allows using JSONWriter with sub-strings (e.g., from a bigger buffer), without having to create null-terminated strings.

Public JSONWriter functions have overloads that accept literal strings.

Differential Revision: https://phabricator.services.mozilla.com/D86192
2020-09-14 02:33:20 +00:00
Jed Davis
c0cd7e11b5 Bug 1660826 - Work around apparent bug with sendmsg() in some 64-bit Android devices. r=nika
Some Android ARM64 devices appear to have a bug where sendmsg sometimes
returns 0xFFFFFFFF, which we're assuming is a -1 that was incorrectly
truncated to 32-bit and then zero-extended.  This patch detects that
value (which should never legitimately be returned, because it's 16x
the maximum message size) and replaces it with -1, with some additional
assertions.

The workaround is also enabled on x86_64 Android on debug builds only,
so that the code has CI coverage.

Differential Revision: https://phabricator.services.mozilla.com/D89845
2020-09-11 04:31:50 +00:00
Nika Layzell
e0c3e2f9a8 Bug 1664553 - Default initialize outparameters in ipdl generated code, r=jld
Doing this helps lower the chances of accidentally trying to send an
uninitialized primitive value, like a raw pointer or integer, over IPC due to a
sync method or IPDLParamTraits::Read implementation failing to initialize the
outparameter.

Differential Revision: https://phabricator.services.mozilla.com/D89963
2020-09-11 19:49:20 +00:00
Mark Banner
3d9ea7d179 Bug 1375244 - Remove sync KeywordToURI and related IPC messages as they are no longer required. r=Gijs,mak,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D89486
2020-09-11 07:15:21 +00:00
Eitan Isaacson
1959904dc6 Bug 1661758 - Part 2: Introduce sync IPDL methods for getting leaf at offset. r=morgan,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D89064
2020-09-11 05:07:48 +00:00
Eitan Isaacson
e3872eb448 Bug 1661758 - Part 1: Introduce sync IPDL methods for getting text range of child. r=morgan,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D89063
2020-09-11 05:07:46 +00:00
Brindusan Cristian
c5f2ef7f15 Backed out 5 changesets (bug 1661758) for build bustages on GeckoTextMarker.h.
Backed out changeset 9b086da1f8f1 (bug 1661758)
Backed out changeset 8def1d51ae3d (bug 1661758)
Backed out changeset 17532cdc54ae (bug 1661758)
Backed out changeset be0ea9159b11 (bug 1661758)
Backed out changeset 2ca136e7d279 (bug 1661758)
2020-09-11 02:16:49 +03:00
Eitan Isaacson
f613d9f64e Bug 1661758 - Part 2: Introduce sync IPDL methods for getting leaf at offset. r=morgan,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D89064
2020-09-10 21:52:20 +00:00
Eitan Isaacson
d0576060fa Bug 1661758 - Part 1: Introduce sync IPDL methods for getting text range of child. r=morgan,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D89063
2020-09-10 21:52:13 +00:00
Anny Gakhokidze
e12736fa36 Bug 1663238 - Only use the principal to inherit if it's equal to the flattened one, r=nika
With fission enabled, when we are starting a load, we might be saving
principals for a specific browsing context in process A, and then end up
targetting process B for the load, so during deserialization of the
LoadInfoArgs struct, we will end up using principals that were saved during a
previous load targetting that browsing context (with the same id) but in
process B.

Therefore, we cannot assert (without clearing the saved principals in the
original browsing context when a load is done, which can be done as a follow up
work) that the saved principal will be equal to the serialized one from
LoadInfoArgs.

Differential Revision: https://phabricator.services.mozilla.com/D89728
2020-09-10 14:40:31 +00:00
Masatoshi Kimura
99eff289ec Bug 1663300 - Remove MessageChannel::IsInTransaction(). r=jld
Differential Revision: https://phabricator.services.mozilla.com/D89317
2020-09-09 17:34:22 +00:00
Luca Greco
bf5f2935f7 Bug 1568597 - RemoteWorkerManager::SelectTargetActorForSharedWorker should select an actor that is kept alive. r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D88412
2020-08-28 18:11:22 +00:00
Anny Gakhokidze
46b53bc947 Bug 1589102 - Part 4: Allow (de)serialization of nested about: uris, r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D85082
2020-08-28 17:20:43 +00:00
Anny Gakhokidze
8b553ecfcf Bug 1589102 - Part 1: Enable about:srcdoc loads via DocumentChannel, r=mattwoodrow
This patch enables sandboxed srcdoc loads to take place via DocumentChannel,
and adds mechanisms for enabling unsandboxed ones.

Both unsandboxed srcdoc, and in subsequent patches, about:blank, loads require
that the triggering principal and the principal to inherit point to the same
instance if the load takes place in the same process as where we are inheriting
those principals from. We save those principals on a target browsing context before
we load the URI, and later, when we are deserializing LoadInfoArgs into
LoadInfo in the content process, we retrieve the saved principals if the
current load identifier of the target BC matches the load identifier saved
along with the principals.

We also need to make sure that during a process switch for about:srcdoc load,
we don't use the original URI for about:srcdoc to determine the remote type and
instead we use channel's result principal.

Differential Revision: https://phabricator.services.mozilla.com/D85079
2020-08-28 17:20:30 +00:00
Eitan Isaacson
1962242b94 Bug 1660364 - Introduce IPDL getters for text range length, and absolute offsets. r=morgan,mccr8
We need a sync IPC call for this because otherwise the number of smaller sync messages we would need to call would be variable.

Differential Revision: https://phabricator.services.mozilla.com/D88076
2020-08-27 20:06:42 +00:00
Gerald Squelart
3cbc9b5572 Bug 1659404 - Fix non-MOZ_GECKO_PROFILER build - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D88375
2020-08-27 14:41:46 +00:00
David Parks
9fcae06581 Bug 1659523: Check CanSend() before calling Send() when allocating Shmems r=nika
CanSend() is called (in ChannelSend()) by SendFoo() IPDL calls to prevent calling Send() on a dead actor but shmem creation uses a different code path to Send() -- one that does not use ChannelSend.  This adds the guard to shmem allocation as well.

Differential Revision: https://phabricator.services.mozilla.com/D87357
2020-08-25 16:10:17 +00:00
Eitan Isaacson
1b3266b806 Bug 1660109 - Add BoundsForRange sync ipc call. r=Jamie,nika
Differential Revision: https://phabricator.services.mozilla.com/D87669
2020-08-20 22:11:41 +00:00
Andrew Osmond
67cd43209f Bug 1658847 - Put profiler thread to sleep when allocating memory for shmems. r=mstange
posix_fallocate iterates over each page/block in a shmem to ensure the
OS allocates memory to back it. Large shmems will cause many read/write
calls to be made, and when profiling, it is very likely a SIGPROF signal
will interrupt us at sufficiently high sampling rates. Most attempts at
retrying will fail for the same reason, and this can cause the threads
to block for an indeterminate period of time.

To work around this we use the profiler's "thread sleep" mechanism to
indicate that the sampler thread should not interrupt this thread with
the sampling signal more than once.

Differential Revision: https://phabricator.services.mozilla.com/D87373
2020-08-18 21:40:11 +00:00
Andrew McCreight
681e8793ff Bug 1641614 - Use mozilla::Queue for ChannelImpl::output_queue_h_. r=froydnj
The goal of this patch is to reduce memory usage. On at least OSX, std::Queue
can use 4kb of memory even with nothing in it. This can be around 52kb of
memory per content process.

The segment size of 64 is fairly arbitrary, but these queues didn't have
more than a few hundred items in them, so it seemed like a reasonable
trade off between space for mostly-empty queues and segment overhead.

Differential Revision: https://phabricator.services.mozilla.com/D87325
2020-08-18 17:03:55 +00:00
Simon Giesecke
1fccb4c60f Bug 1634436 - Make cipher-strategy stateful and keep mode, key and IV as state. r=dom-workers-and-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D80014
2020-08-17 08:42:20 +00:00
Eitan Isaacson
58ae94661e Bug 1657765 - Add IPDL interface for platform-specific mac API. r=morgan,Jamie,nika
Differential Revision: https://phabricator.services.mozilla.com/D86606
2020-08-14 19:33:00 +00:00
Butkovits Atila
ca6c19bf18 Backed out changeset c574dd7d46ef (bug 1616462) as requested by jld 2020-08-08 01:18:19 +03:00
Simon Giesecke
1e02318b49 Bug 1653335 - Replace MakeSpan uses by constructor calls. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D83817
2020-08-07 07:49:47 +00:00
Andrew McCreight
85e0be181d Bug 1657504, part 2 - Fix deprecation warning in ipdl.py. r=nika
This is unrelated to the main issue in the bug, but I noticed
a deprecation warning in the log spew.

Differential Revision: https://phabricator.services.mozilla.com/D86229
2020-08-06 17:36:45 +00:00
Andrew McCreight
bd21b11225 Bug 1657504, part 1 - Don't allow a protocol to be defined in two different files. r=nika
This changes the duplicate checking/caching implemented by |parsed| to be
based on the name of the protocol etc. we're loading, not the file name.
This lets us detect when a protocol is being defined in two different
files.

This can happen if one file is included earlier in the resolve path than
a file explicitly specified on the command line. Any includes will resolve
to the former, and then we'll attempt to parse the latter. Before this
patch, this would result in weird errors, because there would be multiple
protocol types with the same name.

Differential Revision: https://phabricator.services.mozilla.com/D86113
2020-08-06 17:42:13 +00:00
Kartikaya Gupta
39167fa7cd Bug 1251612 - Support the GetFrameUniformity API in content processes. r=botond,froydnj
This moves the IPC mechanism from PCompositorBridge to PLayerTransaction/
PWebRenderBridge, so that it can be used by content processes like the other
test APIs. It still only produces actual data for the layers backend; for
WR it will just return empty datasets.

Differential Revision: https://phabricator.services.mozilla.com/D86016
2020-08-05 21:42:06 +00:00
Butkovits Atila
3bd0e5497c Backed out 10 changesets (bug 1589102) for failure at browser_saveHeapSnapshot_e10s_01.js CLOSED TREE
Backed out changeset 0d22ad297b19 (bug 1589102)
Backed out changeset 14bcaf2a452c (bug 1589102)
Backed out changeset 20905f91e2bb (bug 1589102)
Backed out changeset 29ee0fbe855f (bug 1589102)
Backed out changeset d1f6185030af (bug 1589102)
Backed out changeset 31949872cc1d (bug 1589102)
Backed out changeset ec04e1a20597 (bug 1589102)
Backed out changeset ffe8da473b91 (bug 1589102)
Backed out changeset 3b92f7306c64 (bug 1589102)
Backed out changeset b187548e258f (bug 1589102)
2020-08-05 21:47:50 +03:00
Anny Gakhokidze
6c0bc76392 Bug 1589102 - Part 4: Allow (de)serialization of nested about: uris, r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D85082
2020-08-05 16:45:57 +00:00
Anny Gakhokidze
e903c66d34 Bug 1589102 - Part 1: Enable about:srcdoc loads via DocumentChannel, r=mattwoodrow
This patch enables sandboxed srcdoc loads to take place via DocumentChannel,
and adds mechanisms for enabling unsandboxed ones.

Both unsandboxed srcdoc, and in subsequent patches, about:blank, loads require
that the triggering principal and the principal to inherit point to the same
instance if the load takes place in the same process as where we are inheriting
those principals from. We save those principals on a target browsing context before
we load the URI, and later, when we are deserializing LoadInfoArgs into
LoadInfo in the content process, we retrieve the saved principals if the
current load identifier of the target BC matches the load identifier saved
along with the principals.

We also need to make sure that during a process switch for about:srcdoc load,
we don't use the original URI for about:srcdoc to determine the remote type and
instead we use channel's result principal.

Differential Revision: https://phabricator.services.mozilla.com/D85079
2020-08-05 16:44:01 +00:00
Chris Martin
c946e6eaf9 Bug 1656349 - Refactor the IPC lifetimes for the PGamepadEventChannel object r=daoshengmu
Change the GamepadEventChannel so it is fully-initialized by the IPC
constuctor and needs no separate "init" message, and so its completely
destroyed by the ActorDestroy() message so it needs no "cleanup" message.

This simplifies the object lifetime, as well as unifies the IPC error vs
clean shutdown paths.

Differential Revision: https://phabricator.services.mozilla.com/D85481
2020-08-04 21:27:53 +00:00
Jed Davis
7b4c21f949 Bug 1616462 - Make event_base_fd atomic to avoid a TSan error. r=froydnj
See comment #13 on the bug for an explanation of what this fixes, what it
doesn't fix, and why this hasn't been fixed upstream yet.

See also https://github.com/libevent/libevent/issues/779 (upstream bug report)
and https://github.com/libevent/libevent/pull/741 (stalled pull request
with comments explaining the larger problem in more detail).

Differential Revision: https://phabricator.services.mozilla.com/D85781
2020-08-04 15:06:32 +00:00
Simon Giesecke
96f3e7e019 Bug 1654992 - Use std::move instead of SwapElements where possible. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D84807
2020-08-04 11:27:07 +00:00
Noemi Erli
381fca9783 Backed out 4 changesets (bug 1654992, bug 1654991) for causing timeous in mask-opacity-1e.html
Backed out changeset 11f0f54c6e0a (bug 1654992)
Backed out changeset a353dd5b3f08 (bug 1654991)
Backed out changeset 6a7964ba549f (bug 1654991)
Backed out changeset cf3bfb91d98c (bug 1654991)
2020-08-03 22:09:36 +03:00
Kershaw Chang
13c4c8d567 Bug 1648996 - Keep the source stream open after serializing, r=baku
The main reason of this patch is that the source stream will be closed when `InputStreamHelper::SerializeInputStreamAsPipe` is called, but when `InputStreamHelper::SerializeInputStreamAsPipe` is not called, the stream is stayed opened. I think we should make the behavior of serialization stream consistent, which is keeping the source stream opened.

Differential Revision: https://phabricator.services.mozilla.com/D81978
2020-08-03 10:39:48 +00:00
Simon Giesecke
032d2ac9d3 Bug 1654992 - Use std::move instead of SwapElements where possible. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D84807
2020-08-03 14:54:18 +00:00
Sylvestre Ledru
843f943758 Bug 1519636 - Reformat recent changes to the Google coding style r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D85678
2020-08-02 15:29:15 +00:00
Butkovits Atila
64a8612aa9 Backed out changeset 562a834a3692 (bug 1656349) for build bustages at BackgroundParentImpl. CLOSED TREE 2020-08-01 01:02:44 +03:00
Chris Martin
583e1cc437 Bug 1656349 - Refactor the IPC lifetimes for the PGamepadEventChannel object r=daoshengmu
Change the GamepadEventChannel so it is fully-initialized by the IPC
constuctor and needs no separate "init" message, and so its completely
destroyed by the ActorDestroy() message so it needs no "cleanup" message.

This simplifies the object lifetime, as well as unifies the IPC error vs
clean shutdown paths.

Differential Revision: https://phabricator.services.mozilla.com/D85481
2020-07-31 19:40:55 +00:00
Nathan Froyd
e3ebda1914 Bug 1223932 - delete guard object uses from the tree; r=jwalden
CLOSED TREE

We don't need these macros anymore, for two reasons:

1. We have static analysis to provide the same sort of checks via `MOZ_RAII`
   and friends.
2. clang now warns for the "temporary that should have been a declaration" case.

The extra requirements on class construction also show up during debug tests
as performance problems.

This change was automated by using the following sed script:

```
# Remove declarations in classes.
/MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER/d
/MOZ_GUARD_OBJECT_NOTIFIER_INIT/d

# Remove individual macros, carefully.
{
  # We don't have to worry about substrings here because the closing
  # parenthesis "anchors" the match.
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)/)/g;

  # Remove the longer identifier first.
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT//g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM//g;
}

# Remove the actual include.
\@# *include "mozilla/GuardObjects.h"@d
```

and running:

```
find . -name \*.cpp -o -name \*.h | grep -v 'GuardObjects.h' |xargs sed -i -f script 2>/dev/null
mach clang-format
```

Differential Revision: https://phabricator.services.mozilla.com/D85168
2020-07-30 14:22:38 +00:00
Mihai Alexandru Michis
a911a108d0 Backed out changeset ac9c811bc427 (bug 1223932) for causing spidermonkey rust failures.
CLOSED TREE
2020-07-30 18:23:21 +03:00
Nathan Froyd
bec9f9b93a Bug 1223932 - delete guard object uses from the tree; r=jwalden
We don't need these macros anymore, for two reasons:

1. We have static analysis to provide the same sort of checks via `MOZ_RAII`
   and friends.
2. clang now warns for the "temporary that should have been a declaration" case.

The extra requirements on class construction also show up during debug tests
as performance problems.

This change was automated by using the following sed script:

```
# Remove declarations in classes.
/MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER/d
/MOZ_GUARD_OBJECT_NOTIFIER_INIT/d

# Remove individual macros, carefully.
{
  # We don't have to worry about substrings here because the closing
  # parenthesis "anchors" the match.
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)/)/g;

  # Remove the longer identifier first.
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT//g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM//g;
}

# Remove the actual include.
\@# *include "mozilla/GuardObjects.h"@d
```

and running:

```
find . -name \*.cpp -o -name \*.h | grep -v 'GuardObjects.h' |xargs sed -i -f script 2>/dev/null
mach clang-format
```

Differential Revision: https://phabricator.services.mozilla.com/D85168
2020-07-30 14:22:38 +00:00
James Teh
de10571c3c Bug 1654969: Always disable COM pings for mscom::FastMarshaler (and thus mscom::Interceptor). r=aklotz
Previously, we only did this when IsCallerExternalProcess() returned false.
There are three reasons for changing this:

1. There seem to be cases where IsCallerExternalProcess() returns true even when marshaling for a COM query in the MTA.
2. After bug 1627084, we pre-build a11y handler payloads on the main thread for bulk fetch calls. That will marshal interceptors. However, IsCallerExternalProcess() can't work in that case because it's not running on the thread on which the COM call is being handled.
3. If MSHLFLAGS_NOPING is used, Release calls from remote clients are never sent to the server. So, as soon as we use NOPING for our parent process, we're already going to leak references, even if we don't use NOPING for external callers. Put another way, as soon as we use NOPING for one caller, we may as well use it for all callers because COM pinging will never release the object anyway.

Differential Revision: https://phabricator.services.mozilla.com/D84778
2020-07-29 21:11:14 +00:00
Jed Davis
8c61fa8fde Bug 1656101 - Delete some IPC dead code (BrowserProcessSubThread types and an unused header). r=mccr8
An actual use of the `BACKGROUND_X11` thread may have briefly existed in
2009 but probably never shipped; it's been unused since then, and even
the comments mentioning it have been pruned (bug 909028, bug 624422).
The other thread types besides IO have been commented out ever since
they were first committed.

This patch also removes `x11_util.h`, which has been unused since 2017
(bug 1426284); earlier in history, it had one of those comments
mentioning the nonexistent X11 thread.

Differential Revision: https://phabricator.services.mozilla.com/D85346
2020-07-29 23:31:38 +00:00
Ricky Stewart
11e536dbb2 Bug 1655993 - Remove Punion_Comparable::test from sync-messages.ini r=mccr8
This shouldn't have been added in the first place.

Differential Revision: https://phabricator.services.mozilla.com/D85292
2020-07-29 15:02:11 +00:00
Sebastian Streich
fb1d1dc1df Bug 1558394 - Pass the TriggeringSandboxFlags to nsILoadinfo r=ckerschb,smaug,necko-reviewers,valentin
Add triggering Sandbox flags to loadinfo
***
Pass triggering Flags into Loadinfo

***
Fix triggeringSandboxflags passing

Differential Revision: https://phabricator.services.mozilla.com/D69588
2020-07-29 11:43:23 +00:00
Ricky Stewart
e8ac99b085 Bug 1655371 - Fix ipdl test breaking Windows ccov builds r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D85067
2020-07-27 22:21:48 +00:00
Ricky Stewart
3419d4de1d Bug 1654589 - Move libpref Python unit test to mozbuild suite r=froydnj,mccr8
It could go into its own test suite, but it 1) depends on `mozbuild` code, so the `mozbuild` suite as well as this new suite would be running on any push that touches `mozbuild` code anyway, and 2) this is code that runs during the build, so it's not out of place.

Differential Revision: https://phabricator.services.mozilla.com/D84547
2020-07-23 22:00:46 +00:00
Jon Bauman
e893f80bba Bug 1654379 - Allow filtering the IPC log by multiple toplevel protocol names. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D84587
2020-07-23 17:47:39 +00:00
Simon Giesecke
b0cf19fc3b Bug 1654469 - Fix test protocol names. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D84656
2020-07-23 14:07:02 +00:00