Refactor client-side API and RL modules for banner display


Refactor client-side API and RL modules for banner display

This patch refactors client-side code sent to all subscribing wikis.
Code previously in RL modules ext.centralNotice.bannerController and
ext.centralNotice.bannerController.mobile is removed. Almost
identical functionality is provided by ext.centralNotice.startUp and
its dependencies.

Provides client-side API features needed by upcoming patches to log a
sample of banner history, improve banner hide logic (currently in JS
in banners), and eventually remove calls to Special:RecordImpression.

Performance improvements are expected, since code for processing
campaigns and banners is not loaded if the server does not have any
possible campaigns for this user. Upcoming hide logic changes are
also expected to help performance.

Code to set window.Geo and handle GeoIP cookies has been moved to its
own RL module and is no longer dependent on CentralNoice-related
logic, in preparation for its removal from CentralNotice.

A number of unused features and Javascript API endpoints have been

More details:

  • In legacy code, bannerController execution is wrapped in a $( )

function. This is maintained, but it is expected that in the future,
only code that operates on the DOM will be delayed in that way.

  • Special:RecordImpression now defaults to sampling. Banners that

need unsampled data must call

  • Special:RecordImpression is no longer called for users that are not

targeted by a campaign.

  • The data sent to Special:RecordImpression has changed, and mirrors

the data available at mw.centralNotice.data.

  • Built-in hide cookie logic is now preformed before a banner is


  • Support for the 'old cookie apocalypse' and 'old cookie epoch' has

been removed. (However, the related global variables have been left
in, in case this change needs to be rolled back.)

  • Does _not_ fix an issue with GeoIP cookie handling related to the

domain the cookie is attached to. (See TODO in

  • Changes the directory structure of RL modules.
  • The strategy for deprecating old RL modules is as follows: old

modules no longer have scripts or css associated with them, and
depend on ext.centralNotice.startUp. However, the old modules are
still added to HTML, instead of the new one, in case a rollback is
necessary. This patch does not change HTML output. Old RL modules
will be removed from HTML in a follow-on patch. See

  • The global wgMobileDeviceName (clients-side only) is removed (no

longer needed).

  • New tests for re-implemented functionality will be added in

follow-on patches.

Bug: T100686
Bug: T100372
Bug: T102848
Change-Id: Ifbecceba41363c2ccd4fb3cfff96f7756d90bf06