mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Pass real values to the proxy handler setup.
This commit is contained in:
parent
3c4a08c016
commit
2ad293ca64
5 changed files with 24 additions and 15 deletions
|
@ -10,21 +10,37 @@ use dom::bindings::conversions::is_dom_proxy;
|
||||||
use dom::bindings::utils::delete_property_by_id;
|
use dom::bindings::utils::delete_property_by_id;
|
||||||
use js::glue::GetProxyExtra;
|
use js::glue::GetProxyExtra;
|
||||||
use js::glue::InvokeGetOwnPropertyDescriptor;
|
use js::glue::InvokeGetOwnPropertyDescriptor;
|
||||||
use js::glue::{GetProxyHandler, SetProxyExtra};
|
use js::glue::{GetProxyHandler, SetProxyExtra, GetProxyHandlerFamily};
|
||||||
use js::jsapi::GetObjectProto;
|
use js::jsapi::GetObjectProto;
|
||||||
use js::jsapi::GetStaticPrototype;
|
use js::jsapi::GetStaticPrototype;
|
||||||
use js::jsapi::JS_GetPropertyDescriptorById;
|
use js::jsapi::JS_GetPropertyDescriptorById;
|
||||||
use js::jsapi::MutableHandleObject;
|
use js::jsapi::MutableHandleObject;
|
||||||
use js::jsapi::{Handle, HandleId, HandleObject, MutableHandle, ObjectOpResult};
|
use js::jsapi::{Handle, HandleId, HandleObject, MutableHandle, ObjectOpResult};
|
||||||
use js::jsapi::{JSContext, JSObject, JSPROP_GETTER, PropertyDescriptor};
|
use js::jsapi::{JSContext, JSObject, JSPROP_GETTER, PropertyDescriptor, DOMProxyShadowsResult};
|
||||||
use js::jsapi::{JSErrNum, JS_StrictPropertyStub};
|
use js::jsapi::{JSErrNum, JS_StrictPropertyStub};
|
||||||
use js::jsapi::{JS_DefinePropertyById, JS_NewObjectWithGivenProto};
|
use js::jsapi::{JS_DefinePropertyById, JS_NewObjectWithGivenProto, SetDOMProxyInformation};
|
||||||
use js::jsval::ObjectValue;
|
use js::jsval::ObjectValue;
|
||||||
use libc;
|
use libc;
|
||||||
use std::{mem, ptr};
|
use std::{mem, ptr};
|
||||||
|
|
||||||
static JSPROXYSLOT_EXPANDO: u32 = 0;
|
static JSPROXYSLOT_EXPANDO: u32 = 0;
|
||||||
|
|
||||||
|
/// Determine if this id shadows any existing properties for this proxy.
|
||||||
|
pub unsafe extern "C" fn shadow_check_callback(_cx: *mut JSContext,
|
||||||
|
_object: HandleObject,
|
||||||
|
_id: HandleId)
|
||||||
|
-> DOMProxyShadowsResult {
|
||||||
|
// XXX implement me
|
||||||
|
DOMProxyShadowsResult::ShadowCheckFailed
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initialize the infrastructure for DOM proxy objects.
|
||||||
|
pub unsafe fn init() {
|
||||||
|
SetDOMProxyInformation(GetProxyHandlerFamily(),
|
||||||
|
JSPROXYSLOT_EXPANDO,
|
||||||
|
Some(shadow_check_callback));
|
||||||
|
}
|
||||||
|
|
||||||
/// Invoke the [[GetOwnProperty]] trap (`getOwnPropertyDescriptor`) on `proxy`,
|
/// Invoke the [[GetOwnProperty]] trap (`getOwnPropertyDescriptor`) on `proxy`,
|
||||||
/// with argument `id` and return the result, if it is not `undefined`.
|
/// with argument `id` and return the result, if it is not `undefined`.
|
||||||
/// Otherwise, walk along the prototype chain to find a property with that
|
/// Otherwise, walk along the prototype chain to find a property with that
|
||||||
|
|
|
@ -114,10 +114,10 @@ mod unpremultiplytable;
|
||||||
mod webdriver_handlers;
|
mod webdriver_handlers;
|
||||||
|
|
||||||
use dom::bindings::codegen::RegisterBindings;
|
use dom::bindings::codegen::RegisterBindings;
|
||||||
use js::jsapi::{Handle, JSContext, JSObject, SetDOMProxyInformation};
|
use dom::bindings::proxyhandler;
|
||||||
|
use js::jsapi::{Handle, JSContext, JSObject};
|
||||||
use script_traits::SWManagerSenders;
|
use script_traits::SWManagerSenders;
|
||||||
use serviceworker_manager::ServiceWorkerManager;
|
use serviceworker_manager::ServiceWorkerManager;
|
||||||
use std::ptr;
|
|
||||||
use util::opts;
|
use util::opts;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
@ -164,7 +164,7 @@ fn perform_platform_specific_initialization() {}
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub fn init(sw_senders: SWManagerSenders) {
|
pub fn init(sw_senders: SWManagerSenders) {
|
||||||
unsafe {
|
unsafe {
|
||||||
SetDOMProxyInformation(ptr::null(), 0, Some(script_thread::shadow_check_callback));
|
proxyhandler::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spawn the service worker manager passing the constellation sender
|
// Spawn the service worker manager passing the constellation sender
|
||||||
|
|
|
@ -59,7 +59,6 @@ use hyper_serde::Serde;
|
||||||
use ipc_channel::ipc::{self, IpcSender};
|
use ipc_channel::ipc::{self, IpcSender};
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
use js::glue::GetWindowProxyClass;
|
use js::glue::GetWindowProxyClass;
|
||||||
use js::jsapi::{DOMProxyShadowsResult, HandleId, HandleObject};
|
|
||||||
use js::jsapi::{JSAutoCompartment, JSContext, JS_SetWrapObjectCallbacks};
|
use js::jsapi::{JSAutoCompartment, JSContext, JS_SetWrapObjectCallbacks};
|
||||||
use js::jsapi::{JSTracer, SetWindowProxyClass};
|
use js::jsapi::{JSTracer, SetWindowProxyClass};
|
||||||
use js::jsval::UndefinedValue;
|
use js::jsval::UndefinedValue;
|
||||||
|
@ -484,12 +483,6 @@ impl ScriptThreadFactory for ScriptThread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe extern "C" fn shadow_check_callback(_cx: *mut JSContext,
|
|
||||||
_object: HandleObject, _id: HandleId) -> DOMProxyShadowsResult {
|
|
||||||
// XXX implement me
|
|
||||||
DOMProxyShadowsResult::ShadowCheckFailed
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ScriptThread {
|
impl ScriptThread {
|
||||||
pub fn page_headers_available(id: &PipelineId, subpage: Option<&SubpageId>, metadata: Option<Metadata>)
|
pub fn page_headers_available(id: &PipelineId, subpage: Option<&SubpageId>, metadata: Option<Metadata>)
|
||||||
-> Option<ParserRoot> {
|
-> Option<ParserRoot> {
|
||||||
|
|
2
components/servo/Cargo.lock
generated
2
components/servo/Cargo.lock
generated
|
@ -1086,7 +1086,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js"
|
name = "js"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
source = "git+https://github.com/servo/rust-mozjs#daffcfb1e0568b3e67dda331b487cc9fd8a202cb"
|
source = "git+https://github.com/servo/rust-mozjs#a4a693bf41fc67e839f3a5e8219d872f5c675b5f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
2
ports/cef/Cargo.lock
generated
2
ports/cef/Cargo.lock
generated
|
@ -994,7 +994,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js"
|
name = "js"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
source = "git+https://github.com/servo/rust-mozjs#daffcfb1e0568b3e67dda331b487cc9fd8a202cb"
|
source = "git+https://github.com/servo/rust-mozjs#a4a693bf41fc67e839f3a5e8219d872f5c675b5f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue