mirror of
https://github.com/servo/servo.git
synced 2025-06-13 19:04:30 +00:00
parent
d97ec69957
commit
712955e96a
4 changed files with 53 additions and 0 deletions
20
src/components/script/dom/webidls/Worker.webidl
Normal file
20
src/components/script/dom/webidls/Worker.webidl
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
// http://www.whatwg.org/html/#abstractworker
|
||||
[NoInterfaceObject/*, Exposed=Window,Worker*/]
|
||||
interface AbstractWorker {
|
||||
// attribute EventHandler onerror;
|
||||
};
|
||||
|
||||
// http://www.whatwg.org/html/#worker
|
||||
[Constructor(DOMString scriptURL)/*, Exposed=Window,Worker*/]
|
||||
interface Worker : EventTarget {
|
||||
//void terminate();
|
||||
|
||||
//void postMessage(any message/*, optional sequence<Transferable> transfer*/);
|
||||
// attribute EventHandler onmessage;
|
||||
};
|
||||
Worker implements AbstractWorker;
|
31
src/components/script/dom/worker.rs
Normal file
31
src/components/script/dom/worker.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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::global::GlobalRef;
|
||||
use dom::bindings::js::Temporary;
|
||||
use dom::bindings::utils::{Reflectable, Reflector};
|
||||
use dom::eventtarget::EventTarget;
|
||||
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct Worker {
|
||||
eventtarget: EventTarget,
|
||||
}
|
||||
|
||||
impl Worker {
|
||||
pub fn Constructor(_global: &GlobalRef, _scriptURL: DOMString) -> Fallible<Temporary<Worker>> {
|
||||
Err(Security)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait WorkerMethods {
|
||||
}
|
||||
|
||||
impl Reflectable for Worker {
|
||||
fn reflector<'a>(&'a self) -> &'a Reflector {
|
||||
self.eventtarget.reflector()
|
||||
}
|
||||
}
|
|
@ -173,6 +173,7 @@ pub mod dom {
|
|||
pub mod validitystate;
|
||||
pub mod virtualmethods;
|
||||
pub mod window;
|
||||
pub mod worker;
|
||||
pub mod xmlhttprequest;
|
||||
pub mod xmlhttprequesteventtarget;
|
||||
pub mod xmlhttprequestupload;
|
||||
|
|
|
@ -155,6 +155,7 @@ var interfaceNamesInGlobalScope = [
|
|||
"URLSearchParams",
|
||||
"ValidityState",
|
||||
"Window",
|
||||
"Worker",
|
||||
"XMLHttpRequest",
|
||||
"XMLHttpRequestUpload",
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue