azon_seeker/scripts/verify-port-disconnect-build.mjs

17 lines
758 B
JavaScript

import { readFile } from 'node:fs/promises';
const background = await readFile('extension/dist/background/index.mjs', 'utf8');
const contentScript = await readFile('extension/dist/contentScripts/index.global.js', 'utf8');
if (!background.includes('lastError')) {
throw new Error('Background bundle does not consume runtime.lastError on port disconnect.');
}
if (!contentScript.includes('back/forward cache')) {
throw new Error('Content script bundle does not recognize BFCache port closures.');
}
if (!contentScript.includes('pagehide') || !contentScript.includes('pageshow')) {
throw new Error('Content script bundle does not suspend and resume the BFCache port lifecycle.');
}
console.log('Production BFCache port handling verification passed.');