mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implement stub classes for WorkerGlobalScope and DedicatedWorkerGlobalScope.
Part of #2811.
This commit is contained in:
parent
712955e96a
commit
a345f413cb
8 changed files with 104 additions and 0 deletions
|
@ -15,6 +15,9 @@
|
|||
|
||||
DOMInterfaces = {
|
||||
|
||||
'DedicatedWorkerGlobalScope': {
|
||||
'createGlobal': True,
|
||||
},
|
||||
'EventListener': {
|
||||
'nativeType': 'EventListenerBinding::EventListener',
|
||||
},
|
||||
|
|
33
src/components/script/dom/dedicatedworkerglobalscope.rs
Normal file
33
src/components/script/dom/dedicatedworkerglobalscope.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* 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::codegen::InheritTypes::DedicatedWorkerGlobalScopeDerived;
|
||||
use dom::bindings::utils::{Reflectable, Reflector};
|
||||
use dom::eventtarget::EventTarget;
|
||||
use dom::eventtarget::WorkerGlobalScopeTypeId;
|
||||
use dom::workerglobalscope::DedicatedGlobalScope;
|
||||
use dom::workerglobalscope::WorkerGlobalScope;
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct DedicatedWorkerGlobalScope {
|
||||
workerglobalscope: WorkerGlobalScope,
|
||||
}
|
||||
|
||||
pub trait DedicatedWorkerGlobalScopeMethods {
|
||||
}
|
||||
|
||||
impl Reflectable for DedicatedWorkerGlobalScope {
|
||||
fn reflector<'a>(&'a self) -> &'a Reflector {
|
||||
self.workerglobalscope.reflector()
|
||||
}
|
||||
}
|
||||
|
||||
impl DedicatedWorkerGlobalScopeDerived for EventTarget {
|
||||
fn is_dedicatedworkerglobalscope(&self) -> bool {
|
||||
match self.type_id {
|
||||
WorkerGlobalScopeTypeId(DedicatedGlobalScope) => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ use dom::bindings::utils::{Reflectable, Reflector};
|
|||
use dom::event::Event;
|
||||
use dom::eventdispatcher::dispatch_event;
|
||||
use dom::node::NodeTypeId;
|
||||
use dom::workerglobalscope::WorkerGlobalScopeId;
|
||||
use dom::xmlhttprequest::XMLHttpRequestId;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use js::jsapi::{JS_CompileUCFunction, JS_GetFunctionObject, JS_CloneFunctionObject};
|
||||
|
@ -34,6 +35,7 @@ pub enum ListenerPhase {
|
|||
pub enum EventTargetTypeId {
|
||||
NodeTargetTypeId(NodeTypeId),
|
||||
WindowTypeId,
|
||||
WorkerGlobalScopeTypeId(WorkerGlobalScopeId),
|
||||
XMLHttpRequestTargetTypeId(XMLHttpRequestId)
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
/* 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/#dedicatedworkerglobalscope
|
||||
[Global/*=Worker,DedicatedWorker*/]
|
||||
/*sealed*/ interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
|
||||
//void postMessage(any message, optional sequence<Transferable> transfer);
|
||||
// attribute EventHandler onmessage;
|
||||
};
|
27
src/components/script/dom/webidls/WorkerGlobalScope.webidl
Normal file
27
src/components/script/dom/webidls/WorkerGlobalScope.webidl
Normal file
|
@ -0,0 +1,27 @@
|
|||
/* 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/#workerglobalscope
|
||||
//[Exposed=Worker]
|
||||
interface WorkerGlobalScope : EventTarget {
|
||||
//readonly attribute WorkerGlobalScope self;
|
||||
//readonly attribute WorkerLocation location;
|
||||
|
||||
//void close();
|
||||
// attribute OnErrorEventHandler onerror;
|
||||
// attribute EventHandler onlanguagechange;
|
||||
// attribute EventHandler onoffline;
|
||||
// attribute EventHandler ononline;
|
||||
|
||||
// also has obsolete members
|
||||
};
|
||||
|
||||
// http://www.whatwg.org/html/#WorkerGlobalScope-partial
|
||||
//[Exposed=Worker]
|
||||
partial interface WorkerGlobalScope {
|
||||
//void importScripts(DOMString... urls);
|
||||
//readonly attribute WorkerNavigator navigator;
|
||||
};
|
||||
//WorkerGlobalScope implements WindowTimers;
|
||||
//WorkerGlobalScope implements WindowBase64;
|
25
src/components/script/dom/workerglobalscope.rs
Normal file
25
src/components/script/dom/workerglobalscope.rs
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* 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::utils::{Reflectable, Reflector};
|
||||
use dom::eventtarget::EventTarget;
|
||||
|
||||
#[deriving(PartialEq,Encodable)]
|
||||
pub enum WorkerGlobalScopeId {
|
||||
DedicatedGlobalScope,
|
||||
}
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct WorkerGlobalScope {
|
||||
pub eventtarget: EventTarget,
|
||||
}
|
||||
|
||||
pub trait WorkerGlobalScopeMethods {
|
||||
}
|
||||
|
||||
impl Reflectable for WorkerGlobalScope {
|
||||
fn reflector<'a>(&'a self) -> &'a Reflector {
|
||||
self.eventtarget.reflector()
|
||||
}
|
||||
}
|
|
@ -75,6 +75,7 @@ pub mod dom {
|
|||
pub mod comment;
|
||||
pub mod console;
|
||||
pub mod customevent;
|
||||
pub mod dedicatedworkerglobalscope;
|
||||
pub mod document;
|
||||
pub mod documentfragment;
|
||||
pub mod documenttype;
|
||||
|
@ -174,6 +175,7 @@ pub mod dom {
|
|||
pub mod virtualmethods;
|
||||
pub mod window;
|
||||
pub mod worker;
|
||||
pub mod workerglobalscope;
|
||||
pub mod xmlhttprequest;
|
||||
pub mod xmlhttprequesteventtarget;
|
||||
pub mod xmlhttprequestupload;
|
||||
|
|
|
@ -59,6 +59,7 @@ var interfaceNamesInGlobalScope = [
|
|||
"Comment",
|
||||
"Console",
|
||||
"CustomEvent",
|
||||
"DedicatedWorkerGlobalScope", // #2823
|
||||
"Document",
|
||||
"DocumentFragment",
|
||||
"DocumentType",
|
||||
|
@ -156,6 +157,7 @@ var interfaceNamesInGlobalScope = [
|
|||
"ValidityState",
|
||||
"Window",
|
||||
"Worker",
|
||||
"WorkerGlobalScope", // #2823
|
||||
"XMLHttpRequest",
|
||||
"XMLHttpRequestUpload",
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue