You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Sadly I can't reproduce the issue in minimal way but the behavior I'm experiencing in edge 44 is that a function prototype is being changed without any triggers from my side.
This is the basic idea of the broken setup.
I have a factory of functions:
functioncreate(value,obj){
...
functioninner(){ ... }obj.someField=value/* override function prototype */Object.setPrototypeOf(inner,obj)returninner}
The factory is used to create function instances
// usage of the factoryconstf1=create('1',{$: true})constf2=create('2',{$: true})// this will be the test subject
Then, later on in code, f2 is being passed as an argument to another function. Here's a simplified version of that one:
functiontest(fn/* passing f2 */){console.log(fn.someField)// logs 2constvalues=['someField'].map((key)=>fn[key])// something went wrong hereconsole.log(fn.someField)// logs 1, should log 2}
It appears the second .someField lookup (inside the second console.log) gets the prototype of f1 instead of f2. Behavior suggests this is a JS engine caching issue for prototype lookup.
Same code functions properly in Chrome/FF.
I have managed to work around the issue by setting a property on the function itself:
functioncreate(value,obj){
...
functioninner(){ ... }obj.someField=value/* override function prototype */Object.setPrototypeOf(inner,obj)inner.workAround=Math.random()returninner}
Hi,
Sadly I can't reproduce the issue in minimal way but the behavior I'm experiencing in edge 44 is that a function prototype is being changed without any triggers from my side.
This is the basic idea of the broken setup.
I have a factory of functions:
The factory is used to create function instances
Then, later on in code,
f2
is being passed as an argument to another function. Here's a simplified version of that one:It appears the second
.someField
lookup (inside the secondconsole.log
) gets the prototype off1
instead off2
. Behavior suggests this is a JS engine caching issue for prototype lookup.Same code functions properly in Chrome/FF.
I have managed to work around the issue by setting a property on the function itself:
maybe related to #5915
The text was updated successfully, but these errors were encountered: