Development :  K-Meleon Web Browser Forum
K-Meleon development related discussions. 
Riddling... Questions for experts (dev skills)
Posted by: siria
Date: August 02, 2018 07:29PM

Regarding site-specific useragents with the native Mozilla method: since roytam's Goanna builds those are finally fixed and working, but of course only in newest KM-builds. But many people still use older versions for various reasons (among them slightly complicated/confusing update methods), and it would be nice if they could fix their own older KM7x versions too. It seems possible, and I'd like to add a note how to self-help in the useragents2018 macro.
This tip seems to work - just unsure how to get it permanently installed:

http://kmeleonbrowser.org/forum/read.php?19,146141
Quote
anonymous
Site specific overrides should work for session, if there is no error evaluating this line in Console2:
Components.utils.import('resource://gre/modules/UserAgentOverrides.jsm').UserAgentOverrides.init();

Tried it in some older KM7x versions, and input in errorconsole works great in all!
Then discovered that this great 1-line-solution seems to work permanently when added on top of that very special UA-multiswitcher file in Narumans74 and rodocops76 builds (kmeleonmain.js)
The official gecko builds don't have that extension and file, so I wondered where to best piggyback that line in some other file... Can it be it doesn't really matter? In the official KM74 packed it into omni/components/kmLoginManager.js, simply because it was the smalles js-file there - and seems to work from there too... But tapping in the dark how reliable that is.

Starting with KM75 the file components/kmHelper.js exists. That's were site UAs were officially fixed in KM77-Goanna.
Now wondering:
there the UA-init is split and written in 3 chapters:
1) XPCOMUtils.defineLazyModuleGetter(this, "UserAgentOverrides", "resource://gre/modules/UserAgentOverrides.jsm");
2) case 'kmeleon-init': UserAgentOverrides.init();
3) case 'xpcom-shutdown' : UserAgentOverrides.uninit();


That get's slightly too complicated to explain users for self-help, in the middle of the file in 3 places, but the simple 1-liner-solution on top seems to work too - or not?? Are there any side-effects to consider, causing possibly other bugs, when using this much simplified version? Guess it's probably working "best" when split in 3 parts, but wonder if the simplified version may still work "well enough", though not quite as perfect...?

Options: ReplyQuote
Re: Riddling... Questions for experts (dev skills)
Posted by: hermes
Date: August 02, 2018 08:39PM

@siria

Historically I use general.useragent.override, advantage is the full predictability and controllability.
Thanks to a macro language the menu is easily formed and substitution in the manual or automatic modes is carried out. It is also possible to make the site-focused macro with auto-switching.

The main advantage of Goanna, is an opportunity to redefine useragent before send any message to website that was impossible with standard KM model means of a macro-language earlier (except manual switching, in case of automatic switching, as minimal, one attempt is necessary for URL change definition).

Part of mechanisms of useragent change in rodocop version directly depends on JS inclusion and therefore it is vulnerable. It will also not help when using a server method of UA definition. The research option on the basis on local web server always is preferable in these questions. At the same time it is possible to consider separately that see scripts of the website and server directly
(for obtaining reliable results about replacement and really sent data).



Edited 4 time(s). Last edit at 08/02/2018 08:44PM by hermes.

Options: ReplyQuote
Re: Riddling... Questions for experts (dev skills)
Posted by: siria
Date: August 03, 2018 01:36AM

PS: except for KM74-goanna am doing such UA tests on my offline machine, using a redirect from www-pages to a test page on localhost, which shows the UA it got directly. Using babywebserver, great tiny tool recommanded by Hermes.

Hermes, I don't know how much googletranslate butchers my post again, but there must be some deep misunderstandings between my post and yours. I'm talking about getting KM74-76-gecko to use the exact same Mozilla method as KM-Goanna, which was always contained in the engine in the past too, only the initialization was buggy. And that initialization is obviously fixable inside omni.ja.
The omnis are full with js-files of all sorts - are they really so much vulnerable inside there too?

Options: ReplyQuote
Re: Riddling... Questions for experts (dev skills)
Posted by: J.G.
Date: August 04, 2018 12:11PM

Quote
hermes
@siria
(...)
The main advantage of Goanna, is an opportunity to redefine useragent before send any message to website that was impossible with standard KM (...)

This is the most important point, thank you @hermes. Furthermore, old KM versions are becoming obsolete and unusable 'faster than expected' because mostly all important websites are surrendering to the expansive Chrome development cycle, becoming by itself the most forced standard ever in Internet History. However, KMG77 is currently the only version of KM up-to-date that is fully functional with NO MAIN LINK to be downloaded, by God's sake! :mad:

"It is pretty clear that YouTube's engineers knew what they were doing when they implemented support for the API. Research of compatibility issues would have pointed them to issues with the implementation in Edge or Firefox. The engineers could have decided to serve the old site to users of Firefox or Edge similar to serving the classic site to IE 11 users but they decided against it."
https://www.ghacks.net/2018/07/25/google-making-youtube-slower-for-non-chromium-browsers/

"And then Google built Chrome, and Chrome used Webkit, and it was like Safari, and wanted pages built for Safari, and so pretended to be Safari. And thus Chrome used WebKit, and pretended to be Safari, and WebKit pretended to be KHTML, and KHTML pretended to be Gecko, and all browsers pretended to be Mozilla, and Chrome called itself Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13, and the user agent string was a complete mess, and near useless, and everyone pretended to be everyone else, and confusion abounded."
https://webaim.org/blog/user-agent-string-history/

"User agent detection (or sniffing) is the mechanism used for parsing the User-Agent string and inferring physical and applicative properties about the device and its browser. But let get the record straight. User-Agent sniffing is a future fail strategy. By design, you will detect only what is known, not what will come. The space of small devices (smartphones, feature phones, tablets, watches, arduino, etc.) is a very fast-paced evolving space. The diversity in terms of physical characteristics will only increase. Updating databases and algorithms for identifying correctly is a very high maintenance task which is doomed to fail at a point in the future. Sites get abandoned, libraries are not maintained and Web sites will break just because they were not planned for the future coming devices. All of these have costs in resources and branding."
https://hacks.mozilla.org/2013/09/user-agent-detection-history-and-checklist/

IMHO every single DEV resources should be redirected soon to KMG77 and the old versions's download LINKS should be updated asap with some "new" versions containing mostly all the known fixes and workarounds (deeply lost in every side of this forum). Just my two cents, of course, it's so easy to talk while only @roytam1 is working now in development tasks. sad smiley

Options: ReplyQuote
Re: Riddling... Questions for experts (dev skills)
Posted by: siria
Date: September 16, 2018 11:09PM

Just another example from today, how UA spoofing can help users to break free from idiotically blocked site features:
https://msfn.org/board/topic/177790-fixed-how-to-watch-amazon-prime-video-on-windows-xp/

Obviously Amazon also belongs to some major sites, which try to FORCE customers to update their XP systems (at best buy a new computer with Win10 and full remote control). Or otherwise Amazon refuses to let people watch streaming videos anymore.
Solution: Fake the Useragent string to simply claim your system were Win7 - and miraculously your "obsolete" system or browser has all the necessary features again :cool:

Anyway, am still struggling to find some easier way for KM74-76RC users to initialize that sleeping site-function themselves (if they don't dare updating KM, because it's really complicated if you've customized a lot) Meanwhile I have a bad crutch in a macro, but still needs a manual kickstart in each session by menu, and I'd also rather avoid that code in macros.

Perhaps best add this 1-liner code as an xpi-addon?
I think this would be the most simple method for most users, and it would even show up in the addons manager. Awhile back have already tried to figure out how to get that 1-line-init-code in an addon, messing around completely clueless by trial and error, but no luck yet sad smiley It just wouldn't wake up at startup either.
Anyone know how to make such a teeny tiny addon?? :cool:

Options: ReplyQuote
Re: Riddling... Questions for experts (dev skills)
Posted by: siria
Date: September 22, 2018 05:57AM

Attached a first experimental draft of UAsiteInitFix, as suggested in another topic by copying RefControl as example. Then renamed and blindly stripping off 95% of original content, using vague guessing and trial&error, for lack of any xpi-skills.
I think there's still *too much* unnecessary stuff inside, potentially causing other probs? Could someone with more clue please strip out yet more? :cool:

Aside from that, it works!
Tested so far in KMG74 with offlinebabyserver.

Attachments: UAsiteInitFix_test_v01.xpi (2.8 KB)  
Options: ReplyQuote
Re: Riddling... Questions for experts (dev skills)
Posted by: siria
Date: November 06, 2019 10:40PM

Sigh, am lost again.... endless trial+error attempts but no luck, and running out of ideas...
anyone here who remembers how to get FF-addons running in KM1.6?? (=FF3.5, gecko 191)

Basically that wasn't the main purpose, this quest had started with examining closer (yet again) how to get Firefox-addons installed and tweaked in KM74/KM76, for supporting and also hopefully figuring out more basics about GUI interaction with macros, that JSBridge thing, userscripts, workarounds etc. There's a lot of potential there, we just don't know it without an addon expert helping us! So after some experimenting with different folder locations and zip-or-not and manifestering and install.rdf entries etc., struggling with "hidden" but active addons and those who are disabled after installation, and with KG74 reporting itself to addons as "K-Meleon 2.2", which they believe is prehistoric "Firefox 2.2", the darkness is lifting a little bit again - in KM7X things look quite promising.

One of my example addons is SilentBlock. Which e.g. Hermes is praising so highly, so I knew it definitely runs in KM too and is a very powerful firewall. Good test object since it's also very tiny, and it supports old+new engines. And the latest version even still available on AMO, since it supports multiple browsers:
https://addons.thunderbird.net/en-US/thunderbird/addon/silentblock/

This is running very nicely in KG74 too!
And big surprise: after installation it worked INSTANTLY, no restart needed!
And contrary to old descriptions, it can also be toggled on/off without needing restarts either, simply on about:addons, and it can import list changes in mid-session the same way. Cool.
So, unplanned lesson: "bootstrapped" addons are a very different kind. And if they contain chrome/components inside, that's only the alternative for older engines, which ignore the bootstrap.js, and vice-versa. Probably handy for comparing.

But I cannot tweak that script in KG74, to investigate possible hooks for GUI macros (on/off/import list). Just the tiniest touch breaks it instantly, and the buggy errorconsole remains dead. No logmsg, no error reports, and no testalert possible either, not anything sad smiley

So, back to my initial request: how to get that thing working in KM1.6 too??
Or is it impossible? Perhaps due to the last 3 lines in the manifest? Something with registering components??
Of course I tried the slightly older version 3.0, declared to work in FF3 too, which still contains the chrome+components stuff. And moved the components file into components folder. And deleted the 2 component/dat-files. And tried to adjust the manifest, taking httpfox as example, which does run fine and which also uses components. Tried with and without those 3 manifest lines. And tried as jar, and unpacked, and any nonsense idea I could think of - still doesn't work sad smiley

Options: ReplyQuote
Re: Riddling... Questions for experts (dev skills)
Posted by: anonymous
Date: November 07, 2019 06:51AM

Build KM 1.6 binaries with addon support.

Options: ReplyQuote
Re: Riddling... Questions for experts (dev skills)
Posted by: siria
Date: November 07, 2019 01:39PM

Quote
anonymous
Build KM 1.6 binaries with addon support.

Great! Let me know where to download those updated KM 1.6 binaries :cool:
While at it, an updated TLS1.2 support would be especially fantastic grinning smiley

But why do some other FF-addons work if unzipped in the various root folders?
After wasting a lot more time again with blind trial-error testing, am now 99.9% convinced the killer function for tons of FF-addons in KM is this crucial manifest line:
overlay chrome://browser/content/browser.xul chrome://SilentBlock/content/silentblock.xul

As long since suspected already, but was never quite sure before:
there's just no way to overlay any elevated chrome-stuff on websites, right?
It's only possible to overlay already powerful local chrome-pages with yet more powerful addon-functions.

But modifying local chrome-pages is no prob either for simple macro-injectJS. So for this no "addon" stuff is needed anyway (some of my unfinished monster macros last year are extending aboutconfig and aboutaddons, not to mention chromeblank).
The crucial "addon" prob is getting priviledged code into websites, without giving the whole internet the same rights, sigh. That interim-layer-whatever seems missing in KM, or, if another method exists (??), have no clue how to access it. Just my foggy impression now ;-)

PS: am on a trace how to fix at least one of the killer bugs in KG74 - JSBridge.SendMessage finally works! Using Narumans updated 74+1 comp-files from oct-2014, a younger version of his fork on which KG74 is based. But there's this mess with duplicate /browser/ files, inside and outside of omni.ja, must check more details to replace which files and how exactly...

Options: ReplyQuote
Re: Riddling... Questions for experts (dev skills)
Posted by: anonymous
Date: November 09, 2019 06:39AM

Adding overlays to unused files is meaningless. Gecko 24 has about:compartments to look for loaded files.
There should be no identical files. KM beta versions load modified copies of chrome files from various locations.
Found no link to sources or origin of sources to look for supported JSBridge commands.

Options: ReplyQuote
Re: Riddling... Questions for experts (dev skills)
Posted by: siria
Date: May 19, 2020 03:23PM

Riddling since years....
How in the world limit the menu length, so that it doesn't cover the statusbar info?
A global setting would be handy, affecting all menus.

Only possible since ages to limit the menu spillover length for a few plugins, bookmarks+favorites+hotlist.
For those exist prefs, e.g.: "kmeleon.plugins.bookmarks.maxMenuLength".
Those even have a handy GUI to input max lines: Bookmarks > Options > Bookmarks Menu
Same system for Favorites+ Hotlist plugins.

While at it, another riddle:
any chance to create a tooltip for menu lines, especially for macro menus?
Similar as the "macroinfo" line, which fills the statusbar, but half a line is often too short.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.