Urlmageddon: Use refcounted urls more often.

This commit is contained in:
Emilio Cobos Álvarez 2016-11-16 11:57:39 +01:00
parent f14e7339b5
commit 913c874cb5
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
161 changed files with 1044 additions and 718 deletions

View file

@ -31,6 +31,7 @@ profile_traits = {path = "../profile_traits"}
rustc-serialize = "0.3.4"
serde = "0.8"
serde_derive = "0.8"
servo_url = {path = "../url", features = ["servo"]}
style_traits = {path = "../style_traits", features = ["servo"]}
time = "0.1.12"
url = {version = "1.2", features = ["heap_size"]}

View file

@ -31,9 +31,9 @@ extern crate rustc_serialize;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate servo_url;
extern crate style_traits;
extern crate time;
extern crate url;
mod script_msg;
pub mod webdriver_msg;
@ -64,11 +64,11 @@ use net_traits::storage_thread::StorageType;
use profile_traits::mem;
use profile_traits::time as profile_time;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use servo_url::ServoUrl;
use std::collections::HashMap;
use std::fmt;
use std::sync::mpsc::{Receiver, Sender};
use style_traits::{PagePx, UnsafeNode, ViewportPx};
use url::Url;
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};
pub use script_msg::{LayoutMsg, ScriptMsg, EventResult, LogEntry};
@ -131,7 +131,7 @@ pub enum LayoutControlMsg {
#[derive(Clone, Deserialize, Serialize)]
pub struct LoadData {
/// The URL.
pub url: Url,
pub url: ServoUrl,
/// The method.
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
@ -145,12 +145,12 @@ pub struct LoadData {
/// The referrer policy.
pub referrer_policy: Option<ReferrerPolicy>,
/// The referrer URL.
pub referrer_url: Option<Url>,
pub referrer_url: Option<ServoUrl>,
}
impl LoadData {
/// Create a new `LoadData` object.
pub fn new(url: Url, referrer_policy: Option<ReferrerPolicy>, referrer_url: Option<Url>) -> LoadData {
pub fn new(url: ServoUrl, referrer_policy: Option<ReferrerPolicy>, referrer_url: Option<ServoUrl>) -> LoadData {
LoadData {
url: url,
method: Method::Get,
@ -247,7 +247,7 @@ pub enum ConstellationControlMsg {
},
/// Cause a `storage` event to be dispatched at the appropriate window.
/// The strings are key, old value and new value.
DispatchStorageEvent(PipelineId, StorageType, Url, Option<String>, Option<String>, Option<String>),
DispatchStorageEvent(PipelineId, StorageType, ServoUrl, Option<String>, Option<String>, Option<String>),
/// Notifies a parent pipeline that one of its child frames is now active.
/// PipelineId is for the parent, FrameId is the child frame.
FramedContentChanged(PipelineId, FrameId),
@ -682,7 +682,7 @@ pub enum ConstellationMsg {
/// immediately.
GetPipelineTitle(PipelineId),
/// Request to load the initial page.
InitLoadUrl(Url),
InitLoadUrl(ServoUrl),
/// Query the constellation to see if the current compositor output is stable
IsReadyToSaveImage(HashMap<PipelineId, Epoch>),
/// Inform the constellation of a key event.
@ -730,7 +730,7 @@ pub struct WorkerGlobalScopeInit {
#[derive(Deserialize, Serialize, Clone)]
pub struct WorkerScriptLoadOrigin {
/// referrer url
pub referrer_url: Option<Url>,
pub referrer_url: Option<ServoUrl>,
/// the referrer policy which is used
pub referrer_policy: Option<ReferrerPolicy>,
/// the pipeline id of the entity requesting the load

View file

@ -20,9 +20,9 @@ use msg::constellation_msg::{PipelineId, TraversalDirection};
use net_traits::CoreResourceMsg;
use net_traits::storage_thread::StorageType;
use offscreen_gl_context::{GLContextAttributes, GLLimits};
use servo_url::ServoUrl;
use style_traits::cursor::Cursor;
use style_traits::viewport::ViewportConstraints;
use url::Url;
/// Messages from the layout to the constellation.
#[derive(Deserialize, Serialize)]
@ -62,7 +62,7 @@ pub enum LogEntry {
pub enum ScriptMsg {
/// Broadcast a storage event to every same-origin pipeline.
/// The strings are key, old value and new value.
BroadcastStorageEvent(PipelineId, StorageType, Url, Option<String>, Option<String>, Option<String>),
BroadcastStorageEvent(PipelineId, StorageType, ServoUrl, Option<String>, Option<String>, Option<String>),
/// Indicates whether this pipeline is currently running animations.
ChangeRunningAnimationsState(PipelineId, AnimationState),
/// Requests that a new 2D canvas thread be created. (This is done in the constellation because
@ -95,7 +95,7 @@ pub enum ScriptMsg {
/// Gets the length of the joint session history from the constellation.
JointSessionHistoryLength(PipelineId, IpcSender<u32>),
/// Favicon detected
NewFavicon(Url),
NewFavicon(ServoUrl),
/// Status message to be displayed in the chrome, eg. a link URL on mouseover.
NodeStatus(Option<String>),
/// Notification that this iframe should be removed.
@ -113,7 +113,7 @@ pub enum ScriptMsg {
/// Set the document state for a pipeline (used by screenshot / reftests)
SetDocumentState(PipelineId, DocumentState),
/// Update the pipeline Url, which can change after redirections.
SetFinalUrl(PipelineId, Url),
SetFinalUrl(PipelineId, ServoUrl),
/// Check if an alert dialog box should be presented
Alert(PipelineId, String, IpcSender<bool>),
/// Scroll a page in a window
@ -137,9 +137,9 @@ pub enum ScriptMsg {
PipelineExited(PipelineId),
/// Send messages from postMessage calls from serviceworker
/// to constellation for storing in service worker manager
ForwardDOMMessage(DOMMessage, Url),
ForwardDOMMessage(DOMMessage, ServoUrl),
/// Store the data required to activate a service worker for the given scope
RegisterServiceWorker(ScopeThings, Url),
RegisterServiceWorker(ScopeThings, ServoUrl),
/// Requests that the compositor shut down.
Exit
}
@ -148,7 +148,7 @@ pub enum ScriptMsg {
#[derive(Deserialize, Serialize, Clone)]
pub struct ScopeThings {
/// script resource url
pub script_url: Url,
pub script_url: ServoUrl,
/// network load origin of the resource
pub worker_load_origin: WorkerScriptLoadOrigin,
/// base resources required to create worker global scopes
@ -175,11 +175,11 @@ pub struct SWManagerSenders {
#[derive(Deserialize, Serialize)]
pub enum ServiceWorkerMsg {
/// Message to register the service worker
RegisterServiceWorker(ScopeThings, Url),
RegisterServiceWorker(ScopeThings, ServoUrl),
/// Timeout message sent by active service workers
Timeout(Url),
Timeout(ServoUrl),
/// Message sent by constellation to forward to a running service worker
ForwardDOMMessage(DOMMessage, Url),
ForwardDOMMessage(DOMMessage, ServoUrl),
/// Exit the service worker manager
Exit,
}

View file

@ -10,7 +10,7 @@ use hyper_serde::Serde;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
use rustc_serialize::json::{Json, ToJson};
use url::Url;
use servo_url::ServoUrl;
#[derive(Deserialize, Serialize)]
pub enum WebDriverScriptCommand {
@ -34,7 +34,7 @@ pub enum WebDriverScriptCommand {
GetElementTagName(String, IpcSender<Result<String, ()>>),
GetElementText(String, IpcSender<Result<String, ()>>),
GetFrameId(WebDriverFrameId, IpcSender<Result<Option<PipelineId>, ()>>),
GetUrl(IpcSender<Url>),
GetUrl(IpcSender<ServoUrl>),
IsEnabled(String, IpcSender<Result<bool, ()>>),
IsSelected(String, IpcSender<Result<bool, ()>>),
GetTitle(IpcSender<String>)