-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
8822 features a resize preloader that detects what possible resizes are upcoming and sends the request ahead of time, so that they're cached by the time that resize actually needs to be performed
scp/source/scp-8822/src/controller.html
Lines 389 to 414 in e69cd70
| this.currentTask = requestIdleCallback(async () => { | |
| console.debug(`Preloading assertion state ${snapshot}`); | |
| // Delay upfront so the real iframe gets priority | |
| await new Promise((resolve) => setTimeout(resolve, 300)); | |
| await new Promise((resolve) => { | |
| const preloadIframe = document.createElement("iframe"); | |
| this.frames.push({ snapshot, frame: preloadIframe }); | |
| preloadIframe.addEventListener("load", () => resolve()); | |
| // Iframe is fully sandboxed: allow-same-origin is implicitly false, prevents the controller being resized | |
| preloadIframe.sandbox = true; | |
| preloadIframe.classList.add("preload-iframe"); | |
| document | |
| .getElementById("preload-container") | |
| .appendChild(preloadIframe); | |
| preloadIframe.src = | |
| document.referrer + | |
| "/common--javascript/resize-iframe.html?" + | |
| "#" + | |
| snapshotToSize(snapshot) + | |
| "/" + | |
| location.href.replace(/^.*\//, "/").replace(/^\/+/, ""); | |
| }); |
After discussion with @radian628, we found that the hash segment of the URLs are not being sent to the server anyway and are not involved in caching at all, rendering the preloader not only useless but actively harmful by sending unnecessary requests
https://github.com/scpwiki/interwiki/blob/main/js/resizeIframe.js does not do any cachebusting of its own so the preloader can literally just be removed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request