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

Unified Diff: inject.preload.js

Issue 29721716: Issue 6473 - Remove WebSocket wrapper (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created March 13, 2018, 4:33 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') | lib/requestBlocker.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: inject.preload.js
===================================================================
--- a/inject.preload.js
+++ b/inject.preload.js
@@ -133,18 +133,17 @@
let thisShadow = shadowRoot(this);
return thisShadow == ourShadowRoot ? null : thisShadow;
}
});
}
}
/*
- * Shared request checking code, used by both the WebSocket and
- * RTCPeerConnection wrappers.
+ * Shared request checking code, used by the RTCPeerConnection wrapper.
Sebastian Noack 2018/03/13 17:43:01 Well, it's no longer shared. We probably should ju
Manish Jethani 2018/03/13 18:05:11 Done.
*/
let RealCustomEvent = window.CustomEvent;
// If we've been injected into a frame via contentWindow then we can simply
// grab the copy of checkRequest left for us by the parent document. Otherwise
// we need to set it up now, along with the event handling functions.
if (injectedIntoContentWindow)
checkRequest = window[eventName];
@@ -178,50 +177,16 @@
{
Object.defineProperty(dest, name,
Object.getOwnPropertyDescriptor(src, name));
}
}
}
/*
- * WebSocket wrapper
- *
- * Required before Chrome 58, since the webRequest API didn't allow us to
- * intercept WebSockets.
- * See https://bugs.chromium.org/p/chromium/issues/detail?id=129353
- */
- let RealWebSocket = WebSocket;
- let closeWebSocket = Function.prototype.call.bind(
- RealWebSocket.prototype.close
- );
-
- function WrappedWebSocket(url, ...args)
- {
- // Throw correct exceptions if the constructor is used improperly.
- if (!(this instanceof WrappedWebSocket)) return RealWebSocket();
- if (arguments.length < 1) return new RealWebSocket();
-
- let websocket = new RealWebSocket(url, ...args);
-
- checkRequest("websocket", websocket.url, blocked =>
- {
- if (blocked)
- closeWebSocket(websocket);
- });
-
- return websocket;
- }
- WrappedWebSocket.prototype = RealWebSocket.prototype;
- window.WebSocket = WrappedWebSocket.bind();
- copyProperties(RealWebSocket, WebSocket,
- ["CONNECTING", "OPEN", "CLOSING", "CLOSED", "prototype"]);
- RealWebSocket.prototype.constructor = WebSocket;
-
- /*
* RTCPeerConnection wrapper
*
* The webRequest API in Chrome does not yet allow the blocking of
* WebRTC connections.
* See https://bugs.chromium.org/p/chromium/issues/detail?id=707683
*/
let RealRTCPeerConnection = window.RTCPeerConnection ||
window.webkitRTCPeerConnection;
« no previous file with comments | « no previous file | lib/requestBlocker.js » ('j') | lib/requestBlocker.js » ('J')

Powered by Google App Engine
This is Rietveld