aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r--components/script/dom/bindings/principals.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/components/script/dom/bindings/principals.rs b/components/script/dom/bindings/principals.rs
index b16bc8859db..d693c52d01e 100644
--- a/components/script/dom/bindings/principals.rs
+++ b/components/script/dom/bindings/principals.rs
@@ -131,9 +131,13 @@ unsafe extern "C" fn principals_is_system_or_addon_principal(_: *mut JSPrincipal
//TODO is same_origin_domain equivalent to subsumes for our purposes
pub unsafe extern "C" fn subsumes(obj: *mut JSPrincipals, other: *mut JSPrincipals) -> bool {
- let obj = ServoJSPrincipalsRef::from_raw_unchecked(obj);
- let other = ServoJSPrincipalsRef::from_raw_unchecked(other);
- let obj_origin = obj.origin();
- let other_origin = other.origin();
- obj_origin.same_origin_domain(&other_origin)
+ if let (Some(obj), Some(other)) = (NonNull::new(obj), NonNull::new(other)) {
+ let obj = ServoJSPrincipalsRef::from_raw_nonnull(obj);
+ let other = ServoJSPrincipalsRef::from_raw_nonnull(other);
+ let obj_origin = obj.origin();
+ let other_origin = other.origin();
+ obj_origin.same_origin_domain(&other_origin)
+ } else {
+ false
+ }
}