| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -287,22 +287,6 @@ export function generateDatabrowserHtml(resourceUrl, cdnVersion = null, opts = { | |||
| 287 | 287 | } catch {} | |
| 288 | 288 | })(); | |
| 289 | 289 | ||
| 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 | - | ||
| 306 | 290 | function showError(message) { | |
| 307 | 291 | document.body.innerHTML = '<p>' + message + '</p>'; | |
| 308 | 292 | } | |
@@ -450,22 +434,6 @@ export function generateDatabrowserHtml(resourceUrl, cdnVersion = null, opts = { | |||
| 450 | 434 | } catch {} | |
| 451 | 435 | })(); | |
| 452 | 436 | ||
| 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 | - | ||
| 469 | 437 | function installAuthReloadFallback() { | |
| 470 | 438 | if (window.__jssAuthReloadInstalled) return; | |
| 471 | 439 | ||
@@ -564,10 +532,19 @@ export function shouldServeMashlib(request, mashlibEnabled, contentType) { | |||
| 564 | 532 | return false; | |
| 565 | 533 | } | |
| 566 | 534 | ||
| 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)) { | ||
| 571 | 548 | return false; | |
| 572 | 549 | } | |
| 573 | 550 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments