[Suggestion] Remove obsolete "contains" methods

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.
SemiKebab
Moonbather
Moonbather
Posts: 50
Joined: 2021-05-30, 03:48

[Suggestion] Remove obsolete "contains" methods

Unread post by SemiKebab » 2023-10-04, 02:21

Namely, I'm suggesting to remove Array.prototype.contains() and String.prototype.contains().

They are old names for Array.prototype.includes() and String.prototype.includes() respectively.

The methods have been renamed in Firefox and Chrome, and the old names have been removed, for a long time. See bug 1103588. For the record, it was due to a conflict with MooTools, which extends the prototypes…

Rationale: as a web developer, I did some development using Pale Moon, and used the old names. I didn't notice anything, as the old names just work on Pale Moon. But then I encountered errors on Chrome, etc.
As the old names don't work on mainstream browsers, I think it is useless, and may do more harm than good, to continue to support these.

dbsoft
Project Contributor
Project Contributor
Posts: 419
Joined: 2020-02-21, 17:35

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by dbsoft » 2023-10-04, 03:15

That was done in Firefox 48, Pale Moon/UXP forked at 52... not sure how they would still be in it?

User avatar
FranklinDM
Add-ons Team
Add-ons Team
Posts: 582
Joined: 2017-01-14, 02:40
Location: Philippines

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by FranklinDM » 2023-10-04, 07:09

IIRC we no longer have Array.prototype.contains(), but String.prototype.contains() was restored in 240f52db8e, for compatibility.

SemiKebab
Moonbather
Moonbather
Posts: 50
Joined: 2021-05-30, 03:48

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by SemiKebab » 2023-10-04, 07:23

Right, Array.prototype.contains() is already nonexistent.

About String.prototype.contains(), 7 years after Firefox 48 which removed it, I think it would now be better to remove it, as I explained in OP.

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

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by Moonchild » 2023-10-04, 09:17

Unless there is some abuse going on with it, I don't see a reason to remove this. It's a simple, straightforward alias that allows some unmaintained/archived sites to continue working, and doesn't require any maintenance.
"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
athenian200
Contributing developer
Contributing developer
Posts: 1537
Joined: 2018-10-28, 19:56
Location: Georgia

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by athenian200 » 2023-10-04, 12:26

I don't think we should do this without some kind of underlying security reason, because I think in order to be consistent, we would have to remove all other deprecated features other browsers remove, like perhaps style scoped, etc.

The reason is precisely what you're saying... your existing code works on Pale Moon without updates, whereas it breaks on modern browsers because they ripped out an alias that was no longer needed, for no good reason. Part of the design philosophy behind Pale Moon is that we want older stuff to work on Pale Moon without breaking it for no good reason. For instance, we've kept NPAPI and the ability to use Flash player, we've kept XUL extensions, we've kept scoped styles, etc. Why would we want to get rid of an older alias for a JS function just to "force" web developers to update it for the sake of compatibility with other browsers that have gone in a direction we more or less disagree with? I just don't see much logic in that.

One concern I have is that since XUL extensions rely heavily on JS, removing JS functions for no good reason will result in XUL extensions breaking, and honestly people do not like to do the maintenance work on them. So while the older way of doing things may not be prevalent on the open web, there's a very real chance you'll encounter some ancient or unusual uses of JS within the browser's own codebase (part of which is written in JS), or within XUL extensions. While I have no problem making needed changes to match a spec to make things work, I also see no need to make busywork for extension developers by ripping things out to create an illusion of progress. Just my two cents, though... not implying it's actually up to me. LOL.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

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

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by Moonchild » 2023-10-04, 16:00

athenian200 wrote:
2023-10-04, 12:26
One concern I have is that since XUL extensions rely heavily on JS, removing JS functions for no good reason will result in XUL extensions breaking
Out of curiosity I did a quick search in the archive I have of XUL extensions (similar to what's on CAA) and found that around 70 or so have ".contains(" somewhere in their code, including popular ones like vimfx, tree style tabs and firegestures. So yes, those would likely break by removing support for this alias. And that won't actually count ones that use contains in a different calling format not exactly "something.contains(string)" on a single line...
"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: [Suggestion] Remove obsolete "contains" methods

Unread post by Kris_88 » 2023-10-04, 16:25

If you also didn't remove support for Windows XP, that would be great... ;)

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

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by Moonchild » 2023-10-04, 18:49

Kris_88 wrote:
2023-10-04, 16:25
If you also didn't remove support for Windows XP, that would be great... ;)
Are you sure you want to keep beating that horse carcass? :think: :lol:
"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: [Suggestion] Remove obsolete "contains" methods

Unread post by Kris_88 » 2023-10-04, 19:09

Moonchild wrote:
2023-10-04, 18:49
Are you sure you want to keep beating that horse carcass? :think: :lol:
Now that the job has already been done, it probably doesn’t make sense to go back... However, many people are forced to switch from Windows XP to new systems precisely because there is no modern browser for XP. It’s not at all because XP is outdated or there is no support or the system doesn’t work well. Just recently I witnessed two such cases. But Windows 10 on the same hardware works very slowly, and everything needs to be updated along the chain. And this is just for the sake of the browser...

User avatar
Nuck-TH
Project Contributor
Project Contributor
Posts: 204
Joined: 2020-03-02, 16:04

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by Nuck-TH » 2023-10-04, 20:32

Kris_88 wrote:
2023-10-04, 19:09
...But Windows 10 on the same hardware works very slowly, and everything needs to be updated along the chain.
Off-topic:
Windows 7 is the answer. It works wery well even on budget end of 00 hardware(Athlon II x3 in my case), it is immensely more robust, stable and secure than XP. I had to reinstall XP many times in span of two years back then because of viruses and performance issues(it for some reason got slow and sluggish over time), but 7 once installed endures to this day good as new(and that with less experienced users from mid 2014).
I honestly can't see how PC that can't run 7 well will be even remotely usable with modern websites in their sorry state.
Also that end of 00 hardware(or even sightly newer) is dirt cheap to get nowdays.

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

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by Kris_88 » 2023-10-04, 21:02

Off-topic:
Nuck-TH wrote:
2023-10-04, 20:32
Windows 7 is the answer.
Yes, Windows 7 can still be bought, but it is also outdated and not so cheap. Since the operating system has to be changed, people do not want to spend money on replacing one outdated system with another. They would be quite happy with XP with a modern browser, but if that’s not possible, then they’ll update everything.

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

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by Moonchild » 2023-10-04, 23:17

Off-topic:
Kris_88 wrote:
2023-10-04, 21:02
people do not want to spend money on replacing one outdated system with another.
A case of wanting to have your cake and eat it too?
I think if you're going to use an outdated system, use the best outdated OS you can. Otherwise, you have to buy a new computer for a new OS. And a Win 7 key is, what, $10 for Pro? Definitely cheaper than buying a new PC ;)

The bottom line for XP is a simple one: NT5 is the problem. Win7 up to Win 11 is all based on the same kernel and OS type (variants of NT6) so there is very little issue keeping support backwards to Win 7.
"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: [Suggestion] Remove obsolete "contains" methods

Unread post by Kris_88 » 2023-10-05, 00:34

Off-topic:
Moonchild wrote:
2023-10-04, 23:17
I think if you're going to use an outdated system, use the best outdated OS you can.
Otherwise, you have to buy a new computer for a new OS.
No, that's not the case for me. I use what I'm used to as long as it suits me. I skipped Windows Vista and Windows 7 and went straight from XP to a new computer with 8.1 and then 10.
Moonchild wrote:
2023-10-04, 23:17
And a Win 7 key is, what, $10 for Pro?
This is OEM. Although it will work, the license is violated, as far as I understand.
Moonchild wrote:
2023-10-04, 23:17
The bottom line for XP is a simple one: NT5 is the problem. Win7 up to Win 11 is all based on the same kernel and OS type (variants of NT6) so there is very little issue keeping support backwards to Win 7.
It's clear. But it's a pity. Although this doesn't concern me... personally I don't need XP support.

SemiKebab
Moonbather
Moonbather
Posts: 50
Joined: 2021-05-30, 03:48

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by SemiKebab » 2023-10-05, 01:04

Moonchild wrote:
2023-10-04, 16:00
Out of curiosity I did a quick search in the archive I have of XUL extensions (similar to what's on CAA) and found that around 70 or so have ".contains(" somewhere in their code, including popular ones like vimfx, tree style tabs and firegestures. So yes, those would likely break by removing support for this alias. And that won't actually count ones that use contains in a different calling format not exactly "something.contains(string)" on a single line...
Some (or even most) of them may be false positives. I had done similar searches on some codebases, and all results were actually classList.contains() (most of the occurrences), or Node.contains(), MooTools methods (String:contains, Array:contains, Object:contains…), or even user-defined methods.

User avatar
Basilisk-Dev
Lunatic
Lunatic
Posts: 323
Joined: 2022-03-23, 16:41
Location: Chamber of Secrets

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by Basilisk-Dev » 2023-10-05, 13:47

Kris_88 wrote:
2023-10-04, 16:25
If you also didn't remove support for Windows XP, that would be great... ;)
Off-topic:
That would lock us into old VIsual Studio versions and old C/C++ standards. It would progressively make it harder to update libraries that we build upon, and it would be harder to port changes from Mozilla Firefox. We would be doing a disservice to our users as being held back by XP support would slowly make us into an old and insecure browser like the Firefox fanboys think we are now.
Basilisk Project Owner

viewtopic.php?f=61&p=230756

User avatar
Pentium4User
Board Warrior
Board Warrior
Posts: 1138
Joined: 2019-04-24, 09:38

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by Pentium4User » 2023-10-18, 08:26

Kris_88 wrote:
2023-10-04, 16:25
If you also didn't remove support for Windows XP, that would be great... ;)
XP is an old-ass and insecure operating system.
Why do you still use it?
Linux exist and can run on your XP machine.
Why should the PM developers care about it and effort time in supporting it?
The profile picture shows my Maico EC30 E ceiling fan.

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

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by Kris_88 » 2023-10-18, 14:49

Pentium4User wrote:
2023-10-18, 08:26
XP is an old-ass and insecure operating system.
Why do you still use it?
XP is very fast and requires few resources compared to Windows 10. At the same time, I don’t find any fundamental innovations in Windows 10 that justify its bulkiness. If it were not for some circumstances, such as the lack of a modern browser, I would choose a more efficient system, and it does not matter to me whether it is older or newer.

User avatar
back2themoon
Moon Magic practitioner
Moon Magic practitioner
Posts: 2411
Joined: 2012-08-19, 20:32

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by back2themoon » 2023-10-18, 18:28

Kris_88 wrote:
2023-10-18, 14:49
Pentium4User wrote:
2023-10-18, 08:26
XP is an old-ass and insecure operating system.
XP is very fast and requires few resources compared to Windows 10.
I think the main problem with XP is security (or lack thereof).

dapgo
Fanatic
Fanatic
Posts: 208
Joined: 2016-10-11, 11:36

Re: [Suggestion] Remove obsolete "contains" methods

Unread post by dapgo » 2023-10-19, 10:14

back2themoon wrote:
2023-10-18, 18:28
Kris_88 wrote:
2023-10-18, 14:49
Pentium4User wrote:
2023-10-18, 08:26
XP is an old-ass and insecure operating system.
XP is very fast and requires few resources compared to Windows 10.
I think the main problem with XP is security (or lack thereof).
life is neither safe or secure :think:

There are many use cases, browsing on an intranet, using sandboxes, virtualization, firewalls,... there where risks tend to 0 or just exposure has 0 impact on the user.

IMO. well informed users should have the power to decide what they want and how to use, and at the moment there are some unofficial forks focused on XP with a bunch of users