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

truncateDeep() throws with objects not inheriting hasOwnProperty() #261

Closed
brianreavis opened this issue Oct 1, 2017 · 3 comments
Closed
Labels
released This feature/bug fix has been released

Comments

@brianreavis
Copy link

if (object.hasOwnProperty(key)) {

This line is not safe and breaks history.pushState and history.replaceState when state contains object(s) that do not inherit hasOwnProperty (e.g. were created with Object.create(null)).

Observed behavior

TypeError: e.hasOwnProperty is not a function

Steps to reproduce

  • Have auto breadcrumbs enabled and call history.pushState with a state containing object(s) that do not not inherit hasOwnProperty.
var plainObject = Object.create(null);
plainObject.dummyProperty = true;
var state = {myObject: plainObject};
history.pushState(state, 'foo', 'bar.html');

Version

3.x

@bengourley
Copy link
Contributor

Hey @brianreavis, thanks for the bug report. I'll get this looked into.

@bengourley bengourley added the scheduled Work is starting on this feature/bug label Oct 2, 2017
@brianreavis
Copy link
Author

Thanks @bengourley!

bengourley added a commit that referenced this issue Oct 4, 2017
Truncation of non-Object.prototype objects, fixes #261
@bengourley
Copy link
Contributor

Hey @brianreavis, v3.3.1 was just released containing the fix for this. If you are using the CDN link, the latest version will be fetched automatically and should just work™. Otherwise, please manually upgrade and let me know how you get on. Cheers!

@phillipsam phillipsam added released This feature/bug fix has been released and removed scheduled Work is starting on this feature/bug labels Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This feature/bug fix has been released
Projects
None yet
Development

No branches or pull requests

3 participants