diff options
author | Gregory Terzian <gterzian@users.noreply.github.com> | 2019-05-12 17:37:19 +0800 |
---|---|---|
committer | Gregory Terzian <gterzian@users.noreply.github.com> | 2019-07-18 12:03:45 +0800 |
commit | 571beec179fe9fd5fff2c12b3c5dfa0a5d93df01 (patch) | |
tree | 2eda42b78fa99fd2cd51d733519d5ae9d8678a66 /components/script_traits/script_msg.rs | |
parent | 973a3448a459464b79ea0ef5fb46141176cc7643 (diff) | |
download | servo-571beec179fe9fd5fff2c12b3c5dfa0a5d93df01.tar.gz servo-571beec179fe9fd5fff2c12b3c5dfa0a5d93df01.zip |
clean-up navigation
security: check target and source origin before executing JS url
implement replacement-enabled flag as a HistoryEntryReplacement enum
add source origin string on loaddata
add LoadOrigin
iframe: remove optional load-data
auxiliaries: add load-data into info
constellation: remove url from Pipeline::new
check load origin: link to whatwg issue
switch loadorigin toplevel to constellation
Diffstat (limited to 'components/script_traits/script_msg.rs')
-rw-r--r-- | components/script_traits/script_msg.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index 48862e8378f..fe620247b0d 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -5,7 +5,6 @@ use crate::AnimationState; use crate::AuxiliaryBrowsingContextLoadInfo; use crate::DocumentState; -use crate::IFrameLoadInfo; use crate::IFrameLoadInfoWithData; use crate::LayoutControlMsg; use crate::LoadData; @@ -97,6 +96,15 @@ 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 { @@ -145,7 +153,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, bool), + LoadUrl(LoadData, HistoryEntryReplacement), /// Abort loading after sending a LoadUrl message. AbortLoadUrl, /// Post a message to the currently active window of a given browsing context. @@ -160,7 +168,7 @@ pub enum ScriptMsg { data: Vec<u8>, }, /// Inform the constellation that a fragment was navigated to and whether or not it was a replacement navigation. - NavigatedToFragment(ServoUrl, bool), + NavigatedToFragment(ServoUrl, HistoryEntryReplacement), /// HTMLIFrameElement Forward or Back traversal. TraverseHistory(TraversalDirection), /// Inform the constellation of a pushed history state. @@ -177,7 +185,7 @@ pub enum ScriptMsg { /// A load has been requested in an IFrame. ScriptLoadedURLInIFrame(IFrameLoadInfoWithData), /// A load of the initial `about:blank` has been completed in an IFrame. - ScriptNewIFrame(IFrameLoadInfo, IpcSender<LayoutControlMsg>), + ScriptNewIFrame(IFrameLoadInfoWithData, IpcSender<LayoutControlMsg>), /// Script has opened a new auxiliary browsing context. ScriptNewAuxiliary( AuxiliaryBrowsingContextLoadInfo, |