JavaScript Restrictor
Browser extension that improves privacy and security
Loading...
Searching...
No Matches
wrappingS-ECMA-ARRAY.js File Reference

Wrappers for arrays from the ECMA standard library. More...

Functions

function packIEEE754 (v, ebits, fbits)
 
function unpackIEEE754 (bytes, ebits, fbits)
 
function unpackF64 (b)
 
function packF64 (v)
 
function unpackF32 (b)
 
function packF32 (v)
 
function constructDecorator (wrapped)
 
function offsetDecorator (wrapped, type, proxyRef, offsetF)
 
function redefineNewArrayFunctions (target, offsetF)
 
function redefineNewArrayConstructors (target)
 
function getByteDecorator (wrapped, offsetF, name, doMapping)
 
function setByteDecorator (wrapped, offsetF, name, doMapping)
 
function getFloatDecorator (wrapped, name, doMapping)
 
function setFloatDecorator (wrapped, name, doMapping)
 
function getBigIntDecorator (wrapped, doMapping)
 
function setBigIntDecorator (wrapped, doMapping)
 
function redefineDataViewFunctions (target, offsetF, doMapping)
 
function if (typeof target==='object' &&target !==null)
 
 if (doMapping)
 
 for (let i=0;i< _data['length'];i++)
 
 for (let p of typedTypes)
 

Variables

var proxyHandler
 Default proxy handler for Typed Arrays.
 
 _data = new originalF(...arguments)
 
var offsetF
 
var proxy = new newProxy(_data, ${proxyHandler})
 
 $ {offsetDecorator}
 
let j
 
var wrappers
 
let DEFAULT_TYPED_ARRAY_WRAPPER
 
var typedTypes = ['Uint8Array', 'Int8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array']
 

Detailed Description

Wrappers for arrays from the ECMA standard library.

Author
Copyright (C) 2020 Peter Hornak
License:
SPDX-License-Identifier: GPL-3.0-or-later

This wrapper aims on prevention of microarchitectural attacks like Meltdown and Spectre. This code was originally a part of ChromeZero.

Bug:
The subarray() method always ruturns the full array.

The wrappers support the following behaviour:

  • Offset: The content of the buffer is shifted by a fix offset. This is a faster method but can be removed.
  • Random mapping: All items are mapped randomly. This is a slower method but more reliable.
See also
https://www.fit.vut.cz/study/thesis/22374/?year=0&sup=Pol%C4%8D%C3%A1k, especially Sect. 5.1

Function Documentation

◆ constructDecorator()

function constructDecorator (   wrapped)
Here is the caller graph for this function:

◆ for() [1/2]

for ( )

◆ for() [2/2]

for ( let p of  typedTypes)

◆ getBigIntDecorator()

function getBigIntDecorator (   wrapped,
  doMapping 
)
Here is the caller graph for this function:

◆ getByteDecorator()

function getByteDecorator (   wrapped,
  offsetF,
  name,
  doMapping 
)
Here is the caller graph for this function:

◆ getFloatDecorator()

function getFloatDecorator (   wrapped,
  name,
  doMapping 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ if() [1/2]

if (   doMapping)

◆ if() [2/2]

function if ( typeof  target = == 'object' && target !== null)

◆ offsetDecorator()

function offsetDecorator (   wrapped,
  type,
  proxyRef,
  offsetF 
)
Here is the caller graph for this function:

◆ packF32()

function packF32 (   v)
See also
Function was adopted from https://github.com/inexorabletash/polyfill/blob/master/typedarray.js under MIT licence.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ packF64()

function packF64 (   v)
See also
Function was adopted from https://github.com/inexorabletash/polyfill/blob/master/typedarray.js under MIT licence.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ packIEEE754()

function packIEEE754 (   v,
  ebits,
  fbits 
)
See also
This function was adopted from https://github.com/inexorabletash/polyfill/blob/master/typedarray.js under MIT licence.
Here is the caller graph for this function:

◆ redefineDataViewFunctions()

function redefineDataViewFunctions (   target,
  offsetF,
  doMapping 
)
Here is the call graph for this function:

◆ redefineNewArrayConstructors()

function redefineNewArrayConstructors (   target)
Here is the call graph for this function:

◆ redefineNewArrayFunctions()

function redefineNewArrayFunctions (   target,
  offsetF 
)
Here is the call graph for this function:

◆ setBigIntDecorator()

function setBigIntDecorator (   wrapped,
  doMapping 
)
Here is the caller graph for this function:

◆ setByteDecorator()

function setByteDecorator (   wrapped,
  offsetF,
  name,
  doMapping 
)
Here is the caller graph for this function:

◆ setFloatDecorator()

function setFloatDecorator (   wrapped,
  name,
  doMapping 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unpackF32()

function unpackF32 (   b)
See also
Function was adopted from https://github.com/inexorabletash/polyfill/blob/master/typedarray.js under MIT licence.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unpackF64()

function unpackF64 (   b)
See also
Function was adopted from https://github.com/inexorabletash/polyfill/blob/master/typedarray.js under MIT licence.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unpackIEEE754()

function unpackIEEE754 (   bytes,
  ebits,
  fbits 
)
See also
This function was adopted from https://github.com/inexorabletash/polyfill/blob/master/typedarray.js under MIT licence.
Here is the caller graph for this function:

Variable Documentation

◆ $

◆ _data

_data = new originalF(...arguments)

◆ DEFAULT_TYPED_ARRAY_WRAPPER

let DEFAULT_TYPED_ARRAY_WRAPPER

◆ j

let j

◆ offsetF

var offsetF
Initial value:
= function(x) {
return x;
}

◆ proxy

return proxy = new newProxy(_data, ${proxyHandler})

◆ proxyHandler

var proxyHandler
Initial value:
= `{
get(target, key, receiver) {
var random_idx = Math.floor(Math.random() * target['length']);
var rand_val = target[random_idx];
if (typeof key !== 'symbol' && Number(key) >= 0 && Number(key) < target.length) {
}
let value = target[key]
return typeof value == 'function' ? value.bind(target) : value;
},
set(target, key, value) {
var random_idx = Math.floor(Math.random() * (target['length']));
var rand_val = target[random_idx];
rand_val = rand_val;
if (typeof key !== 'symbol' && Number(key) >= 0 && Number(key) < target.length) {
}
return target[key] = value;
}
}`
domainEl value
Definition options_domains.js:214
let key
Definition popup.js:324
var offsetF
Definition wrappingS-ECMA-ARRAY.js:538

Default proxy handler for Typed Arrays.

◆ typedTypes

var typedTypes = ['Uint8Array', 'Int8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array']

◆ wrappers

var wrappers