Open F9y4ng opened 1 month ago
The problem is re-configuration of the injected userScripts takes time. So I think you can only have real @run-at document-start
at the cost of this re-configuration or a slightly delayed document-start
with just happened storage changes.
GM.getValue
will soon make this re-configuration unnecessary, at the cost of a delay when retrieving config values.
However, I'll double check if I can do anything to mitigate the problem...
Before you solve this problem fundamentally, I came up with a temporary method to extend the waiting time of GM Value and then refresh the page, e.g.
function reload() {
setTimeout(() => location.reload(), 200);
}
Judging from the test results, it seems to temporarily solve some problems. However, I'm not sure if it still works in other scenarios.
@derjanb I found a similar problem in UserScripts API Dynamic
mode. After turning off a script in the extension drop-down menu, it needs to be manually refreshed to take effect. I think this is also a cache issue.
What needs to be refreshed manually?
Toggling a script is working fine here. Disable the script -> reload the page -> script is gone -> enable the script -> reload the page -> the script is running.
I tested TM5.2.2 and TM5.3.6204 on chrome and brave respectively and both reproduce the problem as shown:
Do you use the "Auto reload pages" option?
Do you use the "Auto reload pages" option?
Yes.
And in UserScripts API
mode it works fine, but in UserScripts API Dynamic
mode not.
Ah, I see. Thanks.
Hi @derjanb, In UserScripts API Dynamic
mode, toggling "Enabled" in the extension drop-down menu will not make the settings take effect, even if refresh the page manually.
I think it's the same caching issue.
In
UserScripts API Dynamic
mode, toggling "Enabled" in the extension drop-down menu will not make the settings take effect, even if refresh the page manually.
Chrome 126.0.6478.183 and TM5.2.2/TM5.3.6204
But it is normal in UserScripts API
mode.
Thanks for fixing the issue.
[ ] A problem with the injection cache of GM Value in UserScripts API Dynamic mode, re-configuration of the injected userScripts takes time. (Can be temporarily fixed via userscript, but expect to fix it fundamentally.)
[x] In UserScripts API Dynamic mode, Toggling a script in the extension drop-down menu, it needs to be manually refreshed to take effect. (fixed at 5.3.6205)
[x] In UserScripts API Dynamic mode, Toggling "Enabled" in the extension drop-down menu will not make the settings take effect, even if refresh the page manually. (fixed at 5.3.6205)
Actual Behavior
Someone reported an ISSUE to me, regarding the problem that the page refreshed after the script dropdown menu operation was invalid.
After testing, I found that there was a problem with the injection cache of GM Value in
UserScripts API Dynamic
mode, which should be the same as the cache problem I reported #1899 in Violentmonkey nearly a year ago.When some sites (such as: www.ithome.com) contain the following
<meta>
tags,GM_getValue
will always get an expired cached value, which is wrong.Specifications
Script
(Please give an example of the script if applicable.)