Regression in nsIUploadChannel support

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Regression in nsIUploadChannel support

Unread post by thosrtanner » 2019-07-14, 13:46

This used to work but isn't working in 28.6.0.1 - and still works in the current version of basilisk

Code: Select all

var url = "ftp://user:password@localhost/filename";
var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var channel = ioService.newChannelFromURI(url);
channel = channel.QueryInterface(Components.interfaces.nsIUploadChannel);
In basilisk (and older versions of palemoon, though not sure when it stopped working), I get something back. In current palemoon, I get an exception "Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface]" at line 4.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35571
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Regression in nsIUploadChannel support

Unread post by Moonchild » 2019-07-14, 18:47

This is considered trying to use ftp as a subresource to other content. This kind of load is blocked for security reasons.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Re: Regression in nsIUploadChannel support

Unread post by thosrtanner » 2019-07-14, 20:05

That's a blanky peculiar message in that case.

Anyway, as this is completely unrelated to a web page, as it's actually code from a popup window from an extension, completely unrelated to a web page, and is trying to copy a file via ftp (which admittedly has been read into a string as that's how the current code works, and attempting to use a Scriptable Input Stream gets stuck at the subsequent asyncopen on basilisk), is there some other API I can use that would allow me to do this?

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35571
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Regression in nsIUploadChannel support

Unread post by Moonchild » 2019-07-14, 20:32

I'll make it pref-able so those people who need this specific behavior can switch off the blocking.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

New Tobin Paradigm

Re: Regression in nsIUploadChannel support

Unread post by New Tobin Paradigm » 2019-07-14, 20:35

Can you give us more background on what this is used for.. Is it an extension?

thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Re: Regression in nsIUploadChannel support

Unread post by thosrtanner » 2019-07-14, 21:33

New Tobin Paradigm wrote:
2019-07-14, 20:35
Can you give us more background on what this is used for.. Is it an extension?
Yes, it's an extension that gives the option to backup (or load) its settings to an ftp server. Which basically involves copying a file. Incidentally, I'd do asynchronous copying but that's rather hard if the browser is closing down and you want to copy the settings to the server at that point.

The original author had started some code to back up via the sync service but it hadn't got anywhere, and there's absolutely no documentation on how it works (and one of the files in question can be quite large).

thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Re: Regression in nsIUploadChannel support

Unread post by thosrtanner » 2019-07-14, 21:36

Moonchild wrote:
2019-07-14, 20:32
I'll make it pref-able so those people who need this specific behavior can switch off the blocking.
Thanks. Much appreciated.

thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Re: Regression in nsIUploadChannel support

Unread post by thosrtanner » 2019-07-16, 06:22

Small update. I have changed the code to

Code: Select all

const IoService = Components.classes[
  "@mozilla.org/network/io-service;1"].getService(
  Components.interfaces.nsIIOService);

const ScriptSecurityManager = Components.classes[
  "@mozilla.org/scriptsecuritymanager;1"].getService(
  Components.interfaces.nsIScriptSecurityManager);
  
let channel = IoService.newChannelFromURI2(
    this._url,
    null,
    ScriptSecurityManager.getSystemPrincipal(),
    null,
    Components.interfaces.nsILoadInfo.SEC_FORCE_INHERIT_PRINCIPAL,
    Components.interfaces.nsIContentPolicy.TYPE_OTHER);
This works fine with basilisk - which always allowed channel.asyncOpen, but (with the old code, using the deprecated newChannelFromUri) produced the error "Loading FTP subresource within http(s) page not allowed (Blocked loading of: xxxx") when calling channel.open

It doesn't have any effect on palemoon however. It'd be nice if palemoon did the same thing as basilisk as this shouldn't look at all like loading an ftp subresource to an http(s) page.

New Tobin Paradigm

Re: Regression in nsIUploadChannel support

Unread post by New Tobin Paradigm » 2019-07-16, 10:26

It is being explored in more detail.. You don't need to continue harping on it...

thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Re: Regression in nsIUploadChannel support

Unread post by thosrtanner » 2019-07-16, 11:42

not harping on about it, just posting results of some of the things *I've* been doing Also, forgive me, but it wasn't clear from this thread that it was being explored. However, I am grateful that it is.

New Tobin Paradigm

Re: Regression in nsIUploadChannel support

Unread post by New Tobin Paradigm » 2019-07-16, 11:49

Well I don't have to tell you everything. I don't have to tell you anything.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35571
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Regression in nsIUploadChannel support

Unread post by Moonchild » 2019-07-16, 14:15

thosrtanner wrote:
2019-07-16, 11:42
Also, forgive me, but it wasn't clear from this thread that it was being explored.
I'm not sure in what way you could have missed it.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Re: Regression in nsIUploadChannel support

Unread post by thosrtanner » 2019-07-16, 14:50

Because there hadn't been a reply to my reply to Matt Tobin on what it was being used for. Not that I expect instance responses, I hasten to add, but given I'd found this information on experimenting, I hoped it would be useful to add the further detail anyway.

Anyway, I apologise that it came across as harping on about the same thing. That was not the intention at all.

thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Re: Regression in nsIUploadChannel support

Unread post by thosrtanner » 2019-07-27, 06:02

Hi. I've downloaded the latest version of palemoon to see if that fixes my ftp problems.

Sadly it still fails - setting the new preference to true or false has no effect.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35571
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Regression in nsIUploadChannel support

Unread post by Moonchild » 2019-07-27, 09:08

Setting the preference will completely bypass the change so there's literally no reason for it to fail in that situation. Did you try restarting the browser after changing the pref?
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Re: Regression in nsIUploadChannel support

Unread post by thosrtanner » 2019-07-27, 11:59

I didn't but I checked the pref was false and restarted, and it still doesn't work. :-(

thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Re: Regression in nsIUploadChannel support

Unread post by thosrtanner » 2019-07-27, 15:16

*Sigh* this looks like something else is interfering. I created a blank profile and installed and it all worked fine. I have no idea currently what might be causing a conflict at this sort of level.

(a bit later)

Well, it appears fireftp is causing the problem. Not entirely sure why but guesswork that 'if it has ftp in the name it might be related' seems to have paid off.

So this is fixed, and sorry to have sent you off on what appears to have been a wild goose chase.

New Tobin Paradigm

Re: Regression in nsIUploadChannel support

Unread post by New Tobin Paradigm » 2019-07-27, 15:27

It happens.....

thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Re: Regression in nsIUploadChannel support

Unread post by thosrtanner » 2019-07-27, 15:35

Thanks for the fast response and new version anyways.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35571
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Regression in nsIUploadChannel support

Unread post by Moonchild » 2019-07-27, 17:31

thosrtanner wrote:
2019-07-27, 15:16
sorry to have sent you off on what appears to have been a wild goose chase.
No worries.
On the bright side, it resulted in some improvements and more flexibility in Pale Moon for weird corner cases, so there's that!
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Locked