forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Implement NavigatorStorage mixin interface
Co-authored-by: Tim Flynn <[email protected]> (cherry picked from commit e3b3041a0c87f4cfd6d7941963452c3c9428b487)
- Loading branch information
1 parent
65b9428
commit 6a477c7
Showing
12 changed files
with
93 additions
and
3 deletions.
There are no files selected for viewing
5 changes: 4 additions & 1 deletion
5
Meta/gn/secondary/Userland/Libraries/LibWeb/StorageAPI/BUILD.gn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
source_set("StorageAPI") { | ||
configs += [ "//Userland/Libraries/LibWeb:configs" ] | ||
deps = [ "//Userland/Libraries/LibWeb:all_generated" ] | ||
sources = [ "StorageManager.cpp" ] | ||
sources = [ | ||
"NavigatorStorage.cpp", | ||
"StorageManager.cpp", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2024, Jamie Mansfield <[email protected]> | ||
* Copyright (c) 2024, Tim Flynn <[email protected]> | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#include <LibJS/Runtime/Realm.h> | ||
#include <LibWeb/HTML/Scripting/Environments.h> | ||
#include <LibWeb/StorageAPI/NavigatorStorage.h> | ||
#include <LibWeb/StorageAPI/StorageManager.h> | ||
|
||
namespace Web::StorageAPI { | ||
|
||
// https://storage.spec.whatwg.org/#dom-navigatorstorage-storage | ||
JS::NonnullGCPtr<StorageManager> NavigatorStorage::storage() | ||
{ | ||
// The storage getter steps are to return this’s relevant settings object’s StorageManager object. | ||
return HTML::relevant_settings_object(this_navigator_storage_object()).storage_manager(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2024, Jamie Mansfield <[email protected]> | ||
* Copyright (c) 2024, Tim Flynn <[email protected]> | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <LibJS/Forward.h> | ||
#include <LibJS/Heap/GCPtr.h> | ||
#include <LibWeb/Bindings/PlatformObject.h> | ||
#include <LibWeb/Forward.h> | ||
|
||
namespace Web::StorageAPI { | ||
|
||
class NavigatorStorage { | ||
public: | ||
virtual ~NavigatorStorage() = default; | ||
|
||
JS::NonnullGCPtr<StorageManager> storage(); | ||
|
||
protected: | ||
virtual Bindings::PlatformObject const& this_navigator_storage_object() const = 0; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#import <StorageAPI/StorageManager.idl> | ||
|
||
// https://storage.spec.whatwg.org/#navigatorstorage | ||
[SecureContext] | ||
interface mixin NavigatorStorage { | ||
[SameObject] readonly attribute StorageManager storage; | ||
}; |