Page MenuHomePhabricator

On some pages all js-messages are broken
Closed, ResolvedPublic


On some pages in *WebKit-browsers*, such as :

... all js-messages are broken (<vector-simplesearch-search>, <showtoc> etc.). However they are loaded fine and in mw.messages.

The problem is caused by .exists() returning false incorrectly.
Map.prototype.exists (1.17wmf1):

        function ( selection ) {
		if ( typeof keys === 'object' ) {
			for ( var s = 0; s < selection.length; s++ ) {
				if ( !( selection[s] in this.values ) ) {
					return false;
			return true;
		} else {
			return selection in this.values;


It incorrectly refers to "keys" instead of "selection" so it will fail for multi-message calls which pass an object. But single-message calls (99.9% of cases) should still work fine, and usually they do.

However on the linked Commons-page even single messages are failing.

Google Chrome:

Root cause ? Obviously the root cause is the function checking the wrong variable, but single-message calls should work fine (which was the reason the fixing part of r80572 wasn't backported, core nor any extension used it).

But on this page there is a <h2 id="keys"> ( == Keys == ), and in WebKit browsers references to elements by ID are in the window object / global namespace.
so window.keys === <h2 id="keys"> (an object, instance of Element).

All this weirdness was fixed as part of r80572. Although initially not considered worth a backport, I think we should consider and actually backport to 1.17 and 1.17wmf1 as currently:

  • requesting multiple messages in any browser
  • requesting single messages in Chrome on some pages

.. does not work and results in breakages of all messages on the page.

Version: 1.17.x
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 21 2014, 11:30 PM
bzimport set Reference to bz29726.
bzimport added a subscriber: Unknown Object (MLST).

Created attachment 8745
The mystery caught in the wild

Check the screenshot for debugging


Afbeelding_1.png (627×843 px, 57 KB)

Created attachment 8746
Extracted from r80572, applied to 1.17wmf1

Simple fix from r80572, applied to 1.17wmf1.


Applied on r91504 (REL_1_17) and r91505 (1.17wmf1), should be deployed shortly.

Pushed by Reedy -- I've confirmed that renders correct in Chrome
for me after repoking. Yay!