diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 9b6ae69206..e01bc74b75 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -30,6 +30,8 @@ Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/osfile.jsm"); Components.utils.import("resource://gre/modules/PluralForm.jsm"); +Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); + /* * Core functions */ diff --git a/resource/polyfill.js b/resource/polyfill.js new file mode 100644 index 0000000000..1fa7339f5b --- /dev/null +++ b/resource/polyfill.js @@ -0,0 +1,10 @@ +if (!Object.values) { + const reduce = Function.bind.call(Function.call, Array.prototype.reduce); + const isEnumerable = Function.bind.call(Function.call, Object.prototype.propertyIsEnumerable); + const concat = Function.bind.call(Function.call, Array.prototype.concat); + const keys = Reflect.ownKeys; + + Object.values = function values(O) { + return reduce(keys(O), (v, k) => concat(v, typeof k === 'string' && isEnumerable(O, k) ? [O[k]] : []), []); + }; +}