Web Inspector: Remove dead code in FrameTreeElement
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / Views / FrameTreeElement.js
index af3e3ae..9bc6db4 100644 (file)
@@ -38,6 +38,7 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
         frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
         frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
         frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved, this._resourceWasRemoved, this);
+        frame.addEventListener(WebInspector.Frame.Event.ExtraScriptAdded, this._extraScriptAdded, this);
         frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasAdded, this._childFrameWasAdded, this);
         frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved, this._childFrameWasRemoved, this);
 
@@ -45,24 +46,27 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
         frame.domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasRemoved, this._childContentFlowWasRemoved, this);
         frame.domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated, this._rootDOMNodeInvalidated, this);
 
-        if (this._frame.isMainFrame())
-            this._downloadingPage = false;
-
         this.shouldRefreshChildren = true;
         this.folderSettingsKey = this._frame.url.hash;
 
         this.registerFolderizeSettings("frames", WebInspector.UIString("Frames"),
-            function(representedObject) { return representedObject instanceof WebInspector.Frame; },
-            function() { return this.frame.childFrames.length; }.bind(this),
+            (representedObject) => representedObject instanceof WebInspector.Frame,
+            () => this.frame.childFrames.length,
             WebInspector.FrameTreeElement
         );
 
         this.registerFolderizeSettings("flows", WebInspector.UIString("Flows"),
-            function(representedObject) { return representedObject instanceof WebInspector.ContentFlow; },
-            function() { return this.frame.domTree.flowsCount; }.bind(this),
+            (representedObject) => representedObject instanceof WebInspector.ContentFlow,
+            () => this.frame.domTree.flowsCount,
             WebInspector.ContentFlowTreeElement
         );
 
+        this.registerFolderizeSettings("extra-scripts", WebInspector.UIString("Extra Scripts"),
+            (representedObject) => representedObject instanceof WebInspector.Script && representedObject.dynamicallyAddedScriptElement,
+            () => this.frame.extraScripts.length,
+            WebInspector.ScriptTreeElement
+        );
+
         function makeValidateCallback(resourceType) {
             return function(representedObject) {
                 return representedObject instanceof WebInspector.Resource && representedObject.type === resourceType;
@@ -135,6 +139,8 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
     {
         // Immediate superclasses are skipped, since Frames handle their own SourceMapResources.
         WebInspector.GeneralTreeElement.prototype.onattach.call(this);
+
+        this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this));
     }
 
     // Overrides from FolderizedTreeElement (Protected).
@@ -189,6 +195,10 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
         for (var flowKey in flowMap)
             this.addChildForRepresentedObject(flowMap[flowKey]);
 
+        for (let extraScript of this._frame.extraScripts) {
+            if (extraScript.sourceURL || extraScript.sourceMappingURL)
+                this.addChildForRepresentedObject(extraScript);
+        }
     }
 
     onexpand()
@@ -240,6 +250,13 @@ WebInspector.FrameTreeElement = class FrameTreeElement extends WebInspector.Reso
         this.removeChildForRepresentedObject(event.data.resource);
     }
 
+    _extraScriptAdded(event)
+    {
+        let extraScript = event.data.script;
+        if (extraScript.sourceURL || extraScript.sourceMappingURL)
+            this.addRepresentedObjectToNewChildQueue(extraScript);
+    }
+
     _childFrameWasAdded(event)
     {
         this.addRepresentedObjectToNewChildQueue(event.data.childFrame);