« Bugzilla Issues Index

#1800 — Web compatibility breaks with __proto__

According to sections B.3.1#6.a and, implementations are expected to throw a TypeError exception if an object’s __proto__ is set with anything other than null or an object. Today the existing implementations (Chrome or Firefox) treat such assignments as a no-op.

Interestingly there are instances of web pages who assign undefined to an objects __proto__ are found. For example assigns undefined to __proto__ via a function call as follows.

function(f) { return { __proto__:f } }

Implementing as per the specification would break the zoom in/out functionality of Yelp as this function would throw a TypeError. Similarly a radio player on would not work either. The fact that there are few instances we have seen in the wild would mean there could be more websites that could break.

Spec does not reflect current implementations of __proto__. Spec needs to clarify if assignments of primitives (or just undefined) to __proto__ should be ignored.

fixed in rev17 editor's draft

fixed in rev17, August 23, 2013 draft