NativeScript / ios-jsc

NativeScript for iOS using JavaScriptCore
http://docs.nativescript.org/runtimes/ios
Apache License 2.0
298 stars 59 forks source link

fix(runtime): Exclude duplicate properties from getOwnPropertyNames' result #1229

Closed mbektchiev closed 4 years ago

mbektchiev commented 4 years ago

Extract logic for checking whether a property defined in a class should be left to be handled by its base class via the prototype chain or not. Apply the same logic when collecting own property names and exclude them if needed.

PR Checklist

What is the current behavior?

Properties that are hidden from derived classes are still reported by Object.getOwnPropertyNames. I.e. Object.getOwnPropertyDescriptor could return undefined for some of the properties returned by Object.getOwnPropertyNames.

What is the new behavior?

Properties that are hidden from derived classes are omitted by Object.getOwnPropertyNames as well.

regressed after #1226