Closed Bug 1876731 Opened 2 years ago Closed 2 years ago

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

Categories

(Core :: Networking, defect)

Firefox 122
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: willalwaysdie, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

Steps to reproduce:

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 = "potplayer://" + url;
		if (devMode) console.log(urlFinaly);
		chrome.scripting.executeScript({target: {tabId: tabs[0].id}, func: openUrl, args: [urlFinaly]});
    });
}

in Firefox Console it prints:

potplayer://https://www.youtube.com/watch?v=Qo_cAmJMPx4

but in PotPlayer (a external video player for Windows) I get https// instead of https://:

(see attached screenshot)

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 PotPlayer

How can I fix it for new version of Firefox?

Actual results:

in PotPlayer (a external video player for Windows) I get "https//" instead of "https://"

Expected results:

in PotPlayer (a external video player for Windows) I should get "https://"

Can you use mozregression to get a regression range?

fixed temporary by let urlFinaly = "potplayer://" + url.replace("://", "/://");

actually, not really, it didn't fix it

Flags: needinfo?(willalwaysdie)

new URL("potplayer://https://www.youtube.com").href now produces potplayer://https//www.youtube.com, which is correct according to https://jsdom.github.io/whatwg-url.

Component: Untriaged → Networking
Keywords: regression
Product: Firefox → Core
Regressed by: 1603699

(In reply to Tom Schuster (MoCo) from comment #4)

new URL("potplayer://https://www.youtube.com").href now produces potplayer://https//www.youtube.com, which is correct according to https://jsdom.github.io/whatwg-url.

What does it mean exactly? How can extensions developer pass a normal link from Firefox to external programs installed on windows or Linux?

Flags: needinfo?(willalwaysdie)

The URL you are constructing is semantically incorrect. I don't know what kind URLs "potplayer" accepts, but maybe using potplayer://www.youtube.com/watch?v=Qo_cAmJMPx4 would work instead?

:edgul, since you are the author of the regressor, bug 1603699, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(edgul)

(In reply to Anonym from comment #0)

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

Could you change the code to be:
let urlFinaly = "potplayer:" + url; instead?

That should create a URL that looks like potplayer:https://www.youtube.com/watch?v=Qo_cAmJMPx4 and should work to pass the URL to an external program.

https://jsdom.github.io/whatwg-url/#url=cG90cGxheWVyOmh0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9UW9fY0FtSk1QeDQ=&base=YWJvdXQ6Ymxhbms=

Flags: needinfo?(edgul) → needinfo?(willalwaysdie)

(In reply to Valentin Gosu [:valentin] (he/him) from comment #8)

(In reply to Anonym from comment #0)

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

Could you change the code to be:
let urlFinaly = "potplayer:" + url; instead?

That should create a URL that looks like potplayer:https://www.youtube.com/watch?v=Qo_cAmJMPx4 and should work to pass the URL to an external program.

https://jsdom.github.io/whatwg-url/#url=cG90cGxheWVyOmh0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9UW9fY0FtSk1QeDQ=&base=YWJvdXQ6Ymxhbms=

thanks! it works :)

Flags: needinfo?(willalwaysdie)

Thanks!

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → INVALID
See Also: → 1876729
Duplicate of this bug: 1878295
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: