Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency: Ability to open extension pages using redirect #381

Open
lukeselker opened this issue Apr 20, 2023 · 6 comments
Open

Inconsistency: Ability to open extension pages using redirect #381

lukeselker opened this issue Apr 20, 2023 · 6 comments
Labels
follow-up: safari Needs a response from a Safari representative inconsistency Inconsistent behavior across browsers topic: dnr Related to declarativeNetRequest

Comments

@lukeselker
Copy link

Hi all!

When using Declarative Net Request to handle extension redirects, I'm having an inconsistency between browsers when using a callback url to open the extension. In chrome, this redirect to a chrome-extension://<extension-id> url functions properly, but in safari, the redirect to a safari-web-extension://<extension-id> url is being blocked with the following error:

Redirection to URL with a scheme that is not HTTP(S)

Is there a way for this to be handled consistently across browsers? I understand the reasoning behind only allowing https/http redirects, but it seems that safari-web-extension scheme should also be an allowed scheme for redirects.

@sammacbeth
Copy link

For this use-case you have to use extensionPath instead of url in Safari, i.e:

action: {
   type: "redirect",
   redirect: {
    extensionPath: "/image.png",
  }
}

Here's a full example: https://github.com/duckduckgo/mv3-compat-tests/blob/main/Shared%20(Extension)/Resources/tests/test.declarativeNetRequest.js#L274-L278

@lukeselker
Copy link
Author

lukeselker commented Apr 21, 2023

Thanks @sammacbeth, but this doesn't allow us to do regexSubstitution when using a redirect to an extension page.

@dotproto dotproto added inconsistency Inconsistent behavior across browsers follow-up: safari Needs a response from a Safari representative topic: dnr Related to declarativeNetRequest and removed needs-triage labels Apr 27, 2023
@lukeselker
Copy link
Author

@xeenon let me know if you need me to open a bug in https://bugs.webkit.org/ for this 👍

@xeenon
Copy link
Collaborator

xeenon commented Apr 27, 2023

@lukeselker Feel free, thanks!

@lukeselker
Copy link
Author

Looks like someone just opened a bug today for this exact issue -> https://bugs.webkit.org/show_bug.cgi?id=256054

@tophf
Copy link

tophf commented May 6, 2024

A possible solution is to allow regex substitutions \0 \1 etc. inside extensionPath when regexFilter is present. There'll be an additional benefit in case #604 is solved: no need to expose the target in web_accessible_resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
follow-up: safari Needs a response from a Safari representative inconsistency Inconsistent behavior across browsers topic: dnr Related to declarativeNetRequest
Projects
None yet
Development

No branches or pull requests

5 participants