Skip to content

GM.addStyle not injecting into sub-iframes #755

Open
@ACTCD

Description

@ACTCD

It seems that in the previous resolution of related issues, only the .css file injection path was changed, but not the GM.addStyle API, which has been using tabs.insertCSS() until now.

But since allFrames, frameId is not supported by Safari, in fact we just inject it into the top frame instead of the corresponding sub-frame.

Methods using the <style> element may be blocked by CSP, and in fact there may still be no way to inject into sub-frame in this case.

The best solution at the moment is probably:

  • If it is top frame, use the tabs.insertCSS() to inject

  • If it is sub frame, use the <style> element to inject it

    • If blocked by CSP, fails and logs in console

The .css file and GM.addStyle API should share the same injection path, but the .css feature will be deprecated (#711) in favor of GM.addStyle in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstreamThis is an upstream issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions