HomePhabricator

Avoid using document.write

Authored by Florian on Feb 23 2016, 5:00 PM.

Description

Avoid using document.write

document.write was stubbed in Ic9056d7a779f234a28ddad005fd4d76f2e750fcc and
has a slightly different behaviour now (it now appends the given parameters
to the body directly, instead of adding it to the position where the call
was made). This seems to be a race condition with the usage of document.write
in DismissableSiteNotice to add the site notice with JS for anonymous users and
sometimes results in an undesired outcome.

Instead of having this problem, this change replaces the usage of document.write
by ading a new module, which will add the site notice contents for anonymous users
with jQuery into the correct position. It also populates the site notice in a
new global JS variable wgDismissableSiteNotice to accomplish the goal.

This probably fixes T125323.

Bug: T125323
Change-Id: Ideaa18f5fb468261705c115c68c454919ab22c29