| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of the Adblock Plus extension, | 2 * This file is part of the Adblock Plus extension, |
| 3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 listener.process(null); | 174 listener.process(null); |
| 175 callback(null); | 175 callback(null); |
| 176 }.bind(this)); | 176 }.bind(this)); |
| 177 }, | 177 }, |
| 178 | 178 |
| 179 writeToFile: function(file, encode, data, callback, timeLineID) | 179 writeToFile: function(file, encode, data, callback, timeLineID) |
| 180 { | 180 { |
| 181 var path = this._getFilePath(file); | 181 var path = this._getFilePath(file); |
| 182 this._setFileContents(path, data.join(this.lineBreak) + this.lineBreak, Da te.now()); | 182 this._setFileContents(path, data.join(this.lineBreak) + this.lineBreak, Da te.now()); |
| 183 | 183 |
| 184 // Fake asynchronous execution | 184 var Utils = require("utils").Utils; |
| 185 setTimeout(callback.bind(null, null), 0); | 185 Utils.runAsync(callback, null, null); |
| 186 }, | 186 }, |
| 187 | 187 |
| 188 copyFile: function(fromFile, toFile, callback) | 188 copyFile: function(fromFile, toFile, callback) |
| 189 { | 189 { |
| 190 // Simply combine read and write operations | 190 // Simply combine read and write operations |
| 191 var data = []; | 191 var data = []; |
| 192 this.readFromFile(fromFile, false, { | 192 this.readFromFile(fromFile, false, { |
| 193 process: function(line) | 193 process: function(line) |
| 194 { | 194 { |
| 195 if (line !== null) | 195 if (line !== null) |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 runAsync: function(callback, thisPtr) | 308 runAsync: function(callback, thisPtr) |
| 309 { | 309 { |
| 310 var params = Array.prototype.slice.call(arguments, 2); | 310 var params = Array.prototype.slice.call(arguments, 2); |
| 311 | 311 |
| 312 function invokeCallback() | 312 function invokeCallback() |
| 313 { | 313 { |
| 314 callback.apply(thisPtr, params); | 314 callback.apply(thisPtr, params); |
| 315 } | 315 } |
| 316 | 316 |
| 317 if (document.readyState === "complete") | 317 if (document.readyState === "complete") |
| 318 window.setTimeout(invokeCallback); | 318 window.setTimeout(invokeCallback, 0); |
|
Wladimir Palant
2012/11/21 15:47:58
setTimeout(..., 0)?
Felix Dahlke
2012/11/21 15:56:56
You're right. This only worked because the readySt
| |
| 319 else | 319 else |
| 320 window.addEventListener("load", invokeCallback); | 320 window.addEventListener("load", invokeCallback); |
| 321 }, | 321 }, |
| 322 get appLocale() | 322 get appLocale() |
| 323 { | 323 { |
| 324 // Note: navigator.language | 324 // Note: navigator.language |
| 325 return window.navigator.browserLanguage; | 325 return window.navigator.browserLanguage; |
| 326 }, | 326 }, |
| 327 generateChecksum: function(lines) | 327 generateChecksum: function(lines) |
| 328 { | 328 { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 status: -1, | 511 status: -1, |
| 512 notificationCallbacks: {}, | 512 notificationCallbacks: {}, |
| 513 loadFlags: 0, | 513 loadFlags: 0, |
| 514 INHIBIT_CACHING: 0, | 514 INHIBIT_CACHING: 0, |
| 515 VALIDATE_ALWAYS: 0, | 515 VALIDATE_ALWAYS: 0, |
| 516 QueryInterface: function() | 516 QueryInterface: function() |
| 517 { | 517 { |
| 518 return this; | 518 return this; |
| 519 } | 519 } |
| 520 }; | 520 }; |
| LEFT | RIGHT |