Skip to content

Commit f842ab6

Browse files
committed
Add new scriptlet to allow blocking Amazon's apstag.js
Related issues: - NanoMeow/QuickReports#3717 - https://www.reddit.com/r/uBlockOrigin/comments/ghjqph/ The specific issue on the mentioned site is that the site's code expect `window.apstag.fetchBids` to call client-supplied function. The new scriptlet defuse this by calling the client code with an empty array.
1 parent 2b955fa commit f842ab6

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/js/redirect-engine.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ const redirectableResources = new Map([
5959
[ 'amazon_ads.js', {
6060
alias: 'amazon-adsystem.com/aax2/amzn_ads.js',
6161
} ],
62+
[ 'amazon_apstag.js', {
63+
} ],
6264
[ 'ampproject_v0.js', {
6365
alias: 'ampproject.org/v0.js',
6466
} ],
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*******************************************************************************
2+
3+
uBlock Origin - a browser extension to block requests.
4+
Copyright (C) 2019-present Raymond Hill
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see {http://www.gnu.org/licenses/}.
18+
19+
Home: https://github.com/gorhill/uBlock
20+
*/
21+
22+
// https://www.reddit.com/r/uBlockOrigin/comments/ghjqph/
23+
// https://github.com/NanoMeow/QuickReports/issues/3717
24+
25+
(function() {
26+
'use strict';
27+
const w = window;
28+
const noopfn = function() {
29+
; // jshint ignore:line
30+
}.bind();
31+
const apstag = {
32+
fetchBids: function(a, b) {
33+
if ( b instanceof Function ) {
34+
b([]);
35+
}
36+
},
37+
init: noopfn,
38+
setDisplayBids: noopfn,
39+
targetingKeys: noopfn,
40+
};
41+
w.apstag = apstag;
42+
})();

0 commit comments

Comments
 (0)