-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DEBUG=1 flag #2156
Add DEBUG=1 flag #2156
Conversation
@@ -75,4 +75,11 @@ module.exports = class TSUrlFilter { | |||
const result = this.engine.matchRequest(request); | |||
return result.getBasicResult(); | |||
} | |||
|
|||
matchDebug({ url, frameUrl, type }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that matchDebug()
returns something more useful than just a boolean value. In both the cases here (adblockplus and tsurlfilter) it returns the filter text.
const match = engine.match({ type: WEBREQUEST_OPTIONS[cpt], frameUrl, url }); | ||
|
||
let matchDebug = null; | ||
if (engine.matchDebug) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the engine does not implement matchDebug()
the default value is null
. In the end every engine should implement something useful.
output.push({ index, url, frameUrl, cpt, match, matchDebug }); | ||
} | ||
|
||
fs.writeFileSync(`./${ENGINE}.debug.json`, JSON.stringify(output, null, 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output is pretty so it can be used with tools like diff
.
I also have a In the end it should be possible to do this:
|
This adds a
DEBUG=1
flag.The above should generate a file called
adblockplus.debug.json
in the current directory.