Skip to content

Commit

Permalink
change sessionStorage to window.sessionStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
snapwich committed Jun 6, 2018
1 parent 473c45a commit d48c7c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/debugging.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions test/spec/debugging_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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();
Expand Down

0 comments on commit d48c7c4

Please sign in to comment.