mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Rename GetArrayIndexFromId to get_array_index_from_id.
This commit is contained in:
parent
ab52927ac5
commit
a0f5250cb8
3 changed files with 11 additions and 11 deletions
|
@ -3627,7 +3627,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
|
||||||
|
|
||||||
setOrIndexedGet = ""
|
setOrIndexedGet = ""
|
||||||
if indexedGetter or indexedSetter:
|
if indexedGetter or indexedSetter:
|
||||||
setOrIndexedGet += "let index = GetArrayIndexFromId(cx, id);\n"
|
setOrIndexedGet += "let index = get_array_index_from_id(cx, id);\n"
|
||||||
|
|
||||||
if indexedGetter:
|
if indexedGetter:
|
||||||
readonly = toStringBool(self.descriptor.operations['IndexedSetter'] is None)
|
readonly = toStringBool(self.descriptor.operations['IndexedSetter'] is None)
|
||||||
|
@ -3725,7 +3725,7 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
|
||||||
if indexedSetter:
|
if indexedSetter:
|
||||||
if not (self.descriptor.operations['IndexedCreator'] is indexedSetter):
|
if not (self.descriptor.operations['IndexedCreator'] is indexedSetter):
|
||||||
raise TypeError("Can't handle creator that's different from the setter")
|
raise TypeError("Can't handle creator that's different from the setter")
|
||||||
set += ("let index = GetArrayIndexFromId(cx, id);\n" +
|
set += ("let index = get_array_index_from_id(cx, id);\n" +
|
||||||
"if index.is_some() {\n" +
|
"if index.is_some() {\n" +
|
||||||
" let index = index.unwrap();\n" +
|
" let index = index.unwrap();\n" +
|
||||||
" let this = UnwrapProxy(proxy);\n" +
|
" let this = UnwrapProxy(proxy);\n" +
|
||||||
|
@ -3735,7 +3735,7 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
|
||||||
" return true;\n" +
|
" return true;\n" +
|
||||||
"}\n")
|
"}\n")
|
||||||
elif self.descriptor.operations['IndexedGetter']:
|
elif self.descriptor.operations['IndexedGetter']:
|
||||||
set += ("if GetArrayIndexFromId(cx, id).is_some() {\n" +
|
set += ("if get_array_index_from_id(cx, id).is_some() {\n" +
|
||||||
" return false;\n" +
|
" return false;\n" +
|
||||||
" //return ThrowErrorMessage(cx, MSG_NO_PROPERTY_SETTER, \"%s\");\n" +
|
" //return ThrowErrorMessage(cx, MSG_NO_PROPERTY_SETTER, \"%s\");\n" +
|
||||||
"}\n") % self.descriptor.name
|
"}\n") % self.descriptor.name
|
||||||
|
@ -3800,7 +3800,7 @@ class CGDOMJSProxyHandler_hasOwn(CGAbstractExternMethod):
|
||||||
def getBody(self):
|
def getBody(self):
|
||||||
indexedGetter = self.descriptor.operations['IndexedGetter']
|
indexedGetter = self.descriptor.operations['IndexedGetter']
|
||||||
if indexedGetter:
|
if indexedGetter:
|
||||||
indexed = ("let index = GetArrayIndexFromId(cx, id);\n" +
|
indexed = ("let index = get_array_index_from_id(cx, id);\n" +
|
||||||
"if index.is_some() {\n" +
|
"if index.is_some() {\n" +
|
||||||
" let index = index.unwrap();\n" +
|
" let index = index.unwrap();\n" +
|
||||||
" let this = UnwrapProxy(proxy);\n" +
|
" let this = UnwrapProxy(proxy);\n" +
|
||||||
|
@ -3873,7 +3873,7 @@ if !expando.is_null() {
|
||||||
|
|
||||||
indexedGetter = self.descriptor.operations['IndexedGetter']
|
indexedGetter = self.descriptor.operations['IndexedGetter']
|
||||||
if indexedGetter:
|
if indexedGetter:
|
||||||
getIndexedOrExpando = ("let index = GetArrayIndexFromId(cx, id);\n" +
|
getIndexedOrExpando = ("let index = get_array_index_from_id(cx, id);\n" +
|
||||||
"if index.is_some() {\n" +
|
"if index.is_some() {\n" +
|
||||||
" let index = index.unwrap();\n" +
|
" let index = index.unwrap();\n" +
|
||||||
" let this = UnwrapProxy(proxy);\n" +
|
" let this = UnwrapProxy(proxy);\n" +
|
||||||
|
@ -4552,7 +4552,7 @@ class CGBindingRoot(CGThing):
|
||||||
'dom::bindings::utils::ConstantSpec',
|
'dom::bindings::utils::ConstantSpec',
|
||||||
'dom::bindings::utils::{DOMClass}',
|
'dom::bindings::utils::{DOMClass}',
|
||||||
'dom::bindings::utils::{DOMJSClass, JSCLASS_DOM_GLOBAL}',
|
'dom::bindings::utils::{DOMJSClass, JSCLASS_DOM_GLOBAL}',
|
||||||
'dom::bindings::utils::{FindEnumStringIndex, GetArrayIndexFromId}',
|
'dom::bindings::utils::{FindEnumStringIndex, get_array_index_from_id}',
|
||||||
'dom::bindings::utils::{get_property_on_prototype, get_proto_or_iface_array}',
|
'dom::bindings::utils::{get_property_on_prototype, get_proto_or_iface_array}',
|
||||||
'dom::bindings::utils::HasPropertyOnPrototype',
|
'dom::bindings::utils::HasPropertyOnPrototype',
|
||||||
'dom::bindings::utils::IsPlatformObject',
|
'dom::bindings::utils::IsPlatformObject',
|
||||||
|
|
|
@ -436,7 +436,7 @@ pub fn get_property_on_prototype(cx: *mut JSContext, proxy: *mut JSObject,
|
||||||
|
|
||||||
/// Get an array index from the given `jsid`. Returns `None` if the given
|
/// Get an array index from the given `jsid`. Returns `None` if the given
|
||||||
/// `jsid` is not an integer.
|
/// `jsid` is not an integer.
|
||||||
pub fn GetArrayIndexFromId(_cx: *mut JSContext, id: jsid) -> Option<u32> {
|
pub fn get_array_index_from_id(_cx: *mut JSContext, id: jsid) -> Option<u32> {
|
||||||
unsafe {
|
unsafe {
|
||||||
if RUST_JSID_IS_INT(id) != 0 {
|
if RUST_JSID_IS_INT(id) != 0 {
|
||||||
return Some(RUST_JSID_TO_INT(id) as u32);
|
return Some(RUST_JSID_TO_INT(id) as u32);
|
||||||
|
|
|
@ -9,7 +9,7 @@ use dom::bindings::js::{OptionalRootable, OptionalRootedRootable, ResultRootable
|
||||||
use dom::bindings::js::{OptionalRootedReference, OptionalOptionalRootedRootable};
|
use dom::bindings::js::{OptionalRootedReference, OptionalOptionalRootedRootable};
|
||||||
use dom::bindings::proxyhandler::{get_property_descriptor, fill_property_descriptor};
|
use dom::bindings::proxyhandler::{get_property_descriptor, fill_property_descriptor};
|
||||||
use dom::bindings::utils::{Reflectable, WindowProxyHandler};
|
use dom::bindings::utils::{Reflectable, WindowProxyHandler};
|
||||||
use dom::bindings::utils::{GetArrayIndexFromId};
|
use dom::bindings::utils::get_array_index_from_id;
|
||||||
use dom::document::{Document, DocumentHelpers};
|
use dom::document::{Document, DocumentHelpers};
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
use dom::window::WindowHelpers;
|
use dom::window::WindowHelpers;
|
||||||
|
@ -100,7 +100,7 @@ impl SessionHistoryEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn GetSubframeWindow(cx: *mut JSContext, proxy: *mut JSObject, id: jsid) -> Option<Temporary<Window>> {
|
unsafe fn GetSubframeWindow(cx: *mut JSContext, proxy: *mut JSObject, id: jsid) -> Option<Temporary<Window>> {
|
||||||
let index = GetArrayIndexFromId(cx, id);
|
let index = get_array_index_from_id(cx, id);
|
||||||
if let Some(index) = index {
|
if let Some(index) = index {
|
||||||
let target = GetProxyPrivate(proxy).to_object();
|
let target = GetProxyPrivate(proxy).to_object();
|
||||||
let win: Root<Window> = unwrap_jsmanaged(target).unwrap().root();
|
let win: Root<Window> = unwrap_jsmanaged(target).unwrap().root();
|
||||||
|
@ -139,7 +139,7 @@ unsafe extern fn getOwnPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObje
|
||||||
|
|
||||||
|
|
||||||
unsafe extern fn defineProperty(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, desc: *mut JSPropertyDescriptor) -> bool {
|
unsafe extern fn defineProperty(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, desc: *mut JSPropertyDescriptor) -> bool {
|
||||||
if GetArrayIndexFromId(cx, id).is_some() {
|
if get_array_index_from_id(cx, id).is_some() {
|
||||||
// Spec says to Reject whether this is a supported index or not,
|
// Spec says to Reject whether this is a supported index or not,
|
||||||
// since we have no indexed setter or indexed creator. That means
|
// since we have no indexed setter or indexed creator. That means
|
||||||
// throwing in strict mode (FIXME: Bug 828137), doing nothing in
|
// throwing in strict mode (FIXME: Bug 828137), doing nothing in
|
||||||
|
@ -182,7 +182,7 @@ unsafe extern fn get(cx: *mut JSContext, proxy: *mut JSObject, receiver: *mut JS
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern fn set(cx: *mut JSContext, proxy: *mut JSObject, _receiver: *mut JSObject, id: jsid, _strict: bool, vp: *mut JSVal) -> bool {
|
unsafe extern fn set(cx: *mut JSContext, proxy: *mut JSObject, _receiver: *mut JSObject, id: jsid, _strict: bool, vp: *mut JSVal) -> bool {
|
||||||
if GetArrayIndexFromId(cx, id).is_some() {
|
if get_array_index_from_id(cx, id).is_some() {
|
||||||
// Reject (which means throw if and only if strict) the set.
|
// Reject (which means throw if and only if strict) the set.
|
||||||
// FIXME: Throw
|
// FIXME: Throw
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue