fix duplicate objects after restoring data from localStorage

This makes sure that the originals of changed entities get merged
into the base of the stack after restoring the data from JSON.
This is necessary, because the stack will only have elements for
the current viewport after a restart and previously *modified*
objects will now be falsely detected as *created* ones.

Also removed some ineffective code.
add tests for "restoring from v3 JSON" (core/history.js)
extend history loading fix to deletions

Deleted objects need to be kept in the base of the history stack, too.

This also improves the respective unit tests.
Merge pull request #2135 from tyrasd/master

fix duplicate objects after restoring data from localStorage