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

Function setGlobalObjectMutableProperties

ses.cjs:5301–5357  ·  view source on GitHub ↗
(
  globalObject,
  {
    intrinsics,
    newGlobalPropertyNames,
    makeCompartmentConstructor,
    markVirtualizedNativeFunction})

Source from the content-addressed store, hash-verified

5299 * @param {(object) => void} param1.markVirtualizedNativeFunction
5300 */$h‍_once.setGlobalObjectConstantProperties(setGlobalObjectConstantProperties);
5301const setGlobalObjectMutableProperties= (
5302 globalObject,
5303 {
5304 intrinsics,
5305 newGlobalPropertyNames,
5306 makeCompartmentConstructor,
5307 markVirtualizedNativeFunction})=>
5308
5309 {
5310 for( const [name, intrinsicName]of entries(universalPropertyNames)) {
5311 if( objectHasOwnProperty(intrinsics, intrinsicName)) {
5312 defineProperty(globalObject, name, {
5313 value: intrinsics[intrinsicName],
5314 writable: true,
5315 enumerable: false,
5316 configurable: true});
5317
5318 }
5319 }
5320
5321 for( const [name, intrinsicName]of entries(newGlobalPropertyNames)) {
5322 if( objectHasOwnProperty(intrinsics, intrinsicName)) {
5323 defineProperty(globalObject, name, {
5324 value: intrinsics[intrinsicName],
5325 writable: true,
5326 enumerable: false,
5327 configurable: true});
5328
5329 }
5330 }
5331
5332 const perCompartmentGlobals= {
5333 globalThis: globalObject};
5334
5335
5336 perCompartmentGlobals.Compartment= freeze(
5337 makeCompartmentConstructor(
5338 makeCompartmentConstructor,
5339 intrinsics,
5340 markVirtualizedNativeFunction));
5341
5342
5343
5344 // TODO These should still be tamed according to the whitelist before
5345 // being made available.
5346 for( const [name, value]of entries(perCompartmentGlobals)) {
5347 defineProperty(globalObject, name, {
5348 value,
5349 writable: true,
5350 enumerable: false,
5351 configurable: true});
5352
5353 if( typeof value=== 'function') {
5354 markVirtualizedNativeFunction(value);
5355 }
5356 }
5357 };
5358

Callers 2

CompartmentFunction · 0.85
repairIntrinsicsFunction · 0.85

Calls 2

definePropertyFunction · 0.85

Tested by

no test coverage detected