| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 detail: {url: url} | 399 detail: {url: url} |
| 400 })); | 400 })); |
| 401 } | 401 } |
| 402 | 402 |
| 403 WebSocket = function WrappedWebSocket(url, protocols) | 403 WebSocket = function WrappedWebSocket(url, protocols) |
| 404 { | 404 { |
| 405 // Throw correct exceptions if the constructor is used improperly. | 405 // Throw correct exceptions if the constructor is used improperly. |
| 406 if (!(this instanceof WrappedWebSocket)) return RealWebSocket(); | 406 if (!(this instanceof WrappedWebSocket)) return RealWebSocket(); |
| 407 if (arguments.length < 1) return new RealWebSocket(); | 407 if (arguments.length < 1) return new RealWebSocket(); |
| 408 | 408 |
| 409 var websocket = new RealWebSocket(url, protocols || []); | 409 var websocket; |
| 410 if (arguments.length == 1) | |
| 411 websocket = new RealWebSocket(url); | |
| 412 else | |
| 413 websocket = new RealWebSocket(url, protocols); | |
|
Wladimir Palant
2016/08/15 12:33:24
Why make assumptions about the arguments in the fi
Wladimir Palant
2016/08/15 12:45:36
This will also allow dropping protocols parameter
Wladimir Palant
2016/08/15 13:01:24
Never mind, calling RealWebSocket.apply() won't wo
Sebastian Noack
2016/08/15 13:06:10
See patchset #2 (and the related discussin) for a
| |
| 410 | 414 |
| 411 checkRequest(websocket.url, function(blocked) | 415 checkRequest(websocket.url, function(blocked) |
| 412 { | 416 { |
| 413 if (blocked) | 417 if (blocked) |
| 414 closeWebSocket(websocket); | 418 closeWebSocket(websocket); |
| 415 }); | 419 }); |
| 416 | 420 |
| 417 return websocket; | 421 return websocket; |
| 418 }.bind(); | 422 }.bind(); |
| 419 | 423 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 614 }, true); | 618 }, true); |
| 615 | 619 |
| 616 return updateStylesheet; | 620 return updateStylesheet; |
| 617 } | 621 } |
| 618 | 622 |
| 619 if (document instanceof HTMLDocument) | 623 if (document instanceof HTMLDocument) |
| 620 { | 624 { |
| 621 checkSitekey(); | 625 checkSitekey(); |
| 622 window.updateStylesheet = init(document); | 626 window.updateStylesheet = init(document); |
| 623 } | 627 } |
| LEFT | RIGHT |