This commit is contained in:
iqudoo
2026-06-09 12:26:14 +08:00
parent fb3a4b4e06
commit 0b1b145b9c
6 changed files with 76 additions and 29 deletions

View File

@@ -120,7 +120,7 @@ function hydrateEmbedParams(params, messageSource, targetOrigin) {
return params.map(walk);
}
function broadcastScanErrorToEmbedChildren(error) {
function broadcastScanErrorToEmbedChildren(error, meta) {
if (embedChildSources.size === 0 || error == null || error === "") {
return;
}
@@ -132,6 +132,7 @@ function broadcastScanErrorToEmbedChildren(error) {
v: EMBED_V,
kind: "forwardScanError",
error,
scanKey: meta && meta.scanKey,
},
"*"
);
@@ -153,6 +154,7 @@ function broadcastScanResultToEmbedChildren(result, meta) {
kind: "forwardScanResult",
result,
scanSource: meta && meta.source,
scanKey: meta && meta.scanKey,
},
"*"
);
@@ -221,6 +223,7 @@ function embedChildOnMessage(ev) {
if (typeof data.result === "string") {
const consumed = dispatchEmbedScanResult(data.result, {
source: data.scanSource,
scanKey: data.scanKey,
});
if (consumed && resolveUseParentProxy()) {
window.parent.postMessage(
@@ -238,7 +241,9 @@ function embedChildOnMessage(ev) {
}
if (data.kind === "forwardScanError") {
if (typeof data.error === "string") {
dispatchEmbedScanError(data.error);
dispatchEmbedScanError(data.error, {
scanKey: data.scanKey,
});
}
return;
}