Page MenuHomePhabricator

"Watch" fails to autocomplete in Search due to non-standard reserved keys in Object.prototype in Firefox's JavaScript engine
Open, LowPublic

Description

In Phabricator's search, in Firefox (but not Chromium), if I type watc or watchl it will successfully autocomplete to "mediawiki-watchlist", but if I only type "watch" it doesn't match anything.
Confirmed in private window, as well as logged-in.

Very odd!
(No time to look upstream).

Event Timeline

Quiddity raised the priority of this task from to Needs Triage.
Quiddity updated the task description. (Show Details)
Quiddity added a project: Phabricator.
Quiddity added a subscriber: Quiddity.

I've seen similar behavior in Google Chrome's omnibar (not at all related to this).

Very aggravating.

greg set Security to None.
greg added a subscriber: greg.

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].

Aklapper renamed this task from "Watch" fails to autocomplete in phabricator's search, in Firefox to "Watch" fails to autocomplete in Search due to non-standard reserved keys in Object.prototype in Firefox's JavaScript engine.May 23 2016, 5:34 PM