Index: include.preload.js |
diff --git a/include.preload.js b/include.preload.js |
index 1ea213d7479fed931b8dc3985746cc162fc6dc77..b41deea4931c823cf7e6b650badf6bd7c998f56c 100644 |
--- a/include.preload.js |
+++ b/include.preload.js |
@@ -362,7 +362,7 @@ function wrapWebSocket(document) |
document.addEventListener(eventName, function(event) |
{ |
ext.backgroundPage.sendMessage({ |
- type: "websocket-request", |
+ type: "request.websocket", |
url: event.detail.url |
}, function (block) |
{ |
@@ -398,7 +398,7 @@ function wrapWebSocket(document) |
})); |
} |
- WebSocket = function WrappedWebSocket(url, protocols) |
+ function WrappedWebSocket(url) |
kzar
2016/08/15 19:29:00
For some reason if I did this in one step I no lon
|
{ |
// Throw correct exceptions if the constructor is used improperly. |
if (!(this instanceof WrappedWebSocket)) return RealWebSocket(); |
@@ -408,7 +408,7 @@ function wrapWebSocket(document) |
if (arguments.length == 1) |
websocket = new RealWebSocket(url); |
else |
- websocket = new RealWebSocket(url, protocols); |
+ websocket = new RealWebSocket(url, arguments[1]); |
checkRequest(websocket.url, function(blocked) |
{ |
@@ -417,8 +417,10 @@ function wrapWebSocket(document) |
}); |
return websocket; |
- }.bind(); |
- |
+ } |
+ Object.defineProperty(WrappedWebSocket, "prototype", |
+ {value: RealWebSocket.prototype}); |
kzar
2016/08/15 19:29:00
We have to define the prototype here so that `...
Wladimir Palant
2016/08/15 20:20:35
Since the website cannot access WrappedWebSocket,
kzar
2016/08/15 20:36:21
Done.
|
+ WebSocket = WrappedWebSocket.bind(); |
Object.defineProperties(WebSocket, { |
CONNECTING: {value: RealWebSocket.CONNECTING, enumerable: true}, |
OPEN: {value: RealWebSocket.OPEN, enumerable: true}, |