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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/RequestResponseView.js

Issue 1609973002: DevTools: promisify ContentProvider.requestContent and all its clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaseline Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 * @override 112 * @override
113 * @return {!WebInspector.ResourceType} 113 * @return {!WebInspector.ResourceType}
114 */ 114 */
115 contentType: function() 115 contentType: function()
116 { 116 {
117 return this._request.resourceType(); 117 return this._request.resourceType();
118 }, 118 },
119 119
120 /** 120 /**
121 * @override 121 * @override
122 * @param {function(?string)} callback 122 * @return {!Promise<?string>}
123 */ 123 */
124 requestContent: function(callback) 124 requestContent: function()
125 { 125 {
126 /** 126 /**
127 * @param {?string} content 127 * @param {?string} content
128 * @this {WebInspector.RequestResponseView.ContentProvider} 128 * @this {WebInspector.RequestResponseView.ContentProvider}
129 */ 129 */
130 function decodeContent(content) 130 function decodeContent(content)
131 { 131 {
132 callback(this._request.contentEncoded ? window.atob(content || "") : content); 132 return this._request.contentEncoded ? window.atob(content || "") : c ontent;
133 } 133 }
134 134
135 this._request.requestContent(decodeContent.bind(this)); 135 return this._request.requestContent()
136 .then(decodeContent.bind(this));
136 }, 137 },
137 138
138 /** 139 /**
139 * @override 140 * @override
140 * @param {string} query 141 * @param {string} query
141 * @param {boolean} caseSensitive 142 * @param {boolean} caseSensitive
142 * @param {boolean} isRegex 143 * @param {boolean} isRegex
143 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback 144 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback
144 */ 145 */
145 searchInContent: function(query, caseSensitive, isRegex, callback) 146 searchInContent: function(query, caseSensitive, isRegex, callback)
146 { 147 {
147 this._request.searchInContent(query, caseSensitive, isRegex, callback); 148 this._request.searchInContent(query, caseSensitive, isRegex, callback);
148 } 149 }
149 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698