Web Inspector: Provide a flag for technology preview builds
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Oct 2019 20:43:00 +0000 (20:43 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Oct 2019 20:43:00 +0000 (20:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=203164
<rdar://problem/56202164>

Reviewed by Devin Rousso.

Source/WebCore:

* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::isExperimentalBuild):
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:

* UserInterface/Test/Test.js:
* UserInterface/Base/Main.js:
* UserInterface/Base/Setting.js:
(WI.isTechnologyPreviewBuild):
(WI.arePreviewFeaturesEnabled):
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createExperimentalSettingsView):
In non-TechnologyPreview builds, if there are Preview Features provide a
setting switch that can be used to match the TechnologyPreview features.

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

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorFrontendHost.h
Source/WebCore/inspector/InspectorFrontendHost.idl
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Base/Setting.js
Source/WebInspectorUI/UserInterface/Test/Test.js
Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js

index 4bea45e..ba2b679 100644 (file)
@@ -1,3 +1,16 @@
+2019-10-21  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Provide a flag for technology preview builds
+        https://bugs.webkit.org/show_bug.cgi?id=203164
+        <rdar://problem/56202164>
+
+        Reviewed by Devin Rousso.
+
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::isExperimentalBuild):
+        * inspector/InspectorFrontendHost.h:
+        * inspector/InspectorFrontendHost.idl:
+
 2019-10-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         [SVG2]: Add 'auto' behavior to the 'width' and 'height' properties of the SVG <image> element
index 5a93f3b..eeb41d7 100644 (file)
@@ -446,6 +446,15 @@ bool InspectorFrontendHost::isUnderTest()
     return m_client && m_client->isUnderTest();
 }
 
+bool InspectorFrontendHost::isExperimentalBuild()
+{
+#if ENABLE(EXPERIMENTAL_FEATURES)
+    return true;
+#else
+    return false;
+#endif
+}
+
 void InspectorFrontendHost::unbufferedLog(const String& message)
 {
     // This is used only for debugging inspector tests.
index 56b89df..0aa3183 100644 (file)
@@ -111,6 +111,7 @@ public:
     void dispatchEventAsContextMenuEvent(Event&);
 
     bool isUnderTest();
+    bool isExperimentalBuild();
     void unbufferedLog(const String& message);
 
     void beep();
index 90b3afc..55e55f0 100644 (file)
@@ -83,6 +83,7 @@
     void unbufferedLog(DOMString message);
 
     boolean isUnderTest();
+    boolean isExperimentalBuild();
 
     void beep();
     void inspectInspector();
index 09510e4..50c8ba6 100644 (file)
@@ -1,3 +1,23 @@
+2019-10-21  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Provide a flag for technology preview builds
+        https://bugs.webkit.org/show_bug.cgi?id=203164
+        <rdar://problem/56202164>
+
+        Reviewed by Devin Rousso.
+
+        * Localizations/en.lproj/localizedStrings.js:
+
+        * UserInterface/Test/Test.js:
+        * UserInterface/Base/Main.js:
+        * UserInterface/Base/Setting.js:
+        (WI.isTechnologyPreviewBuild):
+        (WI.arePreviewFeaturesEnabled):
+        * UserInterface/Views/SettingsTabContentView.js:
+        (WI.SettingsTabContentView.prototype._createExperimentalSettingsView):
+        In non-TechnologyPreview builds, if there are Preview Features provide a
+        setting switch that can be used to match the TechnologyPreview features.
+
 2019-10-21  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: replace all uses of `window.*Agent` with a target-specific call
index 5a47303..57256b5 100644 (file)
@@ -441,6 +441,7 @@ localizedStrings["Enable Event Listeners"] = "Enable Event Listeners";
 localizedStrings["Enable Layers Tab"] = "Enable Layers Tab";
 localizedStrings["Enable Local Override"] = "Enable Local Override";
 localizedStrings["Enable New Tab Bar"] = "Enable New Tab Bar";
+localizedStrings["Enable Preview Features"] = "Enable Preview Features";
 localizedStrings["Enable Program"] = "Enable Program";
 localizedStrings["Enable Rule"] = "Enable Rule";
 localizedStrings["Enable all breakpoints (%s)"] = "Enable all breakpoints (%s)";
@@ -1063,6 +1064,7 @@ localizedStrings["Specially Exposed Data"] = "Specially Exposed Data";
 localizedStrings["Specificity: (%d, %d, %d)"] = "Specificity: (%d, %d, %d)";
 localizedStrings["Specificity: No value for selected element"] = "Specificity: No value for selected element";
 localizedStrings["Spelling"] = "Spelling";
+localizedStrings["Staging:"] = "Staging:";
 localizedStrings["Stalled"] = "Stalled";
 localizedStrings["Start"] = "Start";
 localizedStrings["Start Time"] = "Start Time";
index 4070fbe..b8b3a7a 100644 (file)
@@ -3235,6 +3235,7 @@ WI.reset = async function()
 };
 
 WI.isEngineeringBuild = false;
+WI.isExperimentalBuild = InspectorFrontendHost.isExperimentalBuild();
 
 // OpenResourceDialog delegate
 
index b3874ee..7831a6b 100644 (file)
@@ -186,6 +186,7 @@ WI.settings = {
     zoomFactor: new WI.Setting("zoom-factor", 1),
 
     // Experimental
+    experimentalEnablePreviewFeatures: new WI.Setting("experimental-enable-preview-features", false),
     experimentalEnableLayersTab: new WI.Setting("experimental-enable-layers-tab", false),
     experimentalEnableNewTabBar: new WI.Setting("experimental-enable-new-tab-bar", false),
     experimentalEnableStylesIcons: new WI.Setting("experimental-styles-icons", false),
@@ -211,3 +212,21 @@ WI.settings = {
     debugEnableUncaughtExceptionReporter: new WI.Setting("debug-enable-uncaught-exception-reporter", true),
     debugLayoutDirection: new WI.Setting("debug-layout-direction-override", "system"),
 };
+
+WI.previewFeatures = [];
+
+WI.isTechnologyPreviewBuild = function()
+{
+    return WI.isExperimentalBuild && !WI.isEngineeringBuild;
+};
+
+WI.arePreviewFeaturesEnabled = function()
+{
+    if (WI.isExperimentalBuild)
+        return true;
+
+    if (WI.settings.experimentalEnablePreviewFeatures.value)
+        return true;
+
+    return false;
+};
index b318ddd..c234220 100644 (file)
@@ -184,6 +184,9 @@ WI.assumingMainTarget = () => WI.mainTarget;
 
 WI.isDebugUIEnabled = () => false;
 
+WI.isEngineeringBuild = false;
+WI.isExperimentalBuild = true;
+
 WI.unlocalizedString = (string) => string;
 WI.UIString = (string, key, comment) => string;
 
index 0c9f8d4..1a582fc 100644 (file)
@@ -346,6 +346,14 @@ WI.SettingsTabContentView = class SettingsTabContentView extends WI.TabContentVi
 
         let initialValues = new Map;
 
+        // WebKit may by default enable certain features in a Technology Preview that are not enabled in trunk.
+        // Provide a switch that will make non-preview builds behave like an experimental build, for those preview features.
+        let hasPreviewFeatures = WI.previewFeatures.length > 0;
+        if (hasPreviewFeatures && (WI.isTechnologyPreviewBuild() || WI.isEngineeringBuild)) {
+            experimentalSettingsView.addSetting(WI.UIString("Staging:"), WI.settings.experimentalEnablePreviewFeatures, WI.UIString("Enable Preview Features"));
+            experimentalSettingsView.addSeparator();
+        }
+
         if (InspectorBackend.hasDomain("LayerTree")) {
             experimentalSettingsView.addSetting(WI.UIString("Layers:"), WI.settings.experimentalEnableLayersTab, WI.UIString("Enable Layers Tab"));
             experimentalSettingsView.addSeparator();
@@ -381,6 +389,7 @@ WI.SettingsTabContentView = class SettingsTabContentView extends WI.TabContentVi
             });
         }
 
+        listenForChange(WI.settings.experimentalEnablePreviewFeatures);
         listenForChange(WI.settings.experimentalEnableLayersTab);
         listenForChange(WI.settings.experimentalEnableNewTabBar);