dbfdg PK !<ё{33chrome.manifestlocale report-site-issue en-US en-US/locale/en-US/ PK !<K8 8 background.js/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; /* globals browser */ const desktopReporterConfig = { src: "desktop-reporter", utm_campaign: "report-site-issue-button", utm_source: "desktop-reporter", }; const androidReporterConfig = { src: "android-components-reporter", utm_campaign: "report-site-issue-button", utm_source: "android-components-reporter", }; const getReporterConfig = (() => { let promise; return async () => { promise ??= new Promise(resolve => { browser.permissions .contains({ permissions: ["nativeMessaging"] }) .then(needProductName => { if (needProductName) { const port = browser.runtime.connectNative( "mozacWebcompatReporter" ); port.onMessage.addListener(message => { if ("productName" in message) { androidReporterConfig.productName = message.productName; androidReporterConfig.extra_labels = [ `browser-${message.productName}`, ]; resolve(androidReporterConfig); // For now, setting the productName and extra_labels is the only use for this port, // and that's only happening once after startup, so let's disconnect the port when we're done. port.disconnect(); } }); } else { resolve(desktopReporterConfig); } }); }); return promise; }; })(); async function loadTab(url) { const newTab = await browser.tabs.create({ url }); return new Promise(resolve => { const listener = (tabId, changeInfo, tab) => { if ( tabId == newTab.id && tab.url !== "about:blank" && changeInfo.status == "complete" ) { browser.tabs.onUpdated.removeListener(listener); resolve(newTab); } }; browser.tabs.onUpdated.addListener(listener); }); } async function captureAndSendReport(tab) { const { id, url } = tab; try { const { endpointUrl, webcompatInfo } = await browser.tabExtras.getWebcompatInfo(id); const reporterConfig = await getReporterConfig(); const dataToSend = { endpointUrl, reportUrl: url, reporterConfig, webcompatInfo, }; const newTab = await loadTab(endpointUrl); browser.tabExtras.sendWebcompatInfo(newTab.id, dataToSend); } catch (err) { console.error("WebCompat Reporter: unexpected error", err); } } if ("helpMenu" in browser) { // desktop browser.helpMenu.onHelpMenuCommand.addListener(captureAndSendReport); } else { // Android browser.pageAction.onClicked.addListener(captureAndSendReport); } PK !<__'en-US/locale/en-US/webcompat.properties wc-reporter.label2=Report Site Issue… wc-reporter.tooltip=Report a site compatibility issue PK ! { let observer = subject => { let nativeTab = subject.wrappedJSObject; let tab = tabManager.convert(nativeTab); fire.async(tab); }; Services.obs.addObserver(observer, TOPIC); return () => { Services.obs.removeObserver(observer, TOPIC); }; }, }).api(), }, }; } }; PK !<:experimentalAPIs/helpMenu.json[ { "namespace": "helpMenu", "events": [ { "name": "onHelpMenuCommand", "type": "function", "async": "callback", "description": "Fired when the command event for the Report Site Issue menuitem in Help is fired.", "parameters": [ { "type": "function", "name": "callback", "optional": true, "parameters": [ { "name": "tab", "$ref": "tabs.Tab", "optional": true, "description": "Details about the selected tab in the window where the menuitem command fired." } ] } ] } ] } ] PK ! { const { browser } = tabManager.get(tabId); const windowGlobal = browser.browsingContext.currentWindowGlobal; if (!windowGlobal) { return null; } return windowGlobal.getActor("ReportBrokenSite").sendQuery(name, params); }; return { tabExtras: { async getWebcompatInfo(tabId) { const endpointUrl = Services.prefs.getStringPref( NEW_REPORT_ENDPOINT_PREF, DEFAULT_NEW_REPORT_ENDPOINT ); const webcompatInfo = await queryReportBrokenSiteActor( tabId, "GetWebCompatInfo" ); return { webcompatInfo, endpointUrl, }; }, async sendWebcompatInfo(tabId, info) { console.error(info); return queryReportBrokenSiteActor( tabId, "SendDataToWebcompatCom", info ); }, }, }; } }; PK !>experimentalAPIs/tabExtras.json[ { "namespace": "tabExtras", "description": "experimental tab API extensions", "functions": [ { "name": "getWebcompatInfo", "type": "function", "description": "Gets the content blocking status and script log for a given tab", "parameters": [ { "type": "integer", "name": "tabId", "minimum": 0 } ], "async": true }, { "name": "sendWebcompatInfo", "type": "function", "description": "Sends the given webcompat info to the given tab", "parameters": [ { "type": "integer", "name": "tabId", "minimum": 0 }, { "type": "any" } ], "async": true } ] } ] PK !<;sicons/lightbulb.svg PK !<$˜ manifest.json{ "manifest_version": 2, "name": "WebCompat Reporter", "description": "Report site compatibility issues on webcompat.com", "author": "Thomas Wisniewski ", "version": "2.1.0", "homepage_url": "https://github.com/mozilla/webcompat-reporter", "browser_specific_settings": { "gecko": { "id": "webcompat-reporter@mozilla.org" } }, "experiment_apis": { "helpMenu": { "schema": "experimentalAPIs/helpMenu.json", "parent": { "scopes": ["addon_parent"], "script": "experimentalAPIs/helpMenu.js", "paths": [["helpMenu"]] } }, "tabExtras": { "schema": "experimentalAPIs/tabExtras.json", "parent": { "scopes": ["addon_parent"], "script": "experimentalAPIs/tabExtras.js", "paths": [["tabExtras"]] } } }, "icons": { "16": "icons/lightbulb.svg", "32": "icons/lightbulb.svg", "48": "icons/lightbulb.svg", "96": "icons/lightbulb.svg", "128": "icons/lightbulb.svg" }, "permissions": ["tabs", ""], "background": { "persistent": false, "type": "module", "scripts": ["background.js"] } } PK !<ё{33chrome.manifestPK !<K8 8 `background.jsPK !<__' en-US/locale/en-US/webcompat.propertiesPK !> experimentalAPIs/tabExtras.jsonPK !<;sicons/lightbulb.svgPK !<$˜ ~!manifest.jsonPK wC&