diff options
Diffstat (limited to 'Source/WebCore/inspector/front-end/ResourceUtils.js')
-rw-r--r-- | Source/WebCore/inspector/front-end/ResourceUtils.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/WebCore/inspector/front-end/ResourceUtils.js b/Source/WebCore/inspector/front-end/ResourceUtils.js index 5c3f49de6..87eabf540 100644 --- a/Source/WebCore/inspector/front-end/ResourceUtils.js +++ b/Source/WebCore/inspector/front-end/ResourceUtils.js @@ -226,3 +226,18 @@ WebInspector.linkifyRequestAsNode = function(request, classes) anchor.requestId = request.requestId; return anchor; } + +/** + * @param {string} content + * @param {string} mimeType + * @param {boolean} contentEncoded + * @return {?string} + */ +WebInspector.contentAsDataURL = function(content, mimeType, contentEncoded) +{ + const maxDataUrlSize = 1024 * 1024; + if (content == null || content.length > maxDataUrlSize) + return null; + + return "data:" + mimeType + (contentEncoded ? ";base64," : ",") + content; +} |