From f4e5e98d4903532043e3495c360f81b3908a36ff Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 6 May 2024 12:28:35 +0200 Subject: [PATCH] Remove workaround for pywb's wombat.js bug --- src/annotator/sidebar.tsx | 12 ++---------- src/annotator/test/sidebar-test.js | 13 +------------ 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/annotator/sidebar.tsx b/src/annotator/sidebar.tsx index 0da5d0d3153..1bcb84ad28f 100644 --- a/src/annotator/sidebar.tsx +++ b/src/annotator/sidebar.tsx @@ -70,7 +70,7 @@ export type SidebarContainerConfig = { /** * Create the iframe that will load the sidebar application. */ -export function createSidebarIframe(config: SidebarConfig): HTMLIFrameElement { +function createSidebarIframe(config: SidebarConfig): HTMLIFrameElement { const sidebarURL = config.sidebarAppUrl; const sidebarAppSrc = addConfigFragment( sidebarURL, @@ -87,15 +87,7 @@ export function createSidebarIframe(config: SidebarConfig): HTMLIFrameElement { // the clipboard. sidebarFrame.allow = 'fullscreen; clipboard-write'; - // 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 - // 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', { - set: () => {}, - }); + return sidebarFrame; } type GestureState = { diff --git a/src/annotator/test/sidebar-test.js b/src/annotator/test/sidebar-test.js index c341c0c5448..fb985d5a5e1 100644 --- a/src/annotator/test/sidebar-test.js +++ b/src/annotator/test/sidebar-test.js @@ -1,7 +1,7 @@ import { TinyEmitter } from 'tiny-emitter'; import { addConfigFragment } from '../../shared/config-fragment'; -import { Sidebar, MIN_RESIZE, $imports, createSidebarIframe } from '../sidebar'; +import { Sidebar, MIN_RESIZE, $imports } from '../sidebar'; import { Emitter } from '../util/emitter'; const DEFAULT_WIDTH = 350; @@ -1138,15 +1138,4 @@ describe('Sidebar', () => { assert.calledWith(guestRPC().call, 'selectAnnotations', tags, true); }); }); - - describe('createSidebarIframe', () => { - it('does not let `allow` attribute to be overwritten', () => { - const iframe = createSidebarIframe({ sidebarAppUrl: 'https://foo.com' }); - const initialAllow = iframe.allow; - - iframe.allow = 'something else'; - - assert.equal(iframe.allow, initialAllow); - }); - }); });