NotHereToPlayGames Posted October 18, 2023 Share Posted October 18, 2023 (edited) I don't have any Chase accounts but the 360Chrome userbase already has added support for structuredClone() -- // ==UserScript== // @name Inject structuredClone() Polyfill [98] // @version 0.0.1 // @match *://*/* // @run-at document-start // @grant none // ==/UserScript== if (typeof self.structuredClone !== "function") { self.structuredClone = function (value) { if (Array.isArray(value)) { const count = value.length; let arr = new Array(count); for (let i = 0; i < count; i++) { arr = self.structuredClone(value); } return arr; } else if (typeof value === "object") { let obj = {}; for (const prop in value) { obj[prop] = self.structuredClone(value[prop]); } return obj; } else { return value; } } } Edited October 18, 2023 by NotHereToPlayGames Link to comment Share on other sites More sharing options...
NotHereToPlayGames Posted October 18, 2023 Share Posted October 18, 2023 43 minutes ago, UCyborg said: References structuredClone (Chrome 98+). There's polyfill for it in one of 360Chrome threads. lol, I guess I should have read in full before replying. Link to comment Share on other sites More sharing options...
Mathwiz Posted October 18, 2023 Share Posted October 18, 2023 Appears there's more to this than structuredClone. Installed the user script, but still no joy. I'll give it a closer look from home; I'm at work now.... 37 minutes ago, UCyborg said: @Mathwiz Does it have to be Chrome? My recent adventures indicated you should be able to get a snapshot of Chromium in virtually any stage of development, along with offline installer. https://storage.googleapis.com/chromium-browser-continuous/index.html That index only appears to go through the year 2016. But it was only for test purposes anyhow. Sure enough, Chrome 98 did the trick. 2 Link to comment Share on other sites More sharing options...
NotHereToPlayGames Posted October 18, 2023 Share Posted October 18, 2023 I guess that is good news and bad news. I'd be courious as to what other polyfills may need added to v86. Link to comment Share on other sites More sharing options...
NotHereToPlayGames Posted October 18, 2023 Share Posted October 18, 2023 (edited) Since v98 did the trick, I wonder if your v86 needs these two also - // ==UserScript== // @name Inject findLast() Polyfill [97] // @version 0.0.1 // @match *://*/* // @run-at document-start // @grant none // ==/UserScript== if (!Array.prototype.findLast) { Object.defineProperty(Array.prototype, "findLast", { value: function (predicate, thisArg) { let idx = this.length - 1; while (idx >= 0) { const value = this[idx]; if (predicate.call(thisArg, value, idx, this)) { return value; } idx--; } return undefined; } , writable: true, enumerable: false, configurable: true }); } // ==UserScript== // @name Inject findLastIndex() Polyfill [97] // @version 0.0.1 // @match *://*/* // @run-at document-start // @grant none // ==/UserScript== if (!Array.prototype.findLastIndex) { Object.defineProperty(Array.prototype, "findLastIndex", { value: function (predicate, thisArg) { let idx = this.length - 1; while (idx >= 0) { const value = this[idx]; if (predicate.call(thisArg, value, idx, this)) { return idx; } idx--; } return -1; } , writable: true, enumerable: false, configurable: true }); } Another common "attempt" to break older browsers can be fixed with: // ==UserScript== // @name Inject randomUUID() Polyfill [92] // @version 0.0.1 // @match *://*/* // @run-at document-start // @grant none // ==/UserScript== if (!('randomUUID' in crypto)) crypto.randomUUID = function randomUUID() { return ( [1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) ); }; Edited October 18, 2023 by NotHereToPlayGames 1 Link to comment Share on other sites More sharing options...
AstroSkipper Posted October 18, 2023 Share Posted October 18, 2023 (edited) Is that here another (360)Chrome thread? I do not hope so. Edited October 18, 2023 by AstroSkipper 4 Link to comment Share on other sites More sharing options...
Mathwiz Posted October 18, 2023 Share Posted October 18, 2023 No. I'm adding the suggested polyfills to Serpent via the Violentmonkey add-on. Chrome was just used to narrow down which polyfills might be needed. Knowing that version 98 includes the needed functionality means that all missing functionality was added between Chrome versions 88 and 98. Unfortunately, no luck so far.... Link to comment Share on other sites More sharing options...
mina7601 Posted October 19, 2023 Share Posted October 19, 2023 (edited) On 10/18/2023 at 10:14 PM, Mathwiz said: Sounds like a firewall rule. Perhaps port 80 is blocked, with an exception for Chrome? Or perhaps a different proxy configuration? (Chrome uses Windows Internet settings; Serpent has its own, which would default to "direct connection" on a clean profile.) I've spent several hours trying to find the firewall rule, except to realize later on that this exists in Windows Firewall with Advanced Security, which isn't available in Windows XP, but only in Windows Vista and later. I am running Windows XP SP3 in a VM. And I have no proxy server enabled, so that shouldn't be an issue. Edit: Moving on. Not worth the hassle to get www.rw-designer.com to load in Serpent 52 and Serpent 55. Edited October 20, 2023 by mina7601 Moving on... Link to comment Share on other sites More sharing options...
Mathwiz Posted October 19, 2023 Share Posted October 19, 2023 SOLVED!! Both UXP's built-in structuredClone implementation and @UCyborg's polyfill kept blowing up on a circular reference, so neither works on chase.com. I had to go hunting for a fix; finally found one at https://github.com/moll/json-stringify-safe Here's my (chase.com only) polyfill incorporating that code. I don't fully understand what I did, but it works: // ==UserScript== // @name Inject structuredClone() Polyfill [98] // @version 0.0.1 // @match *://*.chase.com/* // @run-at document-start // @grant none // ==/UserScript== function stringify(obj, replacer, spaces, cycleReplacer) { return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces) } function serializer(replacer, cycleReplacer) { var stack = [], keys = [] if (cycleReplacer == null) cycleReplacer = function(key, value) { if (stack[0] === value) return "[Circular ~]" return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]" } return function(key, value) { if (stack.length > 0) { var thisPos = stack.indexOf(this) ~thisPos ? stack.splice(thisPos + 1) : stack.push(this) ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key) if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value) } else stack.push(value) return replacer == null ? value : replacer.call(this, key, value) } } self.structuredClone = function (value) { return JSON.parse(stringify(value)); } I think what it does is convert the object to a JSON string then convert it back to a new object. If any circular references are detected, a special value is placed in the JSON string instead of going into a loop and blowing up on a stack overflow. There are probably a lot of things this won't work on, so I limited it to chase.com, leaving the native implementation for everything else. Perhaps someone more skilled than I (@UCyborg?) can apply the same idea to UXP's native implementation and submit a pull request upstream. 2 Link to comment Share on other sites More sharing options...
dmiranda Posted October 19, 2023 Share Posted October 19, 2023 7 hours ago, Mathwiz said: No. I'm adding the suggested polyfills to Serpent via the Violentmonkey add-on. Actually, it would be nice to start a monkey business thread, so all these scripts are available in one place. 3 Link to comment Share on other sites More sharing options...
AstroSkipper Posted October 19, 2023 Share Posted October 19, 2023 8 hours ago, dmiranda said: Actually, it would be nice to start a monkey business thread, so all these scripts are available in one place. Good idea! I'm curious when you'll start such a thread. 3 Link to comment Share on other sites More sharing options...
mina7601 Posted October 19, 2023 Share Posted October 19, 2023 (edited) 11 hours ago, dmiranda said: Actually, it would be nice to start a monkey business thread, so all these scripts are available in one place. There's a topic for that: Edited October 19, 2023 by mina7601 1 Link to comment Share on other sites More sharing options...
VistaLover Posted October 19, 2023 Share Posted October 19, 2023 2 hours ago, mina7601 said: There's a topic for that: Pity that the "topic" is inside the Windows XP subforum ; IMHO, it should be transferred to the "Browsers working on Older NT-Family OSes" subforum (where this very thread resides ); but I know, I'm just a minority Vista user myself ... 1 Link to comment Share on other sites More sharing options...
j7n Posted October 19, 2023 Share Posted October 19, 2023 Vista, pity the "poor" Sv2003 users who can't post in the XP forum. On topic, it seems that recent New Moon 28 that I updated works better on Facebook. I can post comments to post without waiting for so long, or having the text cursor return to position 0. Link to comment Share on other sites More sharing options...
mina7601 Posted October 19, 2023 Share Posted October 19, 2023 21 minutes ago, VistaLover said: Pity that the "topic" is inside the Windows XP subforum ; IMHO, it should be transferred to the "Browsers working on Older NT-Family OSes" subforum (where this very thread resides ) @Dave-H could you please move the "Monkey Scripts" topic to Browsers working on Older NT-Family OSes subforum? 1 Link to comment Share on other sites More sharing options...
Recommended Posts