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

Side by Side Diff: inject.preload.js

Issue 29445639: Noissue - Use lowercase for WebRTC and WebSocket resource types (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Uppercase resource type before check Created May 22, 2017, 5:20 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/requestBlocker.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 ); 192 );
193 193
194 function WrappedWebSocket(url, ...args) 194 function WrappedWebSocket(url, ...args)
195 { 195 {
196 // Throw correct exceptions if the constructor is used improperly. 196 // Throw correct exceptions if the constructor is used improperly.
197 if (!(this instanceof WrappedWebSocket)) return RealWebSocket(); 197 if (!(this instanceof WrappedWebSocket)) return RealWebSocket();
198 if (arguments.length < 1) return new RealWebSocket(); 198 if (arguments.length < 1) return new RealWebSocket();
199 199
200 let websocket = new RealWebSocket(url, ...args); 200 let websocket = new RealWebSocket(url, ...args);
201 201
202 checkRequest("WEBSOCKET", websocket.url, blocked => 202 checkRequest("websocket", websocket.url, blocked =>
203 { 203 {
204 if (blocked) 204 if (blocked)
205 closeWebSocket(websocket); 205 closeWebSocket(websocket);
206 }); 206 });
207 207
208 return websocket; 208 return websocket;
209 } 209 }
210 WrappedWebSocket.prototype = RealWebSocket.prototype; 210 WrappedWebSocket.prototype = RealWebSocket.prototype;
211 window.WebSocket = WrappedWebSocket.bind(); 211 window.WebSocket = WrappedWebSocket.bind();
212 copyProperties(RealWebSocket, WebSocket, 212 copyProperties(RealWebSocket, WebSocket,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 return createObject(configuration, { 290 return createObject(configuration, {
291 iceServers: { 291 iceServers: {
292 configurable: false, enumerable: false, writable: false, 292 configurable: false, enumerable: false, writable: false,
293 value: iceServers 293 value: iceServers
294 } 294 }
295 }); 295 });
296 } 296 }
297 297
298 function checkUrl(peerconnection, url) 298 function checkUrl(peerconnection, url)
299 { 299 {
300 checkRequest("WEBRTC", url, blocked => 300 checkRequest("webrtc", url, blocked =>
301 { 301 {
302 if (blocked) 302 if (blocked)
303 { 303 {
304 // Calling .close() throws if already closed. 304 // Calling .close() throws if already closed.
305 try 305 try
306 { 306 {
307 closeRTCPeerConnection(peerconnection); 307 closeRTCPeerConnection(peerconnection);
308 } 308 }
309 catch (e) {} 309 catch (e) {}
310 } 310 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 if (document instanceof HTMLDocument) 388 if (document instanceof HTMLDocument)
389 { 389 {
390 let script = document.createElement("script"); 390 let script = document.createElement("script");
391 script.type = "application/javascript"; 391 script.type = "application/javascript";
392 script.async = false; 392 script.async = false;
393 script.textContent = "(" + injected + ")('" + randomEventName + "');"; 393 script.textContent = "(" + injected + ")('" + randomEventName + "');";
394 document.documentElement.appendChild(script); 394 document.documentElement.appendChild(script);
395 document.documentElement.removeChild(script); 395 document.documentElement.removeChild(script);
396 } 396 }
OLDNEW
« 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