| Summary: | declarativeNetRequest in web extensions does not support regexSubstitution | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | vsr4493 |
| Component: | WebKit Extensions | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Blocker | CC: | achristensen, luke.selker, timothy, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari Technology Preview | ||
| Hardware: | Mac (Apple Silicon) | ||
| OS: | Unspecified | ||
Scope: Safari web extensions API: declarativeNetRequest Issue: Unexpected behaviour / missing functionality when calling updateDynamicRules() Hi, just wondering if there has been any investigation into this issue now that there is more support being published for Declarative Net Request. I'm still seeing the issue in version 16.4 This should wor in Safari Technology Preview. It has not shipped in Safari yet. Thanks Timothy! I was able to confirm this is working in Safari Technology Preview. Do you have details on when Safari Technology Preview Releases get merged into production? Closing this as I see this was included in Technology preview and will likely be out soon on Safari stable. Thanks! |
Was looking into usage for declarativeNetRequest permission to configure redirects. Expected behaviour: We should be able to add a dynamic redirect rule with a regexFilter and a regexSubstitution for the action. Current behaviour: we get an error message that reads "`redirect` is missing either a `url`, `extensionPath`, or `transform` key" implying that regex substitution is not supported. Sample payload: ``` browser.declarativeNetRequest.updateDynamicRules({ addRules: [ { action: {redirect: {regexSubstitution: "https://www.somesite.com/\\1"}, type: "redirect"}, condition: {regexFilter: ".*?://test/(.*?)", resourceTypes: ["main_frame"]}, priority: 1, id: 1, } ]}) ``` Other notes: - Looking at these i see regexSubstitution should be supported, but i'm unable to determine where this pre-emptive check is happening: https://github.com/WebKit/WebKit/blob/dd956d5e74249681ddf904e0bbe401f308b65e0f/Source/WebCore/contentextensions/ContentExtensionActions.cpp#L302 https://github.com/WebKit/WebKit/blob/2414d35395c931a94b7b8cedf131a2ca17fd8566/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp#L3103