martok / palefill

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

godbolt.org #1

Closed rofl0r closed 2 years ago

rofl0r commented 2 years ago

would be nice if you can add a hack for godbolt.com

the palemoon web compat forum has a post about how to fix it with a greasemonkey script

martok commented 2 years ago

Assuming you're talking about godbold .org and the queueMicrotask polyfill (which palefill already has for other sites): that won't be enough (anymore?)

Godbold throws a SyntaxError: missing : after property id pointing to right after n.enumerable} in:

((e,t,i,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of s(t))a.call(e,l)||!i&&"default"===l||o(e,l,{get:()=>t[l],enumerable:!(n=r(t,l))||n.enumerable})})(l,n);

Which is weird because that is correct syntax... so the error is somewhere before that.

JS syntax compat is always a bigger challenge... I'll see what I can find out, but can't make any promises.

rofl0r commented 2 years ago

sorry, it's .org not .com

here's an example link https://godbolt.org/z/86Mq1rn8b

leaves you with white page instead of showing the code

rofl0r commented 2 years ago

forum discussion is here https://forum.palemoon.org/viewtopic.php?f=70&t=27860&sid=46328afef476e6f10cb6707fe780079c

martok commented 2 years ago

As previously said, there are more issues than just the polyfill now. But, luckily, only two.

  1. Godbolt uses class field declarations, supported since Chrome 72 (late 2018), Firefox 69 (Sep 2019) and not at all in UXP. We're lucky it is just one class, so a script replacement is possible.
  2. Godbolt has a weird frontend cache that loses some headers, this required a fix to the injector code.

There is another error left that's thrown from the web worker, but doesn't seem to affect the usage?

I've packaged a 1.5 prerelease, let me know if everything works!

rofl0r commented 2 years ago

great, it works! can finally use godbolt again (not only that, many blogs use godbolt iframes to show source snippets)