mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Parse the URL passed to the Worker constructor.
This commit is contained in:
parent
d8152646f3
commit
25abe8b289
1 changed files with 9 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue