Add more comments to nativeAssign definition. [ci skip]

This commit is contained in:
jdalton
2015-04-10 21:24:32 -07:00
parent 5b2bde6e0d
commit a55d822f9a

View File

@@ -797,12 +797,17 @@
/** Used as `baseAssign`. */
var nativeAssign = (function() {
'use strict';
// Avoid `Object.assign` in Firefox 34-37 which have an early implementation
// with a now defunct try/catch behavior. See https://bugzilla.mozilla.org/show_bug.cgi?id=1103344
// for more details.
//
// Use `Object.preventExtensions` on a plain object instead of simply using
// `Object('x')` because Chrome and IE fail to throw an error when attempting
// to assign values to readonly indexes of strings in strict mode.
var object = { '1': 0 },
func = preventExtensions && isNative(func = Object.assign) && func;
// Avoid `Object.assign` in Firefox 34-37 which have an early implementation
// with a slower try/catch behavior. See https://bugzilla.mozilla.org/show_bug.cgi?id=1103344
// for more details.
try { func(preventExtensions(object), 'xo'); } catch(e) {}
return !object[1] && func;
}());