Assert that we're handed a DOM global in initialize_global.

This commit is contained in:
Ms2ger 2014-07-26 17:09:38 +02:00
parent 69c49bb764
commit 692d4e847d

View file

@ -410,9 +410,11 @@ pub extern fn ThrowingConstructor(_cx: *mut JSContext, _argc: c_uint, _vp: *mut
} }
/// Construct and cache the ProtoOrIfaceArray for the given global. /// Construct and cache the ProtoOrIfaceArray for the given global.
/// Fails if the argument is not a DOM global.
pub fn initialize_global(global: *mut JSObject) { pub fn initialize_global(global: *mut JSObject) {
let protoArray = box () ([0 as *mut JSObject, ..PrototypeList::id::IDCount as uint]); let protoArray = box () ([0 as *mut JSObject, ..PrototypeList::id::IDCount as uint]);
unsafe { unsafe {
assert!(((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0);
let box_ = squirrel_away_unique(protoArray); let box_ = squirrel_away_unique(protoArray);
JS_SetReservedSlot(global, JS_SetReservedSlot(global,
DOM_PROTOTYPE_SLOT, DOM_PROTOTYPE_SLOT,