🐛 document.head.removeChild should be hooked in sandbox (#2522)

This commit is contained in:
Kuitos 2023-06-07 11:17:57 +08:00 committed by GitHub
parent cf0ee02751
commit 521efb828d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,6 +95,7 @@ function patchDocument(cfg: { sandbox: SandBox; speedy: boolean }) {
const qiankunHead = getAppWrapperHeadElement(containerConfig.appWrapperGetter());
qiankunHead.appendChild = HTMLHeadElement.prototype.appendChild;
qiankunHead.insertBefore = HTMLHeadElement.prototype.insertBefore;
qiankunHead.removeChild = HTMLHeadElement.prototype.removeChild;
return qiankunHead;
}
break;
@ -247,13 +248,13 @@ export function patchStrictSandbox(
// all dynamic style sheets are stored in proxy container
const { dynamicStyleSheetElements } = containerConfig;
const unpatchDocument = patchDocument({ sandbox, speedy: speedySandbox });
const unpatchDynamicAppendPrototypeFunctions = patchHTMLDynamicAppendPrototypeFunctions(
(element) => elementAttachContainerConfigMap.has(element),
(element) => elementAttachContainerConfigMap.get(element)!,
);
const unpatchDocument = patchDocument({ sandbox, speedy: speedySandbox });
if (!mounting) calcAppCount(appName, 'increase', 'bootstrapping');
if (mounting) calcAppCount(appName, 'increase', 'mounting');