[Webkit-unassigned] [Bug 263817] New: Safari Web Extension content scripts (and scripting.executeScript) won't inject into about:srcdoc iframes

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 27 19:04:26 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=263817

            Bug ID: 263817
           Summary: Safari Web Extension content scripts (and
                    scripting.executeScript) won't inject into
                    about:srcdoc iframes
           Product: WebKit
           Version: Safari 16
          Hardware: Mac (Apple Silicon)
                OS: macOS 13
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit Extensions
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: guivr2011 at gmail.com
                CC: timothy at apple.com, webkit-bug-importer at group.apple.com

I was trying to convert my extension to Safari Web Extension, but there's a major problem.

Setting a content script like this in the manifest.json:

"content_scripts": [
    {
      "matches": ["<all_urls>"],
      "match_about_blank": true,
      "match_origin_as_fallback": true,
      "include_globs": true,
      "all_frames": true,
      "js": ["main.js"]
    }
  ],

Won't inject the content script into iframes without a standard URL, for example, about:srcdoc as the URL.

Example page: https://tailwindui.com/components/application-ui/forms/form-layouts
This page has iframes that for Safari are "about:srcdoc" and the content script won't get injected into them.

I've tried adding/removing match_about_blank, match_origin_as_fallback, include_globs, all_frames, nothing worked.

The same happens if you try to inject it with browser.scripting.executeScript:
browser.scripting.executeScript({
      files: ['main.js'],
      target: {
        tabId: tab.id,
        allFrames: true,
      },
    })

This won't inject the script into about:srcdoc iframes. I've also tried directly specifying the frameIds and it still doesn't work.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231028/6f615328/attachment.htm>


More information about the webkit-unassigned mailing list