aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/globalscope.rs
diff options
context:
space:
mode:
authorgatowololo <gatowololo@gmail.com>2019-06-27 10:23:52 -0700
committerIulian Gabriel Radu <iulian.radu67@gmail.com>2020-02-27 00:02:04 +0200
commit24c14ac94ea53e93ce700ebe1c463fb8f049b54c (patch)
tree7a0d2005829a2ff8fb7074c8397461e6b7ec79b7 /components/script/dom/globalscope.rs
parentad9bfc2a62b70b9f3dbb1c3a5969f30bacce3d74 (diff)
downloadservo-24c14ac94ea53e93ce700ebe1c463fb8f049b54c.tar.gz
servo-24c14ac94ea53e93ce700ebe1c463fb8f049b54c.zip
Factored out permission_state_invocation_results API to GlobalScope
Instead of Window
Diffstat (limited to 'components/script/dom/globalscope.rs')
-rw-r--r--components/script/dom/globalscope.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs
index d86104c1ee6..e631c9bfc9c 100644
--- a/components/script/dom/globalscope.rs
+++ b/components/script/dom/globalscope.rs
@@ -5,6 +5,7 @@
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BroadcastChannelBinding::BroadcastChannelMethods;
use crate::dom::bindings::codegen::Bindings::EventSourceBinding::EventSourceBinding::EventSourceMethods;
+use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionState;
use crate::dom::bindings::codegen::Bindings::VoidFunctionBinding::VoidFunction;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use crate::dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScopeMethods;
@@ -189,6 +190,9 @@ pub struct GlobalScope {
/// The origin of the globalscope
origin: MutableOrigin,
+ /// A map for storing the previous permission state read results.
+ permission_state_invocation_results: DomRefCell<HashMap<String, PermissionState>>,
+
/// The microtask queue associated with this global.
///
/// It is refcounted because windows in the same script thread share the
@@ -575,6 +579,7 @@ impl GlobalScope {
timers: OneshotTimers::new(scheduler_chan),
init_timers: Default::default(),
origin,
+ permission_state_invocation_results: Default::default(),
microtask_queue,
list_auto_close_worker: Default::default(),
event_source_tracker: DOMTracker::new(),
@@ -1701,6 +1706,12 @@ impl GlobalScope {
}
}
+ pub fn permission_state_invocation_results(
+ &self,
+ ) -> &DomRefCell<HashMap<String, PermissionState>> {
+ &self.permission_state_invocation_results
+ }
+
pub fn track_worker(&self, closing_worker: Arc<AtomicBool>) {
self.list_auto_close_worker
.borrow_mut()