diff --git a/src/annotator/sidebar.tsx b/src/annotator/sidebar.tsx index e4abe2b03b8..0da5d0d3153 100644 --- a/src/annotator/sidebar.tsx +++ b/src/annotator/sidebar.tsx @@ -89,9 +89,12 @@ export function createSidebarIframe(config: SidebarConfig): HTMLIFrameElement { // In viahtml, pywb uses wombat.js, which monkey-patches some JS methods. // One of those causes the `allow` attribute to be overwritten, so we want to - // make it non-writable to preserve the permissions we set above. + // define a noop setter to preserve the permissions we set above. + // We can remove this workaround once pywb has been updated to use the latest + // version of wombat.js, which includes a fix for this. + // See https://github.com/webrecorder/wombat/pull/134 return Object.defineProperty(sidebarFrame, 'allow', { - writable: false, + set: () => {}, }); } diff --git a/src/annotator/test/sidebar-test.js b/src/annotator/test/sidebar-test.js index 67799720364..c341c0c5448 100644 --- a/src/annotator/test/sidebar-test.js +++ b/src/annotator/test/sidebar-test.js @@ -1142,10 +1142,11 @@ describe('Sidebar', () => { describe('createSidebarIframe', () => { it('does not let `allow` attribute to be overwritten', () => { const iframe = createSidebarIframe({ sidebarAppUrl: 'https://foo.com' }); + const initialAllow = iframe.allow; - assert.throws(() => { - iframe.allow = 'something else'; - }, "Cannot assign to read only property 'allow' of object '#'"); + iframe.allow = 'something else'; + + assert.equal(iframe.allow, initialAllow); }); }); });