Tampermonkey / tampermonkey

Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
GNU General Public License v3.0
4.2k stars 418 forks source link

Scripts don't execute on streamtape.com #2171

Open j4k0xb opened 3 weeks ago

j4k0xb commented 3 weeks ago

Expected Behavior

Execute the userscript.

Actual Behavior

Script isn't executed. This only happens for this site on brave (works on firefox). Same behavior with Tampermonkey beta.

page logs:

Navigated to https://streamtape.com/
content.js:63 content: normal start event processing for m0t2te3z.1d (1 to run)
content.js:56 env: schedule "New Userscript" for document-idle
content.js:54 env: inject "New Userscript" now
popper.min.js:4 Uncaught SyntaxError: Unexpected token 'export' (at popper.min.js:4:19713)
content.js:62 content: DOMContentLoaded
(index):292 

       GET https://mc.yandex.ru/metrika/tag.js net::ERR_BLOCKED_BY_CLIENT
(anonymous) @ (index):292
(anonymous) @ (index):292
content.js:55 env: run "New Userscript" now  (0 requires)
content.js:62 content: load

background.js logs:

mh: request  {method: 'contextmenu', url: 'https://streamtape.com/', id: 'm0t1fwoh.by'}  sender:  {id: 'dhdgffkkebhmkfjojejmpbldmpobfkfo', url: 'https://streamtape.com/', origin: 'https://streamtape.com', frameId: 0, documentId: '3B244D7883DB738B75713FCDD05FE60D', …}
background.js:744 mh: request page: undefined extpage: false
background.js:902 scriptman: determineScriptsToRun @https://streamtape.com/
background.js:1006 scriptman: @include "/^[hH][tT][tT][pP][sS]:\/\/[sS][tT][rR][eE][aA][mM][tT][aA][pP][eE]\.[cC][oO][mM](:[0-9]{1,5})?\/$/" matched (00518c35-c20a-4c7e-9484-f5a2648da1c1)
background.js:904 scriptman: determineScriptsToRun: found script  {script: {…}, cond: {…}}
background.js:786 check New Userscript for enabled:true
background.js:902 scriptman: determineScriptsToRun @https://streamtape.com/
background.js:1006 scriptman: @include "/^[hH][tT][tT][pP][sS]:\/\/[sS][tT][rR][eE][aA][mM][tT][aA][pP][eE]\.[cC][oO][mM](:[0-9]{1,5})?\/$/" matched (00518c35-c20a-4c7e-9484-f5a2648da1c1)
background.js:904 scriptman: determineScriptsToRun: found script  {script: {…}, cond: {…}}
background.js:786 check New Userscript for enabled:true
background.js:821 badge: set icon 
background.js:822 badge: set 
background.js:743 mh: request  {method: 'prepare', id: 'm0t2te3z.1d', topframe: true, url: 'https://streamtape.com/'}  sender:  {id: 'dhdgffkkebhmkfjojejmpbldmpobfkfo', url: 'https://streamtape.com/', origin: 'https://streamtape.com', frameId: 0, documentId: '49465E43944741742683B522990DBD1E', …}
background.js:744 mh: request page: undefined extpage: false
background.js:818 run script New Userscript @ https://streamtape.com/
background.js:821 badge: set icon 
background.js:822 badge: set 1
background.js:821 badge: set icon 
background.js:822 badge: set 1

Specifications

Script

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://streamtape.com/
// @icon         https://icons.duckduckgo.com/ip2/streamtape.com.ico
// @grant        none
// ==/UserScript==

console.log(location.origin);
F9y4ng commented 3 weeks ago

Turning off Brave Shields or any other adblocker can bring it back to normal, it should be a problem caused by site scripts conflicting with TM and adblocker.

j4k0xb commented 3 weeks ago

That's unfortunate... This site is infested with ads Gonna look what filter in https://github.com/uBlockOrigin/uAssets causes it

derjanb commented 3 weeks ago

You can also try to set Content Script API to UserScripts API Dynamic. By doing so the script might run earlier than uBO's injected filter snippets.

F9y4ng commented 2 weeks ago

That's unfortunate... This site is infested with ads Gonna look in what filter in https://github.com/uBlockOrigin/uAssets causes it

@j4k0xb It could be a script conflict, not related to filtering rules. And the console didn't get any useful information.

You can also try to set Content Script API to UserScripts API Dynamic. By doing so the script might run earlier than uBO's injected filter snippets.

@derjanb The UserScripts API Dynamic mode doesn't help.

BTW. TM 5.3.6209 BETA does not resolve issue #2164, Whenever the browser is updated, GM_info.userAgentData returns still the original version number in UserScripts API Dynamic mode.

j4k0xb commented 1 week ago

The same script works in Violentmonkey btw, so I think it's a Tampermonkey issue

F9y4ng commented 1 week ago

The same script works in Violentmonkey btw, so I think it's a Tampermonkey issue

Violentmonkey also has problems. You can try running the following script. The window.atob method will report an error. @j4k0xb @tophf

Script

// ==UserScript==
// @name        New script
// @namespace   Violentmonkey Scripts
// @match       https://streamtape.com/*
// @grant       unsafeWindow
// @version     1.0
// @author      -
// @description test
// @run-at      document-start
// ==/UserScript==

console.group("unsafeWindow")
console.log(unsafeWindow.atob);
console.log(unsafeWindow.atob("QQ=="))
console.groupEnd("unsafeWindow")

console.group("window")
console.log(window.atob);
console.log(window.atob("QQ=="))
console.groupEnd("window")
j4k0xb commented 1 week ago

The window.atob method will report an error.

nope it works fine image

F9y4ng commented 1 week ago

The window.atob method will report an error.

nope it works fine image

with uBlock Origin?

F9y4ng commented 1 week ago

voilentmonkey with uBO: screenshot_2024-09-24_12-24-29

tophf commented 1 week ago
  1. The order in which extensions run at document_start probably depends on which extension was installed first. If uBO runs first it mangles atob somehow. I'd say it's a bug in uBO filters, because breaking such basic functions is overly destructive.
  2. Since Violentmonkey is still MV2, a real document_start requires you to enable "Synchronous page mode" option.
F9y4ng commented 1 week ago
  1. The order in which extensions run at document_start probably depends on which extension was installed first. If uBO runs first it mangles atob somehow. I'd say it's a bug in uBO filters, because breaking such basic functions is overly destructive.
  2. Since Violentmonkey is still MV2, a real document_start requires you to enable "Synchronous page mode" option.

Hi @tophf , I already enabled "Synchronous page mode" option, but it did not work.

And I fixed it by GM_addElement to get window.atob, and thanks for your reply.