diff options
Diffstat (limited to 'dom/indexedDB/IDBFactory.h')
-rw-r--r-- | dom/indexedDB/IDBFactory.h | 32 |
1 files changed, 16 insertions, 16 deletions
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<RefPtr<IDBFactory>, nsresult> CreateForWindow( nsPIDOMWindowInner* aWindow); @@ -89,8 +94,9 @@ class IDBFactory final : public GlobalTeardownObserver, public nsWrapperCache { static Result<RefPtr<IDBFactory>, nsresult> CreateForMainThreadJS( nsIGlobalObject* aGlobal); + // mAllowed shall be false for null aPrincipalInfo. static Result<RefPtr<IDBFactory>, nsresult> CreateForWorker( - nsIGlobalObject* aGlobal, const PrincipalInfo& aPrincipalInfo, + nsIGlobalObject* aGlobal, UniquePtr<PrincipalInfo>&& 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<IDBOpenDBRequest> Open(JSContext* aCx, - const nsAString& aName, - uint64_t aVersion, - CallerType aCallerType, - ErrorResult& aRv); - - [[nodiscard]] RefPtr<IDBOpenDBRequest> Open(JSContext* aCx, - const nsAString& aName, - const IDBOpenDBOptions& aOptions, - CallerType aCallerType, - ErrorResult& aRv); + [[nodiscard]] RefPtr<IDBOpenDBRequest> Open( + JSContext* aCx, const nsAString& aName, + const Optional<uint64_t>& aVersion, CallerType aCallerType, + ErrorResult& aRv); - [[nodiscard]] RefPtr<IDBOpenDBRequest> DeleteDatabase( - JSContext* aCx, const nsAString& aName, const IDBOpenDBOptions& aOptions, - CallerType aCallerType, ErrorResult& aRv); + [[nodiscard]] RefPtr<IDBOpenDBRequest> DeleteDatabase(JSContext* aCx, + const nsAString& aName, + CallerType aCallerType, + ErrorResult& aRv); already_AddRefed<Promise> Databases(JSContext* aCx, ErrorResult& aRv); |