MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / defineProperty

Function defineProperty

ses.cjs:97–116  ·  view source on GitHub ↗
(object, prop, descriptor)

Source from the content-addressed store, hash-verified

95$h‍_once.stringifyJson(stringifyJson);const{defineProperty:originalDefineProperty}=Object;
96
97const defineProperty= (object, prop, descriptor)=> {
98 // We used to do the following, until we had to reopen Safari bug
99 // https://bugs.webkit.org/show_bug.cgi?id=222538#c17
100 // Once this is fixed, we may restore it.
101 // // Object.defineProperty is allowed to fail silently so we use
102 // // Object.defineProperties instead.
103 // return defineProperties(object, { [prop]: descriptor });
104
105 // Instead, to workaround the Safari bug
106 const result= originalDefineProperty(object, prop, descriptor);
107 if( result!== object) {
108 // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_DEFINE_PROPERTY_FAILED_SILENTLY.md
109 throw TypeError(
110 `Please report that the original defineProperty silently failed to set ${stringifyJson(
111 String(prop))
112 }. (SES_DEFINE_PROPERTY_FAILED_SILENTLY)`);
113
114 }
115 return result;
116 };$h‍_once.defineProperty(defineProperty);
117
118const {
119 apply,

Callers 15

freezeTypedArrayFunction · 0.85
initPropertyFunction · 0.85
[ prop]Function · 0.85
enableFunction · 0.85
tameLocaleMethodsFunction · 0.85
tameFunctionToStringFunction · 0.85
tameDomainsFunction · 0.85
makeLoggingConsoleKitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected