diff --git a/src/background/main.js b/src/background/main.js index 185175c..5d07847 100644 --- a/src/background/main.js +++ b/src/background/main.js @@ -819,7 +819,7 @@ async function searchClickTarget(session) { async function handleParseResults(session, images) { if (!images.length) { await showNotification({messageId: 'error_imageNotFound'}); - } else if (images.length > 1) { + } else if (images.length > 1 || images[0].mustConfirm) { await openContentView({session, images}, 'confirm'); } else { if (session.sessionType === 'search') { @@ -1193,7 +1193,8 @@ async function processMessage(request, sender) { } else if (request.id === 'pageParseSubmit') { if ( request.session.sessionOrigin === 'action' && - request.images.length <= 1 + request.images.length <= 1 && + !request.images[0]?.mustConfirm ) { browser.tabs.sendMessage( sender.tab.id, diff --git a/src/content/main.js b/src/content/main.js index fa1d872..cbd0133 100644 --- a/src/content/main.js +++ b/src/content/main.js @@ -25,6 +25,7 @@ function addViewFrame() { shadowRoot.appendChild(css); const viewFrame = document.createElement('iframe'); + viewFrame.setAttribute('allow', 'web-share'); viewFrame.classList.add('hidden'); css.addEventListener( diff --git a/src/parse/main.js b/src/parse/main.js index 3da5ea9..98bc214 100644 --- a/src/parse/main.js +++ b/src/parse/main.js @@ -402,18 +402,25 @@ self.initParse = async function (session) { const images = await parse(session); if (session.sessionType === 'share' && images.length === 1) { - await shareImage(images[0], { - convert: session.options.convertSharedImage - }); - } else { - await sendLargeMessage({ - message: { - id: 'pageParseSubmit', - images, - session - } - }); + // Safari 17: transient activation does not always propagate to + // the content script context, navigator.userActivation.isActive is false. + if (targetEnv === 'safari') { + images[0].mustConfirm = true; + } else { + await shareImage(images[0], { + convert: session.options.convertSharedImage + }); + return; + } } + + await sendLargeMessage({ + message: { + id: 'pageParseSubmit', + images, + session + } + }); } catch (err) { console.log(err.toString());