Photoshop UXP leaks a global variable `index` overwriting any existing value with an integer

The error is in UXP/common.js, line 26:

function _internalCreateJSArguments(theArgs, fixedArgCount) {
    let jsArgs = [];
    let varArgCount = theArgs.length - fixedArgCount;
    for (index = 0; index < varArgCount; ++index) { // `let` before `index` is missing
        jsArgs.push(theArgs[index + fixedArgCount]);
    }
    return jsArgs;
}

It’s probably causing little trouble in most cases. But Svelte 5 exports index function when each block is used, and a call to core.executeAsModule breaks it.

1 Like

Thanks, I’ll log it.

You should the fix in the next Beta and then in 26.1.

Also, we found and fixed another global in the same file.

3 Likes