Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
3e8d9d68
Commit
3e8d9d68
authored
Feb 22, 2024
by
Alejandro Celaya
Committed by
Alejandro Celaya
Feb 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add noop setter to sidebar iframe allow attribute
parent
ef21b690
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
sidebar.tsx
src/annotator/sidebar.tsx
+5
-2
sidebar-test.js
src/annotator/test/sidebar-test.js
+4
-3
No files found.
src/annotator/sidebar.tsx
View file @
3e8d9d68
...
...
@@ -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
:
()
=>
{}
,
});
}
...
...
src/annotator/test/sidebar-test.js
View file @
3e8d9d68
...
...
@@ -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 '#<HTMLIFrameElement>'"
);
assert
.
equal
(
iframe
.
allow
,
initialAllow
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment