Search code examples
firefoxgoogle-chrome-extensionfirefox-addonchrome-extension-manifest-v3

Firefox 122.0. Extensions. "chrome.scripting.executeScript" removes ":" (colon) from url when using in double with protocol url


The following code for Firefox extensions (addons) was working fine on Firefox until 122.0 version:

background.js:

function openUrl(url) {
    window.open(url, '_self');
}

function play(url) {
    chrome.tabs.query( {currentWindow: true, active : true}, function(tabs) {
        let urlFinaly = "steam://" + url;
        if (devMode) console.log(urlFinaly);
        chrome.scripting.executeScript({target: {tabId: tabs[0].id}, func: openUrl, args: [urlFinaly]});
    });
}

in Firefox Console it prints:

steam://https://www.example.com

but in Windows program I get https// instead of https://:

https//www.example.com

For Firefox 121.* and earlier it works fine, and also it works fine for newest Google Chrome browser - the link can be successfully passed correctly to the program like

How can I fix it for new version of Firefox?


Solution

  • Received an answer from Bugzilla:

    Change the code to be:

    let urlFinal = "steam:" + url;
    

    That should create a URL that looks like steam:https://www.example.com and should work to pass the URL to an external program.

    Now it works

    UPDATED: the same behavior will on all other browsers: https://bugs.chromium.org/p/chromium/issues/detail?id=1416006