Closed Vangelis66 closed 2 years ago
Confirm in SM 2.5.10.2.
~EventTarget.addEventListener
failed on Custom Elements polyfill.~ It's working in current page. :confused: Maybe click
events have been intercepted by button
tag.
This code is working. click
events triggered by parent button
.
(function () {
function addEventListener (type, listener, options) {
const target = this, parent = target.parentNode,
ael = EventTarget.prototype.addEventListener;
ael.call(target, type, listener, options);
// Limit applied scope, or break other functions
if (!(type === "click" && parent.localName === "button")) return;
if (!triggerMap.has(target))
triggerMap.set(target, function () {target.dispatchEvent(new Event("click"))});
ael.call(parent, type, triggerMap.get(target), options);
}
function removeEventListener (type, listener, options) {
const target = this, parent = target.parentNode,
rel = EventTarget.prototype.removeEventListener;
rel.call(target, type, listener, options);
if (!(type === "click" && parent.localName === "button")) return;
rel.call(parent, type, triggerMap.get(target), options);
}
const oldCED = customElements.define, triggerMap = new Map();
customElements.define = function (name, cls) {
cls.prototype.addEventListener = addEventListener;
cls.prototype.removeEventListener = removeEventListener;
oldCED.call(customElements, name, cls);
};
}());
I tested the latest snapshot, c2f2c72
, of your fork and it does address successfully this issue, thanks 👍 , but...
Can you please submit a proper PR for this here, that can cleanly apply on top of master branch (or a "patch" on top of latest beta, 1.2.14b2) ?
(FWIW, you were kindly invited to do the same for another of your "fixes", but so far you seem reluctant to indulge... ).
Using a UXP-based browser myself, I have the "luxury" of being able to try your own fork, but this original extension does also cater to SeaMonkey users, which are NOT covered, AFAICS, by your fork...
Kindest regards 😄
I will tell you how to patch github-wc-polyfill, so I spend some time on writing digest tool.
First, copy this html tool to your disk, named e.g. digest.html
, then load it with your browser.
Paste the script who will be injected, into input text area, then you can click buttons to copy the following needed values.
+++const pfFollowUp = WRAPPED STRINGS;
+++const hashFollowUp = "'DIGEST INTEGRITY'";
Add hashFollowUp
digest integrity.
--- csp = csp.replace(/script-src /g, "script-src " + hashBase + " ");
+++ csp = csp.replace(/script-src /g, "script-src " + hashBase + " " + hashFollowUp + " ");
Inject pfFollowUp
at first position, in result it's the last.
if (this.site == "github") {
+++ data = data.replace("<head>", "<head><script>" + pfFollowUp + "</script>");
Remove unnecessary e.g.
--- data = data.replace(/<script.+chunk-index2-[a-z0-9]+\.js"><\/script>/, "......");
it already works for me (Serpent52 + 1.2.15b1)
it's OK (Serpent52 + 1.2.15b3)
Platform: (forked) UXP Browser: (latest) Serpent 52.9.0 (2022-02-25) (32-bit) Extension version: 1.2.14b2 Browser profile: Fresh (with default settings), with only this extension installed
STR:
https://github.com/JustOff/github-wc-polyfill/commits/master
, click button
Expected behaviour: Full (40 chars) commit HASH copied to the clipboard (with a visual indication of a successful copy action)
Actual result: Clipboard is empty (or contains whatever string was put there, via whatever, immediately previous, copy action)...
In contrast, on a Chromium-based browser sanctioned by GitHub, this is the visual result of clicking the button in question:
and the clipboard becomes populated with
1291c0573ddaa116c48386110ffe5c6a4fe751a3
... Nothing I could spot stands out in Web/Error Console... :disappointed: