Skip to content

Commit

Permalink
fix: 'set on proxy' error
Browse files Browse the repository at this point in the history
* 1. if object extends another object from contextified code, uncorrect proxy setter make it not settable
* 2. this fix just change the proxy setter in contextify
* 3. detail patriksimek#101 (comment)
  • Loading branch information
zuhan.czh committed Sep 10, 2018
1 parent 5e5009a commit edba087
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions lib/contextify.js
@@ -1,4 +1,5 @@
'use strict'
'
jse strict'

const global = this;
const console = host.console;
Expand All @@ -17,7 +18,23 @@ const DEBUG = false;
const OPNA = 'Operation not allowed on contextified object.';
const ERROR_CST = Error.captureStackTrace;
const FROZEN_TRAPS = {
set: (target, key) => false,
set: (target, key, value, receiver) => {
if( target !== receiver ){

Object.defineProperty(receiver, key, {
value: value,
writable: true,
enumerable: true,
configurable: true
})

return true;

}

return false;

},
setPrototypeOf: (target, key) => false,
defineProperty: (target, key) => false,
deleteProperty: (target, key) => false,
Expand Down

0 comments on commit edba087

Please sign in to comment.