mirror of
https://github.com/servo/servo.git
synced 2025-06-26 01:54:33 +01:00
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.
This commit is contained in:
parent
377a76ab1b
commit
1cd5d9179d
3 changed files with 24 additions and 68 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue