Title: [283921] trunk/Source/WebInspectorUI
Revision
283921
Author
[email protected]
Date
2021-10-11 12:17:10 -0700 (Mon, 11 Oct 2021)

Log Message

Web Inspector: add TabBar context menu support for WI.WebInspectorExtensionTabContentView
https://bugs.webkit.org/show_bug.cgi?id=231181
<rdar://74698241>

Unreviewed. Land parts of the previous patch which seem to have been mis-merged and not landed.

* UserInterface/Base/Main.js:
(WI.isNewTabWithTypeAllowed):
* UserInterface/Controllers/WebInspectorExtensionController.js:
(WI.WebInspectorExtensionController.prototype.showExtensionTab):
* UserInterface/Views/TabBar.js:
(WI.TabBar.prototype._handleAddClosedTabsTabBarItemMouseDown):
(WI.TabBar.prototype._handleTabContainerContextMenu):
(WI.TabBar):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (283920 => 283921)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-10-11 19:14:52 UTC (rev 283920)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-10-11 19:17:10 UTC (rev 283921)
@@ -1,3 +1,20 @@
+2021-10-11  BJ Burg  <[email protected]>
+
+        Web Inspector: add TabBar context menu support for WI.WebInspectorExtensionTabContentView
+        https://bugs.webkit.org/show_bug.cgi?id=231181
+        <rdar://74698241>
+
+        Unreviewed. Land parts of the previous patch which seem to have been mis-merged and not landed.
+
+        * UserInterface/Base/Main.js:
+        (WI.isNewTabWithTypeAllowed):
+        * UserInterface/Controllers/WebInspectorExtensionController.js:
+        (WI.WebInspectorExtensionController.prototype.showExtensionTab):
+        * UserInterface/Views/TabBar.js:
+        (WI.TabBar.prototype._handleAddClosedTabsTabBarItemMouseDown):
+        (WI.TabBar.prototype._handleTabContainerContextMenu):
+        (WI.TabBar):
+
 2021-10-11  Razvan Caliman  <[email protected]>
 
         Web Inspector: Move CSS longhand and shorthand mapping away from WI.CSSCompletions

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (283920 => 283921)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2021-10-11 19:14:52 UTC (rev 283920)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2021-10-11 19:17:10 UTC (rev 283921)
@@ -742,6 +742,9 @@
 
 WI.isNewTabWithTypeAllowed = function(tabType)
 {
+    if (tabType === WI.WebInspectorExtensionTabContentView.Type)
+        return false;
+
     let tabClass = WI._knownTabClassesByType.get(tabType);
     if (!tabClass || !tabClass.isTabAllowed())
         return false;

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js (283920 => 283921)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js	2021-10-11 19:14:52 UTC (rev 283920)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js	2021-10-11 19:17:10 UTC (rev 283921)
@@ -160,7 +160,7 @@
         return target.PageAgent.reload.invoke({ignoreCache});
     }
     
-    showExtensionTab(extensionTabID)
+    showExtensionTab(extensionTabID, options = {})
     {
         let tabContentView = this._extensionTabContentViewForExtensionTabIDMap.get(extensionTabID);
         if (!tabContentView) {
@@ -170,6 +170,7 @@
 
         tabContentView.visible = true;
         let success = WI.tabBrowser.showTabForContentView(tabContentView, {
+            ...options,
             initiatorHint: WI.TabBrowser.TabNavigationInitiator.FrontendAPI,
         });
 
@@ -177,6 +178,8 @@
             WI.reportInternalError("Unable to show extension tab with extensionTabID: " + extensionTabID);
             return WI.WebInspectorExtension.ErrorCode.InternalError;
         }
+
+        tabContentView.visible = true;
     }
 
     hideExtensionTab(extensionTabID, options = {})

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js (283920 => 283921)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js	2021-10-11 19:14:52 UTC (rev 283920)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js	2021-10-11 19:17:10 UTC (rev 283921)
@@ -762,11 +762,17 @@
         });
 
         for (let closedTabClass of closedTabClasses) {
+            // Tab types that are not restorable (i.e., extension tab) should not be added in the generic code path.
+            if (!closedTabClass.shouldSaveTab())
+                continue;
+
             contextMenu.appendItem(closedTabClass.tabInfo().displayName, () => {
                 WI.createNewTabWithType(closedTabClass.Type, {shouldShowNewTab: true});
             });
         }
 
+        WI.sharedApp.extensionController.addContextMenuItemsForClosedExtensionTabs(contextMenu);
+
         contextMenu.show();
     }
 
@@ -941,6 +947,8 @@
                     WI.createNewTabWithType(tabClass.Type, {shouldShowNewTab: true});
             }, checked, disabled);
         }
+
+        WI.sharedApp.extensionController.addContextMenuItemsForAllExtensionTabs(contextMenu);
     }
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to