From 919f504b3bfea9539dc1948e615d42c1da098a15 Mon Sep 17 00:00:00 2001 From: dessant Date: Fri, 27 Sep 2024 12:01:21 +0300 Subject: [PATCH] fix: do not set allFrames and frameIds at the same time --- src/utils/common.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/utils/common.js b/src/utils/common.js index bae8c19..4f2a1d1 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -17,9 +17,13 @@ function insertCSS({ origin = 'USER' }) { if (mv3) { - const params = {target: {tabId, allFrames}}; + const params = {target: {tabId}}; - if (!allFrames) { + // Safari 17: allFrames and frameIds cannot both be specified, + // fixed in Safari 18. + if (allFrames) { + params.target.allFrames = true; + } else { params.target.frameIds = frameIds; } @@ -61,9 +65,13 @@ async function executeScript({ code = '' }) { if (mv3) { - const params = {target: {tabId, allFrames}, world}; + const params = {target: {tabId}, world}; - if (!allFrames) { + // Safari 17: allFrames and frameIds cannot both be specified, + // fixed in Safari 18. + if (allFrames) { + params.target.allFrames = true; + } else { params.target.frameIds = frameIds; }