diff --git a/src/components/script/dom/worker.rs b/src/components/script/dom/worker.rs index 6c79525a139..5a62f1c37f4 100644 --- a/src/components/script/dom/worker.rs +++ b/src/components/script/dom/worker.rs @@ -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> { + pub fn Constructor(global: &GlobalRef, scriptURL: DOMString) -> Fallible> { + // 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) } }