Extension of Mozilla Firefox

0

I have a problem, my extension does not work at all, first of all, I will explain what it is for:

This extension when active inserts data into a form from a given web site, receiving this data through the socket of an application made in Java.

In Google Chrome works perfectly, with a delay of 2 seconds for each item added to the form (this started to happen recently, I do not know why), so with all the tests I've done, this is because some update your version.

But changing from water to wine, I did not come by chrome, but by mozilla, I'll make the extension available and wait for help.

Manifest:

{
    "name": "SGIR - Extensão",
    "manifest_version": 2,
    "version": "1.1",
    "description": "Preencher formulários",
    "browser_action": {
        "default_popup": "popup.html"
    },
    "permissions": [
        "contextMenus",
        "//Determinado site da web"
    ],
    "content_scripts": [{
        "js": ["funcao.js"],
        "matches": ["//Determinado site da web"]
    }]
}

Function:

var ws = new WebSocket("ws://localhost:30000");
var itens = [];

ws.onopen = function ()
{
    ws.send("");
   // alert("Mensagem enviada...");
};

ws.onmessage = function (evt)
{
    var received_msg = evt.data;
    itens.push(received_msg);

    var ni = document.getElementById("NI");
    ni.value = itens[0].toString();

    var codigoacesso = document.getElementById("CodigoAcesso");
    codigoacesso.value = itens[1].toString();

    var senha = document.getElementById("Senha");
    senha.value = itens[2].toString();

    itens.splice(0,itens.length);
};

ws.onclose = function ()
{
    // websocket is closed.
    //alert("Conexão fechada...");
};

window.onbeforeunload = function (event) {
    socket.close();
};

Scriptjs:

/* global browser */

browser.tabs.query({
    active: true,
    windowType: "normal",
    currentWindow: true
}, function (tab) {
    browser.tabs.executeScript(tab[0].id, {
        "file": "funcao.js"
    });
});

Popup:

<!doctype html>
<html>
    <head>
        <script src="scriptjs.js"></script>
    </head>
    <body>

        Programa criado por @netoschneider

    </body>
</html>
    
asked by anonymous 27.01.2018 / 02:46

0 answers