Parse the URL passed to the Worker constructor.

This commit is contained in:
Ms2ger 2014-07-13 18:15:24 +02:00
parent d8152646f3
commit 25abe8b289

View file

@ -2,13 +2,14 @@
* 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::error::{Fallible, Security};
use dom::bindings::error::{Fallible, Security, Syntax};
use dom::bindings::global::GlobalRef;
use dom::bindings::js::Temporary;
use dom::bindings::utils::{Reflectable, Reflector};
use dom::eventtarget::EventTarget;
use servo_util::str::DOMString;
use servo_util::url::try_parse_url;
#[deriving(Encodable)]
pub struct Worker {
@ -16,7 +17,13 @@ pub struct Worker {
}
impl Worker {
pub fn Constructor(_global: &GlobalRef, _scriptURL: DOMString) -> Fallible<Temporary<Worker>> {
pub fn Constructor(global: &GlobalRef, scriptURL: DOMString) -> Fallible<Temporary<Worker>> {
// Step 2-4.
let _worker_url = match try_parse_url(scriptURL.as_slice(), Some(global.get_url())) {
Ok(url) => url,
Err(_) => return Err(Syntax),
};
Err(Security)
}
}