Replace the existing callers of `JS::NewArrayBufferWithContents` with the new
`UniquePtr` alternative.
Three callers to the old `JS::NewArrayBufferWithContents` function were left
unchanged:
- `mozilla::dom::FileReader::OnLoadEndArrayBuffer()` and
`mozilla::dom::ArrayBufferBuilder::TakeArrayBuffer()` both store the data
buffer as members and therefore have a more complicated lifetime.
- `JSStructuredCloneReader::readTransferMap()` because it's not clear if the
data can be free'ed when `ArrayBuffectObject` allocation fails.
Differential Revision: https://phabricator.services.mozilla.com/D182588
Replace the existing callers of `JS::NewArrayBufferWithContents` with the new
`UniquePtr` alternative.
Three callers to the old `JS::NewArrayBufferWithContents` function were left
unchanged:
- `mozilla::dom::FileReader::OnLoadEndArrayBuffer()` and
`mozilla::dom::ArrayBufferBuilder::TakeArrayBuffer()` both store the data
buffer as members and therefore have a more complicated lifetime.
- `JSStructuredCloneReader::readTransferMap()` because it's not clear if the
data can be free'ed when `ArrayBuffectObject` allocation fails.
Differential Revision: https://phabricator.services.mozilla.com/D182588
Replace the existing callers of `JS::NewArrayBufferWithContents` with the new
`UniquePtr` alternative.
Three callers to the old `JS::NewArrayBufferWithContents` function were left
unchanged:
- `mozilla::dom::FileReader::OnLoadEndArrayBuffer()` and
`mozilla::dom::ArrayBufferBuilder::TakeArrayBuffer()` both store the data
buffer as members and therefore have a more complicated lifetime.
- `JSStructuredCloneReader::readTransferMap()` because it's not clear if the
data can be free'ed when `ArrayBuffectObject` allocation fails.
Differential Revision: https://phabricator.services.mozilla.com/D182588
This avoids potential issues where multiple OnDataAvailable callbacks or
similar could theoretically be called concurrently on different
StreamTransportService threads when targeting the STS - these cases will
now target a TaskQueue on the STS instead, structurally ensuring serial
execution.
Differential Revision: https://phabricator.services.mozilla.com/D179984
The `nsIAsync{Input,Output}Stream` base classes' Close() methods are
already documented to be idempotent. Do the same for their synchronous
counterparts, and make the necessary changes to ensure this.
The only known functional change here (modulo the removal of some
uninteresting logging) is to `nsFileInputStream`, which now avoids
calling `Tell()` if the stream is already closed. (The other early-exits
added here are formally redundant, but neither obviously nor robustly
so.)
This silences some console warning spam when running a debug build from
the command line.
Differential Revision: https://phabricator.services.mozilla.com/D171615
Manual changes to make all refcounted types be marked as `nullable` after the
changes in part 1a. This was done without any investigation into whether the
actual types want to be nullable, in order to avoid code changes.
Differential Revision: https://phabricator.services.mozilla.com/D168889
This is semantically similar to the existing available() method, however will
not block, and doesn't need to do the work to actually determine the number of
available bytes.
As part of this patch, I also fixed one available() implementation which was
incorrectly throwing NS_BASE_STREAM_WOULD_BLOCK.
Differential Revision: https://phabricator.services.mozilla.com/D170697
Manual changes to make all refcounted types be marked as `nullable` after the
changes in part 1a. This was done without any investigation into whether the
actual types want to be nullable, in order to avoid code changes.
Differential Revision: https://phabricator.services.mozilla.com/D168889
We only use it to generate a dummy URI for SVG-in-Opentype documents. We
don't really need the URIs to be unique or anything in practice.
I noticed this code while looking at the load flags set up for
bug 1809006.
Differential Revision: https://phabricator.services.mozilla.com/D166291
This method always returned GetMainThreadSerialEventTarget(). This patch
switches all callers over to use that method instead.
We can't easily switch all calls to be calls to NS_GetMainThread(), as there is
no version of that method returning a bare nsIThread* instance.
I didn't introduce one, as we may want to add a lock around mMainThread in the
future, which would require removing nsThreadManager::GetMainThreadWeak. As
this method only returns nsISerialEventTarget, it method could remain
implemented, however, by returning a statically allocated fake event target
which forwards dispatches (and QIs to nsIThread) to the real main thread.
Differential Revision: https://phabricator.services.mozilla.com/D166608
This only changes the behaviour when called with a TaskQueue or other type
using SerialEventTargetGuard on the stack. They are being switched over as the
existing GetCurrentEventTarget method is being removed, as it is somewhat
confusing, and poorly documented.
Callers which need to get the current thread even when on a threadpool or
behind a TaskQueue were switched to GetCurrentEventTarget in the previous part.
Differential Revision: https://phabricator.services.mozilla.com/D166607