зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1281194 - Don't use for-of iteration over requested modules array r=bz
This commit is contained in:
Родитель
284c26c669
Коммит
ed839a5b59
|
@ -865,25 +865,16 @@ ResolveRequestedModules(nsModuleLoadRequest* aRequest, nsCOMArray<nsIURI> &aUrls
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> arrayValue(cx, JS::ObjectValue(*specifiers));
|
||||
JS::ForOfIterator iter(cx);
|
||||
if (!iter.init(arrayValue)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
while (true) {
|
||||
bool done;
|
||||
if (!iter.next(&val, &done)) {
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
if (!JS_GetElement(cx, specifiers, i, &val)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
|
||||
nsAutoJSString specifier;
|
||||
specifier.init(cx, val);
|
||||
if (!specifier.init(cx, val)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Let url be the result of resolving a module specifier given module script and requested.
|
||||
nsModuleScript* ms = aRequest->mModuleScript;
|
||||
|
|
|
@ -4288,8 +4288,9 @@ ModuleEvaluation(JSContext* cx, JS::HandleObject moduleRecord);
|
|||
* Get a list of the module specifiers used by a source text module
|
||||
* record to request importation of modules.
|
||||
*
|
||||
* The result is a JavaScript array of string values. ForOfIterator can be used
|
||||
* to extract the individual strings.
|
||||
* The result is a JavaScript array of string values. To extract the individual
|
||||
* values use only JS_GetArrayLength and JS_GetElement with indices 0 to
|
||||
* length - 1.
|
||||
*/
|
||||
extern JS_PUBLIC_API(JSObject*)
|
||||
GetRequestedModules(JSContext* cx, JS::HandleObject moduleRecord);
|
||||
|
|
Загрузка…
Ссылка в новой задаче