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

Instant Injection Mode does not work if one of the scripts requires a local file #1910

Closed
Rootkit- opened this issue Dec 3, 2023 · 10 comments

Comments

@Rootkit-
Copy link

Rootkit- commented Dec 3, 2023

image

I made an example script lol. Downgrading tampermonkey fixed it.

Expected Behavior

External files like
// @require file://W:\down\py\Tamper\jquery-3.6.1.js
// @require file://W:\down\py\Tamper\hoefunc.js
// @require file://W:\down\py\Tamper\waitForKeyElements.js

Actual Behavior

They don't load.

Specifications

Version 119.0.6045.106 (Official Build) (64-bit)

Script

(Please give an example of the script if applicable.)

// @name         !Google
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description
// @author       Hoe
// @match        https://www.google.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=google.com
// @require file://W:\down\py\Tamper\jquery-3.6.1.js
// @require file://W:\down\py\Tamper\hoefunc.js
// @require file://W:\down\py\Tamper\waitForKeyElements.js
// @require file://W:\down\py\Tamper\jquery.nicescroll.js
// @run-at  document-end
// @grant	GM_addElement
// @grant	GM_addStyle
// @grant	GM_download
// @grant	GM_getResourceText
// @grant	GM_getResourceURL
// @grant	GM_info
// @grant	GM_log
// @grant	GM_notification
// @grant	GM_openInTab
// @grant	GM_registerMenuCommand
// @grant	GM_unregisterMenuCommand
// @grant	GM_setClipboard
// @grant	GM_getTab
// @grant	GM_saveTab
// @grant	GM_getTabs
// @grant	GM_setValue
// @grant	GM_getValue
// @grant	GM_deleteValue
// @grant	GM_listValues
// @grant	GM_addValueChangeListener
// @grant	GM_removeValueChangeListener
// @grant	GM_xmlhttpRequest
// @grant	GM_cookie
// @grant	window.onurlchange
// @grant	window.close
// @grant	window.focus
// ==/UserScript==
/* globals jQuery, $, waitForKeyElements,  findpos,  GoTo,  removeThis,  clickz,  copyToClipboard,  qsit ,  containsAnyString,  containsAnyStringLower,  containsAnyTrue,  triggerEvent,  replaceVal,  addFloatButtonss,  CreateLinkButton,  waitforclickthis,  sexyclick,  ClickThis,  getInnermostHover,  RecursiveUnbind,  saveData,  appendStyleToDocument*/

var debugg = true;

waitForKeyElements ("body", wait1);

function wait1(jNode) {
	cl('LOADING')
	const a = document.createElement("div");
	a.style ="font-size:100px;"
	a.textContent = "FUCCCCCCCCCCK"
 jNode[0].append(a)
}



function ci(variable) {
    if(debugg){
		console.info(variable);
    }
}
function ce(variable) {
    if(debugg){
		console.error(variable);
    }
}
function cw(variable) {
    if(debugg){
		console.warn(variable);
    }
}
function ct(variable) {
    if(debugg){
		console.trace(variable)
    }
}
function cc() {
    console.clear();
}
function cl(variable){
    if(debugg){
        console.log(variable)
    }
}
@Rootkit- Rootkit- changed the title [Bug] 5.0 Update [Bug] 5.0 Update Local Files Dec 3, 2023
@derjanb
Copy link
Member

derjanb commented Dec 3, 2023

Requiring local files is working fine here with Tampermonkey 5.0.0 and Chrome 119.0.6045.200.

Please try to disable and re-enable local file access. Do you see errors being logged at the page or background page console?

@stanislav-atr
Copy link

Same here on Chrome 119.0.6045.199 (Official Build) (x86_64). Resetting local file permissions didn't help, but downgrading to 4.19.0 did.

Script:
// ==UserScript==
// @name AdGuard Extra Watch
// @namespace    adguard
// @version      1.0.482
// @description AdGuard Extra is designed to solve complicated cases when regular ad blocking rules aren't enough.
// @homepageURL  https://adguard.com/
// @author       AdGuard
// @require      file:///Volumes/Work/adguard-extra/build/dev/userscript/adguard-extra-debug.user.js
// @match        *://*/*
// @grant        unsafeWindow
// @run-at       document-start
// ==/UserScript==

@derjanb
Copy link
Member

derjanb commented Dec 6, 2023

Hmm, still can't reproduce. The script is loaded any executed as ususal.

Do you see a network request to the local script? Are there any errors logged at the background page console?

image

@stanislav-atr
Copy link

I do not see this request in a network tab and there are no errors on Tampermonkey's background page.

@derjanb
Copy link
Member

derjanb commented Dec 6, 2023

Do you have Instant Injection enabled?

@stanislav-atr
Copy link

@derjanb after the update, the inject mode dropped to its default value, and reverting it toInstant does not resolve the issue. Issue persists with any of the Allow scripts to access local files option values.

@derjanb
Copy link
Member

derjanb commented Dec 6, 2023

I can reproduce the issue with Inject Mode set to Instant and any script that requires a local file. In this case no script is running at all.

@derjanb derjanb added the bug label Dec 6, 2023
@derjanb derjanb added this to the 5.0 milestone Dec 6, 2023
@derjanb derjanb changed the title [Bug] 5.0 Update Local Files Instant Injection Mode does not work if one of the scripts requires a local file Dec 7, 2023
@Murka007
Copy link

Murka007 commented Dec 9, 2023

I reported about this issue 3 weeks ago, but for some reason it was closed. Good to see that it is going to be patched.
One note, if only one script require local file, it will also break execution of other scripts.

@derjanb
Copy link
Member

derjanb commented Dec 14, 2023

Should be fixed at 5.0.6191 (crx|xpi in review)

Chrome/Edge users, please download the crx file linked above and drag and drop it to the extensions page chrome://extensions (after you've enabled 'Developer Mode').
Firefox users please wait for the review being done and install the BETA version or check for BETA version updates at about:addons

For a quick fix please export your settings and scripts as zip or (JSON) file at the "Utilities" tab and import it back at the fixed BETA version.

@pilgerone
Copy link

pilgerone commented Apr 26, 2024

Version v5.1.6194 here and the bug is back, apparently.

I have a script that overrides the window.alert() function and it started to behave erratically. It only works once in every, idk, 20 page loads. Sadly I can't tell exactly when did this start cause I haven't use this particular script in a couple of months.

So I took all the scripts out from my local @ require (sorry for the accidental ping) and embedded them directly into Tampermonkey's editor and it's working perfectly.

Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants