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

HTML filtering not working on codingdeft.com #2656

Closed
8 tasks done
stephenhawk8054 opened this issue May 14, 2023 · 19 comments
Closed
8 tasks done

HTML filtering not working on codingdeft.com #2656

stephenhawk8054 opened this issue May 14, 2023 · 19 comments
Labels
bug Something isn't working Firefox specific to Firefox fixed issue has been addressed

Comments

@stephenhawk8054
Copy link
Member

stephenhawk8054 commented May 14, 2023

Prerequisites

  • I verified that this is not a filter list issue. Report any issues with filter lists or broken website functionality in the uAssets issue tracker.
  • This is not a support issue or a question. For support, questions, or help, visit /r/uBlockOrigin.
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • The issue is not present after disabling uBO in the browser.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.

I tried to reproduce the issue when...

  • uBO is the only extension.
  • uBO uses default lists and settings.
  • using a new, unmodified browser profile.

Description

When I use

codingdeft.com##^script

in Firefox, it does not remove the inline script in the HTML source code.


Actually I cannot remove any tag in the source code using HTML filtering on this site.

A specific URL where the issue occurs.

https://www.codingdeft.com/posts/typescript-convert-enum-to-array/

Steps to Reproduce

  1. Add codingdeft.com##^script
  2. Go to https://www.codingdeft.com/posts/typescript-convert-enum-to-array/
  3. Check the source code in view-source:https://www.codingdeft.com/posts/typescript-convert-enum-to-array/

Expected behavior

Inline scripts are removed

Actual behavior

Inline scripts are not removed

uBO version

1.49.2

Browser name and version

Firefox 113.0.1

Operating System and version

Windows 10

@stephenhawk8054 stephenhawk8054 changed the title HTML filtering not working on codingdeft.com HTML filtering not working on codingdeft.com May 14, 2023
@uBlock-user uBlock-user added bug Something isn't working Firefox specific to Firefox labels May 14, 2023
gorhill added a commit to gorhill/uBlock that referenced this issue May 14, 2023
@gwarser
Copy link

gwarser commented May 14, 2023

Is this because page explicitly specifies content-disposition: inline?

        }
        // https://bugzilla.mozilla.org/show_bug.cgi?id=1426789
        if ( headerValueFromName('content-disposition', headers) ) { return; }

        const stream = request.stream =
            browser.webRequest.filterResponseData(extras.requestId);

It is. I'm 7 minutes too late.

@gwarser gwarser added the fixed issue has been addressed label May 14, 2023
@gwarser gwarser closed this as completed May 14, 2023
@stephenhawk8054
Copy link
Member Author

Somehow HTML filtering does not work on this link: https://www.elahmad.com/tv/radiant_player.php?id=aljazeer_ar1

Can anyone else reproduce?

@peace2000
Copy link
Member

I can. E.g. this doesn't remove anything:

elahmad.com##^[content]

But works on a different page:
iltalehti.fi##^[content]

@uBlock-user
Copy link
Contributor

uBlock-user commented Jul 3, 2023

Something to do with charset being not mentioned ?

gorhill/uBlock@a3a80e3#diff-35c32f641b370cba4a5f06018c904c27241756164dfd317fa7c5698aec08c448R855

if ( charset === undefined ) { return; }

Side-note: @stephenhawk8054 for anti-adb --

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

or
*$xhr,method=head,3p,redirect-rule=nooptext,domain=elahmad.com

@mapx-
Copy link
Contributor

mapx- commented Jul 3, 2023

at least in chrome => elahmad.com##+js(rmnt, script, fetch)

does it work for you for FF ?

@uBlock-user
Copy link
Contributor

does it work for you for FF ?

No, likely due to blob: urls beings executed at late time.

@gorhill
Copy link
Member

gorhill commented Jul 3, 2023

likely due to blob: urls beings executed

rmnt scriptlet is not injected as blob:, it's injected directly as a content script. blob: is for page script.

@uBlock-user
Copy link
Contributor

it's injected directly as a content script.

So why it is failing in FF then ?

@gorhill
Copy link
Member

gorhill commented Jul 3, 2023

Still possible to have race condition. Use log, 1 to find out how many nodes were found already in the DOM when the scriptlet execution started.

@uBlock-user
Copy link
Contributor

Anyway, is the issue reported in #2656 (comment) related to lack of charset mention in Content-Type response header ?

@gorhill
Copy link
Member

gorhill commented Jul 3, 2023

I need to confirm, I can't do this right now, later today maybe.

@gorhill
Copy link
Member

gorhill commented Jul 3, 2023

When uBO doesn't detect a charset in response headers, it falls back to extracting a charset from the DOM. In the current case, the extracted charset is windows-1256, which is not supported in uBO.

@uBlock-user
Copy link
Contributor

I see, well the line I pulled out, suggested a bail-out situation like before.

@stephenhawk8054
Copy link
Member Author

Can anyone use HTML filtering on this site: https://qtoptens.com/ ?

@peace2000
Copy link
Member

I can. What are you trying to remove?

@stephenhawk8054
Copy link
Member Author

I was trying to remove admiral scripts inside while disabling current admiral domain blocking:

||muteknife.com^$badfilter
qtoptens.com##^script:has-text(engaged)

It works at first time for me, but when refreshing without bypassing cache (F5) a few times, it doesn't remove the script any more.


I figured out the cause, it's due to the service workers. When unregistering the service workers and use ||qtoptens.com^$csp=worker-src 'none', it works normally even when refreshing by F5.

@stephenhawk8054
Copy link
Member Author

stephenhawk8054 commented Sep 21, 2024

@gorhill Sorry, looks like HTML filtering is not working on https://missyusa.com/mainpage/content/index.asp. I think it's because this site is using charset=euc-kr ?

The source looks like this

<!DOCTYPE html>

<meta http-equiv="content-type" content="text/html; charset=euc-kr">

<html>
<head>

@gorhill
Copy link
Member

gorhill commented Sep 21, 2024

I think it's because this site is using charset=euc-kr ?

Yes, that is not something uBO can handle. At 0.1% usage, not something I would work on -- I already declined work for Shift JIS (can't find issue anymore in tracker).

@garry-ut99
Copy link

stephenhawk8054 : looks like HTML filtering is not working. I think it's because this site is using charset=euc-kr ?

Like already mentioned in Wiki: https://github.com/uBlockOrigin/uBlock-issues/wiki/Static-filter-syntax#html-filters:

HTML filtering will work only on pages with character encoding compatible with: UTF-8, ISO-8859-1, Windows-1250, Windows-1251 and Windows-1252 (detailed mapping).

Also here some useful related information:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Firefox specific to Firefox fixed issue has been addressed
Projects
None yet
Development

No branches or pull requests

7 participants