Fixes the bug where SourceViews would be blank if shown before
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 May 2008 22:30:16 +0000 (22:30 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 May 2008 22:30:16 +0000 (22:30 +0000)
the Resource finished loading.

<rdar://problem/5807420> Safari's Web Inspector won't display the
contents of some CSS and JS files

Reviewed by Kevin McCullough.

* page/inspector/Resource.js:
(WebInspector.Resource.prototype.set finished): Dispatch the finished event
(WebInspector.Resource.prototype): Inherit from WebInspector.Object.prototype.
* page/inspector/SourceView.js:
(WebInspector.SourceView): Register for the finished event on the resource.
When the event fires, setup the source frame and deregister the event.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@33409 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/page/inspector/Resource.js
WebCore/page/inspector/SourceView.js

index f41093e..5b21985 100644 (file)
@@ -1,5 +1,22 @@
 2008-05-13  Timothy Hatcher  <timothy@apple.com>
 
+        Fixes the bug where SourceViews would be blank if shown before
+        the Resource finished loading.
+
+        <rdar://problem/5807420> Safari's Web Inspector won't display the
+        contents of some CSS and JS files
+
+        Reviewed by Kevin McCullough.
+
+        * page/inspector/Resource.js:
+        (WebInspector.Resource.prototype.set finished): Dispatch the finished event
+        (WebInspector.Resource.prototype): Inherit from WebInspector.Object.prototype.
+        * page/inspector/SourceView.js:
+        (WebInspector.SourceView): Register for the finished event on the resource.
+        When the event fires, setup the source frame and deregister the event.
+
+2008-05-13  Timothy Hatcher  <timothy@apple.com>
+
         Factored most of SourceView out into SourceFrame so it can be shared
         by the new ScriptView. Added the ScriptView class to be used for
         scripts that arn't Resources (like eval code.) Added a simple Script
index b23f202..b30c145 100644 (file)
@@ -230,6 +230,7 @@ WebInspector.Resource.prototype = {
         if (x) {
             this._checkTips();
             this._checkWarnings();
+            this.dispatchEventToListeners("finished");
         }
     },
 
@@ -506,6 +507,8 @@ WebInspector.Resource.prototype = {
     }
 }
 
+WebInspector.Resource.prototype.__proto__ = WebInspector.Object.prototype;
+
 WebInspector.Resource.CompareByTime = function(a, b)
 {
     if (a.responseReceivedTime < b.responseReceivedTime)
index fa85148..4c70b74 100644 (file)
@@ -30,6 +30,8 @@ WebInspector.SourceView = function(resource)
 {
     WebInspector.ResourceView.call(this, resource);
 
+    resource.addEventListener("finished", this._resourceLoadingFinished, this);
+
     this.element.addStyleClass("source");
 
     this._frameNeedsSetup = true;
@@ -79,6 +81,13 @@ WebInspector.SourceView.prototype = {
         // when it is removed from the document. Is this a bug?
         WebInspector.ResourceView.prototype.detach.call(this);
         this._frameNeedsSetup = true;
+    },
+
+    _resourceLoadingFinished: function(event)
+    {
+        if (this.visible)
+            this.setupSourceFrameIfNeeded();
+        this.resource.removeEventListener("finished", this._resourceLoadingFinished, this);
     }
 }