#[repr(u32)]pub enum OnNewGlobalHookOption {
FireOnNewGlobalHook = 0,
DontFireOnNewGlobalHook = 1,
}
Expand description
During global creation, we fire notifications to callbacks registered via the Debugger API. These callbacks are arbitrary script, and can touch the global in arbitrary ways. When that happens, the global should not be in a half-baked state. But this creates a problem for consumers that need to set slots on the global to put it in a consistent state.
This API provides a way for consumers to set slots atomically (immediately after the global is created), before any debugger hooks are fired. It’s unfortunately on the clunky side, but that’s the way the cookie crumbles.
If callers have no additional state on the global to set up, they may pass |FireOnNewGlobalHook| to JS_NewGlobalObject, which causes that function to fire the hook as its final act before returning. Otherwise, callers should pass |DontFireOnNewGlobalHook|, which means that they are responsible for invoking JS_FireOnNewGlobalObject upon successfully creating the global. If an error occurs and the operation aborts, callers should skip firing the hook. But otherwise, callers must take care to fire the hook exactly once before compiling any script in the global’s scope (we have assertions in place to enforce this). This lets us be sure that debugger clients never miss breakpoints.
Variants§
Trait Implementations§
source§impl Clone for OnNewGlobalHookOption
impl Clone for OnNewGlobalHookOption
source§fn clone(&self) -> OnNewGlobalHookOption
fn clone(&self) -> OnNewGlobalHookOption
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for OnNewGlobalHookOption
impl Debug for OnNewGlobalHookOption
source§impl Hash for OnNewGlobalHookOption
impl Hash for OnNewGlobalHookOption
source§impl PartialEq for OnNewGlobalHookOption
impl PartialEq for OnNewGlobalHookOption
impl Copy for OnNewGlobalHookOption
impl Eq for OnNewGlobalHookOption
impl StructuralPartialEq for OnNewGlobalHookOption
Auto Trait Implementations§
impl Freeze for OnNewGlobalHookOption
impl RefUnwindSafe for OnNewGlobalHookOption
impl Send for OnNewGlobalHookOption
impl Sync for OnNewGlobalHookOption
impl Unpin for OnNewGlobalHookOption
impl UnwindSafe for OnNewGlobalHookOption
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more