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

Side by Side Diff: Source/devtools/front_end/sdk/CSSStyleModel.js

Issue 685203003: DevTools: Get rid of synchronous XHRs in the frontend code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 1 month 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 WebInspector.console.error("Failed to get text for stylesheet " + this.id + ": " + error); 1586 WebInspector.console.error("Failed to get text for stylesheet " + this.id + ": " + error);
1587 text = ""; 1587 text = "";
1588 // Fall through. 1588 // Fall through.
1589 } 1589 }
1590 text = this._trimSourceURL(text); 1590 text = this._trimSourceURL(text);
1591 callback(text); 1591 callback(text);
1592 } 1592 }
1593 }, 1593 },
1594 1594
1595 /** 1595 /**
1596 * @return {!Promise.<string>}
1597 */
1598 requestContentPromise: function()
1599 {
1600 return new Promise(requestContent.bind(this));
1601
1602 /**
1603 * @param {function(string)} fulfill
1604 * @param {function(*)} reject
1605 * @this {WebInspector.CSSStyleSheetHeader}
1606 */
1607 function requestContent(fulfill, reject)
1608 {
1609 this.requestContent(callback.bind(null, fulfill));
pfeldman 2014/11/10 10:23:25 this.requestContent(fullfill) ?
1610 }
1611
1612 /**
1613 * @param {function(string)} fulfill
1614 * @param {string} content
1615 */
1616 function callback(fulfill, content)
1617 {
1618 fulfill(content);
1619 }
1620 },
1621
1622 /**
1596 * @override 1623 * @override
1597 */ 1624 */
1598 searchInContent: function(query, caseSensitive, isRegex, callback) 1625 searchInContent: function(query, caseSensitive, isRegex, callback)
1599 { 1626 {
1600 function performSearch(content) 1627 function performSearch(content)
1601 { 1628 {
1602 callback(WebInspector.ContentProvider.performSearchInContent(content , query, caseSensitive, isRegex)); 1629 callback(WebInspector.ContentProvider.performSearchInContent(content , query, caseSensitive, isRegex));
1603 } 1630 }
1604 1631
1605 // searchInContent should call back later. 1632 // searchInContent should call back later.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 for (var i = 0; i < callbacks.length; ++i) 1741 for (var i = 0; i < callbacks.length; ++i)
1715 callbacks[i](computedStyle); 1742 callbacks[i](computedStyle);
1716 } 1743 }
1717 } 1744 }
1718 } 1745 }
1719 1746
1720 /** 1747 /**
1721 * @type {!WebInspector.CSSStyleModel} 1748 * @type {!WebInspector.CSSStyleModel}
1722 */ 1749 */
1723 WebInspector.cssModel; 1750 WebInspector.cssModel;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698