visionmedia / page.js

Micro client-side router inspired by the Express router
http://visionmedia.github.com/page.js
7.67k stars 687 forks source link

Fix the errors in the case that e.g. an external code calls .pushState without path. #558

Open akeyhero opened 4 years ago

akeyhero commented 4 years ago

Hi.

I think we should inspect that e.state.path is not null nor undefined because anyone can call .pushState with an arbitrary state argument. https://developer.mozilla.org/en-US/docs/Web/API/PopStateEvent

I actually encountered this problem when I use an out-of-control external js code, which calls .pushState.

This should fix #293 .

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 92.562% when pulling 6bba5c2481c2281429f46dd3a57cc33e93fa5ba0 on akeyhero:fix-errors-due-to-no-path into 94138d1f3105f9fdb3424f9c0870c1fb90adcd1a on visionmedia:master.