tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

profiler_get_symbols.js (18666B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 //
      6 // THIS FILE IS AUTOGENERATED by wasm-bindgen.
      7 //
      8 // Generated from:
      9 // https://github.com/mstange/profiler-get-symbols/commit/390b8c4be82c720dd3977ff205fb34bd7d0e00ba
     10 // by following the instructions in that repository's Readme.md
     11 //
     12 
     13 let wasm_bindgen;
     14 (function() {
     15    const __exports = {};
     16    let script_src;
     17    if (typeof document !== 'undefined' && document.currentScript !== null) {
     18        script_src = new URL(document.currentScript.src, location.href).toString();
     19    }
     20    let wasm = undefined;
     21 
     22    const heap = new Array(128).fill(undefined);
     23 
     24    heap.push(undefined, null, true, false);
     25 
     26 function getObject(idx) { return heap[idx]; }
     27 
     28 let WASM_VECTOR_LEN = 0;
     29 
     30 let cachedUint8Memory0 = null;
     31 
     32 function getUint8Memory0() {
     33    if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
     34        cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
     35    }
     36    return cachedUint8Memory0;
     37 }
     38 
     39 const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
     40 
     41 const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
     42    ? function (arg, view) {
     43    return cachedTextEncoder.encodeInto(arg, view);
     44 }
     45    : function (arg, view) {
     46    const buf = cachedTextEncoder.encode(arg);
     47    view.set(buf);
     48    return {
     49        read: arg.length,
     50        written: buf.length
     51    };
     52 });
     53 
     54 function passStringToWasm0(arg, malloc, realloc) {
     55 
     56    if (realloc === undefined) {
     57        const buf = cachedTextEncoder.encode(arg);
     58        const ptr = malloc(buf.length, 1) >>> 0;
     59        getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
     60        WASM_VECTOR_LEN = buf.length;
     61        return ptr;
     62    }
     63 
     64    let len = arg.length;
     65    let ptr = malloc(len, 1) >>> 0;
     66 
     67    const mem = getUint8Memory0();
     68 
     69    let offset = 0;
     70 
     71    for (; offset < len; offset++) {
     72        const code = arg.charCodeAt(offset);
     73        if (code > 0x7F) break;
     74        mem[ptr + offset] = code;
     75    }
     76 
     77    if (offset !== len) {
     78        if (offset !== 0) {
     79            arg = arg.slice(offset);
     80        }
     81        ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
     82        const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
     83        const ret = encodeString(arg, view);
     84 
     85        offset += ret.written;
     86        ptr = realloc(ptr, len, offset, 1) >>> 0;
     87    }
     88 
     89    WASM_VECTOR_LEN = offset;
     90    return ptr;
     91 }
     92 
     93 function isLikeNone(x) {
     94    return x === undefined || x === null;
     95 }
     96 
     97 let cachedInt32Memory0 = null;
     98 
     99 function getInt32Memory0() {
    100    if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
    101        cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
    102    }
    103    return cachedInt32Memory0;
    104 }
    105 
    106 let heap_next = heap.length;
    107 
    108 function dropObject(idx) {
    109    if (idx < 132) return;
    110    heap[idx] = heap_next;
    111    heap_next = idx;
    112 }
    113 
    114 function takeObject(idx) {
    115    const ret = getObject(idx);
    116    dropObject(idx);
    117    return ret;
    118 }
    119 
    120 function addHeapObject(obj) {
    121    if (heap_next === heap.length) heap.push(heap.length + 1);
    122    const idx = heap_next;
    123    heap_next = heap[idx];
    124 
    125    heap[idx] = obj;
    126    return idx;
    127 }
    128 
    129 const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
    130 
    131 if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
    132 
    133 function getStringFromWasm0(ptr, len) {
    134    ptr = ptr >>> 0;
    135    return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
    136 }
    137 
    138 const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
    139    ? { register: () => {}, unregister: () => {} }
    140    : new FinalizationRegistry(state => {
    141    wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b)
    142 });
    143 
    144 function makeMutClosure(arg0, arg1, dtor, f) {
    145    const state = { a: arg0, b: arg1, cnt: 1, dtor };
    146    const real = (...args) => {
    147        // First up with a closure we increment the internal reference
    148        // count. This ensures that the Rust closure environment won't
    149        // be deallocated while we're invoking it.
    150        state.cnt++;
    151        const a = state.a;
    152        state.a = 0;
    153        try {
    154            return f(a, state.b, ...args);
    155        } finally {
    156            if (--state.cnt === 0) {
    157                wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
    158                CLOSURE_DTORS.unregister(state);
    159            } else {
    160                state.a = a;
    161            }
    162        }
    163    };
    164    real.original = state;
    165    CLOSURE_DTORS.register(real, state, state);
    166    return real;
    167 }
    168 function __wbg_adapter_20(arg0, arg1, arg2) {
    169    wasm.wasm_bindgen__convert__closures__invoke1_mut__h5c75a368331e2dfc(arg0, arg1, addHeapObject(arg2));
    170 }
    171 
    172 function handleError(f, args) {
    173    try {
    174        return f.apply(this, args);
    175    } catch (e) {
    176        wasm.__wbindgen_exn_store(addHeapObject(e));
    177    }
    178 }
    179 function __wbg_adapter_41(arg0, arg1, arg2, arg3) {
    180    wasm.wasm_bindgen__convert__closures__invoke2_mut__hb4d9edc8ea00b6ab(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
    181 }
    182 
    183 /**
    184 * Usage:
    185 *
    186 * ```js
    187 * async function getSymbolTable(debugName, breakpadId, libKeyToPathMap) {
    188 *   const helper = {
    189 *     getCandidatePathsForDebugFile: (info) => {
    190 *       const path = libKeyToPathMap.get(`${info.debugName}/${info.breakpadId}`);
    191 *       if (path !== undefined) {
    192 *         return [path];
    193 *       }
    194 *       return [];
    195 *     },
    196 *     getCandidatePathsForBinary: (info) => [],
    197 *     readFile: async (filename) => {
    198 *       const byteLength = await getFileSizeInBytes(filename);
    199 *       const fileHandle = getFileHandle(filename);
    200 *       return {
    201 *         size: byteLength,
    202 *         readBytesInto: (array, offset) => {
    203 *           syncReadFilePartIntoBuffer(fileHandle, array, offset);
    204 *         },
    205 *         close: () => {},
    206 *       };
    207 *     },
    208 *   };
    209 *
    210 *   const [addr, index, buffer] = await getCompactSymbolTable(debugName, breakpadId, helper);
    211 *   return [addr, index, buffer];
    212 * }
    213 * ```
    214 * @param {string} debug_name
    215 * @param {string} breakpad_id
    216 * @param {any} helper
    217 * @returns {Promise<any>}
    218 */
    219 __exports.getCompactSymbolTable = function(debug_name, breakpad_id, helper) {
    220    const ptr0 = passStringToWasm0(debug_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    221    const len0 = WASM_VECTOR_LEN;
    222    const ptr1 = passStringToWasm0(breakpad_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    223    const len1 = WASM_VECTOR_LEN;
    224    const ret = wasm.getCompactSymbolTable(ptr0, len0, ptr1, len1, addHeapObject(helper));
    225    return takeObject(ret);
    226 };
    227 
    228 /**
    229 * Usage:
    230 *
    231 * ```js
    232 * async function queryAPIWrapper(url, requestJSONString, libKeyToPathMap) {
    233 *   const helper = {
    234 *     getCandidatePathsForDebugFile: (info) => {
    235 *       const path = libKeyToPathMap.get(`${info.debugName}/${info.breakpadId}`);
    236 *       if (path !== undefined) {
    237 *         return [path];
    238 *       }
    239 *       return [];
    240 *     },
    241 *     getCandidatePathsForBinary: (info) => [],
    242 *     readFile: async (filename) => {
    243 *       const byteLength = await getFileSizeInBytes(filename);
    244 *       const fileHandle = getFileHandle(filename);
    245 *       return {
    246 *         size: byteLength,
    247 *         readBytesInto: (array, offset) => {
    248 *           syncReadFilePartIntoBuffer(fileHandle, array, offset);
    249 *         },
    250 *         close: () => {},
    251 *       };
    252 *     },
    253 *   };
    254 *
    255 *   const responseJSONString = await queryAPI(url, requestJSONString, helper);
    256 *   return responseJSONString;
    257 * }
    258 * ```
    259 * @param {string} url
    260 * @param {string} request_json
    261 * @param {any} helper
    262 * @returns {Promise<any>}
    263 */
    264 __exports.queryAPI = function(url, request_json, helper) {
    265    const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    266    const len0 = WASM_VECTOR_LEN;
    267    const ptr1 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    268    const len1 = WASM_VECTOR_LEN;
    269    const ret = wasm.queryAPI(ptr0, len0, ptr1, len1, addHeapObject(helper));
    270    return takeObject(ret);
    271 };
    272 
    273 async function __wbg_load(module, imports) {
    274    if (typeof Response === 'function' && module instanceof Response) {
    275        if (typeof WebAssembly.instantiateStreaming === 'function') {
    276            try {
    277                return await WebAssembly.instantiateStreaming(module, imports);
    278 
    279            } catch (e) {
    280                if (module.headers.get('Content-Type') != 'application/wasm') {
    281                    console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
    282 
    283                } else {
    284                    throw e;
    285                }
    286            }
    287        }
    288 
    289        const bytes = await module.arrayBuffer();
    290        return await WebAssembly.instantiate(bytes, imports);
    291 
    292    } else {
    293        const instance = await WebAssembly.instantiate(module, imports);
    294 
    295        if (instance instanceof WebAssembly.Instance) {
    296            return { instance, module };
    297 
    298        } else {
    299            return instance;
    300        }
    301    }
    302 }
    303 
    304 function __wbg_get_imports() {
    305    const imports = {};
    306    imports.wbg = {};
    307    imports.wbg.__wbg_get_0ee8ea3c7c984c45 = function(arg0, arg1) {
    308        const ret = getObject(arg0)[arg1 >>> 0];
    309        return addHeapObject(ret);
    310    };
    311    imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
    312        const obj = getObject(arg1);
    313        const ret = typeof(obj) === 'string' ? obj : undefined;
    314        var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    315        var len1 = WASM_VECTOR_LEN;
    316        getInt32Memory0()[arg0 / 4 + 1] = len1;
    317        getInt32Memory0()[arg0 / 4 + 0] = ptr1;
    318    };
    319    imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
    320        takeObject(arg0);
    321    };
    322    imports.wbg.__wbg_self_05040bd9523805b9 = function() { return handleError(function () {
    323        const ret = self.self;
    324        return addHeapObject(ret);
    325    }, arguments) };
    326    imports.wbg.__wbg_window_adc720039f2cb14f = function() { return handleError(function () {
    327        const ret = window.window;
    328        return addHeapObject(ret);
    329    }, arguments) };
    330    imports.wbg.__wbg_globalThis_622105db80c1457d = function() { return handleError(function () {
    331        const ret = globalThis.globalThis;
    332        return addHeapObject(ret);
    333    }, arguments) };
    334    imports.wbg.__wbg_global_f56b013ed9bcf359 = function() { return handleError(function () {
    335        const ret = global.global;
    336        return addHeapObject(ret);
    337    }, arguments) };
    338    imports.wbg.__wbindgen_is_undefined = function(arg0) {
    339        const ret = getObject(arg0) === undefined;
    340        return ret;
    341    };
    342    imports.wbg.__wbg_newnoargs_cfecb3965268594c = function(arg0, arg1) {
    343        const ret = new Function(getStringFromWasm0(arg0, arg1));
    344        return addHeapObject(ret);
    345    };
    346    imports.wbg.__wbg_call_3f093dd26d5569f8 = function() { return handleError(function (arg0, arg1) {
    347        const ret = getObject(arg0).call(getObject(arg1));
    348        return addHeapObject(ret);
    349    }, arguments) };
    350    imports.wbg.__wbindgen_memory = function() {
    351        const ret = wasm.memory;
    352        return addHeapObject(ret);
    353    };
    354    imports.wbg.__wbg_buffer_b914fb8b50ebbc3e = function(arg0) {
    355        const ret = getObject(arg0).buffer;
    356        return addHeapObject(ret);
    357    };
    358    imports.wbg.__wbg_newwithbyteoffsetandlength_7f2d9491ea8c746e = function(arg0, arg1, arg2) {
    359        const ret = new Uint32Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
    360        return addHeapObject(ret);
    361    };
    362    imports.wbg.__wbg_new_437b9c4fbab85dd9 = function(arg0) {
    363        const ret = new Uint32Array(getObject(arg0));
    364        return addHeapObject(ret);
    365    };
    366    imports.wbg.__wbg_newwithbyteoffsetandlength_0de9ee56e9f6ee6e = function(arg0, arg1, arg2) {
    367        const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
    368        return addHeapObject(ret);
    369    };
    370    imports.wbg.__wbg_new_b1f2d6842d615181 = function(arg0) {
    371        const ret = new Uint8Array(getObject(arg0));
    372        return addHeapObject(ret);
    373    };
    374    imports.wbg.__wbg_of_94ac9e20a3c46ec5 = function(arg0, arg1, arg2) {
    375        const ret = Array.of(getObject(arg0), getObject(arg1), getObject(arg2));
    376        return addHeapObject(ret);
    377    };
    378    imports.wbg.__wbg_call_67f2111acd2dfdb6 = function() { return handleError(function (arg0, arg1, arg2) {
    379        const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
    380        return addHeapObject(ret);
    381    }, arguments) };
    382    imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
    383        const ret = getObject(arg0);
    384        return addHeapObject(ret);
    385    };
    386    imports.wbg.__wbg_getCandidatePathsForDebugFile_19de1ea293153630 = function() { return handleError(function (arg0, arg1) {
    387        const ret = getObject(arg0).getCandidatePathsForDebugFile(takeObject(arg1));
    388        return addHeapObject(ret);
    389    }, arguments) };
    390    imports.wbg.__wbg_name_405bb0aa047a1bf5 = function(arg0) {
    391        const ret = getObject(arg0).name;
    392        return addHeapObject(ret);
    393    };
    394    imports.wbg.__wbg_message_2a19bb5b62cf8e22 = function(arg0) {
    395        const ret = getObject(arg0).message;
    396        return addHeapObject(ret);
    397    };
    398    imports.wbg.__wbg_from_58c79ccfb68060f5 = function(arg0) {
    399        const ret = Array.from(getObject(arg0));
    400        return addHeapObject(ret);
    401    };
    402    imports.wbg.__wbg_length_161c0d89c6535c1d = function(arg0) {
    403        const ret = getObject(arg0).length;
    404        return ret;
    405    };
    406    imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
    407        const ret = getStringFromWasm0(arg0, arg1);
    408        return addHeapObject(ret);
    409    };
    410    imports.wbg.__wbg_getCandidatePathsForBinary_8311cb7aeae90263 = function() { return handleError(function (arg0, arg1) {
    411        const ret = getObject(arg0).getCandidatePathsForBinary(takeObject(arg1));
    412        return addHeapObject(ret);
    413    }, arguments) };
    414    imports.wbg.__wbindgen_cb_drop = function(arg0) {
    415        const obj = takeObject(arg0).original;
    416        if (obj.cnt-- == 1) {
    417            obj.a = 0;
    418            return true;
    419        }
    420        const ret = false;
    421        return ret;
    422    };
    423    imports.wbg.__wbg_new_632630b5cec17f21 = function() {
    424        const ret = new Object();
    425        return addHeapObject(ret);
    426    };
    427    imports.wbg.__wbg_set_9182712abebf82ef = function(arg0, arg1, arg2) {
    428        getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
    429    };
    430    imports.wbg.__wbg_close_0c320371e818efa4 = function() { return handleError(function (arg0) {
    431        getObject(arg0).close();
    432    }, arguments) };
    433    imports.wbg.__wbg_readBytesInto_8dda8e37c69f2cbd = function() { return handleError(function (arg0, arg1, arg2) {
    434        getObject(arg0).readBytesInto(takeObject(arg1), arg2);
    435    }, arguments) };
    436    imports.wbg.__wbg_readFile_33b95391c6839d48 = function(arg0, arg1, arg2) {
    437        const ret = getObject(arg0).readFile(getStringFromWasm0(arg1, arg2));
    438        return addHeapObject(ret);
    439    };
    440    imports.wbg.__wbg_then_20a5920e447d1cb1 = function(arg0, arg1, arg2) {
    441        const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
    442        return addHeapObject(ret);
    443    };
    444    imports.wbg.__wbg_size_45521802c91634d3 = function() { return handleError(function (arg0) {
    445        const ret = getObject(arg0).size;
    446        return ret;
    447    }, arguments) };
    448    imports.wbg.__wbg_new_70828a4353259d4b = function(arg0, arg1) {
    449        try {
    450            var state0 = {a: arg0, b: arg1};
    451            var cb0 = (arg0, arg1) => {
    452                const a = state0.a;
    453                state0.a = 0;
    454                try {
    455                    return __wbg_adapter_41(a, state0.b, arg0, arg1);
    456                } finally {
    457                    state0.a = a;
    458                }
    459            };
    460            const ret = new Promise(cb0);
    461            return addHeapObject(ret);
    462        } finally {
    463            state0.a = state0.b = 0;
    464        }
    465    };
    466    imports.wbg.__wbindgen_throw = function(arg0, arg1) {
    467        throw new Error(getStringFromWasm0(arg0, arg1));
    468    };
    469    imports.wbg.__wbg_then_f9e58f5a50f43eae = function(arg0, arg1) {
    470        const ret = getObject(arg0).then(getObject(arg1));
    471        return addHeapObject(ret);
    472    };
    473    imports.wbg.__wbg_queueMicrotask_f61ee94ee663068b = function(arg0) {
    474        queueMicrotask(getObject(arg0));
    475    };
    476    imports.wbg.__wbg_queueMicrotask_f82fc5d1e8f816ae = function(arg0) {
    477        const ret = getObject(arg0).queueMicrotask;
    478        return addHeapObject(ret);
    479    };
    480    imports.wbg.__wbindgen_is_function = function(arg0) {
    481        const ret = typeof(getObject(arg0)) === 'function';
    482        return ret;
    483    };
    484    imports.wbg.__wbg_resolve_5da6faf2c96fd1d5 = function(arg0) {
    485        const ret = Promise.resolve(getObject(arg0));
    486        return addHeapObject(ret);
    487    };
    488    imports.wbg.__wbindgen_closure_wrapper2106 = function(arg0, arg1, arg2) {
    489        const ret = makeMutClosure(arg0, arg1, 159, __wbg_adapter_20);
    490        return addHeapObject(ret);
    491    };
    492 
    493    return imports;
    494 }
    495 
    496 function __wbg_init_memory(imports, maybe_memory) {
    497 
    498 }
    499 
    500 function __wbg_finalize_init(instance, module) {
    501    wasm = instance.exports;
    502    __wbg_init.__wbindgen_wasm_module = module;
    503    cachedInt32Memory0 = null;
    504    cachedUint8Memory0 = null;
    505 
    506 
    507    return wasm;
    508 }
    509 
    510 function initSync(module) {
    511    if (wasm !== undefined) return wasm;
    512 
    513    const imports = __wbg_get_imports();
    514 
    515    __wbg_init_memory(imports);
    516 
    517    if (!(module instanceof WebAssembly.Module)) {
    518        module = new WebAssembly.Module(module);
    519    }
    520 
    521    const instance = new WebAssembly.Instance(module, imports);
    522 
    523    return __wbg_finalize_init(instance, module);
    524 }
    525 
    526 async function __wbg_init(input) {
    527    if (wasm !== undefined) return wasm;
    528 
    529    if (typeof input === 'undefined' && typeof script_src !== 'undefined') {
    530        input = script_src.replace(/\.js$/, '_bg.wasm');
    531    }
    532    const imports = __wbg_get_imports();
    533 
    534    if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
    535        input = fetch(input);
    536    }
    537 
    538    __wbg_init_memory(imports);
    539 
    540    const { instance, module } = await __wbg_load(await input, imports);
    541 
    542    return __wbg_finalize_init(instance, module);
    543 }
    544 
    545 wasm_bindgen = Object.assign(__wbg_init, { initSync }, __exports);
    546 
    547 })();