polyfill-library: Map polyfill fails (in certain use cases?) on IE11 using default-3.4 or newer

Using IE11 (11.1884.14393.0) and polyfill service 3.24, the polyfill string default-3.6,Map will fail (telling me Object doesn't support property or method 'entries', polyfill.js 434:3). However, default-3.3,Map works just fine; as does default-3.6 without added bonuses, but this seems fully dependent on the use case. Adding Map to any default-version from 3.4 and above will fail. The failing block in question looks like this:

	Map.prototype['forEach'] = function(callbackFn, thisArg) {
		thisArg = thisArg || global;
		var iterator = this.entries(); // <- Right here!
		var result = iterator.next();
		while (result.done === false) {
			callbackFn.call(thisArg, result.value[1], result.value[0], this);
			result = iterator.next();
		}
	};

Polyfill header:

/* Polyfill service v3.24.0
 * For detailed credits and licence information see https://github.com/financial-times/polyfill-service.
 * 
 * UA detected: ie/11.0.0
 * Features requested: Map,default-3.6

Now, I know that Map is already included in default-3.6, but in certain cases that fails as well, without clear indication of what’s gone wrong. default-3.6,fetch fails for one of our sites inside the Map-polyfill on IE11 with the message Unable to get property 'get' of undefined or null reference (polyfill.js 1303,3), here:

	var isMap;
	if (hasMap) {
		var mapSize = Object.getOwnPropertyDescriptor(Map.prototype, 'size').get; // Here!
		isMap = function (m) {
			try {
				mapSize.call(m);
				return true;
			} catch (e) {
				return false;
			}
		};
	}

Polyfill header for that one:

/* Polyfill service v3.24.0
 * For detailed credits and licence information see https://github.com/financial-times/polyfill-service.
 * 
 * UA detected: ie/11.0.0
 * Features requested: default-3.6,fetch

That’s about all the detail I can give you presently. Any idea of how to fix this?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

Same problem here with Google Maps and IE11, when adding Array.from to the features list.