[Webkit-unassigned] [Bug 244475] New: declarativeNetRequest in web extensions does not support regexSubstitution

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 29 00:37:08 PDT 2022


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

            Bug ID: 244475
           Summary: declarativeNetRequest in web extensions does not
                    support regexSubstitution
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Mac (Apple Silicon)
                OS: Unspecified
            Status: NEW
          Severity: Blocker
          Priority: P2
         Component: New Bugs
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: vsr4493 at gmail.com

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

-- 
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/20220829/1f1dafc4/attachment.htm>


More information about the webkit-unassigned mailing list