mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1325052. r=Waldo
This commit is contained in:
parent
f67d1319c7
commit
98c86f084f
@ -1988,6 +1988,7 @@ js::array_sort(JSContext* cx, unsigned argc, Value* vp)
|
||||
undefs = 0;
|
||||
bool allStrings = true;
|
||||
bool allInts = true;
|
||||
bool extraIndexed = ObjectMayHaveExtraIndexedProperties(obj);
|
||||
RootedValue v(cx);
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
if (!CheckForInterrupt(cx))
|
||||
@ -2048,7 +2049,10 @@ js::array_sort(JSContext* cx, unsigned argc, Value* vp)
|
||||
}
|
||||
}
|
||||
|
||||
if (!SetArrayElements(cx, obj, 0, uint32_t(n), vec.begin(), ShouldUpdateTypes::DontUpdate))
|
||||
ShouldUpdateTypes updateTypes = !extraIndexed && (allStrings || allInts)
|
||||
? ShouldUpdateTypes::DontUpdate
|
||||
: ShouldUpdateTypes::Update;
|
||||
if (!SetArrayElements(cx, obj, 0, uint32_t(n), vec.begin(), updateTypes))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user