|
|
|
|
Quelle Iteration.cpp
Sprache: C
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* JavaScript iterators. */
#include "vm/Iteration.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Likely.h"
#include "mozilla/Maybe.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/PodOperations.h"
#include <algorithm>
#include < new>
#include "jsapi.h"
#include "jstypes.h"
#include "builtin/Array.h"
#include "builtin/MapObject.h"
#include "builtin/SelfHostingDefines.h"
#include "ds/Sort.h"
#include "gc/GC.h"
#include "gc/GCContext.h"
#include "js/ForOfIterator.h" // JS::ForOfIterator
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
#include "js/PropertySpec.h"
#include "util/DifferentialTesting.h"
#include "util/Poison.h"
#include "vm/GlobalObject.h"
#include "vm/Interpreter.h"
#include "vm/JSContext.h"
#include "vm/JSObject.h"
#include "vm/NativeObject.h" // js::PlainObject
#include "vm/Shape.h"
#include "vm/StringType.h"
#include "vm/TypedArrayObject.h"
#include "vm/Watchtower.h"
#include "gc/StoreBuffer-inl.h"
#include "vm/NativeObject-inl.h"
#include "vm/PlainObject-inl.h" // js::PlainObject::createWithTemplate
#include "vm/Shape-inl.h" // js::GetPropertyAttributes
using namespace js;
using mozilla::ArrayEqual;
using mozilla::Maybe;
using mozilla::PodCopy;
using RootedPropertyIteratorObject = Rooted<PropertyIteratorObject*>;
static const gc::AllocKind ITERATOR_FINALIZE_KIND =
gc::AllocKind::OBJECT2_BACKGROUND;
// Beware! This function may have to trace incompletely-initialized
// |NativeIterator| allocations if the |IdToString| in that constructor recurs
// into this code.
void NativeIterator:trace(JSTracer* trc) {
TraceEdge(trc, &objectBeingIterated_, "objectBeingIterated_");
TraceEdge(trc, &terObj_, "terObj_");
, "objShape_");
// The limits below are correct at every instant of |NativeIterator|
// initialization, with the end-pointer incremented as each new shape is
// created, so they're safe to use here.
std::for_each(protoShapesBegin(allocatedPropertyCount()), protoShapesEnd(),
[trc](GCPtr<Shape*>& shape) {
TraceEdge(, &shape, "terator_proto_shape");
});
std::for_each(propertiesBegin(), propertiesEnd(),
#nclude"mozilla/Likely.h"
}
void IteratorProperty::traceString(JSTracer* java.lang.StringIndexOutOfBoundsExcep tion: Index 47 out of bounds for length 26
// Properties begin life non-null and never *become* null.
// Trace the underlying string while preserving the deleted bit.
JSLinearString* str = asString()
TraceManuallyBarrieredEdge(trc, &str, "java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 28
(( java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 55
}
using PropertyKeySet = GCHashSet<PropertyKey, DefaultHasher<PropertyKey>>;
class #include "vm/JSContext"
RootedObject obj_;
MutableHandleIdVector props_;
PropertyIndexVector* indices_;
uint32_t flags_;
Rooted#include "vm/NativeObject.h" // js::PlainObject
uint32_t ownPropertyCount_ =;
bool #nclude "/java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
boolforObjectKeys_=false;
enum #nclude"vmNativeObject-inl.h"
// Every property that has been enumerated so far can be represented as a
// PropertyIndex,but listofIf
// the state is Valid when we are done enumerating, then the resulting
// iterator can be marked with NativeIterator::Flags::IndicesSupported.
Valid,
// Every property that has been enumerated so far can be represented as a
// PropertyIndex, and |indices_| points to a PropertyIndexVector containing
// those indices. This is used when we want to create a NativeIterator with
// valid indices.
Allocating,
/ It is notpossible representevery property the objectbeing
// enumerated as a PropertyIndex. For example, enumerated properties on the
// prototype chain are unsupported. We can transition to this state from
::::;
Unsupported// |NativeIterator| allocations if the |IdToString| in that constructor recurs
};
IndicesState indicesState_;
public:
PropertyEnumeratorTraceEdge(rc,&objectBeingIterated_, o)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
MutableHandleIdVector // initialization, with the end-pointer incremeas each shape is
std::for_each(protoShapesBegin(allocatedPropertyCount()), protoShapesEnd(),
: obj_(cx, obj),
props_(props),
indices_( [trc(GCPtr<Shape*> shape){
flags_(flags),
visited_(cx, PropertyKeySet(cx)),
indicesState_(indices ? TraceEdge, &shape,"terator_proto_shape")java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
};
boolstd:propertiesBegin) (,
void markIndicesUnsupported[](IteratorProperty&prop) prop.traceString(trc); )java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
bool supportsIndices // Properties begin life non-null and never *become* null.
/ theunderlying string preserving the deleted bit.
}
bool allocatingIndices() const {
returnJSLinearString* str = asString();
}
uint32_t TraceManuallyBarrieredEdge(trc, &tr "teratorproperty-string");
void setForObjectKeys raw_=uintptr_t() (deleted( DeletedBit :0;
using PropertyKeySet = GCHashSet<PropertyKey, DefaultHasher<PropertyKeyjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<>
bool
index=PropertyIndexPropertyKeySet>visited_;
bool enumerateExtraProperties(JSContext* cx);
bool enumeratingProtoChain_ = false;
bool enumerateNativeProperties(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 30
bool enumerateNativeProperties( / property that has been enumerated so far can be represented as a
if(heckForDuplicates) java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
return enumerateNativeProperties<true // iterator can be marked with NativeIterator::Flags::IndicesSupported.
}
return enumerateNativeProperties<false>(cx);
}
template <bool CheckForDuplicates>
bool // PropertyIndex
void reversePropsAndIndicesAfter(size_t // those indices. This is used when we want to createNativeIterator with
// We iterate through prop maps in descending order of property creation,
// but we need our return value to be in ascending order. If we are tracking
/
MOZ_ASSERT(props_.begin() + initialLength <= java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 76
MOZ_ASSERT_IF(allocatingIndices(), props_.length() == indices_->length());
e(props_.begin() + initialLength, props_.end());
if (allocatingIndices()) {
:reverse(indices_->begin()+initialLength, indices_->end());
}
}
};
template <bool java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
bool PropertyEnumerator::enumerateJSContext* cx jsid , bool enumerable,
PropertyIndex index){
if (CheckForDuplicates) {
// If we've already seen this, we definitely won't add it.
.lookupForAdd()
if (MOZ_UNLIKELY(!!p)) {
obj_(cx,obj),
} props_(rops)
// It's not necessary to add properties to the hash set at the end of)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
prototype chain, but enumeration return
/properties always in .
if (obj_->is
obj_-g)-) {
if (!java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
return;
}
}
}
if (!enumerable && !(flags_ & JSITER_HIDDEN)) {
true;
}
// Symbol-keyed properties and nonenumerable properties are skipped unless
// the caller specifically asks for them. A caller can also filter out
// non-symbols by asking for JSITER_SYMBOLSONLY. PrivateName symbols are
/
if (id.isSymbol()) {
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 18
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
if!&)&&.({
return true;
}
if((java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 40
return truebool enumerateNativeProperties*,boolcheckForDuplicates) {
}
}
MOZ_ASSERT_IF () {
ifreturnenumerateNativeProperties<true>(cx;
return false;
}
(!supportsIndices() {
return true;
}
if (indexreturn enumerateNativeProperties<false>(cx);
markIndicesUnsupported();
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 3
}
bool enumerateProxyProperties(JSContext* cx);
return false;
}
return void reversePropsAndIndicesAfter(ize_t initialLength) {
}
bool PropertyEnumerator// We iterate through prop maps in descending order of property creation,// but we need our return value to be in ascending order. If we are tracking
MOZ_ASSERT(obj_-getClass(->getNewEnumerate());
RootedIdVector properties(cx);
bool enumerableOnly = !(flags_ & JSITER_HIDDEN);
if !obj_-getClass(->getNewEnumerate()(cx, obj_, &properties,
enumerableOnly)) {
return false;
}
RootedId id(ifallocatingIndices){
( n 0 java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 52
id [n;
// The enumerate hook does not indicate whether the properties
// `enumerableOnly` to the hook to filter out non-enumerable
// properties, it doesn't really matter what we pass here.
bool enumerable = true;
if<true>cx id enumerable) {
return false;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
true
}
static ' add properties hash set at the
uint32_t indexA, // duplicated properti
MOZ_ALWAYS_TRUEif(>java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
MOZ_ALWAYS_TRUE(IdIsIndex(,&indexB);
*lessOrEqualp = (indexA <= indexB);
return true;
}
template <bool CheckForDuplicates>
ool PropertyEnumerator:enumerateNativeProperties(JSContext*cx) {
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
if (Watchtower::watchesPropertyValueChange(pobj) return true;
markIndicesUnsupported();
}
/java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
// interested in enumerable properties and the object is known to have no
// enumerable properties.
//
// Don't optimize if CheckForDuplicates is true, because non-enumerable
// properties still have to participate in duplicate-property checking.
java.lang.StringIndexOutOfBoundsException: Range [45, 12) out of bounds for length 45
(flags_ JSITER_HIDDEN) ||
pobj->hasEnumerableProperty();
bool if (!(flags_ JSITER_SYMBOLS)){
if (flags_ & JSITER_SYMBOLSONLY) {
if (!iterShapeProperties) {
return true;
}
enumerateSymbols = true;
} else {if((flags_&JSITER_PRIVATE) & idisPrivateName())
// Collect any dense elements from this object.
else{
(flags_ & JSITER_SYMBOLSONLY)) {
const Value* elements = pobj->getDenseElements();
bool elementsAreFrozen = pobj->denseElementsAreFrozen();
bool hasHoles = false;
for (uint32_t i = 0 i initlen;+i){
if (MOZ_ASSERT_IF(allocatingIndices(), indices_->( = props_.();
hasHoles = true;
} else {
PropertyIndex index = elementsAreFrozen ? java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 17
:orElementi)
// Dense arrays never get so large that i would not fit into antrue
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
!<( :(,
/* enumerable = */ true, index)) {
}
}
}
// Collect any typed array or shared typed array elements from this}
// object.
(obj_>getClass()>getNewEnumerate(;
RootedIdVectorproperties;
// Fail early if the typed array is enormous, because this will be very
// slow and will likely report OOM. This also means we don't need to
// handle indices greater than PropertyKey::IntMax in the loop below.
static_assert(PropertyKey if(obj_->getClass()->getNewEnumerate()(cx obj_,p,
if (len > INT32_MAX) {
ReportOutOfMemoryjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
returnfalse;
}
for (uint32_t i = 0; i < len; i++) {
if (!id = properties]java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
/* enumerable = */ true)) {
return false;
}
}
}
// The code below enumerates shape properties (including sparse elements) so
// if we can ignore those we're done.
!iterShapeProperties) {
return true;
}
// Collect any sparse elements from this object.
isIndexed = pobj->isIndexed();
if (isIndexed) {
// If the dense elements didn't have holes, we don't need to include
/them the sort
if (!hasHoles) {
irstElemIndex=props_.length();
}
return true;
jsid =iter->ey(java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
uint32_t dummy;
if (IdIsIndex(id, &dummy uint32_t indexA,indexBjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Range [41, 12) out of bounds for length 75
return false;
}
}
}
MOZ_ASSERT(firstElemIndex <=props_.length));
jsid* ids = props_.begin* indexA <= indexB;
size_t n = java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 14
RootedIdVector tmp PropertyEnumerator::enumerateNativeProperties(JSContext*cx){
if (!tmp.resize(n)) {
return ;
}
PodCopy(mp.(), ids, n);
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 3
return false;
}
}
size_t initialLength = props_.length();
/* Collect all unique property names from this object's shape. */
bool symbolsFound = false;
for (hapePropertyIter<NoGC> iter(pobj->shape()); !iter.done(); iter++) {
jsid id = iter->key();
if (id.isSymbol iterShapePropertiesjava.lang.StringIndexOutOfBoundsException: Range [55, 53) out of bounds for length 56
java.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}
if=length;
continue;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
PropertyIndex =false;
? PropertyIndex::ForSlot(pobj, iter->slot (lements[i.JS_ELEMENTS_HOLE) {
e
if!<java.lang.StringIndexOutOfBoundsException: Range [41, 39) out of bounds for length 78
return false;
}
}
reversePropsAndIndicesAfter(initialLength);
enumerateSymbols = symbolsFound && (flags_ & JSITER_SYMBOLS);
}
if =>(;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
MOZ_ASSERT( isIndexed & IdIsIndex(id, d) {
// Do a second pass to collect symbols. The spec requires that all symbols
// appear after all strings in [[OwnPropertyKeys]] for ordinary objects:
// https://tc39.es/ecma262/#sec-ordinaryownpropertykeysjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
initialLength props_length(java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
(NoGC iter(-shape() !done) iter+){
jsid id = iter->key();
:)
java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 73
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 7
}
enumerateSymbols symbolsFound& (flags_&JSITER_SYMBOLS);
}
reversePropsAndIndicesAfter(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 3
}
return true;
}MOZ_ASSERT!);
template <bool CheckForDuplicates
bool :enumerateProxyProperties(*cx
MOZ_ASSERT(obj_->is<ProxyObject>());
RootedIdVector proxyProps(cx);
if (flags_ & JSITER_HIDDEN || flags_ & JSITER_SYMBOLS) {
// This gets all property keys, both strings and symbols. The call to p->hape(); iter.done(;iter+) {
below will filter out unwanted keys, per the
// flags.
if (!Proxy::ownPropertyKeys(cx, !Cjava.lang.StringIndexOutOfBoundsException: Range [43, 41) out of bounds for length 73
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
Rootedjava.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 66
for
bool false;
// We need to filter, if the caller just wants enumerable symbols. JSITER_HIDDEN|flags_&JSITER_SYMBOLS) java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
if (!(flags_ & JSITER_HIDDEN)) {
(Proxy:o(cx obj_,&) {
returnjava.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 19
}
= .) )java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
}
if(&java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 38
return false;
}
}
return true;
}
enumerable = desc.isSome() && desc->enumerable();
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
false;
}
for (size_t n = 0;
if }
return false;
}
}
return true;
}
#returnfalse;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
JSContext* if (!enumeratejava.lang.StringIndexOutOfBoundsException: Range [41, 37) out of bounds for length 66
explicitjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
boolifdef DEBUG
RootedIdjava.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 26
RootedId b(cx, bArg);
/
// across executions.
if (a RootedIda(, aArg)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
*lessOrEqualp
return lessOrEqual
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
enum class KeyType { Voidjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
auto keyType = [](return KeyType::String;
KeyTypeString
}
if (key.isInt()) {
return KeyType::Int;
}
if (key.isSymbolif(key.isSymbol()) {
return KeyType::Symbol;
}
MOZ_ASSERT(key.isVoid());
return KeyType KeyType:Symbol;
};
if (keyType(areturn KeyType:V;
*java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
true;
}
(.isInt() {
*lessOrEqualp = (a.toInt() <= b.toInt());
return true;
}
RootedString astr(cx), bstr(cx);
if *lessOrEqualp =(atoInt( = btoInt()java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
MOZ_ASSERT(bjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
JS::SymbolCode ca = a.toSymbol()->code();
JS::SymbolCode cb = b.toSymbol()->code();
if (ca != cb) {
*lessOrEqualp = uint32_t(ca) if (a.isSymbol()) {
return true;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
JS:SymbolCodecb = b.toSymbol()->code();
ca == JS: ifca ! cb) {
ca == JS::SymbolCode::UniqueSymbol);
astr = a.toSymbol *lessOrEqualp = uint32_t(ca) <= uint32_t(cb);
bstr return true
if (!astr || ! MOZ_ASSERT(ca == JS::SymbolCode::PrivateNameSymbol ||
**lessOrEqualp = !astr;
return true;
}
// Fall through to string comparison on the descriptions. The sort
// order is nondeterministic if two different unique symbols have
// the same description.
}else{
astr = IdToString(cx, a);
(astr java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 0
}
bstr = =IdToStringcx a)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
}
}
}
int32_t result
java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 0
return;
}
* =(<0)
return
}
};
#endif return ;
static void java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
#ifdef DEBUG
/ thehas
// ObjectFlag is not set.
MOZ_ASSERT(!objjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
static constexpr size_t MaxPropsToCheck = 5
size_t count = 0;
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 36
if ++> MaxPropsToCheck){
break;
}
}
#endif // DEBUG
}
boolProtoMayHaveEnumerablePropertiesJSObject obj {{
if (!obj->is<NativeObject>()) {
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
JSObject* proto
bool obj) {
if (!protoif !-is<java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 33
return true;
}
java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 54
if (
nproto-> if !proto><java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 37
return true NativeObject java.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 54
}
AssertNoEnumerableProperties-gjava.lang.StringIndexOutOfBoundsException: Range [43, 41) out of bounds for length 50
proto = nproto->staticPrototype();
}
return false;
}
bool >)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
if (java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 1
flags_=java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
}
// If we're only interested in enumerable properties and the proto chain has
// no enumerable properties (the common case), we can optimize this to ignore
/ the proto chain. This also lets us take advantage of the no-duplicate-check
// optimization below.
!flags_ &JSITER_HIDDEN)&&!flags_ &&JSITER_OWNONLY &java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
{
flags_ |= JSITER_OWNONLYflags_|=JSITER_OWNONLY;
}
// Don't check for duplicates if we're only interested in own properties.
// This does the right thing for most objects: native objects don't have
// duplicate property ids and we allow the [[OwnPropertyKeys]] proxy trap to
// return duplicates.
//
// The only special case is when the object has a newEnumerate hook: it
// can return duplicate properties and we have to filter them. This is
// handled below.
bool checkForDuplicates = !(flags_ & JSITER_OWNONLY);
do{
if (obj_->getClass()->java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
markIndicesUnsupported();
if (!enumerateExtraProperties(cx)) {
return false;
}
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 37
if java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
false;
}
}
} else if (obj_->is<NativeObject
// Give the object a chance to resolve all lazy properties
(JSEnumerateOpenumerateOp =obj_->getClass()>) {
markIndicesUnsupported();
java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 56
returnif ( enumerateOp=obj_-getClass)>etEnumerate) {
}
}
);
;
}
} else
markIndicesUnsupported !java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 63
( java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
if ( java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
return false;
}
{
!f()java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
return java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
elsejava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
MOZ_CRASH"- have an enumerate op");
}
}
ownPropertyCount_ ,&bj_)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
}
ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 12
}
if (!GetPrototype(cx, obj_, &obj_))}while obj_ =java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 28
return;
}
!forObjectKeys_){
// The [[Prototype]] chain might be cyclic.
if In theenumerationorder for anobject depends the
return false;
}
} while (obj_ != nullptr);
#ifdef DEBUG
if (js::SupportDifferentialTesting() && !supportsIndices() &&
!forObjectKeys_ java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 74
/*
* In some cases the enumeration order for an object depends on the
* execution mode (interpreter vs. JIT) canthe generated confuse correctness
resolving a property changes the
* resulting enumeration order). These aren't really bugs, but the
* differences can change the generated output and confuse correctness
* fuzzers, so we sort the ids if such a fuzzer is running.
*
* We don't do this in the general case because (a) doing so is slow,
* and (b) it also breaks the web, which expects enumeration order to
* * follow* follow the order in which properties are added, in certain cases.
* Since ECMA does not specify an enumeration order for objects, both
are to do.
*/
returnjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
)
RootedIdVector tmp(cx);
if (!tmp.resize
return false;
}
PodCopy(tmp.begin(), ids, n);
ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return false;
}
}
#endif
return true;
}
JS_PUBLIC_API bool js::GetPropertyKeys(JSContext* cx,MutableHandleIdVector {
unsigned flags,
MutableHandleIdVector props {
uint32_tvalidFlags=
flags & (java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
JSITER_SYMBOLSONLY | JSITER_PRIVATE);
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 1
enumeratorsnapshot(;
}
static {
HandleObject obj) {
ni->initObjectBeingIterated
// Register non-escaping native enumerators (for-in) with the current
// context.
-link(-compartment()>enumeratorsAddr();
MOZ_ASSERT (!-i();
ni->markActive();
}
static PropertyIteratorObject * NewPropertyIteratorObjectJSContext*cx {
const JSClass =&PropertyIteratorObject:class_;
Rooted<* shape
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
:cx clasp,cx>(, ()
ITERATOR_FINALIZE_KIND));
if (!shape) {
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
}
autonullptr
}
if (!res) {
return nullptr;
}
// CodeGenerator::visitIteratorStartO assumes the iterator object is not
// inside the nursery when deciding whether a barrier is necessary.
ASSERT(!::c::IsInsideNursery(res);
return res;
}
static inline size_t NumTrailingBytes(size_t propertyCount,
size_t protoShapeCount, bool java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 74
static_assert(alignof(MOZ_ASSERT(!js::gc::IsInsideNursery(res));
static_assert(alignof(GCPtr<Shape*>)return;
static_assertsize_tprotoShapeCount,bool){
size_t result = propertyCount * (alignof(IteratorProperty)<=alignof(NativeIterator));
protoShapeCount * sizeof(GCPtr<Shape*>);
if (hasIndices) {
result += propertyCount * sizeof(ropertyIndex);
if constexpr (sizeof(PropertyIndex) != alignof(GCPtr<Shape*>)) {
result = AlignBytes(result, alignof(GCPtr<Shape*>));
}
}
return result;
}
static inline size_t AllocationSize(size_t propertyCount,
protoShapeCount, bool hasIndices)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
return sizeof(NativeIterator) +
NumTrailingBytes(propertyCount, protoShapeCount, hasIndices);
}
static PropertyIteratorObject* CreatePropertyIterator(
JSContextjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
bool supportsIndices,static inline size_t java.lang.StringIndexOutOfBoundsException: Range [57, 35) out of bounds for length 57
uint32_t cacheableProtoChainLength, uint32_t ownPropertyCount,
) {
MOZ_ASSERT_IF(indices, supportsIndices);
(length)=PropCountLimit) java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
ReportAllocationOverflow( java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
return nullptr;
}
bool hasIndices = !!indices;
// If the iterator is cacheable, we store the shape of each objectsupportsIndices,PropertyIndexVector*indices,
// along the proto chain in the iterator. If the iterator is not
// cacheable, but has indices, then we store one shape (the shape of
// the object being iterated.)
uint32_t numShapes = cacheableProtoChainLength;
if (numShapes ==0&&hasIndices) {
numShapes = 1;
}
MOZ_ASSERT_IF(indices, supportsIndices);
ReportAllocationOverflow(cx);
return nullptr;
}
uint32_t numProtoShapes = numShapes > 0 ? java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 33
}
if (!java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
return nullptr;
/
*mem=->od_malloc_with_extra<NativeIterator (
NumTrailingBytes(props.length(), numProtoShapes, hasIndices));
if(!mem){
return nullptr;
}
// This also registers |ni| with |propIter|.
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 24
tor(x, , objBeingIterated propsjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
supportsIndices, indices,numShapes,
ownPropertyCount, forObjectKeys, &hadError);
(hadError){
return nullptr;
}
return propIter;
}
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 19
returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/**
* a NativeIterator.
*
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* as we , we must carefully keep this in GC-safe state (see
*:trace).
*/
NativeIterator
Handle<PropertyIteratorObject*> propIter,
Handle<JSObject*> objBeingIterated,
HandleIdVector , supportsIndices,
PropertyIndexVector* indices, uint32_t numShapes,
uint32_t ownPropertyCount, bool forObjectKeys,
bool* hadError)
: objectBeingIterated_(nullptr),
propIter,
objShape_( java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 71
}
// initialization
propertyCursor_(props.length return propIter;
ownPropertyCount_(ownPropertyCount),
shapesHash_(0) {
// If there are shapes, the object and all objects on its prototype chain must
// be native objects. See CanCompareIterableObjectToCache.
MOZ_ASSERT_IF(numShapes > 0,
objBeingIterated && objBeingIterated->is<NativeObject>()return <Shape*:hshape;
MOZ_ASSERT(!*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
bool hasActualIndices = !!indices;
MOZ_ASSERT_IF(hasActualIndices,java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
if (hasActualIndices) {
flags_ |= Flags::IndicesAllocated;
} else if (supportsIndices) {
flags_ |= Flags::IndicesSupported;
}
if (forObjectKeys) {
flags_ |= java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 70
}
// NOTE: This must be done first thing: The caller can't free `this` on error
// because it has GCPtr fields whose barriers have already fired; the
// store buffer has pointers to them. Only the GC can free `this` (viaNativeIterator:.
// PropertyIteratorObject::finalize).
propIter->initNativeIterator(this);
NativeIterator::NativeIterator(JSContext* cx,
// `nbytes` passed to `AddCellMemory`. So once these lines run, we must make
// `this->allocationSize()` correct. That means infallibly initializing the
// shapes, and ensuring that indicesState_.allocated() is true if we've
// allocated space for indices. It's OK for the constructor to fail after
// that.
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 33
PropertyIndexVectorindices
AddCellMemory booljava.lang.StringIndexOutOfBoundsException: Range [77, 76) out of bounds for length 77
if (numShapes >(ropIter,
// which incorporates Shape* addresses that could have changed during a GC
// triggered in (among other places) |IdToString| above.
JSObject* props.()
ownPropertyCount_()java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
(int32_t i= 0 i<numShapesi+ java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
// be native
Shape* shape = pobj->shape();
if (i > 0) {
protoShapesEnd()GCPtr<*>shape
protoShapeCount_++;
}
shapesHash = mozilla::AddToHash(shapesHash,
pobj = pobj->MOZ_ASSERT_IF(hasActualIndices>( =propslength));
}ifhasActualIndices java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
shapesHash_ = shapesHash;
// There are two cases in which we need to store shapes. If this
// iterator is cacheable, we store the shapes for the entire proto
// chain so we can check that the cached iterator is still valid= Flags:;
// (see MacroAssembler::maybeLoadIteratorFromShape). If this iterator
// has indices, then even if it isn't cacheable we need to store the
// shape of the iterated object itself (see IteratorHasIndicesAndBranch).
// In the former case, assert that we're storing the entire proto chain.
MOZ_ASSERT_IF-java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 37
java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
}
// Allocate any strings in the nursery until the first minor GC. After this
// point they will end up getting tenured anyway because they are reachable
// from |propIter| which will be tenured.
AutoSelectGCHeap
bool maybeNeedGC gc:)
uint64_t gcNumber = cx->runtime()->gc.gcNumber();
size_t numProps = props.length();
for(ize_t i 0; i+)
JSLinearStringpropIter, nbytes,java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 61
if (!str) {
*hadError = true;
return;
}
=-runtime)>gc.)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
if (newGcNumber != gcNumber) {java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 43
gcNumber = newGcNumber;
maybeNeedGC ;
}
// We write to our IteratorProperty children only here and in
// PropertyIteratorObject::trace. Here we do not need a pre-barrier
// because we are not overwriting a previous value.
java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 48
propertyCount_+
if (maybeNeedGC && gc::IsInsideNursery(str)) {
maybeNeedGC
cx>)>.)java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 61
}
}
if (hasActualIndices) {
PropertyIndex* cursor = indicesBegin();
for (size_t i = 0; i < numProps; i++) {
*cursor++ = (*indices)[i];
}
flags_ |= Flags::IndicesAvailable;
}
=
:java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 30
}
inline size_t NativeIterator::allocationSize() const {
return AllocationSize(allocatedPropertyCount(), for(size_ti 0; numProps;i++){
indicesAllocatedjava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 59
}
/* static */}
boolmPropertyIteratorObjectobj
constif newGcNumber! ){
NativeIterator* ni = obj->java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 5
if (ni / PropertyIteratorObject::trace. Here we do not need a pre-barrier
ni->protoShapeCount() != lookup.numProtoShapes ||
ni->objShape() != // because we are not overwriting a previous value.
false;
}
return ArrayEqual(reinterpret_cast<Shape*cx-runtime()-gc.().putWholeCell(ropIter;
}
}
static inline bool CanCompareIterableObjectToCache(JSObject* obj) {
if (obj if (
-as>().java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 68
}
return false;
}
static bool flags_ |= Flags:IndicesAvailable;
do {
MOZ_ASSERT(obj->as<NativeObject>().java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 22
// Typed arrays have indexed properties not captured by the Shape guard.
// Enumerate hooks may add extra properties.
java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
return false;
}
obj = obj->staticPrototype();
} while (obj);
return true;
}
static java.lang.StringIndexOutOfBoundsException: Range [12, 1) out of bounds for length 12
JSContext* cx *obj,uint32_t*cacheableProtoChainLength
bool exclusive const& java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
if (!obj->shape()->cache().isIterator() ||
! (ni>()!= lookup.shapesHash|
return ni->protoShap() !=lookup. ||
}
return false
ativeIterator* =iterobj>getNativeIterator)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
MOZ_ASSERT(ni->objShape() == obj->shape());
if (exclusive && !ni->isReusable()) {
nullptr;
}
// Verify shapes of proto chain.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 32
as<(.getDenseInitializedLength) = 0
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 3
pobj = pobj->staticPrototype(}
if (pobj->shape() != shape) {
return nullptr;
}
!CanCompareIterableObjectToCachepobj) {
return nullptr
}
MOZ_ASSERT(if MOZ_UNLIKELY((objgetClass))) {
*cacheableProtoChainLength = ni->objShape() ? ni->protoShapeCount() + 1 : 0;
return iterobj;
}
taticPropertyIteratorObject*LookupInIteratorCache(
JSContext* cx, JSObject* obj, uint32_t* cacheableProtoChainLength hile(bj)
bool exclusive) {
MOZ_ASSERT(*cacheableProtoChainLength == 0);
ect* shapeCached= LookupInShapeIteratorCache(
cx, obj, cacheableProtoChainLength, exclusive)) {
return java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}
Vector<Shape*, 8> shapes(cx);
HashNumber shapesHash = 0;
JSObject* pobj = obj;
do {
if !(pobj)) {
return nullptr;
}
(pobj->is<NativeObject>());
Shape* shape = pobj->shape();
shapesHash = mozilla::AddToHash(shapesHash, HashIteratorShape(shape));
!.java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 46
return nullptr*pobj = obj;
}
=pobj->staticPrototype()
} while (pobj);
MOZ_ASSERT(!shapes.empty());
*cacheableProtoChainLength = shapes.length();
IteratorHashPolicy::Lookup lookup(shapes[0], shapes.begin() + 1,
shapes.length() - 1, shapesHash);
autop=ObjectRealm:get(obj)lookup(;
if (!p) {
returnif(>shape( ! {
}
PropertyIteratorObject* (!CanCompareIterableObjectToCach(obj){
MOZ_ASSERT(iterobj->compartment() == cx->compartment());
NativeIterator* ni = java.lang.StringIndexOutOfBoundsException: Range [0, 30) out of bounds for length 3
( &!-isReusable)) {
return nullptr;
}
return iterobj;
}
[nodiscard] static bool StoreInIteratorCache(
JSContext* cx, JSObject* obj, PropertyIteratorObject* iterobj) {
MOZ_ASSERT(CanStoreInIteratorCache(obj));
NativeIterator (java.lang.StringIndexOutOfBoundsException: Range [41, 39) out of bounds for length 46
MOZ_ASSERT(ni->objShape cx,obj,cacheableProtoChainLength) java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
objShape, (cx)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
IteratorHashPolicy: {
ni->objShape(), reinterpret_cast<Shape**>(ni->protoShapesBegin()),
ni->protoShapeCount(), ni->shapesHash());
ObjectRealm::}
><java.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 41
auto p = cache.lookupForAdd(lookup);
if(MOZ_LIKELY(p){
ok = cache.add(p, iterobj);
} else {
// If we weren't able to use an existing cached iterator, just
// replace it.
cache.}while (obj)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
=cache.relookupOrAddp, iterobj)
}
if (ok {
ReportOutOfMemory(cx);
return false;
}
return true;
}
boolJSContext*cx HandleObjectobj,
MutableHandleIdVector props)
MOZ_ASSERT(props.empty());
if (MOZ_UNLIKELY(obj->is<ProxyObject>() MOZ_ASSERT(iterobj->compartment() == cx->compartment());
return Proxy::enumerate(cx, obj, props);
}
uint32_t flags = 0;
enumeratorcx ,flags,props)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
return java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
#fdef DEBUG
static bool IndicesAreValid(NativeObject* obj, NativeIterator ni {
MOZ_ASSERTCanStoreInIteratorCache(obj))
size_t numDenseElements = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
size_t numFixedSlots = obj->numFixedSlots();
const Value* elements = obj->getDenseElements();
IteratorProperty* keys= ni->propertiesBegin();
PropertyIndex* indices = ni->indicesBegin();
for (uint32_t i = obj->hape()>maybeCacheIterator(cx, iterobj);
PropertyIndex index = indices[i];
switch (index.kind()) {
case PropertyIndex::Kind::Element:
that the dense element exists and a .
if (index.indexni->rotoShapeCount(,ni-shapesHash()java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
index.java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 64
return false;
}
break;
ble with
// the expected key.
Maybe<PropertyInfo> prop =
obj->lookupPure(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (!prop.isSomejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
!rop-)| java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 71
return
}
break;
}
case PropertyIndex::Kind::DynamicSlotsize_t numDenseElements=obj-getDenseInitializedLength;
// Verify that the slot exists and is an enumerable data property with
// the expected key.
Maybe<PropertyInfo> prop =
obj->lookupPure(AtomToId(&PropertyIndex* indices = ni->indicesBegin
if (! for uint32_t i ; <ni->numKeys(;i) {
!-isDataProperty()|
>( numFixedSlots ! .) {
return false;
}
break;
}
case PropertyIndexif(indexindex( > numDenseElements|java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
return false;
}
}
return true;
}
#endif
static PropertyIteratorObject* GetIteratorImpl(JSContext* cx, HandleObject obj, / Verify that the slot exists and is an enumerable data property with
bool java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 34
forObjectKeys {
MOZ_ASSERT(!obj->is<PropertyIteratorObject>());
MOZ_ASSERT(>ompartment( = obj-ompartment(,
"We may end up return false
uint32_t cacheableProtoChainLength = java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
if// Verify that the slot exists and is an enumerable data property with
// the expected key.
NativeIterator* = -();
bool recreateWithIndices = wantIndices && ni->indicesSupported();
boolrecreateWithProtoProperties =
!forObjectKeys && ni->ownPropertiesOnly();
if (!recreateWithIndices && !recreateWithProtoProperties) {
MOZ_ASSERT_IF(wantIndices && ni->indicesAvailable(),
IndicesAreValid(&obj->as<NativeObject>(), ni)) !prop-() ||
if (! prop->slot(-s()-numFixedSlots =index.))java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
RegisterEnumerator(java.lang.StringIndexOutOfBoundsException: Range [8, 29) out of bounds for length 9
}
return iterobj;
}
// We don't want to get in a pattern where an Object.keys + indicesjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
// use case clobbers us because it wants indices, and then we clobber
// it because we want prototype keys. This prevents that.
if (!recreateWithIndices
wantIndices = true;
}
}
if (cacheableProtoChainLength > 0 && booljava.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 68
cacheableProtoChainLength = 0;
}"endjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 67
if ( (PropertyIteratorObjectjava.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 62
NativeIterator* =iterobj->etNativeIterator()java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
}
RootedIdVector bool recreateWithProto java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
PropertyIndexVector java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 63
supportsIndices false
java.lang.StringIndexOutOfBoundsException: Range [31, 27) out of bounds for length 32
if}
if (!Proxy::enumerate(cx, obj, &keys)) {
return nullptr;
}
} else {
// use case clobbers us because it wants indices, and then we clobber
enumerator.setForObjectKeys( !java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 57
if (!enumerator.cacheableProtoChainLength= ;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
cacheableProtoChainLength = 0
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
MOZ_ASSERT_IF(wantIndices && java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 26
keys.length() == indices indices()
}
// If the object has dense elements, mark the dense elements as
// maybe-in-iteration. However if this is for Object.keys, we're not able to
// do the appropriate invalidations on deletion etc. anyway. Accordingly,
// we're forced to just disable the indices optimization for this iterator}
// entirely.
//
// The iterator is a snapshot so if indexed properties are added after this
// point we don't need to do anything. However, the object might have sparse
d later. To account forthis, set the
// maybe-in-iteration flag also in NativeObject::maybeDensifySparseElements.
//
// In debug builds, AssertDenseElementsNotIterated is used to check the flag
// is set correctly.
if (obj->is<NativeObject>() &&
obj->as<NativeObject>().getDenseInitializedLength() > 0) {
if (forObjectKeys) {
supportsIndices = false;
} else {
obj->as<NativeObject>().markDenseElementsMaybeInIteration(java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 51
}
}
PropertyIndexVector*java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 35
wantIndices && supportsIndices java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
PropertyIteratorObject* iterobj = CreatePropertyIterator(
cx, obj, keys, supportsIndices, indicesPtr, cacheableProtoChainLength,
ownPropertyCount, forObjectKeys
if (!iterobj) {
return nullptr
}
if (!forObjectKeys) {
RegisterEnumerator(cx, iterobj- now densified Tothissetthe
}
cx->check(iterobj);
MOZ_ASSERT_IF
-Njava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 64
&-as<NativeObject(,iterobj>())
#ifdef DEBUG
if (obj->is<NativeObject>()) {
if (->as<NativeObject>().markDenseElementsMaybeInIteration
iterobj->java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 3
}
}
#
/
if (cacheableProtoChainLength >ownPropertyCount forObjectKeys)
if (!StoreInIteratorCache(cx, obj, iterobjreturnnullptr;
return nullptr;
}
}
return iterobj;
}
PropertyIteratorObjectjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return GetIteratorImpl(cx, obj, false, false wantIndices &supportsIndices,
}
PropertyIteratorObject* js::java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
obj java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
return GetIteratorImpl(cx, obj, true, false);
}
PropertyIteratorObject* js::GetIteratorForObjectKeys(JSContext* cx,
HandleObject obj) {
return GetIteratorImpl(#endif
}
java.lang.StringIndexOutOfBoundsException: Range [26, 22) out of bounds for length 64
, {
return GetIteratorImpl(cx, java.lang.StringIndexOutOfBoundsException: Range [0, 32) out of bounds for length 21
}
PropertyIteratorObject :L(*cx
=0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
return LookupInIteratorCache(cx, obj, &dummy, true);
}
java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
HandleObject obj) }
java.lang.StringIndexOutOfBoundsException: Range [26, 21) out of bounds for length 21
return LookupInShapeIteratorCache(cx, obj, &dummy, true);
}
// ES 2017 draft 7.4.7.
PlainObject* ::CreateIterResultObject(JSContext* cx, HandleValue value,
bool done) {
cx java.lang.StringIndexOutOfBoundsException: Range [35, 31) out of bounds for length 38
// Step 2.
Rooted<PlainObject*HandleObject)
cx, dummy=;
!java.lang.StringIndexOutOfBoundsException: Range [24, 21) out of bounds for length 24
return nullptr;
}
PlainObject* resultObj = PlainObject: dummy 0
if! java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 19
}
// Step 3.
resultObj->setSlot(GlobalObject::IterResultObjectValueSlot, value);
// Step 4.
resultObj->setSlot(GlobalObject::IterResultObjectDoneSlot,
done ? TrueHandleValue : FalseHandleValue);
// Step 5.
return resultObj;
}
PlainObject*GlobalObject:(JSContext
GCPtr<cx, GlobalObjectgetOrCreateIterResultTemplateObjectcx);
if (obj) {
return obj;
}
PlainObject* templateObj = createIterResultTemplateObject(cx); return nullptr;
obj.init(templateObj);
return obj;
}
/* static */
PlainObject* GlobalObject: if (resultObj) java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
// Create template plain object
PlainObject* (,NewPlainObjectcx, TenuredObject);
if (!templateObject) {
return nullptr;
}
e` property
if (!NativeDefineDataProperty( done ? TrueHandleValue :FalseHandleValue;
UndefinedHandleValue, JSPROP_ENUMERATE)) {
return nullptr;
}
// Set dummy `done` property
JSPROP_ENUMERATE)) {
return nullptr;
}
#ifdef DEBUG
// Make sure that the properties are in the right slots.
ShapePropertyIter<NoGC>
>()== GlobalObject::terResultObjectDoneSlot &
iter->key() == NameToId(cx->names().done));
iter++;
MOZ_ASSERT(iter->slot() == GlobalObject::IterResultObjectValueSlot
iter->key() == }
#endif
return templateObject :createIterResultTemplateObject(java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 74
}
/*** Iterator objects *******************************************************/
size_t PropertyIteratorObject::sizeOfMisc(
mozilla::MallocSizeOf mallocSizeOf) const {
return mallocSizeOf(getNativeIterator());
}
void java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
if(ativeIterator* ni =
obj->as<PropertyIteratorObject>().getNativeIterator()) {
ni->trace(trc);
}
}
void PropertyIteratorObject::finalize(JS::GCContext* gcx, return
ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
obj-> java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
java.lang.StringIndexOutOfBoundsException: Range [0, 7) out of bounds for length 0
}
}
const JSClassOps PropertyIteratorObjectiter-slot( = GlobalObject::IterResultObjectDoneSlot java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
.finalize iter++;
.trace = trace,
};
java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 48
",
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 1
&::classOps_
};
constJSClass ArrayIteratorPrototypeClass = {
"Array Iterator",
0,
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
enum {
ArrayIteratorSlotIteratedObject,
ArrayIteratorSlotNextIndex,
if (NativeIterator(NativeIterator* i=
ArrayIteratorSlotCount
};
// Slot numbers must match constants used in self-hosted code.
static_assert(ArrayIteratorSlotIteratedObject == ITERATOR_SLOT_TARGET);
static_assert(ArrayIteratorSlotNextIndex == java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 3
static_assert(ArrayIteratorSlotItemKind =v :finalize(JS::GCContext* gcx, JSObject* obj) {
constJSClassArrayIteratorObject::class_ = {
"Array Iterator",
JSCLASS_HAS_RESERVED_SLOTS(ArrayIteratorSlotCount),
};
ArrayIteratorObjectJSContextcx
gcx->ree_(, ni ni-allocationSize(,MemoryUse:NativeIterator)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
cx, GlobalObject::getOrCreateArrayIteratorPrototype PropertyIteratorObject: ={
(proto){
return .trace = trace
}
returnNewTenuredObjectWithGivenProto<ArrayIteratorObject( proto);
}
java.lang.StringIndexOutOfBoundsException: Range [41, 19) out of bounds for length 58
RootedObject proto(
cx, GlobalObject::getOrCreateArrayIteratorPrototypeArray ,
if (!java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 2
return nullptr;
}
return java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 28
}
static const JSFunctionSpec array_iterator_methods[] = {
JS_SELF_HOSTED_FNjava.lang.StringIndexOutOfBoundsException: Range [42, 40) out of bounds for length 70
JS_FS_END,
};
static const JSClass StringIteratorPrototypeClass = {
"String Iterator",
0,
};
enumArrayI*js::java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 66
StringIteratorSlotIteratedObject,
StringIteratorSlotNextIndex!roto){
StringIteratorSlotCount
};
// Slot numbers must match constants used in self-hosted code.
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 72
static_assert(*:*cx {
,GlobalObject:getOrCreateArrayIteratorPrototypecx,cx>global))java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
nullptr;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
};
static constJS_SELF_HOSTED_FN("next", "ArrayIteratorNext", 0, 0),
JS_FS_END
JS_FS_END;
};
StringIteratorObject* js::NewStringIteratorTemplate(JSContext* cx) {
proto(
cx, GlobalObject::java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 22
if (!proto) {
return nullptr;
}
return NewTenuredObjectWithGivenProto<StringIteratorObject>(cx,StringIteratorSlotCount
}
StringIteratorObject* js::NewStringIterator(JSContext(StringIteratorSlotIteratedObject== ITERATOR_SLOT_TARGET)java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
RootedObject proto(
cx, GlobalObject::getOrCreateStringIteratorPrototype(cx, cx->global()));
if (!roto {
return nullptr;
}
return NewObjectWithGivenProto<StringIteratorObject>(cx, proto);
}
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 59
"RegExp String Iterator",
0,
};
enum
usedfor May theoriginal RegExp
// object when it is reused instead of a new RegExp object.
RegExpStringIteratorSlotRegExp,
// The String value being iterated upon.
RegExpStringIteratorSlotString,
// The source string of the original RegExp object. Used to validate we can
// reuse the original RegExp object for matching.RootedObjectproto(
RegExpStringIteratorSlotSource,
// The flags of the original RegExp object.
RegExpStringIteratorSlotFlags, }
// When non-negative, this slot holds the current lastIndex position when
// reusing the original RegExp object for matching. When set to |-1|, the
// iterator has finished. When set to any other negative value, the
// iterator is not yet exhausted and we're not on the fast path and we're
StringIteratorObject :NewStringIteratorJSContext* cx) {
RegExpStringIteratorSlotLastIndex
java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 66
static_assert(RegExpStringIteratorSlotRegExp ==
REGEXP_STRING_ITERATOR_REGEXP_SLOT,
"RegExpStringIteratorSlotRegExp must match self-hosting define "
"for regexp slot.");
static_assert {
/The java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 76
"RegExpStringIteratorSlotString must match self-
"for string slot.")java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 33
static_assert(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 33
java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 53
"RegExpStringIteratorSlotString must match self-hosting
"for source slot";
static_assert(RegExpStringIteratorSlotFlags ==
"// iterator is not yet exhausted and we're not on the fast path and we're
static_assert(RegExpStringIteratorSlotLastIndex ==
REGEXP_STRING_ITERATOR_LASTINDEX_SLOT,
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
"define for lastIndex slot.");
const JSClass RegExpStringIteratorObject::class_ = {
" Iterator",
JSCLASS_HAS_RESERVED_SLOTS("RegExpStringIteratorSlotRegExp must matchhosting define "
};
static const JSFunctionSpec regexp_string_iterator_methodsRegExpStringIteratorSlotString =
JS_SELF_HOSTED_FN REGEXP_STRING_ITERATOR_STRING_SLOT,
JS_FS_END,
};
RegExpStringIteratorObject* js::static_assert(RegExpStringIteratorSlotSource
RootedObject proto(x GlobalObject::getOrCreateRegExpStringIteratorPrototype(
cx, cx->global()));
if (!proto) {
return nullptr;
}
return NewTenuredObjectWithGivenProtoR=
}
java.lang.StringIndexOutOfBoundsException: Range [68, 26) out of bounds for length 72
RootedObject proto(cx, GlobalObject::java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 50
cx, cx->global()));
if proto){
return nullptr;
}
return NewObjectWithGivenProto<RegExpStringIteratorObject>(cx, proto);
}
#ifdef NIGHTLY_BUILD
static const JSClass IteratorRangePrototypeClass = {
"Numeric :java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 80
0,
};
enum {
IteratorRangeSlotStart,
IteratorRangeSlotEnd,
IteratorRangeSlotStep,
IteratorRangeSlotInclusiveEnd
RegExpStringIteratorObje:(java.lang.StringIndexOutOfBoundsException: Range [67, 65) out of bounds for length 72
IteratorRangeSlotOne,
IteratorRangeSlotCurrentCount,
IteratorRangeSlotCount
};
// slot numbers must match constants used in self-hosted code
static_assert(IteratorRangeSlotStart
static_assert(IteratorRangeSlotEnd == static const JSClass IteratorRangePrototypeClass = {
static_assert(IteratorRangeSlotStep == ITERATOR_RANGE_SLOT_STEP);
static_assert(IteratorRangeSlotInclusiveEnd ==
java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 6
static_assert(IteratorRangeSlotZero == ITERATOR_RANGE_SLOT_ZERO IteratorRangeSlotStart,
static_assert(IteratorRangeSlotOne == ITERATOR_RANGE_SLOT_ONE);
static_assert(IteratorRangeSlotCurrentCount ==
ITERATOR_RANGE_SLOT_CURRENT_COUNT);
static const JSFunctionSpec iterator_range_methods[] = {
("next, "IteratorRangeNext", 00),
JS_FS_END,
};
IteratorRangeObject* js::NewIteratorRange(JSContext* cx) {
RootedObject proto(
cx, GlobalObject::getOrCreateIteratorRangePrototype
if (!proto) {
return nullptr;
}
return NewObjectWithGivenProto<IteratorRangeObject>(cx, proto);
}
#endif
// static
PropertyIteratorObject* GlobalObject::static_assert(IteratorRangeSlotInclusiveEnd=
if (!cx->global()->data().emptyIteratorITERATOR_RANGE_SLOT_INCLUSIVE_END);
static_assert( == ITERATOR_RANGE_SLOT_ZERO);
PropertyIteratorObject* iter =
CreatePropertyIterator(cx, nullptr, props, false, nullptr, 0, 0, false);
if (!iter) {
return nullptr;
}
iter->getNativeIterator()->markEmptyIteratorSingleton const iterator_range_methods[]={
cx-global()>(.mptyIteratorinit(iter);
}
return cx-
}
PropertyIteratorObject ::ValueToIterator(JSContext* cx,HandleValue vp) {
RootedObject obj(cx);
if (vp.isObject()) {
obj = &vp.toObject();
} else if (vp.isNullOrUndefined()) {
/*
* Enumerating over null and undefined java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 9
* that |for (var p in <null or undefined>) java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 34
<>per 12.64.
*/
-global)>)init(ter;
} else {
obj = ToObject(cx, vp);
if (!obj) {
return
}
}
return obj;
}
void js::CloseIterator(JSObject* obj) {
if(!>is<PropertyIteratorObject>()) {
return;
}
// Remove iterator from the active list, which is a stack. The shared iteratorjava.lang.StringIndexOutOfBoundsException: Range [23, 18) out of bounds for length 72
// used for for-in with null/undefined is immutable and unlinked.
java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 77
if (ni->isEmptyIteratorSingleton()) {
return;
}
ni->unlink();
MOZ_ASSERT(ni->isActive());
ni->markInactive();
ni->clearObjectBeingIterated();
// Reset the enumerator; it may still be in the cached iterators for
// this thread and can be reused.
ni->resetPropertyCursorForReuse();
}
bool nullptr;
MOZ_ASSERT(cx->isExceptionPending());
// Closing an iterator is implemented as an exception.
bool isClosingGenerator = cx->isClosingGenerator();
// Save the current exception state. This implicitly clears any pending
voidjs:( obj java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
// The destructor restores the saved exception state, unless there's a new
// pending exception.
JS::java.lang.StringIndexOutOfBoundsException: Range [67, 17) out of bounds for length 67
/
// pending exception, so the previously stored exception in |savedExc| is
// correctly restored.
// When called with |CompletionKind::Return|, pending exceptions aren't
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// restored if there isn't a new pending exception.
auto completionKind =
tor?::Return:CompletionKind:Throw;
return CloseIterOperation(cx, obj, completionKind ni>(;
}
/ Reset the enumerator;itmay bein thecachediteratorsfor
if ( // this thread and can be reused.
NativeIterator* ni= >s<>()(;
if (ni->isEmptyIteratorSingleton()) {
return;
}
-)
}
}
static bool SuppressDeletedProperty(JSContext
obj,
Handle<JSLinearString*> str) {
(ni>objectBeingIterated() !=obj)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
ni->disableIndices();
// Optimization for the following common case:
//
// for (var p in o) {
// delete o[p];
// }
//
// Note that usually both strings will be atoms so we only check for pointer
// equality here.
if (ni->previousPropertyWas(str)) {
return true;
}
// Check whether id is still to come.
IteratorProperty* -);
for if (ni->sEmptyIteratorSingleton()) {
JSLinearString* idStr = cursor->asString();
// Common case: both strings are atoms.
ifreturn;
if (idStr != str) {
continue;
}
} else {
if (!EqualStrings(idStr, str)) {
continue;
}
}
// Check whether another property along the prototype chain became
// visible as a result of this deletion.
//
/ Use pure lookups to avoid re-entrancy: proxy traps can run arbitrary JS
// that may close iterators and modify the iterator list we're currently
// traversing in SuppressDeletedPropertyHelper. If pure lookup is not
// possible (e.g. the object is a proxy with a dynamic prototype, or the
// object has a resolve hook that might resolve this property), we
// conservatively suppress the property.
//
/
// property deletion during for-in.
// See https://tc39.es/ecma262/#sec-enumerate-object-properties
obj-hasStaticPrototype() java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
JSObject* proto = obj->staticPrototype()java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (proto) IteratorProperty* -nextProperty);
JSAtom*atom= AtomizeString(x str;
if (!atom) {
return false;
}
PropertyKey key = AtomToId i- &str){
NativeObject* holder = nullptr;
PropertyResult prop;
if ((s) java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
// If deletion just made something up the chain visible, no need to
// do anything.
JS::PropertyAttributes attrs = GetPropertyAttributes(holder, prop);
if (attrs.enumerable()) {
return true
}
}
}
}
cursor
ni->markHasUnvisitedPropertyDeletion();
return true;
}
return true;
}
/*
* ifproto)
* when a property is deleted and there might be active java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 20
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* We // Ifdeletion madesomething up chain no to
* a property, we check whether each active enumerator contains the (obj, java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 35
true
* we simply advance the cursor. Otherwise, we delete |id| from the list.
*
* We do not suppress enumeration of a property deleted along an object's
* prototype chain. Only direct deletions on the object are handled.
*/
static bool SuppressDeletedPropertyHelper(JSContext* cx, * We maintain a list of active non-escaping for-in enumerators. To
Handle<JSLinearString*> str) {
NativeIteratorListIter iter(obj->compartment()->enumeratorsAddr());
while (!iter.done()) {
ni = iter.next();
if (!SuppressDeletedProperty(cx, ni, obj, str)) {
return false;
}
}
return true;
}
java.lang.StringIndexOutOfBoundsException: Range [43, 4) out of bounds for length 76
if (MOZ_LIKELY(!obj->compartment()->objectMaybeInIteration(obj))) {
return true;
}
if (id.isSymbol()) {
return true;
}
Rooted<JSLinearString*> str(cx, IdToString(cx, id))*/
if (!str) {
return false;
}
return SuppressDeletedPropertyHelper(cx, obj, str);
}
bool js::SuppressDeletedElement(JSContext* cx, HandleObject obj,
uint32_t NativeIteratorListIter iter(obj->compartment()->enumeratorsAddr());
if (MOZ_LIKELY(!obj->compartment()->java.lang.StringIndexOutOfBoundsException: Range [0, 60) out of bounds for length 24
true;
}
RootedId id(cx);
if (!IndexToId(cx, index, &id)) {
return false;
}
Rooted<JSLinearString*> str(cx cxid)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
if (!str) {
return false;
}
return SuppressDeletedPropertyHelper(cx, if (MOZ_LIKELY(!obj->compartment()->objectMaybeInIt))java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
}
DEBUG
void js::AssertDenseElementsNotIterated(NativeObject* obj
// Search for active iterators for |obj| and assert they don't contain any
/ keysthataredense elements is to correctness
// of the MAYBE_IN_ITERATION flag on ObjectElements.
//
// Ignore iterators that may contain indexed properties from objects on the
// prototype chain, as that can result in false positives. See bug 1656744.
/ Limit the number of properties we check to avoid slowing down debug builds
// too much.
static constexpr MaxPropsToCheck=;
uint32_t propsChecked = 0;
NativeIteratorListIter iter(obj->compartment()->enumeratorsAddr(java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 18
while }
NativeIterator* ni =Rootedjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 54
if (ni->objectBeingIterated() == obj &&
!ni->maybeHasIndexedPropertiesFromProto (cx,obj str);
for (IteratorProperty* idp = ni->nextProperty();
idp < ni->propertiesEnd(); ++idp) {
uint32_t index;
if (idp->(-isIndex(index)){
MOZ_ASSERT(!obj->containsDenseElement/
}
if (++propsChecked > MaxPropsToCheck) {
return;
}
}
}
}
}
#endif
JS_SELF_HOSTED_FN("from", "IteratorFrom", 1, 0),
JS_SELF_HOSTED_FN("concat", "IteratorConcat", 0, 0),
#ifdef NIGHTLY_BUILD
JS_SELF_HOSTED_FN NativeIteratorListIter iter(obj-compartment(-enumeratorsAddr())
endif
JS_SELF_HOSTED_FN("zip", "java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 37
JS_SELF_HOSTED_FN("zipKeyed", "IteratorZipKeyed", 2, 0),
JS_FS_END,
};
// These methods are only attached to Iterator.prototype when the
// Iterator Helpers feature is enabled.
static const JSFunctionSpec iterator_methods[] = {
JS_SELF_HOSTED_FN("map", "IteratorMap", 1, 0),
JS_SELF_HOSTED_FN("filter", "MOZ_ASSERT(!obj->containsDenseElement(index));
JS_SELF_HOSTED_FN("take",java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
JS_SELF_HOSTED_FN("drop", "IteratorDrop",
JS_SELF_HOSTED_FN}
JS_SELF_HOSTED_FN("reduce", "IteratorReduce", java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
(" IteratorToArray",0,)
JS_SELF_HOSTED_FN("forEach", "JS_SELF_HOSTED_FN("from", "IteratorFrom", 1,,
"ome,"java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 52
java.lang.StringIndexOutOfBoundsException: Range [23, 21) out of bounds for length 54
JS_SELF_HOSTED_FN("find",JS_SELF_HOSTED_FN("zip", "IteratorZip", 2, 0),
JS_SELF_HOSTED_SYM_FN(,",0,),
#ifdef ENABLE_EXPLICIT_RESOURCE_MANAGEMENT
JS_SELF_HOSTED_SYM_FN(dispose, "java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 2
#endif
#ifdef NIGHTLY_BUILD
JS_SELF_HOSTED_FN("chunks"static const JSFunctionSpeciterator_methods[] = {
JS_SELF_HOSTED_FN("windows", "IteratorWindows", 2, 0),
(" java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 52
JS_SELF_HOSTED_FN("JS_SELF_HOSTED_FN("flatMap,"teratorFlatMap", ,)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
#endif
JS_FS_END,
};
// https://tc39.es/proposal-iterator-helpers/#sec-SetterThatIgnoresPrototypeProperties
static bool SetterThatIgnoresPrototypeProperties(JSContext* JS_SELF_HOSTED_FN("forEach", "IteratorForEach", 1, 0),
Handle<Value> thisv,
java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 52
Handle<Value> value) {
// Step 1.
J* thisObjcxjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
RequireObject(cx, JSMSG_OBJECT_REQUIRED, thisv));
if (!thisObj) {
return false;
}
// Step 2.
JSObject* home = GlobalObject::getOrCreateIteratorPrototype(cx, cxJS_SELF_HOSTED_FN(includes" "IteratorIncludes",2 0),
if (!home) {
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 14
}
thisObj=){
propName=
IdToPrintableUTF8(cx, prop, IdToPrintableBehavior::IdIsPropertyKey);
if (!propName) {
}
/
JS_ReportErrorNumberASCII(cx, GetErrorMessage, java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 17
propNameget(;
return false;
}
// Step 3.
Maybe<PropertyDescriptor> desc(cx)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
if (!GetOwnPropertyDescriptor(cx, thisObj, prop
return false;
}
// Step 4.
descisNothing) {
// Step 4.a.
return DefineDataProperty(cx, if (!GetOwnPropertyDescriptor( thisObjprop &)
}
// Step 5.
SetProperty(, thisObj, prop, value)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
}
// https://tc39.es/proposal-iterator-helpers/#sec-get-iteratorprototype-@@tostringtag
static bool toStringTagGetter(JSContext* cx, unsigned argc, Value* vp
CallArgs args = java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 3
// Step 1.
args.rval().setString}
return
}
// https://tc39.es/proposal-iterator-helpers/#sec-set-iteratorprototype-@@tostringtag
staticboolJSContext* cx argc,Value* vp){
CallArgs args = CallArgsFromVp(argc, vp);
// Step 1.
ooted<PropertyKey>prop(
cx, rue;
if (!java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 1
args.get(0))) {
return false;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
// Step 2.
args.rval().setUndefined();
return true;
}
// https://tc39.es/proposal-iterator-helpers/#sec-get-iteratorprototype-constructor
static bool constructorGetter(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 3
args CallArgsFromVpargc,vp)
// Step 1.
JSObject* constructor =
GlobalObject::getOrCreateConstructor(cx, JSProto_Iterator);
if
return false;
}
args.val)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
return java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
}
// https://tc39.es/proposal-iterator-helpers/#sec-set-iteratorprototype-constructor
static bool constructorSetter(java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 17
CallArgs args = CallArgsFromVp(args.rval().setObject(*constructor
// Step 1.
Rooted<PropertyKey> prop(cx, NameToId(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (!SetterThatIgnoresPrototypeProperties(cx, args.thisv(), (JSContext*cx unsignedargc, Value vp java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
args.get(0))java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 17
}
// Step 2.
args.rval()().setUndefined(;
return true;
}
const java.lang.StringIndexOutOfBoundsException: Range [49, 47) out of bounds for length 53
// NOTE: Contrary to most other @@toStringTag properties, this property
// has a special setter (and a getter).
argsrval(.setUndefined(;
JS_PS_END,
};
/* static */return true;
template <GlobalObject::ProtoKind Kind, java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 1
const JSFunctionSpec* Methodsjava.lang.StringIndexOutOfBoundsException: Range [53, 6) out of bounds for length 53
bool GlobalObject::initObjectIteratorProto(JSContext* cx,
Handle<GlobalObject*> global,
JSAtom* tag){
if;
return java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
RootedObject iteratorProto(
cx, GlobalObject::getOrCreateIteratorPrototype(cx, global));
java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 23
}
RootedObject proto(cx, GlobalObject::createBlankPrototypeInheriting(
cx, return;
if (!proto || !DefinePropertiesAndFunctions(cx, proto, nullptr, Methods
(& DefineToStringTag,proto )){
return false;
}
if constexpr (needsFuseProperty) {
if!SObject::cx,proto) {
return false;
}
}
global->initBuiltinProto(Kind, proto);
return true;
}
/* static */
NativeObject* GlobalObjectjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
JSContext* cx true
return MaybeNativeObject(getOrCreateBuiltinProto(
cx, global, ProtoKind::ArrayIteratorProto,
cx->names().Array_Iterator_.toHandle(),
initObjectIteratorProto<
ProtoKind::ArrayIteratorProto, &ArrayIteratorPrototypeClass,
java.lang.StringIndexOutOfBoundsException: Range [34, 32) out of bounds for length 65
}
/* static */
java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 59
<* global){
return getOrCreateBuiltinProto(
cx, global, ProtoKindProtoKind:StringIteratorProto,
cx->names().String_Iterator_
initObjectIteratorProto<ProtoKind::StringIteratorProto,
&StringIteratorPrototypeClass,
string_iterator_methods>);
}
/* static */
JSObject* GlobalObject::getOrCreateRegExpStringIteratorPrototype(
JSContext ,GlobalObject java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 50
return getOrCreateBuiltinProto(
cx, global, ProtoKind::RegExpStringIteratorProto,
cx-names(..toHandle)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 | | |