RESOLVED FIXED 244475
declarativeNetRequest in web extensions does not support regexSubstitution
https://bugs.webkit.org/show_bug.cgi?id=244475
Summary declarativeNetRequest in web extensions does not support regexSubstitution
vsr4493
Reported 2022-08-29 00:37:08 PDT
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
Attachments
vsr4493
Comment 1 2022-08-29 00:37:58 PDT
Scope: Safari web extensions API: declarativeNetRequest Issue: Unexpected behaviour / missing functionality when calling updateDynamicRules()
Radar WebKit Bug Importer
Comment 2 2022-09-05 00:38:16 PDT
luke.selker
Comment 3 2023-04-18 14:12:01 PDT
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
Timothy Hatcher
Comment 4 2023-04-20 10:54:13 PDT
This should wor in Safari Technology Preview. It has not shipped in Safari yet.
luke.selker
Comment 5 2023-04-25 05:22:40 PDT
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?
vsr4493
Comment 6 2023-05-22 07:04:57 PDT
Closing this as I see this was included in Technology preview and will likely be out soon on Safari stable. Thanks!
Note You need to log in before you can comment on or make changes to this bug.