@@ -1083,6 +1083,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
10831083 case HOLEY_SEALED_ELEMENTS:
10841084 case HOLEY_NONEXTENSIBLE_ELEMENTS:
10851085 case HOLEY_ELEMENTS: {
1086+ // Disallow execution so the cached elements won't change mid execution.
1087+ DisallowJavascriptExecution no_js (isolate);
1088+
10861089 // Run through the elements FixedArray and use HasElement and GetElement
10871090 // to check the prototype for missing elements.
10881091 Handle<FixedArray> elements (FixedArray::cast (array->elements ()), isolate);
@@ -1109,6 +1112,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
11091112 }
11101113 case HOLEY_DOUBLE_ELEMENTS:
11111114 case PACKED_DOUBLE_ELEMENTS: {
1115+ // Disallow execution so the cached elements won't change mid execution.
1116+ DisallowJavascriptExecution no_js (isolate);
1117+
11121118 // Empty array is FixedArray but not FixedDoubleArray.
11131119 if (length == 0 ) break ;
11141120 // Run through the elements FixedArray and use HasElement and GetElement
@@ -1145,6 +1151,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
11451151 }
11461152
11471153 case DICTIONARY_ELEMENTS: {
1154+ // Disallow execution so the cached dictionary won't change mid execution.
1155+ DisallowJavascriptExecution no_js (isolate);
1156+
11481157 Handle<NumberDictionary> dict (array->element_dictionary (), isolate);
11491158 std::vector<uint32_t > indices;
11501159 indices.reserve (dict->Capacity () / 2 );
0 commit comments