aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Martins <martins.fernandomiguel@gmail.com>2016-01-11 17:23:55 +0000
committerFernando Martins <martins.fernandomiguel@gmail.com>2016-01-11 18:24:08 +0000
commit0ef003c20a4aef29ea5862fac60a37fe83548bb7 (patch)
tree5ff300ee669a3cc800f9065f796fa467f88d1833
parent99d01422931cee3ee0b51d7546796de6d09fb7a0 (diff)
downloadservo-0ef003c20a4aef29ea5862fac60a37fe83548bb7.tar.gz
servo-0ef003c20a4aef29ea5862fac60a37fe83548bb7.zip
moved IFrameLoadInfo and IFrameSandboxState to script_traits
-rw-r--r--components/compositing/constellation.rs5
-rw-r--r--components/msg/constellation_msg.rs23
-rw-r--r--components/script/dom/htmliframeelement.rs7
-rw-r--r--components/script_traits/lib.rs27
-rw-r--r--components/script_traits/script_msg.rs5
5 files changed, 37 insertions, 30 deletions
diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs
index f590b845d2d..43e8580ca56 100644
--- a/components/compositing/constellation.rs
+++ b/components/compositing/constellation.rs
@@ -30,8 +30,8 @@ use msg::compositor_msg::Epoch;
use msg::constellation_msg::AnimationState;
use msg::constellation_msg::WebDriverCommandMsg;
use msg::constellation_msg::{DocumentState, FrameId, PipelineId};
-use msg::constellation_msg::{IframeLoadInfo, IFrameSandboxState, MozBrowserEvent, NavigationDirection};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
+use msg::constellation_msg::{MozBrowserEvent, NavigationDirection};
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId};
use msg::constellation_msg::{SubpageId, WindowSizeData};
use msg::constellation_msg::{self, ConstellationChan, Failure};
@@ -45,6 +45,7 @@ use profile_traits::mem;
use profile_traits::time;
use sandboxing;
use script_traits::{CompositorEvent, ConstellationControlMsg, LayoutControlMsg};
+use script_traits::{IFrameLoadInfo, IFrameSandboxState};
use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory};
use script_traits::{TimerEventRequest};
use std::borrow::ToOwned;
@@ -829,7 +830,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
// will result in a new pipeline being spawned and a frame tree being added to
// containing_page_pipeline_id's frame tree's children. This message is never the result of a
// page navigation.
- fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IframeLoadInfo) {
+ fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IFrameLoadInfo) {
let old_pipeline_id = load_info.old_subpage_id.map(|old_subpage_id| {
self.find_subpage(load_info.containing_pipeline_id, old_subpage_id).id
});
diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs
index 878a8b1e7a6..c6d2f65378c 100644
--- a/components/msg/constellation_msg.rs
+++ b/components/msg/constellation_msg.rs
@@ -36,12 +36,6 @@ impl<T: Serialize + Deserialize> Clone for ConstellationChan<T> {
}
}
-#[derive(PartialEq, Eq, Copy, Clone, Debug, Deserialize, Serialize)]
-pub enum IFrameSandboxState {
- IFrameSandboxed,
- IFrameUnsandboxed
-}
-
// We pass this info to various threads, so it lives in a separate, cloneable struct.
#[derive(Clone, Copy, Deserialize, Serialize)]
pub struct Failure {
@@ -206,23 +200,6 @@ bitflags! {
}
}
-/// Specifies the information required to load a URL in an iframe.
-#[derive(Deserialize, Serialize)]
-pub struct IframeLoadInfo {
- /// Url to load
- pub url: Option<Url>,
- /// Pipeline ID of the parent of this iframe
- pub containing_pipeline_id: PipelineId,
- /// The new subpage ID for this load
- pub new_subpage_id: SubpageId,
- /// The old subpage ID for this iframe, if a page was previously loaded.
- pub old_subpage_id: Option<SubpageId>,
- /// The new pipeline ID that the iframe has generated.
- pub new_pipeline_id: PipelineId,
- /// Sandbox type of this iframe
- pub sandbox: IFrameSandboxState,
-}
-
#[derive(Deserialize, HeapSizeOf, Serialize)]
pub enum MouseEventType {
Click,
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 12a432f4c91..4d496903629 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -26,10 +26,11 @@ use dom::virtualmethods::VirtualMethods;
use dom::window::Window;
use js::jsapi::{JSAutoCompartment, JSAutoRequest, RootedValue, JSContext, MutableHandleValue};
use js::jsval::{UndefinedValue, NullValue};
-use msg::constellation_msg::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
-use msg::constellation_msg::{ConstellationChan, IframeLoadInfo, MozBrowserEvent};
+use msg::constellation_msg::{ConstellationChan, MozBrowserEvent};
use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId};
use page::IterablePage;
+use script_traits::IFrameLoadInfo;
+use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
use script_traits::ScriptMsg as ConstellationMsg;
use std::ascii::AsciiExt;
use std::cell::Cell;
@@ -105,7 +106,7 @@ impl HTMLIFrameElement {
self.containing_page_pipeline_id.set(Some(window.pipeline()));
let ConstellationChan(ref chan) = window.constellation_chan();
- let load_info = IframeLoadInfo {
+ let load_info = IFrameLoadInfo {
url: url,
containing_pipeline_id: window.pipeline(),
new_subpage_id: new_subpage_id,
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index a8905de4821..8c2c595a6a2 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -49,6 +49,7 @@ use net_traits::image_cache_thread::ImageCacheThread;
use net_traits::storage_thread::StorageThread;
use profile_traits::mem;
use std::any::Any;
+use url::Url;
use util::ipc::OptionalOpaqueIpcSender;
use util::mem::HeapSizeOf;
@@ -325,3 +326,29 @@ pub enum EventResult {
/// Prevented by web content
DefaultPrevented,
}
+
+/// Whether the sandbox attribute is present for an iframe element
+#[derive(PartialEq, Eq, Copy, Clone, Debug, Deserialize, Serialize)]
+pub enum IFrameSandboxState {
+ /// Sandbox attribute is present
+ IFrameSandboxed,
+ /// Sandbox attribute is not present
+ IFrameUnsandboxed
+}
+
+/// Specifies the information required to load a URL in an iframe.
+#[derive(Deserialize, Serialize)]
+pub struct IFrameLoadInfo {
+ /// Url to load
+ pub url: Option<Url>,
+ /// Pipeline ID of the parent of this iframe
+ pub containing_pipeline_id: PipelineId,
+ /// The new subpage ID for this load
+ pub new_subpage_id: SubpageId,
+ /// The old subpage ID for this iframe, if a page was previously loaded.
+ pub old_subpage_id: Option<SubpageId>,
+ /// The new pipeline ID that the iframe has generated.
+ pub new_pipeline_id: PipelineId,
+ /// Sandbox type of this iframe
+ pub sandbox: IFrameSandboxState,
+}
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs
index d072231eca2..e88605e66ea 100644
--- a/components/script_traits/script_msg.rs
+++ b/components/script_traits/script_msg.rs
@@ -2,11 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use IFrameLoadInfo;
use canvas_traits::CanvasMsg;
use euclid::point::Point2D;
use euclid::size::Size2D;
use ipc_channel::ipc::IpcSender;
-use msg::constellation_msg::{AnimationState, DocumentState, IframeLoadInfo, NavigationDirection};
+use msg::constellation_msg::{AnimationState, DocumentState, NavigationDirection};
use msg::constellation_msg::{Failure, MozBrowserEvent, PipelineId};
use msg::constellation_msg::{LoadData, SubpageId};
use msg::constellation_msg::{MouseButton, MouseEventType};
@@ -72,7 +73,7 @@ pub enum ScriptMsg {
/// Notification that this iframe should be removed.
RemoveIFrame(PipelineId),
/// A load has been requested in an IFrame.
- ScriptLoadedURLInIFrame(IframeLoadInfo),
+ ScriptLoadedURLInIFrame(IFrameLoadInfo),
/// Requests that the constellation set the contents of the clipboard
SetClipboardContents(String),
/// Mark a new document as active