mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a
This commit is contained in:
parent
26045d7fcb
commit
d1b433a3b3
160 changed files with 1427 additions and 1162 deletions
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![deny(missing_doc)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
//! Base classes to work with IDL callbacks.
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use dom::bindings::trace::JSTraceable;
|
|||
use js::jsapi::{JSTracer};
|
||||
|
||||
use servo_util::task_state;
|
||||
use servo_util::task_state::{Script, InGC};
|
||||
use servo_util::task_state::{SCRIPT, IN_GC};
|
||||
|
||||
use std::cell::{Cell, UnsafeCell};
|
||||
use std::kinds::marker;
|
||||
|
@ -39,7 +39,7 @@ impl<T> DOMRefCell<T> {
|
|||
/// This succeeds even if the object is mutably borrowed,
|
||||
/// so you have to be careful in trace code!
|
||||
pub unsafe fn borrow_for_gc_trace<'a>(&'a self) -> &'a T {
|
||||
debug_assert!(task_state::get().contains(Script | InGC));
|
||||
debug_assert!(task_state::get().contains(SCRIPT | IN_GC));
|
||||
&*self.value.get()
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,8 @@ impl<T: JSTraceable> JSTraceable for DOMRefCell<T> {
|
|||
// Values [1, MAX-1] represent the number of `Ref` active
|
||||
// (will not outgrow its range since `uint` is the size of the address space)
|
||||
type BorrowFlag = uint;
|
||||
static UNUSED: BorrowFlag = 0;
|
||||
static WRITING: BorrowFlag = -1;
|
||||
const UNUSED: BorrowFlag = 0;
|
||||
const WRITING: BorrowFlag = -1;
|
||||
|
||||
impl<T> DOMRefCell<T> {
|
||||
pub fn new(value: T) -> DOMRefCell<T> {
|
||||
|
@ -108,14 +108,14 @@ impl<T> DOMRefCell<T> {
|
|||
pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
|
||||
match self.try_borrow() {
|
||||
Some(ptr) => ptr,
|
||||
None => fail!("DOMRefCell<T> already mutably borrowed")
|
||||
None => panic!("DOMRefCell<T> already mutably borrowed")
|
||||
}
|
||||
}
|
||||
|
||||
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
|
||||
match self.try_borrow_mut() {
|
||||
Some(ptr) => ptr,
|
||||
None => fail!("DOMRefCell<T> already borrowed")
|
||||
None => panic!("DOMRefCell<T> already borrowed")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ class CGMethodCall(CGThing):
|
|||
nativeMethodName + '_'*signatureIndex,
|
||||
static, descriptor,
|
||||
method, argConversionStartsAt)
|
||||
|
||||
|
||||
|
||||
signatures = method.signatures()
|
||||
if len(signatures) == 1:
|
||||
|
@ -203,7 +203,7 @@ class CGMethodCall(CGThing):
|
|||
"}" % (requiredArgs, methodName))
|
||||
self.cgRoot.prepend(
|
||||
CGWrapper(CGGeneric(code), pre="\n", post="\n"))
|
||||
|
||||
|
||||
return
|
||||
|
||||
# Need to find the right overload
|
||||
|
@ -277,7 +277,7 @@ class CGMethodCall(CGThing):
|
|||
s[1][distinguishingIndex].type.isNonCallbackInterface()) ]
|
||||
# There might be more than one of these; we need to check
|
||||
# which ones we unwrap to.
|
||||
|
||||
|
||||
if len(interfacesSigs) > 0:
|
||||
# The spec says that we should check for "platform objects
|
||||
# implementing an interface", but it's enough to guard on these
|
||||
|
@ -381,7 +381,7 @@ class CGMethodCall(CGThing):
|
|||
"return 0;\n" % methodName)))
|
||||
#XXXjdm Avoid unreachable statement warnings
|
||||
#overloadCGThings.append(
|
||||
# CGGeneric('fail!("We have an always-returning default case");\n'
|
||||
# CGGeneric('panic!("We have an always-returning default case");\n'
|
||||
# 'return 0;'))
|
||||
self.cgRoot = CGWrapper(CGList(overloadCGThings, "\n"),
|
||||
pre="\n")
|
||||
|
@ -686,7 +686,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
|||
value = "Some(%s)" % value
|
||||
|
||||
default = (
|
||||
"static data: [u8, ..%s] = [ %s ];\n"
|
||||
"const data: [u8, ..%s] = [ %s ];\n"
|
||||
"%s" %
|
||||
(len(defaultValue.value) + 1,
|
||||
", ".join(["'" + char + "' as u8" for char in defaultValue.value] + ["0"]),
|
||||
|
@ -724,7 +724,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
|||
handleInvalidEnumValueCode = exceptionCode
|
||||
else:
|
||||
handleInvalidEnumValueCode = "return 1;"
|
||||
|
||||
|
||||
template = (
|
||||
"match FindEnumStringIndex(cx, ${val}, %(values)s) {\n"
|
||||
" Err(_) => { %(exceptionCode)s },\n"
|
||||
|
@ -1146,7 +1146,7 @@ class PropertyDefiner:
|
|||
if specTerminator:
|
||||
specs.append(specTerminator)
|
||||
|
||||
return (("static %s: &'static [%s] = &[\n" +
|
||||
return (("const %s: &'static [%s] = &[\n" +
|
||||
",\n".join(specs) + "\n" +
|
||||
"];\n\n") % (name, specType))
|
||||
|
||||
|
@ -1197,9 +1197,9 @@ class MethodDefiner(PropertyDefiner):
|
|||
return (m["name"], accessor, jitinfo, m["length"], m["flags"])
|
||||
|
||||
def stringDecl(m):
|
||||
return "static %s_name: [u8, ..%i] = %s;\n" % (m["name"], len(m["name"]) + 1,
|
||||
return "const %s_name: [u8, ..%i] = %s;\n" % (m["name"], len(m["name"]) + 1,
|
||||
str_to_const_array(m["name"]))
|
||||
|
||||
|
||||
decls = ''.join([stringDecl(m) for m in array])
|
||||
return decls + self.generatePrefableArray(
|
||||
array, name,
|
||||
|
@ -1265,9 +1265,9 @@ class AttrDefiner(PropertyDefiner):
|
|||
|
||||
def stringDecl(attr):
|
||||
name = attr.identifier.name
|
||||
return "static %s_name: [u8, ..%i] = %s;\n" % (name, len(name) + 1,
|
||||
return "const %s_name: [u8, ..%i] = %s;\n" % (name, len(name) + 1,
|
||||
str_to_const_array(name))
|
||||
|
||||
|
||||
decls = ''.join([stringDecl(m) for m in array])
|
||||
|
||||
return decls + self.generatePrefableArray(
|
||||
|
@ -1296,8 +1296,8 @@ class ConstDefiner(PropertyDefiner):
|
|||
|
||||
def stringDecl(const):
|
||||
name = const.identifier.name
|
||||
return "static %s_name: &'static [u8] = &%s;\n" % (name, str_to_const_array(name))
|
||||
|
||||
return "const %s_name: &'static [u8] = &%s;\n" % (name, str_to_const_array(name))
|
||||
|
||||
decls = ''.join([stringDecl(m) for m in array])
|
||||
|
||||
return decls + self.generatePrefableArray(
|
||||
|
@ -1362,13 +1362,13 @@ class CGImports(CGWrapper):
|
|||
# CallbackMember.getArgConversions.
|
||||
'unreachable_code',
|
||||
'non_camel_case_types',
|
||||
'non_uppercase_statics',
|
||||
'unnecessary_parens',
|
||||
'non_upper_case_globals',
|
||||
'unused_parens',
|
||||
'unused_imports',
|
||||
'unused_variable',
|
||||
'unused_variables',
|
||||
'unused_unsafe',
|
||||
'unused_mut',
|
||||
'dead_assignment',
|
||||
'unused_assignments',
|
||||
'dead_code',
|
||||
]
|
||||
|
||||
|
@ -1442,7 +1442,7 @@ class CGDOMJSClass(CGThing):
|
|||
flags = "0"
|
||||
slots = "1"
|
||||
return """
|
||||
static Class_name: [u8, ..%i] = %s;
|
||||
const Class_name: [u8, ..%i] = %s;
|
||||
static Class: DOMJSClass = DOMJSClass {
|
||||
base: js::Class {
|
||||
name: &Class_name as *const u8 as *const libc::c_char,
|
||||
|
@ -1526,7 +1526,7 @@ class CGPrototypeJSClass(CGThing):
|
|||
|
||||
def define(self):
|
||||
return """
|
||||
static PrototypeClassName__: [u8, ..%s] = %s;
|
||||
const PrototypeClassName__: [u8, ..%s] = %s;
|
||||
static PrototypeClass: JSClass = JSClass {
|
||||
name: &PrototypeClassName__ as *const u8 as *const libc::c_char,
|
||||
flags: (1 & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT as uint, //JSCLASS_HAS_RESERVED_SLOTS(1)
|
||||
|
@ -1559,7 +1559,7 @@ class CGInterfaceObjectJSClass(CGThing):
|
|||
ctorname = "0 as *const u8" if not self.descriptor.interface.ctor() else CONSTRUCT_HOOK_NAME
|
||||
hasinstance = HASINSTANCE_HOOK_NAME
|
||||
return """
|
||||
static InterfaceObjectClass: JSClass = {
|
||||
const InterfaceObjectClass: JSClass = {
|
||||
%s, 0,
|
||||
JS_PropertyStub,
|
||||
JS_PropertyStub,
|
||||
|
@ -2192,7 +2192,7 @@ class CGCallGenerator(CGThing):
|
|||
call = CGGeneric(nativeMethodName)
|
||||
if static:
|
||||
call = CGWrapper(call, pre="%s::" % descriptorProvider.interface.identifier.name)
|
||||
else:
|
||||
else:
|
||||
call = CGWrapper(call, pre="%s." % object)
|
||||
call = CGList([call, CGWrapper(args, pre="(", post=")")])
|
||||
|
||||
|
@ -2348,7 +2348,7 @@ class CGCase(CGList):
|
|||
bodyList = CGList([body], "\n")
|
||||
if fallThrough:
|
||||
raise TypeError("fall through required but unsupported")
|
||||
#bodyList.append(CGGeneric('fail!("fall through unsupported"); /* Fall through */'))
|
||||
#bodyList.append(CGGeneric('panic!("fall through unsupported"); /* Fall through */'))
|
||||
self.append(CGIndenter(bodyList));
|
||||
self.append(CGGeneric("}"))
|
||||
|
||||
|
@ -2683,7 +2683,7 @@ class CGMemberJITInfo(CGThing):
|
|||
depth = self.descriptor.interface.inheritanceDepth()
|
||||
failstr = "true" if infallible else "false"
|
||||
return ("\n"
|
||||
"static %s: JSJitInfo = JSJitInfo {\n"
|
||||
"const %s: JSJitInfo = JSJitInfo {\n"
|
||||
" op: %s as *const u8,\n"
|
||||
" protoID: %s,\n"
|
||||
" depth: %s,\n"
|
||||
|
@ -2760,7 +2760,7 @@ pub enum valuelist {
|
|||
%s
|
||||
}
|
||||
|
||||
pub static strings: &'static [&'static str] = &[
|
||||
pub const strings: &'static [&'static str] = &[
|
||||
%s,
|
||||
];
|
||||
|
||||
|
@ -2806,7 +2806,7 @@ class CGConstant(CGThing):
|
|||
def stringDecl(const):
|
||||
name = const.identifier.name
|
||||
value = convertConstIDLValueToRust(const.value)
|
||||
return CGGeneric("pub static %s: %s = %s;\n" % (name, builtinNames[const.value.type.tag()], value))
|
||||
return CGGeneric("pub const %s: %s = %s;\n" % (name, builtinNames[const.value.type.tag()], value))
|
||||
|
||||
return CGIndenter(CGList(stringDecl(m) for m in self.constants)).define()
|
||||
|
||||
|
@ -3889,7 +3889,7 @@ class CGDOMJSProxyHandler_obj_toString(CGAbstractExternMethod):
|
|||
return call.define() + """
|
||||
|
||||
JSString* jsresult;
|
||||
return xpc_qsStringToJsstring(cx, result, &jsresult) ? jsresult : NULL;"""
|
||||
return xpc_qsStringToJsstring(cx, result, &jsresult) ? jsresult : NULL;"""
|
||||
|
||||
return """let s = "%s".to_c_str();
|
||||
_obj_toString(cx, s.as_ptr())""" % self.descriptor.name
|
||||
|
@ -5166,7 +5166,7 @@ class CallbackMember(CGNativeMember):
|
|||
if arg.optional and not arg.defaultValue:
|
||||
argval += ".clone().unwrap()"
|
||||
|
||||
conversion = wrapForType("*argv.get_mut(%s)" % jsvalIndex,
|
||||
conversion = wrapForType("argv[%s]" % jsvalIndex,
|
||||
result=argval,
|
||||
successCode="continue;" if arg.variadic else "break;")
|
||||
if arg.variadic:
|
||||
|
@ -5183,7 +5183,7 @@ class CallbackMember(CGNativeMember):
|
|||
" // This is our current trailing argument; reduce argc\n"
|
||||
" argc -= 1;\n"
|
||||
"} else {\n"
|
||||
" *argv.get_mut(%d) = UndefinedValue();\n"
|
||||
" argv[%d] = UndefinedValue();\n"
|
||||
"}" % (i+1, i))
|
||||
return conversion
|
||||
|
||||
|
@ -5397,7 +5397,7 @@ class GlobalGenRoots():
|
|||
|
||||
return CGList([
|
||||
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
|
||||
CGGeneric("pub static MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
||||
CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
||||
CGNamespacedEnum('id', 'ID', protos, [0], deriving="PartialEq"),
|
||||
CGNamespacedEnum('proxies', 'Proxy', proxies, [0], deriving="PartialEq"),
|
||||
])
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![deny(missing_doc)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
//! Conversions of Rust values to and from `JSVal`.
|
||||
|
||||
|
@ -69,7 +69,7 @@ impl ToJSValConvertible for JSVal {
|
|||
fn to_jsval(&self, cx: *mut JSContext) -> JSVal {
|
||||
let mut value = *self;
|
||||
if unsafe { JS_WrapValue(cx, &mut value) } == 0 {
|
||||
fail!("JS_WrapValue failed.");
|
||||
panic!("JS_WrapValue failed.");
|
||||
}
|
||||
value
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ impl ToJSValConvertible for DOMString {
|
|||
let string_utf16: Vec<u16> = self.as_slice().utf16_units().collect();
|
||||
let jsstr = JS_NewUCStringCopyN(cx, string_utf16.as_ptr(), string_utf16.len() as libc::size_t);
|
||||
if jsstr.is_null() {
|
||||
fail!("JS_NewUCStringCopyN failed");
|
||||
panic!("JS_NewUCStringCopyN failed");
|
||||
}
|
||||
StringValue(&*jsstr)
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ impl ToJSValConvertible for ByteString {
|
|||
let jsstr = JS_NewStringCopyN(cx, slice.as_ptr() as *const libc::c_char,
|
||||
slice.len() as libc::size_t);
|
||||
if jsstr.is_null() {
|
||||
fail!("JS_NewStringCopyN failed");
|
||||
panic!("JS_NewStringCopyN failed");
|
||||
}
|
||||
StringValue(&*jsstr)
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ impl ToJSValConvertible for Reflector {
|
|||
assert!(obj.is_not_null());
|
||||
let mut value = ObjectValue(unsafe { &*obj });
|
||||
if unsafe { JS_WrapValue(cx, &mut value) } == 0 {
|
||||
fail!("JS_WrapValue failed.");
|
||||
panic!("JS_WrapValue failed.");
|
||||
}
|
||||
value
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ impl<'a> GlobalRef<'a> {
|
|||
pub fn as_window<'b>(&'b self) -> JSRef<'b, window::Window> {
|
||||
match *self {
|
||||
Window(window) => window,
|
||||
Worker(_) => fail!("expected a Window scope"),
|
||||
Worker(_) => panic!("expected a Window scope"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,6 +144,6 @@ pub fn global_object_for_js_object(obj: *mut JSObject) -> GlobalField {
|
|||
Err(_) => (),
|
||||
}
|
||||
|
||||
fail!("found DOM global that doesn't unwrap to Window or WorkerGlobalScope")
|
||||
panic!("found DOM global that doesn't unwrap to Window or WorkerGlobalScope")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ impl<T: Reflectable> Temporary<T> {
|
|||
pub fn root<'a, 'b>(self) -> Root<'a, 'b, T> {
|
||||
let collection = StackRoots.get().unwrap();
|
||||
unsafe {
|
||||
(**collection).new_root(&self.inner)
|
||||
Root::new(&**collection, &self.inner)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ impl<T: Reflectable> JS<T> {
|
|||
pub fn root<'a, 'b>(&self) -> Root<'a, 'b, T> {
|
||||
let collection = StackRoots.get().unwrap();
|
||||
unsafe {
|
||||
(**collection).new_root(self)
|
||||
Root::new(&**collection, self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -431,18 +431,12 @@ impl RootCollection {
|
|||
}
|
||||
}
|
||||
|
||||
/// Create a new stack-bounded root that will not outlive this collection
|
||||
#[allow(unrooted_must_root)]
|
||||
fn new_root<'b, 'a: 'b, T: Reflectable>(&'a self, unrooted: &JS<T>) -> Root<'a, 'b, T> {
|
||||
Root::new(self, unrooted)
|
||||
}
|
||||
|
||||
/// Track a stack-based root to ensure LIFO root ordering
|
||||
fn root<'a, 'b, T: Reflectable>(&self, untracked: &Root<'a, 'b, T>) {
|
||||
unsafe {
|
||||
let roots = self.roots.get();
|
||||
(*roots).push(untracked.js_ptr);
|
||||
debug!(" rooting {:?}", untracked.js_ptr);
|
||||
debug!(" rooting {}", untracked.js_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,7 +444,7 @@ impl RootCollection {
|
|||
fn unroot<'a, 'b, T: Reflectable>(&self, rooted: &Root<'a, 'b, T>) {
|
||||
unsafe {
|
||||
let roots = self.roots.get();
|
||||
debug!("unrooting {:?} (expecting {:?}",
|
||||
debug!("unrooting {} (expecting {}",
|
||||
(*roots).as_slice().last().unwrap(),
|
||||
rooted.js_ptr);
|
||||
assert!(*(*roots).as_slice().last().unwrap() == rooted.js_ptr);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
use std::from_str::FromStr;
|
||||
use std::hash::{Hash, sip};
|
||||
use std::path::BytesContainer;
|
||||
use std::str;
|
||||
|
||||
/// Encapsulates the IDL `ByteString` type.
|
||||
|
@ -67,7 +66,7 @@ impl ByteString {
|
|||
vec.iter().all(|&x| {
|
||||
// http://tools.ietf.org/html/rfc2616#section-2.2
|
||||
match x {
|
||||
0..31 | 127 => false, // CTLs
|
||||
0...31 | 127 => false, // CTLs
|
||||
40 | 41 | 60 | 62 | 64 |
|
||||
44 | 59 | 58 | 92 | 34 |
|
||||
47 | 91 | 93 | 63 | 61 |
|
||||
|
@ -132,7 +131,7 @@ impl ByteString {
|
|||
false
|
||||
}
|
||||
},
|
||||
0..31 | 127 => false, // CTLs
|
||||
0...31 | 127 => false, // CTLs
|
||||
x if x > 127 => false, // non ASCII
|
||||
_ if prev == Other || prev == SPHT => {
|
||||
prev = Other;
|
||||
|
@ -153,6 +152,6 @@ impl Hash for ByteString {
|
|||
|
||||
impl FromStr for ByteString {
|
||||
fn from_str(s: &str) -> Option<ByteString> {
|
||||
Some(ByteString::new(s.container_into_owned_bytes()))
|
||||
Some(ByteString::new(s.to_string().into_bytes()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![deny(missing_doc)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
//! Utilities for tracing JS-managed values.
|
||||
//!
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![deny(missing_doc)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
//! Various utilities to glue JavaScript and the DOM implementation together.
|
||||
|
||||
|
@ -19,7 +19,6 @@ use libc;
|
|||
use libc::c_uint;
|
||||
use std::cell::Cell;
|
||||
use std::mem;
|
||||
use std::cmp::PartialEq;
|
||||
use std::ptr;
|
||||
use js::glue::{js_IsObjectProxyClass, js_IsFunctionProxyClass, IsProxyHandlerFamily};
|
||||
use js::glue::{UnwrapObject, GetProxyHandlerExtra};
|
||||
|
@ -167,23 +166,23 @@ pub unsafe fn squirrel_away_unique<T>(x: Box<T>) -> *const T {
|
|||
/// stored for non-proxy bindings.
|
||||
// We use slot 0 for holding the raw object. This is safe for both
|
||||
// globals and non-globals.
|
||||
pub static DOM_OBJECT_SLOT: uint = 0;
|
||||
static DOM_PROXY_OBJECT_SLOT: uint = js::JSSLOT_PROXY_PRIVATE as uint;
|
||||
pub const DOM_OBJECT_SLOT: uint = 0;
|
||||
const DOM_PROXY_OBJECT_SLOT: uint = js::JSSLOT_PROXY_PRIVATE as uint;
|
||||
|
||||
// NOTE: This is baked into the Ion JIT as 0 in codegen for LGetDOMProperty and
|
||||
// LSetDOMProperty. Those constants need to be changed accordingly if this value
|
||||
// changes.
|
||||
static DOM_PROTO_INSTANCE_CLASS_SLOT: u32 = 0;
|
||||
const DOM_PROTO_INSTANCE_CLASS_SLOT: u32 = 0;
|
||||
|
||||
/// The index of the slot that contains a reference to the ProtoOrIfaceArray.
|
||||
// All DOM globals must have a slot at DOM_PROTOTYPE_SLOT.
|
||||
pub static DOM_PROTOTYPE_SLOT: u32 = js::JSCLASS_GLOBAL_SLOT_COUNT;
|
||||
pub const DOM_PROTOTYPE_SLOT: u32 = js::JSCLASS_GLOBAL_SLOT_COUNT;
|
||||
|
||||
/// The flag set on the `JSClass`es for DOM global objects.
|
||||
// NOTE: This is baked into the Ion JIT as 0 in codegen for LGetDOMProperty and
|
||||
// LSetDOMProperty. Those constants need to be changed accordingly if this value
|
||||
// changes.
|
||||
pub static JSCLASS_DOM_GLOBAL: u32 = js::JSCLASS_USERBIT1;
|
||||
pub const JSCLASS_DOM_GLOBAL: u32 = js::JSCLASS_USERBIT1;
|
||||
|
||||
/// Representation of an IDL constant value.
|
||||
#[deriving(Clone)]
|
||||
|
@ -677,7 +676,7 @@ pub unsafe fn delete_property_by_id(cx: *mut JSContext, object: *mut JSObject,
|
|||
|
||||
/// Results of `xml_name_type`.
|
||||
#[deriving(PartialEq)]
|
||||
#[allow(missing_doc)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum XMLName {
|
||||
QName,
|
||||
Name,
|
||||
|
@ -690,21 +689,21 @@ pub fn xml_name_type(name: &str) -> XMLName {
|
|||
fn is_valid_start(c: char) -> bool {
|
||||
match c {
|
||||
':' |
|
||||
'A' .. 'Z' |
|
||||
'A' ... 'Z' |
|
||||
'_' |
|
||||
'a' .. 'z' |
|
||||
'\xC0' .. '\xD6' |
|
||||
'\xD8' .. '\xF6' |
|
||||
'\xF8' .. '\u02FF' |
|
||||
'\u0370' .. '\u037D' |
|
||||
'\u037F' .. '\u1FFF' |
|
||||
'\u200C' .. '\u200D' |
|
||||
'\u2070' .. '\u218F' |
|
||||
'\u2C00' .. '\u2FEF' |
|
||||
'\u3001' .. '\uD7FF' |
|
||||
'\uF900' .. '\uFDCF' |
|
||||
'\uFDF0' .. '\uFFFD' |
|
||||
'\U00010000' .. '\U000EFFFF' => true,
|
||||
'a' ... 'z' |
|
||||
'\u00C0' ... '\u00D6' |
|
||||
'\u00D8' ... '\u00F6' |
|
||||
'\u00F8' ... '\u02FF' |
|
||||
'\u0370' ... '\u037D' |
|
||||
'\u037F' ... '\u1FFF' |
|
||||
'\u200C' ... '\u200D' |
|
||||
'\u2070' ... '\u218F' |
|
||||
'\u2C00' ... '\u2FEF' |
|
||||
'\u3001' ... '\uD7FF' |
|
||||
'\uF900' ... '\uFDCF' |
|
||||
'\uFDF0' ... '\uFFFD' |
|
||||
'\U00010000' ... '\U000EFFFF' => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -713,10 +712,10 @@ pub fn xml_name_type(name: &str) -> XMLName {
|
|||
is_valid_start(c) || match c {
|
||||
'-' |
|
||||
'.' |
|
||||
'0' .. '9' |
|
||||
'\xB7' |
|
||||
'\u0300' .. '\u036F' |
|
||||
'\u203F' .. '\u2040' => true,
|
||||
'0' ... '9' |
|
||||
'\u00B7' |
|
||||
'\u0300' ... '\u036F' |
|
||||
'\u203F' ... '\u2040' => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue