Implement the incumbent global.

Fixes #10963.
This commit is contained in:
Ms2ger 2017-01-05 16:22:44 +01:00
parent 933b74781b
commit 51df04d93e
7 changed files with 152 additions and 5 deletions

View file

@ -10,7 +10,7 @@ use dom::bindings::error::{ErrorInfo, report_pending_exception};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::DomObject;
use dom::bindings::settings_stack::{AutoEntryScript, entry_global};
use dom::bindings::settings_stack::{AutoEntryScript, entry_global, incumbent_global};
use dom::bindings::str::DOMString;
use dom::crypto::Crypto;
use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope;
@ -528,6 +528,13 @@ impl GlobalScope {
pub fn entry() -> Root<Self> {
entry_global()
}
/// Returns the ["incumbent"] global object.
///
/// ["incumbent"]: https://html.spec.whatwg.org/multipage/#incumbent
pub fn incumbent() -> Option<Root<Self>> {
incumbent_global()
}
}
fn timestamp_in_ms(time: Timespec) -> u64 {