Comments (2)
Thanks for reporting. I know what causes the error, but am not yet sure how to fix it. I will send e-mail to es-discuss to discuss the best fix to the problem.
In a nutshell, what happens is the following:
fp.prototype = {} // this triggers the proxy's "set" trap
// since the "set" trap is not defined, the proxy defaults to calling:
Reflect.set(f, 'prototype', {}, fp) // note: the proxy fp itself is being passed as the "receiver" argument to Reflect.set
Inside Reflect.set, a test is made to check whether f === fp
.
If this test is true, Reflect.set tries to update the existing 'prototype' property to the "receiver"
If this test is false, Reflect.set tries to add a new data property to the "receiver"
Since f === fp
will fail, Reflect.set tries to add the data property {value: {}, enumerable:true, writable: true, configurable:true }
to fp
. The proxy in turn forwards this operation and tries to add the property to f
, which fails because f
already defines a property with the same name which is non-configurable, and one cannot change a non-configurable property into a configurable property.
There are a couple of fixes:
-
let the default "set" trap forward the operation as
Reflect.set(f, 'prototype', {}, f)
rather thanReflect.set(f, 'prototype', {}, fp)
-
change the
f === fp
test in Reflect.set to take proxies into account explicitly, and change it to:
(f === fp || fp is a proxy for f)
from harmony-reflect.
The issue has been fixed. See commit notes referenced above.
from harmony-reflect.
Related Issues (20)
- "proxies not supported on this platform" error when multiple packages require harmony-reflect HOT 9
- get handler with Symbol HOT 6
- Reflect.Loader HOT 2
- Incompatible with Edge browser HOT 4
- Extending proxy classes HOT 3
- Cannot properly Proxy 'os' methods HOT 2
- Possible incompatibility gulp/jscs HOT 1
- Provide option to turn off warning "getOwnPropertyNames trap is deprecated. Use ownKeys instead" HOT 6
- harmony-reflect borks node repl
- Error when using Reflect.construct on ES2015 classes
- Calling Object.getOwnPropertySymbols() on a Proxy throws an error HOT 2
- 'Illegal access' error when using Object.assign() HOT 1
- Is there a way to conditionally load harmony-reflect HOT 2
- Question: Does this work with IE11? HOT 2
- Conflict with `reflect-metadata` HOT 6
- What is the actual license of this package? HOT 2
- Reflect.construct incorrectly calls newTarget, causing infinite loops HOT 1
- Is Reflect.set working as intended?
- Index not found HOT 8
- Does this polyfill works for chrome version 38 ? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from harmony-reflect.