Implement a stub Worker interface.

Part of #2811.
This commit is contained in:
Ms2ger 2014-06-22 18:07:14 +02:00
parent d97ec69957
commit 712955e96a
4 changed files with 53 additions and 0 deletions

View 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;

View 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()
}
}

View file

@ -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;

View file

@ -155,6 +155,7 @@ var interfaceNamesInGlobalScope = [
"URLSearchParams",
"ValidityState",
"Window",
"Worker",
"XMLHttpRequest",
"XMLHttpRequestUpload",
];