mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 03:14:00 +00:00
fix(share): reject inherited style keys during restore
This commit is contained in:
1 parent
de2138e84c
commit
d49877ad2e
6 files changed
+50
-2
No files matched your search
@@ -778,3 +778,20 @@ test('visual input listeners are revoked before asynchronous UI teardown', () =>
|
||||
assert.match(VisualSettings.prototype.stop.toString(), /this\._styleParameters\?\.destroy\(\)/);
|
||||
assert.match(VisualSettings.prototype.stop.toString(), /this\._visualEffects\.stop\(\)/);
|
||||
});
|
||||
|
||||
|
||||
test('share restore rejects inherited styles while continuing later fields', () => {
|
||||
for (const style of ['constructor', '__proto__', 'toString', 'hasOwnProperty', 'unknown']) {
|
||||
const restored = makeManager(`#lat=10&lon=20&style=${style}&cr=1`).parseInitialHash();
|
||||
assert.equal(restored.style, 'normal');
|
||||
assert.equal(restored.celestialRing, true);
|
||||
}
|
||||
});
|
||||
|
||||
test('programmatic invalid styles are ignored before changing visual state', () => {
|
||||
const target = { activeStyle: 'normal' };
|
||||
for (const value of ['constructor', '__proto__', 'toString', 'hasOwnProperty', 'unknown', {}, null, () => {}]) {
|
||||
assert.doesNotThrow(() => VisualSettings.prototype.setStyle.call(target, value));
|
||||
assert.equal(target.activeStyle, 'normal');
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user