JavaScript Restrictor
Browser extension that improves privacy and security
|
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'] |
Wrappers for arrays from the ECMA standard library.
This wrapper aims on prevention of microarchitectural attacks like Meltdown and Spectre. This code was originally a part of ChromeZero.
subarray()
method always ruturns the full array.The wrappers support the following behaviour:
function constructDecorator | ( | wrapped | ) |
for | ( | ) |
for | ( | let p of | typedTypes | ) |
function getBigIntDecorator | ( | wrapped, | |
doMapping | |||
) |
function getByteDecorator | ( | wrapped, | |
offsetF, | |||
name, | |||
doMapping | |||
) |
function getFloatDecorator | ( | wrapped, | |
name, | |||
doMapping | |||
) |
if | ( | doMapping | ) |
function if | ( | typeof | target = == 'object' && target !== null | ) |
function offsetDecorator | ( | wrapped, | |
type, | |||
proxyRef, | |||
offsetF | |||
) |
function packF32 | ( | v | ) |
function packF64 | ( | v | ) |
function packIEEE754 | ( | v, | |
ebits, | |||
fbits | |||
) |
function redefineDataViewFunctions | ( | target, | |
offsetF, | |||
doMapping | |||
) |
function redefineNewArrayConstructors | ( | target | ) |
function redefineNewArrayFunctions | ( | target, | |
offsetF | |||
) |
function setBigIntDecorator | ( | wrapped, | |
doMapping | |||
) |
function setByteDecorator | ( | wrapped, | |
offsetF, | |||
name, | |||
doMapping | |||
) |
function setFloatDecorator | ( | wrapped, | |
name, | |||
doMapping | |||
) |
function unpackF32 | ( | b | ) |
function unpackF64 | ( | b | ) |
function unpackIEEE754 | ( | bytes, | |
ebits, | |||
fbits | |||
) |
$ {offsetDecorator} |
_data = new originalF(...arguments) |
let DEFAULT_TYPED_ARRAY_WRAPPER |
let j |
var offsetF |
return proxy = new newProxy(_data, ${proxyHandler}) |
var proxyHandler |
Default proxy handler for Typed Arrays.
var typedTypes = ['Uint8Array', 'Int8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array'] |
var wrappers |