Skip to content
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

Update scriptlets from upstream (as of November 2020) #272

Closed
JustOff opened this issue Oct 20, 2020 · 3 comments
Closed

Update scriptlets from upstream (as of November 2020) #272

JustOff opened this issue Oct 20, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request fixed

Comments

@JustOff
Copy link
Collaborator

JustOff commented Oct 20, 2020

Related sources:

@JustOff
Copy link
Collaborator Author

JustOff commented Oct 20, 2020

See also: #228 (comment)

@JustOff JustOff self-assigned this Oct 20, 2020
@JustOff JustOff changed the title Update scriptlets from upstream (as of October 2020) Update scriptlets from upstream (as of November 2020) Nov 14, 2020
@JustOff
Copy link
Collaborator Author

JustOff commented Dec 14, 2020

Here is the version to test: uBlock0_1.16.4.27b4.firefox-legacy.xpi.zip. Rename to xpi, install and purge all caches.
The scriptlets are upstream synchronized as of December 12th, remote update disabled.

I have installed this version in my main browser and going to release it by the end of the week if everything is ok.

@JustOff JustOff added the enhancement New feature or request label Dec 14, 2020
JustOff referenced this issue Dec 21, 2020
When a 3rd argument was provided, the scriplet would
log information related to window popup operations,
regardless of the value of the argument.

The 3rd argument is now parsed in a formal manner. It
is meant to be one or more space-separated tokens which
are used to fine tune the behavior of the scriptlet.

Tokens:

log:
  Cause the scriptlet to log information regarding
  how window.open() is used by the page on which the
  scriptlet is used. Useful only to filter creators.

obj:
  Use an `object` element instead of `iframe` element
  (default) as a decoy to be used in place of a popup
  window, when the page requires a valid `window`
  instance to be returned.
JustOff referenced this issue Dec 21, 2020
Returns proxied self is no window object can
be returned.
JustOff referenced this issue Dec 21, 2020
Related issue:
- uBlockOrigin/uAssets#5132

The change in this commit make it so that it's no
longer required to have an exception filter for
`google-analytics.com/analytics.js` for the page to
render properly.
JustOff referenced this issue Dec 21, 2020
Add support for specially-named properties:

`[]`, to iterate through all elements in an array, in
order to deal more graciously with cases where the
property to remove is an element in an array. An
actual case:

    +js(json-prune, playlist.movies.0.adserver playlist.movies.1.adserver ...)

Can be now converted to:

    +js(json-prune, playlist.movies.[].adserver)

`*`, to iterate through all own properties of an object,
in order to deal with random-named properties. For
example (not an actual case):

    +js(json-prune, playlist.*.adserver)

Where `adserver` would be a property member of an
object which is itself a property of `playlist`, but
which name is unknown or is variable.
JustOff referenced this issue Dec 21, 2020
Reported internally by team.

Explicit conversion was causing an exception to be
thrown when the type argument was not supporting
`toString()`, for example when `type` argument was
literal `null`.
JustOff referenced this issue Dec 21, 2020
Related issues:
- uBlockOrigin/uBlock-issues#156
- uBlockOrigin/uBlock-issues#1162

Take into account that a trapped property may have been
already trapped, and if so honour previous trapper
getter/setter.
JustOff referenced this issue Dec 21, 2020
Work around this issue by using more reliable
Object.keys().
JustOff referenced this issue Dec 21, 2020
This new scriplet has become necessary as a
countermeasure to new bypass mechanisms by
some websites, as discussed with filter list
maintainers.

Also related discussion:
AdguardTeam/Scriptlets#82

Scriptlet: abort-on-stack-trace

Alias: aost

Argument 1:
  The property to trap in order to launch the
  stack trace matching code, ex. Math.random

Argument 2:
  The string (needle) to match against the stack
  trace. If the empty string, always match. There
  is a special string which can be used to match
  inline script context, <inline-script>.

Argument 3:
Whether to log, and if so how:
  Empty string: do not log
  1: log stack trace for all access to trapped
     property
  2: log stack trace for defused access to trapped
     property
  3: log stack trace for non-defused access to
     trapped property
JustOff referenced this issue Dec 21, 2020
Related feedback:
- uBlockOrigin/uBlock-issues#156 (comment)

When the client code assigned a variable to itself, this
would cause the scriptlet to try to re-trap already
trapped properties.
JustOff referenced this issue Dec 21, 2020
The new scriptlet allows to defuse calls to fetch() by returning
a promise which always resolve to an empty response.

There is only one argument, which is a space-separated list
of conditions which must be ALL fulfilled in order for the
defusing to take place.

Each condition is a pair of property name and property value
separated by a column. Valid property names are those
documented as valid `init` options:

https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch

The URL of the fetch() is a special case and does not have to
be associated with a property name. Example of usage:

  ...##+js(no-fetch-if, method:HEAD)

Which means: defuse the call to fetch() if there is an
explicit option which contains `HEAD`. Another example:

  ...##+js(no-fetch-if, adsbygoogle.js)

Which means: defuse the call to fetch() if the URL contains
`adsbygoogle.js`. Multiple conditions can be provided:

  ...##+js(no-fetch-if, adsbygoogle.js method:HEAD)

If at least one condition does not match, the defusing will
not take place.

The string against which to match can be a literal regular
expression:

  ...##+js(no-fetch-if, /adsbygoogle.js$/ method:/HEAD|POST/)
JustOff referenced this issue Dec 21, 2020
When no-fetch-if scriptlet is used without argument, the
parameters passed to no-fetch-if will be output to the
console, as `uBO: fetch([...list of arguments...])`.
@JustOff JustOff closed this as completed Dec 21, 2020
@JustOff JustOff added the fixed label Dec 21, 2020
@krystian3w
Copy link

krystian3w commented Jun 24, 2022

gorhill/uBlock@9d81b7c

Maybe update from 2020 still have bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed
Projects
None yet
Development

No branches or pull requests

2 participants