From 59203c63bb777a3bacec32fb8830fba33540e809 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:29 +0200 Subject: Adding upstream version 127.0. Signed-off-by: Daniel Baumann --- dom/indexedDB/IDBFactory.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'dom/indexedDB/IDBFactory.h') diff --git a/dom/indexedDB/IDBFactory.h b/dom/indexedDB/IDBFactory.h index d64d571a05..08663eaec4 100644 --- a/dom/indexedDB/IDBFactory.h +++ b/dom/indexedDB/IDBFactory.h @@ -77,11 +77,16 @@ class IDBFactory final : public GlobalTeardownObserver, public nsWrapperCache { uint32_t mActiveTransactionCount; uint32_t mActiveDatabaseCount; + // When mAllowed is false we throw security errors on all operations. This is + // because although we make storage access decisions when we create the + // IDBFactory, the spec (and content) expects us to only throw if an attempt + // is made to use the resulting IDBFactory. + bool mAllowed; bool mBackgroundActorFailed; bool mPrivateBrowsingMode; public: - explicit IDBFactory(const IDBFactoryGuard&); + IDBFactory(const IDBFactoryGuard&, bool aAllowed); static Result, nsresult> CreateForWindow( nsPIDOMWindowInner* aWindow); @@ -89,8 +94,9 @@ class IDBFactory final : public GlobalTeardownObserver, public nsWrapperCache { static Result, nsresult> CreateForMainThreadJS( nsIGlobalObject* aGlobal); + // mAllowed shall be false for null aPrincipalInfo. static Result, nsresult> CreateForWorker( - nsIGlobalObject* aGlobal, const PrincipalInfo& aPrincipalInfo, + nsIGlobalObject* aGlobal, UniquePtr&& aPrincipalInfo, uint64_t aInnerWindowID); static bool AllowedForWindow(nsPIDOMWindowInner* aWindow); @@ -146,21 +152,15 @@ class IDBFactory final : public GlobalTeardownObserver, public nsWrapperCache { bool IsChrome() const; - [[nodiscard]] RefPtr Open(JSContext* aCx, - const nsAString& aName, - uint64_t aVersion, - CallerType aCallerType, - ErrorResult& aRv); - - [[nodiscard]] RefPtr Open(JSContext* aCx, - const nsAString& aName, - const IDBOpenDBOptions& aOptions, - CallerType aCallerType, - ErrorResult& aRv); + [[nodiscard]] RefPtr Open( + JSContext* aCx, const nsAString& aName, + const Optional& aVersion, CallerType aCallerType, + ErrorResult& aRv); - [[nodiscard]] RefPtr DeleteDatabase( - JSContext* aCx, const nsAString& aName, const IDBOpenDBOptions& aOptions, - CallerType aCallerType, ErrorResult& aRv); + [[nodiscard]] RefPtr DeleteDatabase(JSContext* aCx, + const nsAString& aName, + CallerType aCallerType, + ErrorResult& aRv); already_AddRefed Databases(JSContext* aCx, ErrorResult& aRv); -- cgit v1.2.3