Skip to content

Commit

Permalink
#203 websockets
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizzick committed May 5, 2016
1 parent 8b11814 commit f78be7e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Extension/lib/content-script/websocket.js
Expand Up @@ -27,6 +27,9 @@
*/
var overrideWebSocket = function () {

var postMessage = window.postMessage;
var addEventListener = window.addEventListener;

'use strict';
var Wrapped = window.WebSocket;
var map = new WeakMap();
Expand Down Expand Up @@ -233,10 +236,10 @@ var overrideWebSocket = function () {
initConnection(that, event.data.collapse);
}

window.addEventListener("message", messageListener, false);
addEventListener.call(window, "message", messageListener, false);

// Send a message to the background page to check if the request should be blocked
window.postMessage({
postMessage.call(window, {
direction: 'from-page-script@adguard',
elementUrl: url,
documentUrl: document.URL
Expand Down

0 comments on commit f78be7e

Please sign in to comment.