mediawiki.confirmCloseWindow: Remove support for custom 'message'


mediawiki.confirmCloseWindow: Remove support for custom 'message'

Between 2015 and 2016, all major browsers removed support for this
due to abuse by pop-up ads and such. As such, we're invoking the
client-side wikitext message parser before the onbeforeunload event
can return, but not actually using its string anywhere except in IE11.

Remove this and let IE11 do the same native thing as all other
browsers have been doing regrardless. This is not a breaking change,
because any callers to confirmCloseWindow() passing a 'message' option
will still work and create the same behaviour as before. It just means
that in IE11 the "extra text" message is now ignored the same as it
was in other browsers already.

Browsers correctly understood that virtually the only legitimate use
of this feature was to remind users of unsaved changes, and their
default localised prompt reflects that understanding.

  • Update callers to not bundle and pass down a custom message.
  • Keep the message bundled with confirmCloseWindow.js for use in the trigger() method. This no longer supports the override, but it does still need a default localised string there since this method uses a prompt() which unlike 'onbeforeunload' has no default.

    I have moved the message parsing down to that method to still remove its overhead from the most common code path.

Bug: T283193
Change-Id: I7b3c0579272f97243c9795c63d7193fefc3eddbe


KrinkleAuthored on Sep 7 2021, 12:07 AM
matmarexCommitted on Sep 16 2021, 7:25 PM
rMW76fdc1fc9137: Merge "Deprecate and replace legacy hooks in DeletePage"