Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: iframe sandbox document.currentScript null #1075

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/source/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ function getUniqueNonceSrc (): string {
function setConvertScriptAttr (convertScript: HTMLScriptElement, attrs: AttrsType): void {
attrs.forEach((value, key) => {
if ((key === 'type' && value === 'module') || key === 'defer' || key === 'async') return
if (key === 'src') key = 'data-origin-src'
if (key === 'src') {
// FIXME:这个地方是不是将src 再次放出来,document.currentScript.src 为空,现在,很多 sdk 无法起效
globalEnv.rawSetAttribute.call(convertScript, key, value)

key = 'data-origin-src'
}

globalEnv.rawSetAttribute.call(convertScript, key, value)
})
}
Expand Down