Title: [188750] trunk/Source/WebInspectorUI
Revision
188750
Author
[email protected]
Date
2015-08-20 21:22:32 -0700 (Thu, 20 Aug 2015)

Log Message

Web Inspector: Better Remember open tab types and order if using JSContext inspector
https://bugs.webkit.org/show_bug.cgi?id=148285

Patch by Joseph Pecoraro <[email protected]> on 2015-08-20
Reviewed by Timothy Hatcher.

* UserInterface/Base/Main.js:
(WebInspector.contentLoaded):
(WebInspector.activateExtraDomains):
Save and restore extra domain related tabs at the expected saved index.

(WebInspector._rememberOpenTabs):
Keep unsupported tab types in the setting so when they are supported they open.

* UserInterface/Base/Utilities.js:
Add a helper for inserting a single object into an array.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (188749 => 188750)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-08-21 04:19:53 UTC (rev 188749)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-08-21 04:22:32 UTC (rev 188750)
@@ -1,3 +1,21 @@
+2015-08-20  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Better Remember open tab types and order if using JSContext inspector
+        https://bugs.webkit.org/show_bug.cgi?id=148285
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.contentLoaded):
+        (WebInspector.activateExtraDomains):
+        Save and restore extra domain related tabs at the expected saved index.
+
+        (WebInspector._rememberOpenTabs):
+        Keep unsupported tab types in the setting so when they are supported they open.
+
+        * UserInterface/Base/Utilities.js:
+        Add a helper for inserting a single object into an array.
+
 2015-08-20  Nikita Vasilyev  <[email protected]>
 
         Web Inspector: inline errors/warnings are taller than the line height

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (188749 => 188750)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-08-21 04:19:53 UTC (rev 188749)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-08-21 04:22:32 UTC (rev 188750)
@@ -341,15 +341,18 @@
     this._updateDockNavigationItems();
     this._updateToolbarHeight();
 
-    this._pendingOpenTabTypes = [];
+    this._pendingOpenTabs = [];
 
-    for (var tabType of this._openTabsSetting.value) {
+    let openTabTypes = this._openTabsSetting.value;
+
+    for (let i = 0; i < openTabTypes.length; ++i) {
+        let tabType = openTabTypes[i];
         if (!this.isTabTypeAllowed(tabType)) {
-            this._pendingOpenTabTypes.push(tabType);
+            this._pendingOpenTabs.push({tabType, index: i});
             continue;
         }
 
-        var tabContentView = this._tabContentViewForType(tabType);
+        let tabContentView = this._tabContentViewForType(tabType);
         if (!tabContentView)
             continue;
         this.tabBrowser.addTabForContentView(tabContentView, true);
@@ -442,6 +445,10 @@
         openTabs.push(tabContentView.type);
     }
 
+    // Keep currently unsupported tabs in the setting at their previous index.
+    for (let {tabType, index} of this._pendingOpenTabs)
+        openTabs.insertAtIndex(tabType, index);
+
     this._openTabsSetting.value = openTabs;
 };
 
@@ -512,23 +519,23 @@
     this._updateReloadToolbarButton();
     this._updateDownloadToolbarButton();
 
-    var stillPendingOpenTabTypes = [];
-    for (var tabType of this._pendingOpenTabTypes) {
+    let stillPendingOpenTabs = [];
+    for (let {tabType, index} of this._pendingOpenTabs) {
         if (!this.isTabTypeAllowed(tabType)) {
-            stillPendingOpenTabTypes.push(tabType);
+            stillPendingOpenTabs.push({tabType, index});
             continue;
         }
 
-        var tabContentView = this._tabContentViewForType(tabType);
+        let tabContentView = this._tabContentViewForType(tabType);
         if (!tabContentView)
             continue;
 
-        this.tabBrowser.addTabForContentView(tabContentView, true);
+        this.tabBrowser.addTabForContentView(tabContentView, true, index);
 
         tabContentView.restoreStateFromCookie(WebInspector.StateRestorationType.Load);
     }
 
-    this._pendingOpenTabTypes = stillPendingOpenTabTypes;
+    this._pendingOpenTabs = stillPendingOpenTabs;
 
     this._updateNewTabButtonState();
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (188749 => 188750)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2015-08-21 04:19:53 UTC (rev 188749)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2015-08-21 04:22:32 UTC (rev 188750)
@@ -433,6 +433,14 @@
     }
 });
 
+Object.defineProperty(Array.prototype, "insertAtIndex",
+{
+    value: function(value, index)
+    {
+        this.splice(index, 0, value);
+    }
+});
+
 Object.defineProperty(Array.prototype, "keySet",
 {
     value: function()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to