store page crashing browser

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.
User avatar
Kris_88
Keeps coming back
Keeps coming back
Posts: 933
Joined: 2021-01-26, 11:18

Re: store page crashing browser

Unread post by Kris_88 » 2021-03-17, 22:25

New Tobin Paradigm wrote:
2021-03-17, 21:31
See your drive-by tinkering can be useful for more than extensions :lol:
It is just a small relaxation... :lol:

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

Re: store page crashing browser

Unread post by Moonchild » 2021-03-17, 23:45

Yeah the script is wrong and will cause a recursive loop, unless there is a specific "optimization" in place that won't call the mutationobserver if the style set is the same as what was already there (and I don't think that is specced).

Otherwise what happens in that script is this:
Style in page is set by js -> mutationobserver is called because style is set to a value -> mutation observer code sets the style -> mutationobserver is called because style is set to a value -> mutation observer code sets the style -> ...
i.e.: the code in the mutationobserver triggers the observer itself through the set action, and there is no check performed if the style is already at the desired value. This kind of programmer error is actually fairly common and you always have to be careful about it when you deal with observers (as in don't make code inside the observer function trigger the observer again).
"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: 933
Joined: 2021-01-26, 11:18

Re: store page crashing browser

Unread post by Kris_88 » 2021-03-17, 23:57

In MS Edge and IE the observer fires only once.
Actually implies that the observer should fires when the attribute is changed, not when just set.
In any case, the page is frozen for this reason, and this is no longer the first case here.

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

Re: store page crashing browser

Unread post by Moonchild » 2021-03-18, 00:16

Kris_88 wrote:
2021-03-17, 23:57
Actually implies that the observer should fires when the attribute is changed, not when just set.
*sigh* with "set" i mean the action of writing something to the value. (as in a "setter") not going from "unset" to "having a value"
Kris_88 wrote:
2021-03-17, 23:57
In MS Edge and IE the observer fires only once.
Why do people make me have to repeat myself?
Moonchild wrote:
2021-03-17, 23:45
unless there is a specific "optimization" in place that won't call the mutationobserver if the style set is the same as what was already there
"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