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

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: 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 function requestData() {
9 var xhr = new XMLHttpRequest();
10 xhr.open('GET', 'network-error-data.json', false);
Dan Beam 2015/11/24 20:08:20 don't do synchronous XHR
edwardjung 2015/11/24 21:42:12 Done.
11 xhr.send(null);
12 if (xhr.status === 200) {
13 return JSON.parse(xhr.responseText);
14 }
Dan Beam 2015/11/24 20:08:20 nit: no curlies
edwardjung 2015/11/24 21:42:12 Done.
15 return [];
16 }
17
Dan Beam 2015/11/24 20:08:20 /** @param {Array} errorCode preferably with Arra
edwardjung 2015/11/24 21:42:12 Done.
18 function listErrorCodes(errorCodes) {
19 var errorPageURL = 'chrome://network-error/';
20 var errorCodesList = document.createElement('ul');
21 for (var i = 0; i < errorCodes.length; i++) {
22 var listEl = document.createElement('li');
23 var errorCodeLinkEl = document.createElement('a');
24 errorCodeLinkEl.href = errorPageURL + errorCodes[i].errorid;
25 errorCodeLinkEl.textContent = errorCodes[i].errorCode + ' (' +
26 errorCodes[i].errorid + ')';
27 listEl.appendChild(errorCodeLinkEl);
28 errorCodesList.appendChild(listEl);
29 }
30 $('pages').appendChild(errorCodesList);
31 }
32
33 function initialize() {
34 var data = requestData();
Dan Beam 2015/11/24 20:08:20 why are you making a method to only use it once?
edwardjung 2015/11/24 21:42:12 Removed.
35 $('pages').textContent = '';
Dan Beam 2015/11/24 20:08:20 what is this doing? clearing #pages?
edwardjung 2015/11/24 21:42:12 Removed.
36 listErrorCodes(data['errorCodes']);
37 }
38
39 return {
40 initialize: initialize
41 };
42 });
43
44 document.addEventListener('DOMContentLoaded', errorCodes.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698