Commit 2250cee7 authored by Butkovits Atila's avatar Butkovits Atila
Browse files

Backed out 3 changesets (bug 1795816, bug 1833946) for causing failures at...

Backed out 3 changesets (bug 1795816, bug 1833946) for causing failures at from_async.js. CLOSED TREE

Backed out changeset c717912156f5 (bug 1795816)
Backed out changeset 7c2aa1e8b112 (bug 1795816)
Backed out changeset d99d41fd6d86 (bug 1833946)
parent 1bd1918a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -290,7 +290,7 @@ class JS_PUBLIC_API RealmCreationOptions {
  // Pref for String.prototype.{is,to}WellFormed() methods.
  bool wellFormedUnicodeStrings_ = false;
#endif
  bool arrayFromAsync_ = true;
  bool arrayFromAsync_ = false;
#ifdef ENABLE_CHANGE_ARRAY_BY_COPY
  bool changeArrayByCopy_ = false;
#endif
+2 −0
Original line number Diff line number Diff line
@@ -4910,7 +4910,9 @@ static const JSFunctionSpec array_methods[] = {
static const JSFunctionSpec array_static_methods[] = {
    JS_INLINABLE_FN("isArray", array_isArray, 1, 0, ArrayIsArray),
    JS_SELF_HOSTED_FN("from", "ArrayFrom", 3, 0),
#ifdef NIGHTLY_BUILD
    JS_SELF_HOSTED_FN("fromAsync", "ArrayFromAsync", 3, 0),
#endif
    JS_FN("of", array_of, 0, 0),

    JS_FS_END};
+11 −11
Original line number Diff line number Diff line
@@ -832,9 +832,8 @@ function ArrayKeys() {
  return CreateArrayIterator(this, ITEM_KIND_KEY);
}

#ifdef NIGHTLY_BUILD
// https://tc39.es/proposal-array-from-async/
// TODO: Bug 1834560 The step numbers in this will need updating when this is merged
// into the main spec.
function ArrayFromAsync(asyncItems, mapfn = undefined, thisArg = undefined) {
  // Step 1. Let C be the this value.
  var C = this;
@@ -878,6 +877,12 @@ function ArrayFromAsync(asyncItems, mapfn = undefined, thisArg = undefined) {
      }
    }

    // Step 3.e. If IsConstructor(C) is true, then
    //     Step 3.e.i. Let A be ? Construct(C).
    // Step 3.f. Else,
    //     Step 3.f.i. Let A be ! ArrayCreate(0).
    let A = IsConstructor(C) ? constructContentFunction(C, C) : [];

    // Step 3.g. Let iteratorRecord be undefined.
    // Step 3.j. If iteratorRecord is not undefined, then ...
    if (usingAsyncIterator !== undefined || usingSyncIterator !== undefined) {
@@ -893,14 +898,6 @@ function ArrayFromAsync(asyncItems, mapfn = undefined, thisArg = undefined) {
      // Step 3.i. Else if usingSyncIterator is not undefined, then
      //     Set iteratorRecord to ? CreateAsyncFromSyncIterator(GetIterator(asyncItems, sync, usingSyncIterator)).

      // https://github.com/tc39/proposal-array-from-async/pull/41
      // Step 3.e. If IsConstructor(C) is true, then
      //     Step 3.e.i. Let A be ? Construct(C).
      // Step 3.f. Else,
      //     Step 3.f.i. Let A be ! ArrayCreate(0).
      let A = IsConstructor(C) ? constructContentFunction(C, C) : [];


      // Step 3.j.i. Let k be 0.
      let k = 0;

@@ -967,7 +964,9 @@ function ArrayFromAsync(asyncItems, mapfn = undefined, thisArg = undefined) {
    //     Step 3.k.iv.1. Let A be ? Construct(C, « 𝔽(len) »).
    // Step 3.k.v. Else,
    //     Step 3.k.v.1. Let A be ? ArrayCreate(len).
    let A = IsConstructor(C) ? constructContentFunction(C, C, len) : std_Array(len);
    // Note: This double construction isn't great, issue is open:
    // https://github.com/tc39/proposal-array-from-async/issues/35
    A = IsConstructor(C) ? constructContentFunction(C, C, len) : std_Array(len);

    // Step 3.k.vi. Let k be 0.
    let k = 0;
@@ -1005,6 +1004,7 @@ function ArrayFromAsync(asyncItems, mapfn = undefined, thisArg = undefined) {
  // Step 5. Return promiseCapability.[[Promise]].
  return fromAsyncClosure();
}
#endif

// ES 2017 draft 0f10dba4ad18de92d47d421f378233a2eae8f077 22.1.2.1
function ArrayFrom(items, mapfn = undefined, thisArg = undefined) {
+5 −5
Original line number Diff line number Diff line
@@ -623,9 +623,9 @@ bool shell::enableToSource = false;
bool shell::enablePropertyErrorMessageFix = false;
bool shell::enableIteratorHelpers = false;
bool shell::enableShadowRealms = false;
bool shell::enableArrayFromAsync = true;
#ifdef NIGHTLY_BUILD
bool shell::enableArrayGrouping = false;
bool shell::enableArrayFromAsync = false;
// Pref for String.prototype.{is,to}WellFormed() methods.
bool shell::enableWellFormedUnicodeStrings = false;
#endif
@@ -3893,9 +3893,9 @@ static void SetStandardRealmOptions(JS::RealmOptions& options) {
      .setPropertyErrorMessageFixEnabled(enablePropertyErrorMessageFix)
      .setIteratorHelpersEnabled(enableIteratorHelpers)
      .setShadowRealmsEnabled(enableShadowRealms)
      .setArrayFromAsyncEnabled(enableArrayFromAsync)
#ifdef NIGHTLY_BUILD
      .setArrayGroupingEnabled(enableArrayGrouping)
      .setArrayFromAsyncEnabled(enableArrayFromAsync)
      .setWellFormedUnicodeStringsEnabled(enableWellFormedUnicodeStrings)
#endif
#ifdef ENABLE_CHANGE_ARRAY_BY_COPY
@@ -11384,9 +11384,9 @@ bool InitOptionParser(OptionParser& op) {
                        "Enable iterator helpers") ||
      !op.addBoolOption('\0', "enable-shadow-realms", "Enable ShadowRealms") ||
      !op.addBoolOption('\0', "enable-array-grouping",
                        "Enable Array.grouping") ||
      !op.addBoolOption('\0', "enable-array-from-async",
                        "Enable Array.fromAsync") ||
      !op.addBoolOption('\0', "enable-array-from-async",
                        "Enable Array Grouping") ||
      !op.addBoolOption('\0', "enable-well-formed-unicode-strings",
                        "Enable String.prototype.{is,to}WellFormed() methods"
                        "(Well-Formed Unicode Strings)") ||
@@ -11908,9 +11908,9 @@ bool SetContextOptions(JSContext* cx, const OptionParser& op) {
      !op.getBoolOption("disable-property-error-message-fix");
  enableIteratorHelpers = op.getBoolOption("enable-iterator-helpers");
  enableShadowRealms = op.getBoolOption("enable-shadow-realms");
  enableArrayFromAsync = op.getBoolOption("enable-array-from-async");
#ifdef NIGHTLY_BUILD
  enableArrayGrouping = op.getBoolOption("enable-array-grouping");
  enableArrayFromAsync = op.getBoolOption("enable-array-from-async");
  enableWellFormedUnicodeStrings =
      op.getBoolOption("enable-well-formed-unicode-strings");
#endif
+1 −1
Original line number Diff line number Diff line
@@ -2228,7 +2228,6 @@ JS_PUBLIC_API bool js::ShouldIgnorePropertyDefinition(JSContext* cx,
       id == NameToId(cx->names().groupToMap))) {
    return true;
  }
#endif

  // It's gently surprising that this is JSProto_Function, but the trick
  // to realize is that this is a -constructor function-, not a function
@@ -2238,6 +2237,7 @@ JS_PUBLIC_API bool js::ShouldIgnorePropertyDefinition(JSContext* cx,
      id == NameToId(cx->names().fromAsync)) {
    return true;
  }
#endif

#ifdef ENABLE_CHANGE_ARRAY_BY_COPY
  if (key == JSProto_Array &&
Loading