Page MenuHomePhabricator

Allow usage of mw.util in altered scope/ environment
Closed, ResolvedPublic

Description

patch that changes *this* to *util* allowing calling this function with another *this* or even no *this*

Krinkle assigned on Commons e.g.
addPortletLink = mw.util.addPortletLink;

This may cause errors if references to *this* (util) are made like in addPortletLink. Most of the code does not use *this*, instead it refers to *util*.

Background (commons-specific): On css pages this caused "this is undefined", called from MediaWiki:Gadget-CSSValidate.js


Version: 1.17.x
Severity: minor

attachment mediawiki.util.patch.js ignored as obsolete

Details

Reference
bz34603

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:18 AM
bzimport set Reference to bz34603.

Created attachment 10075
Re-attach original file with proper mime-type to allow viewing in bugzilla

Attached:

Thanks, applied in r112170 together with more fixes of this to util.

Bugmeister? It seems to be impossible to select a mime-type when submitting a new bug? Right?

(In reply to comment #3)

Bugmeister? It seems to be impossible to select a mime-type when submitting a
new bug? Right?

mime-type is determined by the file you upload, not on BugZilla. Yours had "text/x-c++". The override during upload does indeed appear to absent when creating a new bug, only shown on existing bugs when attaching files. Instead of mime-type one can also check "[_] Patch" which takes care of it automatically, although that one is also invisible during bug creation.