Closed pinepain closed 6 years ago
I think we can use v8::ScriptCompiler::CachedDataVersionTag()
to prepend version tag to any cache data and validate it on loading.
I decided that in advance to v8 version it would be wise to store our own field value to be able to invalidate caches when something changes in extension itself which may affect snapshots behavior.
I'm thinking more about following the approach like with script cache class and do not throw exception in Isolate constructor when snapshot is invalid and set a flag on it that it was rejected so that it won't abrupt execution. It's end-user responsibility to validate that caches and snapshots are valid. We could also expose a tag we store alongside snapshot data to verify it with a runtime tag and check whether snapshot valid or not. Any thoughts?