@@ -1080,6 +1080,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
10801080 case HOLEY_SEALED_ELEMENTS:
10811081 case HOLEY_NONEXTENSIBLE_ELEMENTS:
10821082 case HOLEY_ELEMENTS: {
1083+ // Disallow execution so the cached elements won't change mid execution.
1084+ DisallowJavascriptExecution no_js (isolate);
1085+
10831086 // Run through the elements FixedArray and use HasElement and GetElement
10841087 // to check the prototype for missing elements.
10851088 Handle<FixedArray> elements (FixedArray::cast (array->elements ()), isolate);
@@ -1106,6 +1109,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
11061109 }
11071110 case HOLEY_DOUBLE_ELEMENTS:
11081111 case PACKED_DOUBLE_ELEMENTS: {
1112+ // Disallow execution so the cached elements won't change mid execution.
1113+ DisallowJavascriptExecution no_js (isolate);
1114+
11091115 // Empty array is FixedArray but not FixedDoubleArray.
11101116 if (length == 0 ) break ;
11111117 // Run through the elements FixedArray and use HasElement and GetElement
@@ -1142,6 +1148,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
11421148 }
11431149
11441150 case DICTIONARY_ELEMENTS: {
1151+ // Disallow execution so the cached dictionary won't change mid execution.
1152+ DisallowJavascriptExecution no_js (isolate);
1153+
11451154 Handle<NumberDictionary> dict (array->element_dictionary (), isolate);
11461155 std::vector<uint32_t > indices;
11471156 indices.reserve (dict->Capacity () / 2 );
0 commit comments