Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library throws an error for properties which exist directly on Object.prototype #1137

Closed
JakeChampion opened this issue Dec 6, 2021 · 0 comments · Fixed by #1138
Closed
Labels
library Relates to an Origami library

Comments

@JakeChampion
Copy link
Owner

JakeChampion commented Dec 6, 2021

This was originally reported in polyfillpolyfill/polyfill-service#2652

What

If requesting any property which exists on directly on Object.prototype such as:

  • 'constructor',
  • '__defineGetter__'
  • '__defineSetter__'
  • 'hasOwnProperty'
  • '__lookupGetter__'
  • '__lookupSetter__'
  • 'isPrototypeOf'
  • 'propertyIsEnumerable'
  • 'toString'
  • 'valueOf'
  • '__proto__'
  • 'toLocaleString'

Then the library will throw an error instead of returning a polyfill bundle.

Details

Running the below code will result in an error being thrown "TypeError: Cannot read property 'has' of undefined".

const polyfillLibrary = require('polyfill-library');
const options = {
	features: {
		'constructor': {},
		'__defineGetter__': {},
		'__defineSetter__': {},
		'hasOwnProperty': {},
		'__lookupGetter__': {},
		'__lookupSetter__': {},
		'isPrototypeOf': {},
		'propertyIsEnumerable': {},
		'toString': {},
		'valueOf': {},
		'__proto__': {},
		'toLocaleString': {},
	},
	uaString: 'ie/9'
};
await polyfillLibrary.getPolyfills(options);
@origamiserviceuser origamiserviceuser added this to To Do in Origami ✨ Dec 6, 2021
@github-actions github-actions bot added the library Relates to an Origami library label Dec 6, 2021
JakeChampion added a commit that referenced this issue Dec 6, 2021
…he object are it's own and not those from Object.prototype -- Fixes #1137
Origami ✨ automation moved this from To Do to Done Dec 6, 2021
JakeChampion added a commit that referenced this issue Dec 6, 2021
…he object are it's own and not those from Object.prototype -- Fixes #1137
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2022
@robertboulton robertboulton removed this from Done in Origami ✨ Jul 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
library Relates to an Origami library
Projects
None yet
1 participant