DNR Redirect Rule Won’t Redirect to Extension Path

DNR rules redirecting to an extension path lead to an error page: “Safari can’t open the page. The error is: “The operation couldn’t be completed. (NSURLErrorDomain error -1008.)” (NSURLErrorDomain:-1,008).”

Here is a demo extension that replicates the bug: https://github.com/lenacohen/Safari-Test-Extensions/tree/main/dnr-extension-path-redirect

This is an example of a redirect rule that leads to an error page instead of the extension path page:

chrome.declarativeNetRequest.updateDynamicRules({addRules: [
    {
        id: 2,
        priority: 1,
        action: {
          type: "redirect",
          redirect: {
            extensionPath: "/web_accessible_resources/test_redirect.html"
          }
        },
        condition: {
            urlFilter: "||washingtonpost.com^",
            resourceTypes: [
                "main_frame"
            ]
        }
      }
]});

The extension path is included in web_accessible_resources in the extension manifest:

      "web_accessible_resources": [{
        "resources": [
          "web_accessible_resources/test_redirect.html"
        ],

I also submitted a bug report on Apple's Feedback Assistant: FB16607632

DNR Redirect Rule Won’t Redirect to Extension Path
 
 
Q