Skip to content

Commit

Permalink
Auto merge of #11173 - servo:requests, r=nox
Browse files Browse the repository at this point in the history
Stop using JSAutoRequest.

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

Either:
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because no functional change

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11173)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed May 13, 2016
2 parents 221db56 + 735480c commit ea84601
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 26 deletions.
4 changes: 1 addition & 3 deletions components/script/dom/bindings/codegen/CodegenRust.py
Expand Up @@ -2400,7 +2400,6 @@ def definition_body(self):
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);
Expand All @@ -2419,7 +2418,6 @@ def definition_body(self):
else:
create = CreateBindingJSObject(self.descriptor)
return CGGeneric("""\
let _ar = JSAutoRequest::new(cx);
%(createObject)s
let _ac = JSAutoCompartment::new(cx, obj.ptr);
Expand Down Expand Up @@ -5546,7 +5544,7 @@ def __init__(self, config, prefix, webIDLFile):
'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}',
Expand Down
3 changes: 1 addition & 2 deletions components/script/dom/browsingcontext.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions components/script/dom/dedicatedworkerglobalscope.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
4 changes: 1 addition & 3 deletions components/script/dom/eventtarget.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions components/script/dom/htmliframeelement.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions components/script/dom/websocket.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions components/script/dom/window.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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()); }
}
Expand Down
3 changes: 1 addition & 2 deletions components/script/dom/worker.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions components/script/dom/workerglobalscope.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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());
}
}
Expand Down
3 changes: 1 addition & 2 deletions components/script/script_thread.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/servo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ports/cef/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ports/gonk/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ea84601

Please sign in to comment.