FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

try fix reload · bourgeoa/JavaScriptSolidServer@a83ba57 · GitHub

Commit a83ba57

Browse files
committed
try fix reload
1 parent d4ea06f commit a83ba57

1 file changed

Lines changed: 13 additions & 36 deletions

File tree

‎src/mashlib/index.js‎

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -287,22 +287,6 @@ export function generateDatabrowserHtml(resourceUrl, cdnVersion = null, opts = {
287287
} catch {}
288288
})();
289289
290-
// bfcache can restore a stale/frozen shell where mashlib is not ready.
291-
// On persisted restores, reload only when the shell looks uninitialized.
292-
window.addEventListener('pageshow', function(event) {
293-
if (!event.persisted) return;
294-
try {
295-
var outline = document.getElementById('outline');
296-
var hasRows = !!(outline && outline.querySelector('tr'));
297-
var canRun = !!(window.panes && typeof window.panes.runDataBrowser === 'function');
298-
if (!hasRows || !canRun) {
299-
window.location.reload();
300-
}
301-
} catch (_) {
302-
window.location.reload();
303-
}
304-
});
305-
306290
function showError(message) {
307291
document.body.innerHTML = '<p>' + message + '</p>';
308292
}
@@ -450,22 +434,6 @@ export function generateDatabrowserHtml(resourceUrl, cdnVersion = null, opts = {
450434
} catch {}
451435
})();
452436
453-
// bfcache can restore a stale/frozen shell where mashlib is not ready.
454-
// On persisted restores, reload only when the shell looks uninitialized.
455-
window.addEventListener('pageshow', function(event) {
456-
if (!event.persisted) return;
457-
try {
458-
var outline = document.getElementById('outline');
459-
var hasRows = !!(outline && outline.querySelector('tr'));
460-
var canRun = !!(window.panes && typeof window.panes.runDataBrowser === 'function');
461-
if (!hasRows || !canRun) {
462-
window.location.reload();
463-
}
464-
} catch (_) {
465-
window.location.reload();
466-
}
467-
});
468-
469437
function installAuthReloadFallback() {
470438
if (window.__jssAuthReloadInstalled) return;
471439
@@ -564,10 +532,19 @@ export function shouldServeMashlib(request, mashlibEnabled, contentType) {
564532
return false;
565533
}
566534

567-
// Only serve mashlib for top-level document navigation
568-
// sec-fetch-dest: 'document' = browser navigation (serve mashlib)
569-
// sec-fetch-dest: 'empty' = JavaScript fetch/XHR (serve RDF data)
570-
if (secFetchDest && secFetchDest !== 'document') {
535+
// Block non-navigation sub-resource fetches (XHR, fetch API, scripts, etc.)
536+
// sec-fetch-dest values that indicate non-document fetches are blocked.
537+
// We do NOT require 'document' because on Android Chrome back navigation
538+
// the header may be absent or differ from a fresh forward navigation.
539+
// The Accept: text/html check below is the primary discriminator since
540+
// mashlib XHR never includes text/html in its Accept header.
541+
const nonDocumentDests = new Set([
542+
'empty', 'script', 'worker', 'sharedworker', 'serviceworker',
543+
'style', 'image', 'font', 'media', 'manifest', 'object', 'embed',
544+
'report', 'xslt', 'audioworklet', 'paintworklet', 'track', 'video',
545+
'audio', 'fetch'
546+
]);
547+
if (secFetchDest && nonDocumentDests.has(secFetchDest)) {
571548
return false;
572549
}
573550

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL