Remove now-unnecessary must_root and allow(unrooted_must_root) annotations

This commit is contained in:
Manish Goregaokar 2019-01-03 16:29:49 -08:00
parent 6df1c6d7e7
commit 611dc4bc70
28 changed files with 2 additions and 67 deletions

View file

@ -107,7 +107,6 @@ impl AudioContextMethods for AudioContext {
}
// https://webaudio.github.io/web-audio-api/#dom-audiocontext-suspend
#[allow(unrooted_must_root)]
fn Suspend(&self) -> Rc<Promise> {
// Step 1.
let promise = Promise::new(&self.global());
@ -169,7 +168,6 @@ impl AudioContextMethods for AudioContext {
}
// https://webaudio.github.io/web-audio-api/#dom-audiocontext-close
#[allow(unrooted_must_root)]
fn Close(&self) -> Rc<Promise> {
// Step 1.
let promise = Promise::new(&self.global());

View file

@ -62,7 +62,6 @@ pub enum BaseAudioContextOptions {
OfflineAudioContext(OfflineAudioContextOptions),
}
#[must_root]
#[derive(JSTraceable)]
struct DecodeResolver {
pub promise: Rc<Promise>,
@ -147,7 +146,6 @@ impl BaseAudioContext {
self.state.get() == AudioContextState::Suspended
}
#[allow(unrooted_must_root)]
fn push_pending_resume_promise(&self, promise: &Rc<Promise>) {
self.pending_resume_promises
.borrow_mut()
@ -164,7 +162,6 @@ impl BaseAudioContext {
/// Each call to this method must be followed by a call to
/// `fulfill_in_flight_resume_promises`, to actually fulfill the promises
/// which were taken and moved to the in-flight queue.
#[allow(unrooted_must_root)]
fn take_pending_resume_promises(&self, result: ErrorResult) {
let pending_resume_promises =
mem::replace(&mut *self.pending_resume_promises.borrow_mut(), vec![]);
@ -271,7 +268,6 @@ impl BaseAudioContextMethods for BaseAudioContext {
}
/// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume
#[allow(unrooted_must_root)]
fn Resume(&self) -> Rc<Promise> {
// Step 1.
let promise = Promise::new(&self.global());
@ -397,7 +393,6 @@ impl BaseAudioContextMethods for BaseAudioContext {
}
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-decodeaudiodata
#[allow(unrooted_must_root)]
fn DecodeAudioData(
&self,
audio_data: CustomAutoRooterGuard<ArrayBuffer>,

View file

@ -91,7 +91,6 @@ impl TrustedPromise {
/// Obtain a usable DOM Promise from a pinned `TrustedPromise` value. Fails if used on
/// a different thread than the original value from which this `TrustedPromise` was
/// obtained.
#[allow(unrooted_must_root)]
pub fn root(self) -> Rc<Promise> {
LIVE_REFERENCES.with(|ref r| {
let r = r.borrow();

View file

@ -277,7 +277,6 @@ pub fn response_async<T: AsyncBluetoothListener + DomObject + 'static>(
action_sender
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#getgattchildren
pub fn get_gatt_children<T, F>(
attribute: &T,
@ -530,7 +529,6 @@ impl From<BluetoothError> for Error {
}
impl BluetoothMethods for Bluetooth {
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice
fn RequestDevice(&self, option: &RequestDeviceOptions) -> Rc<Promise> {
let p = Promise::new(&self.global());
@ -549,7 +547,6 @@ impl BluetoothMethods for Bluetooth {
return p;
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-getavailability
fn GetAvailability(&self) -> Rc<Promise> {
let p = Promise::new(&self.global());

View file

@ -276,7 +276,6 @@ impl BluetoothDeviceMethods for BluetoothDevice {
None
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-watchadvertisements
fn WatchAdvertisements(&self) -> Rc<Promise> {
let p = Promise::new(&self.global());

View file

@ -102,7 +102,6 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
self.uuid.clone()
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptor
fn GetDescriptor(&self, descriptor: BluetoothDescriptorUUID) -> Rc<Promise> {
get_gatt_children(
@ -116,7 +115,6 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
)
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptors
fn GetDescriptors(&self, descriptor: Option<BluetoothDescriptorUUID>) -> Rc<Promise> {
get_gatt_children(
@ -135,7 +133,6 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
self.value.borrow().clone()
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-readvalue
fn ReadValue(&self) -> Rc<Promise> {
let p = Promise::new(&self.global());
@ -169,7 +166,6 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
return p;
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-writevalue
fn WriteValue(&self, value: ArrayBufferViewOrArrayBuffer) -> Rc<Promise> {
let p = Promise::new(&self.global());
@ -221,7 +217,6 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
return p;
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-startnotifications
fn StartNotifications(&self) -> Rc<Promise> {
let p = Promise::new(&self.global());
@ -259,7 +254,6 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
return p;
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-stopnotifications
fn StopNotifications(&self) -> Rc<Promise> {
let p = Promise::new(&self.global());

View file

@ -92,7 +92,6 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
self.value.borrow().clone()
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-readvalue
fn ReadValue(&self) -> Rc<Promise> {
let p = Promise::new(&self.global());
@ -125,7 +124,6 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
return p;
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-writevalue
fn WriteValue(&self, value: ArrayBufferViewOrArrayBuffer) -> Rc<Promise> {
let p = Promise::new(&self.global());

View file

@ -68,7 +68,6 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
self.connected.get()
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connect
fn Connect(&self) -> Rc<Promise> {
// Step 1.
@ -109,7 +108,6 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
self.Device().garbage_collect_the_connection()
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservice
fn GetPrimaryService(&self, service: BluetoothServiceUUID) -> Rc<Promise> {
// Step 1 - 2.
@ -124,7 +122,6 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
)
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservices
fn GetPrimaryServices(&self, service: Option<BluetoothServiceUUID>) -> Rc<Promise> {
// Step 1 - 2.

View file

@ -82,7 +82,6 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
self.uuid.clone()
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristic
fn GetCharacteristic(&self, characteristic: BluetoothCharacteristicUUID) -> Rc<Promise> {
get_gatt_children(
@ -96,7 +95,6 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
)
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristics
fn GetCharacteristics(
&self,
@ -113,7 +111,6 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
)
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getincludedservice
fn GetIncludedService(&self, service: BluetoothServiceUUID) -> Rc<Promise> {
get_gatt_children(
@ -127,7 +124,6 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
)
}
#[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getincludedservices
fn GetIncludedServices(&self, service: Option<BluetoothServiceUUID>) -> Rc<Promise> {
get_gatt_children(

View file

@ -399,7 +399,6 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
}
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-whendefined>
#[allow(unrooted_must_root)]
fn WhenDefined(&self, name: DOMString) -> Rc<Promise> {
let global_scope = self.window.upcast::<GlobalScope>();
let name = LocalName::from(&*name);

View file

@ -3139,7 +3139,6 @@ impl Document {
}
// https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen
#[allow(unrooted_must_root)]
pub fn enter_fullscreen(&self, pending: &Element) -> Rc<Promise> {
// Step 1
let promise = Promise::new(self.global().r());
@ -3198,7 +3197,6 @@ impl Document {
}
// https://fullscreen.spec.whatwg.org/#exit-fullscreen
#[allow(unrooted_must_root)]
pub fn exit_fullscreen(&self) -> Rc<Promise> {
let global = self.global();
// Step 1
@ -4561,7 +4559,6 @@ impl DocumentMethods for Document {
self.fullscreen_element.get()
}
#[allow(unrooted_must_root)]
// https://fullscreen.spec.whatwg.org/#dom-document-exitfullscreen
fn ExitFullscreen(&self) -> Rc<Promise> {
self.exit_fullscreen()

View file

@ -2565,7 +2565,6 @@ impl ElementMethods for Element {
}
// https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen
#[allow(unrooted_must_root)]
fn RequestFullscreen(&self) -> Rc<Promise> {
let doc = document_from_node(self);
doc.enter_fullscreen(self)

View file

@ -1022,7 +1022,6 @@ impl HTMLMediaElement {
}
/// Appends a promise to the list of pending play promises.
#[allow(unrooted_must_root)]
fn push_pending_play_promise(&self, promise: &Rc<Promise>) {
self.pending_play_promises
.borrow_mut()
@ -1039,7 +1038,6 @@ impl HTMLMediaElement {
/// Each call to this method must be followed by a call to
/// `fulfill_in_flight_play_promises`, to actually fulfill the promises
/// which were taken and moved to the in-flight queue.
#[allow(unrooted_must_root)]
fn take_pending_play_promises(&self, result: ErrorResult) {
let pending_play_promises =
mem::replace(&mut *self.pending_play_promises.borrow_mut(), vec![]);
@ -1375,7 +1373,6 @@ impl HTMLMediaElementMethods for HTMLMediaElement {
}
// https://html.spec.whatwg.org/multipage/#dom-media-play
#[allow(unrooted_must_root)]
fn Play(&self) -> Rc<Promise> {
let promise = Promise::new(&self.global());
self.play(&promise);

View file

@ -42,7 +42,6 @@ impl NavigationPreloadManager {
}
impl NavigationPreloadManagerMethods for NavigationPreloadManager {
#[allow(unrooted_must_root)]
// https://w3c.github.io/ServiceWorker/#navigation-preload-manager-enable
fn Enable(&self) -> Rc<Promise> {
let promise = Promise::new(&*self.global());
@ -65,7 +64,6 @@ impl NavigationPreloadManagerMethods for NavigationPreloadManager {
promise
}
#[allow(unrooted_must_root)]
// https://w3c.github.io/ServiceWorker/#navigation-preload-manager-disable
fn Disable(&self) -> Rc<Promise> {
let promise = Promise::new(&*self.global());
@ -88,7 +86,6 @@ impl NavigationPreloadManagerMethods for NavigationPreloadManager {
promise
}
#[allow(unrooted_must_root)]
// https://w3c.github.io/ServiceWorker/#navigation-preload-manager-setheadervalue
fn SetHeaderValue(&self, value: ByteString) -> Rc<Promise> {
let promise = Promise::new(&*self.global());
@ -111,7 +108,6 @@ impl NavigationPreloadManagerMethods for NavigationPreloadManager {
promise
}
#[allow(unrooted_must_root)]
// https://w3c.github.io/ServiceWorker/#navigation-preload-manager-getstate
fn GetState(&self) -> Rc<Promise> {
let promise = Promise::new(&*self.global());

View file

@ -147,7 +147,6 @@ impl NavigatorMethods for Navigator {
}
// https://w3c.github.io/webvr/spec/1.1/#navigator-getvrdisplays-attribute
#[allow(unrooted_must_root)]
fn GetVRDisplays(&self) -> Rc<Promise> {
let promise = Promise::new(&self.global());
let displays = self.Xr().get_displays();

View file

@ -113,7 +113,6 @@ impl OfflineAudioContextMethods for OfflineAudioContext {
}
// https://webaudio.github.io/web-audio-api/#dom-offlineaudiocontext-startrendering
#[allow(unrooted_must_root)]
fn StartRendering(&self) -> Rc<Promise> {
let promise = Promise::new(&self.global());
if self.rendering_started.get() {

View file

@ -84,7 +84,6 @@ impl Permissions {
)
}
#[allow(unrooted_must_root)]
// https://w3c.github.io/permissions/#dom-permissions-query
// https://w3c.github.io/permissions/#dom-permissions-request
// https://w3c.github.io/permissions/#dom-permissions-revoke
@ -197,21 +196,18 @@ impl Permissions {
}
impl PermissionsMethods for Permissions {
#[allow(unrooted_must_root)]
#[allow(unsafe_code)]
// https://w3c.github.io/permissions/#dom-permissions-query
unsafe fn Query(&self, cx: *mut JSContext, permissionDesc: *mut JSObject) -> Rc<Promise> {
self.manipulate(Operation::Query, cx, permissionDesc, None)
}
#[allow(unrooted_must_root)]
#[allow(unsafe_code)]
// https://w3c.github.io/permissions/#dom-permissions-request
unsafe fn Request(&self, cx: *mut JSContext, permissionDesc: *mut JSObject) -> Rc<Promise> {
self.manipulate(Operation::Request, cx, permissionDesc, None)
}
#[allow(unrooted_must_root)]
#[allow(unsafe_code)]
// https://w3c.github.io/permissions/#dom-permissions-revoke
unsafe fn Revoke(&self, cx: *mut JSContext, permissionDesc: *mut JSObject) -> Rc<Promise> {

View file

@ -89,7 +89,7 @@ impl Promise {
}
}
#[allow(unsafe_code, unrooted_must_root)]
#[allow(unsafe_code)]
pub fn duplicate(&self) -> Rc<Promise> {
let cx = self.global().get_cx();
unsafe { Promise::new_with_js_promise(self.reflector().get_jsobject(), cx) }

View file

@ -95,7 +95,6 @@ impl PromiseRejectionEvent {
}
impl PromiseRejectionEventMethods for PromiseRejectionEvent {
#[allow(unrooted_must_root)]
// https://html.spec.whatwg.org/multipage/#dom-promiserejectionevent-promise
fn Promise(&self) -> Rc<Promise> {
self.promise.clone()

View file

@ -620,31 +620,26 @@ impl RequestMethods for Request {
Request::clone_from(self)
}
#[allow(unrooted_must_root)]
// https://fetch.spec.whatwg.org/#dom-body-text
fn Text(&self) -> Rc<Promise> {
consume_body(self, BodyType::Text)
}
#[allow(unrooted_must_root)]
// https://fetch.spec.whatwg.org/#dom-body-blob
fn Blob(&self) -> Rc<Promise> {
consume_body(self, BodyType::Blob)
}
#[allow(unrooted_must_root)]
// https://fetch.spec.whatwg.org/#dom-body-formdata
fn FormData(&self) -> Rc<Promise> {
consume_body(self, BodyType::FormData)
}
#[allow(unrooted_must_root)]
// https://fetch.spec.whatwg.org/#dom-body-json
fn Json(&self) -> Rc<Promise> {
consume_body(self, BodyType::Json)
}
#[allow(unrooted_must_root)]
// https://fetch.spec.whatwg.org/#dom-body-arraybuffer
fn ArrayBuffer(&self) -> Rc<Promise> {
consume_body(self, BodyType::ArrayBuffer)

View file

@ -362,31 +362,26 @@ impl ResponseMethods for Response {
self.body_used.get()
}
#[allow(unrooted_must_root)]
// https://fetch.spec.whatwg.org/#dom-body-text
fn Text(&self) -> Rc<Promise> {
consume_body(self, BodyType::Text)
}
#[allow(unrooted_must_root)]
// https://fetch.spec.whatwg.org/#dom-body-blob
fn Blob(&self) -> Rc<Promise> {
consume_body(self, BodyType::Blob)
}
#[allow(unrooted_must_root)]
// https://fetch.spec.whatwg.org/#dom-body-formdata
fn FormData(&self) -> Rc<Promise> {
consume_body(self, BodyType::FormData)
}
#[allow(unrooted_must_root)]
// https://fetch.spec.whatwg.org/#dom-body-json
fn Json(&self) -> Rc<Promise> {
consume_body(self, BodyType::Json)
}
#[allow(unrooted_must_root)]
// https://fetch.spec.whatwg.org/#dom-body-arraybuffer
fn ArrayBuffer(&self) -> Rc<Promise> {
consume_body(self, BodyType::ArrayBuffer)

View file

@ -51,9 +51,9 @@ impl ServiceWorkerContainerMethods for ServiceWorkerContainer {
self.client.get_controller()
}
#[allow(unrooted_must_root)] // Job is unrooted
/// https://w3c.github.io/ServiceWorker/#service-worker-container-register-method and - A
/// https://w3c.github.io/ServiceWorker/#start-register-algorithm - B
#[allow(unrooted_must_root)] // Job is unrooted
fn Register(&self, script_url: USVString, options: &RegistrationOptions) -> Rc<Promise> {
// A: Step 1
let promise = Promise::new(&*self.global());

View file

@ -1006,7 +1006,6 @@ impl TestBindingMethods for TestBinding {
);
}
#[allow(unrooted_must_root)]
fn PromiseNativeHandler(
&self,
resolve: Option<Rc<SimpleCallback>>,
@ -1041,7 +1040,6 @@ impl TestBindingMethods for TestBinding {
}
}
#[allow(unrooted_must_root)]
fn PromiseAttribute(&self) -> Rc<Promise> {
Promise::new(&self.global())
}

View file

@ -51,7 +51,6 @@ impl TestWorklet {
}
impl TestWorkletMethods for TestWorklet {
#[allow(unrooted_must_root)]
fn AddModule(&self, moduleURL: USVString, options: &WorkletOptions) -> Rc<Promise> {
self.worklet.AddModule(moduleURL, options)
}

View file

@ -307,7 +307,6 @@ impl VRDisplayMethods for VRDisplay {
}
}
#[allow(unrooted_must_root)]
// https://w3c.github.io/webvr/#dom-vrdisplay-requestpresent
fn RequestPresent(&self, layers: Vec<VRLayer>) -> Rc<Promise> {
let promise = Promise::new(&self.global());
@ -380,7 +379,6 @@ impl VRDisplayMethods for VRDisplay {
promise
}
#[allow(unrooted_must_root)]
// https://w3c.github.io/webvr/#dom-vrdisplay-exitpresent
fn ExitPresent(&self) -> Rc<Promise> {
let promise = Promise::new(&self.global());

View file

@ -1138,7 +1138,6 @@ impl WindowMethods for Window {
mql
}
#[allow(unrooted_must_root)]
// https://fetch.spec.whatwg.org/#fetch-method
fn Fetch(
&self,

View file

@ -109,7 +109,6 @@ impl Worklet {
}
impl WorkletMethods for Worklet {
#[allow(unrooted_must_root)]
/// <https://drafts.css-houdini.org/worklets/#dom-worklet-addmodule>
fn AddModule(&self, module_url: USVString, options: &WorkletOptions) -> Rc<Promise> {
// Step 1.

View file

@ -57,7 +57,6 @@ impl Drop for XR {
}
impl XRMethods for XR {
#[allow(unrooted_must_root)]
/// https://immersive-web.github.io/webxr/#dom-xr-supportssessionmode
fn SupportsSessionMode(&self, mode: XRSessionMode) -> Rc<Promise> {
// XXXManishearth this should select an XR device first
@ -72,7 +71,6 @@ impl XRMethods for XR {
promise
}
#[allow(unrooted_must_root)]
/// https://immersive-web.github.io/webxr/#dom-xr-requestsession
fn RequestSession(&self, options: &XRSessionCreationOptions) -> Rc<Promise> {
let promise = Promise::new(&self.global());