<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[179999] trunk/Source/WebInspectorUI</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/179999">179999</a></dd>
<dt>Author</dt> <dd>burg@cs.washington.edu</dd>
<dt>Date</dt> <dd>2015-02-12 10:42:21 -0800 (Thu, 12 Feb 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Large background image fails to load in inspector
https://bugs.webkit.org/show_bug.cgi?id=141405
Reviewed by Timothy Hatcher.
Convert base64-encoded resource data to binary data using Uint8Array and Blobs.
Use object URLs for blobs instead of data URLs when setting image 'src' attribute
and in @font-face urls. This conversion happens when the backend indicates that
resource content is base64-encoded.
Update image and font clients of resource-fetching functionality so that they use
object URLs correctly. Add some plumbing so that Blobs can be constructed with
the correct mime-type.
* UserInterface/Base/Utilities.js:
(decodeBase64ToBlob): Added.
* UserInterface/Models/CSSStyleSheet.js:
(WebInspector.CSSStyleSheet.prototype.get mimeType): Added.
* UserInterface/Models/Resource.js:
(WebInspector.Resource.prototype.createObjectURL): Added.
(WebInspector.Resource.prototype.getImageSize.imageDidLoad):
(WebInspector.Resource.prototype.getImageSize):
(WebInspector.Resource.prototype.get contentURL): Deleted.
* UserInterface/Models/Script.js:
(WebInspector.Script.prototype.get mimeType): Added.
* UserInterface/Models/SourceCode.js:
(WebInspector.SourceCode.prototype.get mimeType): Added.
(WebInspector.SourceCode.prototype._processContent):
(WebInspector.SourceCode.prototype.get contentIsBase64Encoded): Deleted.
* UserInterface/Models/SourceCodeRevision.js:
(WebInspector.SourceCodeRevision):
(WebInspector.SourceCodeRevision.prototype.copy):
(WebInspector.SourceCodeRevision.prototype.get contentIsBase64Encoded): Deleted.
(WebInspector.SourceCodeRevision.prototype.set contentIsBase64Encoded): Deleted.
* UserInterface/Views/FontResourceContentView.js:
(WebInspector.FontResourceContentView.prototype.hidden):
(WebInspector.FontResourceContentView.prototype.closed):
* UserInterface/Views/ImageResourceContentView.js:
(WebInspector.ImageResourceContentView.prototype.contentAvailable):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseUtilitiesjs">trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsCSSStyleSheetjs">trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsResourcejs">trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsScriptjs">trunk/Source/WebInspectorUI/UserInterface/Models/Script.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsSourceCodejs">trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsSourceCodeRevisionjs">trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeRevision.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsFontResourceContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsImageResourceContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (179998 => 179999)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-02-12 18:35:12 UTC (rev 179998)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-02-12 18:42:21 UTC (rev 179999)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2015-02-12 Brian J. Burg <burg@cs.washington.edu>
+
+ Web Inspector: Large background image fails to load in inspector
+ https://bugs.webkit.org/show_bug.cgi?id=141405
+
+ Reviewed by Timothy Hatcher.
+
+ Convert base64-encoded resource data to binary data using Uint8Array and Blobs.
+ Use object URLs for blobs instead of data URLs when setting image 'src' attribute
+ and in @font-face urls. This conversion happens when the backend indicates that
+ resource content is base64-encoded.
+
+ Update image and font clients of resource-fetching functionality so that they use
+ object URLs correctly. Add some plumbing so that Blobs can be constructed with
+ the correct mime-type.
+
+ * UserInterface/Base/Utilities.js:
+ (decodeBase64ToBlob): Added.
+ * UserInterface/Models/CSSStyleSheet.js:
+ (WebInspector.CSSStyleSheet.prototype.get mimeType): Added.
+ * UserInterface/Models/Resource.js:
+ (WebInspector.Resource.prototype.createObjectURL): Added.
+ (WebInspector.Resource.prototype.getImageSize.imageDidLoad):
+ (WebInspector.Resource.prototype.getImageSize):
+ (WebInspector.Resource.prototype.get contentURL): Deleted.
+ * UserInterface/Models/Script.js:
+ (WebInspector.Script.prototype.get mimeType): Added.
+ * UserInterface/Models/SourceCode.js:
+ (WebInspector.SourceCode.prototype.get mimeType): Added.
+ (WebInspector.SourceCode.prototype._processContent):
+ (WebInspector.SourceCode.prototype.get contentIsBase64Encoded): Deleted.
+ * UserInterface/Models/SourceCodeRevision.js:
+ (WebInspector.SourceCodeRevision):
+ (WebInspector.SourceCodeRevision.prototype.copy):
+ (WebInspector.SourceCodeRevision.prototype.get contentIsBase64Encoded): Deleted.
+ (WebInspector.SourceCodeRevision.prototype.set contentIsBase64Encoded): Deleted.
+ * UserInterface/Views/FontResourceContentView.js:
+ (WebInspector.FontResourceContentView.prototype.hidden):
+ (WebInspector.FontResourceContentView.prototype.closed):
+ * UserInterface/Views/ImageResourceContentView.js:
+ (WebInspector.ImageResourceContentView.prototype.contentAvailable):
+
</ins><span class="cx"> 2015-02-11 Nikita Vasilyev <nvasilyev@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: REGRESSION: Clicking selected item in the sidebar second time should scroll to the corresponding line
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseUtilitiesjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (179998 => 179999)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js        2015-02-12 18:35:12 UTC (rev 179998)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js        2015-02-12 18:42:21 UTC (rev 179999)
</span><span class="lines">@@ -1044,3 +1044,27 @@
</span><span class="cx"> {
</span><span class="cx"> array.splice(insertionIndexForObjectInListSortedByFunction(object, array, comparator), 0, object);
</span><span class="cx"> }
</span><ins>+
+function decodeBase64ToBlob(base64Data, mimeType)
+{
+ mimeType = mimeType || '';
+
+ const sliceSize = 1024;
+ var byteCharacters = atob(base64Data);
+ var bytesLength = byteCharacters.length;
+ var slicesCount = Math.ceil(bytesLength / sliceSize);
+ var byteArrays = new Array(slicesCount);
+
+ for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
+ var begin = sliceIndex * sliceSize;
+ var end = Math.min(begin + sliceSize, bytesLength);
+
+ var bytes = new Array(end - begin);
+ for (var offset = begin, i = 0 ; offset < end; ++i, ++offset)
+ bytes[i] = byteCharacters[offset].charCodeAt(0);
+
+ byteArrays[sliceIndex] = new Uint8Array(bytes);
+ }
+
+ return new Blob(byteArrays, {type: mimeType});
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsCSSStyleSheetjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js (179998 => 179999)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js        2015-02-12 18:35:12 UTC (rev 179998)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js        2015-02-12 18:42:21 UTC (rev 179999)
</span><span class="lines">@@ -75,6 +75,11 @@
</span><span class="cx"> return this._urlComponents;
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ get mimeType()
+ {
+ return "text/css";
+ },
+
</ins><span class="cx"> get displayName()
</span><span class="cx"> {
</span><span class="cx"> if (this._url)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsResourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (179998 => 179999)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js        2015-02-12 18:35:12 UTC (rev 179998)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js        2015-02-12 18:42:21 UTC (rev 179999)
</span><span class="lines">@@ -254,16 +254,17 @@
</span><span class="cx"> return this._mimeType;
</span><span class="cx"> },
</span><span class="cx">
</span><del>- get contentURL()
</del><ins>+ createObjectURL: function()
</ins><span class="cx"> {
</span><del>- const maximumDataURLSize = 1024 * 1024; // 1 MiB
</del><ins>+ // If content is not available, fallback to using original URL.
+ // The client may try to revoke it, but nothing will happen.
+ if (!this.content)
+ return this._url;
</ins><span class="cx">
</span><del>- // If content is not available or won't fit a data URL, fallback to using original URL.
</del><span class="cx"> var content = this.content;
</span><del>- if (content === null || content.length > maximumDataURLSize)
- return this._url;
</del><ins>+ console.assert(content instanceof Blob, content);
</ins><span class="cx">
</span><del>- return "data:" + this.mimeTypeComponents.type + (this.contentIsBase64Encoded ? ";base64," + content : "," + encodeURIComponent(content));
</del><ins>+ return URL.createObjectURL(content);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> isMainResource: function()
</span><span class="lines">@@ -651,9 +652,13 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ var objectURL = null;
+
</ins><span class="cx"> // Event handler for the image "load" event.
</span><span class="cx"> function imageDidLoad()
</span><span class="cx"> {
</span><ins>+ URL.revokeObjectURL(objectURL);
+
</ins><span class="cx"> // Cache the image metrics.
</span><span class="cx"> this._imageSize = {
</span><span class="cx"> width: image.width,
</span><span class="lines">@@ -668,9 +673,9 @@
</span><span class="cx"> var image = new Image;
</span><span class="cx"> image.addEventListener("load", imageDidLoad.bind(this), false);
</span><span class="cx">
</span><del>- // Set the image source once we've obtained the base64-encoded URL for it.
</del><ins>+ // Set the image source using an object URL once we've obtained its data.
</ins><span class="cx"> this.requestContent().then(function(content) {
</span><del>- image.src = content.sourceCode.contentURL;
</del><ins>+ objectURL = image.src = content.sourceCode.createObjectURL();
</ins><span class="cx"> });
</span><span class="cx"> },
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsScriptjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Script.js (179998 => 179999)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/Script.js        2015-02-12 18:35:12 UTC (rev 179998)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Script.js        2015-02-12 18:42:21 UTC (rev 179999)
</span><span class="lines">@@ -84,6 +84,11 @@
</span><span class="cx"> return this._urlComponents;
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ get mimeType()
+ {
+ return this._resource.mimeType;
+ },
+
</ins><span class="cx"> get displayName()
</span><span class="cx"> {
</span><span class="cx"> if (this._url)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsSourceCodejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js (179998 => 179999)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js        2015-02-12 18:35:12 UTC (rev 179998)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js        2015-02-12 18:42:21 UTC (rev 179999)
</span><span class="lines">@@ -88,11 +88,6 @@
</span><span class="cx"> return this._currentRevision.content;
</span><span class="cx"> },
</span><span class="cx">
</span><del>- get contentIsBase64Encoded()
- {
- return this._currentRevision.contentIsBase64Encoded;
- },
-
</del><span class="cx"> get sourceMaps()
</span><span class="cx"> {
</span><span class="cx"> return this._sourceMaps || [];
</span><span class="lines">@@ -186,6 +181,12 @@
</span><span class="cx"> return Promise.reject(new Error("Needs to be implemented by a subclass."));
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ get mimeType()
+ {
+ // Implemented by subclasses.
+ console.error("Needs to be implemented by a subclass.");
+ },
+
</ins><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _processContent: function(parameters)
</span><span class="lines">@@ -193,20 +194,19 @@
</span><span class="cx"> // Different backend APIs return one of `content, `body`, `text`, or `scriptSource`.
</span><span class="cx"> var content = parameters.content || parameters.body || parameters.text || parameters.scriptSource;
</span><span class="cx"> var error = parameters.error;
</span><del>- var base64Encoded = parameters.base64Encoded;
</del><ins>+ if (parameters.base64Encoded)
+ content = decodeBase64ToBlob(content, this.mimeType);
</ins><span class="cx">
</span><span class="cx"> var revision = this.revisionForRequestedContent;
</span><span class="cx">
</span><span class="cx"> this._ignoreRevisionContentDidChangeEvent = true;
</span><span class="cx"> revision.content = content || null;
</span><del>- revision.contentIsBase64Encoded = base64Encoded || false;
</del><span class="cx"> delete this._ignoreRevisionContentDidChangeEvent;
</span><span class="cx">
</span><span class="cx"> return Promise.resolve({
</span><span class="cx"> error: error,
</span><span class="cx"> sourceCode: this,
</span><span class="cx"> content: content,
</span><del>- base64Encoded: base64Encoded
</del><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsSourceCodeRevisionjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeRevision.js (179998 => 179999)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeRevision.js        2015-02-12 18:35:12 UTC (rev 179998)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeRevision.js        2015-02-12 18:42:21 UTC (rev 179999)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-WebInspector.SourceCodeRevision = function(sourceCode, content, contentIsBase64Encoded)
</del><ins>+WebInspector.SourceCodeRevision = function(sourceCode, content)
</ins><span class="cx"> {
</span><span class="cx"> WebInspector.Revision.call(this);
</span><span class="cx">
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx">
</span><span class="cx"> this._sourceCode = sourceCode;
</span><span class="cx"> this._content = content || "";
</span><del>- this._contentIsBase64Encoded = contentIsBase64Encoded || false;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.SourceCodeRevision.prototype = {
</span><span class="lines">@@ -61,16 +60,6 @@
</span><span class="cx"> this._sourceCode.revisionContentDidChange(this);
</span><span class="cx"> },
</span><span class="cx">
</span><del>- get contentIsBase64Encoded()
- {
- return this._contentIsBase64Encoded;
- },
-
- set contentIsBase64Encoded(encoded)
- {
- this._contentIsBase64Encoded = encoded || false;
- },
-
</del><span class="cx"> apply: function()
</span><span class="cx"> {
</span><span class="cx"> this._sourceCode.currentRevision = this;
</span><span class="lines">@@ -83,7 +72,7 @@
</span><span class="cx">
</span><span class="cx"> copy: function()
</span><span class="cx"> {
</span><del>- return new WebInspector.SourceCodeRevision(this._sourceCode, this._content, this._contentIsBase64Encoded);
</del><ins>+ return new WebInspector.SourceCodeRevision(this._sourceCode, this._content);
</ins><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsFontResourceContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js (179998 => 179999)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js        2015-02-12 18:35:12 UTC (rev 179998)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js        2015-02-12 18:42:21 UTC (rev 179999)
</span><span class="lines">@@ -94,8 +94,10 @@
</span><span class="cx"> if (this._styleElement && this._styleElement.parentNode)
</span><span class="cx"> this._styleElement.parentNode.removeChild(this._styleElement);
</span><span class="cx">
</span><ins>+ this._fontObjectURL = this.resource.createObjectURL();
+
</ins><span class="cx"> this._styleElement = document.createElement("style");
</span><del>- this._styleElement.textContent = "@font-face { font-family: \"" + uniqueFontName + "\"; src: url(" + this.resource.contentURL + ")" + format + "; }";
</del><ins>+ this._styleElement.textContent = "@font-face { font-family: \"" + uniqueFontName + "\"; src: url(" + this._fontObjectURL + ")" + format + "; }";
</ins><span class="cx">
</span><span class="cx"> // The style element will be added when shown later if we are not visible now.
</span><span class="cx"> if (this.visible)
</span><span class="lines">@@ -153,6 +155,16 @@
</span><span class="cx"> // Remove the style element so it will not stick around when this content view is destroyed.
</span><span class="cx"> if (this._styleElement && this._styleElement.parentNode)
</span><span class="cx"> this._styleElement.parentNode.removeChild(this._styleElement);
</span><ins>+ },
+
+ closed: function()
+ {
+ // This is a workaround for the fact that the browser does not send any events
+ // when a @font-face resource is loaded. So, we assume it could be needed until
+ // the content view is destroyed, as re-attaching the style element would cause
+ // the object URL to be resolved again.
+ if (this._fontObjectURL)
+ URL.revokeObjectURL(this._fontObjectURL);
</ins><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsImageResourceContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js (179998 => 179999)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js        2015-02-12 18:35:12 UTC (rev 179998)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js        2015-02-12 18:42:21 UTC (rev 179999)
</span><span class="lines">@@ -46,8 +46,10 @@
</span><span class="cx"> {
</span><span class="cx"> this.element.removeChildren();
</span><span class="cx">
</span><ins>+ var objectURL = this.resource.createObjectURL();
</ins><span class="cx"> this._imageElement = document.createElement("img");
</span><del>- this._imageElement.src = this.resource.contentURL;
</del><ins>+ this._imageElement.addEventListener("load", function() { URL.revokeObjectURL(objectURL); });
+ this._imageElement.src = objectURL;
</ins><span class="cx">
</span><span class="cx"> this.element.appendChild(this._imageElement);
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>