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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionServer.js

Issue 1609973002: DevTools: promisify ContentProvider.requestContent and all its clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 contentEncoded = contentProvider.contentEncoded; 517 contentEncoded = contentProvider.contentEncoded;
518 if (contentProvider instanceof WebInspector.NetworkRequest) 518 if (contentProvider instanceof WebInspector.NetworkRequest)
519 contentEncoded = contentProvider.contentEncoded; 519 contentEncoded = contentProvider.contentEncoded;
520 var response = { 520 var response = {
521 encoding: contentEncoded && content ? "base64" : "", 521 encoding: contentEncoded && content ? "base64" : "",
522 content: content 522 content: content
523 }; 523 };
524 this._dispatchCallback(message.requestId, port, response); 524 this._dispatchCallback(message.requestId, port, response);
525 } 525 }
526 526
527 contentProvider.requestContent(onContentAvailable.bind(this)); 527 contentProvider.requestContent().then(onContentAvailable.bind(this));
528 }, 528 },
529 529
530 _onGetRequestContent: function(message, port) 530 _onGetRequestContent: function(message, port)
531 { 531 {
532 var request = this._requestById(message.id); 532 var request = this._requestById(message.id);
533 if (!request) 533 if (!request)
534 return this._status.E_NOTFOUND(message.id); 534 return this._status.E_NOTFOUND(message.id);
535 this._getResourceContent(request, message, port); 535 this._getResourceContent(request, message, port);
536 }, 536 },
537 537
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 /** 1081 /**
1082 * @typedef {{code: string, description: string, details: !Array.<*>}} 1082 * @typedef {{code: string, description: string, details: !Array.<*>}}
1083 */ 1083 */
1084 WebInspector.ExtensionStatus.Record; 1084 WebInspector.ExtensionStatus.Record;
1085 1085
1086 WebInspector.extensionAPI = {}; 1086 WebInspector.extensionAPI = {};
1087 defineCommonExtensionSymbols(WebInspector.extensionAPI); 1087 defineCommonExtensionSymbols(WebInspector.extensionAPI);
1088 1088
1089 /** @type {!WebInspector.ExtensionServer} */ 1089 /** @type {!WebInspector.ExtensionServer} */
1090 WebInspector.extensionServer; 1090 WebInspector.extensionServer;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698