Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include.preload.js

Issue 29349816: Fixes 4331, 4332 - WebSocket.length and instanceof WebSocket (Closed)
Patch Set: Assign WrappedWebSocket.prototype more simply Created Aug. 15, 2016, 8:35 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/requestBlocker.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.preload.js
diff --git a/include.preload.js b/include.preload.js
index 1ea213d7479fed931b8dc3985746cc162fc6dc77..7acdbb149870180bd26785a5fd8a7432da1db692 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)
{
// 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,9 @@ function wrapWebSocket(document)
});
return websocket;
- }.bind();
-
+ }
+ WrappedWebSocket.prototype = RealWebSocket.prototype;
+ WebSocket = WrappedWebSocket.bind();
Object.defineProperties(WebSocket, {
CONNECTING: {value: RealWebSocket.CONNECTING, enumerable: true},
OPEN: {value: RealWebSocket.OPEN, enumerable: true},
« no previous file with comments | « no previous file | lib/requestBlocker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld