aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeegan McAllister <kmcallister@mozilla.com>2013-10-16 16:32:08 -0700
committerKeegan McAllister <kmcallister@mozilla.com>2013-10-17 19:28:43 -0700
commit1cd5d9179d88a55f0f49da3cdf42e687115b0a0d (patch)
tree5b17b0420528e9bc4b8725e9ff9707f2c6a9a836 /src
parent377a76ab1b1eacec707c360f41ea2408ce4a5c4b (diff)
downloadservo-1cd5d9179d88a55f0f49da3cdf42e687115b0a0d.tar.gz
servo-1cd5d9179d88a55f0f49da3cdf42e687115b0a0d.zip
Remove special-casing of URLs ending in ".js"
This was a very old (May 2012) testing feature which used std::io::read_whole_file rather than our normal resource-loader mechanism. We can implement javascript: URLs later.
Diffstat (limited to 'src')
-rw-r--r--src/components/main/constellation.rs58
-rw-r--r--src/components/main/pipeline.rs7
-rw-r--r--src/components/script/script_task.rs27
3 files changed, 24 insertions, 68 deletions
diff --git a/src/components/main/constellation.rs b/src/components/main/constellation.rs
index a7e06dd4a17..3e3b2e969ab 100644
--- a/src/components/main/constellation.rs
+++ b/src/components/main/constellation.rs
@@ -16,7 +16,7 @@ use servo_msg::constellation_msg::{IFrameSandboxState, InitLoadUrlMsg, LoadIfram
use servo_msg::constellation_msg::{Msg, NavigateMsg, NavigationType, IFrameUnsandboxed};
use servo_msg::constellation_msg::{PipelineId, RendererReadyMsg, ResizedWindowMsg, SubpageId};
use servo_msg::constellation_msg;
-use script::script_task::{ResizeMsg, ResizeInactiveMsg, ExecuteMsg};
+use script::script_task::{ResizeMsg, ResizeInactiveMsg};
use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use servo_net::resource_task::ResourceTask;
use servo_net::resource_task;
@@ -404,21 +404,17 @@ impl Constellation {
let size = self.compositor_chan.get_size();
from_value(Size2D(size.width as uint, size.height as uint))
});
- if url.path.ends_with(".js") {
- pipeline.script_chan.send(ExecuteMsg(pipeline.id, url));
- } else {
- pipeline.load(url);
+ pipeline.load(url);
- self.pending_frames.push(FrameChange{
- before: None,
- after: @mut FrameTree {
- pipeline: pipeline,
- parent: None,
- children: ~[],
- },
- navigation_type: constellation_msg::Load,
- });
- }
+ self.pending_frames.push(FrameChange{
+ before: None,
+ after: @mut FrameTree {
+ pipeline: pipeline,
+ parent: None,
+ children: ~[],
+ },
+ navigation_type: constellation_msg::Load,
+ });
self.pipelines.insert(pipeline.id, pipeline);
}
@@ -549,12 +545,8 @@ impl Constellation {
size_future)
};
- if url.path.ends_with(".js") {
- pipeline.execute(url);
- } else {
- debug!("Constellation: sending load msg to pipeline %?", pipeline.id);
- pipeline.load(url);
- }
+ debug!("Constellation: sending load msg to pipeline %?", pipeline.id);
+ pipeline.load(url);
let rect = self.pending_sizes.pop(&(source_pipeline_id, subpage_id));
for frame_tree in frame_trees.iter() {
frame_tree.children.push(ChildFrameTree {
@@ -606,21 +598,17 @@ impl Constellation {
self.opts.clone(),
size_future);
- if url.path.ends_with(".js") {
- pipeline.script_chan.send(ExecuteMsg(pipeline.id, url));
- } else {
- pipeline.load(url);
+ pipeline.load(url);
- self.pending_frames.push(FrameChange{
- before: Some(source_id),
- after: @mut FrameTree {
- pipeline: pipeline,
- parent: parent,
- children: ~[],
- },
- navigation_type: constellation_msg::Load,
- });
- }
+ self.pending_frames.push(FrameChange{
+ before: Some(source_id),
+ after: @mut FrameTree {
+ pipeline: pipeline,
+ parent: parent,
+ children: ~[],
+ },
+ navigation_type: constellation_msg::Load,
+ });
self.pipelines.insert(pipeline.id, pipeline);
}
diff --git a/src/components/main/pipeline.rs b/src/components/main/pipeline.rs
index 1f7dbb8eef9..12b301a4c68 100644
--- a/src/components/main/pipeline.rs
+++ b/src/components/main/pipeline.rs
@@ -9,7 +9,7 @@ use gfx::render_task::{PaintPermissionGranted, PaintPermissionRevoked};
use gfx::opts::Opts;
use layout::layout_task::LayoutTask;
use script::layout_interface::LayoutChan;
-use script::script_task::{ExecuteMsg, LoadMsg};
+use script::script_task::LoadMsg;
use servo_msg::constellation_msg::{ConstellationChan, FailureMsg, PipelineId, SubpageId};
use script::dom::node::AbstractNode;
use script::script_task::{AttachLayoutMsg, NewLayoutInfo, ScriptTask, ScriptChan};
@@ -194,11 +194,6 @@ impl Pipeline {
self.script_chan.send(LoadMsg(self.id, url));
}
- pub fn execute(&mut self, url: Url) {
- self.url = Some(url.clone());
- self.script_chan.send(ExecuteMsg(self.id, url));
- }
-
pub fn grant_paint_permission(&self) {
self.render_chan.try_send(PaintPermissionGranted);
}
diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs
index 9a729ba2970..e025fdfc5d5 100644
--- a/src/components/script/script_task.rs
+++ b/src/components/script/script_task.rs
@@ -28,9 +28,7 @@ use servo_msg::constellation_msg;
use std::cell::Cell;
use std::comm;
use std::comm::{Port, SharedChan};
-use std::io::read_whole_file;
use std::ptr;
-use std::str;
use std::task::{spawn_sched, SingleThreaded};
use std::util::replace;
use dom::window::TimerData;
@@ -58,8 +56,6 @@ pub enum ScriptMsg {
LoadMsg(PipelineId, Url),
/// Gives a channel and ID to a layout task, as well as the ID of that layout's parent
AttachLayoutMsg(NewLayoutInfo),
- /// Executes a standalone script.
- ExecuteMsg(PipelineId, Url),
/// Instructs the script task to send a navigate message to the constellation.
NavigateMsg(NavigationDirection),
/// Sends a DOM event.
@@ -533,7 +529,6 @@ impl ScriptTask {
// TODO(tkuehn) need to handle auxiliary layouts for iframes
AttachLayoutMsg(new_layout_info) => self.handle_new_layout(new_layout_info),
LoadMsg(id, url) => self.load(id, url),
- ExecuteMsg(id, url) => self.handle_execute_msg(id, url),
SendEventMsg(id, event) => self.handle_event(id, event),
FireTimerMsg(id, timer_data) => self.handle_fire_timer_msg(id, timer_data),
NavigateMsg(direction) => self.handle_navigate_msg(direction),
@@ -564,28 +559,6 @@ impl ScriptTask {
parent_page_tree.inner.push(new_page_tree);
}
- /// Handles a request to execute a script.
- fn handle_execute_msg(&mut self, id: PipelineId, url: Url) {
- debug!("script: Received url `%s` to execute", url.to_str());
-
- let page_tree = self.page_tree.find(id).expect("ScriptTask: received fire timer msg for a
- pipeline ID not associated with this script task. This is a bug.");
- let compartment = page_tree.page.js_info.get_ref().js_compartment;
- let cx = page_tree.page.js_info.get_ref().js_context;
-
- match read_whole_file(&Path(url.path)) {
- Err(msg) => println(fmt!("Error opening %s: %s", url.to_str(), msg)),
-
- Ok(bytes) => {
- compartment.define_functions(debug_fns);
- cx.evaluate_script(compartment.global_obj,
- str::from_utf8(bytes),
- url.path.clone(),
- 1);
- }
- }
- }
-
/// Handles a timer that fired.
#[fixed_stack_segment]
fn handle_fire_timer_msg(&mut self, id: PipelineId, timer_data: ~TimerData) {