Update to SpiderMonkey 66.

This commit is contained in:
Josh Matthews 2019-05-06 11:38:34 -04:00
parent d0d3401361
commit 4328713f71
31 changed files with 150 additions and 144 deletions

View file

@ -37,9 +37,9 @@ use html5ever::{LocalName, Namespace, Prefix};
use js::conversions::ToJSValConvertible;
use js::glue::UnwrapObject;
use js::jsapi::{HandleValueArray, Heap, IsCallable, IsConstructor};
use js::jsapi::{JSAutoCompartment, JSContext, JSObject};
use js::jsapi::{JSAutoRealm, JSContext, JSObject};
use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue};
use js::rust::wrappers::{Construct1, JS_GetProperty, JS_SameValue};
use js::rust::wrappers::{Construct1, JS_GetProperty, SameValue};
use js::rust::{HandleObject, HandleValue, MutableHandleValue};
use std::cell::Cell;
use std::collections::{HashMap, VecDeque};
@ -324,7 +324,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
// Steps 10.1 - 10.2
rooted!(in(cx) let mut prototype = UndefinedValue());
{
let _ac = JSAutoCompartment::new(cx, constructor.get());
let _ac = JSAutoRealm::new(cx, constructor.get());
if let Err(error) = self.check_prototype(constructor.handle(), prototype.handle_mut()) {
self.element_definition_is_running.set(false);
return Err(error);
@ -334,7 +334,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
// Steps 10.3 - 10.4
rooted!(in(cx) let proto_object = prototype.to_object());
let callbacks = {
let _ac = JSAutoCompartment::new(cx, proto_object.get());
let _ac = JSAutoRealm::new(cx, proto_object.get());
match unsafe { self.get_callbacks(proto_object.handle()) } {
Ok(callbacks) => callbacks,
Err(error) => {
@ -346,7 +346,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
// Step 10.5 - 10.6
let observed_attributes = if callbacks.attribute_changed_callback.is_some() {
let _ac = JSAutoCompartment::new(cx, constructor.get());
let _ac = JSAutoRealm::new(cx, constructor.get());
match self.get_observed_attributes(constructor.handle()) {
Ok(attributes) => attributes,
Err(error) => {
@ -535,7 +535,7 @@ impl CustomElementDefinition {
rooted!(in(cx) let mut element = ptr::null_mut::<JSObject>());
{
// Go into the constructor's compartment
let _ac = JSAutoCompartment::new(cx, self.constructor.callback());
let _ac = JSAutoRealm::new(cx, self.constructor.callback());
let args = HandleValueArray::new();
if unsafe { !Construct1(cx, constructor.handle(), &args, element.handle_mut()) } {
return Err(Error::JSFailed);
@ -665,7 +665,7 @@ fn run_upgrade_constructor(
rooted!(in(cx) let mut construct_result = ptr::null_mut::<JSObject>());
{
// Go into the constructor's compartment
let _ac = JSAutoCompartment::new(cx, constructor.callback());
let _ac = JSAutoRealm::new(cx, constructor.callback());
let args = HandleValueArray::new();
// Step 7.1
if unsafe {
@ -682,7 +682,7 @@ fn run_upgrade_constructor(
let mut same = false;
rooted!(in(cx) let construct_result_val = ObjectValue(construct_result.get()));
if unsafe {
!JS_SameValue(
!SameValue(
cx,
construct_result_val.handle(),
element_val.handle(),