Page MenuHomePhabricator

Search's autocomplete doesn't work on non-standard reserved keys in Object.prototype in Firefox's JavaScript engine
Open, Needs TriagePublic

Description

You can test this on the WMF install by searching for "watch". Either "watc" or "watchl" will match for the project "MediaWiki-Watchlist" but "watch" does not.

From one of our resident JS gurus:

In T118539#1802886, @Krinkle wrote:

Probably because the JavaScript code in Phabricator treats an object as supporting arbitrary keys. watch is a non-standard reserved key in Object.prototype in Firefox's JavaScript engine.

The standard reserved keys are all in CamelCase such as toString, valueOf, hasOwnProperty. But Phabricator's script converts the value to lowercase before it searches, so those are fine.

Upstream bug! They need to use if hasOwnProperty.call( obj, key ) instead of if obj[key].

Event Timeline

greggrossmeier updated the task description. (Show Details)
greggrossmeier added a project: Search.

The same behavior happens here as well. Typing watch causes the suggestion to be hidden, then adding d to make watchd results in the suggestion reappearing.

epriestley moved this task from Backlog to v2 on the Search board.Mar 26 2017, 12:36 PM