1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-04 10:09:38 +02:00
Commit Graph

104 Commits

Author SHA1 Message Date
Raymond Hill
ee83a4304a
Isolate DOM inspector layers from page context
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/1411

Additionally, refactored communication mechanism between content
script contexts and uBO contexts by using MessageChannel/BroadcastChannel
web APIs.
2023-12-03 16:21:32 -05:00
rajiv
a8cf08325d
Add enableLazyLoad function
see https://developers.google.com/publisher-tag/reference#javascript_16

Fixes https://github.com/uBlockOrigin/uAssets/issues/20988
2023-12-01 02:20:40 -05:00
Raymond Hill
bd8a91ed3a
Add support to redirect to noop.json
There ar ea couple of AdGuard filters supporting this local
resource.

Reference:
https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#noopjson
2023-11-16 09:54:21 -05:00
Dave Vandyke
c1d8f5908d
More improvements to the google-ima shim script (#3908)
We have enabled the google-ima shim script again in the DuckDuckGo
Privacy Essentials browser extension, and found a couple more issues:
- Some websites set the enablePreloading[1] option, which should
  cause[2] the AdsManager.init() method to trigger the LOADED AdEvent
  to fire. If the event doesn't fire, those websites can get stuck
  waiting for the event forever.
- When AdsManager.start() method is called, a bunch of events are
  dispatched in order, to simulate ads loading, playing and
  finishing. There was a mistake in that logic though. The
  CONTENT_PAUSE_REQUESTED and CONTENT_RESUME_REQUESTED events[3]
  should fire as the ads start and finish respectively. By firing the
  latter early, and skipping the former, some websites got confused
  and tried to display ad overlays at the same time as playing their
  content, or didn't display they content at all.

1 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdsRenderingSettings#enablePreloading
2 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/preload#timing
3 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdEvent
2023-11-16 09:41:07 -05:00
Dave Vandyke
0fa30a73c5
Further improve google-ima shim script (#3900)
I worked through some of the websites listed in the google-ima shim
script issue[1], to see what was going wrong. It turned out the
addEventListener method supports an optional context Object, which is
bound to the listener if provided. Some websites make use of that,
and then break when `this` is not bound correctly when events are
dispatched.

See also https://github.com/duckduckgo/tracker-surrogates/pull/24

1 - https://github.com/uBlockOrigin/uBlock-issues/issues/2265
2023-10-25 12:00:21 -04:00
Dave Vandyke
b445f4f4cd
Improve google-ima shim script (#3899)
We made use of the google-ima shim script from uBlock in the
DuckDuckGo Privacy Essentials extension recently, but found a few
issues with website breakage. After debugging and fixing those[1], I
thought it would be worth sharing the improvements back again. Issues
we ran into:

- The AdDisplayContainer[2] constructor usually creates some DOM
  elements inside the given container. They are all nested within a
  DIV and some websites break when at least that top DIV element isn't
  created.
- While not documented (that I could see), the event listeners can be
  added using an array of event types. Some websites make use of that
  and then hang forever when the expected events aren't fired. This
  caused videos not to play on some websites.
- The Ad.prototype.getUniversalAdIds()[3] method should return an
  array of UniversalAdIdInfo Objects, instead of an Array of
  strings. When an array of strings are returned, some websites then
  break when the UniversalAdIdInfo's methods are missing.
- The UniversalAdIdInfo.prototype.getAdIdValue()[4] method had a typo
  in the name ("getAsIdValue") and was effectively missing. That
  caused some websites to break when the missing method was called.
- The google.ima.OmidVerificationVendor[5] Object was missing, which
  broke some websites that attempted to access it.

1 - 52f2999523
2 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdDisplayContainer
3 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.Ad#getUniversalAdIds
4 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.UniversalAdIdInfo#getAdIdValue
5 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima#.OmidVerificationVendor
2023-10-24 11:16:14 -04:00
Raymond Hill
02c7b32bef
Improve google-ima.js surrogate
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2265
- https://github.com/uBlockOrigin/uAssets/issues/19981
2023-10-07 12:27:03 -04:00
Raymond Hill
7bcc340ab0
Add commented keywords to googlesyndication_adsbygoogle.js scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2773
2023-08-10 09:54:58 -04:00
Raymond Hill
3c609793fd
Improve fingerprint2.js scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2741
2023-08-09 09:28:05 -04:00
Raymond Hill
ee0649329c
Remove obsolete web_accessible_resources
Add removed resource as an alias of `no-window-open-if.js`.

Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/19002#issuecomment-1638367659
2023-07-18 09:39:06 -04:00
Raymond Hill
cdf385f5f4
Add missing (deprecated) method to google ima
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2265#issuecomment-1637094149
2023-07-16 11:23:31 -04:00
Raymond Hill
ec06981965
Improve compatibility with AdGuard's scriptlets
Related:
https://testcases.agrd.dev/Filters/scriptlet-rules/test-scriptlet-rules.html
2023-07-11 18:25:21 -04:00
Raymond Hill
7184f93cb0
Return empty array instead of undefined
Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/18649
2023-06-23 20:42:58 -04:00
Raymond Hill
0bd4b600cf
Rework nowoif scriptlet
New official name: `no-window-open-if`.

The pattern will now be matched against all arguments passed
to `window.open()`: all the arguments are joined as a single
space-spearated string, and the result is used as the target
for matching the pattern.

To enable logging, used the extra parameters approach, i.e.
`log, 1`, which should come after the positional arguments
`pattern`, `delay`, and `decoy`.
2023-06-17 11:53:08 -04:00
Raymond Hill
3b14fd915a
Fix cloud storage widget not showing (regression)
Related feedback:
- 50afd5ae38 (commitcomment-108294887)
2023-04-10 10:03:51 -04:00
Raymond Hill
a60a5c2772
Fix wrong syntax color highlight in "Trusted sites" pane
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2521
2023-03-02 20:50:32 -05:00
Raymond Hill
33c437f99f
Add source code viewer (from logger)
This commits add the ability to open html/css/script
resources from the logger, as a formatted and syntax-
highligthed document.

The goal is to make it easier for filter list authors to
investigate filter-related issues.
2023-03-01 11:04:40 -05:00
Raymond Hill
4564e3a9b8
Add redirectable resource noop.css, as suggested
Related feedback:
- https://github.com/uBlockOrigin/uAssets/issues/16391#issuecomment-1396316194
2023-01-23 16:39:46 -05:00
Raymond Hill
f596559103
Add options stub to nofab scriptlet
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/16010

Related AdGuard commit re. `prevent-fab-3.2.0`:
- 3bfb9b39e9
2022-12-15 13:12:37 -05:00
Raymond Hill
feaa338678
Code maintenance: replace uDom.js with dom.js
`uDom` is old and crusty and `dom` is meant as replacement. The
goal of `dom` is to be simpler and mainly just convenience
methods for handling the DOM with vanilla JS -- this is not a
framework.

Additionally, removed keyboard shortcuts pane which was useful
only on very old versions of Firefox.
2022-11-12 09:51:22 -05:00
Raymond Hill
fb4059d11c
Add missing API method in neutered resource 2022-10-24 09:11:02 -04:00
Raymond Hill
5a9cd724ca
Add missing method to neutered api 2022-10-15 14:46:12 -04:00
Raymond Hill
115f7bb687
Fix operator token-to-ctor map
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2294
2022-09-26 22:27:50 -04:00
Raymond Hill
e31637af78
[mv3] Add ability to enable/disable filter lists 2022-09-13 17:44:24 -04:00
Raymond Hill
067e128163
Patch google-ima shim script for proper integration into uBO
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2158

Additionally, added firing of CONTENT_RESUME_REQUESTED event in
start() method.
2022-09-11 11:03:47 -04:00
Raymond Hill
b6b6e49d57
Add original Firefox-authored google-ima shim script
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2158
2022-09-11 10:54:54 -04:00
Emilio Cobos Álvarez
4044aa182a
element-picker: Declare we support both light and dark color-schemes. (#3872)
This fixes https://github.com/uBlockOrigin/uBlock-issues/issues/2240 and
should get the desired behavior regardless of browser.

Delay showing the iframe until load to prevent flashing a white
background on the initial about:blank.
2022-09-11 07:34:29 -04:00
Raymond Hill
04114942aa
Add missing method to shim script
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2225
2022-08-21 12:54:02 -04:00
Raymond Hill
c521479ef9
Add 0.5s mp3 redirectable resource
Command used to generate 0.5s mp3 file:

ffmpeg -ar 48000 -t 0.5 -f s16le -acodec pcm_s16le -ac 2 -i /dev/zero -acodec libmp3lame -aq 4 noop-0.5s.mp3

Related filter issue:
- https://github.com/uBlockOrigin/uAssets/issues/14231
2022-08-14 13:06:00 -04:00
Raymond Hill
e62604f889
Add queue-related initialization code to AMZN shim script
This would render obsolete the AMZN-related exception at the
following URL:

https://play.mylifetime.com/shows/married-at-first-sight/season-15/episode-1

And possibly lower the likelihood of breakage on other sites.
2022-08-05 11:26:23 -04:00
Raymond Hill
313d694040
Add missing method to outbrain surrogate script
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/13834
2022-06-25 11:06:05 -04:00
Raymond Hill
ef25f30b30
Squashed commit of the following:
commit 34a290bdd62013591b17efbd2320698b95925c00
Author: Yuki2718 <58900598+Yuki2718@users.noreply.github.com>
Date:   Mon Feb 7 19:14:02 2022 +0900

    update last commit

commit f34ffbcc3d78bc98ee43b015f0ad0dae9d99720e
Author: Yuki2718 <58900598+Yuki2718@users.noreply.github.com>
Date:   Mon Feb 7 19:05:17 2022 +0900

    Improve and rename canrunads.js

Related issue:
- https://github.com/AdguardTeam/Scriptlets/issues/190

Related commit:
- e8bfc9a031
2022-02-07 07:05:44 -05:00
Raymond Hill
e44768f5d3
Ensure click2load.html widget is dark-theme aware
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/1963#discussioncomment-2117460
2022-02-05 13:34:48 -05:00
Raymond Hill
ecb73d2ff5
Bring dark theme out of experimental status
Too many changes to list here, essentially there is now a
user interface setting to enable/disable dark theme, and
I've rearranged a bit the Settings pane as a result and
also altered other visuals in various places.

There are places which I know have not been thoroughly
tested (i.e. logger inspector).

Will fine-tune as per feedback.

Issues with the classic popup panel will not be addressed,
and if feedback is that it has become unusuable, it will be
outright removed.
2022-02-02 15:40:47 -05:00
Raymond Hill
4ee8a5948d
Work toward bringing dark theme closer to a stable release
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/401
2022-01-30 18:35:26 -05:00
Raymond Hill
e8bfc9a031
Add canrunads.js as redirectable resource
Related discussion:
- 036e13101e (commitcomment-65068100)
2022-01-29 08:40:47 -05:00
Raymond Hill
a5ca565e9c
Add hashComponents() to FingerprintJS v3 shim
Related feedback:
- f4824bd0d9 (commitcomment-64534458)
2022-01-28 09:26:57 -05:00
Raymond Hill
fba680f9ab
Improve google-analytics shim
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/11456
2022-01-24 12:26:24 -05:00
Raymond Hill
f4824bd0d9
Add shim for FingerprintJS (aka Fingerprint v3)
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/11408
2022-01-21 08:38:48 -05:00
Raymond Hill
fb0de0cc9c
Wait for placeholders to be present
Related issue:
- https://www.reddit.com/r/uBlockOrigin/comments/rgxlda/adblock_detected/

Related discussion:
- 137070f226 (commitcomment-61964299)
2021-12-15 09:08:04 -05:00
Raymond Hill
d17d634b7c
Define new nobab scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1863

As per internal discussion with team, best to have a simpler
scriplet, and which is hard-coded to work only on a specific
set of domains -- only those seen used by BAB.
2021-12-08 12:10:18 -05:00
Raymond Hill
92ad101557
Update nobab.js scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1863

As discussed internally with uBO filters team.
2021-12-08 10:24:03 -05:00
Raymond Hill
64f427d0e5
Have getAll() returns at least one neutered Tracker object
Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/10731#issuecomment-986031354
2021-12-04 11:07:19 -05:00
Raymond Hill
374d4800e5
Arrow functions are not instanceof Function
But their `typeof` is `function`, so use this instead to
detect whether an argument is a function which can be
called.

Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/qyx7en/
2021-11-21 11:19:12 -05:00
Raymond Hill
3b53c3a3e3
Further improve GA's surrogate script
Related issue:
- https://github.com/AdguardTeam/Scriptlets/issues/154

Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1807
2021-11-09 15:18:30 -05:00
Raymond Hill
6f49e079db
Improve GA's surrogate script
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1807
2021-11-09 13:20:49 -05:00
Raymond Hill
33a18c3a1e
Convert fingerprint2.js scriptlet into a redirectable resource
As per internal discussion with volunteer filter list
maintainers.
2021-09-18 10:55:22 -04:00
Raymond Hill
3488e6d5ba
Merge branch 'master' of https://github.com/gorhill/uBlock into 1664 2021-07-29 08:54:48 -04:00
Raymond Hill
ee0b2c2fa4
Do not truncate datalayer
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1671

Regression from:
- 0dbe581c5b
2021-07-28 12:45:03 -04:00
Raymond Hill
22022f636f
Modularize codebase with export/import
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664

The changes are enough to fulfill the related issue.

A new platform has been added in order to allow for building
a NodeJS package. From the root of the project:

    ./tools/make-nodejs

This will create new uBlock0.nodejs directory in the
./dist/build directory, which is a valid NodeJS package.

From the root of the package, you can try:

    node test

This will instantiate a static network filtering engine,
populated by easylist and easyprivacy, which can be used
to match network requests by filling the appropriate
filtering context object.

The test.js file contains code which is typical example
of usage of the package.

Limitations: the NodeJS package can't execute the WASM
versions of the code since the WASM module requires the
use of fetch(), which is not available in NodeJS.

This is a first pass at modularizing the codebase, and
while at it a number of opportunistic small rewrites
have also been made.

This commit requires the minimum supported version for
Chromium and Firefox be raised to 61 and 60 respectively.
2021-07-27 17:26:04 -04:00