Problem on https://www.y8.com/games/dress_up_poland

For support with specific websites

Moderator: trava90

Forum rules
Please always mention the name/domain of the website in question in your topic title.
Please one website per topic thread (to help keep things organized). While behavior on different sites might at first glance seem similar, they are not necessarily caused by the same.

Please try to include any relevant output from the Toolkit Error Console or the Developer Tools Web Console using the following procedure:
  1. Clear any current output
  2. Navigate or refresh the page in question
  3. Copy and paste Errors or seemingly relevant Warnings into a single [ code ] block.
User avatar
craniumcadoo
Moonbather
Moonbather
Posts: 66
Joined: 2023-08-02, 19:42

Problem on https://www.y8.com/games/dress_up_poland

Post by craniumcadoo » 2025-07-24, 15:19

The message

Code: Select all

ReferenceError: assignment to undeclared variable event
appears in the console, I think it relates to the below code and because of it the page does not load the game.

Code: Select all

        6115: function(e, t) {
            "use strict";
            ...
            var r = function() {
                return e = function e() {
                    ! function(e, t) {
                        if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
                    }(this, e)
                }, ... {
                    key: "dispatchCustomEvent",
                    value: function() {
                        console.log("dispatching event preRollAdHidden"), event = new Event("preRollAdHidden"), document.dispatchEvent(event)
                    }
                }]) && i(e.prototype, t), n && i(e, n), Object.defineProperty(e, "prototype", {
                    writable: !1
                }), e;
                var e, t, n
            }();
            t.A = r
        },

User avatar
craniumcadoo
Moonbather
Moonbather
Posts: 66
Joined: 2023-08-02, 19:42

Re: Problem on https://www.y8.com/games/dress_up_poland

Post by craniumcadoo » 2025-07-24, 15:28

Tested this snippet in the console on Pale Moon and Firefox

Code: Select all

"use strict";
try {
    event = new Event("testEvent");
    console.log("Assigned to event:", event);
} catch (e) {
    console.error("Error assigning to event:", e);
}

console.log("window.event =", window.event);
Pale Moon:

Code: Select all

Error assigning to event: ReferenceError: assignment to undeclared variable event
undefined
Firefox:

Code: Select all

Assigned to event: 
testEvent { target: null, isTrusted: false, eventPhase: 0, bubbles: false, cancelable: false, returnValue: true, defaultPrevented: false, composed: false, timeStamp: 127056, cancelBubble: false, … }
window.event = 
testEvent { target: null, isTrusted: false, eventPhase: 0, bubbles: false, cancelable: false, returnValue: true, defaultPrevented: false, composed: false, timeStamp: 127056, cancelBubble: false, … }
Also Firefox with this code:

Code: Select all

"use strict";
try {
    other = new Event("testEvent");
    console.log("Assigned to other:", other);
} catch (e) {
    console.error("Error assigning to other:", e);
}

Code: Select all

Error assigning to other: ReferenceError: assignment to undeclared variable other
Firefox appears to treat event as a legacy global in certain contexts, meaning it does not error out. Pale Moon already has the appropriate behavior for this for `name`, `status`, `length`, `parent`, `opener`, `frames`, `self` and likely others.

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2548
Joined: 2018-05-05, 13:29

Re: Problem on https://www.y8.com/games/dress_up_poland

Post by vannilla » 2025-07-24, 15:51

window.event is officially deprecated and dates back to the times of Internet Explorer. It has many subtle issues and if code works is mostly by coincidence. It should not be used in new scripts. Pale Moon doesn't have this deprecated feature without changing a setting.

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

Re: Problem on https://www.y8.com/games/dress_up_poland

Post by FranklinDM » 2025-07-24, 15:52

The provided code works for me. See https://repo.palemoon.org/MoonchildProd ... ment-43556

Do note that global window event support is not enabled by default.