Skip to content

Commit

Permalink
make Opts.url an Option<> type, only emit initial url load if url exists
Browse files Browse the repository at this point in the history
this is a necessary change for embedded apps to prevent an initial about:blank
page load from overwriting whatever the app was actually trying to load
  • Loading branch information
Mike Blumenkrantz committed May 27, 2015
1 parent fcf4495 commit b1ae5e7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
11 changes: 7 additions & 4 deletions components/servo/lib.rs
Expand Up @@ -168,10 +168,13 @@ fn create_constellation(opts: opts::Opts,
storage_task);

// Send the URL command to the constellation.
{
let ConstellationChan(ref chan) = constellation_chan;
chan.send(ConstellationMsg::InitLoadUrl(opts.url.clone())).unwrap();
}
match opts.url {
Some(url) => {
let ConstellationChan(ref chan) = constellation_chan;
chan.send(ConstellationMsg::InitLoadUrl(url.clone())).unwrap();
},
None => ()
};

constellation_chan
}
6 changes: 3 additions & 3 deletions components/util/opts.rs
Expand Up @@ -24,7 +24,7 @@ use url::{self, Url};
#[derive(Clone)]
pub struct Opts {
/// The initial URL to load.
pub url: Url,
pub url: Option<Url>,

/// How many threads to use for CPU painting (`-t`).
///
Expand Down Expand Up @@ -198,7 +198,7 @@ static FORCE_CPU_PAINTING: bool = false;

pub fn default_opts() -> Opts {
Opts {
url: Url::parse("about:blank").unwrap(),
url: Some(Url::parse("about:blank").unwrap()),
paint_threads: 1,
gpu_painting: false,
tile_size: 512,
Expand Down Expand Up @@ -370,7 +370,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
};

let opts = Opts {
url: url,
url: Some(url),
paint_threads: paint_threads,
gpu_painting: gpu_painting,
tile_size: tile_size,
Expand Down
1 change: 1 addition & 0 deletions ports/cef/core.rs
Expand Up @@ -74,6 +74,7 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
temp_opts.hard_fail = false;
temp_opts.enable_text_antialiasing = true;
temp_opts.resources_path = None;
temp_opts.url = None;
opts::set(temp_opts);

if unsafe { (*settings).windowless_rendering_enabled != 0 } {
Expand Down

0 comments on commit b1ae5e7

Please sign in to comment.