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

Side by Side Diff: content/browser/resources/net/network_errors_listing.js

Issue 1421743002: Implement chrome://network-errors for direct access to network error interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up NetworkErrorRequestJob remnants Created 5 years 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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 cr.define('errorCodes', function() {
6 'use strict';
7
8 /**
9 * Generate the page content.
10 * @param {Array.<Object>} errorCodes Error codes array consisting of a
11 * numerical error ID and error code string.
12 */
13 function listErrorCodes(errorCodes) {
14 var errorPageURL = 'chrome://network-error/';
Dan Beam 2015/12/01 04:24:17 nit: errorPageUrl
edwardjung 2015/12/01 12:30:08 Done.
15 var errorCodesList = document.createElement('ul');
16 for (var i = 0; i < errorCodes.length; i++) {
17 var listEl = document.createElement('li');
18 var errorCodeLinkEl = document.createElement('a');
19 errorCodeLinkEl.href = errorPageURL + errorCodes[i].errorId;
20 errorCodeLinkEl.textContent = errorCodes[i].errorCode + ' (' +
21 errorCodes[i].errorId + ')';
22 listEl.appendChild(errorCodeLinkEl);
23 errorCodesList.appendChild(listEl);
24 }
25 $('pages').appendChild(errorCodesList);
26 }
27
28 function initialize() {
29 var xhr = new XMLHttpRequest();
30 xhr.open('GET', 'network-error-data.json', true);
Dan Beam 2015/12/01 04:24:17 nit: do you need the async param (true)?
edwardjung 2015/12/01 12:30:08 Removed, I'm still in the mindset of developing fo
31 xhr.addEventListener('load', function(e) {
32 if (xhr.status === 200) {
33 var data = JSON.parse(xhr.responseText);
Dan Beam 2015/12/01 04:24:17 do you want to handle the semi-likely case that th
edwardjung 2015/12/01 12:30:08 Done
34 listErrorCodes(data['errorCodes']);
35 }
36 });
Dan Beam 2015/12/01 04:24:17 indent off
edwardjung 2015/12/01 12:30:08 Done.
37 xhr.send(null);
Dan Beam 2015/12/01 04:24:17 why not just send()?
edwardjung 2015/12/01 12:30:08 Done
38 }
39
40 return {
41 initialize: initialize
42 };
43 });
44
45 document.addEventListener('DOMContentLoaded', errorCodes.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698