Skip to content

Commit

Permalink
fix(metadata): IE cross origin frame Access Denied on Window['frameEl…
Browse files Browse the repository at this point in the history
…ement'] in Origin.get - add test
  • Loading branch information
valery-vitko committed Dec 12, 2017
1 parent 5e678d7 commit 553c5a2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/origin.spec.js
Expand Up @@ -25,8 +25,9 @@ describe('origin', () => {
});

describe('get - search modules', () => {
let modules = {'text-file': 'abcdef', 'real-module':{name:'test', x() {return 'hey'}}};
let modules = undefined;
beforeEach(()=> {
modules = {'text-file': 'abcdef', 'real-module':{name: 'test', x() { return 'hey' }}};
spyOn(PLATFORM, 'eachModule').and.callFake((callback) => {
for (let key in modules) callback(key, modules[key]);
});
Expand All @@ -46,6 +47,13 @@ describe('origin', () => {
it('but it should not search in strings', () => {
expect(Origin.get('a').moduleId).toBe(undefined);
});

it('should not fail on accessing restricted/failing members', () => {
Object.defineProperty(modules['real-module'], 'restricted1', { get: () => { throw new Error('restricted') }, enumerable: true });
class Test {}
expect(Origin.get(Test).moduleId).toBe(undefined);
expect(PLATFORM.eachModule).toHaveBeenCalled();
});
});

describe('set', () => {
Expand Down

0 comments on commit 553c5a2

Please sign in to comment.