Remove HeapGCValue

It could be used to have mutable JSVal fields without GC barriers.
With the removal of that trait, MutHeap and MutNullableHeap can respectively
be replaced by MutJS and MutNullableJS.
This commit is contained in:
Anthony Ramine 2016-12-11 01:19:04 -10:00
parent f7d53b7bc1
commit 1327ebd52f
64 changed files with 251 additions and 271 deletions

View file

@ -29,19 +29,19 @@ impl EarlyLintPass for BanPass {
.and_then(|t| t.get(0))
.and_then(|t| match_ty_unwrap(&**t, &["dom", "bindings", "js", "JS"]))
.is_some() {
cx.span_lint(BANNED_TYPE, ty.span, "Banned type Cell<JS<T>> detected. Use MutHeap<JS<T>> instead")
cx.span_lint(BANNED_TYPE, ty.span, "Banned type Cell<JS<T>> detected. Use MutJS<JS<T>> instead")
}
if match_ty_unwrap(ty, &["std", "cell", "Cell"])
.and_then(|t| t.get(0))
.and_then(|t| match_ty_unwrap(&**t, &["js", "jsval", "JSVal"]))
.is_some() {
cx.span_lint(BANNED_TYPE, ty.span, "Banned type Cell<JSVal> detected. Use MutHeap<JSVal> instead")
cx.span_lint(BANNED_TYPE, ty.span, "Banned type Cell<JSVal> detected. Use MutJS<JSVal> instead")
}
if match_ty_unwrap(ty, &["dom", "bindings", "cell", "DOMRefCell"])
.and_then(|t| t.get(0))
.and_then(|t| match_ty_unwrap(&**t, &["dom", "bindings", "js", "JS"]))
.is_some() {
cx.span_lint(BANNED_TYPE, ty.span, "Banned type DOMRefCell<JS<T>> detected. Use MutHeap<JS<T>> instead")
cx.span_lint(BANNED_TYPE, ty.span, "Banned type DOMRefCell<JS<T>> detected. Use MutJS<JS<T>> instead")
}
}
}

View file

@ -6,8 +6,7 @@ use devtools_traits::AttrInfo;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap};
use dom::bindings::js::{LayoutJS, Root, RootedReference};
use dom::bindings::js::{LayoutJS, MutNullableJS, Root, RootedReference};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::element::{AttributeMutation, Element};
@ -28,7 +27,7 @@ pub struct Attr {
value: DOMRefCell<AttrValue>,
/// the element that owns this attribute.
owner: MutNullableHeap<JS<Element>>,
owner: MutNullableJS<Element>,
}
impl Attr {
@ -48,7 +47,7 @@ impl Attr {
prefix: prefix,
},
value: DOMRefCell::new(value),
owner: MutNullableHeap::new(owner),
owner: MutNullableJS::new(owner),
}
}

View file

@ -229,20 +229,6 @@ impl LayoutJS<Node> {
}
}
/// A trait to be implemented for JS-managed types that can be stored in
/// mutable member fields.
///
/// Do not implement this trait yourself.
pub trait HeapGCValue: JSTraceable {
}
impl HeapGCValue for Heap<JSVal> {
}
impl<T: DomObject> HeapGCValue for JS<T> {
}
/// A holder that provides interior mutability for GC-managed JSVals.
///
/// Must be used in place of traditional interior mutability to ensure proper
@ -293,20 +279,20 @@ impl MutHeapJSVal {
/// on `JS<T>`.
#[must_root]
#[derive(JSTraceable)]
pub struct MutHeap<T: HeapGCValue> {
val: UnsafeCell<T>,
pub struct MutJS<T: DomObject> {
val: UnsafeCell<JS<T>>,
}
impl<T: DomObject> MutHeap<JS<T>> {
/// Create a new `MutHeap`.
pub fn new(initial: &T) -> MutHeap<JS<T>> {
impl<T: DomObject> MutJS<T> {
/// Create a new `MutJS`.
pub fn new(initial: &T) -> MutJS<T> {
debug_assert!(thread_state::get().is_script());
MutHeap {
MutJS {
val: UnsafeCell::new(JS::from_ref(initial)),
}
}
/// Set this `MutHeap` to the given value.
/// Set this `MutJS` to the given value.
pub fn set(&self, val: &T) {
debug_assert!(thread_state::get().is_script());
unsafe {
@ -314,7 +300,7 @@ impl<T: DomObject> MutHeap<JS<T>> {
}
}
/// Get the value in this `MutHeap`.
/// Get the value in this `MutJS`.
pub fn get(&self) -> Root<T> {
debug_assert!(thread_state::get().is_script());
unsafe {
@ -323,14 +309,14 @@ impl<T: DomObject> MutHeap<JS<T>> {
}
}
impl<T: HeapGCValue> HeapSizeOf for MutHeap<T> {
impl<T: DomObject> HeapSizeOf for MutJS<T> {
fn heap_size_of_children(&self) -> usize {
// See comment on HeapSizeOf for JS<T>.
0
}
}
impl<T: DomObject> PartialEq for MutHeap<JS<T>> {
impl<T: DomObject> PartialEq for MutJS<T> {
fn eq(&self, other: &Self) -> bool {
unsafe {
*self.val.get() == *other.val.get()
@ -338,7 +324,7 @@ impl<T: DomObject> PartialEq for MutHeap<JS<T>> {
}
}
impl<T: DomObject + PartialEq> PartialEq<T> for MutHeap<JS<T>> {
impl<T: DomObject + PartialEq> PartialEq<T> for MutJS<T> {
fn eq(&self, other: &T) -> bool {
unsafe {
**self.val.get() == *other
@ -354,15 +340,15 @@ impl<T: DomObject + PartialEq> PartialEq<T> for MutHeap<JS<T>> {
/// on `JS<T>`.
#[must_root]
#[derive(JSTraceable)]
pub struct MutNullableHeap<T: HeapGCValue> {
ptr: UnsafeCell<Option<T>>,
pub struct MutNullableJS<T: DomObject> {
ptr: UnsafeCell<Option<JS<T>>>,
}
impl<T: DomObject> MutNullableHeap<JS<T>> {
/// Create a new `MutNullableHeap`.
pub fn new(initial: Option<&T>) -> MutNullableHeap<JS<T>> {
impl<T: DomObject> MutNullableJS<T> {
/// Create a new `MutNullableJS`.
pub fn new(initial: Option<&T>) -> MutNullableJS<T> {
debug_assert!(thread_state::get().is_script());
MutNullableHeap {
MutNullableJS {
ptr: UnsafeCell::new(initial.map(JS::from_ref)),
}
}
@ -400,7 +386,7 @@ impl<T: DomObject> MutNullableHeap<JS<T>> {
}
}
/// Set this `MutNullableHeap` to the given value.
/// Set this `MutNullableJS` to the given value.
pub fn set(&self, val: Option<&T>) {
debug_assert!(thread_state::get().is_script());
unsafe {
@ -416,7 +402,7 @@ impl<T: DomObject> MutNullableHeap<JS<T>> {
}
}
impl<T: DomObject> PartialEq for MutNullableHeap<JS<T>> {
impl<T: DomObject> PartialEq for MutNullableJS<T> {
fn eq(&self, other: &Self) -> bool {
unsafe {
*self.ptr.get() == *other.ptr.get()
@ -424,7 +410,7 @@ impl<T: DomObject> PartialEq for MutNullableHeap<JS<T>> {
}
}
impl<'a, T: DomObject> PartialEq<Option<&'a T>> for MutNullableHeap<JS<T>> {
impl<'a, T: DomObject> PartialEq<Option<&'a T>> for MutNullableJS<T> {
fn eq(&self, other: &Option<&T>) -> bool {
unsafe {
*self.ptr.get() == other.map(JS::from_ref)
@ -432,17 +418,17 @@ impl<'a, T: DomObject> PartialEq<Option<&'a T>> for MutNullableHeap<JS<T>> {
}
}
impl<T: HeapGCValue> Default for MutNullableHeap<T> {
impl<T: DomObject> Default for MutNullableJS<T> {
#[allow(unrooted_must_root)]
fn default() -> MutNullableHeap<T> {
fn default() -> MutNullableJS<T> {
debug_assert!(thread_state::get().is_script());
MutNullableHeap {
MutNullableJS {
ptr: UnsafeCell::new(None),
}
}
}
impl<T: HeapGCValue> HeapSizeOf for MutNullableHeap<T> {
impl<T: DomObject> HeapSizeOf for MutNullableJS<T> {
fn heap_size_of_children(&self) -> usize {
// See comment on HeapSizeOf for JS<T>.
0

View file

@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
use dom::bindings::error::Error::{self, NotFound, Security, Type};
use dom::bindings::error::Fallible;
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::js::{MutJS, Root};
use dom::bindings::refcounted::{Trusted, TrustedPromise};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString;
@ -86,7 +86,7 @@ impl<Listener: AsyncBluetoothListener + DomObject> BluetoothResponseListener for
#[dom_struct]
pub struct Bluetooth {
eventtarget: EventTarget,
device_instance_map: DOMRefCell<HashMap<String, MutHeap<JS<BluetoothDevice>>>>,
device_instance_map: DOMRefCell<HashMap<String, MutJS<BluetoothDevice>>>,
}
impl Bluetooth {
@ -409,7 +409,7 @@ impl AsyncBluetoothListener for Bluetooth {
device.name.map(DOMString::from),
&ad_data,
&self);
device_instance_map.insert(device.id, MutHeap::new(&bt_device));
device_instance_map.insert(device.id, MutJS::new(&bt_device));
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice
// Step 5.
promise.resolve_native(promise_cx, &bt_device);

View file

@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::BluetoothDeviceBinding;
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::js::{JS, Root, MutHeap, MutNullableHeap};
use dom::bindings::js::{MutJS, MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::bluetooth::Bluetooth;
@ -29,12 +29,12 @@ pub struct BluetoothDevice {
eventtarget: EventTarget,
id: DOMString,
name: Option<DOMString>,
ad_data: MutHeap<JS<BluetoothAdvertisingData>>,
gatt: MutNullableHeap<JS<BluetoothRemoteGATTServer>>,
context: MutHeap<JS<Bluetooth>>,
attribute_instance_map: (DOMRefCell<HashMap<String, MutHeap<JS<BluetoothRemoteGATTService>>>>,
DOMRefCell<HashMap<String, MutHeap<JS<BluetoothRemoteGATTCharacteristic>>>>,
DOMRefCell<HashMap<String, MutHeap<JS<BluetoothRemoteGATTDescriptor>>>>),
ad_data: MutJS<BluetoothAdvertisingData>,
gatt: MutNullableJS<BluetoothRemoteGATTServer>,
context: MutJS<Bluetooth>,
attribute_instance_map: (DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTService>>>,
DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTCharacteristic>>>,
DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTDescriptor>>>),
}
impl BluetoothDevice {
@ -47,9 +47,9 @@ impl BluetoothDevice {
eventtarget: EventTarget::new_inherited(),
id: id,
name: name,
ad_data: MutHeap::new(ad_data),
ad_data: MutJS::new(ad_data),
gatt: Default::default(),
context: MutHeap::new(context),
context: MutJS::new(context),
attribute_instance_map: (DOMRefCell::new(HashMap::new()),
DOMRefCell::new(HashMap::new()),
DOMRefCell::new(HashMap::new())),
@ -84,7 +84,7 @@ impl BluetoothDevice {
DOMString::from(service.uuid.clone()),
service.is_primary,
service.instance_id.clone());
service_map.insert(service.instance_id.clone(), MutHeap::new(&bt_service));
service_map.insert(service.instance_id.clone(), MutJS::new(&bt_service));
return bt_service;
}
@ -113,7 +113,7 @@ impl BluetoothDevice {
DOMString::from(characteristic.uuid.clone()),
&properties,
characteristic.instance_id.clone());
characteristic_map.insert(characteristic.instance_id.clone(), MutHeap::new(&bt_characteristic));
characteristic_map.insert(characteristic.instance_id.clone(), MutJS::new(&bt_characteristic));
return bt_characteristic;
}
@ -130,7 +130,7 @@ impl BluetoothDevice {
characteristic,
DOMString::from(descriptor.uuid.clone()),
descriptor.instance_id.clone());
descriptor_map.insert(descriptor.instance_id.clone(), MutHeap::new(&bt_descriptor));
descriptor_map.insert(descriptor.instance_id.clone(), MutJS::new(&bt_descriptor));
return bt_descriptor;
}
}

View file

@ -16,7 +16,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::Bluetoo
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::js::{MutJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString};
use dom::bluetooth::{AsyncBluetoothListener, response_async};
@ -38,9 +38,9 @@ pub const MAXIMUM_ATTRIBUTE_LENGTH: usize = 512;
#[dom_struct]
pub struct BluetoothRemoteGATTCharacteristic {
eventtarget: EventTarget,
service: MutHeap<JS<BluetoothRemoteGATTService>>,
service: MutJS<BluetoothRemoteGATTService>,
uuid: DOMString,
properties: MutHeap<JS<BluetoothCharacteristicProperties>>,
properties: MutJS<BluetoothCharacteristicProperties>,
value: DOMRefCell<Option<ByteString>>,
instance_id: String,
}
@ -53,9 +53,9 @@ impl BluetoothRemoteGATTCharacteristic {
-> BluetoothRemoteGATTCharacteristic {
BluetoothRemoteGATTCharacteristic {
eventtarget: EventTarget::new_inherited(),
service: MutHeap::new(service),
service: MutJS::new(service),
uuid: uuid,
properties: MutHeap::new(properties),
properties: MutJS::new(properties),
value: DOMRefCell::new(None),
instance_id: instance_id,
}

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding::Blue
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
use dom::bindings::error::Error::{self, InvalidModification, Network, Security};
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::js::{MutJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString};
use dom::bluetooth::{AsyncBluetoothListener, response_async};
@ -28,7 +28,7 @@ use std::rc::Rc;
#[dom_struct]
pub struct BluetoothRemoteGATTDescriptor {
reflector_: Reflector,
characteristic: MutHeap<JS<BluetoothRemoteGATTCharacteristic>>,
characteristic: MutJS<BluetoothRemoteGATTCharacteristic>,
uuid: DOMString,
value: DOMRefCell<Option<ByteString>>,
instance_id: String,
@ -41,7 +41,7 @@ impl BluetoothRemoteGATTDescriptor {
-> BluetoothRemoteGATTDescriptor {
BluetoothRemoteGATTDescriptor {
reflector_: Reflector::new(),
characteristic: MutHeap::new(characteristic),
characteristic: MutJS::new(characteristic),
uuid: uuid,
value: DOMRefCell::new(None),
instance_id: instance_id,

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::error::Error::{self, Network, Security};
use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::js::{MutJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bluetooth::{AsyncBluetoothListener, response_async};
use dom::bluetoothdevice::BluetoothDevice;
@ -25,7 +25,7 @@ use std::rc::Rc;
#[dom_struct]
pub struct BluetoothRemoteGATTServer {
reflector_: Reflector,
device: MutHeap<JS<BluetoothDevice>>,
device: MutJS<BluetoothDevice>,
connected: Cell<bool>,
}
@ -33,7 +33,7 @@ impl BluetoothRemoteGATTServer {
pub fn new_inherited(device: &BluetoothDevice) -> BluetoothRemoteGATTServer {
BluetoothRemoteGATTServer {
reflector_: Reflector::new(),
device: MutHeap::new(device),
device: MutJS::new(device),
connected: Cell::new(false),
}
}

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::error::Error::{self, Network, Security};
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::js::{MutJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::bluetooth::{AsyncBluetoothListener, response_async};
@ -27,7 +27,7 @@ use std::rc::Rc;
#[dom_struct]
pub struct BluetoothRemoteGATTService {
eventtarget: EventTarget,
device: MutHeap<JS<BluetoothDevice>>,
device: MutJS<BluetoothDevice>,
uuid: DOMString,
is_primary: bool,
instance_id: String,
@ -41,7 +41,7 @@ impl BluetoothRemoteGATTService {
-> BluetoothRemoteGATTService {
BluetoothRemoteGATTService {
eventtarget: EventTarget::new_inherited(),
device: MutHeap::new(device),
device: MutJS::new(device),
uuid: uuid,
is_primary: is_primary,
instance_id: instance_id,

View file

@ -4,7 +4,7 @@
use dom::bindings::conversions::{ToJSValConvertible, root_from_handleobject};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::bindings::js::{JS, MutNullableJS, Root, RootedReference};
use dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor};
use dom::bindings::reflector::{DomObject, MutDomObject, Reflector};
use dom::bindings::trace::JSTraceable;
@ -43,7 +43,7 @@ pub struct BrowsingContext {
/// The current active document.
/// Note that the session history is stored in the constellation,
/// in the script thread we just track the current active document.
active_document: MutNullableHeap<JS<Document>>,
active_document: MutNullableJS<Document>,
/// The containing iframe element, if this is a same-origin iframe
frame_element: Option<JS<Element>>,

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::ClientBinding::{ClientMethods, Wrap};
use dom::bindings::codegen::Bindings::ClientBinding::FrameType;
use dom::bindings::js::{JS, Root, MutNullableHeap};
use dom::bindings::js::{Root, MutNullableJS};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::{DOMString, USVString};
use dom::serviceworker::ServiceWorker;
@ -16,7 +16,7 @@ use uuid::Uuid;
#[dom_struct]
pub struct Client {
reflector_: Reflector,
active_worker: MutNullableHeap<JS<ServiceWorker>>,
active_worker: MutNullableJS<ServiceWorker>,
url: ServoUrl,
frame_type: FrameType,
#[ignore_heap_size_of = "Defined in uuid"]

View file

@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding;
use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMethods;
use dom::bindings::error::{ErrorResult, Fallible};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::cssrule::CSSRule;
@ -22,7 +22,7 @@ pub struct CSSGroupingRule {
cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"]
rules: Arc<RwLock<StyleCssRules>>,
rulelist: MutNullableHeap<JS<CSSRuleList>>,
rulelist: MutNullableJS<CSSRuleList>,
}
impl CSSGroupingRule {
@ -31,7 +31,7 @@ impl CSSGroupingRule {
CSSGroupingRule {
cssrule: CSSRule::new_inherited(parent_stylesheet),
rules: rules,
rulelist: MutNullableHeap::new(None),
rulelist: MutNullableJS::new(None),
}
}

View file

@ -6,7 +6,7 @@ use cssparser::Parser;
use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding;
use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::csskeyframerule::CSSKeyframeRule;
@ -26,7 +26,7 @@ pub struct CSSKeyframesRule {
cssrule: CSSRule,
#[ignore_heap_size_of = "Arc"]
keyframesrule: Arc<RwLock<KeyframesRule>>,
rulelist: MutNullableHeap<JS<CSSRuleList>>,
rulelist: MutNullableJS<CSSRuleList>,
}
impl CSSKeyframesRule {
@ -35,7 +35,7 @@ impl CSSKeyframesRule {
CSSKeyframesRule {
cssrule: CSSRule::new_inherited(parent_stylesheet),
keyframesrule: keyframesrule,
rulelist: MutNullableHeap::new(None),
rulelist: MutNullableJS::new(None),
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::CSSMediaRuleBinding;
use dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::cssgroupingrule::CSSGroupingRule;
@ -22,7 +22,7 @@ pub struct CSSMediaRule {
cssrule: CSSGroupingRule,
#[ignore_heap_size_of = "Arc"]
mediarule: Arc<RwLock<MediaRule>>,
medialist: MutNullableHeap<JS<MediaList>>,
medialist: MutNullableJS<MediaList>,
}
impl CSSMediaRule {
@ -32,7 +32,7 @@ impl CSSMediaRule {
CSSMediaRule {
cssrule: CSSGroupingRule::new_inherited(parent_stylesheet, list),
mediarule: mediarule,
medialist: MutNullableHeap::new(None),
medialist: MutNullableJS::new(None),
}
}

View file

@ -6,7 +6,7 @@ use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::CSSRuleListBinding;
use dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{JS, MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::csskeyframerule::CSSKeyframeRule;
use dom::cssrule::CSSRule;
@ -38,7 +38,7 @@ pub struct CSSRuleList {
parent_stylesheet: JS<CSSStyleSheet>,
#[ignore_heap_size_of = "Arc"]
rules: RulesSource,
dom_rules: DOMRefCell<Vec<MutNullableHeap<JS<CSSRule>>>>
dom_rules: DOMRefCell<Vec<MutNullableJS<CSSRule>>>
}
pub enum RulesSource {
@ -51,10 +51,10 @@ impl CSSRuleList {
pub fn new_inherited(parent_stylesheet: &CSSStyleSheet, rules: RulesSource) -> CSSRuleList {
let dom_rules = match rules {
RulesSource::Rules(ref rules) => {
rules.read().0.iter().map(|_| MutNullableHeap::new(None)).collect()
rules.read().0.iter().map(|_| MutNullableJS::new(None)).collect()
}
RulesSource::Keyframes(ref rules) => {
rules.read().keyframes.iter().map(|_| MutNullableHeap::new(None)).collect()
rules.read().keyframes.iter().map(|_| MutNullableJS::new(None)).collect()
}
};
@ -92,7 +92,7 @@ impl CSSRuleList {
let parent_stylesheet = &*self.parent_stylesheet;
let dom_rule = CSSRule::new_specific(&window, parent_stylesheet, new_rule);
self.dom_rules.borrow_mut().insert(index, MutNullableHeap::new(Some(&*dom_rule)));
self.dom_rules.borrow_mut().insert(index, MutNullableJS::new(Some(&*dom_rule)));
Ok((idx))
}
@ -158,7 +158,7 @@ impl CSSRuleList {
if let RulesSource::Rules(..) = self.rules {
panic!("Can only call append_lazy_rule with keyframes-backed CSSRules");
}
self.dom_rules.borrow_mut().push(MutNullableHeap::new(None));
self.dom_rules.borrow_mut().push(MutNullableJS::new(None));
}
}

View file

@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::CSSStyleSheetBinding;
use dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
use dom::bindings::error::{ErrorResult, Fallible};
use dom::bindings::js::{JS, Root, MutNullableHeap};
use dom::bindings::js::{JS, MutNullableJS, Root};
use dom::bindings::reflector::{reflect_dom_object, DomObject};
use dom::bindings::str::DOMString;
use dom::cssrulelist::{CSSRuleList, RulesSource};
@ -20,7 +20,7 @@ use style::stylesheets::Stylesheet as StyleStyleSheet;
pub struct CSSStyleSheet {
stylesheet: StyleSheet,
owner: JS<Element>,
rulelist: MutNullableHeap<JS<CSSRuleList>>,
rulelist: MutNullableJS<CSSRuleList>,
#[ignore_heap_size_of = "Arc"]
style_stylesheet: Arc<StyleStyleSheet>,
}
@ -34,7 +34,7 @@ impl CSSStyleSheet {
CSSStyleSheet {
stylesheet: StyleSheet::new_inherited(type_, href, title),
owner: JS::from_ref(owner),
rulelist: MutNullableHeap::new(None),
rulelist: MutNullableJS::new(None),
style_stylesheet: stylesheet,
}
}

View file

@ -24,7 +24,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::{FrameRequestCallback, Scro
use dom::bindings::codegen::UnionTypes::NodeOrString;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root};
use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root};
use dom::bindings::js::RootedReference;
use dom::bindings::num::Finite;
use dom::bindings::refcounted::{Trusted, TrustedPromise};
@ -184,8 +184,8 @@ pub struct Document {
window: JS<Window>,
/// https://html.spec.whatwg.org/multipage/#concept-document-bc
browsing_context: Option<JS<BrowsingContext>>,
implementation: MutNullableHeap<JS<DOMImplementation>>,
location: MutNullableHeap<JS<Location>>,
implementation: MutNullableJS<DOMImplementation>,
location: MutNullableJS<Location>,
content_type: DOMString,
last_modified: Option<String>,
encoding: Cell<EncodingRef>,
@ -197,29 +197,29 @@ pub struct Document {
tag_map: DOMRefCell<HashMap<LocalName, JS<HTMLCollection>>>,
tagns_map: DOMRefCell<HashMap<QualName, JS<HTMLCollection>>>,
classes_map: DOMRefCell<HashMap<Vec<Atom>, JS<HTMLCollection>>>,
images: MutNullableHeap<JS<HTMLCollection>>,
embeds: MutNullableHeap<JS<HTMLCollection>>,
links: MutNullableHeap<JS<HTMLCollection>>,
forms: MutNullableHeap<JS<HTMLCollection>>,
scripts: MutNullableHeap<JS<HTMLCollection>>,
anchors: MutNullableHeap<JS<HTMLCollection>>,
applets: MutNullableHeap<JS<HTMLCollection>>,
images: MutNullableJS<HTMLCollection>,
embeds: MutNullableJS<HTMLCollection>,
links: MutNullableJS<HTMLCollection>,
forms: MutNullableJS<HTMLCollection>,
scripts: MutNullableJS<HTMLCollection>,
anchors: MutNullableJS<HTMLCollection>,
applets: MutNullableJS<HTMLCollection>,
/// List of stylesheets associated with nodes in this document. |None| if the list needs to be refreshed.
stylesheets: DOMRefCell<Option<Vec<StylesheetInDocument>>>,
/// Whether the list of stylesheets has changed since the last reflow was triggered.
stylesheets_changed_since_reflow: Cell<bool>,
stylesheet_list: MutNullableHeap<JS<StyleSheetList>>,
stylesheet_list: MutNullableJS<StyleSheetList>,
ready_state: Cell<DocumentReadyState>,
/// Whether the DOMContentLoaded event has already been dispatched.
domcontentloaded_dispatched: Cell<bool>,
/// The element that has most recently requested focus for itself.
possibly_focused: MutNullableHeap<JS<Element>>,
possibly_focused: MutNullableJS<Element>,
/// The element that currently has the document focus context.
focused: MutNullableHeap<JS<Element>>,
focused: MutNullableJS<Element>,
/// The script element that is currently executing.
current_script: MutNullableHeap<JS<HTMLScriptElement>>,
current_script: MutNullableJS<HTMLScriptElement>,
/// https://html.spec.whatwg.org/multipage/#pending-parsing-blocking-script
pending_parsing_blocking_script: MutNullableHeap<JS<HTMLScriptElement>>,
pending_parsing_blocking_script: MutNullableJS<HTMLScriptElement>,
/// Number of stylesheets that block executing the next parser-inserted script
script_blocking_stylesheets_count: Cell<u32>,
/// https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing
@ -245,14 +245,14 @@ pub struct Document {
/// Tracks all outstanding loads related to this document.
loader: DOMRefCell<DocumentLoader>,
/// The current active HTML parser, to allow resuming after interruptions.
current_parser: MutNullableHeap<JS<ServoParser>>,
current_parser: MutNullableJS<ServoParser>,
/// When we should kick off a reflow. This happens during parsing.
reflow_timeout: Cell<Option<u64>>,
/// The cached first `base` element with an `href` attribute.
base_element: MutNullableHeap<JS<HTMLBaseElement>>,
base_element: MutNullableJS<HTMLBaseElement>,
/// This field is set to the document itself for inert documents.
/// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document
appropriate_template_contents_owner_document: MutNullableHeap<JS<Document>>,
appropriate_template_contents_owner_document: MutNullableJS<Document>,
/// Information on elements needing restyle to ship over to the layout thread when the
/// time comes.
pending_restyles: DOMRefCell<HashMap<JS<Element>, PendingRestyle>>,
@ -280,7 +280,7 @@ pub struct Document {
/// https://html.spec.whatwg.org/multipage/#dom-document-referrer
referrer: Option<String>,
/// https://html.spec.whatwg.org/multipage/#target-element
target_element: MutNullableHeap<JS<Element>>,
target_element: MutNullableJS<Element>,
/// https://w3c.github.io/uievents/#event-type-dblclick
#[ignore_heap_size_of = "Defined in std"]
last_click_info: DOMRefCell<Option<(Instant, Point2D<f32>)>>,
@ -293,7 +293,7 @@ pub struct Document {
/// See also: https://github.com/servo/servo/issues/10110
dom_count: Cell<u32>,
/// Entry node for fullscreen.
fullscreen_element: MutNullableHeap<JS<Element>>,
fullscreen_element: MutNullableJS<Element>,
}
#[derive(JSTraceable, HeapSizeOf)]
@ -1036,7 +1036,7 @@ impl Document {
pub fn handle_mouse_move_event(&self,
js_runtime: *mut JSRuntime,
client_point: Option<Point2D<f32>>,
prev_mouse_over_target: &MutNullableHeap<JS<Element>>) {
prev_mouse_over_target: &MutNullableJS<Element>) {
let client_point = match client_point {
None => {
// If there's no point, there's no target under the mouse
@ -1872,7 +1872,7 @@ impl Document {
applets: Default::default(),
stylesheets: DOMRefCell::new(None),
stylesheets_changed_since_reflow: Cell::new(false),
stylesheet_list: MutNullableHeap::new(None),
stylesheet_list: MutNullableJS::new(None),
ready_state: Cell::new(ready_state),
domcontentloaded_dispatched: Cell::new(domcontentloaded_dispatched),
possibly_focused: Default::default(),
@ -1907,11 +1907,11 @@ impl Document {
origin: origin,
referrer: referrer,
referrer_policy: Cell::new(referrer_policy),
target_element: MutNullableHeap::new(None),
target_element: MutNullableJS::new(None),
last_click_info: DOMRefCell::new(None),
ignore_destructive_writes_counter: Default::default(),
dom_count: Cell::new(1),
fullscreen_element: MutNullableHeap::new(None),
fullscreen_element: MutNullableJS::new(None),
}
}

View file

@ -22,7 +22,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::UnionTypes::NodeOrString;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap};
use dom::bindings::js::{JS, LayoutJS, MutNullableJS};
use dom::bindings::js::{Root, RootedReference};
use dom::bindings::refcounted::{Trusted, TrustedPromise};
use dom::bindings::reflector::DomObject;
@ -125,8 +125,8 @@ pub struct Element {
id_attribute: DOMRefCell<Option<Atom>>,
#[ignore_heap_size_of = "Arc"]
style_attribute: DOMRefCell<Option<Arc<RwLock<PropertyDeclarationBlock>>>>,
attr_list: MutNullableHeap<JS<NamedNodeMap>>,
class_list: MutNullableHeap<JS<DOMTokenList>>,
attr_list: MutNullableJS<NamedNodeMap>,
class_list: MutNullableJS<DOMTokenList>,
state: Cell<ElementState>,
atomic_flags: AtomicElementFlags,
}

View file

@ -6,7 +6,7 @@ use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::EventBinding;
use dom::bindings::codegen::Bindings::EventBinding::{EventConstants, EventMethods};
use dom::bindings::error::Fallible;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::DOMString;
@ -80,8 +80,8 @@ impl From<bool> for EventCancelable {
#[dom_struct]
pub struct Event {
reflector_: Reflector,
current_target: MutNullableHeap<JS<EventTarget>>,
target: MutNullableHeap<JS<EventTarget>>,
current_target: MutNullableJS<EventTarget>,
target: MutNullableJS<EventTarget>,
type_: DOMRefCell<Atom>,
phase: Cell<EventPhase>,
canceled: Cell<bool>,

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::FileReaderBinding::{self, FileReaderConsta
use dom::bindings::codegen::UnionTypes::StringOrObject;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString;
@ -86,7 +86,7 @@ pub enum FileReaderResult {
pub struct FileReader {
eventtarget: EventTarget,
ready_state: Cell<FileReaderReadyState>,
error: MutNullableHeap<JS<DOMException>>,
error: MutNullableJS<DOMException>,
result: DOMRefCell<Option<FileReaderResult>>,
generation_id: Cell<GenerationId>,
}
@ -96,7 +96,7 @@ impl FileReader {
FileReader {
eventtarget: EventTarget::new_inherited(),
ready_state: Cell::new(FileReaderReadyState::Empty),
error: MutNullableHeap::new(None),
error: MutNullableJS::new(None),
result: DOMRefCell::new(None),
generation_id: Cell::new(GenerationId(0)),
}

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::FocusEventBinding::FocusEventMethods;
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
use dom::bindings::error::Fallible;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString;
use dom::event::{EventBubbles, EventCancelable};
@ -20,7 +20,7 @@ use std::default::Default;
#[dom_struct]
pub struct FocusEvent {
uievent: UIEvent,
related_target: MutNullableHeap<JS<EventTarget>>,
related_target: MutNullableJS<EventTarget>,
}
impl FocusEvent {

View file

@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::conversions::root_from_object;
use dom::bindings::error::{ErrorInfo, report_pending_exception};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString;
use dom::crypto::Crypto;
@ -50,7 +50,7 @@ use timers::{OneshotTimers, TimerCallback};
#[dom_struct]
pub struct GlobalScope {
eventtarget: EventTarget,
crypto: MutNullableHeap<JS<Crypto>>,
crypto: MutNullableJS<Crypto>,
next_worker_id: Cell<WorkerId>,
/// Pipeline id associated with this global.

View file

@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::HTMLAnchorElementBinding::HTMLAnchorElemen
use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::str::{DOMString, USVString};
use dom::document::Document;
use dom::domtokenlist::DOMTokenList;
@ -36,7 +36,7 @@ use util::prefs::PREFS;
#[dom_struct]
pub struct HTMLAnchorElement {
htmlelement: HTMLElement,
rel_list: MutNullableHeap<JS<DOMTokenList>>,
rel_list: MutNullableJS<DOMTokenList>,
url: DOMRefCell<Option<ServoUrl>>,
}

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::HTMLAreaElementBinding;
use dom::bindings::codegen::Bindings::HTMLAreaElementBinding::HTMLAreaElementMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::domtokenlist::DOMTokenList;
@ -19,7 +19,7 @@ use style::attr::AttrValue;
#[dom_struct]
pub struct HTMLAreaElement {
htmlelement: HTMLElement,
rel_list: MutNullableHeap<JS<DOMTokenList>>,
rel_list: MutNullableJS<DOMTokenList>,
}
impl HTMLAreaElement {

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::UnionTypes::CanvasRenderingContext2DOrWebGLRendering
use dom::bindings::conversions::ConversionResult;
use dom::bindings::error::{Error, Fallible};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{HeapGCValue, JS, LayoutJS, Root};
use dom::bindings::js::{JS, LayoutJS, Root};
use dom::bindings::num::Finite;
use dom::bindings::str::DOMString;
use dom::canvasrenderingcontext2d::{CanvasRenderingContext2D, LayoutCanvasRenderingContext2DHelpers};
@ -47,8 +47,6 @@ pub enum CanvasContext {
WebGL(JS<WebGLRenderingContext>),
}
impl HeapGCValue for CanvasContext {}
#[dom_struct]
pub struct HTMLCanvasElement {
htmlelement: HTMLElement,

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::HTMLCollectionBinding;
use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, Root, MutNullableHeap};
use dom::bindings::js::{JS, Root, MutNullableJS};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::bindings::trace::JSTraceable;
@ -59,7 +59,7 @@ pub struct HTMLCollection {
// the length of the collection, and a cursor into the collection.
// FIXME: make the cached cursor element a weak pointer
cached_version: Cell<u64>,
cached_cursor_element: MutNullableHeap<JS<Element>>,
cached_cursor_element: MutNullableJS<Element>,
cached_cursor_index: Cell<OptionU32>,
cached_length: Cell<OptionU32>,
}
@ -73,7 +73,7 @@ impl HTMLCollection {
filter: filter,
// Default values for the cache
cached_version: Cell::new(root.inclusive_descendants_version()),
cached_cursor_element: MutNullableHeap::new(None),
cached_cursor_element: MutNullableJS::new(None),
cached_cursor_index: Cell::new(OptionU32::none()),
cached_length: Cell::new(OptionU32::none()),
}

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::error::{Error, ErrorResult};
use dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::str::DOMString;
use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration};
use dom::document::{Document, FocusType};
@ -40,8 +40,8 @@ use style::element_state::*;
#[dom_struct]
pub struct HTMLElement {
element: Element,
style_decl: MutNullableHeap<JS<CSSStyleDeclaration>>,
dataset: MutNullableHeap<JS<DOMStringMap>>,
style_decl: MutNullableJS<CSSStyleDeclaration>,
dataset: MutNullableJS<DOMStringMap>,
}
impl HTMLElement {

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementM
use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods;
use dom::bindings::conversions::DerivedFrom;
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString;
@ -61,7 +61,7 @@ pub struct GenerationId(u32);
pub struct HTMLFormElement {
htmlelement: HTMLElement,
marked_for_reset: Cell<bool>,
elements: MutNullableHeap<JS<HTMLFormControlsCollection>>,
elements: MutNullableJS<HTMLFormControlsCollection>,
generation_id: Cell<GenerationId>
}

View file

@ -19,7 +19,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethod
use dom::bindings::conversions::ToJSValConvertible;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root};
use dom::bindings::js::{LayoutJS, MutNullableJS, Root};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString;
@ -80,7 +80,7 @@ pub struct HTMLIFrameElement {
htmlelement: HTMLElement,
frame_id: FrameId,
pipeline_id: Cell<Option<PipelineId>>,
sandbox: MutNullableHeap<JS<DOMTokenList>>,
sandbox: MutNullableJS<DOMTokenList>,
sandbox_allowance: Cell<Option<SandboxAllowance>>,
load_blocker: DOMRefCell<Option<LoadBlocker>>,
visibility: Cell<bool>,

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementM
use dom::bindings::codegen::Bindings::KeyboardEventBinding::KeyboardEventMethods;
use dom::bindings::error::{Error, ErrorResult};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root, RootedReference};
use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root, RootedReference};
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::element::{AttributeMutation, Element, LayoutElementHelpers, RawLayoutElementHelpers};
@ -94,7 +94,7 @@ pub struct HTMLInputElement {
// https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag
value_dirty: Cell<bool>,
filelist: MutNullableHeap<JS<FileList>>,
filelist: MutNullableJS<FileList>,
}
#[derive(JSTraceable)]
@ -150,7 +150,7 @@ impl HTMLInputElement {
SelectionDirection::None)),
activation_state: DOMRefCell::new(InputActivationState::new()),
value_dirty: Cell::new(false),
filelist: MutNullableHeap::new(None),
filelist: MutNullableJS::new(None),
}
}

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods;
use dom::bindings::codegen::Bindings::HTMLLinkElementBinding;
use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString;
@ -55,10 +55,10 @@ unsafe_no_jsmanaged_fields!(Stylesheet);
#[dom_struct]
pub struct HTMLLinkElement {
htmlelement: HTMLElement,
rel_list: MutNullableHeap<JS<DOMTokenList>>,
rel_list: MutNullableJS<DOMTokenList>,
#[ignore_heap_size_of = "Arc"]
stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>,
cssom_stylesheet: MutNullableHeap<JS<CSSStyleSheet>>,
cssom_stylesheet: MutNullableJS<CSSStyleSheet>,
/// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts
parser_inserted: Cell<bool>,
@ -72,7 +72,7 @@ impl HTMLLinkElement {
rel_list: Default::default(),
parser_inserted: Cell::new(creator == ElementCreator::ParserCreated),
stylesheet: DOMRefCell::new(None),
cssom_stylesheet: MutNullableHeap::new(None),
cssom_stylesheet: MutNullableJS::new(None),
}
}

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementM
use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorConstants::*;
use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{Root, MutNullableHeap, JS};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString;
@ -218,7 +218,7 @@ pub struct HTMLMediaElement {
current_src: DOMRefCell<String>,
generation_id: Cell<u32>,
first_data_load: Cell<bool>,
error: MutNullableHeap<JS<MediaError>>,
error: MutNullableJS<MediaError>,
paused: Cell<bool>,
autoplaying: Cell<bool>,
video: DOMRefCell<Option<VideoMedia>>,

View file

@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HTMLMetaElementBinding;
use dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::str::DOMString;
use dom::cssstylesheet::CSSStyleSheet;
use dom::document::Document;
@ -32,7 +32,7 @@ pub struct HTMLMetaElement {
htmlelement: HTMLElement,
#[ignore_heap_size_of = "Arc"]
stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>,
cssom_stylesheet: MutNullableHeap<JS<CSSStyleSheet>>,
cssom_stylesheet: MutNullableJS<CSSStyleSheet>,
}
impl HTMLMetaElement {
@ -42,7 +42,7 @@ impl HTMLMetaElement {
HTMLMetaElement {
htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
stylesheet: DOMRefCell::new(None),
cssom_stylesheet: MutNullableHeap::new(None),
cssom_stylesheet: MutNullableJS::new(None),
}
}

View file

@ -14,7 +14,7 @@ use dom::bindings::codegen::UnionTypes::HTMLElementOrLong;
use dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement;
//use dom::bindings::error::ErrorResult;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::element::{AttributeMutation, Element};
@ -58,7 +58,7 @@ impl CollectionFilter for OptionsFilter {
#[dom_struct]
pub struct HTMLSelectElement {
htmlelement: HTMLElement,
options: MutNullableHeap<JS<HTMLOptionsCollection>>,
options: MutNullableJS<HTMLOptionsCollection>,
}
static DEFAULT_SELECT_SIZE: u32 = 0;

View file

@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HTMLStyleElementBinding;
use dom::bindings::codegen::Bindings::HTMLStyleElementBinding::HTMLStyleElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::str::DOMString;
use dom::cssstylesheet::CSSStyleSheet;
use dom::document::Document;
@ -29,7 +29,7 @@ pub struct HTMLStyleElement {
htmlelement: HTMLElement,
#[ignore_heap_size_of = "Arc"]
stylesheet: DOMRefCell<Option<Arc<Stylesheet>>>,
cssom_stylesheet: MutNullableHeap<JS<CSSStyleSheet>>,
cssom_stylesheet: MutNullableJS<CSSStyleSheet>,
}
impl HTMLStyleElement {
@ -39,7 +39,7 @@ impl HTMLStyleElement {
HTMLStyleElement {
htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
stylesheet: DOMRefCell::new(None),
cssom_stylesheet: MutNullableHeap::new(None),
cssom_stylesheet: MutNullableJS::new(None),
}
}

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementM
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root, RootedReference};
use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root, RootedReference};
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
@ -31,7 +31,7 @@ pub struct HTMLTableElement {
htmlelement: HTMLElement,
border: Cell<Option<u32>>,
cellspacing: Cell<Option<u32>>,
tbodies: MutNullableHeap<JS<HTMLCollection>>,
tbodies: MutNullableJS<HTMLCollection>,
}
#[allow(unrooted_must_root)]

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableS
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::error::{ErrorResult, Fallible};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root, RootedReference};
use dom::bindings::js::{LayoutJS, MutNullableJS, Root, RootedReference};
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::element::{Element, RawLayoutElementHelpers};
@ -36,7 +36,7 @@ impl CollectionFilter for CellsFilter {
#[dom_struct]
pub struct HTMLTableRowElement {
htmlelement: HTMLElement,
cells: MutNullableHeap<JS<HTMLCollection>>,
cells: MutNullableJS<HTMLCollection>,
}
impl HTMLTableRowElement {

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding;
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::documentfragment::DocumentFragment;
@ -21,7 +21,7 @@ pub struct HTMLTemplateElement {
htmlelement: HTMLElement,
/// https://html.spec.whatwg.org/multipage/#template-contents
contents: MutNullableHeap<JS<DocumentFragment>>,
contents: MutNullableJS<DocumentFragment>,
}
impl HTMLTemplateElement {
@ -31,7 +31,7 @@ impl HTMLTemplateElement {
HTMLTemplateElement {
htmlelement:
HTMLElement::new_inherited(local_name, prefix, document),
contents: MutNullableHeap::new(None),
contents: MutNullableJS::new(None),
}
}

View file

@ -32,8 +32,8 @@
//! * rooting pointers on the stack:
//! the [`Root`](bindings/js/struct.Root.html) smart pointer;
//! * tracing pointers in member fields: the [`JS`](bindings/js/struct.JS.html),
//! [`MutNullableHeap`](bindings/js/struct.MutNullableHeap.html) and
//! [`MutHeap`](bindings/js/struct.MutHeap.html) smart pointers and
//! [`MutNullableJS`](bindings/js/struct.MutNullableJS.html) and
//! [`MutJS`](bindings/js/struct.MutJS.html) smart pointers and
//! [the tracing implementation](bindings/trace/index.html);
//! * rooting pointers from across thread boundaries or in channels: the
//! [`Trusted`](bindings/refcounted/struct.Trusted.html) smart pointer;

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods;
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
use dom::bindings::error::Fallible;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable};
@ -30,7 +30,7 @@ pub struct MouseEvent {
alt_key: Cell<bool>,
meta_key: Cell<bool>,
button: Cell<i16>,
related_target: MutNullableHeap<JS<EventTarget>>,
related_target: MutNullableJS<EventTarget>,
}
impl MouseEvent {

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::NavigatorBinding;
use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{Reflector, DomObject, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::bluetooth::Bluetooth;
@ -17,10 +17,10 @@ use dom::window::Window;
#[dom_struct]
pub struct Navigator {
reflector_: Reflector,
bluetooth: MutNullableHeap<JS<Bluetooth>>,
plugins: MutNullableHeap<JS<PluginArray>>,
mime_types: MutNullableHeap<JS<MimeTypeArray>>,
service_worker: MutNullableHeap<JS<ServiceWorkerContainer>>,
bluetooth: MutNullableJS<Bluetooth>,
plugins: MutNullableJS<PluginArray>,
mime_types: MutNullableJS<MimeTypeArray>,
service_worker: MutNullableJS<ServiceWorkerContainer>,
}
impl Navigator {

View file

@ -21,7 +21,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::{Castable, CharacterDataTypeId, ElementTypeId};
use dom::bindings::inheritance::{EventTargetTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::inheritance::{SVGElementTypeId, SVGGraphicsElementTypeId};
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap};
use dom::bindings::js::{JS, LayoutJS, MutNullableJS};
use dom::bindings::js::Root;
use dom::bindings::js::RootedReference;
use dom::bindings::reflector::{DomObject, reflect_dom_object};
@ -95,25 +95,25 @@ pub struct Node {
eventtarget: EventTarget,
/// The parent of this node.
parent_node: MutNullableHeap<JS<Node>>,
parent_node: MutNullableJS<Node>,
/// The first child of this node.
first_child: MutNullableHeap<JS<Node>>,
first_child: MutNullableJS<Node>,
/// The last child of this node.
last_child: MutNullableHeap<JS<Node>>,
last_child: MutNullableJS<Node>,
/// The next sibling of this node.
next_sibling: MutNullableHeap<JS<Node>>,
next_sibling: MutNullableJS<Node>,
/// The previous sibling of this node.
prev_sibling: MutNullableHeap<JS<Node>>,
prev_sibling: MutNullableJS<Node>,
/// The document that this node belongs to.
owner_doc: MutNullableHeap<JS<Document>>,
owner_doc: MutNullableJS<Document>,
/// The live list of children return by .childNodes.
child_list: MutNullableHeap<JS<NodeList>>,
child_list: MutNullableJS<NodeList>,
/// The live count of children of this node.
children_count: Cell<u32>,
@ -1370,7 +1370,7 @@ impl Node {
last_child: Default::default(),
next_sibling: Default::default(),
prev_sibling: Default::default(),
owner_doc: MutNullableHeap::new(doc),
owner_doc: MutNullableJS::new(doc),
child_list: Default::default(),
children_count: Cell::new(0u32),
flags: Cell::new(flags),

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilterConstants;
use dom::bindings::codegen::Bindings::NodeIteratorBinding;
use dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods;
use dom::bindings::error::Fallible;
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::js::{JS, MutJS, Root};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::document::Document;
use dom::node::Node;
@ -21,7 +21,7 @@ pub struct NodeIterator {
reflector_: Reflector,
root_node: JS<Node>,
#[ignore_heap_size_of = "Defined in rust-mozjs"]
reference_node: MutHeap<JS<Node>>,
reference_node: MutJS<Node>,
pointer_before_reference_node: Cell<bool>,
what_to_show: u32,
#[ignore_heap_size_of = "Can't measure due to #6870"]
@ -35,7 +35,7 @@ impl NodeIterator {
NodeIterator {
reflector_: Reflector::new(),
root_node: JS::from_ref(root_node),
reference_node: MutHeap::new(root_node),
reference_node: MutJS::new(root_node),
pointer_before_reference_node: Cell::new(true),
what_to_show: what_to_show,
filter: filter

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::Bindings::NodeListBinding;
use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::bindings::js::{JS, MutNullableJS, Root, RootedReference};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::node::{ChildrenMutation, Node};
use dom::window::Window;
@ -111,7 +111,7 @@ impl NodeList {
pub struct ChildrenList {
node: JS<Node>,
#[ignore_heap_size_of = "Defined in rust-mozjs"]
last_visited: MutNullableHeap<JS<Node>>,
last_visited: MutNullableJS<Node>,
last_index: Cell<u32>,
}
@ -120,7 +120,7 @@ impl ChildrenList {
let last_visited = node.GetFirstChild();
ChildrenList {
node: JS::from_ref(node),
last_visited: MutNullableHeap::new(last_visited.r()),
last_visited: MutNullableJS::new(last_visited.r()),
last_index: Cell::new(0u32),
}
}

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutHeap, Root, RootedReference};
use dom::bindings::js::{JS, MutJS, Root, RootedReference};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::bindings::trace::JSTraceable;
@ -934,7 +934,7 @@ impl RangeMethods for Range {
#[privatize]
#[derive(HeapSizeOf)]
pub struct BoundaryPoint {
node: MutHeap<JS<Node>>,
node: MutJS<Node>,
offset: Cell<u32>,
}
@ -943,7 +943,7 @@ impl BoundaryPoint {
debug_assert!(!node.is_doctype());
debug_assert!(offset <= node.len());
BoundaryPoint {
node: MutHeap::new(node),
node: MutJS::new(node),
offset: Cell::new(offset),
}
}

View file

@ -17,7 +17,7 @@ use dom::bindings::codegen::Bindings::RequestBinding::RequestMode;
use dom::bindings::codegen::Bindings::RequestBinding::RequestRedirect;
use dom::bindings::codegen::Bindings::RequestBinding::RequestType;
use dom::bindings::error::{Error, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString, USVString};
use dom::globalscope::GlobalScope;
@ -45,7 +45,7 @@ pub struct Request {
reflector_: Reflector,
request: DOMRefCell<NetTraitsRequest>,
body_used: Cell<bool>,
headers: MutNullableHeap<JS<Headers>>,
headers: MutNullableJS<Headers>,
mime_type: DOMRefCell<Vec<u8>>,
#[ignore_heap_size_of = "Rc"]
body_promise: DOMRefCell<Option<(Rc<Promise>, BodyType)>>,

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::ResponseBinding;
use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, ResponseType as DOMResponseType};
use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit;
use dom::bindings::error::{Error, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, USVString};
use dom::globalscope::GlobalScope;
@ -32,7 +32,7 @@ use url::Position;
#[dom_struct]
pub struct Response {
reflector_: Reflector,
headers_reflector: MutNullableHeap<JS<Headers>>,
headers_reflector: MutNullableJS<Headers>,
mime_type: DOMRefCell<Vec<u8>>,
body_used: Cell<bool>,
/// `None` can be considered a StatusCode of `0`.

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ServiceWorkerContainerMethods, Wrap};
use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions;
use dom::bindings::error::Error;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{JS, MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::USVString;
use dom::client::Client;
@ -22,7 +22,7 @@ use std::rc::Rc;
#[dom_struct]
pub struct ServiceWorkerContainer {
eventtarget: EventTarget,
controller: MutNullableHeap<JS<ServiceWorker>>,
controller: MutNullableJS<ServiceWorker>,
client: JS<Client>
}

View file

@ -6,7 +6,7 @@
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{JS, MutNullableJS, Root};
use dom::bindings::str::DOMString;
use dom::bindings::trace::JSTraceable;
use dom::comment::Comment;
@ -97,7 +97,7 @@ unsafe impl JSTraceable for XmlTokenizer<XmlTreeBuilder<JS<Node>, Sink>> {
struct Sink {
base_url: ServoUrl,
document: JS<Document>,
script: MutNullableHeap<JS<HTMLScriptElement>>,
script: MutNullableJS<HTMLScriptElement>,
}
impl<'a> TreeSink for Sink {

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::StorageEventBinding;
use dom::bindings::codegen::Bindings::StorageEventBinding::StorageEventMethods;
use dom::bindings::error::Fallible;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable};
@ -23,7 +23,7 @@ pub struct StorageEvent {
old_value: Option<DOMString>,
new_value: Option<DOMString>,
url: DOMString,
storage_area: MutNullableHeap<JS<Storage>>
storage_area: MutNullableJS<Storage>
}
@ -39,7 +39,7 @@ impl StorageEvent {
old_value: old_value,
new_value: new_value,
url: url,
storage_area: MutNullableHeap::new(storage_area)
storage_area: MutNullableJS::new(storage_area)
}
}

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::TouchBinding;
use dom::bindings::codegen::Bindings::TouchBinding::TouchMethods;
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::js::{MutJS, Root};
use dom::bindings::num::Finite;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::eventtarget::EventTarget;
@ -14,7 +14,7 @@ use dom::window::Window;
pub struct Touch {
reflector_: Reflector,
identifier: i32,
target: MutHeap<JS<EventTarget>>,
target: MutJS<EventTarget>,
screen_x: f64,
screen_y: f64,
client_x: f64,
@ -31,7 +31,7 @@ impl Touch {
Touch {
reflector_: Reflector::new(),
identifier: identifier,
target: MutHeap::new(target),
target: MutJS::new(target),
screen_x: *screen_x,
screen_y: *screen_y,
client_x: *client_x,

View file

@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::TouchEventBinding;
use dom::bindings::codegen::Bindings::TouchEventBinding::TouchEventMethods;
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::js::{MutJS, Root};
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString;
use dom::event::{EventBubbles, EventCancelable};
@ -18,9 +18,9 @@ use std::cell::Cell;
#[dom_struct]
pub struct TouchEvent {
uievent: UIEvent,
touches: MutHeap<JS<TouchList>>,
target_touches: MutHeap<JS<TouchList>>,
changed_touches: MutHeap<JS<TouchList>>,
touches: MutJS<TouchList>,
target_touches: MutJS<TouchList>,
changed_touches: MutJS<TouchList>,
alt_key: Cell<bool>,
meta_key: Cell<bool>,
ctrl_key: Cell<bool>,
@ -33,9 +33,9 @@ impl TouchEvent {
target_touches: &TouchList) -> TouchEvent {
TouchEvent {
uievent: UIEvent::new_inherited(),
touches: MutHeap::new(touches),
target_touches: MutHeap::new(target_touches),
changed_touches: MutHeap::new(changed_touches),
touches: MutJS::new(touches),
target_touches: MutJS::new(target_touches),
changed_touches: MutJS::new(changed_touches),
ctrl_key: Cell::new(false),
shift_key: Cell::new(false),
alt_key: Cell::new(false),

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilterConstants;
use dom::bindings::codegen::Bindings::TreeWalkerBinding;
use dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods;
use dom::bindings::error::Fallible;
use dom::bindings::js::{JS, MutHeap};
use dom::bindings::js::{JS, MutJS};
use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::document::Document;
@ -21,7 +21,7 @@ use std::rc::Rc;
pub struct TreeWalker {
reflector_: Reflector,
root_node: JS<Node>,
current_node: MutHeap<JS<Node>>,
current_node: MutJS<Node>,
what_to_show: u32,
#[ignore_heap_size_of = "function pointers and Rc<T> are hard"]
filter: Filter
@ -34,7 +34,7 @@ impl TreeWalker {
TreeWalker {
reflector_: Reflector::new(),
root_node: JS::from_ref(root_node),
current_node: MutHeap::new(root_node),
current_node: MutJS::new(root_node),
what_to_show: what_to_show,
filter: filter
}

View file

@ -7,8 +7,7 @@ use dom::bindings::codegen::Bindings::UIEventBinding;
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
use dom::bindings::error::Fallible;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, RootedReference};
use dom::bindings::js::Root;
use dom::bindings::js::{MutNullableJS, Root, RootedReference};
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable};
@ -21,7 +20,7 @@ use std::default::Default;
#[dom_struct]
pub struct UIEvent {
event: Event,
view: MutNullableHeap<JS<Window>>,
view: MutNullableJS<Window>,
detail: Cell<i32>
}

View file

@ -6,7 +6,7 @@ use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
use dom::bindings::codegen::Bindings::URLBinding::{self, URLMethods};
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{DOMString, USVString};
use dom::blob::Blob;
@ -30,7 +30,7 @@ pub struct URL {
url: DOMRefCell<ServoUrl>,
// https://url.spec.whatwg.org/#dom-url-searchparams
search_params: MutNullableHeap<JS<URLSearchParams>>,
search_params: MutNullableJS<URLSearchParams>,
}
impl URL {

View file

@ -7,7 +7,7 @@ use canvas_traits::CanvasMsg;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::WebGLFramebufferBinding;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::js::{HeapGCValue, JS, Root};
use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::reflect_dom_object;
use dom::webglobject::WebGLObject;
use dom::webglrenderbuffer::WebGLRenderbuffer;
@ -25,8 +25,6 @@ enum WebGLFramebufferAttachment {
Texture { texture: JS<WebGLTexture>, level: i32 },
}
impl HeapGCValue for WebGLFramebufferAttachment {}
#[dom_struct]
pub struct WebGLFramebuffer {
webgl_object: WebGLObject,

View file

@ -6,7 +6,7 @@
use canvas_traits::CanvasMsg;
use dom::bindings::codegen::Bindings::WebGLProgramBinding;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::webglactiveinfo::WebGLActiveInfo;
@ -27,8 +27,8 @@ pub struct WebGLProgram {
is_deleted: Cell<bool>,
link_called: Cell<bool>,
linked: Cell<bool>,
fragment_shader: MutNullableHeap<JS<WebGLShader>>,
vertex_shader: MutNullableHeap<JS<WebGLShader>>,
fragment_shader: MutNullableJS<WebGLShader>,
vertex_shader: MutNullableJS<WebGLShader>,
#[ignore_heap_size_of = "Defined in ipc-channel"]
renderer: IpcSender<CanvasMsg>,
}

View file

@ -13,7 +13,7 @@ use dom::bindings::conversions::{array_buffer_to_vec, array_buffer_view_data, ar
use dom::bindings::conversions::{array_buffer_view_to_vec, array_buffer_view_to_vec_checked};
use dom::bindings::error::{Error, Fallible};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root};
use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable};
@ -124,13 +124,13 @@ pub struct WebGLRenderingContext {
#[ignore_heap_size_of = "Defined in webrender_traits"]
last_error: Cell<Option<WebGLError>>,
texture_unpacking_settings: Cell<TextureUnpacking>,
bound_framebuffer: MutNullableHeap<JS<WebGLFramebuffer>>,
bound_renderbuffer: MutNullableHeap<JS<WebGLRenderbuffer>>,
bound_texture_2d: MutNullableHeap<JS<WebGLTexture>>,
bound_texture_cube_map: MutNullableHeap<JS<WebGLTexture>>,
bound_buffer_array: MutNullableHeap<JS<WebGLBuffer>>,
bound_buffer_element_array: MutNullableHeap<JS<WebGLBuffer>>,
current_program: MutNullableHeap<JS<WebGLProgram>>,
bound_framebuffer: MutNullableJS<WebGLFramebuffer>,
bound_renderbuffer: MutNullableJS<WebGLRenderbuffer>,
bound_texture_2d: MutNullableJS<WebGLTexture>,
bound_texture_cube_map: MutNullableJS<WebGLTexture>,
bound_buffer_array: MutNullableJS<WebGLBuffer>,
bound_buffer_element_array: MutNullableJS<WebGLBuffer>,
current_program: MutNullableJS<WebGLProgram>,
#[ignore_heap_size_of = "Because it's small"]
current_vertex_attrib_0: Cell<(f32, f32, f32, f32)>,
#[ignore_heap_size_of = "Because it's small"]
@ -159,13 +159,13 @@ impl WebGLRenderingContext {
canvas: JS::from_ref(canvas),
last_error: Cell::new(None),
texture_unpacking_settings: Cell::new(CONVERT_COLORSPACE),
bound_framebuffer: MutNullableHeap::new(None),
bound_texture_2d: MutNullableHeap::new(None),
bound_texture_cube_map: MutNullableHeap::new(None),
bound_buffer_array: MutNullableHeap::new(None),
bound_buffer_element_array: MutNullableHeap::new(None),
bound_renderbuffer: MutNullableHeap::new(None),
current_program: MutNullableHeap::new(None),
bound_framebuffer: MutNullableJS::new(None),
bound_texture_2d: MutNullableJS::new(None),
bound_texture_cube_map: MutNullableJS::new(None),
bound_buffer_array: MutNullableJS::new(None),
bound_buffer_element_array: MutNullableJS::new(None),
bound_renderbuffer: MutNullableJS::new(None),
current_program: MutNullableJS::new(None),
current_vertex_attrib_0: Cell::new((0f32, 0f32, 0f32, 1f32)),
current_scissor: Cell::new((0, 0, size.width, size.height)),
current_clear_color: Cell::new((0.0, 0.0, 0.0, 0.0))

View file

@ -19,7 +19,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOp
use dom::bindings::codegen::UnionTypes::RequestOrUSVString;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::num::Finite;
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject;
@ -159,19 +159,19 @@ pub struct Window {
history_traversal_task_source: HistoryTraversalTaskSource,
#[ignore_heap_size_of = "task sources are hard"]
file_reading_task_source: FileReadingTaskSource,
navigator: MutNullableHeap<JS<Navigator>>,
navigator: MutNullableJS<Navigator>,
#[ignore_heap_size_of = "channels are hard"]
image_cache_thread: ImageCacheThread,
#[ignore_heap_size_of = "channels are hard"]
image_cache_chan: ImageCacheChan,
browsing_context: MutNullableHeap<JS<BrowsingContext>>,
history: MutNullableHeap<JS<History>>,
performance: MutNullableHeap<JS<Performance>>,
browsing_context: MutNullableJS<BrowsingContext>,
history: MutNullableJS<History>,
performance: MutNullableJS<Performance>,
navigation_start: u64,
navigation_start_precise: f64,
screen: MutNullableHeap<JS<Screen>>,
session_storage: MutNullableHeap<JS<Storage>>,
local_storage: MutNullableHeap<JS<Storage>>,
screen: MutNullableJS<Screen>,
session_storage: MutNullableJS<Storage>,
local_storage: MutNullableJS<Storage>,
status: DOMRefCell<DOMString>,
/// For sending timeline markers. Will be ignored if
@ -241,7 +241,7 @@ pub struct Window {
/// All the MediaQueryLists we need to update
media_query_lists: WeakMediaQueryListVec,
test_runner: MutNullableHeap<JS<TestRunner>>,
test_runner: MutNullableJS<TestRunner>,
}
impl Window {

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScop
use dom::bindings::codegen::UnionTypes::RequestOrUSVString;
use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString;
@ -73,8 +73,8 @@ pub struct WorkerGlobalScope {
closing: Option<Arc<AtomicBool>>,
#[ignore_heap_size_of = "Defined in js"]
runtime: Runtime,
location: MutNullableHeap<JS<WorkerLocation>>,
navigator: MutNullableHeap<JS<WorkerNavigator>>,
location: MutNullableJS<WorkerLocation>,
navigator: MutNullableJS<WorkerNavigator>,
#[ignore_heap_size_of = "Defined in ipc-channel"]
/// Optional `IpcSender` for sending the `DevtoolScriptControlMsg`

View file

@ -14,7 +14,7 @@ use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::XMLHttpRequestRespo
use dom::bindings::conversions::ToJSValConvertible;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutHeapJSVal, MutNullableHeap, Root};
use dom::bindings::js::{JS, MutHeapJSVal, MutNullableJS, Root};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString, USVString, is_token};
@ -122,8 +122,8 @@ pub struct XMLHttpRequest {
status_text: DOMRefCell<ByteString>,
response: DOMRefCell<ByteString>,
response_type: Cell<XMLHttpRequestResponseType>,
response_xml: MutNullableHeap<JS<Document>>,
response_blob: MutNullableHeap<JS<Blob>>,
response_xml: MutNullableJS<Document>,
response_blob: MutNullableJS<Blob>,
#[ignore_heap_size_of = "Defined in rust-mozjs"]
response_json: MutHeapJSVal,
#[ignore_heap_size_of = "Defined in hyper"]

View file

@ -32,7 +32,7 @@ use dom::bindings::codegen::Bindings::TransitionEventBinding::TransitionEventIni
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, StringificationBehavior};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootCollection};
use dom::bindings::js::{JS, MutNullableJS, Root, RootCollection};
use dom::bindings::js::{RootCollectionPtr, RootedReference};
use dom::bindings::num::Finite;
use dom::bindings::refcounted::Trusted;
@ -461,7 +461,7 @@ pub struct ScriptThread {
js_runtime: Rc<Runtime>,
/// The topmost element over the mouse.
topmost_mouse_over_target: MutNullableHeap<JS<Element>>,
topmost_mouse_over_target: MutNullableJS<Element>,
/// List of pipelines that have been owned and closed by this script thread.
closed_pipelines: DOMRefCell<HashSet<PipelineId>>,
@ -686,7 +686,7 @@ impl ScriptThread {
devtools_sender: ipc_devtools_sender,
js_runtime: Rc::new(runtime),
topmost_mouse_over_target: MutNullableHeap::new(Default::default()),
topmost_mouse_over_target: MutNullableJS::new(Default::default()),
closed_pipelines: DOMRefCell::new(HashSet::new()),
scheduler_chan: state.scheduler_chan,

View file

@ -13,7 +13,7 @@ use script::dom::node::Node;
struct Foo {
bar: DOMRefCell<JS<Node>>
//~^ ERROR Banned type DOMRefCell<JS<T>> detected. Use MutHeap<JS<T>> instead,
//~^ ERROR Banned type DOMRefCell<JS<T>> detected. Use MutJS<JS<T>> instead,
}
fn main() {}

View file

@ -12,7 +12,7 @@ use std::cell::Cell;
struct Foo {
bar: Cell<JSVal>
//~^ ERROR Banned type Cell<JSVal> detected. Use MutHeap<JSVal> instead,
//~^ ERROR Banned type Cell<JSVal> detected. Use MutJS<JSVal> instead,
}
fn main() {}