messaging.js (508B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 const manifest = document.querySelector("head > link[rel=manifest]"); 6 if (manifest) { 7 fetch(manifest.href) 8 .then(response => response.json()) 9 .then(json => { 10 const message = { type: "WPAManifest", manifest: json }; 11 browser.runtime.sendNativeMessage("browser", message); 12 }); 13 }