Quote
siria
Thanks for all the details! Will have to take a closer look just not today anymore.
I still can't quite believe that sandbox theory, at least regarding KM1.x, since in my experience injectJS really seems to toggle the GLOBAL pref on-off.
Internally, I don't know. The test on 1.x is very simple (note, I haven't tested, but maybe after post I do). Just create a macro that injects this:
function mytestfunction(){
alert('hello');
}
Create another macro that injects the following script:
mytestfunction();
Test with and without JavaScript enabled. If you see the alert, there you are.
On 1.x I can't confirm anything because back then I didn't use injectjs as I do now.
Only tell that I have kind of a personal API that then is called from other macros injections (at any time) and it works (with and without JS enabled) tells me what I told you before, that injectjs works in another environment. Interacts with the page, but it is always accessible.
EDIT: I CONFIRM THE injectJS BEHAVIOUR WORKS THE SAME ON
1.X 1.6, to avoid confusions, with the code above and even JS disabled. As I said, it is kind of a sandbox where you can interact with other scripts already loaded with injectJS.
Quote
siria
Quote
To let people understand what happens:
- open a page with javascript enabled which runs something
- toggle js off in the window/tab that rendered that page with pageToggleJS
- script stops
- go to another window/tab and toggle javascript globally with navToggleJS
- script in original window/tab will continue running
Sounds like a PAUSE function, not a full STOP function....
Yes. The deal, and what I initially reported to Dorian was that from 74.x (or was called 24.x?) toggling the pref didn't stop the scripts execution.
Then Dorian came with pageToggleJS that stops them on the current window/tab and navToggleJS that stops on all windows/tabs.
Quote
siria
The big question is:
- open a page with javascript OFF
- go to another window/tab and toggle javascript globally with navToggleJS
- script in original window/tab => ...??....
Will THIS start running or not??
No, if you open a window/tab without JavaScript, it won't happen anything.
This is told in the linked posts I made back 5 years ago.
When you have JS initially enabled, anything would run. pageToggleJS and navToggleJS than come to the help, as switching the pref did nothing since 74.x.
When you don't, nothing happens. It is just disabled
Quote
siria
Quote
JohnHell
I'd need a way to populate that to all windows/tabs, as going back to toggle the javascript.enabled preference happens what I described 5 years ago, that that didn't actually stop scripts execution. Only navToggleJS does it globally, when the pages are loaded with javascript enabled
Don't know about you, but I sure only need a global STOP, never a global ENABLE JS.
So... am I guessing (hoping) this right that navToggle follows the pref??
1) pref is ON
2) fire navToggleJS => sets pref OFF? (+stops everything)
3) fire togglepref, or setpref ON again (no effect for already loaded pages)
4) fire navToggle => ....
??....
Hopefully AGAIN sets it OFF?
If true (?), then I'd make the JS-Button simply check the global pref first:
- OFF > ON: fire setpref-ON and confirm("Start JS in current page now?")=pageEnableJS
- ON > OFF: stop either current page or all (whatever preferred)
Looks like that JS stuff now requires
2 JS-buttons, depending on user intentions:
For global toggle and for page-toggle...
at least 2 OFF-buttons...
Then again - the JS-Page-button can never show the current state anyway??
And Global-JS-button has nothing to do anymore with already open tabs either, only for future pages?
Boah, what a mess... completely useless now as state incidators...
No. I already tried to toggle, instead navToggleJS, the pref javascript.enabled. But then happens what I reported 5 years ago, that javascript.enabled doesn't stop the scripts from running. Only navToggleJS and pageToggleJS.
But, obviously, if you use the preference, despite it doesn't stop the script from running, it doesn't wake up the script of the window/tab where you loaded content with javascript enabled but used pageToggleJS to stop them. The only one that resets that window/tab is navToggleJS.
Quote
siria
And starting to wonder about KM7X users, how many may be aware that JS-toggle has become so dangerous now... no one ever mentioning anything about JS-probs since ever... or perhaps finding completely normal that toggling JS loads all scripts in ALL open tabs instantly...? Or... perhaps just dropping the brower when (if) noticing such probs? Or... perhaps there are now PageToggle functions added in the GUI somewhere..??
Hmm... or they don't have any PAGE-toggle anyway, and navToggleJS perhaps does not start ALL scripts only those which were already loaded before, in THAT case that would pretty much eliminate all differences to KM1.x.... if I guess it right? No idea, just a theory.
I don't think there is much people out there using them XD
I wouldn't say dangerous but originally misleading. Should have been stated, and maybe is somewhere, that pageToggleJS is reset back.
Hey, I may found myself whenever I created that "add-on" to the toggler that restored pageToggleJS, but at that time I didn't think about it happening on all windows/tabs. Probably because I'm not of using too many windows (I'm not user of tabs, actually, but it happens the same on tabbed browsing, but on tabs could even be forgiven as even they work on different contexts, they are on the same window).
Quote
siria
Just wondered what exactly the PrivBar button does now in KG74, and main.kmm has:
pref_ToggleJavaScript{
id(navToggleJS); &_pref_SyncButtons;
And PrivBar button in toolbars.cfg:
!JavaScript{
navToggleJS|&Privacy
The indicators works, as the button indicators are based on the preference and the preference is toggle with togglepref and navToggleJS.
Quote
siria
=> so it's always behaving as you described above: toggling ON fires all scripts in all tabs!
Frankly, who'd need THAT? A global killer button, yes sure, but a global JS-starter? Find that completely useless, even for JS-fans. And what good are separate JS-settings for single pages, if users still find only a GLOBAL toggle?? And a lot more dangerous as before?
Yep (bolded) that's the point!! But beyond that, that the preference on 1.x probably did the same, not toggle back when was explicitly told to a window/tab to pageToggleJS.
Quote
siria
Quote
(NB: Would prefer to find this in Dev chapter, instead of getting lost in Wide "General" Ocean ;-)
Of course I just meant to move the FORUM topic ;-)
Maybe more to bugs..., or fill a bug, but for now I think it is fine here. Don't call bug what it is a feature XD
Quote
anonymous
@JohnHell
>script in original window/tab will continue running
Do javascript clocks continue running in your beta?
I'm on 75.0, no beta, but it also does the same on latest K-meleon 76 on Goanna build by roytam. And so may happen on 76RC as they are based on it.
By clocks... what do you mean? Clocks usually have a setInterval and I already told above that setInterval status, this is running, get reset despite the pageToggleJS that stopped them.
(SORRY FOR ALL EDITS too long post XD)
Edited 7 time(s). Last edit at 10/15/2020 04:06PM by JohnHell.