checkForManifest(aWindow) { // Only top-level browsing contexts are valid. if (!aWindow || aWindow.top !== aWindow) { return false; } const elem = aWindow.document.querySelector("link[rel~='manifest']"); // Only if we have an element and a non-empty href attribute. if (!elem || !elem.getAttribute("href")) { return false; } return true; } PK