@@ -1080,6 +1080,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
1080
1080
case HOLEY_SEALED_ELEMENTS:
1081
1081
case HOLEY_NONEXTENSIBLE_ELEMENTS:
1082
1082
case HOLEY_ELEMENTS: {
1083
+ // Disallow execution so the cached elements won't change mid execution.
1084
+ DisallowJavascriptExecution no_js (isolate);
1085
+
1083
1086
// Run through the elements FixedArray and use HasElement and GetElement
1084
1087
// to check the prototype for missing elements.
1085
1088
Handle <FixedArray> elements (FixedArray::cast (array->elements ()), isolate);
@@ -1106,6 +1109,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
1106
1109
}
1107
1110
case HOLEY_DOUBLE_ELEMENTS:
1108
1111
case PACKED_DOUBLE_ELEMENTS: {
1112
+ // Disallow execution so the cached elements won't change mid execution.
1113
+ DisallowJavascriptExecution no_js (isolate);
1114
+
1109
1115
// Empty array is FixedArray but not FixedDoubleArray.
1110
1116
if (length == 0 ) break ;
1111
1117
// Run through the elements FixedArray and use HasElement and GetElement
@@ -1142,6 +1148,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
1142
1148
}
1143
1149
1144
1150
case DICTIONARY_ELEMENTS: {
1151
+ // Disallow execution so the cached dictionary won't change mid execution.
1152
+ DisallowJavascriptExecution no_js (isolate);
1153
+
1145
1154
Handle <NumberDictionary> dict (array->element_dictionary (), isolate);
1146
1155
std::vector<uint32_t > indices;
1147
1156
indices.reserve (dict->Capacity () / 2 );
0 commit comments