| OLD | NEW | 
|---|
| 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-present eyeo GmbH | 3  * Copyright (C) 2006-present 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 229       if (method != "GET") | 229       if (method != "GET") | 
| 230         throw new Error("Only GET requests are supported"); | 230         throw new Error("Only GET requests are supported"); | 
| 231       if (typeof async != "undefined" && !async) | 231       if (typeof async != "undefined" && !async) | 
| 232         throw new Error("Sync requests are not supported"); | 232         throw new Error("Sync requests are not supported"); | 
| 233       if (typeof user != "undefined" || typeof password != "undefined") | 233       if (typeof user != "undefined" || typeof password != "undefined") | 
| 234         throw new Error("User authentification is not supported"); | 234         throw new Error("User authentification is not supported"); | 
| 235 | 235 | 
| 236       let match = /^data:[^,]+,/.exec(url); | 236       let match = /^data:[^,]+,/.exec(url); | 
| 237       if (match) | 237       if (match) | 
| 238       { | 238       { | 
| 239         this._data = decodeURIComponent(url.substr(match[0].length)); | 239         this._data = decodeURIComponent(url.substring(match[0].length)); | 
| 240         return; | 240         return; | 
| 241       } | 241       } | 
| 242 | 242 | 
| 243       if (url.substr(0, this._host.length + 1) != this._host + "/") | 243       if (url.substring(0, this._host.length + 1) != this._host + "/") | 
| 244         throw new Error("Unexpected URL: " + url + " (URL starting with " + this
     ._host + "expected)"); | 244         throw new Error("Unexpected URL: " + url + " (URL starting with " + this
     ._host + "expected)"); | 
| 245 | 245 | 
| 246       this._path = url.substr(this._host.length); | 246       this._path = url.substring(this._host.length); | 
| 247 | 247 | 
| 248       let queryIndex = this._path.indexOf("?"); | 248       let queryIndex = this._path.indexOf("?"); | 
| 249       this._queryString = ""; | 249       this._queryString = ""; | 
| 250       if (queryIndex >= 0) | 250       if (queryIndex >= 0) | 
| 251       { | 251       { | 
| 252         this._queryString = this._path.substr(queryIndex + 1); | 252         this._queryString = this._path.substring(queryIndex + 1); | 
| 253         this._path = this._path.substr(0, queryIndex); | 253         this._path = this._path.substring(0, queryIndex); | 
| 254       } | 254       } | 
| 255     }, | 255     }, | 
| 256 | 256 | 
| 257     send(data) | 257     send(data) | 
| 258     { | 258     { | 
| 259       if (!this._data && !this._path) | 259       if (!this._data && !this._path) | 
| 260         throw new Error("No request path set"); | 260         throw new Error("No request path set"); | 
| 261       if (typeof data != "undefined" && data) | 261       if (typeof data != "undefined" && data) | 
| 262         throw new Error("Sending data to server is not supported"); | 262         throw new Error("Sending data to server is not supported"); | 
| 263 | 263 | 
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 405       } | 405       } | 
| 406     }) | 406     }) | 
| 407   }; | 407   }; | 
| 408 }; | 408 }; | 
| 409 | 409 | 
| 410 exports.unexpectedError = function(error) | 410 exports.unexpectedError = function(error) | 
| 411 { | 411 { | 
| 412   console.error(error); | 412   console.error(error); | 
| 413   this.ok(false, "Unexpected error: " + error); | 413   this.ok(false, "Unexpected error: " + error); | 
| 414 }; | 414 }; | 
| OLD | NEW | 
|---|