Title: [247707] trunk/Source/WebCore
Revision
247707
Author
[email protected]
Date
2019-07-22 17:01:04 -0700 (Mon, 22 Jul 2019)

Log Message

Fix inspector override conversion in InspectorPageAgent::overrideSetting
https://bugs.webkit.org/show_bug.cgi?id=200017

Reviewed by Devin Rousso.

Covered by inspector/page/overrideSetting-MockCaptureDevicesEnabled.html
which should not fail on bots not having cameras

* inspector/agents/InspectorPageAgent.cpp:
(WebCore::toOptionalBool):
(WebCore::InspectorPageAgent::overrideSetting):
Previously, the conversion for the mock capture value was implicit from a bool pointer to an optional.
Make an explicit conversion as done for regular settings.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (247706 => 247707)


--- trunk/Source/WebCore/ChangeLog	2019-07-22 23:47:16 UTC (rev 247706)
+++ trunk/Source/WebCore/ChangeLog	2019-07-23 00:01:04 UTC (rev 247707)
@@ -1,3 +1,19 @@
+2019-07-22  Youenn Fablet  <[email protected]>
+
+        Fix inspector override conversion in InspectorPageAgent::overrideSetting
+        https://bugs.webkit.org/show_bug.cgi?id=200017
+
+        Reviewed by Devin Rousso.
+
+        Covered by inspector/page/overrideSetting-MockCaptureDevicesEnabled.html
+        which should not fail on bots not having cameras
+
+        * inspector/agents/InspectorPageAgent.cpp:
+        (WebCore::toOptionalBool):
+        (WebCore::InspectorPageAgent::overrideSetting):
+        Previously, the conversion for the mock capture value was implicit from a bool pointer to an optional.
+        Make an explicit conversion as done for regular settings.
+
 2019-07-22  Ross Kirsling  <[email protected]>
 
         Unreviewed non-unified build fix.

Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp (247706 => 247707)


--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp	2019-07-22 23:47:16 UTC (rev 247706)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp	2019-07-23 00:01:04 UTC (rev 247707)
@@ -422,6 +422,13 @@
     m_userAgentOverride = value ? *value : String();
 }
 
+static inline Optional<bool> asOptionalBool(const bool* value)
+{
+    if (!value)
+        return WTF::nullopt;
+    return *value;
+}
+
 void InspectorPageAgent::overrideSetting(ErrorString& errorString, const String& settingString, const bool* value)
 {
     if (settingString.isEmpty()) {
@@ -435,15 +442,12 @@
         return;
     }
 
+    auto overrideValue = asOptionalBool(value);
     switch (setting.value()) {
 #define CASE_INSPECTOR_OVERRIDE_SETTING(name) \
-    case Inspector::Protocol::Page::Setting::name: {                               \
-        if (value)                                                                 \
-            m_inspectedPage.settings().set##name##InspectorOverride(*value);       \
-        else                                                                       \
-            m_inspectedPage.settings().set##name##InspectorOverride(WTF::nullopt); \
-        break;                                                                     \
-    }                                                                              \
+    case Inspector::Protocol::Page::Setting::name:                              \
+        m_inspectedPage.settings().set##name##InspectorOverride(overrideValue); \
+        break;                                                                  \
 
     FOR_EACH_INSPECTOR_OVERRIDE_SETTING(CASE_INSPECTOR_OVERRIDE_SETTING)
 
@@ -452,7 +456,7 @@
 
     // Update the UIProcess / client for particular overrides.
     if (setting.value() == Inspector::Protocol::Page::Setting::MockCaptureDevicesEnabled)
-        m_client->setMockCaptureDevicesEnabledOverride(value);
+        m_client->setMockCaptureDevicesEnabledOverride(overrideValue);
 }
 
 static Inspector::Protocol::Page::CookieSameSitePolicy cookieSameSitePolicyJSON(Cookie::SameSitePolicy policy)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to