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

Delta Between Two Patch Sets: lib/io.js

Issue 29339112: Issue 3716 - Split up files stored in storage.local (Closed)
Left Patch Set: Fix the promise logic. Remove whitespace changes. Created April 1, 2016, 12:41 p.m.
Right Patch Set: Remove the trailing comma. Created April 1, 2016, 1:14 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « chrome/ext/background.js ('k') | lib/prefs.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 loadFile(file).then(onLoaded, callback); 90 loadFile(file).then(onLoaded, callback);
91 }, 91 },
92 92
93 writeToFile: function(file, data, callback) 93 writeToFile: function(file, data, callback)
94 { 94 {
95 let items = {}; 95 let items = {};
96 let entry = items[fileToKey(file)] = {lastModified: Date.now()}; 96 let entry = items[fileToKey(file)] = {lastModified: Date.now()};
97 97
98 if (typeof browser == "object") 98 if (typeof browser == "object")
Oleksandr 2016/04/01 12:45:10 I was using this to test in Chrome. Just noticed t
99 { 99 {
100 loadFile(file).catch(() => null) 100 loadFile(file).catch(() => null)
101 .then(oldEntry => 101 .then(oldEntry =>
102 { 102 {
103 let quota = 1024 * 1024 / 2 - 1000; 103 let quota = 1024 * 1024 / 2 - 1000;
104 let chunks = []; 104 let chunks = [];
105 let chunk = []; 105 let chunk = [];
106 let chunkSize = 0; 106 let chunkSize = 0;
107 107
108 for (let line of data) 108 for (let line of data)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 { 140 {
141 function onLoaded(entry) 141 function onLoaded(entry)
142 { 142 {
143 callback(null, { 143 callback(null, {
144 exists: true, 144 exists: true,
145 lastModified: entry.lastModified 145 lastModified: entry.lastModified
146 }); 146 });
147 } 147 }
148 148
149 loadFile(file).then(onLoaded, callback); 149 loadFile(file).then(onLoaded, callback);
150 }, 150 }
Sebastian Noack 2016/04/01 13:01:05 Nit: You added a redundant comma here. There shoul
151 }; 151 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld