mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
auto merge of #2434 : Ms2ger/servo/contentWindow, r=jdm
This commit is contained in:
commit
ca9396ff9c
6 changed files with 50 additions and 33 deletions
|
@ -37,6 +37,7 @@ use js::jsapi::{JSContext, JSObject, JSBool, jsid, JSClass, JSNative};
|
|||
use js::jsapi::{JSFunctionSpec, JSPropertySpec};
|
||||
use js::jsapi::{JS_NewGlobalObject, JS_InitStandardClasses};
|
||||
use js::jsapi::{JSString};
|
||||
use js::jsfriendapi::JS_ObjectToOuterObject;
|
||||
use js::jsfriendapi::bindgen::JS_NewObjectWithUniqueType;
|
||||
use js::jsval::JSVal;
|
||||
use js::jsval::{PrivateValue, ObjectValue, NullValue, ObjectOrNullValue};
|
||||
|
@ -594,19 +595,14 @@ pub fn CreateDOMGlobal(cx: *JSContext, class: *JSClass) -> *JSObject {
|
|||
|
||||
pub extern fn wrap_for_same_compartment(cx: *JSContext, obj: *JSObject) -> *JSObject {
|
||||
unsafe {
|
||||
let clasp = JS_GetClass(obj);
|
||||
let clasp = clasp as *js::Class;
|
||||
match (*clasp).ext.outerObject {
|
||||
Some(outerize) => {
|
||||
debug!("found an outerize hook");
|
||||
let obj = JSHandleObject { unnamed: &obj };
|
||||
outerize(cx, obj)
|
||||
}
|
||||
None => {
|
||||
debug!("no outerize hook found");
|
||||
obj
|
||||
}
|
||||
}
|
||||
JS_ObjectToOuterObject(cx as *mut _, obj as *mut _) as *_
|
||||
}
|
||||
}
|
||||
|
||||
pub extern fn pre_wrap(cx: *mut JSContext, _scope: *mut JSObject,
|
||||
obj: *mut JSObject, _flags: c_uint) -> *mut JSObject {
|
||||
unsafe {
|
||||
JS_ObjectToOuterObject(cx, obj)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ use dom::htmlelement::HTMLElement;
|
|||
use dom::node::{Node, ElementNodeTypeId, window_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom::window::Window;
|
||||
use script_task::IterablePage;
|
||||
use servo_msg::constellation_msg::{PipelineId, SubpageId};
|
||||
use servo_msg::constellation_msg::{IFrameSandboxed, IFrameUnsandboxed};
|
||||
use servo_msg::constellation_msg::{ConstellationChan, LoadIframeUrlMsg};
|
||||
|
@ -184,7 +185,18 @@ impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
|
|||
}
|
||||
|
||||
fn GetContentWindow(&self) -> Option<Temporary<Window>> {
|
||||
None
|
||||
self.size.and_then(|size| {
|
||||
let window = window_from_node(self).root();
|
||||
let children = &*window.deref().page.children.deref().borrow();
|
||||
let child = children.iter().find(|child| {
|
||||
child.subpage_id.unwrap() == size.subpage_id
|
||||
});
|
||||
child.and_then(|page| {
|
||||
page.frame.deref().borrow().as_ref().map(|frame| {
|
||||
Temporary::new(frame.window.clone())
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn Align(&self) -> DOMString {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue