mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
storage: Isolate sessionStorage per top-level browsing context and copy sessionStorage when creating a new auxiliary browsing context (#37803)
This pull request introduces changes to the storage subsystem to: - Isolate sessionStorage per top-level browsing context (WebViewId), in addition to origin. - Copy sessionStorage when creating a new auxiliary browsing context without noopener, as required by the corresponding spec These changes bring Servo closer to spec compliance, matching expected browser behavior. Testing: This work affects observable behavior. As a result, some previously failing WPT tests now pass. No new tests are added, since the behavior is already covered by existing web-platform-tests. Fixes: #21291 --------- Signed-off-by: Jan Varga <jan.varga@gmail.com>
This commit is contained in:
parent
aaf04883dd
commit
934b3341d7
6 changed files with 234 additions and 122 deletions
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use base::id::WebViewId;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use profile_traits::mem::ReportsChan;
|
||||
|
@ -18,31 +19,58 @@ pub enum StorageType {
|
|||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum StorageThreadMsg {
|
||||
/// gets the number of key/value pairs present in the associated storage data
|
||||
Length(IpcSender<usize>, ServoUrl, StorageType),
|
||||
Length(IpcSender<usize>, StorageType, WebViewId, ServoUrl),
|
||||
|
||||
/// gets the name of the key at the specified index in the associated storage data
|
||||
Key(IpcSender<Option<String>>, ServoUrl, StorageType, u32),
|
||||
Key(
|
||||
IpcSender<Option<String>>,
|
||||
StorageType,
|
||||
WebViewId,
|
||||
ServoUrl,
|
||||
u32,
|
||||
),
|
||||
|
||||
/// Gets the available keys in the associated storage data
|
||||
Keys(IpcSender<Vec<String>>, ServoUrl, StorageType),
|
||||
Keys(IpcSender<Vec<String>>, StorageType, WebViewId, ServoUrl),
|
||||
|
||||
/// gets the value associated with the given key in the associated storage data
|
||||
GetItem(IpcSender<Option<String>>, ServoUrl, StorageType, String),
|
||||
GetItem(
|
||||
IpcSender<Option<String>>,
|
||||
StorageType,
|
||||
WebViewId,
|
||||
ServoUrl,
|
||||
String,
|
||||
),
|
||||
|
||||
/// sets the value of the given key in the associated storage data
|
||||
SetItem(
|
||||
IpcSender<Result<(bool, Option<String>), ()>>,
|
||||
ServoUrl,
|
||||
StorageType,
|
||||
WebViewId,
|
||||
ServoUrl,
|
||||
String,
|
||||
String,
|
||||
),
|
||||
|
||||
/// removes the key/value pair for the given key in the associated storage data
|
||||
RemoveItem(IpcSender<Option<String>>, ServoUrl, StorageType, String),
|
||||
RemoveItem(
|
||||
IpcSender<Option<String>>,
|
||||
StorageType,
|
||||
WebViewId,
|
||||
ServoUrl,
|
||||
String,
|
||||
),
|
||||
|
||||
/// clears the associated storage data by removing all the key/value pairs
|
||||
Clear(IpcSender<bool>, ServoUrl, StorageType),
|
||||
Clear(IpcSender<bool>, StorageType, WebViewId, ServoUrl),
|
||||
|
||||
/// clones all storage data of the given top-level browsing context for a new browsing context.
|
||||
/// should only be used for sessionStorage.
|
||||
Clone {
|
||||
sender: IpcSender<()>,
|
||||
src: WebViewId,
|
||||
dest: WebViewId,
|
||||
},
|
||||
|
||||
/// send a reply when done cleaning up thread resources and then shut it down
|
||||
Exit(IpcSender<()>),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue