JustOff / github-wc-polyfill

Ensure that all GitHub and GitLab scripts required for UXP and SeaMonkey are loaded correctly
https://justoff.github.io
Mozilla Public License 2.0
103 stars 19 forks source link

Argh.. GitHub is broken again #44

Closed jrfnl closed 2 years ago

jrfnl commented 2 years ago

Yup... GH has done it again.... must be driving you bonkers..

I see this error in the console:

TypeError: (intermediate value).attachShadow is not a function[Learn More] chunk-index2-a8e52977.js:1:2276

As for symptoms:

Polynomial-C commented 2 years ago

Same with the user drop down menu in seamonkey. All I can see in the menu is: Sorry, something went wrong.

JustOff commented 2 years ago

Resolved by 1.2.12.

But now GH is slow like a slug :angry:

dilworks commented 2 years ago

Almost there!

First, thanks for the speedy fix, GiggityHub must be driving you, me, and everybody else not using Holy Chromeยฎโ„ข downright insane with this pointless chase for shiny.

Now the editor seems to work properly again, and dropdown menus work... except for one: the user menu. The "something happened" message is gone, but all I get is a blank menu instead.

EDIT (yay, I can edit again!): no errors are logged in console when trying to access the broken user menu.

JustOff commented 2 years ago

@dilworks, for me it works just fine:

image

dilworks commented 2 years ago

Weird... Let me test on a clean profile, clearing cache, etc.

dirkf commented 2 years ago

GH doesn't seem to be serving the code that provoked the error with missing this.attachShadow now, but kudos for instant 1.2.12.

jrfnl commented 2 years ago

@JustOff Your work is soooooo much appreciated. Thanks (again) for the quick fixes and releases โค๏ธ

JustOff commented 2 years ago

@dirkf, perhaps there is some A/B test, but I still can see the error with 1.2.11.

dirkf commented 2 years ago

No, you're right. DevTools crashed the browser and I forgot to re-enable JS.

AroKol78 commented 2 years ago

such a trifle - ~string~ text position (no bugs in the console) https://github.com/JustOff/github-wc-polyfill/commit/727fe0e5da881ceac90248f03b20a10b10e9f719 testbuggh01


moving the cursor in the text with the keys - very slow

dilworks commented 2 years ago

@JustOff : Managed to reply the user menu issue on a totally clean SeaMonkey profile - no addons except for github-wc-polyfill, no custom settings, no nada: plzGiggityHub

All I can see on the network inspector is that the menu is loaded via AJAX (/menu) on the initial page load, but it's not being used for whatever reason.

JustOff commented 2 years ago

@dilworks, well, I can reproduce it with SeaMonkey, but not with Pale Moon. I wish I know what to do with this.

@AroKol78, yep, it's a bummer.

dilworks commented 2 years ago

@JustOff FWIW it also happens on SeaMonkey latest beta, 2.53.11b1...

Vangelis66 commented 2 years ago

But now GH is slow like a slug ๐Ÿ˜ 

I can confirm/reproduce in latest St52 32-bit ๐Ÿ˜  ; typing this very comment is sluggish as hell ๐Ÿ’ข , just reloading a GitHub tab now produces the Not Responding hang in the Browser Window title for 2-5 sec (YMMV), on "heavy" GitHub pages I may even get this: unresp-script

So, M$ have now rendered GitHub very "uncomfortable" to use on "legacy" platforms ๐Ÿ˜ญ ; after all, today is Feb 17th, I guess someone there did stick to their original plan to mess things up for "us" on the 17th...

deprecation on 20220217

dirkf commented 2 years ago

The top-right pull-down is an <include-fragment> element, which is where I was seeing the this.attachShadow is not a function error without 1.2.12 (and even though the polyfill from #19 was loaded and this.attachShadow was a function when the problem line was BPed and the page reloaded).

Anyhow, there's a big difference between adding APIs and redefining the language syntax (ES2020 optional chaining, ES2018 regex literals).

JustOff commented 2 years ago

even though the polyfill from https://github.com/JustOff/github-wc-polyfill/issues/19 was loaded and this.attachShadow was a function

This is because they need Element.prototype.attachShadow, not only HTMLElement.prototype.attachShadow

Vangelis66 commented 2 years ago

https://github.com/JustOff/github-wc-polyfill/commit/727fe0e5da881ceac90248f03b20a10b10e9f719

Load diff

(no bugs in the console)

I get

Content Security Policy: The pageโ€™s settings blocked the loading of a resource at self (โ€œscript-src 'sha256-adiMt0jngKHacvEid386+kd4GfsJG9Bk63VtPqP2ZVI=' https://github.githubassets.comโ€). Source: parent["VM0.12818166828098088"] = [this].

immediately after https://github.githubassets.com/assets/diffs-4fa71244.js is loaded...

dirkf commented 2 years ago

... they need Element.prototype.attachShadow ...

In fact I had modified the polyfill to target Element: perhaps I needed to do both given the rickety OO system in JS.

Also, what on earth are they doing in this typing field? Looks like typing up stuff in the editor and pasting it in will be the new MO.

JustOff commented 2 years ago

@Vangelis66, can't reproduce in a clean profile, perhaps you have some userscript ot other extension enabled for GH.

Vangelis66 commented 2 years ago

can't reproduce in a clean profile, perhaps you have some userscript or other extension enabled for GH.

Apologies ๐Ÿ˜Š , I had indeed 3 GH-targeting userscripts enabled in Violentmonkey...

BTW, with 1.2.12 already installed, "Load more..." (items) is also broken ๐Ÿ˜ข :

LM

JustOff commented 2 years ago

"Load more..." (items) is also broken

Can't confirm, works just fine in Pale Moon 29.4.4.

AroKol78 commented 2 years ago

https://github.com/JustOff/github-wc-polyfill/issues/44#issuecomment-1043223634 i don't have such csp - if you press "load diff" it loads fine (just a strange text position) https://github.com/JustOff/github-wc-polyfill/issues/44#issuecomment-1043251878 is fine, only there is a problem with reloading

dirkf commented 2 years ago

'Load more' working OK, if slow, in SM 2.53.10.2 with 1.2.12 installed.

Vangelis66 commented 2 years ago

Can't confirm, works just fine in Pale Moon 29.4.4.

๐Ÿ˜Š ; I somehow made it work, too (and now hid my invalid comments); I probably need to go out and get some fresh air; apologies to all, sorry ๐Ÿ˜œ

garoto commented 2 years ago

Wow, JustOff weren't exaggerating when he mentioned its slowness, damn. GH is pretty much unusable now on latest PM.

I had to type this comment in my text editor, since the comment form was lagging like crazy with one core at 100%. Nuts!

dilworks commented 2 years ago

Huh, I always thought the GH editor was always slow (and sometimes buggy), but today indeed has become VERY laggy for me, like something that is doing deep learning on every keystroke...

The modern web is a dumpster fire of broken tech :/

AroKol78 commented 2 years ago

script not responding https://github.com/ikatyang/emoji-cheat-sheet

SeaHOH commented 2 years ago

I try to replace chunk-index2 to last work version a3fdc9f7, it works. But may some of site functions will be broken.

Patch in my fork (not for SM): https://github.com/SeaHOH/github-wc-polyfill/commit/f5c231650285a4f3c8359bb49b9d59313e94b703

The new additional code of chunk-index2 is:

constructor(){super();this.attachShadow({mode:"open"}).innerHTML=`
      <style> 
        :host {
          display: block;
        }
      </style>
      <slot></slot>`}
AroKol78 commented 2 years ago

I'm back to 1.2.11 (I chose the lesser evil)

ghost commented 2 years ago

Resolved by 1.2.12.

But now GH is slow like a slug ๐Ÿ˜ 

I'm back to 1.2.11 (I chose the lesser evil)

So, what to do? In actual state 1.2.12 fully blows CPU and on my laptop it always just stuck โ€” Pale Moon asks me to stop script instead...

EDITED: Just updated to 1.2.13b2 (https://github.com/JustOff/github-wc-polyfill/issues/44#issuecomment-1044231249) โ€” seems like all is work as for now.

Thanks, @JustOff!

Vangelis66 commented 2 years ago

Thanks for this kludge ๐Ÿ˜„ , SeaHOH ๐Ÿ‘ ; installed it in latest Serpent 52 and GH is again usable (typing this from St52 right now...); BTW, no disrespect is meant to the great JustOff ๐Ÿ‘ ; this fix will probably get us going till tomorrow, when M$, no doubt, introduce more Chrome-specific "goodies" ๐Ÿ˜  ...

JustOff commented 2 years ago

Patch in my fork (not for SM): https://github.com/SeaHOH/github-wc-polyfill/commit/f5c231650285a4f3c8359bb49b9d59313e94b703

Unfortunately, it doesn't work for me. Perhaps I'm missing something.

dirkf commented 2 years ago

Is there a high-numbered TV channel somewhere showing conspiracy docs about how M$ and Google are going to take over the world and split it up between them? I really don't see why M$ would want to promote content that favours G. I favour the view that M$ is generally hands-off with GH but the GH staff making detailed technical decisions love the shiny to the detriment of configuration control and without a mature understanding of their implications.

More significantly, with 1.2.12, I can type again but the 'TypeError: this.attachShadow is not a function' diagnostic is back, the comment top-right ... button gives an empty pull-down and the page top-right user pull-down says 'Something went wrong'. (How true) Dropped back to 1.2.10: ludicrously slow typing but comment menus back. And now the original behaviour with 1.2.12 is back, with empty page top-right user pull-down.

SeaHOH commented 2 years ago

Patch in my fork (not for SM): SeaHOH@f5c2316

Unfortunately, it doesn't work for me. Perhaps I'm missing something.

You patch your version 1.2.11? How about version 1.2.10? Replace environment with chunk-index2.

dirkf commented 2 years ago

Possibly this is the reason for the slowdown:

queueMicrotask.toSource()
/*
(function(f) {setTimeout(f, 0)})
*/

I don't know whether that's being sent by GH or set by 1.2.12, but it should be polyfilled with s/t like this:

const _queueMicrotask = (function () {
    const checkIsCallable = (callback) => {
        if (typeof callback !== 'function') {
            throw new TypeError( "Failed to execute 'queueMicrotask': callback is not a function" );
        }  
    };
    let promise = null;
    return function(callback) {
        checkIsCallable(callback);
        (promise || (promise = Promise.resolve()))
            .then( () => callback() ) // call with no arguments
            // if an error occurs during callback execution,
            // throw it back to globalObj (using setTimeout to get out of Promise chain)
            .catch( (err) => setTimeout( () => { throw err; } ) );
    };
})();

for (let intf of [window, Worker.prototype]) {
    if (!('queueMicrotask' in intf)) {
        intf.queueMicrotask = _queueMicrotask;
    }
}
SeaHOH commented 2 years ago

Yep, I only tested my fork before. Now, I tested that only replace the chunk-index2 is not enough. And I really use Promise to polyfill with queueMicrotask in my fork, and kept the attribute defer when replace script elements.

JustOff commented 2 years ago

kept the attribute defer when replace script elements

Yep, that was the part I missed, and here it is: 1.2.13b2.

JustOff commented 2 years ago

FTR, SeaMonkey 2.53.9.1 has no problems with the user menu with both 1.2.12 and 1.2.13b2, while 2.53.10 has.

SeaHOH commented 2 years ago

I forgot data-module-id, maybe the reason is it.

dirkf commented 2 years ago

Certainly I don't see a relevant change in the SM 2.53.10 changelog: it's all ChatZilla, MailNews and browser chrome stuff.

RamonUnch commented 2 years ago

Thanks a lot @JustOff and @SeaHOH. Thanks to you I do not have to use chrome for GitHub. I deeply appreciate your work. The 1.2.13b2 works very well and fast for me.

Polynomial-C commented 2 years ago

User drop down menu still is empty with 1.2.13b2 and seamonkey-2.53.11b1.

JustOff commented 2 years ago

You could try to find a regression between 2.53.9.1 and 2.53.10 based on these nightly builds.

garoto commented 2 years ago

Noticing some subjectively faster GH performance overall with 1.2.13, specially when rendering somewhat larger diffs and issues with 100+ comments. e: with latest PM release on Windows.

hiiamboris commented 2 years ago

Is there a high-numbered TV channel somewhere showing conspiracy docs about how M$ and Google are going to take over the world and split it up between them? I really don't see why M$ would want to promote content that favours G.

@dirkf Just look at the top stakeholders list of Google/Alphabet, M$ or really any other Silicon Valley corp, you'll be in for a surprise ;)

garoto commented 2 years ago

When a corporation reaches the multi-billion dollar mark in valuation and/or assets, it can't call its shots anymore. It either play ball or bad things will happen. Specially true for the computing industry for the past two decades or so.

CyberTailor commented 2 years ago

@JustOff

Resolved by 1.2.12.

But now GH is slow like a slug

Let's move this repository to some Gitea public instance (like https://codeberg.org) so we can report issues at least. It works perfectly in Pale Moon.

rofl0r commented 2 years ago

Let's move this repository to some Gitea public instance (like https://codeberg.org/) so we can report issues at least. It works perfectly in Pale Moon.

good idea, if you s/move/copy/

CyberTailor commented 2 years ago

good idea, if you s/move/copy/

GH can be left as a mirror, indeed.

JustOff commented 2 years ago

Let's move this repository to some Gitea public instance good idea, if you s/move/copy/

Sorry, but this is unlikely to happen.

so we can report issues at least

You can always use a different browser for this.