[Intl] throw instead of DCHECK while long locale
This is a temp fix to throw instead of DCHECK in debug build. The correct fix depends on the landing of https://github.com/unicode-org/icu/pull/1762 Once that land I will cherrypick into chrome to fix the function correctly. But the current (before this CL) behavior is not harmful in release build. It basically does not do the max nor min just return itself. Bug: chromium:1224869 Change-Id: Iebce2ab0a5ce047e83e8fce05db8290212e64509 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3017300 Reviewed-by: Shu-yu Guo <syg@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#76047}
This commit is contained in:
parent
3a8ce6a092
commit
2273f34116
@ -425,8 +425,13 @@ MaybeHandle<JSLocale> JSLocale::Maximize(Isolate* isolate,
|
||||
// Base name is not changed
|
||||
result = source;
|
||||
}
|
||||
DCHECK(U_SUCCESS(status));
|
||||
DCHECK(!result.isBogus());
|
||||
if (U_FAILURE(status) || result.isBogus()) {
|
||||
// Due to https://unicode-org.atlassian.net/browse/ICU-21639
|
||||
// Valid but super long locale will fail. Just throw here for now.
|
||||
THROW_NEW_ERROR(isolate,
|
||||
NewRangeError(MessageTemplate::kLocaleBadParameters),
|
||||
JSLocale);
|
||||
}
|
||||
return Construct(isolate, result);
|
||||
}
|
||||
|
||||
@ -455,8 +460,13 @@ MaybeHandle<JSLocale> JSLocale::Minimize(Isolate* isolate,
|
||||
// Base name is not changed
|
||||
result = source;
|
||||
}
|
||||
DCHECK(U_SUCCESS(status));
|
||||
DCHECK(!result.isBogus());
|
||||
if (U_FAILURE(status) || result.isBogus()) {
|
||||
// Due to https://unicode-org.atlassian.net/browse/ICU-21639
|
||||
// Valid but super long locale will fail. Just throw here for now.
|
||||
THROW_NEW_ERROR(isolate,
|
||||
NewRangeError(MessageTemplate::kLocaleBadParameters),
|
||||
JSLocale);
|
||||
}
|
||||
return Construct(isolate, result);
|
||||
}
|
||||
|
||||
|
18
test/intl/regress-1224869.js
Normal file
18
test/intl/regress-1224869.js
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright 2021 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
var l = new Intl.Locale("en-US-4106-4104-4102-4100-4098-4096-4094-4092-4090-4088-4086-4084-4082-4080-4078-4076-4074-4072-4070-4068-4066-4064-4062-4060-4058-4056-4054-4052-4050-4048-4049");
|
||||
|
||||
// Ensure won't DCHECK in debug build
|
||||
try {
|
||||
l.maximize();
|
||||
} catch(e) {
|
||||
}
|
||||
|
||||
l2 = new Intl.Locale("en-US-4106-4104-4102-4100-4098-4096-4094-4092-4090-4088-4086-4084-4082-4080-4078-4076-4074-4072-4070-4068-4066-4064-4062-4060-4058-4056-4054-4052-4050-4048-4049");
|
||||
// Ensure won't DCHECK in debug build
|
||||
try {
|
||||
l2.minimize();
|
||||
} catch(e) {
|
||||
}
|
Loading…
Reference in New Issue
Block a user