mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Stub out Trusted Types interfaces (#36355)
Some methods are implemented fully, while others are implemented partly. With these implementations, there are no observed crashes when running the trusted-types web-platform-tests. Most notably, the tests/wpt/tests/trusted-types/idlharness.window.js is now fully passing. Part of #36258 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
parent
3f24b44e15
commit
b87bf0b806
145 changed files with 3377 additions and 559 deletions
|
@ -145,6 +145,7 @@ use crate::dom::selection::Selection;
|
|||
use crate::dom::storage::Storage;
|
||||
#[cfg(feature = "bluetooth")]
|
||||
use crate::dom::testrunner::TestRunner;
|
||||
use crate::dom::trustedtypepolicyfactory::TrustedTypePolicyFactory;
|
||||
use crate::dom::types::UIEvent;
|
||||
use crate::dom::webglrenderingcontext::WebGLCommandSender;
|
||||
#[cfg(feature = "webgpu")]
|
||||
|
@ -247,6 +248,7 @@ pub(crate) struct Window {
|
|||
session_storage: MutNullableDom<Storage>,
|
||||
local_storage: MutNullableDom<Storage>,
|
||||
status: DomRefCell<DOMString>,
|
||||
trusted_types: MutNullableDom<TrustedTypePolicyFactory>,
|
||||
|
||||
/// For sending timeline markers. Will be ignored if
|
||||
/// no devtools server
|
||||
|
@ -1696,6 +1698,11 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
|
|||
self.as_global_scope()
|
||||
.structured_clone(cx, value, options, retval)
|
||||
}
|
||||
|
||||
fn TrustedTypes(&self, can_gc: CanGc) -> DomRoot<TrustedTypePolicyFactory> {
|
||||
self.trusted_types
|
||||
.or_init(|| TrustedTypePolicyFactory::new(self.as_global_scope(), can_gc))
|
||||
}
|
||||
}
|
||||
|
||||
impl Window {
|
||||
|
@ -2922,6 +2929,7 @@ impl Window {
|
|||
layout_marker: DomRefCell::new(Rc::new(Cell::new(true))),
|
||||
current_event: DomRefCell::new(None),
|
||||
theme: Cell::new(PrefersColorScheme::Light),
|
||||
trusted_types: Default::default(),
|
||||
});
|
||||
|
||||
unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue