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

Side by Side Diff: chrome/browser/resources/chromeos/wallpaper_manager/js/util.js

Issue 24040002: Fix unexpected error message when quickly select different wallpapers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 var WallpaperUtil = {}; 5 var WallpaperUtil = {};
6 6
7 /** 7 /**
8 * Saves value to local storage that associates with key. 8 * Saves value to local storage that associates with key.
9 * @param {string} key The key that associates with value. 9 * @param {string} key The key that associates with value.
10 * @param {string} value The value to save to local storage. 10 * @param {string} value The value to save to local storage.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 var xhr; 54 var xhr;
55 if (opt_xhr) 55 if (opt_xhr)
56 xhr = opt_xhr; 56 xhr = opt_xhr;
57 else 57 else
58 xhr = new XMLHttpRequest(); 58 xhr = new XMLHttpRequest();
59 59
60 try { 60 try {
61 xhr.addEventListener('loadend', function(e) { 61 xhr.addEventListener('loadend', function(e) {
62 if (this.status == 200) { 62 if (this.status == 200) {
63 onSuccess(this); 63 onSuccess(this);
64 } else if (this.status == 0) {
flackr 2013/09/06 15:44:00 A status of 0 can also result from a network error
65 // The status attribute may return 0 if this request is aborted when
66 // readystate is UNSENT or OPENED. No error message should show. See
67 // http://crbug.com/242581.
68 return;
64 } else { 69 } else {
65 onFailure(); 70 onFailure();
66 } 71 }
67 }); 72 });
68 xhr.open('GET', url, true); 73 xhr.open('GET', url, true);
69 xhr.responseType = type; 74 xhr.responseType = type;
70 xhr.send(null); 75 xhr.send(null);
71 } catch (e) { 76 } catch (e) {
72 onFailure(); 77 onFailure();
73 } 78 }
(...skipping 20 matching lines...) Expand all
94 chrome.wallpaperPrivate.setWallpaper(xhr.response, layout, url, 99 chrome.wallpaperPrivate.setWallpaper(xhr.response, layout, url,
95 onSuccess); 100 onSuccess);
96 self.saveWallpaperInfo(url, layout, 101 self.saveWallpaperInfo(url, layout,
97 Constants.WallpaperSourceEnum.Online); 102 Constants.WallpaperSourceEnum.Online);
98 } else { 103 } else {
99 onFailure(); 104 onFailure();
100 } 105 }
101 }, onFailure); 106 }, onFailure);
102 }); 107 });
103 }; 108 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698