author | Barret Rennie <barret@brennie.ca> |
Wed, 09 Dec 2020 05:47:31 +0000 | |
changeset 559946 | 3b0a152f733f1c83a0b14d318546e21245d31583 |
parent 559945 | 03dee0cdd71a176752b327c21da0dcd3da0a9663 |
child 559947 | 7331b21c377f1ed641d3da656b85f95d9b371d0b |
push id | 132359 |
push user | brennie@mozilla.com |
push date | Wed, 09 Dec 2020 05:56:04 +0000 |
treeherder | autoland@6cc33208cf32 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | Gijs |
bugs | 1677000 |
milestone | 85.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/system/IOUtils.cpp | file | annotate | diff | comparison | revisions | |
dom/system/IOUtils.h | file | annotate | diff | comparison | revisions |
--- a/dom/system/IOUtils.cpp +++ b/dom/system/IOUtils.cpp @@ -208,17 +208,16 @@ already_AddRefed<Promise> IOUtils::Read( toRead.emplace(aOptions.mMaxBytes.Value()); } RunOnBackgroundThread<nsTArray<uint8_t>>( promise, [file = std::move(file), toRead, decompress = aOptions.mDecompress]() { return ReadSync(file, toRead, decompress); }); - return promise.forget(); } /* static */ already_AddRefed<Promise> IOUtils::ReadUTF8(GlobalObject& aGlobal, const nsAString& aPath, const ReadUTF8Options& aOptions) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); @@ -558,18 +557,17 @@ already_AddRefed<Promise> IOUtils::Creat if (er.Failed()) { return nullptr; } MOZ_ASSERT(promise); return do_AddRef(promise); } /* static */ -void IOUtils::RejectJSPromise(const RefPtr<Promise>& aPromise, - const IOError& aError) { +void IOUtils::RejectJSPromise(Promise* aPromise, const IOError& aError) { const auto& errMsg = aError.Message(); switch (aError.Code()) { case NS_ERROR_FILE_TARGET_DOES_NOT_EXIST: case NS_ERROR_FILE_NOT_FOUND: aPromise->MaybeRejectWithNotFoundError(errMsg.refOr("File not found"_ns)); break; case NS_ERROR_FILE_ACCESS_DENIED:
--- a/dom/system/IOUtils.h +++ b/dom/system/IOUtils.h @@ -138,18 +138,17 @@ class IOUtils final { // Allow conversion of |InternalFileInfo| with |ToJSValue|. friend MOZ_MUST_USE bool ToJSValue(JSContext* aCx, const InternalFileInfo& aInternalFileInfo, JS::MutableHandle<JS::Value> aValue); /** * Rejects |aPromise| with an appropriate |DOMException| describing |aError|. */ - static void RejectJSPromise(const RefPtr<Promise>& aPromise, - const IOError& aError); + static void RejectJSPromise(Promise* aPromise, const IOError& aError); /** * Attempts to read the entire file at |aPath| into a buffer. * * @param aFile The location of the file. * @param aMaxBytes If |Some|, then only read up this this number of bytes, * otherwise attempt to read the whole file. * @param aDecompress If true, decompress the bytes read from disk before