mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
added xow security callbacks
This commit is contained in:
parent
ef053dbfa0
commit
9151b4b751
1 changed files with 10 additions and 1 deletions
|
@ -10,7 +10,7 @@ use dom::bindings::js::{RootCollection, RootCollectionPtr, trace_roots};
|
||||||
use dom::bindings::refcounted::{LiveDOMReferences, trace_refcounted_objects};
|
use dom::bindings::refcounted::{LiveDOMReferences, trace_refcounted_objects};
|
||||||
use dom::bindings::settings_stack;
|
use dom::bindings::settings_stack;
|
||||||
use dom::bindings::trace::{JSTraceable, trace_traceables};
|
use dom::bindings::trace::{JSTraceable, trace_traceables};
|
||||||
use dom::bindings::utils::DOM_CALLBACKS;
|
use dom::bindings::utils::{self, DOM_CALLBACKS};
|
||||||
use dom::globalscope::GlobalScope;
|
use dom::globalscope::GlobalScope;
|
||||||
use js::glue::CollectServoSizes;
|
use js::glue::CollectServoSizes;
|
||||||
use js::jsapi::{DisableIncrementalGC, GCDescription, GCProgress, HandleObject};
|
use js::jsapi::{DisableIncrementalGC, GCDescription, GCProgress, HandleObject};
|
||||||
|
@ -19,6 +19,7 @@ use js::jsapi::{JSGCInvocationKind, JSGCStatus, JS_AddExtraGCRootsTracer, JS_Set
|
||||||
use js::jsapi::{JSGCMode, JSGCParamKey, JS_SetGCParameter, JS_SetGlobalJitCompilerOption};
|
use js::jsapi::{JSGCMode, JSGCParamKey, JS_SetGCParameter, JS_SetGlobalJitCompilerOption};
|
||||||
use js::jsapi::{JSJitCompilerOption, JS_SetOffthreadIonCompilationEnabled, JS_SetParallelParsingEnabled};
|
use js::jsapi::{JSJitCompilerOption, JS_SetOffthreadIonCompilationEnabled, JS_SetParallelParsingEnabled};
|
||||||
use js::jsapi::{JSObject, RuntimeOptionsRef, SetPreserveWrapperCallback, SetEnqueuePromiseJobCallback};
|
use js::jsapi::{JSObject, RuntimeOptionsRef, SetPreserveWrapperCallback, SetEnqueuePromiseJobCallback};
|
||||||
|
use js::jsapi::{JSSecurityCallbacks, JS_SetSecurityCallbacks};
|
||||||
use js::panic::wrap_panic;
|
use js::panic::wrap_panic;
|
||||||
use js::rust::Runtime;
|
use js::rust::Runtime;
|
||||||
use microtask::{EnqueuedPromiseCallback, Microtask};
|
use microtask::{EnqueuedPromiseCallback, Microtask};
|
||||||
|
@ -36,6 +37,12 @@ use std::ptr;
|
||||||
use style::thread_state;
|
use style::thread_state;
|
||||||
use time::{Tm, now};
|
use time::{Tm, now};
|
||||||
|
|
||||||
|
//TODO contentsecuritypolicy
|
||||||
|
static SECURITY_CALLBACKS: JSSecurityCallbacks = JSSecurityCallbacks {
|
||||||
|
contentSecurityPolicyAllows: None,
|
||||||
|
subsumes: Some(utils::subsumes)}
|
||||||
|
;
|
||||||
|
|
||||||
/// Common messages used to control the event loops in both the script and the worker
|
/// Common messages used to control the event loops in both the script and the worker
|
||||||
pub enum CommonScriptMsg {
|
pub enum CommonScriptMsg {
|
||||||
/// Requests that the script thread measure its memory usage. The results are sent back via the
|
/// Requests that the script thread measure its memory usage. The results are sent back via the
|
||||||
|
@ -131,6 +138,8 @@ pub unsafe fn new_rt_and_cx() -> Runtime {
|
||||||
JS_AddExtraGCRootsTracer(runtime.rt(), Some(trace_rust_roots), ptr::null_mut());
|
JS_AddExtraGCRootsTracer(runtime.rt(), Some(trace_rust_roots), ptr::null_mut());
|
||||||
JS_AddExtraGCRootsTracer(runtime.rt(), Some(trace_refcounted_objects), ptr::null_mut());
|
JS_AddExtraGCRootsTracer(runtime.rt(), Some(trace_refcounted_objects), ptr::null_mut());
|
||||||
|
|
||||||
|
JS_SetSecurityCallbacks(runtime.rt(), &SECURITY_CALLBACKS);
|
||||||
|
|
||||||
// Needed for debug assertions about whether GC is running.
|
// Needed for debug assertions about whether GC is running.
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
JS_SetGCCallback(runtime.rt(), Some(debug_gc_callback), ptr::null_mut());
|
JS_SetGCCallback(runtime.rt(), Some(debug_gc_callback), ptr::null_mut());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue