diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-02-13 04:54:47 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-13 04:54:47 -0500 |
commit | b1d3d6f6324394f0e9f17b027fef24420d829b5c (patch) | |
tree | da12ad096ade09fd4f89ff2b243b4eff6b69a8a9 | |
parent | 9e64008e759a678a3971d04977c2b20b66fa8229 (diff) | |
parent | ee25413c0fe13378e0de4b716915f572e7bbc32a (diff) | |
download | servo-b1d3d6f6324394f0e9f17b027fef24420d829b5c.tar.gz servo-b1d3d6f6324394f0e9f17b027fef24420d829b5c.zip |
Auto merge of #19975 - paulrouget:killbhtml, r=mbrubeck,emilio
Kill browserhtml
Fixes https://github.com/servo/servo/issues/19971
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19975)
<!-- Reviewable:end -->
82 files changed, 102 insertions, 2528 deletions
diff --git a/Cargo.lock b/Cargo.lock index adf71b4b594..4de65ef9a49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -257,11 +257,6 @@ dependencies = [ ] [[package]] -name = "browserhtml" -version = "0.1.17" -source = "git+https://github.com/browserhtml/browserhtml?branch=crate#84913eafd817c92fbb6bdbb8a8f7480baddee3d3" - -[[package]] name = "byteorder" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1972,11 +1967,6 @@ dependencies = [ ] [[package]] -name = "open" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] name = "openssl" version = "0.9.22" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2376,7 +2366,6 @@ dependencies = [ "net_traits 0.0.1", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", - "open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2569,7 +2558,6 @@ dependencies = [ "android_injected_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "browserhtml 0.1.17 (git+https://github.com/browserhtml/browserhtml?branch=crate)", "compositing 0.0.1", "euclid 0.16.4 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3532,7 +3520,6 @@ dependencies = [ "checksum blurz 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e73bda0f4c71c63a047351070097f3f507e6718e86b9ee525173371ef7b94b73" "checksum brotli 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fe87b40996b84fdc56e57c165d93079f4b50cb806598118e692ddfaa3d3c57c0" "checksum brotli-decompressor 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "313f4b6cc0b365d6b88eda5aa40175ee34ac6efa9a79e0b3b8202eca90247ba8" -"checksum browserhtml 0.1.17 (git+https://github.com/browserhtml/browserhtml?branch=crate)" = "<none>" "checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" "checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27" "checksum caseless 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8950b075cff75cdabadee97148a8b5816c7cf62e5948a6005b5255d564b42fe7" @@ -3665,7 +3652,6 @@ dependencies = [ "checksum offscreen_gl_context 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb69c6b9fff6f2166af94c72cf6333b8bb883910809a396b53a881fd6b5e913" "checksum ogg 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7137bf02687385302f4c0aecd77cfce052b69f5b4ee937be778e125c62f67e30" "checksum ogg_metadata 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fc665717454399cba557c55ad226148996e9266ee291f8a37a98bb2cded0a490" -"checksum open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3478ed1686bd1300c8a981a940abc92b06fac9cbef747f4c668d4e032ff7b842" "checksum openssl 0.9.22 (registry+https://github.com/rust-lang/crates.io-index)" = "419ef26bb651d72b6c5a603bcc4e4856a362460e62352dfffa53de91d2e81181" "checksum openssl-sys 0.9.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5483bdc56756041ba6aa37c9cb59cc2219f012a2a1377d97ad35556ac6676ee7" "checksum ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "da12c96037889ae0be29dd2bdd260e5a62a7df24e6466d5a15bb8131c1c200a8" diff --git a/Info.plist b/Info.plist index a3136514d3a..ded92bf0267 100644 --- a/Info.plist +++ b/Info.plist @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>CFBundleExecutable</key> - <string>run-servo</string> + <string>servo</string> <key>CFBundleGetInfoString</key> <string>Servo</string> <key>CFBundleIconFile</key> diff --git a/README.md b/README.md index fe24a22478a..1572d33db0b 100644 --- a/README.md +++ b/README.md @@ -253,11 +253,6 @@ Run Servo with the command: ./mach run https://www.google.com ``` -Also, don't miss the info on the [browserhtml page](https://github.com/browserhtml/browserhtml) on how to run the Browser.html -full tech demo (it provides a more browser-like experience than just browsing a single -URL with servo). - - ### Commandline Arguments - `-p INTERVAL` turns on the profiler and dumps info to the console every diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 58f7358045b..62d5740d31a 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -18,10 +18,9 @@ use nonzero::NonZero; use profile_traits::time::{self, ProfilerCategory, profile}; use script_traits::{AnimationState, AnimationTickType, ConstellationMsg, LayoutControlMsg}; use script_traits::{MouseButton, MouseEventType, ScrollState, TouchEventType, TouchId}; -use script_traits::{TouchpadPressurePhase, UntrustedNodeAddress, WindowSizeData, WindowSizeType}; -use script_traits::CompositorEvent::{MouseMoveEvent, MouseButtonEvent, TouchEvent, TouchpadPressureEvent}; +use script_traits::{UntrustedNodeAddress, WindowSizeData, WindowSizeType}; +use script_traits::CompositorEvent::{MouseMoveEvent, MouseButtonEvent, TouchEvent}; use servo_config::opts; -use servo_config::prefs::PREFS; use servo_geometry::DeviceIndependentPixel; use std::collections::HashMap; use std::fs::File; @@ -864,31 +863,6 @@ impl<Window: WindowMethods> IOCompositor<Window> { self.send_touch_event(TouchEventType::Cancel, identifier, point); } - pub fn on_touchpad_pressure_event(&self, - point: TypedPoint2D<f32, DevicePixel>, - pressure: f32, - phase: TouchpadPressurePhase) { - match PREFS.get("dom.forcetouch.enabled").as_boolean() { - Some(true) => {}, - _ => return, - } - - let results = self.hit_test_at_point(point); - if let Some(item) = results.items.first() { - let event = TouchpadPressureEvent( - item.point_in_viewport.to_untyped(), - pressure, - phase, - Some(UntrustedNodeAddress(item.tag.0 as *const c_void)), - ); - let pipeline_id = PipelineId::from_webrender(item.pipeline); - let msg = ConstellationMsg::ForwardEvent(pipeline_id, event); - if let Err(e) = self.constellation_chan.send(msg) { - warn!("Sending event to constellation failed ({}).", e); - } - } - } - /// <http://w3c.github.io/touch-events/#mouse-events> fn simulate_mouse_click(&mut self, p: TypedPoint2D<f32, DevicePixel>) { let button = MouseButton::Left; diff --git a/components/compositing/compositor_thread.rs b/components/compositing/compositor_thread.rs index 2e3d69f8057..2695970e320 100644 --- a/components/compositing/compositor_thread.rs +++ b/components/compositing/compositor_thread.rs @@ -146,6 +146,8 @@ pub enum EmbedderMsg { LoadStart(TopLevelBrowsingContextId), /// The load of a page has completed LoadComplete(TopLevelBrowsingContextId), + /// A pipeline panicked. First string is the reason, second one is the backtrace. + Panic(TopLevelBrowsingContextId, String, Option<String>), } /// Messages from the painting thread and the constellation thread to the compositor thread. @@ -237,6 +239,7 @@ impl Debug for EmbedderMsg { EmbedderMsg::SetFullscreenState(..) => write!(f, "SetFullscreenState"), EmbedderMsg::LoadStart(..) => write!(f, "LoadStart"), EmbedderMsg::LoadComplete(..) => write!(f, "LoadComplete"), + EmbedderMsg::Panic(..) => write!(f, "Panic"), } } } diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index 94e9bd19865..473e85fcb07 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -11,7 +11,7 @@ use gleam::gl; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::{Key, KeyModifiers, KeyState, TopLevelBrowsingContextId, TraversalDirection}; use net_traits::net_error_list::NetError; -use script_traits::{LoadData, MouseButton, TouchEventType, TouchId, TouchpadPressurePhase}; +use script_traits::{LoadData, MouseButton, TouchEventType, TouchId}; use servo_geometry::DeviceIndependentPixel; use servo_url::ServoUrl; use std::fmt::{Debug, Error, Formatter}; @@ -50,8 +50,6 @@ pub enum WindowEvent { Refresh, /// Sent when the window is resized. Resize, - /// Touchpad Pressure - TouchpadPressure(TypedPoint2D<f32, DevicePixel>, f32, TouchpadPressurePhase), /// Sent when a new URL is to be loaded. LoadUrl(TopLevelBrowsingContextId, ServoUrl), /// Sent when a mouse hit test is to be performed. @@ -94,7 +92,6 @@ impl Debug for WindowEvent { WindowEvent::Idle => write!(f, "Idle"), WindowEvent::Refresh => write!(f, "Refresh"), WindowEvent::Resize => write!(f, "Resize"), - WindowEvent::TouchpadPressure(..) => write!(f, "TouchpadPressure"), WindowEvent::KeyEvent(..) => write!(f, "Key"), WindowEvent::LoadUrl(..) => write!(f, "LoadUrl"), WindowEvent::MouseWindowEventClass(..) => write!(f, "Mouse"), @@ -192,4 +189,7 @@ pub trait WindowMethods { /// will want to avoid blocking on UI events, and just /// run the event loop at the vsync interval. fn set_animation_state(&self, _state: AnimationState) {} + + /// Called when a pipeline panics. + fn handle_panic(&self, browser_id: TopLevelBrowsingContextId, reason: String, backtrace: Option<String>); } diff --git a/components/config/opts.rs b/components/config/opts.rs index 8c9bf1cbd3b..fbca63417ae 100644 --- a/components/config/opts.rs +++ b/components/config/opts.rs @@ -609,7 +609,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { opts.optopt("", "content-process" , "Run as a content process and connect to the given pipe", "servo-ipc-channel.abcdefg"); opts.optmulti("", "pref", - "A preference to set to enable", "dom.mozbrowser.enabled"); + "A preference to set to enable", "dom.bluetooth.enabled"); opts.optflag("b", "no-native-titlebar", "Do not use native titlebar"); opts.optflag("w", "webrender", "Use webrender backend"); opts.optopt("G", "graphics", "Select graphics backend (gl or es2)", "gl"); diff --git a/components/config/prefs.rs b/components/config/prefs.rs index 3efccecb8bc..285cdd9402d 100644 --- a/components/config/prefs.rs +++ b/components/config/prefs.rs @@ -228,10 +228,6 @@ impl Preferences { self.0.read().unwrap().clone() } - pub fn is_mozbrowser_enabled(&self) -> bool { - self.get("dom.mozbrowser.enabled").as_boolean().unwrap_or(false) - } - pub fn set(&self, name: &str, value: PrefValue) { let mut prefs = self.0.write().unwrap(); if let Some(pref) = prefs.get_mut(name) { diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 09bce57bb90..3db4c5c39f2 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -43,9 +43,6 @@ //! +------------+ +------------+ //! ``` // -//! Complicating matters, there are also mozbrowser iframes, which are top-level -//! iframes with a parent. -//! //! The constellation also maintains channels to threads, including: //! //! * The script and layout threads. @@ -59,8 +56,7 @@ //! to track the evolving state of the browsing context tree. //! //! The constellation acts as a logger, tracking any `warn!` messages from threads, -//! and converting any `error!` or `panic!` into a crash report, which is filed -//! using an appropriate `mozbrowsererror` event. +//! and converting any `error!` or `panic!` into a crash report. //! //! Since there is only one constellation, and its responsibilities include crash reporting, //! it is very important that it does not panic. @@ -116,7 +112,7 @@ use ipc_channel::router::ROUTER; use itertools::Itertools; use layout_traits::LayoutThreadFactory; use log::{Log, LogLevel, LogLevelFilter, LogMetadata, LogRecord}; -use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, FrameType, PipelineId}; +use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, PipelineId}; use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, TraversalDirection}; use net_traits::{self, IpcSend, FetchResponseMsg, ResourceThreads}; @@ -133,8 +129,8 @@ use script_traits::{DocumentActivity, DocumentState, LayoutControlMsg, LoadData} use script_traits::{IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState, TimerSchedulerMsg}; use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory}; use script_traits::{LogEntry, ScriptToConstellationChan, ServiceWorkerMsg, webdriver_msg}; -use script_traits::{MozBrowserErrorType, MozBrowserEvent, WebDriverCommandMsg, WindowSizeData}; -use script_traits::{SWManagerMsg, ScopeThings, UpdatePipelineIdReason, WindowSizeType}; +use script_traits::{SWManagerMsg, ScopeThings, UpdatePipelineIdReason, WebDriverCommandMsg}; +use script_traits::{WindowSizeData, WindowSizeType}; use serde::{Deserialize, Serialize}; use servo_config::opts; use servo_config::prefs::PREFS; @@ -658,7 +654,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> pipeline_id: PipelineId, browsing_context_id: BrowsingContextId, top_level_browsing_context_id: TopLevelBrowsingContextId, - parent_info: Option<(PipelineId, FrameType)>, + parent_info: Option<PipelineId>, initial_window_size: Option<TypedSize2D<f32, CSSPixel>>, // TODO: we have to provide ownership of the LoadData // here, because it will be send on an ipc channel, @@ -690,7 +686,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> }, } } else if let Some(parent) = parent_info - .and_then(|(pipeline_id, _)| self.pipelines.get(&pipeline_id)) { + .and_then(|pipeline_id| self.pipelines.get(&pipeline_id)) { (Some(parent.event_loop.clone()), None) } else if let Some(creator) = load_data.creator_pipeline_id .and_then(|pipeline_id| self.pipelines.get(&pipeline_id)) { @@ -708,7 +704,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> }; let parent_visibility = parent_info - .and_then(|(parent_pipeline_id, _)| self.pipelines.get(&parent_pipeline_id)) + .and_then(|parent_pipeline_id| self.pipelines.get(&parent_pipeline_id)) .map(|pipeline| pipeline.visible); let prev_visibility = self.browsing_contexts.get(&browsing_context_id) @@ -824,12 +820,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> ) } - /// Is the joint session future empty? - fn joint_session_future_is_empty(&self, top_level_browsing_context_id: TopLevelBrowsingContextId) -> bool { - self.all_browsing_contexts_iter(top_level_browsing_context_id) - .all(|browsing_context| browsing_context.next.is_empty()) - } - #[cfg(feature = "unstable")] /// The joint session past is the merge of the session past of every /// browsing_context, sorted reverse chronologically. @@ -866,12 +856,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> ) } - /// Is the joint session past empty? - fn joint_session_past_is_empty(&self, top_level_browsing_context_id: TopLevelBrowsingContextId) -> bool { - self.all_browsing_contexts_iter(top_level_browsing_context_id) - .all(|browsing_context| browsing_context.prev.is_empty()) - } - /// Create a new browsing context and update the internal bookkeeping. fn new_browsing_context(&mut self, browsing_context_id: BrowsingContextId, @@ -885,7 +869,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> // If a child browsing_context, add it to the parent pipeline. let parent_info = self.pipelines.get(&pipeline_id) .and_then(|pipeline| pipeline.parent_info); - if let Some((parent_id, _)) = parent_info { + if let Some(parent_id) = parent_info { if let Some(parent) = self.pipelines.get_mut(&parent_id) { parent.add_child(browsing_context_id); } @@ -1173,10 +1157,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> debug!("constellation got postMessage message"); self.handle_post_message_msg(browsing_context_id, origin, data); } - FromScriptMsg::MozBrowserEvent(pipeline_id, event) => { - debug!("constellation got mozbrowser event message"); - self.handle_mozbrowser_event_msg(pipeline_id, source_top_ctx_id, event); - } FromScriptMsg::Focus => { debug!("constellation got focus message"); self.handle_focus_msg(source_pipeline_id); @@ -1515,8 +1495,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id); - // Notify the browser chrome that the pipeline has failed - self.trigger_mozbrowsererror(top_level_browsing_context_id, reason, backtrace); + self.embedder_proxy.send(EmbedderMsg::Panic(top_level_browsing_context_id, reason, backtrace)); let (window_size, pipeline_id) = { let browsing_context = self.browsing_contexts.get(&browsing_context_id); @@ -1656,7 +1635,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> fn handle_subframe_loaded(&mut self, pipeline_id: PipelineId) { let (browsing_context_id, parent_id) = match self.pipelines.get(&pipeline_id) { Some(pipeline) => match pipeline.parent_info { - Some((parent_id, _)) => (pipeline.browsing_context_id, parent_id), + Some(parent_id) => (pipeline.browsing_context_id, parent_id), None => return debug!("Pipeline {} has no parent.", pipeline_id), }, None => return warn!("Pipeline {} loaded after closure.", pipeline_id), @@ -1732,7 +1711,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> self.new_pipeline(load_info.info.new_pipeline_id, load_info.info.browsing_context_id, load_info.info.top_level_browsing_context_id, - Some((load_info.info.parent_pipeline_id, load_info.info.frame_type)), + Some(load_info.info.parent_pipeline_id), window_size, load_data.clone(), load_info.sandbox, @@ -1752,7 +1731,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> let IFrameLoadInfo { parent_pipeline_id, new_pipeline_id, - frame_type, replace, browsing_context_id, top_level_browsing_context_id, @@ -1772,7 +1750,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> Pipeline::new(new_pipeline_id, browsing_context_id, top_level_browsing_context_id, - Some((parent_pipeline_id, frame_type)), + Some(parent_pipeline_id), script_sender, layout_sender, self.compositor_proxy.clone(), @@ -1841,27 +1819,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> fn handle_alert(&mut self, top_level_browsing_context_id: TopLevelBrowsingContextId, - message: String, + _message: String, sender: IpcSender<bool>) { - let browser_pipeline_id = self.browsing_contexts.get(&BrowsingContextId::from(top_level_browsing_context_id)) - .and_then(|browsing_context| self.pipelines.get(&browsing_context.pipeline_id)) - .and_then(|pipeline| pipeline.parent_info) - .map(|(browser_pipeline_id, _)| browser_pipeline_id); - let mozbrowser_modal_prompt = PREFS.is_mozbrowser_enabled() && browser_pipeline_id.is_some(); - - if mozbrowser_modal_prompt { - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsershowmodalprompt - let prompt_type = String::from("alert"); - let title = String::from("Alert"); - let return_value = String::from(""); - let event = MozBrowserEvent::ShowModalPrompt(prompt_type, title, message, return_value); - match browser_pipeline_id.and_then(|id| self.pipelines.get(&id)) { - None => warn!("Alert sent after browser pipeline closure."), - Some(pipeline) => pipeline.trigger_mozbrowser_event(Some(top_level_browsing_context_id), event), - } - } - - let result = sender.send(!mozbrowser_modal_prompt); + // FIXME: forward alert event to embedder + // https://github.com/servo/servo/issues/19992 + let result = sender.send(true); if let Err(e) = result { let ctx_id = BrowsingContextId::from(top_level_browsing_context_id); let pipeline_id = match self.browsing_contexts.get(&ctx_id) { @@ -1902,7 +1864,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> } }; match parent_info { - Some((parent_pipeline_id, _)) => { + Some(parent_pipeline_id) => { // Find the script thread for the pipeline containing the iframe // and issue an iframe load through there. let msg = ConstellationControlMsg::Navigate(parent_pipeline_id, @@ -2131,22 +2093,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> } } - fn handle_mozbrowser_event_msg(&mut self, - pipeline_id: PipelineId, - top_level_browsing_context_id: TopLevelBrowsingContextId, - event: MozBrowserEvent) { - assert!(PREFS.is_mozbrowser_enabled()); - - // Find the script channel for the given parent pipeline, - // and pass the event to that script thread. - // If the pipeline lookup fails, it is because we have torn down the pipeline, - // so it is reasonable to silently ignore the event. - match self.pipelines.get(&pipeline_id) { - Some(pipeline) => pipeline.trigger_mozbrowser_event(Some(top_level_browsing_context_id), event), - None => warn!("Pipeline {:?} handling mozbrowser event after closure.", pipeline_id), - } - } - fn handle_get_pipeline(&mut self, browsing_context_id: BrowsingContextId, resp_chan: IpcSender<Option<PipelineId>>) { @@ -2175,7 +2121,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> Some(pipeline) => (pipeline.browsing_context_id, pipeline.parent_info), None => return warn!("Pipeline {:?} focus parent after closure.", pipeline_id), }; - let (parent_pipeline_id, _) = match parent_info { + let parent_pipeline_id = match parent_info { Some(info) => info, None => return debug!("Pipeline {:?} focus has no parent.", pipeline_id), }; @@ -2234,7 +2180,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> None => return warn!("Visibity change for closed pipeline {:?}.", pipeline_id), Some(pipeline) => (pipeline.browsing_context_id, pipeline.parent_info), }; - if let Some((parent_pipeline_id, _)) = parent_pipeline_info { + if let Some(parent_pipeline_id) = parent_pipeline_info { let visibility_msg = ConstellationControlMsg::NotifyVisibilityChange(parent_pipeline_id, browsing_context_id, visibility); @@ -2430,7 +2376,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> // Update the owning iframe to point to the new pipeline id. // This makes things like contentDocument work correctly. - if let Some((parent_pipeline_id, frame_type)) = parent_info { + if let Some(parent_pipeline_id) = parent_info { let msg = ConstellationControlMsg::UpdatePipelineId(parent_pipeline_id, browsing_context_id, pipeline_id, UpdatePipelineIdReason::Traversal); let result = match self.pipelines.get(&parent_pipeline_id) { @@ -2440,12 +2386,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> if let Err(e) = result { self.handle_send_error(parent_pipeline_id, e); } - - // If this is a mozbrowser iframe, send a mozbrowser location change event. - // This is the result of a back/forward traversal. - if frame_type == FrameType::MozBrowserIFrame { - self.trigger_mozbrowserlocationchange(top_level_id); - } } } @@ -2579,11 +2519,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> self.notify_history_changed(change.top_level_browsing_context_id); } - // If the navigation is for a top-level browsing context, inform mozbrowser - if change.browsing_context_id == change.top_level_browsing_context_id { - self.trigger_mozbrowserlocationchange(change.top_level_browsing_context_id); - } - self.update_frame_tree_if_active(change.top_level_browsing_context_id); } @@ -2592,7 +2527,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> // Notify the parent (if there is one). if let Some(pipeline) = self.pipelines.get(&pipeline_id) { - if let Some((parent_pipeline_id, _)) = pipeline.parent_info { + if let Some(parent_pipeline_id) = pipeline.parent_info { if let Some(parent_pipeline) = self.pipelines.get(&parent_pipeline_id) { let msg = ConstellationControlMsg::UpdatePipelineId(parent_pipeline_id, pipeline.browsing_context_id, pipeline_id, UpdatePipelineIdReason::Navigation); @@ -2759,7 +2694,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> if let Some(ancestor) = self.pipelines.get(&ancestor_id) { if let Some(browsing_context) = self.browsing_contexts.get(&ancestor.browsing_context_id) { if browsing_context.pipeline_id == ancestor_id { - if let Some((parent_id, FrameType::IFrame)) = ancestor.parent_info { + if let Some(parent_id) = ancestor.parent_info { ancestor_id = parent_id; continue; } else { @@ -2887,7 +2822,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> let parent_info = self.pipelines.get(&browsing_context.pipeline_id) .and_then(|pipeline| pipeline.parent_info); - if let Some((parent_pipeline_id, _)) = parent_info { + if let Some(parent_pipeline_id) = parent_info { match self.pipelines.get_mut(&parent_pipeline_id) { None => return warn!("Pipeline {:?} child closed after parent.", parent_pipeline_id), Some(parent_pipeline) => parent_pipeline.remove_child(browsing_context_id), @@ -2982,13 +2917,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> if let Some((ref mut rng, probability)) = self.random_pipeline_closure { if let Some(pipeline_id) = rng.choose(&*pipeline_ids) { if let Some(pipeline) = self.pipelines.get(pipeline_id) { - // Don't kill the mozbrowser pipeline - if PREFS.is_mozbrowser_enabled() && pipeline.parent_info.is_none() { - info!("Not closing mozbrowser pipeline {}.", pipeline_id); - } else if - self.pending_changes.iter().any(|change| change.new_pipeline_id == pipeline.id) && - probability <= rng.gen::<f32>() - { + if self.pending_changes.iter().any(|change| change.new_pipeline_id == pipeline.id) && + probability <= rng.gen::<f32>() { // We tend not to close pending pipelines, as that almost always // results in pipelines being closed early in their lifecycle, // and not stressing the constellation as much. @@ -3027,26 +2957,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> } /// Re-send the frame tree to the compositor. - fn update_frame_tree_if_active(&mut self, mut top_level_browsing_context_id: TopLevelBrowsingContextId) { - // This might be a mozbrowser iframe, so we need to climb the parent hierarchy, - // even though it's a top-level browsing context. - // FIXME(paul): to remove once mozbrowser API is removed. - let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id); - let mut pipeline_id = match self.browsing_contexts.get(&browsing_context_id) { - Some(browsing_context) => browsing_context.pipeline_id, - None => return warn!("Sending frame tree for discarded browsing context {}.", browsing_context_id), - }; - - while let Some(pipeline) = self.pipelines.get(&pipeline_id) { - match pipeline.parent_info { - Some((parent_id, _)) => pipeline_id = parent_id, - None => { - top_level_browsing_context_id = pipeline.top_level_browsing_context_id; - break; - }, - } - } - + fn update_frame_tree_if_active(&mut self, top_level_browsing_context_id: TopLevelBrowsingContextId) { // Only send the frame tree if it's the active one or if no frame tree // has been sent yet. if self.active_browser_id.is_none() || Some(top_level_browsing_context_id) == self.active_browser_id { @@ -3069,77 +2980,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> } } - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserlocationchange - // Note that this is a no-op if the pipeline is not a mozbrowser iframe - fn trigger_mozbrowserlocationchange(&self, - top_level_browsing_context_id: TopLevelBrowsingContextId) - { - let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id); - let pipeline_id = match self.browsing_contexts.get(&browsing_context_id) { - Some(browsing_context) => browsing_context.pipeline_id, - None => return warn!("mozbrowser location change on closed browsing context {}.", browsing_context_id), - }; - let (url, parent_info) = match self.pipelines.get(&pipeline_id) { - Some(pipeline) => (pipeline.url.clone(), pipeline.parent_info), - None => return warn!("mozbrowser location change on closed pipeline {}.", pipeline_id), - }; - let parent_id = match parent_info { - Some((parent_id, FrameType::MozBrowserIFrame)) => parent_id, - _ => return debug!("mozbrowser location change on a regular iframe {}", browsing_context_id), - }; - let can_go_forward = !self.joint_session_future_is_empty(top_level_browsing_context_id); - let can_go_back = !self.joint_session_past_is_empty(top_level_browsing_context_id); - let event = MozBrowserEvent::LocationChange(url.to_string(), can_go_back, can_go_forward); - match self.pipelines.get(&parent_id) { - Some(parent) => parent.trigger_mozbrowser_event(Some(top_level_browsing_context_id), event), - None => return warn!("mozbrowser location change on closed parent {}", parent_id), - }; - } - - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsererror - fn trigger_mozbrowsererror(&mut self, - top_level_browsing_context_id: TopLevelBrowsingContextId, - reason: String, - backtrace: Option<String>) - { - if !PREFS.is_mozbrowser_enabled() { return; } - - let mut report = String::new(); - for (thread_name, warning) in self.handled_warnings.drain(..) { - report.push_str("\nWARNING: "); - if let Some(thread_name) = thread_name { - report.push_str("<"); - report.push_str(&*thread_name); - report.push_str(">: "); - } - report.push_str(&*warning); - } - report.push_str("\nERROR: "); - report.push_str(&*reason); - if let Some(backtrace) = backtrace { - report.push_str("\n\n"); - report.push_str(&*backtrace); - } - - let event = MozBrowserEvent::Error(MozBrowserErrorType::Fatal, reason, report); - let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id); - let pipeline_id = match self.browsing_contexts.get(&browsing_context_id) { - Some(browsing_context) => browsing_context.pipeline_id, - None => return warn!("Mozbrowser error after top-level browsing context closed."), - }; - let parent_id = match self.pipelines.get(&pipeline_id) { - Some(pipeline) => match pipeline.parent_info { - Some((parent_id, FrameType::MozBrowserIFrame)) => parent_id, - _ => return pipeline.trigger_mozbrowser_event(None, event), - }, - None => return warn!("Mozbrowser error on a closed pipeline {}", pipeline_id), - }; - match self.pipelines.get(&parent_id) { - None => warn!("Mozbrowser error after parent pipeline {} closed.", parent_id), - Some(parent) => parent.trigger_mozbrowser_event(Some(top_level_browsing_context_id), event), - }; - } - fn focused_pipeline_is_descendant_of(&self, browsing_context_id: BrowsingContextId) -> bool { self.focus_pipeline_id.map_or(false, |pipeline_id| { self.fully_active_descendant_browsing_contexts_iter(browsing_context_id) diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index 00b3088a3fc..4753f0ba3eb 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -16,7 +16,7 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; use layout_traits::LayoutThreadFactory; use metrics::PaintTimeMetrics; -use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, FrameType, PipelineId, PipelineNamespaceId}; +use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, PipelineId, PipelineNamespaceId}; use net::image_cache::ImageCacheImpl; use net_traits::{IpcSend, ResourceThreads}; use net_traits::image_cache::ImageCache; @@ -24,7 +24,7 @@ use profile_traits::mem as profile_mem; use profile_traits::time; use script_traits::{ConstellationControlMsg, DiscardBrowsingContext, ScriptToConstellationChan}; use script_traits::{DocumentActivity, InitialScriptState}; -use script_traits::{LayoutControlMsg, LayoutMsg, LoadData, MozBrowserEvent}; +use script_traits::{LayoutControlMsg, LayoutMsg, LoadData}; use script_traits::{NewLayoutInfo, SWManagerMsg, SWManagerSenders}; use script_traits::{ScriptThreadFactory, TimerSchedulerMsg, WindowSizeData}; use servo_config::opts::{self, Opts}; @@ -58,11 +58,8 @@ pub struct Pipeline { pub top_level_browsing_context_id: TopLevelBrowsingContextId, /// The parent pipeline of this one. `None` if this is a root pipeline. - /// Note that because of mozbrowser iframes, even top-level pipelines - /// may have a parent (in which case the frame type will be - /// `MozbrowserIFrame`). /// TODO: move this field to `BrowsingContext`. - pub parent_info: Option<(PipelineId, FrameType)>, + pub parent_info: Option<PipelineId>, /// The event loop handling this pipeline. pub event_loop: Rc<EventLoop>, @@ -110,7 +107,7 @@ pub struct InitialPipelineState { /// The ID of the parent pipeline and frame type, if any. /// If `None`, this is the root. - pub parent_info: Option<(PipelineId, FrameType)>, + pub parent_info: Option<PipelineId>, /// A channel to the associated constellation. pub script_to_constellation_chan: ScriptToConstellationChan, @@ -309,7 +306,7 @@ impl Pipeline { pub fn new(id: PipelineId, browsing_context_id: BrowsingContextId, top_level_browsing_context_id: TopLevelBrowsingContextId, - parent_info: Option<(PipelineId, FrameType)>, + parent_info: Option<PipelineId>, event_loop: Rc<EventLoop>, layout_chan: IpcSender<LayoutControlMsg>, compositor_proxy: CompositorProxy, @@ -405,22 +402,6 @@ impl Pipeline { }; } - /// Send a mozbrowser event to the script thread for this pipeline. - /// This will cause an event to be fired on an iframe in the document, - /// or on the `Window` if no frame is given. - pub fn trigger_mozbrowser_event(&self, - child_id: Option<TopLevelBrowsingContextId>, - event: MozBrowserEvent) { - assert!(PREFS.is_mozbrowser_enabled()); - - let event = ConstellationControlMsg::MozBrowserEvent(self.id, - child_id, - event); - if let Err(e) = self.event_loop.send(event) { - warn!("Sending mozbrowser event to script failed ({}).", e); - } - } - /// Notify the script thread that this pipeline is visible. fn notify_visibility(&self) { let script_msg = ConstellationControlMsg::ChangeFrameVisibilityStatus(self.id, self.visible); @@ -451,7 +432,7 @@ pub struct UnprivilegedPipelineContent { id: PipelineId, top_level_browsing_context_id: TopLevelBrowsingContextId, browsing_context_id: BrowsingContextId, - parent_info: Option<(PipelineId, FrameType)>, + parent_info: Option<PipelineId>, script_to_constellation_chan: ScriptToConstellationChan, layout_to_constellation_chan: IpcSender<LayoutMsg>, scheduler_chan: IpcSender<TimerSchedulerMsg>, diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index 6f9e89036a2..398b5ace73e 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -365,10 +365,3 @@ pub const TEST_BROWSING_CONTEXT_INDEX: BrowsingContextIndex = #[cfg(feature = "unstable")] pub const TEST_BROWSING_CONTEXT_ID: BrowsingContextId = BrowsingContextId { namespace_id: TEST_NAMESPACE, index: TEST_BROWSING_CONTEXT_INDEX }; - -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)] -pub enum FrameType { - IFrame, - MozBrowserIFrame, -} - diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 4aae00f551b..cd33e982e7c 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -67,7 +67,6 @@ msg = {path = "../msg"} net_traits = {path = "../net_traits"} num-traits = "0.1.32" offscreen_gl_context = { version = "0.14", features = ["serde"] } -open = "1.1.1" parking_lot = "0.4" phf = "0.7.18" profile_traits = {path = "../profile_traits"} diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index f4930406507..5153b70e72f 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -63,7 +63,7 @@ use js::jsapi::{GCTraceKindToAscii, Heap, JSObject, JSTracer, TraceKind}; use js::jsval::JSVal; use js::rust::Runtime; use metrics::{InteractiveMetrics, InteractiveWindow}; -use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId, TopLevelBrowsingContextId}; +use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use net_traits::{Metadata, NetworkError, ReferrerPolicy, ResourceThreads}; use net_traits::filemanager_thread::RelativePos; use net_traits::image::base::{Image, ImageMetadata}; @@ -79,7 +79,7 @@ use profile_traits::time::ProfilerChan as TimeProfilerChan; use script_layout_interface::OpaqueStyleAndLayoutData; use script_layout_interface::reporter::CSSErrorReporter; use script_layout_interface::rpc::LayoutRPC; -use script_traits::{DocumentActivity, ScriptToConstellationChan, TimerEventId, TimerSource, TouchpadPressurePhase}; +use script_traits::{DocumentActivity, ScriptToConstellationChan, TimerEventId, TimerSource}; use script_traits::{UntrustedNodeAddress, WindowSizeData, WindowSizeType}; use script_traits::DrawAPaintImageResult; use selectors::matching::ElementSelectorFlags; @@ -351,7 +351,7 @@ unsafe_no_jsmanaged_fields!(PropertyDeclarationBlock); // These three are interdependent, if you plan to put jsmanaged data // in one of these make sure it is propagated properly to containing structs unsafe_no_jsmanaged_fields!(DocumentActivity, WindowSizeData, WindowSizeType); -unsafe_no_jsmanaged_fields!(BrowsingContextId, FrameType, PipelineId, TopLevelBrowsingContextId); +unsafe_no_jsmanaged_fields!(BrowsingContextId, PipelineId, TopLevelBrowsingContextId); unsafe_no_jsmanaged_fields!(TimerEventId, TimerSource); unsafe_no_jsmanaged_fields!(TimelineMarkerType); unsafe_no_jsmanaged_fields!(WorkerId); @@ -385,7 +385,6 @@ unsafe_no_jsmanaged_fields!(Request); unsafe_no_jsmanaged_fields!(RequestInit); unsafe_no_jsmanaged_fields!(SharedRt); unsafe_no_jsmanaged_fields!(StyleSharedRwLock); -unsafe_no_jsmanaged_fields!(TouchpadPressurePhase); unsafe_no_jsmanaged_fields!(USVString); unsafe_no_jsmanaged_fields!(ReferrerPolicy); unsafe_no_jsmanaged_fields!(Response); diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index a24382ab80a..47ba21c8e4d 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -42,7 +42,6 @@ use dom::errorevent::ErrorEvent; use dom::event::{Event, EventBubbles, EventCancelable, EventDefault, EventStatus}; use dom::eventtarget::EventTarget; use dom::focusevent::FocusEvent; -use dom::forcetouchevent::ForceTouchEvent; use dom::globalscope::GlobalScope; use dom::hashchangeevent::HashChangeEvent; use dom::htmlanchorelement::HTMLAnchorElement; @@ -99,7 +98,7 @@ use js::jsapi::{JSContext, JSObject, JSRuntime}; use js::jsapi::JS_GetRuntime; use metrics::{InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory, ProgressiveWebMetric}; use mime::{Mime, TopLevel, SubLevel}; -use msg::constellation_msg::{BrowsingContextId, Key, KeyModifiers, KeyState, TopLevelBrowsingContextId}; +use msg::constellation_msg::{BrowsingContextId, Key, KeyModifiers, KeyState}; use net_traits::{FetchResponseMsg, IpcSend, ReferrerPolicy}; use net_traits::CookieSource::NonHTTP; use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl}; @@ -112,8 +111,7 @@ use script_layout_interface::message::{Msg, NodesFromPointQueryType, ReflowGoal} use script_runtime::{CommonScriptMsg, ScriptThreadEventCategory}; use script_thread::{MainThreadScriptMsg, ScriptThread}; use script_traits::{AnimationState, DocumentActivity, MouseButton, MouseEventType}; -use script_traits::{MozBrowserEvent, MsDuration, ScriptMsg, TouchEventType, TouchId}; -use script_traits::{TouchpadPressurePhase, UntrustedNodeAddress}; +use script_traits::{MsDuration, ScriptMsg, TouchEventType, TouchId, UntrustedNodeAddress}; use servo_arc::Arc; use servo_atoms::Atom; use servo_config::prefs::PREFS; @@ -328,7 +326,6 @@ pub struct Document { load_event_end: Cell<u64>, /// <https://html.spec.whatwg.org/multipage/#concept-document-https-state> https_state: Cell<HttpsState>, - touchpad_pressure_phase: Cell<TouchpadPressurePhase>, /// The document's origin. origin: MutableOrigin, /// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states @@ -454,7 +451,6 @@ impl Document { pub fn set_https_state(&self, https_state: HttpsState) { self.https_state.set(https_state); - self.trigger_mozbrowser_event(MozBrowserEvent::SecurityChange(https_state)); } pub fn is_fully_active(&self) -> bool { @@ -757,13 +753,9 @@ impl Document { pub fn set_ready_state(&self, state: DocumentReadyState) { match state { DocumentReadyState::Loading => { - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserconnected - self.trigger_mozbrowser_event(MozBrowserEvent::Connected); update_with_current_time_ms(&self.dom_loading); }, DocumentReadyState::Complete => { - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadend - self.trigger_mozbrowser_event(MozBrowserEvent::LoadEnd); update_with_current_time_ms(&self.dom_complete); }, DocumentReadyState::Interactive => update_with_current_time_ms(&self.dom_interactive), @@ -829,9 +821,6 @@ impl Document { /// Handles any updates when the document's title has changed. pub fn title_changed(&self) { if self.browsing_context().is_some() { - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsertitlechange - self.trigger_mozbrowser_event(MozBrowserEvent::TitleChange(String::from(self.Title()))); - self.send_title_to_constellation(); } } @@ -998,65 +987,6 @@ impl Document { *self.last_click_info.borrow_mut() = Some((now, click_pos)); } - #[allow(unsafe_code)] - pub fn handle_touchpad_pressure_event( - &self, - js_runtime: *mut JSRuntime, - pressure: f32, - phase_now: TouchpadPressurePhase, - node_address: Option<UntrustedNodeAddress> - ) { - let el = node_address.and_then(|address| { - let node = unsafe { node::from_untrusted_node_address(js_runtime, address) }; - node.inclusive_ancestors() - .filter_map(DomRoot::downcast::<Element>) - .next() - }); - let el = match el { - Some(el) => el, - None => return, - }; - - let phase_before = self.touchpad_pressure_phase.get(); - self.touchpad_pressure_phase.set(phase_now); - - if phase_before == TouchpadPressurePhase::BeforeClick && - phase_now == TouchpadPressurePhase::BeforeClick { - return; - } - - let node = el.upcast::<Node>(); - let target = node.upcast(); - - let force = match phase_now { - TouchpadPressurePhase::BeforeClick => pressure, - TouchpadPressurePhase::AfterFirstClick => 1. + pressure, - TouchpadPressurePhase::AfterSecondClick => 2. + pressure, - }; - - if phase_now != TouchpadPressurePhase::BeforeClick { - self.fire_forcetouch_event("servomouseforcechanged".to_owned(), target, force); - } - - if phase_before != TouchpadPressurePhase::AfterSecondClick && - phase_now == TouchpadPressurePhase::AfterSecondClick { - self.fire_forcetouch_event("servomouseforcedown".to_owned(), target, force); - } - - if phase_before == TouchpadPressurePhase::AfterSecondClick && - phase_now != TouchpadPressurePhase::AfterSecondClick { - self.fire_forcetouch_event("servomouseforceup".to_owned(), target, force); - } - } - - fn fire_forcetouch_event(&self, event_name: String, target: &EventTarget, force: f32) { - let force_event = ForceTouchEvent::new(&self.window, - DOMString::from(event_name), - force); - let event = force_event.upcast::<Event>(); - event.fire(target); - } - pub fn fire_mouse_event(&self, client_point: Point2D<f32>, target: &EventTarget, event_name: FireMouseEventType) { let client_x = client_point.x.to_i32().unwrap_or(0); let client_y = client_point.y.to_i32().unwrap_or(0); @@ -1472,15 +1402,6 @@ impl Document { } } - pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) { - if PREFS.is_mozbrowser_enabled() { - if let Some((parent_pipeline_id, _)) = self.window.parent_info() { - let event = ScriptMsg::MozBrowserEvent(parent_pipeline_id, event); - self.send_to_constellation(event); - } - } - } - /// <https://html.spec.whatwg.org/multipage/#dom-window-requestanimationframe> pub fn request_animation_frame(&self, callback: AnimationFrameCallback) -> u32 { let ident = self.animation_frame_ident.get() + 1; @@ -1919,20 +1840,6 @@ impl Document { .find(|node| node.browsing_context_id() == Some(browsing_context_id)) } - /// Find a mozbrowser iframe element in the document. - pub fn find_mozbrowser_iframe(&self, - top_level_browsing_context_id: TopLevelBrowsingContextId) - -> Option<DomRoot<HTMLIFrameElement>> - { - match self.find_iframe(BrowsingContextId::from(top_level_browsing_context_id)) { - None => None, - Some(iframe) => { - assert!(iframe.Mozbrowser()); - Some(iframe) - }, - } - } - pub fn get_dom_loading(&self) -> u64 { self.dom_loading.get() } @@ -2297,7 +2204,6 @@ impl Document { load_event_start: Cell::new(Default::default()), load_event_end: Cell::new(Default::default()), https_state: Cell::new(HttpsState::None), - touchpad_pressure_phase: Cell::new(TouchpadPressurePhase::BeforeClick), origin: origin, referrer: referrer, referrer_policy: Cell::new(referrer_policy), diff --git a/components/script/dom/forcetouchevent.rs b/components/script/dom/forcetouchevent.rs deleted file mode 100644 index 66d5a7de94b..00000000000 --- a/components/script/dom/forcetouchevent.rs +++ /dev/null @@ -1,58 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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 dom::bindings::codegen::Bindings::ForceTouchEventBinding; -use dom::bindings::codegen::Bindings::ForceTouchEventBinding::ForceTouchEventMethods; -use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; -use dom::bindings::inheritance::Castable; -use dom::bindings::num::Finite; -use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::DomRoot; -use dom::bindings::str::DOMString; -use dom::uievent::UIEvent; -use dom::window::Window; -use dom_struct::dom_struct; - -#[dom_struct] -pub struct ForceTouchEvent { - uievent: UIEvent, - force: f32, -} - -impl ForceTouchEvent { - fn new_inherited(force: f32) -> ForceTouchEvent { - ForceTouchEvent { - uievent: UIEvent::new_inherited(), - force: force, - } - } - - pub fn new(window: &Window, - type_: DOMString, - force: f32) -> DomRoot<ForceTouchEvent> { - let event = Box::new(ForceTouchEvent::new_inherited(force)); - let ev = reflect_dom_object(event, window, ForceTouchEventBinding::Wrap); - ev.upcast::<UIEvent>().InitUIEvent(type_, true, true, Some(window), 0); - ev - } -} - -impl<'a> ForceTouchEventMethods for &'a ForceTouchEvent { - fn ServoForce(&self) -> Finite<f32> { - Finite::wrap(self.force) - } - - fn SERVO_FORCE_AT_MOUSE_DOWN(&self) -> Finite<f32> { - Finite::wrap(1.0) - } - - fn SERVO_FORCE_AT_FORCE_MOUSE_DOWN(&self) -> Finite<f32> { - Finite::wrap(2.0) - } - - // https://dom.spec.whatwg.org/#dom-event-istrusted - fn IsTrusted(&self) -> bool { - self.uievent.IsTrusted() - } -} diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index 37949572ccc..e48385ed692 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -28,8 +28,6 @@ use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use net_traits::ReferrerPolicy; use num_traits::ToPrimitive; -use script_traits::MozBrowserEvent; -use servo_config::prefs::PREFS; use servo_url::ServoUrl; use std::default::Default; use style::attr::AttrValue; @@ -608,13 +606,8 @@ pub fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>, ref // Step 8: navigate to the URL. if let Some(target) = target { - if PREFS.is_mozbrowser_enabled() && !is_current_browsing_context(target.Value()) { - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowseropenwindow - // TODO: referrer and opener - // TODO: should we send the normalized url or the non-normalized href? - let event = MozBrowserEvent::OpenWindow(url.into_string(), Some(String::from(target.Value())), None); - document.trigger_mozbrowser_event(event); - return + if !is_current_browsing_context(target.Value()) { + // https://github.com/servo/servo/issues/13241 } } diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index c1ec4a7435b..b03cfdce07e 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -5,51 +5,34 @@ use document_loader::{LoadBlocker, LoadType}; use dom::attr::Attr; use dom::bindings::cell::DomRefCell; -use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementErrorEventDetail; -use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementIconChangeEventDetail; -use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementLocationChangeEventDetail; -use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementOpenTabEventDetail; -use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementOpenWindowEventDetail; -use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementSecurityChangeDetail; -use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementVisibilityChangeEventDetail; -use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserShowModalPromptEventDetail; use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding; use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; -use dom::bindings::conversions::ToJSValConvertible; -use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; use dom::bindings::root::{LayoutDom, DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; -use dom::customevent::CustomEvent; use dom::document::Document; use dom::domtokenlist::DOMTokenList; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; -use dom::event::Event; use dom::eventtarget::EventTarget; use dom::globalscope::GlobalScope; use dom::htmlelement::HTMLElement; use dom::node::{Node, NodeDamage, UnbindContext, document_from_node, window_from_node}; use dom::virtualmethods::VirtualMethods; -use dom::window::{ReflowReason, Window}; +use dom::window::ReflowReason; use dom::windowproxy::WindowProxy; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use ipc_channel::ipc; -use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue}; -use js::jsval::{NullValue, UndefinedValue}; -use msg::constellation_msg::{FrameType, BrowsingContextId, PipelineId, TopLevelBrowsingContextId, TraversalDirection}; -use net_traits::response::HttpsState; +use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; use script_layout_interface::message::ReflowGoal; use script_thread::ScriptThread; use script_traits::{IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData, UpdatePipelineIdReason}; -use script_traits::{MozBrowserEvent, NewLayoutInfo, ScriptMsg}; +use script_traits::{NewLayoutInfo, ScriptMsg}; use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed}; -use servo_atoms::Atom; use servo_config::prefs::PREFS; -use servo_config::servo_version; use servo_url::ServoUrl; use std::cell::Cell; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; @@ -165,8 +148,6 @@ impl HTMLIFrameElement { let old_pipeline_id = self.pipeline_id(); let new_pipeline_id = PipelineId::new(); self.pending_pipeline_id.set(Some(new_pipeline_id)); - let private_iframe = self.privatebrowsing(); - let frame_type = if self.Mozbrowser() { FrameType::MozBrowserIFrame } else { FrameType::IFrame }; let global_scope = window.upcast::<GlobalScope>(); let load_info = IFrameLoadInfo { @@ -174,8 +155,7 @@ impl HTMLIFrameElement { browsing_context_id: browsing_context_id, top_level_browsing_context_id: top_level_browsing_context_id, new_pipeline_id: new_pipeline_id, - is_private: private_iframe, - frame_type: frame_type, + is_private: false, // FIXME replace: replace, }; @@ -189,7 +169,7 @@ impl HTMLIFrameElement { .unwrap(); let new_layout_info = NewLayoutInfo { - parent_info: Some((global_scope.pipeline_id(), frame_type)), + parent_info: Some(global_scope.pipeline_id()), new_pipeline_id: new_pipeline_id, browsing_context_id: browsing_context_id, top_level_browsing_context_id: top_level_browsing_context_id, @@ -216,11 +196,6 @@ impl HTMLIFrameElement { .unwrap(); } } - - if PREFS.is_mozbrowser_enabled() { - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart - self.dispatch_mozbrowser_event(MozBrowserEvent::LoadStart); - } } /// <https://html.spec.whatwg.org/multipage/#process-the-iframe-attributes> @@ -258,17 +233,6 @@ impl HTMLIFrameElement { self.navigate_or_reload_child_browsing_context(Some(load_data), NavigationType::Regular, false); } - #[allow(unsafe_code)] - pub fn dispatch_mozbrowser_event(&self, event: MozBrowserEvent) { - assert!(PREFS.is_mozbrowser_enabled()); - - if self.Mozbrowser() { - let window = window_from_node(self); - let custom_event = build_mozbrowser_custom_event(&window, event); - custom_event.upcast::<Event>().fire(self.upcast()); - } - } - fn create_nested_browsing_context(&self) { // Synchronously create a new context and navigate it to about:blank. let url = ServoUrl::parse("about:blank").unwrap(); @@ -276,12 +240,8 @@ impl HTMLIFrameElement { let window = window_from_node(self); let pipeline_id = Some(window.upcast::<GlobalScope>().pipeline_id()); let load_data = LoadData::new(url, pipeline_id, document.get_referrer_policy(), Some(document.url().clone())); - let (browsing_context_id, top_level_browsing_context_id) = if self.Mozbrowser() { - let top_level_browsing_context_id = TopLevelBrowsingContextId::new(); - (BrowsingContextId::from(top_level_browsing_context_id), top_level_browsing_context_id) - } else { - (BrowsingContextId::new(), window.window_proxy().top_level_browsing_context_id()) - }; + let browsing_context_id = BrowsingContextId::new(); + let top_level_browsing_context_id = window.window_proxy().top_level_browsing_context_id(); self.pipeline_id.set(None); self.pending_pipeline_id.set(None); self.top_level_browsing_context_id.set(Some(top_level_browsing_context_id)); @@ -358,11 +318,6 @@ impl HTMLIFrameElement { pub fn change_visibility_status(&self, visibility: bool) { if self.visibility.get() != visibility { self.visibility.set(visibility); - - // Visibility changes are only exposed to Mozbrowser iframes - if self.Mozbrowser() { - self.dispatch_mozbrowser_event(MozBrowserEvent::VisibilityChange(visibility)); - } } } @@ -395,16 +350,6 @@ impl HTMLIFrameElement { let window = window_from_node(self); window.reflow(ReflowGoal::Full, ReflowReason::IFrameLoadEvent); } - - /// Check whether the iframe has the mozprivatebrowsing attribute set - pub fn privatebrowsing(&self) -> bool { - if self.Mozbrowser() { - let element = self.upcast::<Element>(); - element.has_attribute(&LocalName::from("mozprivatebrowsing")) - } else { - false - } - } } pub trait HTMLIFrameElementLayoutMethods { @@ -455,117 +400,6 @@ impl HTMLIFrameElementLayoutMethods for LayoutDom<HTMLIFrameElement> { } } -#[allow(unsafe_code)] -pub fn build_mozbrowser_custom_event(window: &Window, event: MozBrowserEvent) -> DomRoot<CustomEvent> { - // TODO(gw): Support mozbrowser event types that have detail which is not a string. - // See https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API - // for a list of mozbrowser events. - let cx = window.get_cx(); - let _ac = JSAutoCompartment::new(cx, window.reflector().get_jsobject().get()); - rooted!(in(cx) let mut detail = UndefinedValue()); - let event_name = Atom::from(event.name()); - unsafe { build_mozbrowser_event_detail(event, cx, detail.handle_mut()); } - CustomEvent::new(window.upcast(), - event_name, - true, - true, - detail.handle()) -} - -#[allow(unsafe_code)] -unsafe fn build_mozbrowser_event_detail(event: MozBrowserEvent, - cx: *mut JSContext, - rval: MutableHandleValue) { - match event { - MozBrowserEvent::AsyncScroll | MozBrowserEvent::Close | MozBrowserEvent::ContextMenu | - MozBrowserEvent::LoadEnd | MozBrowserEvent::LoadStart | - MozBrowserEvent::Connected | MozBrowserEvent::OpenSearch | - MozBrowserEvent::UsernameAndPasswordRequired => { - rval.set(NullValue()); - } - MozBrowserEvent::Error(error_type, description, report) => { - BrowserElementErrorEventDetail { - type_: Some(DOMString::from(error_type.name())), - description: Some(DOMString::from(description)), - report: Some(DOMString::from(report)), - version: Some(DOMString::from_string(servo_version())), - }.to_jsval(cx, rval); - }, - MozBrowserEvent::SecurityChange(https_state) => { - BrowserElementSecurityChangeDetail { - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsersecuritychange - state: Some(DOMString::from(match https_state { - HttpsState::Modern => "secure", - HttpsState::Deprecated => "broken", - HttpsState::None => "insecure", - }.to_owned())), - // FIXME - Not supported yet: - trackingContent: None, - mixedContent: None, - trackingState: None, - extendedValidation: None, - mixedState: None, - }.to_jsval(cx, rval); - } - MozBrowserEvent::TitleChange(ref string) => { - string.to_jsval(cx, rval); - } - MozBrowserEvent::LocationChange(url, can_go_back, can_go_forward) => { - BrowserElementLocationChangeEventDetail { - url: Some(DOMString::from(url)), - canGoBack: Some(can_go_back), - canGoForward: Some(can_go_forward), - }.to_jsval(cx, rval); - } - MozBrowserEvent::OpenTab(url) => { - BrowserElementOpenTabEventDetail { - url: Some(DOMString::from(url)), - }.to_jsval(cx, rval); - } - MozBrowserEvent::OpenWindow(url, target, features) => { - BrowserElementOpenWindowEventDetail { - url: Some(DOMString::from(url)), - target: target.map(DOMString::from), - features: features.map(DOMString::from), - }.to_jsval(cx, rval); - } - MozBrowserEvent::IconChange(rel, href, sizes) => { - BrowserElementIconChangeEventDetail { - rel: Some(DOMString::from(rel)), - href: Some(DOMString::from(href)), - sizes: Some(DOMString::from(sizes)), - }.to_jsval(cx, rval); - } - MozBrowserEvent::ShowModalPrompt(prompt_type, title, message, return_value) => { - BrowserShowModalPromptEventDetail { - promptType: Some(DOMString::from(prompt_type)), - title: Some(DOMString::from(title)), - message: Some(DOMString::from(message)), - returnValue: Some(DOMString::from(return_value)), - }.to_jsval(cx, rval) - } - MozBrowserEvent::VisibilityChange(visibility) => { - BrowserElementVisibilityChangeEventDetail { - visible: Some(visibility), - }.to_jsval(cx, rval); - } - } -} - -pub fn Navigate(iframe: &HTMLIFrameElement, direction: TraversalDirection) -> ErrorResult { - if iframe.Mozbrowser() { - if let Some(_) = iframe.top_level_browsing_context_id() { - let window = window_from_node(iframe); - let msg = ScriptMsg::TraverseHistory(direction); - window.upcast::<GlobalScope>().script_to_constellation_chan().send(msg).unwrap(); - return Ok(()); - } - } - debug!(concat!("this frame is not mozbrowser: mozbrowser attribute missing, or not a top", - "level window, or mozbrowser preference not set (use --pref dom.mozbrowser.enabled)")); - Err(Error::NotSupported) -} - impl HTMLIFrameElementMethods for HTMLIFrameElement { // https://html.spec.whatwg.org/multipage/#dom-iframe-src make_url_getter!(Src, "src"); @@ -604,83 +438,11 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { Some(document) } - // Experimental mozbrowser implementation is based on the webidl - // present in the gecko source tree, and the documentation here: - // https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API - // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser - fn Mozbrowser(&self) -> bool { - if window_from_node(self).is_mozbrowser() { - let element = self.upcast::<Element>(); - element.has_attribute(&local_name!("mozbrowser")) - } else { - false - } - } - - // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser - fn SetMozbrowser(&self, value: bool) { - let element = self.upcast::<Element>(); - element.set_bool_attribute(&local_name!("mozbrowser"), value); - } - // https://html.spec.whatwg.org/multipage/#attr-iframe-allowfullscreen make_bool_getter!(AllowFullscreen, "allowfullscreen"); // https://html.spec.whatwg.org/multipage/#attr-iframe-allowfullscreen make_bool_setter!(SetAllowFullscreen, "allowfullscreen"); - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/goBack - fn GoBack(&self) -> ErrorResult { - Navigate(self, TraversalDirection::Back(1)) - } - - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/goForward - fn GoForward(&self) -> ErrorResult { - Navigate(self, TraversalDirection::Forward(1)) - } - - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/reload - fn Reload(&self, _hard_reload: bool) -> ErrorResult { - if self.Mozbrowser() { - if self.upcast::<Node>().is_in_doc_with_browsing_context() { - self.navigate_or_reload_child_browsing_context(None, NavigationType::Regular, true); - } - Ok(()) - } else { - debug!(concat!("this frame is not mozbrowser: mozbrowser attribute missing, or not a top", - "level window, or mozbrowser preference not set (use --pref dom.mozbrowser.enabled)")); - Err(Error::NotSupported) - } - } - - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/setVisible - fn SetVisible(&self, visible: bool) -> ErrorResult { - if self.Mozbrowser() { - self.set_visible(visible); - Ok(()) - } else { - debug!(concat!("this frame is not mozbrowser: mozbrowser attribute missing, or not a top", - "level window, or mozbrowser preference not set (use --pref dom.mozbrowser.enabled)")); - Err(Error::NotSupported) - } - } - - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/getVisible - fn GetVisible(&self) -> Fallible<bool> { - if self.Mozbrowser() { - Ok(self.visibility.get()) - } else { - debug!(concat!("this frame is not mozbrowser: mozbrowser attribute missing, or not a top", - "level window, or mozbrowser preference not set (use --pref dom.mozbrowser.enabled)")); - Err(Error::NotSupported) - } - } - - - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/stop - fn Stop(&self) -> ErrorResult { - Err(Error::NotSupported) - } - // https://html.spec.whatwg.org/multipage/#dom-dim-width make_getter!(Width, "width"); // https://html.spec.whatwg.org/multipage/#dom-dim-width @@ -695,21 +457,6 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { make_getter!(FrameBorder, "frameborder"); // https://html.spec.whatwg.org/multipage/#other-elements,-attributes-and-apis:attr-iframe-frameborder make_setter!(SetFrameBorder, "frameborder"); - - // check-tidy: no specs after this line - fn SetMozprivatebrowsing(&self, value: bool) { - let element = self.upcast::<Element>(); - element.set_bool_attribute(&LocalName::from("mozprivatebrowsing"), value); - } - - fn Mozprivatebrowsing(&self) -> bool { - if window_from_node(self).is_mozbrowser() { - let element = self.upcast::<Element>(); - element.has_attribute(&LocalName::from("mozprivatebrowsing")) - } else { - false - } - } } impl VirtualMethods for HTMLIFrameElement { diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 597a6e2e96f..be4c974bf67 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -24,7 +24,7 @@ use dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; use net_traits::ReferrerPolicy; -use script_traits::{MozBrowserEvent, ScriptMsg}; +use script_traits::ScriptMsg; use servo_arc::Arc; use std::borrow::ToOwned; use std::cell::Cell; @@ -309,18 +309,12 @@ impl HTMLLinkElement { }, link_url, cors_setting, integrity_metadata.to_owned()); } - fn handle_favicon_url(&self, rel: &str, href: &str, sizes: &Option<String>) { + fn handle_favicon_url(&self, _rel: &str, href: &str, _sizes: &Option<String>) { let document = document_from_node(self); match document.base_url().join(href) { Ok(url) => { let event = ScriptMsg::NewFavicon(url.clone()); document.window().upcast::<GlobalScope>().script_to_constellation_chan().send(event).unwrap(); - - let mozbrowser_event = match *sizes { - Some(ref sizes) => MozBrowserEvent::IconChange(rel.to_owned(), url.to_string(), sizes.to_owned()), - None => MozBrowserEvent::IconChange(rel.to_owned(), url.to_string(), "".to_owned()) - }; - document.trigger_mozbrowser_event(mozbrowser_event); } Err(e) => debug!("Parsing url {} failed: {}", href, e) } diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 78f78cbed75..73293342ac8 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -289,7 +289,6 @@ pub mod filelist; pub mod filereader; pub mod filereadersync; pub mod focusevent; -pub mod forcetouchevent; pub mod formdata; pub mod gamepad; pub mod gamepadbutton; diff --git a/components/script/dom/webidls/BrowserElement.webidl b/components/script/dom/webidls/BrowserElement.webidl deleted file mode 100644 index 4c6273a1cef..00000000000 --- a/components/script/dom/webidls/BrowserElement.webidl +++ /dev/null @@ -1,227 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -// https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API - -callback BrowserElementNextPaintEventCallback = void (); - -//enum BrowserFindCaseSensitivity { "case-sensitive", "case-insensitive" }; -//enum BrowserFindDirection { "forward", "backward" }; - -//dictionary BrowserElementDownloadOptions { -// DOMString? filename; -// DOMString? referrer; -//}; - -//dictionary BrowserElementExecuteScriptOptions { -// DOMString? url; -// DOMString? origin; -//}; - -[NoInterfaceObject, Exposed=(Window,Worker)] -interface BrowserElement { -}; - -dictionary BrowserElementSecurityChangeDetail { - - // state: - // "insecure" indicates that the data corresponding to - // the request was received over an insecure channel. - // - // "broken" indicates an unknown security state. This - // may mean that the request is being loaded as part - // of a page in which some content was received over - // an insecure channel. - // - // "secure" indicates that the data corresponding to the - // request was received over a secure channel. - DOMString state; - - // trackingState: - // "loaded_tracking_content": tracking content has been loaded. - // "blocked_tracking_content": tracking content has been blocked from loading. - DOMString trackingState; - - // mixedState: - // "blocked_mixed_active_content": Mixed active content has been blocked from loading. - // "loaded_mixed_active_content": Mixed active content has been loaded. - DOMString mixedState; - - boolean extendedValidation; - boolean trackingContent; - boolean mixedContent; -}; - -dictionary BrowserElementErrorEventDetail { - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsererror - // just requires a "type" field, but we also provide - // an optional human-readable description, and - // an optional machine-readable report (e.g. a backtrace for panics) - DOMString type; - DOMString description; - DOMString report; - DOMString version; -}; - -dictionary BrowserElementLocationChangeEventDetail { - DOMString url; - boolean canGoBack; - boolean canGoForward; -}; - -dictionary BrowserElementIconChangeEventDetail { - DOMString rel; - DOMString href; - DOMString sizes; -}; - -dictionary BrowserShowModalPromptEventDetail { - DOMString promptType; - DOMString title; - DOMString message; - DOMString returnValue; - // TODO(simartin) unblock() callback -}; - -dictionary BrowserElementOpenTabEventDetail { - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowseropentab - DOMString url; -}; - -dictionary BrowserElementOpenWindowEventDetail { - // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowseropenwindow - DOMString url; - DOMString target; - DOMString features; - // Element frameElement; -}; - -dictionary BrowserElementVisibilityChangeEventDetail { - boolean visible; -}; - -BrowserElement implements BrowserElementCommon; -BrowserElement implements BrowserElementPrivileged; - -[NoInterfaceObject, Exposed=(Window,Worker)] -interface BrowserElementCommon { - [Throws, - Pref="dom.mozbrowser.enabled"] - void setVisible(boolean visible); - - [Throws, - Pref="dom.mozbrowser.enabled"] - boolean getVisible(); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //void setActive(boolean active); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //boolean getActive(); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //void addNextPaintListener(BrowserElementNextPaintEventCallback listener); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //void removeNextPaintListener(BrowserElementNextPaintEventCallback listener); -}; - -[NoInterfaceObject, Exposed=(Window,Worker)] -interface BrowserElementPrivileged { - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //void sendMouseEvent(DOMString type, - // unsigned long x, - // unsigned long y, - // unsigned long button, - // unsigned long clickCount, - // unsigned long modifiers); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled", - // Func="TouchEvent::PrefEnabled"] - //void sendTouchEvent(DOMString type, - // sequence<unsigned long> identifiers, - // sequence<long> x, - // sequence<long> y, - // sequence<unsigned long> rx, - // sequence<unsigned long> ry, - // sequence<float> rotationAngles, - // sequence<float> forces, - // unsigned long count, - // unsigned long modifiers); - - [Func="::dom::window::Window::global_is_mozbrowser", Throws] - void goBack(); - - [Func="::dom::window::Window::global_is_mozbrowser", Throws] - void goForward(); - - [Func="::dom::window::Window::global_is_mozbrowser", Throws] - void reload(optional boolean hardReload = false); - - [Func="::dom::window::Window::global_is_mozbrowser", Throws] - void stop(); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //DOMRequest download(DOMString url, - // optional BrowserElementDownloadOptions options); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //DOMRequest purgeHistory(); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //DOMRequest getScreenshot([EnforceRange] unsigned long width, - // [EnforceRange] unsigned long height, - // optional DOMString mimeType=""); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //void zoom(float zoom); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //DOMRequest getCanGoBack(); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //DOMRequest getCanGoForward(); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //DOMRequest getContentDimensions(); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //DOMRequest setInputMethodActive(boolean isActive); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //void setNFCFocus(boolean isFocus); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //void findAll(DOMString searchString, BrowserFindCaseSensitivity caseSensitivity); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //void findNext(BrowserFindDirection direction); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //void clearMatch(); - - //[Throws, - // Pref="dom.mozBrowserFramesEnabled"] - //DOMRequest executeScript(DOMString script, - // optional BrowserElementExecuteScriptOptions options); - -}; diff --git a/components/script/dom/webidls/ForceTouchEvent.webidl b/components/script/dom/webidls/ForceTouchEvent.webidl deleted file mode 100644 index 4c184214cae..00000000000 --- a/components/script/dom/webidls/ForceTouchEvent.webidl +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -// https://developer.apple.com/library/mac/documentation/AppleApplications/Conceptual/SafariJSProgTopics/RespondingtoForceTouchEventsfromJavaScript.html - -/** - * Events: (copy/paste from apple.com) - * - * webkitmouseforcewillbegin: This event occurs immediately before the mousedown event. It allows you to - * prevent the default system behavior, such as displaying a dictionary window when force clicking on a - * word, in order to perform a custom action instead. To prevent the default system behavior, call the - * preventDefault() method on the event. - * webkitmouseforcedown: This event occurs after the mousedown event, once enough force has been applied - * to register as a force click. The user receives haptic feedback representing the force click when this - * event occurs. - * webkitmouseforceup: This event occurs after a webkitmouseforcedown event, once enough force has been - * released to exit the force click operation. The user receives haptic feedback representing the exit - * from force click when this event occurs. - * webkitmouseforcechanged: This event occurs whenever a change in trackpad force is detected between the - * mousedown and mouseup events. - * - */ - - -[Pref="dom.forcetouch.enabled"] -interface ForceTouchEvent : UIEvent { - // Represents the amount of force required to perform a regular click. - readonly attribute float SERVO_FORCE_AT_MOUSE_DOWN; - // Represents the force required to perform a force click. - readonly attribute float SERVO_FORCE_AT_FORCE_MOUSE_DOWN; - // force level - readonly attribute float servoForce; -}; diff --git a/components/script/dom/webidls/HTMLIFrameElement.webidl b/components/script/dom/webidls/HTMLIFrameElement.webidl index bcccb34cb0a..fec8768e8e8 100644 --- a/components/script/dom/webidls/HTMLIFrameElement.webidl +++ b/components/script/dom/webidls/HTMLIFrameElement.webidl @@ -46,13 +46,3 @@ partial interface HTMLIFrameElement { // [CEReactions, TreatNullAs=EmptyString] // attribute DOMString marginWidth; }; - -partial interface HTMLIFrameElement { - [CEReactions, Func="::dom::window::Window::global_is_mozbrowser"] - attribute boolean mozbrowser; - - [CEReactions, Func="::dom::window::Window::global_is_mozbrowser"] - attribute boolean mozprivatebrowsing; -}; - -HTMLIFrameElement implements BrowserElement; diff --git a/components/script/dom/webidls/Window.webidl b/components/script/dom/webidls/Window.webidl index 0ec0489937b..d6da05480cf 100644 --- a/components/script/dom/webidls/Window.webidl +++ b/components/script/dom/webidls/Window.webidl @@ -164,8 +164,6 @@ partial interface Window { void debug(DOMString arg); void gc(); void trap(); - [Func="Window::global_is_mozbrowser", Throws] - void openURLInDefaultBrowser(DOMString href); }; // WebDriver extensions diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index c9765b18253..a564d00ee5f 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -32,10 +32,8 @@ use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSSt use dom::customelementregistry::CustomElementRegistry; use dom::document::{AnimationFrameCallback, Document}; use dom::element::Element; -use dom::event::Event; use dom::globalscope::GlobalScope; use dom::history::History; -use dom::htmliframeelement::build_mozbrowser_custom_event; use dom::location::Location; use dom::mediaquerylist::{MediaQueryList, WeakMediaQueryListVec}; use dom::messageevent::MessageEvent; @@ -54,18 +52,17 @@ use euclid::{Point2D, Vector2D, Rect, Size2D}; use fetch; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; -use js::jsapi::{HandleObject, HandleValue, JSAutoCompartment, JSContext}; +use js::jsapi::{HandleValue, JSAutoCompartment, JSContext}; use js::jsapi::{JS_GC, JS_GetRuntime}; use js::jsval::UndefinedValue; use layout_image::fetch_image_for_layout; use microtask::MicrotaskQueue; -use msg::constellation_msg::{FrameType, PipelineId}; +use msg::constellation_msg::PipelineId; use net_traits::{ResourceThreads, ReferrerPolicy}; use net_traits::image_cache::{ImageCache, ImageResponder, ImageResponse}; use net_traits::image_cache::{PendingImageId, PendingImageResponse}; use net_traits::storage_thread::StorageType; use num_traits::ToPrimitive; -use open; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; use script_layout_interface::{TrustedNodeAddress, PendingImageState}; @@ -76,14 +73,13 @@ use script_layout_interface::rpc::{NodeScrollIdResponse, ResolvedStyleResponse, use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory, Runtime}; use script_thread::{ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg}; use script_thread::{ScriptThread, SendableMainThreadScriptChan}; -use script_traits::{ConstellationControlMsg, DocumentState, LoadData, MozBrowserEvent}; +use script_traits::{ConstellationControlMsg, DocumentState, LoadData}; use script_traits::{ScriptToConstellationChan, ScriptMsg, ScrollState, TimerEvent, TimerEventId}; use script_traits::{TimerSchedulerMsg, UntrustedNodeAddress, WindowSizeData, WindowSizeType}; use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; use selectors::attr::CaseSensitivity; use servo_arc; use servo_config::opts; -use servo_config::prefs::PREFS; use servo_geometry::{f32_rect_to_au_rect, MaxRect}; use servo_url::{Host, MutableOrigin, ImmutableOrigin, ServoUrl}; use std::borrow::ToOwned; @@ -200,7 +196,7 @@ pub struct Window { resize_event: Cell<Option<(WindowSizeData, WindowSizeType)>>, /// Parent id associated with this page, if any. - parent_info: Option<(PipelineId, FrameType)>, + parent_info: Option<PipelineId>, /// Global static data related to the DOM. dom_static: GlobalStaticData, @@ -343,7 +339,7 @@ impl Window { &self.script_chan.0 } - pub fn parent_info(&self) -> Option<(PipelineId, FrameType)> { + pub fn parent_info(&self) -> Option<PipelineId> { self.parent_info } @@ -520,7 +516,7 @@ impl WindowMethods for Window { // https://html.spec.whatwg.org/multipage/#dom-alert fn Alert(&self, s: DOMString) { - // Right now, just print to the console + // Print to the console. // Ensure that stderr doesn't trample through the alert() we use to // communicate test results (see executorservo.py in wptrunner). { @@ -992,17 +988,6 @@ impl WindowMethods for Window { *self.status.borrow_mut() = status } - // check-tidy: no specs after this line - fn OpenURLInDefaultBrowser(&self, href: DOMString) -> ErrorResult { - let url = ServoUrl::parse(&href).map_err(|e| { - Error::Type(format!("Couldn't parse URL: {}", e)) - })?; - match open::that(url.as_str()) { - Ok(_) => Ok(()), - Err(e) => Err(Error::Type(format!("Couldn't open URL: {}", e))), - } - } - // https://drafts.csswg.org/cssom-view/#dom-window-matchmedia fn MatchMedia(&self, query: DOMString) -> DomRoot<MediaQueryList> { let mut input = ParserInput::new(&query); @@ -1682,31 +1667,7 @@ impl Window { // https://html.spec.whatwg.org/multipage/#top-level-browsing-context pub fn is_top_level(&self) -> bool { - match self.parent_info { - Some((_, FrameType::IFrame)) => false, - _ => true, - } - } - - /// Returns whether this window is mozbrowser. - pub fn is_mozbrowser(&self) -> bool { - PREFS.is_mozbrowser_enabled() && self.parent_info().is_none() - } - - /// Returns whether mozbrowser is enabled and `obj` has been created - /// in a top-level `Window` global. - #[allow(unsafe_code)] - pub unsafe fn global_is_mozbrowser(_: *mut JSContext, obj: HandleObject) -> bool { - GlobalScope::from_object(obj.get()) - .downcast::<Window>() - .map_or(false, |window| window.is_mozbrowser()) - } - - #[allow(unsafe_code)] - pub fn dispatch_mozbrowser_event(&self, event: MozBrowserEvent) { - assert!(PREFS.is_mozbrowser_enabled()); - let custom_event = build_mozbrowser_custom_event(&self, event); - custom_event.upcast::<Event>().fire(self.upcast()); + self.parent_info.is_none() } pub fn evaluate_media_queries_and_report_changes(&self) { @@ -1769,7 +1730,7 @@ impl Window { timer_event_chan: IpcSender<TimerEvent>, layout_chan: Sender<Msg>, pipelineid: PipelineId, - parent_info: Option<(PipelineId, FrameType)>, + parent_info: Option<PipelineId>, window_size: Option<WindowSizeData>, origin: MutableOrigin, navigation_start: u64, diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 33c62a38cd5..b7b652a6f91 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -60,7 +60,6 @@ use net_traits::trim_http_whitespace; use network_listener::{NetworkListener, PreInvoke}; use script_traits::DocumentActivity; use servo_atoms::Atom; -use servo_config::prefs::PREFS; use servo_url::ServoUrl; use std::borrow::ToOwned; use std::cell::Cell; @@ -572,20 +571,6 @@ impl XMLHttpRequestMethods for XMLHttpRequest { unreachable!() }; - let bypass_cross_origin_check = { - // We want to be able to do cross-origin requests in browser.html. - // If the XHR happens in a top level window and the mozbrowser - // preference is enabled, we allow bypassing the CORS check. - // This is a temporary measure until we figure out Servo privilege - // story. See https://github.com/servo/servo/issues/9582 - if let Some(win) = DomRoot::downcast::<Window>(self.global()) { - let is_root_pipeline = win.parent_info().is_none(); - is_root_pipeline && PREFS.is_mozbrowser_enabled() - } else { - false - } - }; - let mut request = RequestInit { method: self.request_method.borrow().clone(), url: self.request_url.borrow().clone().unwrap(), @@ -608,10 +593,6 @@ impl XMLHttpRequestMethods for XMLHttpRequest { .. RequestInit::default() }; - if bypass_cross_origin_check { - request.mode = RequestMode::Navigate; - } - // step 4 (second half) match extracted_or_serialized { Some((_, ref content_type)) => { diff --git a/components/script/lib.rs b/components/script/lib.rs index a871b320758..e28bf016e55 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -70,7 +70,6 @@ extern crate msg; extern crate net_traits; extern crate num_traits; extern crate offscreen_gl_context; -extern crate open; extern crate parking_lot; extern crate phf; #[macro_use] diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index fd5fe44962f..3a51c812dce 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -77,7 +77,7 @@ use malloc_size_of::MallocSizeOfOps; use mem::malloc_size_of_including_self; use metrics::{MAX_TASK_NS, PaintTimeMetrics}; use microtask::{MicrotaskQueue, Microtask}; -use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId, PipelineNamespace, TopLevelBrowsingContextId}; +use msg::constellation_msg::{BrowsingContextId, PipelineId, PipelineNamespace, TopLevelBrowsingContextId}; use net_traits::{FetchMetadata, FetchResponseListener, FetchResponseMsg}; use net_traits::{Metadata, NetworkError, ReferrerPolicy, ResourceThreads}; use net_traits::image_cache::{ImageCache, PendingImageResponse}; @@ -91,13 +91,12 @@ use script_runtime::{ScriptPort, get_reports, new_rt_and_cx, Runtime}; use script_traits::{CompositorEvent, ConstellationControlMsg}; use script_traits::{DiscardBrowsingContext, DocumentActivity, EventResult}; use script_traits::{InitialScriptState, JsEvalResult, LayoutMsg, LoadData}; -use script_traits::{MouseButton, MouseEventType, MozBrowserEvent, NewLayoutInfo}; +use script_traits::{MouseButton, MouseEventType, NewLayoutInfo}; use script_traits::{ProgressiveWebMetricType, Painter, ScriptMsg, ScriptThreadFactory}; use script_traits::{ScriptToConstellationChan, TimerEvent, TimerSchedulerMsg}; use script_traits::{TimerSource, TouchEventType, TouchId, UntrustedNodeAddress}; use script_traits::{UpdatePipelineIdReason, WindowSizeData, WindowSizeType}; -use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent}; -use script_traits::CompositorEvent::{TouchEvent, TouchpadPressureEvent}; +use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent, TouchEvent}; use script_traits::webdriver_msg::WebDriverScriptCommand; use serviceworkerjob::{Job, JobQueue}; use servo_atoms::Atom; @@ -154,7 +153,7 @@ struct InProgressLoad { /// The top level ancestor browsing context. top_level_browsing_context_id: TopLevelBrowsingContextId, /// The parent pipeline and frame type associated with this load, if any. - parent_info: Option<(PipelineId, FrameType)>, + parent_info: Option<PipelineId>, /// The current window size associated with this pipeline. window_size: Option<WindowSizeData>, /// Channel to the layout thread associated with this pipeline. @@ -180,7 +179,7 @@ impl InProgressLoad { fn new(id: PipelineId, browsing_context_id: BrowsingContextId, top_level_browsing_context_id: TopLevelBrowsingContextId, - parent_info: Option<(PipelineId, FrameType)>, + parent_info: Option<PipelineId>, layout_chan: Sender<message::Msg>, window_size: Option<WindowSizeData>, url: ServoUrl, @@ -981,7 +980,7 @@ impl ScriptThread { let origin = if new_layout_info.load_data.url.as_str() != "about:blank" { MutableOrigin::new(new_layout_info.load_data.url.origin()) } else if let Some(parent) = new_layout_info.parent_info - .and_then(|(pipeline_id, _)| self.documents.borrow() + .and_then(|pipeline_id| self.documents.borrow() .find_document(pipeline_id)) { parent.origin().clone() } else if let Some(creator) = new_layout_info.load_data.creator_pipeline_id @@ -1169,7 +1168,6 @@ impl ScriptThread { NotifyVisibilityChange(id, ..) => Some(id), Navigate(id, ..) => Some(id), PostMessage(id, ..) => Some(id), - MozBrowserEvent(id, ..) => Some(id), UpdatePipelineId(_, _, id, _) => Some(id), FocusIFrame(id, ..) => Some(id), WebDriverScriptCommand(id, ..) => Some(id), @@ -1289,12 +1287,6 @@ impl ScriptThread { self.handle_visibility_change_complete_msg(parent_pipeline_id, browsing_context_id, visible), ConstellationControlMsg::PostMessage(pipeline_id, origin, data) => self.handle_post_message_msg(pipeline_id, origin, data), - ConstellationControlMsg::MozBrowserEvent(parent_pipeline_id, - top_level_browsing_context_id, - event) => - self.handle_mozbrowser_event_msg(parent_pipeline_id, - top_level_browsing_context_id, - event), ConstellationControlMsg::UpdatePipelineId(parent_pipeline_id, browsing_context_id, new_pipeline_id, @@ -1693,27 +1685,6 @@ impl ScriptThread { } } - /// Handles a mozbrowser event, for example see: - /// <https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart> - fn handle_mozbrowser_event_msg(&self, - parent_pipeline_id: PipelineId, - top_level_browsing_context_id: Option<TopLevelBrowsingContextId>, - event: MozBrowserEvent) { - let doc = match { self.documents.borrow().find_document(parent_pipeline_id) } { - None => return warn!("Mozbrowser event after pipeline {} closed.", parent_pipeline_id), - Some(doc) => doc, - }; - - match top_level_browsing_context_id { - None => doc.window().dispatch_mozbrowser_event(event), - Some(top_level_browsing_context_id) => match doc.find_mozbrowser_iframe(top_level_browsing_context_id) { - None => warn!("Mozbrowser event after iframe {}/{} closed.", - parent_pipeline_id, top_level_browsing_context_id), - Some(frame_element) => frame_element.dispatch_mozbrowser_event(event), - }, - } - } - fn handle_update_pipeline_id(&self, parent_pipeline_id: PipelineId, browsing_context_id: BrowsingContextId, @@ -2027,7 +1998,7 @@ impl ScriptThread { result_receiver.recv().expect("Failed to get frame id from constellation.") } - fn ask_constellation_for_parent_info(&self, pipeline_id: PipelineId) -> Option<(PipelineId, FrameType)> { + fn ask_constellation_for_parent_info(&self, pipeline_id: PipelineId) -> Option<PipelineId> { let (result_sender, result_receiver) = ipc::channel().unwrap(); let msg = ScriptMsg::GetParentInfo(pipeline_id, result_sender); self.script_sender.send((pipeline_id, msg)).expect("Failed to send to constellation."); @@ -2050,12 +2021,9 @@ impl ScriptThread { if let Some(window_proxy) = self.window_proxies.borrow().get(&browsing_context_id) { return Some(DomRoot::from_ref(window_proxy)); } - let parent = match self.ask_constellation_for_parent_info(pipeline_id) { - Some((parent_id, FrameType::IFrame)) => self.remote_window_proxy(global_to_clone, - top_level_browsing_context_id, - parent_id), - _ => None, - }; + let parent = self.ask_constellation_for_parent_info(pipeline_id).and_then(|parent_id| { + self.remote_window_proxy(global_to_clone, top_level_browsing_context_id, parent_id) + }); let window_proxy = WindowProxy::new_dissimilar_origin(global_to_clone, browsing_context_id, top_level_browsing_context_id, @@ -2074,22 +2042,21 @@ impl ScriptThread { window: &Window, browsing_context_id: BrowsingContextId, top_level_browsing_context_id: TopLevelBrowsingContextId, - parent_info: Option<(PipelineId, FrameType)>) + parent_info: Option<PipelineId>) -> DomRoot<WindowProxy> { if let Some(window_proxy) = self.window_proxies.borrow().get(&browsing_context_id) { window_proxy.set_currently_active(&*window); return DomRoot::from_ref(window_proxy); } - let iframe = match parent_info { - Some((parent_id, FrameType::IFrame)) => self.documents.borrow().find_iframe(parent_id, browsing_context_id), - _ => None, - }; + let iframe = parent_info.and_then(|parent_id| { + self.documents.borrow().find_iframe(parent_id, browsing_context_id) + }); let parent = match (parent_info, iframe.as_ref()) { (_, Some(iframe)) => Some(window_from_node(&**iframe).window_proxy()), - (Some((parent_id, FrameType::IFrame)), _) => self.remote_window_proxy(window.upcast(), - top_level_browsing_context_id, - parent_id), + (Some(parent_id), _) => self.remote_window_proxy(window.upcast(), + top_level_browsing_context_id, + parent_id), _ => None, }; let window_proxy = WindowProxy::new(&window, @@ -2378,19 +2345,6 @@ impl ScriptThread { } } - TouchpadPressureEvent(_point, pressure, phase, node_address) => { - let doc = match { self.documents.borrow().find_document(pipeline_id) } { - Some(doc) => doc, - None => return warn!("Message sent to closed pipeline {}.", pipeline_id), - }; - doc.handle_touchpad_pressure_event( - self.js_runtime.rt(), - pressure, - phase, - node_address - ); - } - KeyEvent(ch, key, state, modifiers) => { let document = match { self.documents.borrow().find_document(pipeline_id) } { Some(document) => document, diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index a8ef74c56c3..14e0472da60 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -48,13 +48,12 @@ use hyper::method::Method; use ipc_channel::{Error as IpcError}; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use libc::c_void; -use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, FrameType, Key, KeyModifiers, KeyState}; +use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, Key, KeyModifiers, KeyState}; use msg::constellation_msg::{PipelineId, PipelineNamespaceId, TraversalDirection}; use net_traits::{FetchResponseMsg, ReferrerPolicy, ResourceThreads}; use net_traits::image::base::Image; use net_traits::image::base::PixelFormat; use net_traits::image_cache::ImageCache; -use net_traits::response::HttpsState; use net_traits::storage_thread::StorageType; use profile_traits::mem; use profile_traits::time as profile_time; @@ -186,7 +185,7 @@ impl LoadData { pub struct NewLayoutInfo { /// The ID of the parent pipeline and frame type, if any. /// If `None`, this is a root pipeline. - pub parent_info: Option<(PipelineId, FrameType)>, + pub parent_info: Option<PipelineId>, /// Id of the newly-created pipeline. pub new_pipeline_id: PipelineId, /// Id of the browsing context associated with this pipeline. @@ -287,9 +286,6 @@ pub enum ConstellationControlMsg { Navigate(PipelineId, BrowsingContextId, LoadData, bool), /// Post a message to a given window. PostMessage(PipelineId, Option<ImmutableOrigin>, Vec<u8>), - /// Requests the script thread forward a mozbrowser event to a mozbrowser iframe it owns, - /// or to the window if no browsing context id is provided. - MozBrowserEvent(PipelineId, Option<TopLevelBrowsingContextId>, MozBrowserEvent), /// Updates the current pipeline ID of a given iframe. /// First PipelineId is for the parent, second is the new PipelineId for the frame. UpdatePipelineId(PipelineId, BrowsingContextId, PipelineId, UpdatePipelineIdReason), @@ -346,7 +342,6 @@ impl fmt::Debug for ConstellationControlMsg { NotifyVisibilityChange(..) => "NotifyVisibilityChange", Navigate(..) => "Navigate", PostMessage(..) => "PostMessage", - MozBrowserEvent(..) => "MozBrowserEvent", UpdatePipelineId(..) => "UpdatePipelineId", FocusIFrame(..) => "FocusIFrame", WebDriverScriptCommand(..) => "WebDriverScriptCommand", @@ -445,23 +440,10 @@ pub enum CompositorEvent { MouseMoveEvent(Option<Point2D<f32>>, Option<UntrustedNodeAddress>), /// A touch event was generated with a touch ID and location. TouchEvent(TouchEventType, TouchId, Point2D<f32>, Option<UntrustedNodeAddress>), - /// Touchpad pressure event - TouchpadPressureEvent(Point2D<f32>, f32, TouchpadPressurePhase, Option<UntrustedNodeAddress>), /// A key was pressed. KeyEvent(Option<char>, Key, KeyState, KeyModifiers), } -/// Touchpad pressure phase for `TouchpadPressureEvent`. -#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)] -pub enum TouchpadPressurePhase { - /// Pressure before a regular click. - BeforeClick, - /// Pressure after a regular click. - AfterFirstClick, - /// Pressure after a "forceTouch" click - AfterSecondClick, -} - /// Requests a TimerEvent-Message be sent after the given duration. #[derive(Deserialize, Serialize)] pub struct TimerEventRequest(pub IpcSender<TimerEvent>, pub TimerSource, pub TimerEventId, pub MsDuration); @@ -524,7 +506,7 @@ pub struct InitialScriptState { pub id: PipelineId, /// The subpage ID of this pipeline to create in its pipeline parent. /// If `None`, this is the root. - pub parent_info: Option<(PipelineId, FrameType)>, + pub parent_info: Option<PipelineId>, /// The ID of the browsing context this script is part of. pub browsing_context_id: BrowsingContextId, /// The ID of the top-level browsing context this script is part of. @@ -592,14 +574,11 @@ pub struct IFrameLoadInfo { /// The ID for this iframe's nested browsing context. pub browsing_context_id: BrowsingContextId, /// The ID for the top-level ancestor browsing context of this iframe's nested browsing context. - /// Note: this is the same as the browsing_context_id for mozbrowser iframes. pub top_level_browsing_context_id: TopLevelBrowsingContextId, /// The new pipeline ID that the iframe has generated. pub new_pipeline_id: PipelineId, /// Whether this iframe should be considered private pub is_private: bool, - /// Whether this iframe is a mozbrowser iframe - pub frame_type: FrameType, /// Wether 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: bool, @@ -618,94 +597,6 @@ pub struct IFrameLoadInfoWithData { pub sandbox: IFrameSandboxState, } -// https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API#Events -/// The events fired in a Browser API context (`<iframe mozbrowser>`) -#[derive(Deserialize, Serialize)] -pub enum MozBrowserEvent { - /// Sent when the scroll position within a browser `<iframe>` changes. - AsyncScroll, - /// Sent when window.close() is called within a browser `<iframe>`. - Close, - /// Sent when a browser `<iframe>` tries to open a context menu. This allows - /// handling `<menuitem>` element available within the browser `<iframe>`'s content. - ContextMenu, - /// Sent when an error occurred while trying to load content within a browser `<iframe>`. - /// Includes a human-readable description, and a machine-readable report. - Error(MozBrowserErrorType, String, String), - /// Sent when the favicon of a browser `<iframe>` changes. - IconChange(String, String, String), - /// Sent when the browser `<iframe>` has reached the server. - Connected, - /// Sent when the browser `<iframe>` has finished loading all its assets. - LoadEnd, - /// Sent when the browser `<iframe>` starts to load a new page. - LoadStart, - /// Sent when a browser `<iframe>`'s location changes. - LocationChange(String, bool, bool), - /// Sent when a new tab is opened within a browser `<iframe>` as a result of the user - /// issuing a command to open a link target in a new tab (for example ctrl/cmd + click.) - /// Includes the URL. - OpenTab(String), - /// Sent when a new window is opened within a browser `<iframe>`. - /// Includes the URL, target browsing context name, and features. - OpenWindow(String, Option<String>, Option<String>), - /// Sent when the SSL state changes within a browser `<iframe>`. - SecurityChange(HttpsState), - /// Sent when alert(), confirm(), or prompt() is called within a browser `<iframe>`. - ShowModalPrompt(String, String, String, String), // TODO(simartin): Handle unblock() - /// Sent when the document.title changes within a browser `<iframe>`. - TitleChange(String), - /// Sent when an HTTP authentification is requested. - UsernameAndPasswordRequired, - /// Sent when a link to a search engine is found. - OpenSearch, - /// Sent when visibility state changes. - VisibilityChange(bool), -} - -impl MozBrowserEvent { - /// Get the name of the event as a `& str` - pub fn name(&self) -> &'static str { - match *self { - MozBrowserEvent::AsyncScroll => "mozbrowserasyncscroll", - MozBrowserEvent::Close => "mozbrowserclose", - MozBrowserEvent::Connected => "mozbrowserconnected", - MozBrowserEvent::ContextMenu => "mozbrowsercontextmenu", - MozBrowserEvent::Error(_, _, _) => "mozbrowsererror", - MozBrowserEvent::IconChange(_, _, _) => "mozbrowsericonchange", - MozBrowserEvent::LoadEnd => "mozbrowserloadend", - MozBrowserEvent::LoadStart => "mozbrowserloadstart", - MozBrowserEvent::LocationChange(_, _, _) => "mozbrowserlocationchange", - MozBrowserEvent::OpenTab(_) => "mozbrowseropentab", - MozBrowserEvent::OpenWindow(_, _, _) => "mozbrowseropenwindow", - MozBrowserEvent::SecurityChange(_) => "mozbrowsersecuritychange", - MozBrowserEvent::ShowModalPrompt(_, _, _, _) => "mozbrowsershowmodalprompt", - MozBrowserEvent::TitleChange(_) => "mozbrowsertitlechange", - MozBrowserEvent::UsernameAndPasswordRequired => "mozbrowserusernameandpasswordrequired", - MozBrowserEvent::OpenSearch => "mozbrowseropensearch", - MozBrowserEvent::VisibilityChange(_) => "mozbrowservisibilitychange", - } - } -} - -// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsererror -/// The different types of Browser error events -#[derive(Deserialize, Serialize)] -pub enum MozBrowserErrorType { - // For the moment, we are just reporting panics, using the "fatal" type. - /// A fatal error - Fatal, -} - -impl MozBrowserErrorType { - /// Get the name of the error type as a `& str` - pub fn name(&self) -> &'static str { - match *self { - MozBrowserErrorType::Fatal => "fatal", - } - } -} - /// Specifies whether the script or layout thread needs to be ticked for animation. #[derive(Deserialize, Serialize)] pub enum AnimationTickType { diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index 6ff47b5e004..524a87d039a 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -9,7 +9,6 @@ use IFrameLoadInfo; use IFrameLoadInfoWithData; use LayoutControlMsg; use LoadData; -use MozBrowserEvent; use WorkerGlobalScopeInit; use WorkerScriptLoadOrigin; use canvas_traits::canvas::CanvasMsg; @@ -17,7 +16,7 @@ use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use euclid::{Point2D, Size2D, TypedSize2D}; use gfx_traits::Epoch; use ipc_channel::ipc::{IpcReceiver, IpcSender}; -use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId, TraversalDirection}; +use msg::constellation_msg::{BrowsingContextId, PipelineId, TraversalDirection}; use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use net_traits::CoreResourceMsg; use net_traits::request::RequestInit; @@ -89,7 +88,7 @@ pub enum ScriptMsg { /// Get the browsing context id for a given pipeline. GetBrowsingContextId(PipelineId, IpcSender<Option<BrowsingContextId>>), /// Get the parent info for a given pipeline. - GetParentInfo(PipelineId, IpcSender<Option<(PipelineId, FrameType)>>), + GetParentInfo(PipelineId, IpcSender<Option<PipelineId>>), /// <head> tag finished parsing HeadParsed, /// All pending loads are complete, and the `load` event for this pipeline @@ -102,8 +101,6 @@ pub enum ScriptMsg { AbortLoadUrl, /// Post a message to the currently active window of a given browsing context. PostMessage(BrowsingContextId, Option<ImmutableOrigin>, Vec<u8>), - /// Dispatch a mozbrowser event to the parent of a mozbrowser iframe. - MozBrowserEvent(PipelineId, MozBrowserEvent), /// HTMLIFrameElement Forward or Back traversal. TraverseHistory(TraversalDirection), /// Gets the length of the joint session history from the constellation. diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 092e441535d..8844625af19 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -311,10 +311,6 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static { } } - WindowEvent::TouchpadPressure(cursor, pressure, stage) => { - self.compositor.on_touchpad_pressure_event(cursor, pressure, stage); - } - WindowEvent::KeyEvent(ch, key, state, modifiers) => { let msg = ConstellationMsg::KeyEvent(ch, key, state, modifiers); if let Err(e) = self.constellation_chan.send(msg) { @@ -461,6 +457,11 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static { // TODO(pcwalton): Specify which frame's load completed. self.compositor.window.load_end(top_level_browsing_context); }, + (EmbedderMsg::Panic(top_level_browsing_context, reason, backtrace), + ShutdownState::NotShuttingDown) => { + self.compositor.window.handle_panic(top_level_browsing_context, reason, backtrace); + }, + } } } diff --git a/ports/servo/Cargo.toml b/ports/servo/Cargo.toml index b2632a3731f..a0fb6fd3b10 100644 --- a/ports/servo/Cargo.toml +++ b/ports/servo/Cargo.toml @@ -26,7 +26,6 @@ unstable = ["libservo/unstable"] [dependencies] backtrace = "0.3" -browserhtml = {git = "https://github.com/browserhtml/browserhtml", branch = "crate"} bitflags = "1.0" compositing = {path = "../../components/compositing"} euclid = "0.16" diff --git a/ports/servo/glutin_app/window.rs b/ports/servo/glutin_app/window.rs index d024429aca8..88c14873b7d 100644 --- a/ports/servo/glutin_app/window.rs +++ b/ports/servo/glutin_app/window.rs @@ -23,7 +23,7 @@ use msg::constellation_msg::{KeyModifiers, KeyState, TraversalDirection}; use net_traits::net_error_list::NetError; #[cfg(any(target_os = "linux", target_os = "macos"))] use osmesa_sys; -use script_traits::{LoadData, TouchEventType, TouchpadPressurePhase}; +use script_traits::{LoadData, TouchEventType}; use servo::ipc_channel::ipc::IpcSender; use servo_config::opts; use servo_config::prefs::PREFS; @@ -518,12 +518,6 @@ impl Window { let point = TypedPoint2D::new(touch.location.0 as f32, touch.location.1 as f32); self.event_queue.borrow_mut().push(WindowEvent::Touch(phase, id, point)); } - Event::TouchpadPressure(pressure, stage) => { - let m = self.mouse_pos.get(); - let point = TypedPoint2D::new(m.x as f32, m.y as f32); - let phase = glutin_pressure_stage_to_touchpad_pressure_phase(stage); - self.event_queue.borrow_mut().push(WindowEvent::TouchpadPressure(point, pressure, phase)); - } Event::Refresh => { self.event_queue.borrow_mut().push(WindowEvent::Refresh); } @@ -1360,6 +1354,10 @@ impl WindowMethods for Window { fn supports_clipboard(&self) -> bool { true } + + fn handle_panic(&self, _: BrowserId, _reason: String, _backtrace: Option<String>) { + // Nothing to do here yet. The crash has already been reported on the console. + } } fn glutin_phase_to_touch_event_type(phase: TouchPhase) -> TouchEventType { @@ -1371,16 +1369,6 @@ fn glutin_phase_to_touch_event_type(phase: TouchPhase) -> TouchEventType { } } -fn glutin_pressure_stage_to_touchpad_pressure_phase(stage: i64) -> TouchpadPressurePhase { - if stage < 1 { - TouchpadPressurePhase::BeforeClick - } else if stage < 2 { - TouchpadPressurePhase::AfterFirstClick - } else { - TouchpadPressurePhase::AfterSecondClick - } -} - fn is_printable(key_code: VirtualKeyCode) -> bool { use glutin::VirtualKeyCode::*; match key_code { diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 8cc307bfb51..ef0e7dacc3f 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -65,13 +65,6 @@ def find_dep_path_newest(package, bin_path): return None -def get_browserhtml_path(binary_path): - browserhtml_path = find_dep_path_newest('browserhtml', binary_path) - if browserhtml_path: - return path.join(browserhtml_path, "out") - sys.exit("Could not find browserhtml package; perhaps you haven't built Servo.") - - def archive_deterministically(dir_to_archive, dest_archive, prepend_path=None): """Create a .tar.gz archive in a deterministic (reproducible) manner. diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py index 6912962c095..2a2f2f74d8c 100644 --- a/python/servo/package_commands.py +++ b/python/servo/package_commands.py @@ -36,7 +36,6 @@ from servo.command_base import ( CommandBase, is_macosx, is_windows, - get_browserhtml_path, ) from servo.util import delete @@ -228,11 +227,9 @@ class PackageCommands(CommandBase): if path.exists(dir_to_dmg): print("Cleaning up from previous packaging") delete(dir_to_dmg) - browserhtml_path = get_browserhtml_path(binary_path) print("Copying files") shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources) - shutil.copytree(browserhtml_path, path.join(dir_to_resources, 'browserhtml')) shutil.copy2(path.join(dir_to_root, 'Info.plist'), path.join(dir_to_app, 'Contents', 'Info.plist')) content_dir = path.join(dir_to_app, 'Contents', 'MacOS') @@ -264,16 +261,6 @@ class PackageCommands(CommandBase): credits_file.write(template.render(version=version)) delete(template_path) - print("Writing run-servo") - bhtml_path = path.join('${0%/*}', '..', 'Resources', 'browserhtml', 'index.html') - runservo = os.open( - path.join(content_dir, 'run-servo'), - os.O_WRONLY | os.O_CREAT, - int("0755", 8) - ) - os.write(runservo, '#!/bin/bash\nexec ${0%/*}/servo ' + bhtml_path) - os.close(runservo) - print("Creating dmg") os.symlink('/Applications', path.join(dir_to_dmg, 'Applications')) dmg_path = path.join(target_dir, "servo-tech-demo.dmg") @@ -323,14 +310,12 @@ class PackageCommands(CommandBase): print("Cleaning up from previous packaging") delete(dir_to_msi) os.makedirs(dir_to_msi) - browserhtml_path = get_browserhtml_path(binary_path) print("Copying files") dir_to_temp = path.join(dir_to_msi, 'temp') dir_to_temp_servo = path.join(dir_to_temp, 'servo') dir_to_resources = path.join(dir_to_temp_servo, 'resources') shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources) - shutil.copytree(browserhtml_path, path.join(dir_to_temp_servo, 'browserhtml')) shutil.copy(binary_path, dir_to_temp_servo) shutil.copy("{}.manifest".format(binary_path), dir_to_temp_servo) copy_windows_dependencies(target_dir, dir_to_temp_servo) @@ -372,7 +357,6 @@ class PackageCommands(CommandBase): delete(dir_to_temp) else: dir_to_temp = path.join(target_dir, 'packaging-temp') - browserhtml_path = get_browserhtml_path(binary_path) if path.exists(dir_to_temp): # TODO(aneeshusa): lock dir_to_temp to prevent simultaneous builds print("Cleaning up from previous packaging") @@ -381,7 +365,6 @@ class PackageCommands(CommandBase): print("Copying files") dir_to_resources = path.join(dir_to_temp, 'resources') shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources) - shutil.copytree(browserhtml_path, path.join(dir_to_temp, 'browserhtml')) shutil.copy(binary_path, dir_to_temp) change_prefs(dir_to_resources, "linux") diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index 30d1eed9bc0..115c03f30b5 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -23,8 +23,7 @@ from mach.decorators import ( from servo.command_base import ( CommandBase, check_call, check_output, BIN_SUFFIX, - is_linux, is_windows, is_macosx, set_osmesa_env, - get_browserhtml_path, + is_linux, set_osmesa_env, ) @@ -53,8 +52,6 @@ class PostBuildCommands(CommandBase): 'have no effect without this.') @CommandArgument('--debugger', default=None, type=str, help='Name of debugger to use.') - @CommandArgument('--browserhtml', '-b', action='store_true', - help='Launch with Browser.html') @CommandArgument('--headless', '-z', action='store_true', help='Launch in headless mode') @CommandArgument('--software', '-s', action='store_true', @@ -64,7 +61,7 @@ class PostBuildCommands(CommandBase): @CommandArgument( 'params', nargs='...', help="Command-line arguments to be passed through to Servo") - def run(self, params, release=False, dev=False, android=None, debug=False, debugger=None, browserhtml=False, + def run(self, params, release=False, dev=False, android=None, debug=False, debugger=None, headless=False, software=False, bin=None): env = self.build_env() env["RUST_BACKTRACE"] = "1" @@ -100,20 +97,6 @@ class PostBuildCommands(CommandBase): args = [bin or self.get_binary_path(release, dev)] - if browserhtml: - browserhtml_path = get_browserhtml_path(args[0]) - if is_macosx(): - # Enable borderless on OSX - args = args + ['-b'] - elif is_windows(): - # Convert to a relative path to avoid mingw -> Windows path conversions - browserhtml_path = path.relpath(browserhtml_path, os.getcwd()) - - args = args + ['--pref', 'dom.mozbrowser.enabled', - '--pref', 'dom.forcetouch.enabled', - '--pref', 'shell.builtin-key-shortcuts.enabled=false', - path.join(browserhtml_path, 'index.html')] - if headless: set_osmesa_env(args[0], env) args.append('-z') diff --git a/resources/package-prefs.json b/resources/package-prefs.json index b68db95d663..0762de26cbc 100644 --- a/resources/package-prefs.json +++ b/resources/package-prefs.json @@ -1,7 +1,3 @@ { - "dom.forcetouch.enabled": true, - "dom.mozbrowser.enabled": true, - "shell.builtin-key-shortcuts.enabled": false, - "os:windows,os:linux;shell.homepage": "browserhtml/index.html", - "os:macosx;shell.native-titlebar.enabled": false + "_comment": "this file is used to add some specific preferences to the Servo package (nightly builds)" } diff --git a/resources/prefs.json b/resources/prefs.json index f7682c8f182..0c42ab221ec 100644 --- a/resources/prefs.json +++ b/resources/prefs.json @@ -8,7 +8,6 @@ "dom.gamepad.enabled": false, "dom.microdata.testing.enabled": true, "dom.mouseevent.which.enabled": false, - "dom.mozbrowser.enabled": false, "dom.mutation_observer.enabled": false, "dom.permissions.enabled": false, "dom.permissions.testing.allowed_in_nonsecure_contexts": false, diff --git a/servo-tidy.toml b/servo-tidy.toml index 5a2a5940f68..295aa2162f4 100644 --- a/servo-tidy.toml +++ b/servo-tidy.toml @@ -54,7 +54,6 @@ files = [ "./components/style/gecko/generated/atom_macro.rs", "./resources/hsts_preload.json", "./tests/wpt/metadata/MANIFEST.json", - "./components/script/dom/webidls/ForceTouchEvent.webidl", "./support/android/openssl.sh", # Upstream code from Khronos/WebGL uses tabs for indentation "./tests/wpt/mozilla/tests/webgl", diff --git a/support/windows/Servo.wxs.mako b/support/windows/Servo.wxs.mako index 08294abd392..a2a62ccb581 100644 --- a/support/windows/Servo.wxs.mako +++ b/support/windows/Servo.wxs.mako @@ -44,7 +44,6 @@ </Component> ${include_directory(resources_path, "resources")} - ${include_directory(path.join(dir_to_temp, "browserhtml"), "browserhtml")} </Directory> </Directory> </Directory> diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 2fbfc9f584e..f8a55cc49d5 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -2387,18 +2387,6 @@ {} ] ], - "css/iframe/mozbrowser_navigation.html": [ - [ - "/_mozilla/css/iframe/mozbrowser_navigation.html", - [ - [ - "/_mozilla/css/iframe/mozbrowser_navigation_ref.html", - "==" - ] - ], - {} - ] - ], "css/iframe/multiple_external.html": [ [ "/_mozilla/css/iframe/multiple_external.html", @@ -8947,11 +8935,6 @@ {} ] ], - "css/iframe/mozbrowser_navigation_ref.html": [ - [ - {} - ] - ], "css/iframe/multiple_external_child.html": [ [ {} @@ -11102,101 +11085,6 @@ {} ] ], - "mozilla/mozbrowser/helper.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/iframe_contentDocument_inner.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/iframe_privateContent_grandchild.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/iframe_privateContent_inner.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe1.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe2.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe3.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowser_iframe_child.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowser_iframe_grandchild.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowser_iframe_harness.js": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowsericonchange_event_test.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowserlocationchange_event_iframe.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowsershowmodalprompt_event_iframe.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowsershowmodalprompt_event_nested_iframe.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowsershowmodalprompt_event_no_params_alert.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event_iframe.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/redirect_final.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/redirect_init.html": [ - [ - {} - ] - ], - "mozilla/mozbrowser/stash.py": [ - [ - {} - ] - ], "mozilla/nested_asap_script.js": [ [ {} @@ -33471,96 +33359,6 @@ {} ] ], - "mozilla/mozbrowser/crossorigin_xhr.html": [ - [ - "/_mozilla/mozilla/mozbrowser/crossorigin_xhr.html", - {} - ] - ], - "mozilla/mozbrowser/iframe_goback.html": [ - [ - "/_mozilla/mozilla/mozbrowser/iframe_goback.html", - {} - ] - ], - "mozilla/mozbrowser/iframe_reload_twice.html": [ - [ - "/_mozilla/mozilla/mozbrowser/iframe_reload_twice.html", - {} - ] - ], - "mozilla/mozbrowser/iframe_visibility.html": [ - [ - "/_mozilla/mozilla/mozbrowser/iframe_visibility.html", - {} - ] - ], - "mozilla/mozbrowser/mozbrowser_click_fires_openwindow.html": [ - [ - "/_mozilla/mozilla/mozbrowser/mozbrowser_click_fires_openwindow.html", - {} - ] - ], - "mozilla/mozbrowser/mozbrowser_iframe_parentage.html": [ - [ - "/_mozilla/mozilla/mozbrowser/mozbrowser_iframe_parentage.html", - {} - ] - ], - "mozilla/mozbrowser/mozbrowser_loadevents.html": [ - [ - "/_mozilla/mozilla/mozbrowser/mozbrowser_loadevents.html", - {} - ] - ], - "mozilla/mozbrowser/mozbrowsericonchange_event.html": [ - [ - "/_mozilla/mozilla/mozbrowser/mozbrowsericonchange_event.html", - {} - ] - ], - "mozilla/mozbrowser/mozbrowserlocationchange_event.html": [ - [ - "/_mozilla/mozilla/mozbrowser/mozbrowserlocationchange_event.html", - {} - ] - ], - "mozilla/mozbrowser/mozbrowsersecuritychange_event.html": [ - [ - "/_mozilla/mozilla/mozbrowser/mozbrowsersecuritychange_event.html", - {} - ] - ], - "mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html": [ - [ - "/_mozilla/mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html", - {} - ] - ], - "mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html": [ - [ - "/_mozilla/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html", - {} - ] - ], - "mozilla/mozbrowser/private_browsing.html": [ - [ - "/_mozilla/mozilla/mozbrowser/private_browsing.html", - {} - ] - ], - "mozilla/mozbrowser/redirect.html": [ - [ - "/_mozilla/mozilla/mozbrowser/redirect.html", - {} - ] - ], - "mozilla/mozbrowser/reload.html": [ - [ - "/_mozilla/mozilla/mozbrowser/reload.html", - {} - ] - ], "mozilla/mql_borrow.html": [ [ "/_mozilla/mozilla/mql_borrow.html", @@ -62602,14 +62400,6 @@ "e30451b16fc0c4b025a2160e6c7b849901150718", "support" ], - "css/iframe/mozbrowser_navigation.html": [ - "7a17922ce48c8138284ad1a1f0f88317df35b541", - "reftest" - ], - "css/iframe/mozbrowser_navigation_ref.html": [ - "368a46cfb7c6cdce26381121d803427d6ad93c69", - "support" - ], "css/iframe/multiple_external.html": [ "79df63cbb113c57ccacf5734a6d14e29d73478a5", "reftest" @@ -66562,142 +66352,6 @@ "1311e72e0a0dafa6fae594ca1ce2deca164acd36", "testharness" ], - "mozilla/mozbrowser/crossorigin_xhr.html": [ - "e716ee75552f0e531fef1a71b20799ccb8b221d9", - "testharness" - ], - "mozilla/mozbrowser/helper.html": [ - "652e88e7a84b50ca1d4ed3cc2d1f1e354fb9ab32", - "support" - ], - "mozilla/mozbrowser/iframe_contentDocument_inner.html": [ - "a098b74e081838bcbf4ceb854a48a57eb5ae3cab", - "support" - ], - "mozilla/mozbrowser/iframe_goback.html": [ - "a850e2549dfdbcfbb344ccc23ff03717d392bfdc", - "testharness" - ], - "mozilla/mozbrowser/iframe_privateContent_grandchild.html": [ - "13d4e88f2581ff7d5cbbf149463563d0754978fe", - "support" - ], - "mozilla/mozbrowser/iframe_privateContent_inner.html": [ - "354b3b6d6596559bac45119db6549f1347b93bef", - "support" - ], - "mozilla/mozbrowser/iframe_reload_twice.html": [ - "c6e6cc7ca336154723c658fb8cae8989ca8b7ee7", - "testharness" - ], - "mozilla/mozbrowser/iframe_visibility.html": [ - "c2a2df3f85f7ed1d76fbc694fe247071050ebb81", - "testharness" - ], - "mozilla/mozbrowser/mozbrowser_click_fires_openwindow.html": [ - "30fa150f6f22a989bf7e85d3b367ec7d61f57f09", - "testharness" - ], - "mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe1.html": [ - "375566a899295a1da1685cd85127c2da60e1eee8", - "support" - ], - "mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe2.html": [ - "e4d4a2acd91a4f12323b5aca458a5c4068e70782", - "support" - ], - "mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe3.html": [ - "9d714203485baed8faff37c312190dd384769c83", - "support" - ], - "mozilla/mozbrowser/mozbrowser_iframe_child.html": [ - "a51e76f9c72896a539b08d40f48fef0412336a34", - "support" - ], - "mozilla/mozbrowser/mozbrowser_iframe_grandchild.html": [ - "441c2e80ad3ecc9da321507a3c41b3c346bea0f0", - "support" - ], - "mozilla/mozbrowser/mozbrowser_iframe_harness.js": [ - "c5db7a8f3c32f79a4e24d176cb95563a999240e5", - "support" - ], - "mozilla/mozbrowser/mozbrowser_iframe_parentage.html": [ - "3f03a10f8f8c72cbd0a73fc130f705246c308871", - "testharness" - ], - "mozilla/mozbrowser/mozbrowser_loadevents.html": [ - "03ef403ece408147f23f5dc898a0509102c4d75c", - "testharness" - ], - "mozilla/mozbrowser/mozbrowsericonchange_event.html": [ - "fbaeb75787aa039e506c32ec0487dc05dc6280cf", - "testharness" - ], - "mozilla/mozbrowser/mozbrowsericonchange_event_test.html": [ - "61e39bc9ead6d4bfc9bf60bed3323753dc0e791a", - "support" - ], - "mozilla/mozbrowser/mozbrowserlocationchange_event.html": [ - "35a0671b553ae5787b8444deac127e2ee071d0f7", - "testharness" - ], - "mozilla/mozbrowser/mozbrowserlocationchange_event_iframe.html": [ - "ed175a1b2426de141ccb47e4d13c88ff0db0506e", - "support" - ], - "mozilla/mozbrowser/mozbrowsersecuritychange_event.html": [ - "58a58e552f21dd650020197b7e28c87c4d84e691", - "testharness" - ], - "mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html": [ - "ff8971b64dda52903009697dc56df6b3a9cecdb3", - "testharness" - ], - "mozilla/mozbrowser/mozbrowsershowmodalprompt_event_iframe.html": [ - "1cd97f725237d9ccba830a2e7f61b85da82319c5", - "support" - ], - "mozilla/mozbrowser/mozbrowsershowmodalprompt_event_nested_iframe.html": [ - "4b40aeb217cfe9d557dbd4b87120b788ba7a0fd8", - "support" - ], - "mozilla/mozbrowser/mozbrowsershowmodalprompt_event_no_params_alert.html": [ - "8c67b9c24de045fe36be9ff74a0700d7e7af6588", - "support" - ], - "mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html": [ - "2beae7d4e20e0b535144ac91113a73724f970321", - "testharness" - ], - "mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event_iframe.html": [ - "d7a0b1eced93ae16b2ccc7d1d1f2b1d383ff75ed", - "support" - ], - "mozilla/mozbrowser/private_browsing.html": [ - "bc8f9bfde5b6eb53ec1362b0cfae5d300af15c7e", - "testharness" - ], - "mozilla/mozbrowser/redirect.html": [ - "7377e38b6bdaea746d8e3c2801112200dca502d2", - "testharness" - ], - "mozilla/mozbrowser/redirect_final.html": [ - "db82c9a14bc76e3548200bc2e507d6044660514c", - "support" - ], - "mozilla/mozbrowser/redirect_init.html": [ - "ab668d7af80b7560bf3afa732b1198e2825929e9", - "support" - ], - "mozilla/mozbrowser/reload.html": [ - "f8c4f6b0ccf95426a3e6816fce5490ef9704e267", - "testharness" - ], - "mozilla/mozbrowser/stash.py": [ - "5513229f79ab37de67eb4d60ea9dd23cd31d133f", - "support" - ], "mozilla/mql_borrow.html": [ "f8f9adebe09f9473a52e5ec4f075540b10b32d7e", "testharness" diff --git a/tests/wpt/mozilla/meta/css/iframe/mozbrowser_navigation.html.ini b/tests/wpt/mozilla/meta/css/iframe/mozbrowser_navigation.html.ini deleted file mode 100644 index 7ed29aa037c..00000000000 --- a/tests/wpt/mozilla/meta/css/iframe/mozbrowser_navigation.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[mozbrowser_navigation.html] - type: reftest - prefs: [dom.mozbrowser.enabled:true] - disabled: https://github.com/servo/servo/issues/10924 diff --git a/tests/wpt/mozilla/meta/mozilla/mozbrowser/__dir__.ini b/tests/wpt/mozilla/meta/mozilla/mozbrowser/__dir__.ini deleted file mode 100644 index 6a4996ca794..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/mozbrowser/__dir__.ini +++ /dev/null @@ -1 +0,0 @@ -prefs: ["dom.mozbrowser.enabled:true"] diff --git a/tests/wpt/mozilla/meta/mozilla/mozbrowser/iframe_visibility.html.ini b/tests/wpt/mozilla/meta/mozilla/mozbrowser/iframe_visibility.html.ini deleted file mode 100644 index 6b5a309d200..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/mozbrowser/iframe_visibility.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[iframe_visibility.html] - type: testharness - disabled: https://github.com/servo/servo/issues/11825 diff --git a/tests/wpt/mozilla/meta/mozilla/mozbrowser/mozbrowser_loadevents.html.ini b/tests/wpt/mozilla/meta/mozilla/mozbrowser/mozbrowser_loadevents.html.ini deleted file mode 100644 index 2d0ba01c141..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/mozbrowser/mozbrowser_loadevents.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[mozbrowser_loadevents.html] - type: testharness - [mozbrowserloadstart, mozbrowserconnected and mozbrowserloadend are dispatched] - expected: FAIL - diff --git a/tests/wpt/mozilla/meta/mozilla/mozbrowser/mozbrowserlocationchange_event.html.ini b/tests/wpt/mozilla/meta/mozilla/mozbrowser/mozbrowserlocationchange_event.html.ini deleted file mode 100644 index 3535c215cdc..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/mozbrowser/mozbrowserlocationchange_event.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[mozbrowserlocationchange_event.html] - type: testharness - expected: TIMEOUT - [Browser API; mozbrowserlocationchange event] - expected: TIMEOUT - diff --git a/tests/wpt/mozilla/meta/mozilla/mozbrowser/mozbrowsersecuritychange_event.html.ini b/tests/wpt/mozilla/meta/mozilla/mozbrowser/mozbrowsersecuritychange_event.html.ini deleted file mode 100644 index 509699c9ca4..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/mozbrowser/mozbrowsersecuritychange_event.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[mozbrowsersecuritychange_event.html] - type: testharness - [mozbrowsersecuritychange event is dispatched when content security state changes] - expected: FAIL - diff --git a/tests/wpt/mozilla/tests/css/iframe/mozbrowser_navigation.html b/tests/wpt/mozilla/tests/css/iframe/mozbrowser_navigation.html deleted file mode 100644 index ea8ae85531d..00000000000 --- a/tests/wpt/mozilla/tests/css/iframe/mozbrowser_navigation.html +++ /dev/null @@ -1,33 +0,0 @@ -<!DOCTYPE html> -<html class="reftest-wait"> -<head> -<meta charset="utf-8"> -<style> -iframe { - display: block; - border: 1px solid black; - width: 500px; - height: 300px; - margin-left: 10px; - margin-top: 0px; -} -</style> -<link rel="match" href="mozbrowser_navigation_ref.html"> -</head> -<body> -<iframe mozbrowser="true" src="data:text/html,Hello%20world"></iframe> -<script> -var iframe = document.getElementsByTagName('iframe')[0]; -iframe.addEventListener('load', function first() { - iframe.removeEventListener('load', first); - iframe.src = "data:text/html,Foo"; - iframe.addEventListener('load', function() { - iframe.goBack(); - iframe.offsetHeight; // flush layout - document.documentElement.classList.remove("reftest-wait"); - }, false); -}, false); -</script> -</body> -</html> - diff --git a/tests/wpt/mozilla/tests/css/iframe/mozbrowser_navigation_ref.html b/tests/wpt/mozilla/tests/css/iframe/mozbrowser_navigation_ref.html deleted file mode 100644 index 10e6dac4888..00000000000 --- a/tests/wpt/mozilla/tests/css/iframe/mozbrowser_navigation_ref.html +++ /dev/null @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> -<meta charset="utf-8"> -<style> -iframe { - display: block; - border: 1px solid black; - width: 500px; - height: 300px; - margin-left: 10px; - margin-top: 0px; -} -</style> -<body> -<iframe src="data:text/html,Hello%20world"></iframe> -</body> -</html> - - diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/crossorigin_xhr.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/crossorigin_xhr.html deleted file mode 100644 index 180f3a915b6..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/crossorigin_xhr.html +++ /dev/null @@ -1,22 +0,0 @@ -<head> -<title>cross origin xhr() with mozbrowser</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -</head> -<body> -<script> - -async_test(function(t) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", "http://www2.web-platform.test:8000"); - xhr.send(); - - xhr.onerror = this.unreached_func("Cross origin xhr() should not have failed"); - - xhr.onload = this.step_func_done(() => { - assert_equals(xhr.status, 200, "Cross origin xhr() is successful"); - }); -}); - -</script> -</body> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/helper.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/helper.html deleted file mode 100644 index dee1ea597e5..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/helper.html +++ /dev/null @@ -1,6 +0,0 @@ -<!doctype html> -<html> -<body> - <p>test</p> -</body> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_contentDocument_inner.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_contentDocument_inner.html deleted file mode 100644 index 8336b0744a8..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_contentDocument_inner.html +++ /dev/null @@ -1,3 +0,0 @@ -<html><body><div id="test">Normal iFrame</div></body> -<script>alert(document.cookie)</script> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_goback.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_goback.html deleted file mode 100644 index 353051043e1..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_goback.html +++ /dev/null @@ -1,37 +0,0 @@ -<head> -<title>iframe.goBack()</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -</head> -<body> -<script> - -async_test(function(t) { - - var url2 = "data:,a"; - var url1 = `data:text/html,<script>setTimeout(() => location.assign("${url2}"), 0)</${"script"}>`; - - var locations = [] - var expected_locations = ["about:blank", url1, url2, url1]; - - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = url1; - - iframe.addEventListener("mozbrowserlocationchange", t.step_func(e => { - locations.push(e.detail.url); - if (e.detail.url == url2) { - iframe.goBack(); - } - if (locations.length == expected_locations.length) { - assert_array_equals(locations, expected_locations); - t.done(); - } - })); - - document.body.appendChild(iframe); - -}); - -</script> -</body> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_privateContent_grandchild.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_privateContent_grandchild.html deleted file mode 100644 index 5af0ff72802..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_privateContent_grandchild.html +++ /dev/null @@ -1,4 +0,0 @@ -<span id="cookie"></span> -<script> -document.querySelector('#cookie').innerHTML = document.cookie; -</script> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_privateContent_inner.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_privateContent_inner.html deleted file mode 100644 index 30d5bc8598a..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_privateContent_inner.html +++ /dev/null @@ -1,13 +0,0 @@ -<html> -<body> -<div id="test">Private iFrame</div> -</body> -<script>document.cookie = "private=active;path=/";</script> -<iframe src="iframe_privateContent_grandchild.html"></iframe> -<script> -var iframe = document.querySelector('iframe'); -iframe.onload = function() { - alert(document.cookie + ' ' + iframe.contentDocument.querySelector('#cookie').textContent); -}; -</script> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_reload_twice.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_reload_twice.html deleted file mode 100644 index 0b42fafbc55..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_reload_twice.html +++ /dev/null @@ -1,23 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>Reloading an iframe twice doesn't panic</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<iframe></iframe> -<script> -async_test(function(t) { - var iframe = document.querySelector('iframe'); - var loaded = false; - iframe.onload = t.step_func(function() { - if (!loaded) { - loaded = true; - iframe.reload(); - iframe.reload(); - } else { - t.done(); - } - }); - iframe.mozbrowser = true; - iframe.src = "about:blank"; -}); -</script> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_visibility.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_visibility.html deleted file mode 100644 index 8987998993c..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/iframe_visibility.html +++ /dev/null @@ -1,115 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<head> -<title>Iframe visibility tests</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -</head> -<body> - <script> - async_test(function(t) { - var expectedVisibilities = [false, true]; - var receivedVisibilities = []; - - var iframe = document.createElement("iframe"); - iframe.mozbrowser = true; - iframe.src = "helper.html"; - - //Alternate the iframe's visibility and fire mozbrowservisibilitychange - iframe.onload = t.step_func(function() { - iframe.setVisible(false); - iframe.setVisible(true); - }); - - iframe.addEventListener("mozbrowservisibilitychange", t.step_func(e => { - assert_equals(iframe.getVisible(), e.detail.visible); - receivedVisibilities.push(e.detail.visible); - if (receivedVisibilities.length == expectedVisibilities.length) { - assert_array_equals(receivedVisibilities, expectedVisibilities); - t.done(); - } - })); - - document.body.appendChild(iframe); - }, "Iframe visibility setter/getter"); - - async_test(function(t) { - var iframe = document.createElement("iframe"); - iframe.mozbrowser = true; - iframe.src = "helper.html"; - var start = null; - document.body.appendChild(iframe); - iframe.onload = t.step_func(function() { - var element = iframe.contentWindow.document.querySelector("p"); - var animationCompletesAfterResumingVisibility = false; - var nonVisibleAnimationStopped = false; - element.style.position = 'relative'; - element.style.right = "0px"; - var step = t.step_func(function(timestamp) { - if (!start) start = timestamp; - var progress = timestamp - start; - element.style.right = Math.min(progress/5, 100) + "px"; - if (progress < 500) { - iframe.contentWindow.requestAnimationFrame(step); - } - }); - - iframe.setVisible(false); - - iframe.contentWindow.setTimeout(t.step_func(function(){ - nonVisibleAnimationStopped = element.style.right === '0px'; - iframe.setVisible(true); - }),1000); - - iframe.contentWindow.setTimeout(t.step_func(function(){ - animationCompletesAfterResumingVisibility = element.style.right === '100px'; - assert_true(nonVisibleAnimationStopped); - assert_true(animationCompletesAfterResumingVisibility); - t.done(); - }),2000); - - iframe.contentWindow.requestAnimationFrame(step); - }); - }, 'Requesting animation frame composites only when frame is visible'); - - async_test(function(t) { - var iframe = document.createElement("iframe"); - iframe.src = "http://web-platform.test:8000/common/blank.html"; - iframe.mozbrowser = true; - iframe.onload = t.step_func(function() { - iframe.addEventListener("mozbrowservisibilitychange", t.step_func(function() { - var startTime = Date.now(); - iframe.contentWindow.setTimeout(t.step_func(function() { - assert_true(Date.now() - startTime >= 1000); - t.done(); - }), 1); - })); - iframe.setVisible(false); - }); - document.body.appendChild(iframe); - }, 'Minimum setTimeout of 1s when pipeline is invisible'); - - async_test(function(t) { - var iframe = document.createElement("iframe"); - var destination = "helper.html"; - iframe.src = "http://web-platform.test:8000/common/blank.html"; - iframe.mozbrowser = true; - iframe.onload = t.step_func(function() { - iframe.addEventListener("mozbrowservisibilitychange", t.step_func(function() { - iframe.src = destination; - })); - if (iframe.src !== destination) { - iframe.setVisible(false); - } else { - var startTime = Date.now(); - iframe.contentWindow.setTimeout(t.step_func(function() { - assert_true(Date.now() - startTime >= 1000); - t.done(); - }), 1); - } - }); - document.body.appendChild(iframe); - }, 'Minimum setTimeout of 1s persists after new page is loaded'); - - </script> -</body> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow.html deleted file mode 100644 index 60f4686c5a9..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow.html +++ /dev/null @@ -1,27 +0,0 @@ -<head> -<title>Browser API; mozbrowseropenwindow event</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -</head> -<body> -<script> - -async_test(function(t) { - - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = "mozbrowser_click_fires_openwindow_iframe1.html"; - - iframe.addEventListener("mozbrowseropenwindow", t.step_func(function(e) { - var expectedURL = new URL("mozbrowser_click_fires_openwindow_iframe3.html", window.location.href); - assert_equals(e.detail.target, "_blank"); - assert_equals(e.detail.url.toString(), expectedURL.toString()); - t.done(); - })); - - document.body.appendChild(iframe); - -}); - -</script> -</body> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe1.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe1.html deleted file mode 100644 index ed6fbe47a42..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe1.html +++ /dev/null @@ -1,8 +0,0 @@ -<html> - <body> - Frame 1: <a id="anchor" href="mozbrowser_click_fires_openwindow_iframe2.html">go</a>. - </body> - <script> - document.getElementById("anchor").click() - </script> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe2.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe2.html deleted file mode 100644 index 9f54b30db7c..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe2.html +++ /dev/null @@ -1,8 +0,0 @@ -<html> - <body> - Frame 2: <a id="anchor" href="mozbrowser_click_fires_openwindow_iframe3.html" target="_blank">go</a>. - </body> - <script> - document.getElementById("anchor").click() - </script> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe3.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe3.html deleted file mode 100644 index 9085a9f7348..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_click_fires_openwindow_iframe3.html +++ /dev/null @@ -1,5 +0,0 @@ -<html> - <body> - Frame 3. - </body> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_child.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_child.html deleted file mode 100644 index 92c1da900fd..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_child.html +++ /dev/null @@ -1,11 +0,0 @@ -<script src="mozbrowser_iframe_harness.js"></script> -<body> - <iframe src="mozbrowser_iframe_grandchild.html"></iframe> -</body> -<script> - send_test_results({ - "id": 'aaee4290-6a78-4932-a1d1-fbbe158fb473', - "parent": window.parent === window, - "top": window.top === window, - }); -</script> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_grandchild.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_grandchild.html deleted file mode 100644 index cca52b544ec..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_grandchild.html +++ /dev/null @@ -1,11 +0,0 @@ -<script src="mozbrowser_iframe_harness.js"></script> -<body> -</body> -<script> - send_test_results({ - "id": 'a94c0025-08dc-49a6-8f98-fbbaacfdd296', - "parent": window.parent !== window, - "grandparent": window.parent.parent === window.parent, - "top": window.top === window.parent, - }); -</script> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_harness.js b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_harness.js deleted file mode 100644 index f4ef511d1de..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_harness.js +++ /dev/null @@ -1,26 +0,0 @@ -function get_test_results(id) { - async_test(function(test) { - var timer = window.setInterval(test.step_func(loop), 100); - function loop() { - var xhr = new XMLHttpRequest(); - xhr.open('GET', 'stash.py?id=' + id); - xhr.onreadystatechange = test.step_func(function() { - assert_equals(xhr.status, 200); - if (xhr.responseText) { - assert_equals(xhr.responseText, "OK"); - test.done(); - window.clearTimeout(timer); - } - }); - xhr.send(); - } - }); -} - -function send_test_results(results) { - var ok = true; - for (result in results) { ok = ok && results[result]; } - var xhr = new XMLHttpRequest(); - xhr.open('POST', 'stash.py?id=' + results.id); - xhr.send(ok ? "OK" : "FAIL: " + JSON.stringify(results)); -} diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_parentage.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_parentage.html deleted file mode 100644 index 45610858ae0..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_iframe_parentage.html +++ /dev/null @@ -1,23 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>Check the frame heriarchy</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="mozbrowser_iframe_harness.js"></script> -<body> -</body> -<script> - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = "mozbrowser_iframe_child.html"; - document.body.appendChild(iframe); - - get_test_results('cdea5bf0-667e-407c-878c-6b5cfa623fd6'); - get_test_results('aaee4290-6a78-4932-a1d1-fbbe158fb473'); - get_test_results('a94c0025-08dc-49a6-8f98-fbbaacfdd296'); - send_test_results({ - "id": 'cdea5bf0-667e-407c-878c-6b5cfa623fd6', - "parent": window.parent === window, - "top": window.top === window, - }); -</script> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_loadevents.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_loadevents.html deleted file mode 100644 index 8992e7e743a..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowser_loadevents.html +++ /dev/null @@ -1,47 +0,0 @@ -<head> - <title>mozbrowserloadstart, mozbrowserconnected and mozbrowserloadend are dispatched</title> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> -</head> -<body> - <script> - - async_test(function(t) { - - var has_reloaded = false; - var expectedEvents = [ - "mozbrowserloadstart", - "mozbrowserconnected", - "mozbrowserloadend", - "mozbrowserloadstart", - "mozbrowserconnected", - "mozbrowserloadend", - ]; - - var receivedEvents = []; - - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = "http://web-platform.test:8000"; - - for (var event_name of ["mozbrowserloadstart", - "mozbrowserconnected", - "mozbrowserloadend"]) { - iframe.addEventListener(event_name, t.step_func(e => { - receivedEvents.push(e.type); - if (receivedEvents.length == expectedEvents.length) { - assert_array_equals(receivedEvents, expectedEvents); - t.done(); - } else { - if (e.type == "mozbrowserloadend") { - iframe.reload(); - } - } - })); - } - - document.body.appendChild(iframe); - }); - - </script> -</body> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsericonchange_event.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsericonchange_event.html deleted file mode 100644 index eea0b431928..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsericonchange_event.html +++ /dev/null @@ -1,51 +0,0 @@ -<head> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -</head> -<body> -<script> - -async_test(function(t) { - - var expectedEvents = [ - {rel: "icon", href: "http://web-platform.test:8000/test1.ico", sizes: "any"}, - {rel: "icon", href: "http://web-platform.test:8000/_mozilla/mozilla/mozbrowser/test2.ico", sizes: "16x16 24x24"}, - {rel: "shortcut icon", href: "http://example.com/test3.ico", sizes: ""}, - {rel: "apple-touch-icon", href: "http://web-platform.test:8000/test4.ico", sizes: ""}, - {rel: "icon", href: "http://web-platform.test:8000/test5.ico", sizes: ""}, - {rel: "icon", href: "http://web-platform.test:8000/test6.ico", sizes: "any"}, - {rel: "icon", href: "http://web-platform.test:8000/test6.ico", sizes: "32x32"}, - ]; - - var receivedEvents = []; - - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = "mozbrowsericonchange_event_test.html"; - - iframe.addEventListener("mozbrowsericonchange", t.step_func(e => { - - receivedEvents.push({ - rel: e.detail.rel, - href: e.detail.href, - sizes: e.detail.sizes, - }); - - if (receivedEvents.length == expectedEvents.length) { - for (var i = 0; i < expectedEvents.length; i++) { - var e1 = expectedEvents[i]; - var e2 = receivedEvents[i]; - assert_equals(e1.rel, e2.rel); - assert_equals(e1.href, e2.href); - assert_equals(e1.sizes, e2.sizes); - } - t.done(); - } - })); - - - document.body.appendChild(iframe); -}); - -</script> -</body> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsericonchange_event_test.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsericonchange_event_test.html deleted file mode 100644 index 6693605e1e8..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsericonchange_event_test.html +++ /dev/null @@ -1,22 +0,0 @@ -<html> - <head> - <link rel="icon" href="/test1.ico" sizes="any"> - <link rel="icon" href="./test2.ico" sizes="16x16 24x24"> - <link rel="shortcut icon" href="http://example.com/test3.ico"> - <link rel="not-icon" href="xxx"> - <link rel="icon no-href"> - <link rel="apple-touch-icon" href="/test4.ico"> - <script> - setTimeout(function() { - var link = document.createElement("link"); - link.rel = "icon"; - link.href = "/test5.ico" - document.head.appendChild(link); - link = document.querySelector('link[href="/test1.ico"]'); - link.href = "/test6.ico"; - setTimeout(() => link.setAttribute("sizes", "32x32"), 0); - }, 0); - </script> - </head> - <body>123</body> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowserlocationchange_event.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowserlocationchange_event.html deleted file mode 100644 index 30abe74b92e..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowserlocationchange_event.html +++ /dev/null @@ -1,75 +0,0 @@ -<head> -<title>Browser API; mozbrowserlocationchange event</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -</head> -<body> -<script> - -async_test(function(t) { - - var url1 = "data:,1"; - var url2 = "data:,2"; - var url3 = "data:,3"; - - var received_events = [] - var expected_events = [ - "about:blank", false, false, - url1, true, false, - url2, true, false, - url3, true, false, - url2, true, true, - url1, true, true, - "about:blank", false, true, - url1, true, true, - url2, true, true, - url3, true, false, - ]; - - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - - var actions = [ - function() {iframe.src = url1}, - function() {iframe.src = url2}, - function() {iframe.src = url3}, - function() {iframe.goBack()}, - function() {iframe.goBack()}, - function() {iframe.goBack()}, - function() {iframe.goForward()}, - function() {iframe.goForward()}, - function() {iframe.goForward()}, - ]; - - var action_idx = 0; - - iframe.addEventListener("mozbrowserlocationchange", t.step_func(e => { - received_events.push(e.detail.url); - received_events.push(e.detail.canGoBack); - received_events.push(e.detail.canGoForward); - - if (action_idx < actions.length) { - actions[action_idx++](); - } else { - assert_array_equals(received_events, expected_events); - t.done(); - } - })); - - document.body.appendChild(iframe); - -}); - -async_test(function(t) { - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = "mozbrowserlocationchange_event_iframe.html"; - iframe.addEventListener("mozbrowserlocationchange", t.step_func(function(e) { - var url = e.detail.url || e.detail.uri || e.detail; - var filename = url.split("/").pop(); - if (filename === "yes.html") { t.done(); } - })); - document.body.appendChild(iframe); -}); -</script> -</body> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowserlocationchange_event_iframe.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowserlocationchange_event_iframe.html deleted file mode 100644 index 11c18e4cd45..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowserlocationchange_event_iframe.html +++ /dev/null @@ -1,6 +0,0 @@ -<html> - <body></body> - <script> - window.location.assign("yes.html"); - </script> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsersecuritychange_event.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsersecuritychange_event.html deleted file mode 100644 index 8cf0cc402f8..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsersecuritychange_event.html +++ /dev/null @@ -1,46 +0,0 @@ -<head> - <title>mozbrowsersecuritychange event is dispatched when content security state changes</title> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> -</head> -<body> - <script> - - async_test(function(t) { - - const HTTP_URL = "http://web-platform.test:8000"; - const HTTPS_URL = "https://web-platform.test:8443"; - - var urls = [ HTTP_URL, HTTPS_URL, HTTP_URL ]; - var url_index = 0; - - var expectedEvents = [ - "insecure", - "secure", - "insecure", - ]; - - var receivedEvents = []; - - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = urls[url_index++]; - - iframe.addEventListener("mozbrowsersecuritychange", t.step_func(e => { - - receivedEvents.push(e.detail.state); - - if (receivedEvents.length == expectedEvents.length) { - assert_array_equals(receivedEvents, expectedEvents); - t.done(); - } else { - iframe.src = urls[url_index++]; - } - })); - - - document.body.appendChild(iframe); - }); - - </script> -</body> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html deleted file mode 100644 index ca63dad80cc..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event.html +++ /dev/null @@ -1,43 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>Dispatch mozbrowsershowmodalprompt event for alert (issue #8352)</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<body></body> -<script> - async_test(function(t) { - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = "mozbrowsershowmodalprompt_event_iframe.html"; - iframe.addEventListener("mozbrowsershowmodalprompt", t.step_func(e => { - assert_equals(e.detail.promptType, "alert"); - assert_equals(e.detail.message, "my alert message"); - t.done(); - })); - document.body.appendChild(iframe); - }); - - async_test(function(t) { - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = "mozbrowsershowmodalprompt_event_nested_iframe.html"; - iframe.addEventListener("mozbrowsershowmodalprompt", t.step_func(e => { - assert_equals(e.detail.promptType, "alert"); - assert_equals(e.detail.message, "my alert message"); - t.done(); - })); - document.body.appendChild(iframe); - }, "mozbrowsershowmodalprompt event from nested iframes triggering an alert"); - - async_test(function(t) { - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = "mozbrowsershowmodalprompt_event_no_params_alert.html"; - iframe.addEventListener("mozbrowsershowmodalprompt", t.step_func(e => { - assert_equals(e.detail.promptType, "alert"); - assert_equals(e.detail.message, ""); - t.done(); - })); - document.body.appendChild(iframe); - }, "Dispatch mozbrowsershowmodalprompt event for alert with no parameters"); -</script> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_iframe.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_iframe.html deleted file mode 100644 index e9e8e84be54..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_iframe.html +++ /dev/null @@ -1,6 +0,0 @@ -<html> - <body></body> - <script> - window.alert("my alert message"); - </script> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_nested_iframe.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_nested_iframe.html deleted file mode 100644 index 9d9efd7f922..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_nested_iframe.html +++ /dev/null @@ -1,5 +0,0 @@ -<html> - <body> - <iframe src="mozbrowsershowmodalprompt_event_iframe.html" /> - </body> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_no_params_alert.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_no_params_alert.html deleted file mode 100644 index f0a8adbd15e..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsershowmodalprompt_event_no_params_alert.html +++ /dev/null @@ -1,6 +0,0 @@ -<html> - <body></body> - <script> - window.alert(); - </script> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html deleted file mode 100644 index 4809f302f2f..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event.html +++ /dev/null @@ -1,19 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>Check if title_changed is too eager (issue #10782)</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<body></body> -<script> - async_test(function(t) { - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = "mozbrowsertitlechangedeagerly_event_iframe.html"; - iframe.addEventListener("mozbrowsertitlechange", t.step_func(e => { - assert_equals(e.type, "mozbrowsertitlechange"); - assert_not_equals(e.detail, "Bar"); - })); - iframe.addEventListener("load", t.step_func_done()); - document.body.appendChild(iframe); - }); -</script> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event_iframe.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event_iframe.html deleted file mode 100644 index b10a632092a..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/mozbrowsertitlechangedeagerly_event_iframe.html +++ /dev/null @@ -1,16 +0,0 @@ -<html> - <head> - <title>Foo</title> - <script> - var text = - '<html xmlns="http://www.w3.org/1999/xhtml">' + - ' <head>' + - ' <title>Bar</title>' + - ' </head>' + - '</html>'; - var parser = new DOMParser(); - var doc = parser.parseFromString(text, "text/xml"); - </script> - </head> - <body>Hello world</body> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/private_browsing.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/private_browsing.html deleted file mode 100644 index 7510998625f..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/private_browsing.html +++ /dev/null @@ -1,44 +0,0 @@ -<head> - <meta charset="utf8" /> - <title>Private browsing</title> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> -</head> -<body> - <script> - async_test(function(t) { - var privateFrame = document.createElement("iframe"); - privateFrame.mozbrowser = true; - privateFrame.mozprivatebrowsing = true; - - var gotGrandchildResult = false; - privateFrame.addEventListener("mozbrowsershowmodalprompt", t.step_func(e => { - assert_equals(e.detail.message, 'private=active private=active'); - gotGrandchildResult = true; - })); - - privateFrame.onload = t.step_func(function() { - assert_true(gotGrandchildResult); - - var parent = privateFrame.parentNode; - parent.removeChild(privateFrame); - - var iframe = document.createElement("iframe"); - var promptDisplay = false; - iframe.mozbrowser = true; - iframe.onload = t.step_func(function() { - assert_true(promptDisplay); - t.done(); - }); - iframe.addEventListener("mozbrowsershowmodalprompt", t.step_func(e => { - promptDisplay = true; - assert_equals(e.detail.message, ""); - })); - iframe.src = "iframe_contentDocument_inner.html"; - parent.appendChild(iframe); - }); - privateFrame.src = "iframe_privateContent_inner.html"; - document.body.appendChild(privateFrame); - }); - </script> -</body> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect.html deleted file mode 100644 index 7c807556826..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect.html +++ /dev/null @@ -1,26 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>mozbrowserlocationchange with final url after redirect</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<body></body> -<script> - async_test(function(t) { - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = "redirect_init.html?pipe=status(302)|header(Location,redirect_final.html)"; - var i = 0; - iframe.addEventListener("mozbrowserlocationchange", t.step_func(e => { - switch (++i) { - case 1: - assert_equals(e.detail.url, "about:blank"); - break; - case 2: - assert_equals(e.detail.url, new URL("redirect_final.html", location).href); - t.done(); - break; - } - })); - document.body.appendChild(iframe); - }); -</script> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_final.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_final.html deleted file mode 100644 index cd059ad53fc..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_final.html +++ /dev/null @@ -1 +0,0 @@ -<h1>redirect_final</h1> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_init.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_init.html deleted file mode 100644 index f6c7e1d9df5..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/redirect_init.html +++ /dev/null @@ -1 +0,0 @@ -<h1>redirect_init</h1> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/reload.html b/tests/wpt/mozilla/tests/mozilla/mozbrowser/reload.html deleted file mode 100644 index 7dea32d3730..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/reload.html +++ /dev/null @@ -1,35 +0,0 @@ -<head> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -</head> -<body> -<script> - -async_test(function(t) { - - const SRC = "data:,foobar"; - const RELOAD_MAX_COUNT = 5; - - - var iframe = document.createElement("iframe"); - iframe.mozbrowser = "true"; - iframe.src = SRC; - - var reload_count = 0; - - iframe.addEventListener("mozbrowserloadend", t.step_func(e => { - reload_count++; - assert_equals(SRC, e.target.src); - if (reload_count == RELOAD_MAX_COUNT) { - t.done(); - } else { - iframe.reload(); - } - })); - - - document.body.appendChild(iframe); -}); - -</script> -</body> diff --git a/tests/wpt/mozilla/tests/mozilla/mozbrowser/stash.py b/tests/wpt/mozilla/tests/mozilla/mozbrowser/stash.py deleted file mode 100644 index 0b8693a9011..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/mozbrowser/stash.py +++ /dev/null @@ -1,10 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# 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/. - - -def main(request, response): - if request.method == 'POST': - request.server.stash.put(request.GET["id"], request.body) - return '' - return request.server.stash.take(request.GET["id"]) |