icecat: update to upstream version 128.0.14-1gnu1

This commit is contained in:
Ark74 2025-08-20 11:58:34 -06:00
parent 0cdda4f34e
commit 56c3deff60
77 changed files with 8997 additions and 3862 deletions

View file

@ -7,7 +7,6 @@
#include "GLContext.h"
#include "ImageBitmapRenderingContext.h"
#include "ImageEncoder.h"
#include "mozilla/dom/BlobImpl.h"
#include "mozilla/dom/CanvasRenderingContext2D.h"
#include "mozilla/dom/OffscreenCanvasRenderingContext2D.h"
#include "mozilla/GfxMessageUtils.h"
@ -26,55 +25,6 @@ namespace mozilla::dom {
CanvasRenderingContextHelper::CanvasRenderingContextHelper()
: mCurrentContextType(CanvasContextType::NoContext) {}
void CanvasRenderingContextHelper::ToBlob(
JSContext* aCx, nsIGlobalObject* aGlobal, BlobCallback& aCallback,
const nsAString& aType, JS::Handle<JS::Value> aParams, bool aUsePlaceholder,
ErrorResult& aRv) {
// Encoder callback when encoding is complete.
class EncodeCallback : public EncodeCompleteCallback {
public:
EncodeCallback(nsIGlobalObject* aGlobal, BlobCallback* aCallback)
: mGlobal(aGlobal), mBlobCallback(aCallback) {}
// This is called on main thread.
MOZ_CAN_RUN_SCRIPT
nsresult ReceiveBlobImpl(already_AddRefed<BlobImpl> aBlobImpl) override {
MOZ_ASSERT(NS_IsMainThread());
RefPtr<BlobImpl> blobImpl = aBlobImpl;
RefPtr<Blob> blob;
if (blobImpl) {
blob = Blob::Create(mGlobal, blobImpl);
}
RefPtr<BlobCallback> callback(std::move(mBlobCallback));
ErrorResult rv;
callback->Call(blob, rv);
mGlobal = nullptr;
MOZ_ASSERT(!mBlobCallback);
return rv.StealNSResult();
}
bool CanBeDeletedOnAnyThread() override {
// EncodeCallback is used from the main thread only.
return false;
}
nsCOMPtr<nsIGlobalObject> mGlobal;
RefPtr<BlobCallback> mBlobCallback;
};
RefPtr<EncodeCompleteCallback> callback =
new EncodeCallback(aGlobal, &aCallback);
ToBlob(aCx, callback, aType, aParams, aUsePlaceholder, aRv);
}
void CanvasRenderingContextHelper::ToBlob(
JSContext* aCx, EncodeCompleteCallback* aCallback, const nsAString& aType,
JS::Handle<JS::Value> aParams, bool aUsePlaceholder, ErrorResult& aRv) {

View file

@ -54,10 +54,6 @@ class CanvasRenderingContextHelper {
nsAString& outParams,
bool* const outCustomParseOptions);
void ToBlob(JSContext* aCx, nsIGlobalObject* global, BlobCallback& aCallback,
const nsAString& aType, JS::Handle<JS::Value> aParams,
bool aUsePlaceholder, ErrorResult& aRv);
void ToBlob(JSContext* aCx, EncodeCompleteCallback* aCallback,
const nsAString& aType, JS::Handle<JS::Value> aParams,
bool aUsePlaceholder, ErrorResult& aRv);

View file

@ -570,6 +570,10 @@ void OffscreenCanvas::SetWriteOnly(RefPtr<nsIPrincipal>&& aExpandedReader) {
mExpandedReader.forget());
mExpandedReader = std::move(aExpandedReader);
mIsWriteOnly = true;
if (mDisplay) {
mDisplay->SetWriteOnly(mExpandedReader);
}
}
bool OffscreenCanvas::CallerCanRead(nsIPrincipal& aPrincipal) const {

View file

@ -32,7 +32,11 @@ OffscreenCanvasDisplayHelper::OffscreenCanvasDisplayHelper(
mData.mSize.height = aHeight;
}
OffscreenCanvasDisplayHelper::~OffscreenCanvasDisplayHelper() = default;
OffscreenCanvasDisplayHelper::~OffscreenCanvasDisplayHelper() {
MutexAutoLock lock(mMutex);
NS_ReleaseOnMainThread("OffscreenCanvas::mExpandedReader",
mExpandedReader.forget());
}
void OffscreenCanvasDisplayHelper::DestroyElement() {
MOZ_ASSERT(NS_IsMainThread());
@ -61,6 +65,32 @@ void OffscreenCanvasDisplayHelper::DestroyCanvas() {
mWorkerRef = nullptr;
}
void OffscreenCanvasDisplayHelper::SetWriteOnly(nsIPrincipal* aExpandedReader) {
MutexAutoLock lock(mMutex);
NS_ReleaseOnMainThread("OffscreenCanvasDisplayHelper::mExpandedReader",
mExpandedReader.forget());
mExpandedReader = aExpandedReader;
mIsWriteOnly = true;
}
bool OffscreenCanvasDisplayHelper::CallerCanRead(
nsIPrincipal& aPrincipal) const {
MutexAutoLock lock(mMutex);
if (!mIsWriteOnly) {
return true;
}
// If mExpandedReader is set, this canvas was tainted only by
// mExpandedReader's resources. So allow reading if the subject
// principal subsumes mExpandedReader.
if (mExpandedReader && aPrincipal.Subsumes(mExpandedReader)) {
return true;
}
return nsContentUtils::PrincipalHasPermission(aPrincipal,
nsGkAtoms::all_urlsPermission);
}
bool OffscreenCanvasDisplayHelper::CanElementCaptureStream() const {
MutexAutoLock lock(mMutex);
return !!mWorkerRef;

View file

@ -57,6 +57,19 @@ class OffscreenCanvasDisplayHelper final {
void DestroyCanvas();
void DestroyElement();
bool IsWriteOnly() const {
MutexAutoLock lock(mMutex);
return mIsWriteOnly;
}
bool HasWorkerRef() const {
MutexAutoLock lock(mMutex);
return !!mWorkerRef;
}
void SetWriteOnly(nsIPrincipal* aExpandedReader = nullptr);
bool CallerCanRead(nsIPrincipal& aPrincipal) const;
bool CanElementCaptureStream() const;
bool UsingElementCaptureStream() const;
@ -90,6 +103,8 @@ class OffscreenCanvasDisplayHelper final {
mozilla::layers::ImageContainer::FrameID mLastFrameID MOZ_GUARDED_BY(mMutex) =
0;
bool mPendingInvalidate MOZ_GUARDED_BY(mMutex) = false;
bool mIsWriteOnly MOZ_GUARDED_BY(mMutex) = false;
RefPtr<nsIPrincipal> mExpandedReader MOZ_GUARDED_BY(mMutex);
};
} // namespace mozilla::dom