mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Replace HistoryEntryReplacement with NavigationHistoryBehavior from the navigation API (#34681)
Signed-off-by: Shane Handley <shanehandley@fastmail.com>
This commit is contained in:
parent
3cbc8c2442
commit
3a4e5d4245
11 changed files with 127 additions and 108 deletions
|
@ -64,9 +64,9 @@ use webrender_traits::{
|
|||
};
|
||||
|
||||
pub use crate::script_msg::{
|
||||
DOMMessage, EventResult, HistoryEntryReplacement, IFrameSizeMsg, Job, JobError, JobResult,
|
||||
JobResultValue, JobType, LayoutMsg, LogEntry, SWManagerMsg, SWManagerSenders, ScopeThings,
|
||||
ScriptMsg, ServiceWorkerMsg, TraversalDirection,
|
||||
DOMMessage, EventResult, IFrameSizeMsg, Job, JobError, JobResult, JobResultValue, JobType,
|
||||
LayoutMsg, LogEntry, SWManagerMsg, SWManagerSenders, ScopeThings, ScriptMsg, ServiceWorkerMsg,
|
||||
TraversalDirection,
|
||||
};
|
||||
use crate::serializable::{BlobData, BlobImpl};
|
||||
use crate::transferable::MessagePortImpl;
|
||||
|
@ -233,6 +233,21 @@ pub enum DiscardBrowsingContext {
|
|||
No,
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#navigation-supporting-concepts:navigationhistorybehavior>
|
||||
#[derive(Debug, Default, Deserialize, PartialEq, Serialize)]
|
||||
pub enum NavigationHistoryBehavior {
|
||||
/// The default value, which will be converted very early in the navigate algorithm into "push"
|
||||
/// or "replace". Usually it becomes "push", but under certain circumstances it becomes
|
||||
/// "replace" instead.
|
||||
#[default]
|
||||
Auto,
|
||||
/// A regular navigation which adds a new session history entry, and will clear the forward
|
||||
/// session history.
|
||||
Push,
|
||||
/// A navigation that will replace the active session history entry.
|
||||
Replace,
|
||||
}
|
||||
|
||||
/// Is a document fully active, active or inactive?
|
||||
/// A document is active if it is the current active document in its session history,
|
||||
/// it is fuly active if it is active and all of its ancestors are active,
|
||||
|
@ -316,7 +331,7 @@ pub enum ConstellationControlMsg {
|
|||
PipelineId,
|
||||
BrowsingContextId,
|
||||
LoadData,
|
||||
HistoryEntryReplacement,
|
||||
NavigationHistoryBehavior,
|
||||
),
|
||||
/// Post a message to a given window.
|
||||
PostMessage {
|
||||
|
@ -721,9 +736,9 @@ pub struct IFrameLoadInfo {
|
|||
pub is_private: bool,
|
||||
/// Whether this iframe should be considered secure
|
||||
pub inherited_secure_context: Option<bool>,
|
||||
/// Wether this load should replace the current entry (reload). If true, the current
|
||||
/// Whether this load should replace the current entry (reload). If true, the current
|
||||
/// entry will be replaced instead of a new entry being added.
|
||||
pub replace: HistoryEntryReplacement,
|
||||
pub history_handling: NavigationHistoryBehavior,
|
||||
}
|
||||
|
||||
/// Specifies the information required to load a URL in an iframe.
|
||||
|
|
|
@ -28,8 +28,8 @@ use webgpu::{wgc, WebGPU, WebGPUResponse};
|
|||
|
||||
use crate::{
|
||||
AnimationState, AuxiliaryBrowsingContextLoadInfo, BroadcastMsg, DocumentState,
|
||||
IFrameLoadInfoWithData, LoadData, MessagePortMsg, PortMessageTask, StructuredSerializedData,
|
||||
WindowSizeType, WorkerGlobalScopeInit, WorkerScriptLoadOrigin,
|
||||
IFrameLoadInfoWithData, LoadData, MessagePortMsg, NavigationHistoryBehavior, PortMessageTask,
|
||||
StructuredSerializedData, WindowSizeType, WorkerGlobalScopeInit, WorkerScriptLoadOrigin,
|
||||
};
|
||||
|
||||
/// An iframe sizing operation.
|
||||
|
@ -83,15 +83,6 @@ pub enum LogEntry {
|
|||
Warn(String),
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#replacement-enabled>
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum HistoryEntryReplacement {
|
||||
/// Traverse the history with replacement enabled.
|
||||
Enabled,
|
||||
/// Traverse the history with replacement disabled.
|
||||
Disabled,
|
||||
}
|
||||
|
||||
/// Messages from the script to the constellation.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum ScriptMsg {
|
||||
|
@ -181,7 +172,7 @@ pub enum ScriptMsg {
|
|||
LoadComplete,
|
||||
/// A new load has been requested, with an option to replace the current entry once loaded
|
||||
/// instead of adding a new entry.
|
||||
LoadUrl(LoadData, HistoryEntryReplacement),
|
||||
LoadUrl(LoadData, NavigationHistoryBehavior),
|
||||
/// Abort loading after sending a LoadUrl message.
|
||||
AbortLoadUrl,
|
||||
/// Post a message to the currently active window of a given browsing context.
|
||||
|
@ -199,7 +190,7 @@ pub enum ScriptMsg {
|
|||
data: StructuredSerializedData,
|
||||
},
|
||||
/// Inform the constellation that a fragment was navigated to and whether or not it was a replacement navigation.
|
||||
NavigatedToFragment(ServoUrl, HistoryEntryReplacement),
|
||||
NavigatedToFragment(ServoUrl, NavigationHistoryBehavior),
|
||||
/// HTMLIFrameElement Forward or Back traversal.
|
||||
TraverseHistory(TraversalDirection),
|
||||
/// Inform the constellation of a pushed history state.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue