Firefox WebExtensions send message from browser to extension and get response in call back function
<p>I'm trying to convert my Chrome extension to a FireFox WebExtensions . I am having an issue to communicating between my webpage to the background script.
From content script I am injecting some functions into browser page. That functions need to call browser extension and get response for that.</p>

<blockquote>
  <p>manifest.json
  </p>
</blockquote>

<pre><code>{
"manifest_version" : 2,
"name" : "Sample",
"description" : "Sample",
"version" : "1.0",

"icons" : {
    "48" : "icons/link-48.png"
},

"applications" : {
    "gecko" : {
        "id" : "sample@sss.com",
        "strict_min_version" : "48.0"
    }
},

"permissions" : ["notifications", "alarms", "storage"],

"background" : {
    "scripts" : [
        "js/jquery.js",
        "background-script.js"
    ]

},
"web_accessible_resources" : ["js/content.js"], // Not working in firefox
"externally_connectable" : {
    "matches" : [
        "http://localhost/*",]
},
"content_scripts" : [{
        "matches" : ["&lt;all_urls&gt;"],
        "js" : ["js/jquery.js",
            "js/script.js",
            "content-script.js"
        ],
        "run_at" : "document_start"
    }
],
"default_locale" : "en"
}
</code></pre>

<blockquote>
  <p>content-script.js</p>
</blockquote>

<pre><code>var port = chrome.runtime.connect();

window.addEventListener("message", function(event) {

if (event.source != window)
    return;

if (event.data.type &amp;&amp; (event.data.type == "FROM_PAGE")) {
    console.log("Content script received: " + event.data.text);
    chrome.runtime.sendMessage({
        hello: 1
    },function (response)
    {
        //Need to send response back to browser
    });
}
}, false);
</code></pre>

<blockquote>
  <p>background-script.js</p>
</blockquote>

<pre><code>chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
    alert('bg');
    var response_Text = '-1';

    if (request.hello) {
        console.log('hello received');
        sendResponse("213");
    }
});
</code></pre>

<blockquote>
  <p>browser page</p>
</blockquote>

<pre><code>window.postMessage({ type: "FROM_PAGE", text: "Hello from the webpage!" },"*");
</code></pre>

<p>I am using the <strong>window.postMessage</strong> to send some content. </p>

<p>Is it possible to get callback value for this function or any method available to send message to extension from webpage and get response?</p>