mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Make the global object be the Window object. Fixes #833.
This commit is contained in:
parent
2d3a4d7e1d
commit
da599c6ccf
12 changed files with 95 additions and 69 deletions
|
@ -29,7 +29,7 @@ use js::jsapi::{JS_NewStringCopyN, JS_DefineFunctions, JS_DefineProperty};
|
|||
use js::jsapi::{JS_ValueToString, JS_GetReservedSlot, JS_SetReservedSlot};
|
||||
use js::jsapi::{JSContext, JSObject, JSBool, jsid, JSClass, JSNative, JSTracer};
|
||||
use js::jsapi::{JSFunctionSpec, JSPropertySpec, JSVal, JSPropertyDescriptor};
|
||||
use js::jsapi::{JSPropertyOp, JSStrictPropertyOp};
|
||||
use js::jsapi::{JSPropertyOp, JSStrictPropertyOp, JS_NewGlobalObject, JS_InitStandardClasses};
|
||||
use js::jsfriendapi::bindgen::JS_NewObjectWithUniqueType;
|
||||
use js::rust::Compartment;
|
||||
use js::{JSPROP_ENUMERATE, JSVAL_NULL};
|
||||
|
@ -845,3 +845,16 @@ pub fn HasPropertyOnPrototype(cx: *JSContext, proxy: *JSObject, id: jsid) -> boo
|
|||
let mut found = false;
|
||||
return !GetPropertyOnPrototype(cx, proxy, id, &mut found, ptr::null()) || found;
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn CreateDOMGlobal(cx: *JSContext, class: *JSClass) -> *JSObject {
|
||||
unsafe {
|
||||
let obj = JS_NewGlobalObject(cx, class, ptr::null());
|
||||
if obj.is_null() {
|
||||
return ptr::null();
|
||||
}
|
||||
JS_InitStandardClasses(cx, obj);
|
||||
initialize_global(obj);
|
||||
obj
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue