Web Inspector: Make showing a content view work in the tab world
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 01:20:59 +0000 (01:20 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 01:20:59 +0000 (01:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144110

Reviewed by Joseph Pecoraro.

* UserInterface/Base/Main.js:
(WebInspector.loaded):
(WebInspector.hideSplitConsole):
(WebInspector.showSourceCodeLocation):
(WebInspector.showOriginalUnformattedSourceCodeLocation):
(WebInspector.showOriginalOrFormattedSourceCodeLocation):
(WebInspector.showOriginalOrFormattedSourceCodeTextRange):
(WebInspector.showResourceRequest):
(WebInspector.debuggerToggleBreakpoints):
(WebInspector.debuggerPauseResumeToggle):
(WebInspector.debuggerStepOver):
(WebInspector.debuggerStepInto):
(WebInspector.debuggerStepOut):
(WebInspector._focusChanged):
(WebInspector._mouseWasClicked):
(WebInspector._dragOver):
(WebInspector._captureDidStart):
(WebInspector._debuggerDidPause):
(WebInspector._debuggerDidResume):
(WebInspector._frameWasAdded):
(WebInspector._undock):
(WebInspector._updateDockNavigationItems):
* UserInterface/Models/Breakpoint.js:
(WebInspector.Breakpoint.prototype.appendContextMenuItems.revealOriginalSourceCodeLocation):
(WebInspector.Breakpoint.prototype.appendContextMenuItems):
* UserInterface/Protocol/InspectorFrontendAPI.js:
(InspectorFrontendAPI.showMainResourceForFrame):
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype.tokenTrackingControllerHighlightedRangeWasClicked):
* UserInterface/Views/ComputedStyleDetailsPanel.js:
(WebInspector.ComputedStyleDetailsPanel.prototype._goToRegionFlowArrowWasClicked):
(WebInspector.ComputedStyleDetailsPanel.prototype._goToContentFlowArrowWasClicked):
(WebInspector.ComputedStyleDetailsPanel):
* UserInterface/Views/ContentBrowser.js:
(WebInspector.ContentBrowser.prototype.updateHierarchicalPathForCurrentContentView):
* UserInterface/Views/ContentView.js:
(WebInspector.ContentView):
* UserInterface/Views/DOMTreeContentView.js:
(WebInspector.DOMTreeContentView.prototype.restoreFromCookie):
* UserInterface/Views/DOMTreeDataGridNode.js:
(WebInspector.DOMTreeDataGridNode.prototype._goToArrowWasClicked):
* UserInterface/Views/DebuggerSidebarPanel.js:
(WebInspector.DebuggerSidebarPanel.prototype.showDefaultContentView):
(WebInspector.DebuggerSidebarPanel.prototype._addTreeElementForSourceCodeToContentTreeOutline):
(WebInspector.DebuggerSidebarPanel.prototype._treeElementSelected):
(WebInspector.DebuggerSidebarPanel.prototype._addIssue):
(WebInspector.DebuggerSidebarPanel.prototype._handleIssueAdded):
* UserInterface/Views/LayerTreeDataGridNode.js:
(WebInspector.LayerTreeDataGridNode.prototype._goToArrowWasClicked):
* UserInterface/Views/LayoutTimelineView.js:
(WebInspector.LayoutTimelineView.prototype._treeElementSelected):
* UserInterface/Views/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel.prototype.get contentBrowser):
(WebInspector.NavigationSidebarPanel.prototype.set contentBrowser):
(WebInspector.NavigationSidebarPanel.prototype._updateFilter):
* UserInterface/Views/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView.prototype._treeElementSelected):
* UserInterface/Views/ObjectTreeBaseTreeElement.js:
(WebInspector.ObjectTreeBaseTreeElement.prototype._appendMenusItemsForObject):
(WebInspector.ObjectTreeBaseTreeElement):
* UserInterface/Views/OverviewTimelineView.js:
(WebInspector.OverviewTimelineView.prototype._treeElementSelected):
* UserInterface/Views/ResourceDetailsSidebarPanel.js:
(WebInspector.ResourceDetailsSidebarPanel.prototype._goToRequestDataClicked):
* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel):
(WebInspector.ResourceSidebarPanel.prototype.showDefaultContentView):
(WebInspector.ResourceSidebarPanel.prototype._mainFrameDidChange):
(WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange.delayedWork):
(WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange):
(WebInspector.ResourceSidebarPanel.prototype._treeElementSelected):
(WebInspector.ResourceSidebarPanel.prototype._storageCleared):
* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype._goToResource):
* UserInterface/Views/ScriptTimelineView.js:
(WebInspector.ScriptTimelineView.prototype._treeElementSelected):
* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.tokenTrackingControllerHighlightedRangeWasClicked):
* UserInterface/Views/TimelineDataGrid.js:
(WebInspector.TimelineDataGrid.prototype._popoverCallStackTreeElementSelected):
* UserInterface/Views/TimelineSidebarPanel.js:
(WebInspector.TimelineSidebarPanel):
(WebInspector.TimelineSidebarPanel.prototype.shown):
(WebInspector.TimelineSidebarPanel.showTimelineViewForTimeline):

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

25 files changed:
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Models/Breakpoint.js
Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js
Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js
Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
Source/WebInspectorUI/UserInterface/Views/ContentView.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/LayerTreeDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js
Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js
Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js
Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js
Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js
Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js
Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/TimelineView.js

index cecb9a2..0553a84 100644 (file)
@@ -1,3 +1,95 @@
+2015-04-23  Timothy Hatcher  <timothy@apple.com>
+
+        Web Inspector: Make showing a content view work in the tab world
+        https://bugs.webkit.org/show_bug.cgi?id=144110
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.loaded):
+        (WebInspector.hideSplitConsole):
+        (WebInspector.showSourceCodeLocation):
+        (WebInspector.showOriginalUnformattedSourceCodeLocation):
+        (WebInspector.showOriginalOrFormattedSourceCodeLocation):
+        (WebInspector.showOriginalOrFormattedSourceCodeTextRange):
+        (WebInspector.showResourceRequest):
+        (WebInspector.debuggerToggleBreakpoints):
+        (WebInspector.debuggerPauseResumeToggle):
+        (WebInspector.debuggerStepOver):
+        (WebInspector.debuggerStepInto):
+        (WebInspector.debuggerStepOut):
+        (WebInspector._focusChanged):
+        (WebInspector._mouseWasClicked):
+        (WebInspector._dragOver):
+        (WebInspector._captureDidStart):
+        (WebInspector._debuggerDidPause):
+        (WebInspector._debuggerDidResume):
+        (WebInspector._frameWasAdded):
+        (WebInspector._undock):
+        (WebInspector._updateDockNavigationItems):
+        * UserInterface/Models/Breakpoint.js:
+        (WebInspector.Breakpoint.prototype.appendContextMenuItems.revealOriginalSourceCodeLocation):
+        (WebInspector.Breakpoint.prototype.appendContextMenuItems):
+        * UserInterface/Protocol/InspectorFrontendAPI.js:
+        (InspectorFrontendAPI.showMainResourceForFrame):
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+        (WebInspector.CSSStyleDeclarationTextEditor.prototype.tokenTrackingControllerHighlightedRangeWasClicked):
+        * UserInterface/Views/ComputedStyleDetailsPanel.js:
+        (WebInspector.ComputedStyleDetailsPanel.prototype._goToRegionFlowArrowWasClicked):
+        (WebInspector.ComputedStyleDetailsPanel.prototype._goToContentFlowArrowWasClicked):
+        (WebInspector.ComputedStyleDetailsPanel):
+        * UserInterface/Views/ContentBrowser.js:
+        (WebInspector.ContentBrowser.prototype.updateHierarchicalPathForCurrentContentView):
+        * UserInterface/Views/ContentView.js:
+        (WebInspector.ContentView):
+        * UserInterface/Views/DOMTreeContentView.js:
+        (WebInspector.DOMTreeContentView.prototype.restoreFromCookie):
+        * UserInterface/Views/DOMTreeDataGridNode.js:
+        (WebInspector.DOMTreeDataGridNode.prototype._goToArrowWasClicked):
+        * UserInterface/Views/DebuggerSidebarPanel.js:
+        (WebInspector.DebuggerSidebarPanel.prototype.showDefaultContentView):
+        (WebInspector.DebuggerSidebarPanel.prototype._addTreeElementForSourceCodeToContentTreeOutline):
+        (WebInspector.DebuggerSidebarPanel.prototype._treeElementSelected):
+        (WebInspector.DebuggerSidebarPanel.prototype._addIssue):
+        (WebInspector.DebuggerSidebarPanel.prototype._handleIssueAdded):
+        * UserInterface/Views/LayerTreeDataGridNode.js:
+        (WebInspector.LayerTreeDataGridNode.prototype._goToArrowWasClicked):
+        * UserInterface/Views/LayoutTimelineView.js:
+        (WebInspector.LayoutTimelineView.prototype._treeElementSelected):
+        * UserInterface/Views/NavigationSidebarPanel.js:
+        (WebInspector.NavigationSidebarPanel.prototype.get contentBrowser):
+        (WebInspector.NavigationSidebarPanel.prototype.set contentBrowser):
+        (WebInspector.NavigationSidebarPanel.prototype._updateFilter):
+        * UserInterface/Views/NetworkTimelineView.js:
+        (WebInspector.NetworkTimelineView.prototype._treeElementSelected):
+        * UserInterface/Views/ObjectTreeBaseTreeElement.js:
+        (WebInspector.ObjectTreeBaseTreeElement.prototype._appendMenusItemsForObject):
+        (WebInspector.ObjectTreeBaseTreeElement):
+        * UserInterface/Views/OverviewTimelineView.js:
+        (WebInspector.OverviewTimelineView.prototype._treeElementSelected):
+        * UserInterface/Views/ResourceDetailsSidebarPanel.js:
+        (WebInspector.ResourceDetailsSidebarPanel.prototype._goToRequestDataClicked):
+        * UserInterface/Views/ResourceSidebarPanel.js:
+        (WebInspector.ResourceSidebarPanel):
+        (WebInspector.ResourceSidebarPanel.prototype.showDefaultContentView):
+        (WebInspector.ResourceSidebarPanel.prototype._mainFrameDidChange):
+        (WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange.delayedWork):
+        (WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange):
+        (WebInspector.ResourceSidebarPanel.prototype._treeElementSelected):
+        (WebInspector.ResourceSidebarPanel.prototype._storageCleared):
+        * UserInterface/Views/ResourceTimelineDataGridNode.js:
+        (WebInspector.ResourceTimelineDataGridNode.prototype._goToResource):
+        * UserInterface/Views/ScriptTimelineView.js:
+        (WebInspector.ScriptTimelineView.prototype._treeElementSelected):
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WebInspector.SourceCodeTextEditor.prototype.tokenTrackingControllerHighlightedRangeWasClicked):
+        * UserInterface/Views/TimelineDataGrid.js:
+        (WebInspector.TimelineDataGrid.prototype._popoverCallStackTreeElementSelected):
+        * UserInterface/Views/TimelineSidebarPanel.js:
+        (WebInspector.TimelineSidebarPanel):
+        (WebInspector.TimelineSidebarPanel.prototype.shown):
+        (WebInspector.TimelineSidebarPanel.showTimelineViewForTimeline):
+
 2015-04-22  Timothy Hatcher  <timothy@apple.com>
 
         Web Inspector: Make debugger keyboard shortcuts global
index 72f1595..f1417ce 100644 (file)
@@ -128,6 +128,7 @@ WebInspector.loaded = function()
     this.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.InspectModeStateChanged, this._inspectModeStateChanged, this);
     this.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DOMNodeWasInspected, this._domNodeWasInspected, this);
     this.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
+    this.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this);
 
     WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
@@ -547,7 +548,7 @@ WebInspector.openURL = function(url, frame, alwaysOpenExternally, lineNumber)
     var resource = frame.url === url ? frame.mainResource : frame.resourceForURL(url, searchChildFrames);
     if (resource) {
         var position = new WebInspector.SourceCodePosition(lineNumber, 0);
-        this.resourceSidebarPanel.showSourceCode(resource, position);
+        this.showSourceCode(resource, position);
         return;
     }
 
@@ -732,6 +733,141 @@ WebInspector.toggleDetailsSidebar = function(event)
     this.detailsSidebar.collapsed = false;
 };
 
+WebInspector.tabContentViewClassForRepresentedObject = function(representedObject)
+{
+    if (representedObject instanceof WebInspector.DOMTree)
+        return WebInspector.ElementsTabContentView;
+
+    if (representedObject instanceof WebInspector.TimelineRecording)
+        return WebInspector.TimelineTabContentView;
+
+    // We only support one console tab right now. So this isn't an instanceof check.
+    if (representedObject === this._consoleRepresentedObject)
+        return WebInspector.ConsoleTabContentView;
+
+    if (WebInspector.debuggerManager.paused) {
+        if (representedObject instanceof WebInspector.Script)
+            return WebInspector.DebuggerTabContentView;
+
+        if (representedObject instanceof WebInspector.Resource && (representedObject.type === WebInspector.Resource.Type.Document || representedObject.type === WebInspector.Resource.Type.Script))
+            return WebInspector.DebuggerTabContentView;
+    }
+
+    if (representedObject instanceof WebInspector.Frame || representedObject instanceof WebInspector.Resource || representedObject instanceof WebInspector.Script)
+        return WebInspector.ResourcesTabContentView;
+
+    // FIXME: Move Content Flows to the Elements tab?
+    if (representedObject instanceof WebInspector.ContentFlow)
+        return WebInspector.ResourcesTabContentView;
+
+    // FIXME: Move these to a Storage tab.
+    if (representedObject instanceof WebInspector.DOMStorageObject || representedObject instanceof WebInspector.CookieStorageObject ||
+        representedObject instanceof WebInspector.DatabaseTableObject || representedObject instanceof WebInspector.DatabaseObject ||
+        representedObject instanceof WebInspector.ApplicationCacheFrame || representedObject instanceof WebInspector.IndexedDatabaseObjectStore ||
+        representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex)
+        return WebInspector.ResourcesTabContentView;
+
+    return null;
+};
+
+WebInspector.tabContentViewForRepresentedObject = function(representedObject)
+{
+    var tabContentView = this.tabBrowser.bestTabContentViewForRepresentedObject(representedObject);
+    if (tabContentView)
+        return tabContentView;
+
+    var tabContentViewClass = this.tabContentViewClassForRepresentedObject(representedObject);
+    if (!tabContentViewClass) {
+        console.error("Unknown representedObject, couldn't create TabContentView.", representedObject);
+        return null;
+    }
+
+    tabContentView = new tabContentViewClass;
+
+    this.tabBrowser.addTabForContentView(tabContentView);
+
+    return tabContentView;
+};
+
+WebInspector.showRepresentedObject = function(representedObject, cookie, forceShowTab)
+{
+    var tabContentView = this.tabContentViewForRepresentedObject(representedObject);
+    console.assert(tabContentView);
+    if (!tabContentView)
+        return;
+
+    if (window.event || forceShowTab)
+        this.tabBrowser.showTabForContentView(tabContentView);
+
+    tabContentView.showRepresentedObject(representedObject, cookie);
+};
+
+WebInspector.showMainFrameDOMTree = function(nodeToSelect, forceShowTab)
+{
+    console.assert(WebInspector.frameResourceManager.mainFrame);
+    if (!WebInspector.frameResourceManager.mainFrame)
+        return;
+    this.showRepresentedObject(WebInspector.frameResourceManager.mainFrame.domTree, {nodeToSelect}, forceShowTab);
+};
+
+WebInspector.showContentFlowDOMTree = function(contentFlow, nodeToSelect, forceShowTab)
+{
+    this.showRepresentedObject(contentFlow, {nodeToSelect}, forceShowTab);
+};
+
+WebInspector.showSourceCodeForFrame = function(frameIdentifier, forceShowTab)
+{
+    var frame = WebInspector.frameResourceManager.frameForIdentifier(frameIdentifier);
+    if (!frame) {
+        this._frameIdentifierToShowSourceCodeWhenAvailable = frameIdentifier;
+        return;
+    }
+
+    this._frameIdentifierToShowSourceCodeWhenAvailable = undefined;
+
+    this.showRepresentedObject(frame, null, forceShowTab);
+};
+
+WebInspector.showSourceCode = function(sourceCode, positionToReveal, textRangeToSelect, forceUnformatted, forceShowTab)
+{
+    console.assert(!positionToReveal || positionToReveal instanceof WebInspector.SourceCodePosition, positionToReveal);
+    var representedObject = sourceCode;
+
+    if (representedObject instanceof WebInspector.Script) {
+        // A script represented by a resource should always show the resource.
+        representedObject = representedObject.resource || representedObject;
+    }
+
+    var cookie = positionToReveal ? {lineNumber: positionToReveal.lineNumber, columnNumber: positionToReveal.columnNumber} : {};
+    this.showRepresentedObject(representedObject, cookie, forceShowTab);
+};
+
+WebInspector.showSourceCodeLocation = function(sourceCodeLocation, forceShowTab)
+{
+    this.showSourceCode(sourceCodeLocation.displaySourceCode, sourceCodeLocation.displayPosition(), null, false, forceShowTab);
+};
+
+WebInspector.showOriginalUnformattedSourceCodeLocation = function(sourceCodeLocation, forceShowTab)
+{
+    this.showSourceCode(sourceCodeLocation.sourceCode, sourceCodeLocation.position(), null, true);
+};
+
+WebInspector.showOriginalOrFormattedSourceCodeLocation = function(sourceCodeLocation, forceShowTab)
+{
+    this.showSourceCode(sourceCodeLocation.sourceCode, sourceCodeLocation.formattedPosition(), null, false, forceShowTab);
+};
+
+WebInspector.showOriginalOrFormattedSourceCodeTextRange = function(sourceCodeTextRange, forceShowTab)
+{
+    var textRangeToSelect = sourceCodeTextRange.formattedTextRange;
+    this.showSourceCode(sourceCodeTextRange.sourceCode, textRangeToSelect.startPosition(), textRangeToSelect, false, forceShowTab);
+};
+
+WebInspector.showResourceRequest = function(resource, forceShowTab)
+{
+    this.showRepresentedObject(resource, {[WebInspector.ResourceClusterContentView.ContentViewIdentifierCookieKey]: WebInspector.ResourceClusterContentView.RequestIdentifier}, forceShowTab);
+};
+
 WebInspector.debuggerToggleBreakpoints = function(event)
 {
     WebInspector.debuggerManager.breakpointsEnabled = !WebInspector.debuggerManager.breakpointsEnabled;
@@ -833,6 +969,18 @@ WebInspector._debuggerDidResume = function(event)
     this.dashboardContainer.closeDashboardViewForRepresentedObject(this.dashboardManager.dashboards.debugger);
 };
 
+WebInspector._frameWasAdded = function(event)
+{
+    if (!this._frameIdentifierToShowSourceCodeWhenAvailable)
+        return;
+
+    var frame = event.data.frame;
+    if (frame.id !== this._frameIdentifierToShowSourceCodeWhenAvailable)
+        return;
+
+    this.showSourceCodeForFrame(frame.id);
+};
+
 WebInspector._mainFrameDidChange = function(event)
 {
     this.updateWindowTitle();
@@ -1696,9 +1844,9 @@ WebInspector.createSourceCodeLocationLink = function(sourceCodeLocation, dontFlo
         event.preventDefault();
 
         if (event.metaKey)
-            this.resourceSidebarPanel.showOriginalUnformattedSourceCodeLocation(sourceCodeLocation);
+            this.showOriginalUnformattedSourceCodeLocation(sourceCodeLocation);
         else
-            this.resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);
+            this.showSourceCodeLocation(sourceCodeLocation);
     }
 
     var linkElement = document.createElement("a");
index 2821a70..cbe12b2 100644 (file)
@@ -241,7 +241,7 @@ WebInspector.Breakpoint = class Breakpoint extends WebInspector.Object
 
         function revealOriginalSourceCodeLocation()
         {
-            WebInspector.resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(this._sourceCodeLocation);
+            WebInspector.showOriginalOrFormattedSourceCodeLocation(this._sourceCodeLocation);
         }
 
         if (WebInspector.debuggerManager.isBreakpointEditable(this))
index fc7efcf..aa7a7bf 100644 (file)
@@ -92,8 +92,7 @@ InspectorFrontendAPI = {
     showMainResourceForFrame: function(frameIdentifier)
     {
         WebInspector.ignoreLastContentCookie = true;
-        WebInspector.navigationSidebar.selectedSidebarPanel = WebInspector.resourceSidebarPanel;
-        WebInspector.resourceSidebarPanel.showSourceCodeForFrame(frameIdentifier, true);
+        WebInspector.showSourceCodeForFrame(frameIdentifier, true);
     },
 
     contextMenuItemSelected: function(id)
index 703c95b..d3e2b6d 100644 (file)
@@ -993,7 +993,7 @@ WebInspector.CSSStyleDeclarationTextEditor = class CSSStyleDeclarationTextEditor
             }
         }
 
-        WebInspector.resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);
+        WebInspector.showSourceCodeLocation(sourceCodeLocation);
     }
 
     tokenTrackingControllerNewHighlightCandidate(tokenTrackingController, candidate)
index e106186..08585cc 100644 (file)
@@ -204,12 +204,12 @@ WebInspector.ComputedStyleDetailsPanel = class ComputedStyleDetailsPanel extends
 
     _goToRegionFlowArrowWasClicked()
     {
-        WebInspector.resourceSidebarPanel.showContentFlowDOMTree(this._regionFlow);
+        WebInspector.showContentFlowDOMTree(this._regionFlow);
     }
 
     _goToContentFlowArrowWasClicked()
     {
-        WebInspector.resourceSidebarPanel.showContentFlowDOMTree(this._contentFlow, this.nodeStyles.node, true);
+        WebInspector.showContentFlowDOMTree(this._contentFlow, this.nodeStyles.node, true);
     }
 };
 
index 11b9d33..7210168 100644 (file)
@@ -187,6 +187,12 @@ WebInspector.ContentBrowser.prototype = {
         return this._contentViewContainer.contentViewForRepresentedObject(representedObject, onlyExisting, extraArguments);
     },
 
+    updateHierarchicalPathForCurrentContentView: function()
+    {
+        var currentContentView = this.currentContentView;
+        this._updateHierarchicalPathNavigationItem(currentContentView ? currentContentView.representedObject : null);
+    },
+
     canGoBack: function()
     {
         var currentContentView = this.currentContentView;
index 8cce277..f237356 100644 (file)
@@ -31,7 +31,7 @@ WebInspector.ContentView = function(representedObject, extraArguments)
         console.assert(representedObject);
 
         if (representedObject instanceof WebInspector.Frame)
-            return new WebInspector.FrameContentView(representedObject, extraArguments);
+            return new WebInspector.ResourceClusterContentView(representedObject.mainResource, extraArguments);
 
         if (representedObject instanceof WebInspector.Resource)
             return new WebInspector.ResourceClusterContentView(representedObject, extraArguments);
index ce05550..be28b21 100644 (file)
@@ -140,6 +140,18 @@ WebInspector.DOMTreeContentView.prototype = {
         return pathComponents;
     },
 
+    restoreFromCookie: function(cookie)
+    {
+        if (!cookie || !cookie.nodeToSelect)
+            return;
+
+        this.selectAndRevealDOMNode(cookie.nodeToSelect);
+
+        // Because nodeToSelect is ephemeral, we don't want to keep
+        // it around in the back-forward history entries.
+        cookie.nodeToSelect = undefined;
+    },
+
     selectAndRevealDOMNode: function(domNode, preventFocusChange)
     {
         this._domTreeOutline.selectDOMNode(domNode, !preventFocusChange);
index 683a4ae..079a8cb 100644 (file)
@@ -83,6 +83,6 @@ WebInspector.DOMTreeDataGridNode.prototype = {
 
     _goToArrowWasClicked: function()
     {
-        WebInspector.resourceSidebarPanel.showMainFrameDOMTree(this._domNode, true);
+        WebInspector.showMainFrameDOMTree(this._domNode);
     }
 };
index 5dd604e..619ddbc 100644 (file)
 
 WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspector.NavigationSidebarPanel
 {
-    constructor()
+    constructor(contentBrowser)
     {
         super("debugger", WebInspector.UIString("Debugger"), true);
 
+        this.contentBrowser = contentBrowser;
+
         WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceChanged, this);
         WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceAdded, this);
 
@@ -179,7 +181,15 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
 
     showDefaultContentView()
     {
-        WebInspector.resourceSidebarPanel.showDefaultContentView();
+        var currentTreeElement = this._contentTreeOutline.children[0];
+        while (currentTreeElement && !currentTreeElement.root) {
+            if (currentTreeElement instanceof WebInspector.ResourceTreeElement || currentTreeElement instanceof WebInspector.ScriptTreeElement) {
+                currentTreeElement.revealAndSelect();
+                return;
+            }
+
+            currentTreeElement = currentTreeElement.traverseNextTreeElement(false, null, true);
+        }
     }
 
     treeElementForRepresentedObject(representedObject)
@@ -306,6 +316,11 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
                 treeElement = new WebInspector.ScriptTreeElement(sourceCode);
         }
 
+        if (!treeElement) {
+            console.error("Unknown sourceCode instance", sourceCode);
+            return;
+        }
+
         if (!treeElement.parent) {
             treeElement.hasChildren = false;
             treeElement.expand();
@@ -578,7 +593,7 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
         if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
             deselectCallStackContentTreeElements.call(this);
             deselectPauseReasonContentTreeElements.call(this);
-            WebInspector.resourceSidebarPanel.showSourceCode(treeElement.representedObject);
+            WebInspector.showSourceCode(treeElement.representedObject);
             return;
         }
 
@@ -589,14 +604,14 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
 
             var callFrame = treeElement.callFrame;
             WebInspector.debuggerManager.activeCallFrame = callFrame;
-            WebInspector.resourceSidebarPanel.showSourceCodeLocation(callFrame.sourceCodeLocation);
+            WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation);
             return;
         }
 
         if (treeElement instanceof WebInspector.IssueTreeElement) {
             deselectCallStackContentTreeElements.call(this);
             deselectPauseReasonContentTreeElements.call(this);
-            WebInspector.resourceSidebarPanel.showSourceCodeLocation(treeElement.issueMessage.sourceCodeLocation);
+            WebInspector.showSourceCodeLocation(treeElement.issueMessage.sourceCodeLocation);
             return;
         }
 
@@ -613,7 +628,7 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
 
         var breakpoint = treeElement.breakpoint;
         if (treeElement.treeOutline === this._pauseReasonTreeOutline) {
-            WebInspector.resourceSidebarPanel.showSourceCodeLocation(breakpoint.sourceCodeLocation);
+            WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation);
             return;
         }
 
@@ -624,7 +639,7 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
         if (!(treeElement.parent.representedObject instanceof WebInspector.SourceCode))
             return;
 
-        WebInspector.resourceSidebarPanel.showSourceCodeLocation(breakpoint.sourceCodeLocation);
+        WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation);
     }
 
     _compareTopLevelTreeElements(a, b)
@@ -761,6 +776,9 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
     _addIssue(issueMessage)
     {
         var parentTreeElement = this._addTreeElementForSourceCodeToContentTreeOutline(issueMessage.sourceCodeLocation.sourceCode);
+        if (!parentTreeElement)
+            return null;
+
         var issueTreeElement = new WebInspector.IssueTreeElement(issueMessage);
 
         parentTreeElement.insertChild(issueTreeElement, insertionIndexForObjectInListSortedByFunction(issueTreeElement, parentTreeElement.children, this._compareDebuggerTreeElements));
@@ -775,7 +793,7 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
         var issue = event.data.issue;
 
         // We only want to show issues originating from JavaScript source code.
-        if (!issue.lineNumber || (issue.source !== "javascript" && issue.source !== "console-api"))
+        if (!issue.sourceCodeLocation || !issue.sourceCodeLocation.sourceCode || (issue.source !== "javascript" && issue.source !== "console-api"))
             return;
 
         this._addIssue(issue);
index 151a5a3..01459b5 100644 (file)
@@ -162,7 +162,7 @@ WebInspector.LayerTreeDataGridNode.prototype = {
     _goToArrowWasClicked: function()
     {
         var domNode = WebInspector.domTreeManager.nodeForId(this._layer.nodeId);
-        WebInspector.resourceSidebarPanel.showMainFrameDOMTree(domNode, true);
+        WebInspector.showMainFrameDOMTree(domNode);
     }
 };
 
index 7d3f25e..2b51c9e 100644 (file)
@@ -76,6 +76,16 @@ WebInspector.NavigationSidebarPanel = class NavigationSidebarPanel extends WebIn
 
     // Public
 
+    get contentBrowser()
+    {
+        return this._contentBrowser;
+    }
+
+    set contentBrowser(contentBrowser)
+    {
+        this._contentBrowser = contentBrowser || null;
+    }
+
     get contentTreeOutlineElement()
     {
         return this._contentTreeOutline.element;
@@ -477,8 +487,9 @@ WebInspector.NavigationSidebarPanel = class NavigationSidebarPanel extends WebIn
         this._updateContentOverflowShadowVisibility();
 
         // Filter may have hidden the selected resource in the timeline view, which should now notify its listeners.
+        // FIXME: This is a layering violation. This should at least be in TimelineSidebarPanel.
         if (selectedTreeElement && selectedTreeElement.hidden !== selectionWasHidden) {
-            var currentContentView = WebInspector.contentBrowser.currentContentView;
+            var currentContentView = this.contentBrowser.currentContentView;
             if (currentContentView instanceof WebInspector.TimelineRecordingContentView && typeof currentContentView.currentTimelineView.filterUpdated === "function")
                 currentContentView.currentTimelineView.filterUpdated();
         }
index a5ffff2..6878629 100644 (file)
@@ -151,7 +151,7 @@ WebInspector.NetworkTimelineView.prototype = {
     showContentViewForTreeElement: function(treeElement)
     {
         if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
-            WebInspector.resourceSidebarPanel.showSourceCode(treeElement.representedObject);
+            WebInspector.showSourceCode(treeElement.representedObject);
             return true;
         }
 
index 8ae1b77..8ffdfc1 100644 (file)
@@ -223,7 +223,7 @@ WebInspector.ObjectTreeBaseTreeElement = class ObjectTreeBaseTreeElement extends
                             return;
 
                         var sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber || 0);
-                        WebInspector.resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);
+                        WebInspector.showSourceCodeLocation(sourceCodeLocation);
                     });
                 });
             }
index 1e1b687..e04f9c3 100644 (file)
@@ -340,7 +340,7 @@ WebInspector.OverviewTimelineView.prototype = {
             return;
 
         if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
-            WebInspector.resourceSidebarPanel.showSourceCode(treeElement.representedObject);
+            WebInspector.showSourceCode(treeElement.representedObject);
             this._updateTreeElementWithCloseButton(treeElement);
             return;
         }
@@ -356,7 +356,7 @@ WebInspector.OverviewTimelineView.prototype = {
             return;
         }
 
-        WebInspector.resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(treeElement.sourceCodeTimeline.sourceCodeLocation);
+        WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.sourceCodeTimeline.sourceCodeLocation);
         this._updateTreeElementWithCloseButton(treeElement);
     },
 
index ccc201e..5e52629 100644 (file)
@@ -157,7 +157,7 @@ WebInspector.RenderingFrameTimelineView.prototype = {
     showContentViewForTreeElement: function(treeElement)
     {
         if (treeElement instanceof WebInspector.ProfileNodeTreeElement && treeElement.profileNode.sourceCodeLocation) {
-            WebInspector.resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
+            WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
             return true;
         }
 
index e719c07..1719983 100644 (file)
@@ -398,7 +398,7 @@ WebInspector.ResourceDetailsSidebarPanel = class ResourceDetailsSidebarPanel ext
 
     _goToRequestDataClicked()
     {
-        WebInspector.resourceSidebarPanel.showResourceRequest(this._resource);
+        WebInspector.showResourceRequest(this._resource);
     }
 
     _refreshRequestDataSection()
index b08f1d1..500e1fe 100644 (file)
 
 WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspector.NavigationSidebarPanel
 {
-    constructor()
+    constructor(contentBrowser)
     {
         super("resource", WebInspector.UIString("Resources"), true, true);
 
+        this.contentBrowser = contentBrowser;
+
         var searchElement = document.createElement("div");
         searchElement.classList.add("search-bar");
         this.element.appendChild(searchElement);
@@ -79,9 +81,6 @@ WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspec
         WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestRemoved, this._frameManifestRemoved, this);
 
         WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
-        WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this);
-
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DOMNodeWasInspected, this._domNodeWasInspected, this);
 
         WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, this._scriptWasAdded, this);
         WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptsCleared, this._scriptsCleared, this);
@@ -105,7 +104,7 @@ WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspec
     showDefaultContentView()
     {
         if (WebInspector.frameResourceManager.mainFrame) {
-            this.showMainFrame();
+            this.contentBrowser.showContentViewForRepresentedObject(WebInspector.frameResourceManager.mainFrame);
             return;
         }
 
@@ -119,129 +118,15 @@ WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspec
         return this._searchContentTreeOutline;
     }
 
-    showMainFrame(nodeToSelect, preventFocusChange)
-    {
-        WebInspector.contentBrowser.showContentViewForRepresentedObject(WebInspector.frameResourceManager.mainFrame);
-    }
-
-    showMainFrameDOMTree(nodeToSelect, preventFocusChange)
-    {
-        var contentView = WebInspector.contentBrowser.contentViewForRepresentedObject(WebInspector.frameResourceManager.mainFrame);
-        contentView.showDOMTree(nodeToSelect, preventFocusChange);
-        WebInspector.contentBrowser.showContentView(contentView);
-    }
-
-    showMainFrameSourceCode()
-    {
-        var contentView = WebInspector.contentBrowser.contentViewForRepresentedObject(WebInspector.frameResourceManager.mainFrame);
-        contentView.showSourceCode();
-        WebInspector.contentBrowser.showContentView(contentView);
-    }
-
-    showContentFlowDOMTree(contentFlow, nodeToSelect, preventFocusChange)
-    {
-        var contentView = WebInspector.contentBrowser.contentViewForRepresentedObject(contentFlow);
-        if (nodeToSelect)
-            contentView.selectAndRevealDOMNode(nodeToSelect, preventFocusChange);
-        WebInspector.contentBrowser.showContentView(contentView);
-    }
-
-    showSourceCodeForFrame(frameIdentifier, revealAndSelectTreeElement)
-    {
-        delete this._frameIdentifierToShowSourceCodeWhenAvailable;
-
-        // We can't show anything until we have the main frame in the sidebar.
-        // Otherwise the path components in the navigation bar would be missing.
-        var frame = WebInspector.frameResourceManager.frameForIdentifier(frameIdentifier);
-        if (!frame || !this._mainFrameTreeElement) {
-            this._frameIdentifierToShowSourceCodeWhenAvailable = frameIdentifier;
-            return;
-        }
-
-        var contentView = WebInspector.contentBrowser.contentViewForRepresentedObject(frame);
-        console.assert(contentView);
-        if (!contentView)
-            return;
-
-        contentView.showSourceCode();
-        WebInspector.contentBrowser.showContentView(contentView);
-
-        if (revealAndSelectTreeElement)
-            this.treeElementForRepresentedObject(frame).revealAndSelect(true, true, true, true);
-    }
-
-    showSourceCode(sourceCode, positionToReveal, textRangeToSelect, forceUnformatted)
-    {
-        console.assert(!positionToReveal || positionToReveal instanceof WebInspector.SourceCodePosition, positionToReveal);
-        var representedObject = sourceCode;
-
-        if (representedObject instanceof WebInspector.Script) {
-            // A script represented by a resource should always show the resource.
-            representedObject = representedObject.resource || representedObject;
-        }
-
-        // A main resource is always represented by its parent frame.
-        if (representedObject instanceof WebInspector.Resource && representedObject.isMainResource())
-            representedObject = representedObject.parentFrame;
-
-        var cookie = positionToReveal ? {lineNumber: positionToReveal.lineNumber, columnNumber: positionToReveal.columnNumber} : {};
-        WebInspector.contentBrowser.showContentViewForRepresentedObject(representedObject, cookie);
-    }
-
-    showSourceCodeLocation(sourceCodeLocation)
-    {
-        this.showSourceCode(sourceCodeLocation.displaySourceCode, sourceCodeLocation.displayPosition());
-    }
-
-    showOriginalUnformattedSourceCodeLocation(sourceCodeLocation)
-    {
-        this.showSourceCode(sourceCodeLocation.sourceCode, sourceCodeLocation.position(), undefined, true);
-    }
-
-    showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation)
-    {
-        this.showSourceCode(sourceCodeLocation.sourceCode, sourceCodeLocation.formattedPosition());
-    }
-
-    showSourceCodeTextRange(sourceCodeTextRange)
-    {
-        var textRangeToSelect = sourceCodeTextRange.displayTextRange;
-        this.showSourceCode(sourceCodeTextRange.displaySourceCode, textRangeToSelect.startPosition(), textRangeToSelect);
-    }
-
-    showOriginalOrFormattedSourceCodeTextRange(sourceCodeTextRange)
-    {
-        var textRangeToSelect = sourceCodeTextRange.formattedTextRange;
-        this.showSourceCode(sourceCodeTextRange.sourceCode, textRangeToSelect.startPosition(), textRangeToSelect);
-    }
-
-    showResource(resource)
-    {
-        WebInspector.contentBrowser.showContentViewForRepresentedObject(resource.isMainResource() ? resource.parentFrame : resource);
-    }
-
-    showResourceRequest(resource)
-    {
-        var contentView = WebInspector.contentBrowser.contentViewForRepresentedObject(resource.isMainResource() ? resource.parentFrame : resource);
-
-        if (contentView instanceof WebInspector.FrameContentView)
-            var resourceContentView = contentView.showResource();
-        else if (contentView instanceof WebInspector.ResourceClusterContentView)
-            var resourceContentView = contentView;
-
-        console.assert(resourceContentView instanceof WebInspector.ResourceClusterContentView);
-        if (!(resourceContentView instanceof WebInspector.ResourceClusterContentView))
-            return;
-
-        resourceContentView.showRequest();
-
-        WebInspector.contentBrowser.showContentView(contentView);
-    }
-
     treeElementForRepresentedObject(representedObject)
     {
         // A custom implementation is needed for this since the frames are populated lazily.
 
+        if (!this._mainFrameTreeElement && (representedObject instanceof WebInspector.Resource || representedObject instanceof WebInspector.Frame)) {
+            // All resources are under the main frame, so we need to return early if we don't have the main frame yet.
+            return null;
+        }
+
         // The Frame is used as the representedObject instead of the main resource in our tree.
         if (representedObject instanceof WebInspector.Resource && representedObject.parentFrame && representedObject.parentFrame.mainResource === representedObject)
             representedObject = representedObject.parentFrame;
@@ -592,14 +477,19 @@ WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspec
             this._mainFrameTreeElement = new WebInspector.FrameTreeElement(newFrame);
             this._resourcesContentTreeOutline.insertChild(this._mainFrameTreeElement, 0);
 
-            // Select by default. Allow onselect if we aren't showing a content view.
-            if (!this._resourcesContentTreeOutline.selectedTreeElement)
-                this._mainFrameTreeElement.revealAndSelect(true, false, !!WebInspector.contentBrowser.currentContentView);
-
-            if (this._frameIdentifierToShowSourceCodeWhenAvailable)
-                this.showSourceCodeForFrame(this._frameIdentifierToShowSourceCodeWhenAvailable, true);
+            // Select a tree element by default. Allow onselect if we aren't showing a content view.
+            if (!this._resourcesContentTreeOutline.selectedTreeElement) {
+                var currentContentView = this.contentBrowser.currentContentView;
+                var treeElement = currentContentView ? this.treeElementForRepresentedObject(currentContentView.representedObject) : null;
+                if (!treeElement)
+                    treeElement = this._mainFrameTreeElement;
+                treeElement.revealAndSelect(true, false, !!currentContentView, true);
+            }
         }
 
+        // The navigation path needs update when the main frame changes, since all resources are under the main frame.
+        this.contentBrowser.updateHierarchicalPathForCurrentContentView();
+
         // We only care about the first time the main frame changes.
         if (!this._waitingForInitialMainFrame)
             return;
@@ -608,7 +498,7 @@ WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspec
         if (!newFrame)
             return;
 
-        delete this._waitingForInitialMainFrame;
+        this._waitingForInitialMainFrame = false;
 
         // Only if the last page searched is the same as the current page.
         if (this._lastSearchedPageSetting.value !== newFrame.url.hash)
@@ -621,16 +511,13 @@ WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspec
     _mainFrameMainResourceDidChange(event)
     {
         var wasShowingResourceSidebar = this.selected;
-        var currentContentView = WebInspector.contentBrowser.currentContentView;
+        var currentContentView = this.contentBrowser.currentContentView;
         var wasShowingResourceContentView = currentContentView instanceof WebInspector.ResourceContentView
             || currentContentView instanceof WebInspector.ResourceClusterContentView
             || currentContentView instanceof WebInspector.FrameContentView
             || currentContentView instanceof WebInspector.ScriptContentView;
 
-        // Close all resource and frame content views since the main frame has navigated and all resources are cleared.
-        WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.ResourceClusterContentView);
-        WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.FrameContentView);
-        WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.ScriptContentView);
+        this.contentBrowser.contentViewContainer.closeAllContentViews();
 
         // Break out of search tree outline if there was an active search.
         this._showResourcesContentTreeOutline();
@@ -639,13 +526,7 @@ WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspec
         {
             // Show the main frame since there is no content view showing or we were showing a resource before.
             // Cookie restoration will attempt to re-select the resource we were showing.
-            if (!WebInspector.contentBrowser.currentContentView || wasShowingResourceContentView) {
-                // If we were showing a resource inside of the ResourceSidebar, we should
-                // re-show the resource inside of the resource sidebar. It is possible that
-                // the sidebar panel could have switched to another view in the back-forward list.
-                if (wasShowingResourceSidebar)
-                    WebInspector.navigationSidebar.selectedSidebarPanel = this;
-
+            if (!this.contentBrowser.currentContentView || wasShowingResourceContentView) {
                 // NOTE: This selection, during provisional loading, won't be saved, so it is
                 // safe to do and not-clobber cookie restoration.
                 this._mainFrameTreeElement.revealAndSelect(true, false);
@@ -657,18 +538,6 @@ WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspec
         setTimeout(delayedWork.bind(this), 0);
     }
 
-    _frameWasAdded(event)
-    {
-        if (!this._frameIdentifierToShowSourceCodeWhenAvailable)
-            return;
-
-        var frame = event.data.frame;
-        if (frame.id !== this._frameIdentifierToShowSourceCodeWhenAvailable)
-            return;
-
-        this.showSourceCodeForFrame(frame.id, true);
-    }
-
     _scriptWasAdded(event)
     {
         var script = event.data.script;
@@ -776,7 +645,7 @@ WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspec
             treeElement instanceof WebInspector.DatabaseTreeElement || treeElement instanceof WebInspector.ApplicationCacheFrameTreeElement ||
             treeElement instanceof WebInspector.ContentFlowTreeElement || treeElement instanceof WebInspector.IndexedDatabaseObjectStoreTreeElement ||
             treeElement instanceof WebInspector.IndexedDatabaseObjectStoreIndexTreeElement) {
-            WebInspector.contentBrowser.showContentViewForRepresentedObject(treeElement.representedObject);
+            WebInspector.showRepresentedObject(treeElement.representedObject);
             return;
         }
 
@@ -785,14 +654,9 @@ WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspec
             return;
 
         if (treeElement.representedObject instanceof WebInspector.DOMSearchMatchObject)
-            this.showMainFrameDOMTree(treeElement.representedObject.domNode, true);
+            WebInspector.showMainFrameDOMTree(treeElement.representedObject.domNode);
         else if (treeElement.representedObject instanceof WebInspector.SourceCodeSearchMatchObject)
-            this.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange);
-    }
-
-    _domNodeWasInspected(event)
-    {
-        this.showMainFrameDOMTree(event.data.node);
+            WebInspector.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange);
     }
 
     _domStorageObjectWasAdded(event)
@@ -928,11 +792,11 @@ WebInspector.ResourceSidebarPanel = class ResourceSidebarPanel extends WebInspec
     _storageCleared(event)
     {
         // Close all DOM and cookie storage content views since the main frame has navigated and all storages are cleared.
-        WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.CookieStorageContentView);
-        WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DOMStorageContentView);
-        WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseTableContentView);
-        WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseContentView);
-        WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.ApplicationCacheFrameContentView);
+        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.CookieStorageContentView);
+        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DOMStorageContentView);
+        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseTableContentView);
+        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseContentView);
+        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.ApplicationCacheFrameContentView);
 
         if (this._localStorageRootTreeElement && this._localStorageRootTreeElement.parent)
             this._localStorageRootTreeElement.parent.removeChild(this._localStorageRootTreeElement);
index 0a14ab7..2f1b13f 100644 (file)
@@ -169,7 +169,7 @@ WebInspector.ResourceTimelineDataGridNode.prototype = {
 
     _goToResource: function(event)
     {
-        WebInspector.resourceSidebarPanel.showSourceCode(this._resource);
+        WebInspector.showSourceCode(this._resource);
     },
 
     _timelineRecordUpdated: function(event)
index aa67187..7c8adad 100644 (file)
@@ -166,7 +166,7 @@ WebInspector.ScriptTimelineView.prototype = {
     showContentViewForTreeElement: function(treeElement)
     {
         if (treeElement instanceof WebInspector.ProfileNodeTreeElement && treeElement.profileNode.sourceCodeLocation) {
-            WebInspector.resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
+            WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
             return true;
         }
 
index 2c95483..0b00b6c 100644 (file)
@@ -1324,9 +1324,9 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
 
         var sourceCodeLocation = this._sourceCodeLocationForEditorPosition(this.tokenTrackingController.candidate.hoveredTokenRange.start);
         if (this.sourceCode instanceof WebInspector.SourceMapResource)
-            WebInspector.resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation);
+            WebInspector.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation);
         else
-            WebInspector.resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);
+            WebInspector.showSourceCodeLocation(sourceCodeLocation);
     }
 
     tokenTrackingControllerNewHighlightCandidate(tokenTrackingController, candidate)
index 0dbc37e..8fb6f26 100644 (file)
@@ -487,6 +487,6 @@ WebInspector.TimelineDataGrid.prototype = {
         if (!callFrame.sourceCodeLocation)
             return;
 
-        WebInspector.resourceSidebarPanel.showSourceCodeLocation(callFrame.sourceCodeLocation);
+        WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation);
     }
 };
index 674cb55..2135e5b 100644 (file)
 
 WebInspector.TimelineSidebarPanel = class TimelineSidebarPanel extends WebInspector.NavigationSidebarPanel
 {
-    constructor()
+    constructor(contentBrowser)
     {
         super("timeline", WebInspector.UIString("Timelines"));
 
+        this.contentBrowser = contentBrowser;
+
         this._timelineEventsTitleBarElement = document.createElement("div");
         this._timelineEventsTitleBarElement.classList.add(WebInspector.TimelineSidebarPanel.TitleBarStyleClass);
         this._timelineEventsTitleBarElement.classList.add(WebInspector.TimelineSidebarPanel.TimelineEventsTitleBarStyleClass);
@@ -120,7 +122,7 @@ WebInspector.TimelineSidebarPanel = class TimelineSidebarPanel extends WebInspec
         WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingCreated, this._recordingCreated, this);
         WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingLoaded, this._recordingLoaded, this);
 
-        WebInspector.contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange, this._contentBrowserCurrentContentViewDidChange, this);
+        this.contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange, this._contentBrowserCurrentContentViewDidChange, this);
         WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted, this._capturingStarted, this);
         WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
     }
@@ -132,7 +134,7 @@ WebInspector.TimelineSidebarPanel = class TimelineSidebarPanel extends WebInspec
         super.shown();
 
         if (this._displayedContentView)
-            WebInspector.contentBrowser.showContentView(this._displayedContentView);
+            this.contentBrowser.showContentView(this._displayedContentView);
     }
 
     showDefaultContentView()
@@ -236,7 +238,7 @@ WebInspector.TimelineSidebarPanel = class TimelineSidebarPanel extends WebInspec
             this._timelinesTreeOutline.selectedTreeElement.deselect();
 
         this._displayedContentView.showOverviewTimelineView();
-        WebInspector.contentBrowser.showContentView(this._displayedContentView);
+        this.contentBrowser.showContentView(this._displayedContentView);
     }
 
     showTimelineViewForTimeline(timeline)
@@ -284,7 +286,7 @@ WebInspector.TimelineSidebarPanel = class TimelineSidebarPanel extends WebInspec
     {
         console.assert(cookie);
 
-        cookie[WebInspector.TimelineSidebarPanel.ShowingTimelineRecordingContentViewCookieKey] = WebInspector.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;
+        cookie[WebInspector.TimelineSidebarPanel.ShowingTimelineRecordingContentViewCookieKey] = this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;
 
         var selectedTreeElement = this._timelinesTreeOutline.selectedTreeElement;
         if (selectedTreeElement)
@@ -356,12 +358,12 @@ WebInspector.TimelineSidebarPanel = class TimelineSidebarPanel extends WebInspec
         console.assert(this._displayedRecording.timelines.get(timeline.type) === timeline, timeline);
 
         this._displayedContentView.showTimelineViewForTimeline(timeline);
-        WebInspector.contentBrowser.showContentView(this._displayedContentView);
+        this.contentBrowser.showContentView(this._displayedContentView);
     }
 
     _contentBrowserCurrentContentViewDidChange(event)
     {
-        var didShowTimelineRecordingContentView = WebInspector.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;
+        var didShowTimelineRecordingContentView = this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;
         this.element.classList.toggle(WebInspector.TimelineSidebarPanel.TimelineRecordingContentViewShowingStyleClass, didShowTimelineRecordingContentView);
     }
 
@@ -423,9 +425,9 @@ WebInspector.TimelineSidebarPanel = class TimelineSidebarPanel extends WebInspec
         for (var timeline of recording.timelines.values())
             this._timelineAdded(timeline);
 
-        this._displayedContentView = WebInspector.contentBrowser.contentViewForRepresentedObject(this._displayedRecording, false, {timelineSidebarPanel: this});
+        this._displayedContentView = this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording, false, {timelineSidebarPanel: this});
         if (this.selected)
-            WebInspector.contentBrowser.showContentView(this._displayedContentView);
+            this.contentBrowser.showContentView(this._displayedContentView);
     }
 
     _recordingLoaded(event)
index 18b5f51..a1581b4 100644 (file)
@@ -206,7 +206,7 @@ WebInspector.TimelineView.prototype = {
             return true;
         }
 
-        WebInspector.resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation);
+        WebInspector.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation);
         return true;
     },