diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-07-26 17:09:38 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-07-26 17:16:25 +0200 |
commit | 692d4e847da191c68206ecac06cc4bb9aeb59555 (patch) | |
tree | 94955ca9fc8a24935a6fa3768b60ba31b5370170 /src/components/script/dom/bindings/utils.rs | |
parent | 69c49bb76437bb6dd71fe64cdf4c9da1dcaab11e (diff) | |
download | servo-692d4e847da191c68206ecac06cc4bb9aeb59555.tar.gz servo-692d4e847da191c68206ecac06cc4bb9aeb59555.zip |
Assert that we're handed a DOM global in initialize_global.
Diffstat (limited to 'src/components/script/dom/bindings/utils.rs')
-rw-r--r-- | src/components/script/dom/bindings/utils.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/components/script/dom/bindings/utils.rs b/src/components/script/dom/bindings/utils.rs index 1e2e38c0141..8e572414d0e 100644 --- a/src/components/script/dom/bindings/utils.rs +++ b/src/components/script/dom/bindings/utils.rs @@ -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. +/// Fails if the argument is not a DOM global. pub fn initialize_global(global: *mut JSObject) { let protoArray = box () ([0 as *mut JSObject, ..PrototypeList::id::IDCount as uint]); unsafe { + assert!(((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0); let box_ = squirrel_away_unique(protoArray); JS_SetReservedSlot(global, DOM_PROTOTYPE_SLOT, |