mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
refactor(script): rename ServoJSPrincipal
to ServoJSPrincipals
This commit is contained in:
parent
320965bfb9
commit
b77ee8721b
2 changed files with 6 additions and 6 deletions
|
@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::PrototypeList;
|
|||
use crate::dom::bindings::constant::{define_constants, ConstantSpec};
|
||||
use crate::dom::bindings::conversions::{get_dom_class, DOM_OBJECT_SLOT};
|
||||
use crate::dom::bindings::guard::Guard;
|
||||
use crate::dom::bindings::principals::ServoJSPrincipal;
|
||||
use crate::dom::bindings::principals::ServoJSPrincipals;
|
||||
use crate::dom::bindings::utils::{ProtoOrIfaceArray, DOM_PROTOTYPE_SLOT};
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::JSContext as SafeJSContext;
|
||||
|
@ -150,7 +150,7 @@ pub unsafe fn create_global_object(
|
|||
options.creationOptions_.streams_ = true;
|
||||
select_compartment(cx, &mut options);
|
||||
|
||||
let principal = ServoJSPrincipal::new(origin);
|
||||
let principal = ServoJSPrincipals::new(origin);
|
||||
|
||||
rval.set(JS_NewGlobalObject(
|
||||
*cx,
|
||||
|
|
|
@ -6,9 +6,9 @@ use js::jsapi::JSPrincipals;
|
|||
use servo_url::MutableOrigin;
|
||||
|
||||
// TODO: RAII ref-counting
|
||||
pub struct ServoJSPrincipal(pub *mut JSPrincipals);
|
||||
pub struct ServoJSPrincipals(pub *mut JSPrincipals);
|
||||
|
||||
impl ServoJSPrincipal {
|
||||
impl ServoJSPrincipals {
|
||||
pub fn new(origin: &MutableOrigin) -> Self {
|
||||
let private: Box<MutableOrigin> = Box::new(origin.clone());
|
||||
Self(unsafe { CreateRustJSPrincipals(&PRINCIPALS_CALLBACKS, Box::into_raw(private) as _) })
|
||||
|
@ -36,8 +36,8 @@ 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 = ServoJSPrincipal(obj);
|
||||
let other = ServoJSPrincipal(other);
|
||||
let obj = ServoJSPrincipals(obj);
|
||||
let other = ServoJSPrincipals(other);
|
||||
let obj_origin = obj.origin();
|
||||
let other_origin = other.origin();
|
||||
obj_origin.same_origin_domain(&other_origin)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue