This patch does not make some header files stop including the inline
header because fixing them require more changes.
Note that `#include "nsComponentManagerUtils.h"` is fixing a bustage
caused by "use of undeclared identifier 'do_CreateInstance'" error.
Differential Revision: https://phabricator.services.mozilla.com/D304432
This patch is to remove the ClonedMessageData type which is currently
frequently used for sending a StructuredCloneData over IPC manually. Instead,
under the new approach, the StructuredCloneData is transferred directly using
its serializer.
This allows for simplification of various types across the codebase which
previously needed complex handling for this manual {de-}serialization step,
especially around keeping the borrowed-from buffers alive in some cases.
As part of this, the type has also been changed to be a threadsafe refcounted
object. This is in part possible due to earlier parts, which have made it safe
to Read() from the same StructuredCloneData object concurrently from multiple
threads (so long as it does not support transferrables).
The underlying data storage within StructuredCloneData was previously already
reference counted (due to SharedJSAllocatedData).
In addition to StructuredCloneData, other data structures (e.g.
nsStructuredCloneContainer and SharedMessageBody) have also been updated to be
serialized directly, avoiding now-unnecessary intermediate objects.
Differential Revision: https://phabricator.services.mozilla.com/D281115
This is the last member of StructuredCloneHolder which is mutated when reading
a StructuredCloneHolder which does not support transfers.
This does change behaviour, as the Read functions no longer clobber every
exception thrown by the StructuredClone implementation with a DataCloneError
exception, instead stealing the exceptions as they are thrown. The behaviour of
the Write function has been changed less substantially, as it already avoided
clobbering existing exceptions.
This change in behaviour is not a complete shift. Our Structured Clone custom
callbacks have historically not reliably thrown exceptions on failure, so
uncatchable exceptions are replaced with generic exceptions before being
returned to the JS engine to avoid throwing uncatchable exceptions in error
cases where we did not previously.
It's worth noting that this change assumes that the JS implementation of
structured clone reliably throws exceptions itself. In general SpiderMonkey
code is better about this (due to better-established patterns), than Gecko code
using SpiderMonkey calling conventions.
The new implementations of Read/Write use StealExceptionFromJSContext over
NoteJSContextException, as SuppressExceptions/IgnoreErrors/IgnoredErrorResult
are frequently used with StructuredCloneHolder, and JSContext exceptions are
not suppressed when SuppressExceptions is called.
Differential Revision: https://phabricator.services.mozilla.com/D281113
Now that we are no longer tracking the global on the StructuredCloneHolder type
(see previous patch), this argument is redundant, and can be removed.
Differential Revision: https://phabricator.services.mozilla.com/D281112
This reverts commit 72c32e25bf.
Revert "Bug 2013389 - Part 11: Make attachment arrays more consistent in StructuredCloneHolder, r=asuth"
This reverts commit c0912428c7.
Revert "Bug 2013389 - Part 10: Fix version tracking in nsStructuredCloneContainer, r=asuth,extension-reviewers,spidermonkey-reviewers,sfink,robwu"
This reverts commit f2e9691831.
Revert "Bug 2013389 - Part 9: Remove the now-unused ReadFromBuffer method, r=asuth"
This reverts commit 6eb034458e.
Revert "Bug 2013389 - Part 8: Avoid the unnecessary ClonedMessageData intermediate, r=asuth,mccr8,extension-reviewers,dom-worker-reviewers,robwu"
This reverts commit 4dd6f1d6ea.
Revert "Bug 2013389 - Part 7: Only deserialize once in nsFrameMessageManager, r=asuth"
This reverts commit 65d16af619.
Revert "Bug 2013389 - Part 6: Remove weak listener support from MessageManager, r=smaug"
This reverts commit 66f4b308a0.
Revert "Bug 2013389 - Part 5: Broadcasting MessageManagers cannot support transferrables, r=asuth"
This reverts commit e95e1a5a6c.
Revert "Bug 2013389 - Part 4: Avoid depending on mErrorMessage when deserializing StructuredCloneHolder, r=asuth,dom-worker-reviewers"
This reverts commit ae78c69357.
Revert "Bug 2013389 - Part 3: Remove aGlobal argument from StructuredCloneHolder::Read, r=asuth,dom-worker-reviewers"
This reverts commit 066bd37bfd.
Revert "Bug 2013389 - Part 2: Stop tracking mGlobal within StructuredCloneHolder::Read, r=asuth"
This reverts commit 6b4f3a43c0.
Revert "Bug 2013389 - Part 1: Add an Adopt API to StructuredCloneHolder, r=asuth"
This reverts commit 8624db71c2.
This patch is to remove the ClonedMessageData type which is currently
frequently used for sending a StructuredCloneData over IPC manually. Instead,
under the new approach, the StructuredCloneData is transferred directly using
its serializer.
This allows for simplification of various types across the codebase which
previously needed complex handling for this manual {de-}serialization step,
especially around keeping the borrowed-from buffers alive in some cases.
As part of this, the type has also been changed to be a threadsafe refcounted
object. This is in part possible due to earlier parts, which have made it safe
to Read() from the same StructuredCloneData object concurrently from multiple
threads (so long as it does not support transferrables).
The underlying data storage within StructuredCloneData was previously already
reference counted (due to SharedJSAllocatedData).
In addition to StructuredCloneData, other data structures (e.g.
nsStructuredCloneContainer and SharedMessageBody) have also been updated to be
serialized directly, avoiding now-unnecessary intermediate objects.
Differential Revision: https://phabricator.services.mozilla.com/D281115
This is the last member of StructuredCloneHolder which is mutated when reading
a StructuredCloneHolder which does not support transfers.
This does change behaviour, as the Read functions no longer clobber every
exception thrown by the StructuredClone implementation with a DataCloneError
exception, instead stealing the exceptions as they are thrown. The behaviour of
the Write function has been changed less substantially, as it already avoided
clobbering existing exceptions.
This change in behaviour is not a complete shift. Our Structured Clone custom
callbacks have historically not reliably thrown exceptions on failure, so
uncatchable exceptions are replaced with generic exceptions before being
returned to the JS engine to avoid throwing uncatchable exceptions in error
cases where we did not previously.
It's worth noting that this change assumes that the JS implementation of
structured clone reliably throws exceptions itself. In general SpiderMonkey
code is better about this (due to better-established patterns), than Gecko code
using SpiderMonkey calling conventions.
The new implementations of Read/Write use StealExceptionFromJSContext over
NoteJSContextException, as SuppressExceptions/IgnoreErrors/IgnoredErrorResult
are frequently used with StructuredCloneHolder, and JSContext exceptions are
not suppressed when SuppressExceptions is called.
Differential Revision: https://phabricator.services.mozilla.com/D281113
Now that we are no longer tracking the global on the StructuredCloneHolder type
(see previous patch), this argument is redundant, and can be removed.
Differential Revision: https://phabricator.services.mozilla.com/D281112
This reverts commit 5c5cf7465b.
Revert "Bug 2013389 - Part 10: Fix version tracking in nsStructuredCloneContainer, r=asuth,extension-reviewers,spidermonkey-reviewers,sfink,robwu"
This reverts commit c87a327d86.
Revert "Bug 2013389 - Part 9: Remove the now-unused ReadFromBuffer method, r=asuth"
This reverts commit 5adf49e5d8.
Revert "Bug 2013389 - Part 8: Avoid the unnecessary ClonedMessageData intermediate, r=asuth,mccr8,extension-reviewers,dom-worker-reviewers,robwu"
This reverts commit f6d12563fe.
Revert "Bug 2013389 - Part 7: Only deserialize once in nsFrameMessageManager, r=asuth"
This reverts commit 44c1325d76.
Revert "Bug 2013389 - Part 6: Remove weak listener support from MessageManager, r=smaug"
This reverts commit 1d1b495c91.
Revert "Bug 2013389 - Part 5: Broadcasting MessageManagers cannot support transferrables, r=asuth"
This reverts commit e2eb75ff8f.
Revert "Bug 2013389 - Part 4: Avoid depending on mErrorMessage when deserializing StructuredCloneHolder, r=asuth,dom-worker-reviewers"
This reverts commit d9a234ad7b.
Revert "Bug 2013389 - Part 3: Remove aGlobal argument from StructuredCloneHolder::Read, r=asuth,dom-worker-reviewers"
This reverts commit 48279cea50.
Revert "Bug 2013389 - Part 2: Stop tracking mGlobal within StructuredCloneHolder::Read, r=asuth"
This reverts commit 27162e5046.
Revert "Bug 2013389 - Part 1: Add an Adopt API to StructuredCloneHolder, r=asuth"
This reverts commit e3a9f32716.
This patch is to remove the ClonedMessageData type which is currently
frequently used for sending a StructuredCloneData over IPC manually. Instead,
under the new approach, the StructuredCloneData is transferred directly using
its serializer.
This allows for simplification of various types across the codebase which
previously needed complex handling for this manual {de-}serialization step,
especially around keeping the borrowed-from buffers alive in some cases.
As part of this, the type has also been changed to be a threadsafe refcounted
object. This is in part possible due to earlier parts, which have made it safe
to Read() from the same StructuredCloneData object concurrently from multiple
threads (so long as it does not support transferrables).
The underlying data storage within StructuredCloneData was previously already
reference counted (due to SharedJSAllocatedData).
In addition to StructuredCloneData, other data structures (e.g.
nsStructuredCloneContainer and SharedMessageBody) have also been updated to be
serialized directly, avoiding now-unnecessary intermediate objects.
Differential Revision: https://phabricator.services.mozilla.com/D281115
This is the last member of StructuredCloneHolder which is mutated when reading
a StructuredCloneHolder which does not support transfers.
This does change behaviour, as the Read functions no longer clobber every
exception thrown by the StructuredClone implementation with a DataCloneError
exception, instead stealing the exceptions as they are thrown. The behaviour of
the Write function has been changed less substantially, as it already avoided
clobbering existing exceptions.
This change in behaviour is not a complete shift. Our Structured Clone custom
callbacks have historically not reliably thrown exceptions on failure, so
uncatchable exceptions are replaced with generic exceptions before being
returned to the JS engine to avoid throwing uncatchable exceptions in error
cases where we did not previously.
It's worth noting that this change assumes that the JS implementation of
structured clone reliably throws exceptions itself. In general SpiderMonkey
code is better about this (due to better-established patterns), than Gecko code
using SpiderMonkey calling conventions.
The new implementations of Read/Write use StealExceptionFromJSContext over
NoteJSContextException, as SuppressExceptions/IgnoreErrors/IgnoredErrorResult
are frequently used with StructuredCloneHolder, and JSContext exceptions are
not suppressed when SuppressExceptions is called.
Differential Revision: https://phabricator.services.mozilla.com/D281113
Now that we are no longer tracking the global on the StructuredCloneHolder type
(see previous patch), this argument is redundant, and can be removed.
Differential Revision: https://phabricator.services.mozilla.com/D281112
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.
Differential Revision: https://phabricator.services.mozilla.com/D256800
This is somewhat complex, untested, never shipped, and predates
fission.
Remove it to simplify the code.
Depends on D198183
Differential Revision: https://phabricator.services.mozilla.com/D198184
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.
I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).
Differential Revision: https://phabricator.services.mozilla.com/D190450
This prevents copies and avoids the hack we have to avoid this, which
right now is using nsDependent{C,}String.
Non-virtual actors can still use `nsString` if they need to on the
receiving end.
Differential Revision: https://phabricator.services.mozilla.com/D152519