martok / palefill

Inject Polyfills for various web technologies into pages requiring them
https://martok.github.io/palefill/
Mozilla Public License 2.0
81 stars 9 forks source link

GitHub: Missing redesigned code file view on Waterfox Classic (non-e10s) #94

Closed walmar closed 11 months ago

walmar commented 11 months ago

The [GitHub Feature Support Table](https://github.github.com/browser-support) shows no warning signs when dom.webcomponents.enabled is set to true.

Web Console output

Content Security Policy: Directive ‘child-src’ has been deprecated. Please use directive ‘worker-src’ to control workers, or directive ‘frame-src’ to control frames respectively. (unknown)

SyntaxError: missing : after property id[Learn More] vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_primer_view-co-2c6968-d14fe7eeba42.js:1:9268

SyntaxError: missing : after property id[Learn More] vendors-node_modules_primer_react_lib-esm_ActionMenu_ActionMenu_js-2f08ef908241.js:1:1949

https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_primer_view-co-2c6968-d14fe7eeba42.js

tf=class extends Event{oldState;newState;constructor(t,{oldState:e="",newState:n="",...i}={}){super(t,i),this.oldState=String(e||""),this.newState=String(n||"")}}

https://github.githubassets.com/assets/vendors-node_modules_primer_react_lib-esm_ActionMenu_ActionMenu_js-2f08ef908241.js

m=class extends Event{oldState;newState;constructor(e,{oldState:t="",newState:n="",...o}={}){super(e,o),this.oldState=String(t||""),this.newState=String(n||"")}}

Missing-Code-File-View.png

martok commented 11 months ago

Waterfox is not a supported platform. I may consider pull requests, but only if somebody wants to volunteer for maintenance.

Waterfox-classic doesn't have class fields, and I don't suspect it ever will...

CeruleanSky commented 11 months ago

I have tested the throw everything including the kitchen sink fix.

Get https://unpkg.com/@babel/standalone/babel.min.js or https://unpkg.com/@babel/standalone/babel.js search and replace ["text/jsx", "text/babel"]; to ["text/jsx", "text/babel", "application/javascript"]; toss it into the extension.

In my case I have been tweaking the original Polly extension, which works well for this so I can easily turn the Babel's tower monster on/off. I renamed it Polly2 so its settings doesn't interfere with the Polly that came with Waterfox.

Try it out: https://github.com/CeruleanSky/Polly2/releases/tag/v2.0

Check the pollyfills/Babel/babel.min.js box in Polly2 probably the regenerator as well. Brew some tea and while you wait for everything to stop loading and for it to recompile everything. Most github pages take between 2 minutes to 5 minutes depending on the page.

Be amazed it works!

Immediately turn it back off until somebody figures out a better quicker way, such as just recompiling a whitelist of scripts using the incompatible ways like vendors-node_modules_primer_react_lib-esm_ActionMenu_ActionMenu_js & vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_primer_view-co , or maybe figuring out just the subset of babel needed for this, I got the bundle which does everything and is overkill. Unfortunately I am not too familiar with this aspect of javascript much less browser compatibility, Polly2 is just the result of incrementally trying mainly non working things over time.

I think https://github.com/facebook/regenerator/blob/main/packages/transform/src/replaceShorthandObjectMethod.js this is the code that is actually fixing things up, but I don't know how to make it stand alone to find out.

Also you probably have to disable security.csp.enable and security.csp.enableStrictDynamic in about:config , at least for me it is totally busted on many websites, but it may leave you more vulnerable to security issues, but your running waterfox classic so probably the least of your worries, just run ublock, umatrix, and noscript and hope for the best.

walmar commented 9 months ago

Thanks to @martok for your clarification and to @CeruleanSky for your constructive contribution on the topic.

I opened the GitHub support ticket #2390102 on Oct 20, 2023 to clarify the still-claimed service mechanism for browsers without Public Class Fields support, which appears to no longer be working. A GitHub Technical Support person commented to me on Oct 31, 2023 that the issue has been created with the engineering team. Since then, the Public Class Fields feature part has been highlighted in red and moved from Transpiled Native Syntax to the Native Syntax section (GitHub Feature Support Table — Postimages).

Unfortunately, Babel does not seem to be able to transform scripts of several hundred KB in size, inline scripts, or most ES modules - such as those used on Waterfox.net - on the fly. Where I have to open the page in Firefox Portable in a Sandboxie Plus box via the OpenURLWith userChrome JavaScript. But for GitHub.com it's working pretty well so far via the latest unofficial Polly+ version. This seems to be the best workaround for now until someone implements the missing feature similar to: Merge pull request 'JS: Implement Class Fields & Logical Assignment Operators' (#2224) from martok/UXP-contrib:mr/class-fields into master · 127bf5784a - UXP - Pale Moon repositories

For my part, I already use the uBlock Origin and NoScript extensions to reduce the security risk with Waterfox Classic. Additionally, Container Tabs, URLVoid.com via Flagfox and in some cases Sandboxie Plus. But thanks for pointing that out.