From d48c7c487d1f59bc41964e4804713ad584f4b4e2 Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Wed, 30 May 2018 09:40:51 -0700 Subject: [PATCH] change sessionStorage to window.sessionStorage --- src/debugging.js | 6 +++--- test/spec/debugging_spec.js | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/debugging.js b/src/debugging.js index 2d02b137638..39ddc92beee 100644 --- a/src/debugging.js +++ b/src/debugging.js @@ -66,11 +66,11 @@ export function getConfig(debugging) { if (!debugging.enabled) { disableOverrides(); try { - sessionStorage.removeItem(OVERRIDE_KEY); + window.sessionStorage.removeItem(OVERRIDE_KEY); } catch (e) {} } else { try { - sessionStorage.setItem(OVERRIDE_KEY, JSON.stringify(debugging)); + window.sessionStorage.setItem(OVERRIDE_KEY, JSON.stringify(debugging)); } catch (e) {} enableOverrides(debugging); } @@ -80,7 +80,7 @@ config.getConfig('debugging', ({debugging}) => getConfig(debugging)); export function sessionLoader() { let overrides; try { - overrides = JSON.parse(sessionStorage.getItem(OVERRIDE_KEY)); + overrides = JSON.parse(window.sessionStorage.getItem(OVERRIDE_KEY)); } catch (e) { } if (overrides) { diff --git a/test/spec/debugging_spec.js b/test/spec/debugging_spec.js index 0911ecc2c7c..39b08075e06 100644 --- a/test/spec/debugging_spec.js +++ b/test/spec/debugging_spec.js @@ -18,8 +18,8 @@ describe('bid overrides', () => { describe('initialization', () => { beforeEach(() => { sandbox.stub(config, 'setConfig'); - sandbox.stub(sessionStorage, 'setItem'); - sandbox.stub(sessionStorage, 'removeItem'); + sandbox.stub(window.sessionStorage, 'setItem'); + sandbox.stub(window.sessionStorage, 'removeItem'); }); afterEach(() => { @@ -35,14 +35,14 @@ describe('bid overrides', () => { }); it('should happen when configuration found in sessionStorage', () => { - sandbox.stub(sessionStorage, 'getItem').returns('{"enabled": true}'); + sandbox.stub(window.sessionStorage, 'getItem').returns('{"enabled": true}'); sessionLoader(); expect(addBidResponse.hasHook(boundHook)).to.equal(true); }); it('should not throw if sessionStorage is inaccessible', () => { - sandbox.stub(sessionStorage, 'getItem').throws(); + sandbox.stub(window.sessionStorage, 'getItem').throws(); expect(() => { sessionLoader();