Error with Intl.DateTimeFormat on updating to 32.3.0

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

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

Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by thosrtanner » 2023-07-12, 08:06

This error is happening in one of my extensions, so obviously I'm investigating this myself, but I've started getting:

Code: Select all

Exception { message: "Could not convert Native argument a…", result: 2153185290, name: "NS_ERROR_XPC_BAD_CONVERT_NATIVE", filename: "jar:file:///C:/Program%20Files/Pale…", lineNumber: 364, columnNumber: 0, data: null, stack: "openModalWindow@jar:file:///C:/Prog…", location: XPCWrappedNative_NoHelper } for Error: No such property on self-hosted object: "get format"
All of which is inside palemoon somewhere. Clicking on the exception fortunately gives something slightly more helpful for the filename "jar:file:///C:/Program%20Files/Pale%20Moon/palemoon.res!/components/nsPrompter.js"

The code calling this is

Code: Select all

function format_as_hh_mm_ss(date)
{
  return As_HH_MM_SS.format(date);
}
where As_HH_MM_SS is defined as

Code: Select all

const As_HH_MM_SS = new Intl.DateTimeFormat(
  [],
  { hour: "numeric", minute: "numeric", second: "numeric", hour12: false }
);
and that is being called as:

Code: Select all

format_as_hh_mm_ss(new Date())
Of course, it works absolutely fine if I run it from the scratchpad, whereas this code is in modules in my extension

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

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by Moonchild » 2023-07-12, 10:20

Can you provide more code context where you're using the function, please?

It may be a quirk of toolkit code that needs additional changes for handling the updated Intl code results. (nsprompter points to that possibility)
"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

User avatar
Martok
Contributing developer
Contributing developer
Posts: 5
Joined: 2019-08-29, 00:46

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by Martok » 2023-07-12, 12:42

If you can boil this down to a small repro addon, I can have a look...

Looks pretty similar to https://bugzilla.mozilla.org/show_bug.cgi?id=1546232, but I need a test case.
"For more information please reread."

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

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by thosrtanner » 2023-07-12, 15:56

Well, not small, but the code is here: https://github.com/ThosRTanner/inforss

This is generating a toast from here: https://github.com/ThosRTanner/inforss/ ... #L568-L577

I will see if I can reduce this somewhat, but it might help point to the problem while I work out how to convert that to a minimal example

User avatar
Martok
Contributing developer
Contributing developer
Posts: 5
Joined: 2019-08-29, 00:46

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by Martok » 2023-07-12, 17:17

thosrtanner wrote:
2023-07-12, 15:56
Well, not small, but the code is here: https://github.com/ThosRTanner/inforss
Ah, neat.

If you can write down some steps to reproduce from a fresh install, I'm happy with that too. If it really was that bug, the fix is simple but apparently that code path is not used very often so I can't tell...
"For more information please reread."

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

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by thosrtanner » 2023-07-12, 19:27

It's not just me apparently. I've just seen these come up in my console:

Code: Select all

Error: No such property on self-hosted object: "get format" 
DownloadUtils.jsm:501:16
	DU_convertByteUnits resource://gre/modules/DownloadUtils.jsm:501:16
	cs_updated_stat chrome://cachestatus/content/cachestatus.js:99:45
	onCacheStorageInfo chrome://cachestatus/content/cachestatus.js:164:9
Sadly I don't get more backtrace than that (the DownloadUtils is palemoon.res!/modules/DownloadUtils.jsm).

For some reason I don't fully understand, DownloadUtils is available in my console window and running

Code: Select all

DownloadUtils.convertByteUnits(1000);
triggers the error immediately.

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

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by thosrtanner » 2023-07-12, 19:36

Aaand restarting the browser fixed this >.< I think I'm going to have to wait till it happens again but it looks like something is getting corrupted.

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

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by thosrtanner » 2023-07-12, 19:52

And it has started again (though currently the complaints are from DownloadUtils.jsm as my code hasn't triggered yet). So something is doing nasty things somewhere.

User avatar
Martok
Contributing developer
Contributing developer
Posts: 5
Joined: 2019-08-29, 00:46

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by Martok » 2023-07-12, 21:12

I can't reproduce either case.
For the DownloadUtils case, I added a small test function to Palefill to trigger it, no issue.
Toasts in infoRSS also work, no issue.
"For more information please reread."

q160765803
Apollo supporter
Apollo supporter
Posts: 35
Joined: 2023-04-13, 07:57

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by q160765803 » 2023-07-13, 01:57

Martok wrote:
2023-07-12, 21:12
I can't reproduce either case.
For the DownloadUtils case, I added a small test function to Palefill to trigger it, no issue.
Toasts in infoRSS also work, no issue.
It seems that the problem doesn't appear in short time. But if it happens, it may also affect github in https://github.githubassets.com/assets/ ... 8659d4f.js

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

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by thosrtanner » 2023-07-13, 12:03

I've had to wait for about half an hour for it to trigger. Pale moon will start up and the dateutils function will work fine. after a while it goes kaboom.

Case in point. running profile with just inforss in it took less than 5 minutes to trigger. Running my normal browser - hasn't triggered yet, and has been running for 75 minutes.

And as soon as I'd posted that...

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

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by thosrtanner » 2023-07-13, 19:47

I can now confirm this happens with a completely blank profile if you wait for long enough.

Steps as follows:

1. Enable debug in the browser console by setting devtools.chrome.enabled to true in about:console
2. Loaded up this page https://repo.palemoon.org/MoonchildProd ... tByteUnits
3. Open the browser console (ctrl-shift-J)
4. Enter

Code: Select all

Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
DownloadUtils.convertByteUnits(1024);
5. This should display

Code: Select all

Array [ "1.0", "KB" ]
6. Wait for some time. Maybe an hour.
7. Enter

Code: Select all

DownloadUtils.convertByteUnits(1024);
8. It displays

Code: Select all

Error: No such property on self-hosted object: "get format"
9. If it didn't, you didn't wait long enough. Wait some more and go back to 7.

User avatar
Kris_88
Keeps coming back
Keeps coming back
Posts: 940
Joined: 2021-01-26, 11:18

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by Kris_88 » 2023-07-13, 19:59

More quickly:

1) Scratchpad, environment -> browser
2) Type:
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
DownloadUtils.convertByteUnits(1024);
3) Open about:memory, press the buttons: Minimize memory usage, GC, CC
4) Type:
DownloadUtils.convertByteUnits(1024);

Code: Select all

/*
Exception: Error: No such property on self-hosted object: "get format"
DU_convertByteUnits@resource://gre/modules/DownloadUtils.jsm:501:16
@Scratchpad/2:11:15
WCA_evalWithDebugger@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/webconsole.js:1373:26
WCA_onEvaluateJS@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/webconsole.js:886:25
WCA_onEvaluateJSAsync@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/webconsole.js:856:25
onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/main.js:1745:58
receiveMessage@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/transport/transport.js:761:18
*/

User avatar
Kris_88
Keeps coming back
Keeps coming back
Posts: 940
Joined: 2021-01-26, 11:18

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by Kris_88 » 2023-07-13, 20:24

Maybe the AddRef was not called somewhere...

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

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by Moonchild » 2023-07-13, 20:41

"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

User avatar
Kris_88
Keeps coming back
Keeps coming back
Posts: 940
Joined: 2021-01-26, 11:18

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by Kris_88 » 2023-07-13, 20:52

even more quickly:

1) Browser console:
var nf = Intl.NumberFormat();
2) about:memory: Minimize memory, GC, CC
3) Browser console:
nf.format(1024);
Error: No such property on self-hosted object: "get format"

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

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by Moonchild » 2023-07-14, 17:47

Can you check if this beta version: https://testserver.palemoon.org/32-beta ... 1.win64.7z works any better for you? (64-bit only, sorry)
"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

User avatar
Kris_88
Keeps coming back
Keeps coming back
Posts: 940
Joined: 2021-01-26, 11:18

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by Kris_88 » 2023-07-14, 18:16

Yes, I can't replicate the problem in this beta version.

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

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by thosrtanner » 2023-07-15, 06:08

Ah, worked out what to do with it. just unzip and run.

OK, running now, will see what happens.

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

Re: Error with Intl.DateTimeFormat on updating to 32.3.0

Unread post by thosrtanner » 2023-07-15, 09:02

apart from the surprising popup suggesting I should download firefox developer tools when opening the browser console, I've not seen the error I saw before at all.

So it all looks good.