(win)
| 5 | * @param {!Window} win |
| 6 | */ |
| 7 | export function install(win) { |
| 8 | const {WeakMap} = win; |
| 9 | const m = new WeakMap(); |
| 10 | if (m.set({}, 0) !== m) { |
| 11 | const {set} = m; |
| 12 | |
| 13 | win.Object.defineProperty(WeakMap.prototype, 'set', { |
| 14 | enumerable: false, |
| 15 | configurable: true, |
| 16 | writable: true, |
| 17 | value: function () { |
| 18 | set.apply(this, arguments); |
| 19 | return this; |
| 20 | }, |
| 21 | }); |
| 22 | } |
| 23 | } |