mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Stop using JSAutoRequest.
This commit is contained in:
parent
221db56b08
commit
735480c184
13 changed files with 13 additions and 26 deletions
|
@ -2400,7 +2400,6 @@ class CGWrapMethod(CGAbstractMethod):
|
|||
if not self.descriptor.isGlobal():
|
||||
create = CreateBindingJSObject(self.descriptor, "scope")
|
||||
return CGGeneric("""\
|
||||
let _ar = JSAutoRequest::new(cx);
|
||||
let scope = scope.reflector().get_jsobject();
|
||||
assert!(!scope.get().is_null());
|
||||
assert!(((*JS_GetClass(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
|
||||
|
@ -2419,7 +2418,6 @@ Root::from_ref(&*raw)""" % {'copyUnforgeable': unforgeable, 'createObject': crea
|
|||
else:
|
||||
create = CreateBindingJSObject(self.descriptor)
|
||||
return CGGeneric("""\
|
||||
let _ar = JSAutoRequest::new(cx);
|
||||
%(createObject)s
|
||||
|
||||
let _ac = JSAutoCompartment::new(cx, obj.ptr);
|
||||
|
@ -5546,7 +5544,7 @@ class CGBindingRoot(CGThing):
|
|||
'js::jsapi::{JS_AtomizeAndPinString, JS_IsExceptionPending, JS_NewObject, JS_NewObjectWithGivenProto}',
|
||||
'js::jsapi::{JS_NewObjectWithoutMetadata, JS_NewStringCopyZ, JS_SetProperty}',
|
||||
'js::jsapi::{JS_SetPrototype, JS_SetReservedSlot, JS_WrapValue, JSAutoCompartment}',
|
||||
'js::jsapi::{JSAutoRequest, JSContext, JSClass, JSFreeOp, JSFunctionSpec}',
|
||||
'js::jsapi::{JSContext, JSClass, JSFreeOp, JSFunctionSpec}',
|
||||
'js::jsapi::{JSJitGetterCallArgs, JSJitInfo, JSJitMethodCallArgs, JSJitSetterCallArgs}',
|
||||
'js::jsapi::{JSNative, JSObject, JSNativeWrapper, JSPropertySpec}',
|
||||
'js::jsapi::{JSString, JSTracer, JSType, JSTypedMethodJitInfo, JSValueType}',
|
||||
|
|
|
@ -17,7 +17,7 @@ use dom::window::Window;
|
|||
use js::JSCLASS_IS_GLOBAL;
|
||||
use js::glue::{CreateWrapperProxyHandler, ProxyTraps, NewWindowProxy};
|
||||
use js::glue::{GetProxyPrivate, SetProxyExtra, GetProxyExtra};
|
||||
use js::jsapi::{Handle, HandleId, HandleObject, HandleValue, JSAutoCompartment, JSAutoRequest};
|
||||
use js::jsapi::{Handle, HandleId, HandleObject, HandleValue, JSAutoCompartment};
|
||||
use js::jsapi::{JSContext, JSPROP_READONLY, JSErrNum, JSObject, PropertyDescriptor, JS_DefinePropertyById};
|
||||
use js::jsapi::{JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo, JS_GetClass, JSTracer, FreeOp};
|
||||
use js::jsapi::{JS_GetOwnPropertyDescriptorById, JS_HasPropertyById, MutableHandle};
|
||||
|
@ -70,7 +70,6 @@ impl BrowsingContext {
|
|||
assert!(!handler.is_null());
|
||||
|
||||
let cx = window.get_cx();
|
||||
let _ar = JSAutoRequest::new(cx);
|
||||
let parent = window.reflector().get_jsobject();
|
||||
assert!(!parent.get().is_null());
|
||||
assert!(((*JS_GetClass(parent.get())).flags & JSCLASS_IS_GLOBAL) != 0);
|
||||
|
|
|
@ -23,7 +23,7 @@ use dom::workerglobalscope::WorkerGlobalScopeInit;
|
|||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use js::jsapi::{HandleValue, JS_SetInterruptCallback};
|
||||
use js::jsapi::{JSAutoCompartment, JSAutoRequest, JSContext, RootedValue};
|
||||
use js::jsapi::{JSAutoCompartment, JSContext, RootedValue};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::Runtime;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
|
@ -347,7 +347,6 @@ impl DedicatedWorkerGlobalScope {
|
|||
WorkerScriptMsg::DOMMessage(data) => {
|
||||
let scope = self.upcast::<WorkerGlobalScope>();
|
||||
let target = self.upcast();
|
||||
let _ar = JSAutoRequest::new(scope.get_cx());
|
||||
let _ac = JSAutoCompartment::new(scope.get_cx(),
|
||||
scope.reflector().get_jsobject().get());
|
||||
let mut message = RootedValue::new(scope.get_cx(), UndefinedValue());
|
||||
|
|
|
@ -25,8 +25,7 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use dom::window::Window;
|
||||
use fnv::FnvHasher;
|
||||
use heapsize::HeapSizeOf;
|
||||
use js::jsapi::{CompileFunction, JS_GetFunctionObject, RootedValue, RootedFunction};
|
||||
use js::jsapi::{JSAutoCompartment, JSAutoRequest};
|
||||
use js::jsapi::{CompileFunction, JS_GetFunctionObject, RootedValue, RootedFunction, JSAutoCompartment};
|
||||
use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper};
|
||||
use libc::{c_char, size_t};
|
||||
use std::collections::HashMap;
|
||||
|
@ -422,7 +421,6 @@ impl EventTarget {
|
|||
|
||||
let scopechain = AutoObjectVectorWrapper::new(cx);
|
||||
|
||||
let _ar = JSAutoRequest::new(cx);
|
||||
let _ac = JSAutoCompartment::new(cx, window.reflector().get_jsobject().get());
|
||||
let mut handler = RootedFunction::new(cx, ptr::null_mut());
|
||||
let rv = unsafe {
|
||||
|
|
|
@ -30,7 +30,7 @@ use dom::urlhelper::UrlHelper;
|
|||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom::window::{ReflowReason, Window};
|
||||
use ipc_channel::ipc;
|
||||
use js::jsapi::{JSAutoCompartment, JSAutoRequest, RootedValue, JSContext, MutableHandleValue};
|
||||
use js::jsapi::{JSAutoCompartment, RootedValue, JSContext, MutableHandleValue};
|
||||
use js::jsval::{UndefinedValue, NullValue};
|
||||
use layout_interface::ReflowQueryType;
|
||||
use msg::constellation_msg::{ConstellationChan, LoadData};
|
||||
|
@ -162,7 +162,6 @@ impl HTMLIFrameElement {
|
|||
let window = window_from_node(self);
|
||||
let custom_event = unsafe {
|
||||
let cx = window.get_cx();
|
||||
let _ar = JSAutoRequest::new(cx);
|
||||
let _ac = JSAutoCompartment::new(cx, window.reflector().get_jsobject().get());
|
||||
let mut detail = RootedValue::new(cx, UndefinedValue());
|
||||
let event_name = Atom::from(event.name());
|
||||
|
|
|
@ -25,7 +25,7 @@ use dom::eventtarget::EventTarget;
|
|||
use dom::messageevent::MessageEvent;
|
||||
use dom::urlhelper::UrlHelper;
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use js::jsapi::{JSAutoCompartment, JSAutoRequest, RootedValue};
|
||||
use js::jsapi::{JSAutoCompartment, RootedValue};
|
||||
use js::jsapi::{JS_GetArrayBufferData, JS_NewArrayBuffer};
|
||||
use js::jsval::UndefinedValue;
|
||||
use libc::{uint32_t, uint8_t};
|
||||
|
@ -591,7 +591,6 @@ impl Runnable for MessageReceivedTask {
|
|||
// global.get_cx() returns a valid `JSContext` pointer, so this is safe.
|
||||
unsafe {
|
||||
let cx = global.r().get_cx();
|
||||
let _ar = JSAutoRequest::new(cx);
|
||||
let _ac = JSAutoCompartment::new(cx, ws.reflector().get_jsobject().get());
|
||||
let mut message = RootedValue::new(cx, UndefinedValue());
|
||||
match self.message {
|
||||
|
|
|
@ -37,7 +37,7 @@ use gfx_traits::LayerId;
|
|||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use js::jsapi::{Evaluate2, MutableHandleValue};
|
||||
use js::jsapi::{HandleValue, JSContext};
|
||||
use js::jsapi::{JSAutoCompartment, JSAutoRequest, JS_GC, JS_GetRuntime, SetWindowProxy};
|
||||
use js::jsapi::{JSAutoCompartment, JS_GC, JS_GetRuntime, SetWindowProxy};
|
||||
use js::rust::CompileOptionsWrapper;
|
||||
use js::rust::Runtime;
|
||||
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleResponse, ScriptReflow};
|
||||
|
@ -843,7 +843,6 @@ impl<'a, T: Reflectable> ScriptHelpers for &'a T {
|
|||
rval: MutableHandleValue) {
|
||||
let global = self.global();
|
||||
let cx = global.r().get_cx();
|
||||
let _ar = JSAutoRequest::new(cx);
|
||||
let globalhandle = global.r().reflector().get_jsobject();
|
||||
let code: Vec<u16> = code.encode_utf16().collect();
|
||||
let filename = CString::new(filename).unwrap();
|
||||
|
@ -1216,7 +1215,6 @@ impl Window {
|
|||
self.browsing_context.set(Some(&browsing_context));
|
||||
let window = self.reflector().get_jsobject();
|
||||
let cx = self.get_cx();
|
||||
let _ar = JSAutoRequest::new(cx);
|
||||
let _ac = JSAutoCompartment::new(cx, window.get());
|
||||
unsafe { SetWindowProxy(cx, window, browsing_context.reflector().get_jsobject()); }
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ use dom::messageevent::MessageEvent;
|
|||
use dom::workerglobalscope::WorkerGlobalScopeInit;
|
||||
use ipc_channel::ipc;
|
||||
use js::jsapi::{HandleValue, JSContext, JSRuntime, RootedValue};
|
||||
use js::jsapi::{JSAutoCompartment, JSAutoRequest, JS_RequestInterruptCallback};
|
||||
use js::jsapi::{JSAutoCompartment, JS_RequestInterruptCallback};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::Runtime;
|
||||
use script_runtime::ScriptChan;
|
||||
|
@ -133,7 +133,6 @@ impl Worker {
|
|||
|
||||
let global = worker.r().global();
|
||||
let target = worker.upcast();
|
||||
let _ar = JSAutoRequest::new(global.r().get_cx());
|
||||
let _ac = JSAutoCompartment::new(global.r().get_cx(), target.reflector().get_jsobject().get());
|
||||
let mut message = RootedValue::new(global.r().get_cx(), UndefinedValue());
|
||||
data.read(global.r(), message.handle_mut());
|
||||
|
|
|
@ -18,7 +18,7 @@ use dom::window::{base64_atob, base64_btoa};
|
|||
use dom::workerlocation::WorkerLocation;
|
||||
use dom::workernavigator::WorkerNavigator;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use js::jsapi::{HandleValue, JSAutoRequest, JSContext, JSRuntime, RootedValue};
|
||||
use js::jsapi::{HandleValue, JSContext, JSRuntime, RootedValue};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::Runtime;
|
||||
use msg::constellation_msg::{ConstellationChan, PipelineId};
|
||||
|
@ -329,7 +329,6 @@ impl WorkerGlobalScope {
|
|||
// TODO: An error needs to be dispatched to the parent.
|
||||
// https://github.com/servo/servo/issues/6422
|
||||
println!("evaluate_script failed");
|
||||
let _ar = JSAutoRequest::new(self.runtime.cx());
|
||||
report_pending_exception(self.runtime.cx(), self.reflector().get_jsobject().get());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ use ipc_channel::ipc::{self, IpcSender};
|
|||
use ipc_channel::router::ROUTER;
|
||||
use js::glue::GetWindowProxyClass;
|
||||
use js::jsapi::{DOMProxyShadowsResult, HandleId, HandleObject, RootedValue};
|
||||
use js::jsapi::{JSAutoRequest, JSContext, JS_SetWrapObjectCallbacks, JSTracer, SetWindowProxyClass};
|
||||
use js::jsapi::{JSContext, JS_SetWrapObjectCallbacks, JSTracer, SetWindowProxyClass};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::Runtime;
|
||||
use layout_interface::{ReflowQueryType};
|
||||
|
@ -1576,7 +1576,6 @@ impl ScriptThread {
|
|||
|
||||
// Turn javascript: URL into JS code to eval, according to the steps in
|
||||
// https://html.spec.whatwg.org/multipage/#javascript-protocol
|
||||
let _ar = JSAutoRequest::new(self.get_cx());
|
||||
|
||||
// This slice of the URL’s serialization is equivalent to (5.) to (7.):
|
||||
// Start with the scheme data of the parsed URL;
|
||||
|
|
2
components/servo/Cargo.lock
generated
2
components/servo/Cargo.lock
generated
|
@ -1042,7 +1042,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "js"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/servo/rust-mozjs#8ad6c1148fd77e5b9dc2ce0f0ab40d4f455f6f4e"
|
||||
source = "git+https://github.com/servo/rust-mozjs#2bcfb73419ca893156f48b8e7966f0fc492ccfa0"
|
||||
dependencies = [
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
2
ports/cef/Cargo.lock
generated
2
ports/cef/Cargo.lock
generated
|
@ -955,7 +955,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "js"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/servo/rust-mozjs#8ad6c1148fd77e5b9dc2ce0f0ab40d4f455f6f4e"
|
||||
source = "git+https://github.com/servo/rust-mozjs#2bcfb73419ca893156f48b8e7966f0fc492ccfa0"
|
||||
dependencies = [
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
2
ports/gonk/Cargo.lock
generated
2
ports/gonk/Cargo.lock
generated
|
@ -947,7 +947,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "js"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/servo/rust-mozjs#8ad6c1148fd77e5b9dc2ce0f0ab40d4f455f6f4e"
|
||||
source = "git+https://github.com/servo/rust-mozjs#2bcfb73419ca893156f48b8e7966f0fc492ccfa0"
|
||||
dependencies = [
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue