alexmarcoo / open-in-native-client

GNU General Public License v3.0
120 stars 49 forks source link

Stopped working on all FF-based browsers #10

Closed siffegh closed 4 years ago

siffegh commented 4 years ago

Addon has stopped working on all FF-based browsers including one with fresh, clean profile. I get either no response or the 'make sure native-client patch is installed popup'. Everything looks OK in the registry and in the appdata/local/com.mybrowseraddon.node folder. The Chrome extension still works.

siffegh commented 4 years ago

More info:

In the browser console, I see

Unchecked lastError value: Error: undefined chrome.js:61 postMessage moz-extension://301ab72d-3199-4a84-9018-1ccf34403c0c/lib/chrome/chrome.js:61

Which opens a page with this code, and the ' chrome.runtime.sendNativeMessage('com.mybrowseraddon.node', {' line is highlighted:

var app = {};

app.name = function () {return chrome.runtime.getManifest().name}; app.version = function () {return chrome.runtime.getManifest().version}; app.short_name = function () {return chrome.runtime.getManifest().short_name}; app.tab = {"open": function (url) {chrome.tabs.create({"url": url, "active": true})}}; if (chrome.runtime.setUninstallURL) chrome.runtime.setUninstallURL(config.welcome.url + "?v=" + app.version() + "&type=uninstall", function () {});

app.storage = (function () { var objs = {}; window.setTimeout(function () { chrome.storage.local.get(null, function (o) { objs = o; var script = document.createElement("script"); script.src = "../common.js"; document.body.appendChild(script); }); }, 300); / / return { "read": function (id) {return objs[id]}, "write": function (id, data) { var tmp = {}; objs[id] = data; tmp[id] = data; chrome.storage.local.set(tmp, function () {}); } } })();

app.notifications = (function () { chrome.notifications.onClicked.addListener(function () {app.tab.open(config.welcome.url + "#faq")}); / / return { "create": function (message) { chrome.notifications.create({ "type": "basic", "message": message, "title": app.name(), "iconUrl": chrome.runtime.getURL("data/icons/64.png") }, function () {}); } } })();

app.context_menu = { "create": function (id, title, contexts, callback) { chrome.contextMenus.create({ "id": id, "title": title, "contexts": contexts, "onclick": function (e) { callback(e.linkUrl || e.pageUrl || e.srcUrl || null); } }); } };

app.nativeClient = { "postMessage": function (args, callback) { chrome.runtime.sendNativeMessage('com.mybrowseraddon.node', { "args": args, "permissions": ['child_process'], "script": var stdout = '', stderr = ''; var app = require('child_process').spawn(args[0], args.slice(1).filter(a => a), {detached: true}); app.stdout.on('data', function (data) {stdout += data}); app.stderr.on('data', function (data) {stderr += data}); app.on('close', function (code) { push({code, stdout, stderr}); close(); }); }, callback); } };

app.options = (function () { var _tmp = {}; chrome.runtime.onMessage.addListener(function (request, sender, sendeponse) { for (var id in _tmp) { if (_tmp[id] && (typeof _tmp[id] === "function")) { if (request.path === 'options-to-background') { if (request.method === id) _tmpid; } } } }); / / return { "receive": function (id, callback) {_tmp[id] = callback}, "send": function (id, data, tabId) { chrome.runtime.sendMessage({"path": 'background-to-options', "method": id, "data": data}); } } })();

siffegh commented 4 years ago

More info:

In the browser console, I see

Unchecked lastError value: Error: undefined chrome.js:61 postMessage moz-extension://301ab72d-3199-4a84-9018-1ccf34403c0c/lib/chrome/chrome.js:61

Which opens a page with this code, and the ' chrome.runtime.sendNativeMessage('com.mybrowseraddon.node', {' line is highlighted:

var app = {};

app.name = function () {return chrome.runtime.getManifest().name}; app.version = function () {return chrome.runtime.getManifest().version}; app.short_name = function () {return chrome.runtime.getManifest().short_name}; app.tab = {"open": function (url) {chrome.tabs.create({"url": url, "active": true})}}; if (chrome.runtime.setUninstallURL) chrome.runtime.setUninstallURL(config.welcome.url + "?v=" + app.version() + "&type=uninstall", function () {});

app.storage = (function () { var objs = {}; window.setTimeout(function () { chrome.storage.local.get(null, function (o) { objs = o; var script = document.createElement("script"); script.src = "../common.js"; document.body.appendChild(script); }); }, 300); / / return { "read": function (id) {return objs[id]}, "write": function (id, data) { var tmp = {}; objs[id] = data; tmp[id] = data; chrome.storage.local.set(tmp, function () {}); } } })();

app.notifications = (function () { chrome.notifications.onClicked.addListener(function () {app.tab.open(config.welcome.url + "#faq")}); / / return { "create": function (message) { chrome.notifications.create({ "type": "basic", "message": message, "title": app.name(), "iconUrl": chrome.runtime.getURL("data/icons/64.png") }, function () {}); } } })();

app.context_menu = { "create": function (id, title, contexts, callback) { chrome.contextMenus.create({ "id": id, "title": title, "contexts": contexts, "onclick": function (e) { callback(e.linkUrl || e.pageUrl || e.srcUrl || null); } }); } };

app.nativeClient = { "postMessage": function (args, callback) { chrome.runtime.sendNativeMessage('com.mybrowseraddon.node', { "args": args, "permissions": ['child_process'], "script": var stdout = '', stderr = ''; var app = require('child_process').spawn(args[0], args.slice(1).filter(a => a), {detached: true}); app.stdout.on('data', function (data) {stdout += data}); app.stderr.on('data', function (data) {stderr += data}); app.on('close', function (code) { push({code, stdout, stderr}); close(); }); }, callback); } };

app.options = (function () { var _tmp = {}; chrome.runtime.onMessage.addListener(function (request, sender, sendeponse) { for (var id in _tmp) { if (_tmp[id] && (typeof _tmp[id] === "function")) { if (request.path === 'options-to-background') { if (request.method === id) _tmpid; } } } }); / / return { "receive": function (id, callback) {_tmp[id] = callback}, "send": function (id, data, tabId) { chrome.runtime.sendMessage({"path": 'background-to-options', "method": id, "data": data}); } } })();

siffegh commented 4 years ago

Aaach, never mind. It was being caused by NoVirusThanks' OSArmor. Although not sure why it only affected FF...