Web Inspector: Debugger: don't allow blackboxing of scripts that aren't finished loading or failed to load
https://bugs.webkit.org/show_bug.cgi?id=202376

Reviewed by Matt Baker.

* UserInterface/Models/Resource.js:
(WI.Resource.prototype.get supportsScriptBlackboxing):

* UserInterface/Views/SourceCodeTreeElement.js:
(WI.SourceCodeTreeElement.prototype.updateStatus):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@250813 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog
index 77025c2..e3b8644 100644
--- a/Source/WebInspectorUI/ChangeLog
+++ b/Source/WebInspectorUI/ChangeLog
@@ -1,3 +1,16 @@
+2019-10-07  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Debugger: don't allow blackboxing of scripts that aren't finished loading or failed to load
+        https://bugs.webkit.org/show_bug.cgi?id=202376
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Models/Resource.js:
+        (WI.Resource.prototype.get supportsScriptBlackboxing):
+
+        * UserInterface/Views/SourceCodeTreeElement.js:
+        (WI.SourceCodeTreeElement.prototype.updateStatus):
+
 2019-10-02  Nikita Vasilyev  <nvasilyev@apple.com>
 
         Web Inspector: Styles: for rules that don't match selected node, property values always show as invalid
diff --git a/Source/WebInspectorUI/UserInterface/Models/Resource.js b/Source/WebInspectorUI/UserInterface/Models/Resource.js
index 7f6d52a..4feddc6 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Resource.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Resource.js
@@ -373,6 +373,8 @@
     {
         if (this.isLocalResourceOverride)
             return false;
+        if (!this.finished || this.failed)
+            return false;
         return super.supportsScriptBlackboxing;
     }
 
diff --git a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js
index 4c288aa..2150479 100644
--- a/Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js
@@ -168,7 +168,8 @@
 
             this.status = this._toggleBlackboxedImageElement;
             this._updateToggleBlackboxImageElementState();
-        }
+        } else if (this.status === this._toggleBlackboxedImageElement)
+            this.status = null;
     }
 
     // Protected (ResourceTreeElement calls this when its Resource changes dynamically for Frames)