Skip to content

Commit

Permalink
Merge branch 'master' into fix/AG-21081
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamWr committed Jul 7, 2023
2 parents e288834 + c647f9a commit 71c74b5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- issue with printing unnecessary logs to the console in `log-addEventListener` scriptlet
[#335](https://github.com/AdguardTeam/Scriptlets/issues/335)
- error throwing in `prevent-fetch` and `prevent-xhr` scriptlets when a request is blocked
[#334](https://github.com/AdguardTeam/Scriptlets/issues/334)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adguard/scriptlets",
"version": "1.9.43",
"version": "1.9.44",
"description": "AdGuard's JavaScript library of Scriptlets and Redirect resources",
"scripts": {
"build": "babel-node -x .js,.ts scripts/build.js",
Expand Down
12 changes: 6 additions & 6 deletions src/scriptlets/log-addEventListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ export function logAddEventListener(source) {
const message = `addEventListener("${type}", ${listenerToString(listener)})`;
logMessage(source, message, true);
hit(source);
} else {
// logging while debugging
const message = `Invalid event type or listener passed to addEventListener:
type: ${convertTypeToString(type)}
listener: ${convertTypeToString(listener)}`;
logMessage(source, message, true);
}

// logging while debugging
const message = `Invalid event type or listener passed to addEventListener:
type: ${convertTypeToString(type)}
listener: ${convertTypeToString(listener)}`;
logMessage(source, message, true);

// Avoid illegal invocations due to lost context
// https://github.com/AdguardTeam/Scriptlets/issues/271
let context = this;
Expand Down
1 change: 1 addition & 0 deletions tests/scriptlets/log-addEventListener.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ test('logs events to console', (assert) => {
}
assert.ok(input.includes(eventName), 'console.hit input should be equal');
assert.ok(input.includes(callback.toString()), 'console.hit input should be equal');
assert.notOk(input.includes(INVALID_MESSAGE_START), 'Invalid message should not be displayed');
};

runScriptlet(name);
Expand Down

0 comments on commit 71c74b5

Please sign in to comment.