Skip to content

Releases: MindFoundry/mf-opencv-fork

1.0.1

25 Jul 09:04
Compare
Choose a tag to compare

Added README and cleaned up commit history

1.0.0

24 Jul 14:09
Compare
Choose a tag to compare

This is a fork of https://github.com/TechStark/opencv-js and was done so as the opencv.js file had a function in the original code that caused an inline-unsafe-eval csp error to be triggered.

In the opencv.js file this function:

function createNamedFunction(name, body) {
   name = makeLegalFunctionName(name);
   return new Function("body","return function " + name + "() {\n" + '    "use strict";' + "    return body.apply(this, arguments);\n" + "};\n")(body)
}

was changed to:

function createNamedFunction(name, body) {
    name = makeLegalFunctionName(name);

    // Create the function string without using the Function constructor
    const func = function() {
        "use strict";
        return body.apply(this, arguments);
    };

    // Attach the name to the function for debugging purposes
    Object.defineProperty(func, 'name', { value: name, writable: false });

    return func;
}

function makeLegalFunctionName(name) {
    // Replace any characters that are not legal in function names
    return name.replace(/[^a-zA-Z0-9_$]/g, '_');
}

The opencv.js file has also been minimised