react-native-community / jsc-android-buildscripts

Script for building JavaScriptCore for Android (for React Native but not only)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-standard ownProperty `length` on AsyncGenerator and AsyncFunctionPrototype

leotm opened this issue · comments

commented

Issue Description

In android-jsc we're adding non-standard ownProperty length
On our AsyncGenerator (shown below) and AsyncFunctionPrototype

Reflect.ownKeys(AsyncGenerator) on iOS

["constructor", "prototype", Symbol(Symbol.toStringTag)]

Other engines (like android-v8 when remote debugging) don't add the length property too

Reflect.ownKeys(AsyncGenerator) on Android

["length", "constructor", "prototype", Symbol(Symbol.toStringTag)]

This only happens on Android, which is against the ECMAScript standard

WebKitGTK everywhere else isn't adding our length property here ^

Repro

grab.cjs

module.exports = function grab() {
  async function* AsyncGeneratorFunctionInstance() {}
  const AsyncGeneratorFunction = Object.getPrototypeOf(
    AsyncGeneratorFunctionInstance,
  ).constructor;

  const AsyncGenerator = AsyncGeneratorFunction.prototype;

  return Reflect.ownKeys(AsyncGenerator);
};

.babelignore

grab.cjs

index.js

import grab from './grab.cjs';

console.log(grab());

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

Version, config, any additional info

RN 0.66.5, so default "jsc-android": "^250231.0.0" (WebKitGTK 2.26.1)
RN 0.66.5, iOS default

Not yet tested on later versions