mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1146235 - Part 2: Expose @@iterator aliases on XrayWrappers. r=peterv
This commit is contained in:
parent
8e8b4598a7
commit
89f3438815
@ -1164,7 +1164,16 @@ XrayResolveProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
methodSpecs = nativeProperties->methodSpecs;
|
||||
}
|
||||
if (methods) {
|
||||
if (!XrayResolveMethod(cx, wrapper, obj, id, methods, methodIds,
|
||||
JS::Rooted<jsid> methodId(cx);
|
||||
if (nativeProperties->iteratorAliasMethodIndex != -1 &&
|
||||
id == SYMBOL_TO_JSID(
|
||||
JS::GetWellKnownSymbol(cx, JS::SymbolCode::iterator))) {
|
||||
methodId =
|
||||
nativeProperties->methodIds[nativeProperties->iteratorAliasMethodIndex];
|
||||
} else {
|
||||
methodId = id;
|
||||
}
|
||||
if (!XrayResolveMethod(cx, wrapper, obj, methodId, methods, methodIds,
|
||||
methodSpecs, desc, cacheOnHolder)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2150,7 +2150,8 @@ class MethodDefiner(PropertyDefiner):
|
||||
"flags": "JSPROP_ENUMERATE",
|
||||
"condition": PropertyDefiner.getControllingCondition(m, descriptor),
|
||||
"allowCrossOriginThis": m.getExtendedAttribute("CrossOriginCallable"),
|
||||
"returnsPromise": m.returnsPromise()
|
||||
"returnsPromise": m.returnsPromise(),
|
||||
"hasIteratorAlias": "@@iterator" in m.aliases
|
||||
}
|
||||
if isChromeOnly(m):
|
||||
self.chrome.append(method)
|
||||
@ -2492,6 +2493,12 @@ class CGNativeProperties(CGList):
|
||||
else:
|
||||
props = "nullptr, nullptr, nullptr"
|
||||
nativeProps.append(CGGeneric(props))
|
||||
iteratorAliasIndex = -1
|
||||
for index, item in enumerate(properties.methods.regular):
|
||||
if item.get("hasIteratorAlias"):
|
||||
iteratorAliasIndex = index
|
||||
break
|
||||
nativeProps.append(CGGeneric(str(iteratorAliasIndex)));
|
||||
return CGWrapper(CGIndenter(CGList(nativeProps, ",\n")),
|
||||
pre="static const NativeProperties %s = {\n" % name,
|
||||
post="\n};\n")
|
||||
|
@ -123,6 +123,9 @@ struct NativeProperties
|
||||
const Prefable<const ConstantSpec>* constants;
|
||||
jsid* constantIds;
|
||||
const ConstantSpec* constantSpecs;
|
||||
|
||||
// Index into methods for the entry that is [Alias="@@iterator"], -1 if none
|
||||
int32_t iteratorAliasMethodIndex;
|
||||
};
|
||||
|
||||
struct NativePropertiesHolder
|
||||
|
Loading…
Reference in New Issue
Block a user