arai-a/ditm

DITM doesn't work with URLs with ports

KwanEsq opened this issue · 0 comments

STR:

$ mkdir ditm-test 
$ cd ditm-test
$ echo 'Hello world' > test.txt
$ python -m SimpleHTTPServer 8080
  • Open localhost:8080/test.txt in Firefox
  • Open DITM
  • Select http://localhost:8080/test.txt from "Used" <select>
    • It never loads
  • Type "Goodbye world" into textarea
  • Hit save
  • Reload page
    • Content is still "Hello world"

This is because "host must not include a port number" in match patterns, but the URLs are used as-is in the listener

ditm/background.js

Lines 57 to 71 in dded760

const urls = Object.keys(files);
if (loadingURL) {
urls.push(loadingURL);
}
if (urls.length === 0) {
return;
}
await browser.webRequest.onBeforeRequest.addListener(
filterRequest,
{
urls,
},
["blocking"]
);

PR incoming.