Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/resources/offline_pages/offline_internals.js

Issue 2274733002: [Offline pages] Add null pointer checks in offline internals code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incognito Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/offline/offline_internals_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('offlineInternals', function() { 5 cr.define('offlineInternals', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** @type {!Array<OfflinePage>} */ 8 /** @type {!Array<OfflinePage>} */
9 var offlinePages = []; 9 var offlinePages = [];
10 10
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 188 }
189 189
190 /** 190 /**
191 * @param {!boolean} enabled Whether to enable Logging. 191 * @param {!boolean} enabled Whether to enable Logging.
192 */ 192 */
193 function toggleRequestQueueLog(enabled) { 193 function toggleRequestQueueLog(enabled) {
194 browserProxy_.setRecordRequestQueue(enabled); 194 browserProxy_.setRecordRequestQueue(enabled);
195 $('request-status').textContent = enabled ? 'On' : 'Off'; 195 $('request-status').textContent = enabled ? 'On' : 'Off';
196 } 196 }
197 197
198 var incognito = loadTimeData.getBoolean('isIncognito');
199 $('clear-all').disabled = incognito;
200 $('clear-selected').disabled = incognito;
201 $('log-model-on').disabled = incognito;
202 $('log-model-off').disabled = incognito;
203 $('log-request-on').disabled = incognito;
204 $('log-request-off').disabled = incognito;
205 $('refresh').disabled = incognito;
206
198 $('clear-all').onclick = deleteAllPages; 207 $('clear-all').onclick = deleteAllPages;
199 $('clear-selected').onclick = deleteSelectedPages; 208 $('clear-selected').onclick = deleteSelectedPages;
200 $('refresh').onclick = refreshAll; 209 $('refresh').onclick = refreshAll;
201 $('download').onclick = download; 210 $('download').onclick = download;
202 $('log-model-on').onclick = togglePageModelLog.bind(this, true); 211 $('log-model-on').onclick = togglePageModelLog.bind(this, true);
203 $('log-model-off').onclick = togglePageModelLog.bind(this, false); 212 $('log-model-off').onclick = togglePageModelLog.bind(this, false);
204 $('log-request-on').onclick = toggleRequestQueueLog.bind(this, true); 213 $('log-request-on').onclick = toggleRequestQueueLog.bind(this, true);
205 $('log-request-off').onclick = toggleRequestQueueLog.bind(this, false); 214 $('log-request-off').onclick = toggleRequestQueueLog.bind(this, false);
206 $('refresh-logs').onclick = refreshLog; 215 $('refresh-logs').onclick = refreshLog;
207 $('add-to-queue').onclick = function() { 216 $('add-to-queue').onclick = function() {
(...skipping 11 matching lines...) Expand all
219 if (counter == 0) { 228 if (counter == 0) {
220 browserProxy_.getRequestQueue().then(fillRequestQueue); 229 browserProxy_.getRequestQueue().then(fillRequestQueue);
221 } 230 }
222 } else { 231 } else {
223 $('save-url-state').textContent += 232 $('save-url-state').textContent +=
224 saveUrls[i] + ' failed to be added to queue.\n'; 233 saveUrls[i] + ' failed to be added to queue.\n';
225 } 234 }
226 }); 235 });
227 } 236 }
228 }; 237 };
229 238 if (!incognito)
230 refreshAll(); 239 refreshAll();
231 } 240 }
232 241
233 // Return an object with all of the exports. 242 // Return an object with all of the exports.
234 return { 243 return {
235 initialize: initialize, 244 initialize: initialize,
236 }; 245 };
237 }); 246 });
238 247
239 document.addEventListener('DOMContentLoaded', offlineInternals.initialize); 248 document.addEventListener('DOMContentLoaded', offlineInternals.initialize);
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/offline/offline_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698