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
|
@ -125,6 +125,7 @@ use crate::dom::promise::Promise;
|
|||
use crate::dom::readablestream::ReadableStream;
|
||||
use crate::dom::serviceworker::ServiceWorker;
|
||||
use crate::dom::serviceworkerregistration::ServiceWorkerRegistration;
|
||||
use crate::dom::trustedtypepolicyfactory::TrustedTypePolicyFactory;
|
||||
use crate::dom::underlyingsourcecontainer::UnderlyingSourceType;
|
||||
#[cfg(feature = "webgpu")]
|
||||
use crate::dom::webgpu::gpudevice::GPUDevice;
|
||||
|
@ -3300,6 +3301,16 @@ impl GlobalScope {
|
|||
.borrow_mut()
|
||||
.remove(&callback_id)
|
||||
}
|
||||
|
||||
pub(crate) fn trusted_types(&self, can_gc: CanGc) -> DomRoot<TrustedTypePolicyFactory> {
|
||||
if let Some(window) = self.downcast::<Window>() {
|
||||
return window.TrustedTypes(can_gc);
|
||||
}
|
||||
if let Some(worker) = self.downcast::<WorkerGlobalScope>() {
|
||||
return worker.TrustedTypes(can_gc);
|
||||
}
|
||||
unreachable!();
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the Rust global scope from a JS global object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue