Title: [261103] trunk
Revision
261103
Author
[email protected]
Date
2020-05-04 12:51:18 -0700 (Mon, 04 May 2020)

Log Message

Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode
https://bugs.webkit.org/show_bug.cgi?id=209763

Reviewed by Brian Burg.

Source/_javascript_Core:

* inspector/protocol/Page.json:
Add new enum values to `Page.Setting`:
 - `AdClickAttributionDebugModeEnabled`
 - `ITPDebugModeEnabled`

Source/WebCore:

Tests: inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled.html
       inspector/page/overrideSetting-ITPDebugModeEnabled.html

* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::overrideSetting):

* inspector/InspectorClient.h:
(WebCore::InspectorClient::setDeveloperPreferenceOverride): Added.
(WebCore::InspectorClient::setMockCaptureDevicesEnabledOverride): Deleted.

Source/WebInspectorUI:

* UserInterface/Base/Main.js:
(WI._handleDeviceSettingsTabBarButtonClicked):
Add a new section to the device settings popover:

    Enable: [ ] ITP Debug Mode
            [ ] Ad Click Attribution Debug Mode

* Localizations/en.lproj/localizedStrings.js:

Source/WebKit:

Generalize the `setMockCaptureDevicesEnabledOverride` to be `setDeveloperPreferenceOverride`
that uses an enum `WebCore::InspectorClient::DeveloperPreference` to know what to do.

Communicate with the NetworkProcess (from the WebProcess via the UIProcess) in the case of:
 - `AdClickAttributionDebugModeEnabled`
 - `ITPDebugModeEnabled`

* WebProcess/Inspector/WebInspectorClient.h:
* WebProcess/Inspector/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::setDeveloperPreferenceOverride): Added.
(WebKit::WebInspectorClient::setMockCaptureDevicesEnabledOverride): Deleted.
* WebProcess/Inspector/WebInspector.h:
* WebProcess/Inspector/WebInspector.cpp:
(WebKit::WebInspector::setDeveloperPreferenceOverride): Added.
(WebKit::WebInspector::setMockCaptureDevicesEnabledOverride): Deleted.

* UIProcess/Inspector/WebInspectorProxy.messages.in:
* UIProcess/Inspector/WebInspectorProxy.h:
* UIProcess/Inspector/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::setDeveloperPreferenceOverride): Added.
(WebKit::WebInspectorProxy::setMockCaptureDevicesEnabledOverride): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::setAdClickAttributionDebugMode): Added.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::setAdClickAttributionDebugMode): Added.

* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::setAdClickAttributionDebugMode): Added.
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):

LayoutTests:

* inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled.html: Added.
* inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled-expected.txt: Added.
* inspector/page/overrideSetting-ITPDebugModeEnabled.html: Added.
* inspector/page/overrideSetting-ITPDebugModeEnabled-expected.txt: Added.

* TestExpectations:
* platform/wk2/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (261102 => 261103)


--- trunk/LayoutTests/ChangeLog	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/LayoutTests/ChangeLog	2020-05-04 19:51:18 UTC (rev 261103)
@@ -1,3 +1,18 @@
+2020-05-04  Devin Rousso  <[email protected]>
+
+        Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode
+        https://bugs.webkit.org/show_bug.cgi?id=209763
+
+        Reviewed by Brian Burg.
+
+        * inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled.html: Added.
+        * inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled-expected.txt: Added.
+        * inspector/page/overrideSetting-ITPDebugModeEnabled.html: Added.
+        * inspector/page/overrideSetting-ITPDebugModeEnabled-expected.txt: Added.
+
+        * TestExpectations:
+        * platform/wk2/TestExpectations:
+
 2020-05-04  Guillem Vinals  <[email protected]>
 
         WebGPU: Textures should be able to have OUTPUT_ATTACHEMENT | SAMPLED usage flags

Modified: trunk/LayoutTests/TestExpectations (261102 => 261103)


--- trunk/LayoutTests/TestExpectations	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/LayoutTests/TestExpectations	2020-05-04 19:51:18 UTC (rev 261103)
@@ -976,6 +976,10 @@
 # Target domain is only present in WK2.
 http/tests/inspector/target [ Skip ]
 
+# ITP and AdClickAttribution are WK2 only.
+inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled.html [ Skip ]
+inspector/page/overrideSetting-ITPDebugModeEnabled.html [ Skip ]
+
 # These conformance tests are no longer in sync with the latest specification
 # and expect compareDocumentPosition() to return:
 # DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_DISCONNECTED

Added: trunk/LayoutTests/inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled-expected.txt (0 => 261103)


--- trunk/LayoutTests/inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled-expected.txt	2020-05-04 19:51:18 UTC (rev 261103)
@@ -0,0 +1,9 @@
+CONSOLE MESSAGE: [Ad Click Attribution] Turned Debug Mode on.
+Tests for the Page.overrideSetting command.
+
+
+== Running test suite: Page.overrideSetting
+-- Running test case: Page.overrideSetting.AdClickAttributionDebugModeEnabled
+Enabling ad click attribution debug mode...
+PASS: Should broadcast at least one console message.
+

Added: trunk/LayoutTests/inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled.html (0 => 261103)


--- trunk/LayoutTests/inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled.html	2020-05-04 19:51:18 UTC (rev 261103)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite("Page.overrideSetting");
+
+    suite.addTestCase({
+        name: "Page.overrideSetting.AdClickAttributionDebugModeEnabled",
+        description: "Test that changing whether ad click attribution debug mode is enabled has an effect.",
+        test(resolve, reject) {
+            let listener = WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, (event) => {
+                let {message} = event.data;
+                if (message.source !== WI.ConsoleMessage.MessageSource.AdClickAttribution)
+                    return;
+
+                InspectorTest.pass("Should broadcast at least one console message.");
+
+                WI.consoleManager.removeEventListener(WI.ConsoleManager.Event.MessageAdded, listener);
+                resolve();
+            });
+
+            InspectorTest.log("Enabling ad click attribution debug mode...");
+            PageAgent.overrideSetting(InspectorBackend.Enum.Page.Setting.AdClickAttributionDebugModeEnabled, true).catch(reject);
+        },
+    });
+
+    suite.runTestCasesAndFinish();
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+    <p>Tests for the Page.overrideSetting command.</p>
+</body>
+</html>

Added: trunk/LayoutTests/inspector/page/overrideSetting-ITPDebugModeEnabled-expected.txt (0 => 261103)


--- trunk/LayoutTests/inspector/page/overrideSetting-ITPDebugModeEnabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/page/overrideSetting-ITPDebugModeEnabled-expected.txt	2020-05-04 19:51:18 UTC (rev 261103)
@@ -0,0 +1,11 @@
+CONSOLE MESSAGE: [ITP] Turned Debug Mode on.
+CONSOLE MESSAGE: [ITP] Applying cross-site tracking restrictions to: [3rdpartytestwebkit.org].
+CONSOLE MESSAGE: [ITP] Done applying cross-site tracking restrictions.
+Tests for the Page.overrideSetting command.
+
+
+== Running test suite: Page.overrideSetting
+-- Running test case: Page.overrideSetting.ITPDebugModeEnabled
+Enabling ITP debug mode...
+PASS: Should broadcast at least one console message.
+

Added: trunk/LayoutTests/inspector/page/overrideSetting-ITPDebugModeEnabled.html (0 => 261103)


--- trunk/LayoutTests/inspector/page/overrideSetting-ITPDebugModeEnabled.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/page/overrideSetting-ITPDebugModeEnabled.html	2020-05-04 19:51:18 UTC (rev 261103)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite("Page.overrideSetting");
+
+    suite.addTestCase({
+        name: "Page.overrideSetting.ITPDebugModeEnabled",
+        description: "Test that changing whether ITP debug mode is enabled has an effect.",
+        test(resolve, reject) {
+            let listener = WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, (event) => {
+                let {message} = event.data;
+                if (message.source !== WI.ConsoleMessage.MessageSource.ITPDebug)
+                    return;
+
+                InspectorTest.pass("Should broadcast at least one console message.");
+
+                WI.consoleManager.removeEventListener(WI.ConsoleManager.Event.MessageAdded, listener);
+                resolve();
+            });
+
+            InspectorTest.log("Enabling ITP debug mode...");
+            PageAgent.overrideSetting(InspectorBackend.Enum.Page.Setting.ITPDebugModeEnabled, true).catch(reject);
+        },
+    });
+
+    suite.runTestCasesAndFinish();
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+    <p>Tests for the Page.overrideSetting command.</p>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/wk2/TestExpectations (261102 => 261103)


--- trunk/LayoutTests/platform/wk2/TestExpectations	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/LayoutTests/platform/wk2/TestExpectations	2020-05-04 19:51:18 UTC (rev 261103)
@@ -770,6 +770,10 @@
 # Target domain is only present in WebKit2.
 http/tests/inspector/target [ Pass ]
 
+# ITP and AdClickAttribution are WK2 only.
+inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled.html [ Pass ]
+inspector/page/overrideSetting-ITPDebugModeEnabled.html [ Pass ]
+
 # Highlighting marked text ranges from layout tests is only supported in WebKit2.
 editing/input/composition-highlights.html [ Pass ]
 

Modified: trunk/Source/_javascript_Core/ChangeLog (261102 => 261103)


--- trunk/Source/_javascript_Core/ChangeLog	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-05-04 19:51:18 UTC (rev 261103)
@@ -1,3 +1,15 @@
+2020-05-04  Devin Rousso  <[email protected]>
+
+        Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode
+        https://bugs.webkit.org/show_bug.cgi?id=209763
+
+        Reviewed by Brian Burg.
+
+        * inspector/protocol/Page.json:
+        Add new enum values to `Page.Setting`:
+         - `AdClickAttributionDebugModeEnabled`
+         - `ITPDebugModeEnabled`
+
 2020-05-03  Maciej Stachowiak  <[email protected]>
 
         Remove no longer needed WebKitAdditions include for _javascript_CorePrefix.h

Modified: trunk/Source/_javascript_Core/inspector/protocol/Page.json (261102 => 261103)


--- trunk/Source/_javascript_Core/inspector/protocol/Page.json	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/_javascript_Core/inspector/protocol/Page.json	2020-05-04 19:51:18 UTC (rev 261103)
@@ -7,10 +7,12 @@
         {
             "id": "Setting",
             "type": "string",
-            "description": "List of settings able to be overridden by WebInspector. Keep this in sync with FOR_EACH_INSPECTOR_OVERRIDE_SETTING.",
+            "description": "List of settings able to be overridden by WebInspector.",
             "enum": [
+                "AdClickAttributionDebugModeEnabled",
                 "AuthorAndUserStylesEnabled",
                 "ICECandidateFilteringEnabled",
+                "ITPDebugModeEnabled",
                 "ImagesEnabled",
                 "MediaCaptureRequiresSecureConnection",
                 "MockCaptureDevicesEnabled",

Modified: trunk/Source/WebCore/ChangeLog (261102 => 261103)


--- trunk/Source/WebCore/ChangeLog	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebCore/ChangeLog	2020-05-04 19:51:18 UTC (rev 261103)
@@ -1,3 +1,21 @@
+2020-05-04  Devin Rousso  <[email protected]>
+
+        Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode
+        https://bugs.webkit.org/show_bug.cgi?id=209763
+
+        Reviewed by Brian Burg.
+
+        Tests: inspector/page/overrideSetting-AdClickAttributionDebugModeEnabled.html
+               inspector/page/overrideSetting-ITPDebugModeEnabled.html
+
+        * inspector/agents/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::disable):
+        (WebCore::InspectorPageAgent::overrideSetting):
+
+        * inspector/InspectorClient.h:
+        (WebCore::InspectorClient::setDeveloperPreferenceOverride): Added.
+        (WebCore::InspectorClient::setMockCaptureDevicesEnabledOverride): Deleted.
+
 2020-05-04  Simon Fraser  <[email protected]>
 
         REGRESSION: [ Mac WK1 ] inspector/console/console-api.html is flaky crashing

Modified: trunk/Source/WebCore/inspector/InspectorClient.h (261102 => 261103)


--- trunk/Source/WebCore/inspector/InspectorClient.h	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebCore/inspector/InspectorClient.h	2020-05-04 19:51:18 UTC (rev 261103)
@@ -64,7 +64,12 @@
     virtual void elementSelectionChanged(bool) { }
     virtual void timelineRecordingChanged(bool) { }
 
-    virtual void setMockCaptureDevicesEnabledOverride(Optional<bool>) { }
+    enum class DeveloperPreference {
+        AdClickAttributionDebugModeEnabled,
+        ITPDebugModeEnabled,
+        MockCaptureDevicesEnabled,
+    };
+    virtual void setDeveloperPreferenceOverride(DeveloperPreference, Optional<bool>) { }
 
 #if ENABLE(REMOTE_INSPECTOR)
     virtual bool allowRemoteInspectionToPageDirectly() const { return false; }
@@ -72,3 +77,16 @@
 };
 
 } // namespace WebCore
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::InspectorClient::DeveloperPreference> {
+    using values = EnumValues<
+        WebCore::InspectorClient::DeveloperPreference,
+        WebCore::InspectorClient::DeveloperPreference::AdClickAttributionDebugModeEnabled,
+        WebCore::InspectorClient::DeveloperPreference::ITPDebugModeEnabled,
+        WebCore::InspectorClient::DeveloperPreference::MockCaptureDevicesEnabled
+    >;
+};
+
+} // namespace WTF

Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp (261102 => 261103)


--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp	2020-05-04 19:51:18 UTC (rev 261103)
@@ -86,20 +86,6 @@
 
 using namespace Inspector;
 
-// Keep this in sync with Page.Setting
-#define FOR_EACH_INSPECTOR_OVERRIDE_SETTING(macro) \
-    macro(AuthorAndUserStylesEnabled) \
-    macro(ICECandidateFilteringEnabled) \
-    macro(ImagesEnabled) \
-    macro(MediaCaptureRequiresSecureConnection) \
-    macro(MockCaptureDevicesEnabled) \
-    macro(NeedsSiteSpecificQuirks) \
-    macro(ScriptEnabled) \
-    macro(ShowDebugBorders) \
-    macro(ShowRepaintCounter) \
-    macro(WebRTCEncryptionEnabled) \
-    macro(WebSecurityEnabled)
-
 static bool decodeBuffer(const char* buffer, unsigned size, const String& textEncodingName, String* result)
 {
     if (buffer) {
@@ -386,14 +372,22 @@
     setEmulatedMedia(unused, emptyString());
     setForcedAppearance(unused, emptyString());
 
-#define DISABLE_INSPECTOR_OVERRIDE_SETTING(name) \
-    m_inspectedPage.settings().set##name##InspectorOverride(WTF::nullopt);
+    auto& inspectedPageSettings = m_inspectedPage.settings();
+    inspectedPageSettings.setAuthorAndUserStylesEnabledInspectorOverride(WTF::nullopt);
+    inspectedPageSettings.setICECandidateFilteringEnabledInspectorOverride(WTF::nullopt);
+    inspectedPageSettings.setImagesEnabledInspectorOverride(WTF::nullopt);
+    inspectedPageSettings.setMediaCaptureRequiresSecureConnectionInspectorOverride(WTF::nullopt);
+    inspectedPageSettings.setMockCaptureDevicesEnabledInspectorOverride(WTF::nullopt);
+    inspectedPageSettings.setNeedsSiteSpecificQuirksInspectorOverride(WTF::nullopt);
+    inspectedPageSettings.setScriptEnabledInspectorOverride(WTF::nullopt);
+    inspectedPageSettings.setShowDebugBordersInspectorOverride(WTF::nullopt);
+    inspectedPageSettings.setShowRepaintCounterInspectorOverride(WTF::nullopt);
+    inspectedPageSettings.setWebRTCEncryptionEnabledInspectorOverride(WTF::nullopt);
+    inspectedPageSettings.setWebSecurityEnabledInspectorOverride(WTF::nullopt);
 
-    FOR_EACH_INSPECTOR_OVERRIDE_SETTING(DISABLE_INSPECTOR_OVERRIDE_SETTING)
-
-#undef DISABLE_INSPECTOR_OVERRIDE_SETTING
-
-    m_client->setMockCaptureDevicesEnabledOverride(WTF::nullopt);
+    m_client->setDeveloperPreferenceOverride(InspectorClient::DeveloperPreference::AdClickAttributionDebugModeEnabled, WTF::nullopt);
+    m_client->setDeveloperPreferenceOverride(InspectorClient::DeveloperPreference::ITPDebugModeEnabled, WTF::nullopt);
+    m_client->setDeveloperPreferenceOverride(InspectorClient::DeveloperPreference::MockCaptureDevicesEnabled, WTF::nullopt);
 }
 
 double InspectorPageAgent::timestamp()
@@ -451,21 +445,65 @@
         return;
     }
 
+    auto& inspectedPageSettings = m_inspectedPage.settings();
+
     auto overrideValue = asOptionalBool(value);
     switch (setting.value()) {
-#define CASE_INSPECTOR_OVERRIDE_SETTING(name) \
-    case Inspector::Protocol::Page::Setting::name:                              \
-        m_inspectedPage.settings().set##name##InspectorOverride(overrideValue); \
-        break;                                                                  \
+    case Inspector::Protocol::Page::Setting::AdClickAttributionDebugModeEnabled:
+        m_client->setDeveloperPreferenceOverride(InspectorClient::DeveloperPreference::AdClickAttributionDebugModeEnabled, overrideValue);
+        return;
 
-    FOR_EACH_INSPECTOR_OVERRIDE_SETTING(CASE_INSPECTOR_OVERRIDE_SETTING)
+    case Inspector::Protocol::Page::Setting::AuthorAndUserStylesEnabled:
+        inspectedPageSettings.setAuthorAndUserStylesEnabledInspectorOverride(overrideValue);
+        return;
 
-#undef CASE_INSPECTOR_OVERRIDE_SETTING
+    case Inspector::Protocol::Page::Setting::ICECandidateFilteringEnabled:
+        inspectedPageSettings.setICECandidateFilteringEnabledInspectorOverride(overrideValue);
+        return;
+
+    case Inspector::Protocol::Page::Setting::ITPDebugModeEnabled:
+        m_client->setDeveloperPreferenceOverride(InspectorClient::DeveloperPreference::ITPDebugModeEnabled, overrideValue);
+        return;
+
+    case Inspector::Protocol::Page::Setting::ImagesEnabled:
+        inspectedPageSettings.setImagesEnabledInspectorOverride(overrideValue);
+        return;
+
+    case Inspector::Protocol::Page::Setting::MediaCaptureRequiresSecureConnection:
+        inspectedPageSettings.setMediaCaptureRequiresSecureConnectionInspectorOverride(overrideValue);
+        return;
+
+    case Inspector::Protocol::Page::Setting::MockCaptureDevicesEnabled:
+        inspectedPageSettings.setMockCaptureDevicesEnabledInspectorOverride(overrideValue);
+        m_client->setDeveloperPreferenceOverride(InspectorClient::DeveloperPreference::MockCaptureDevicesEnabled, overrideValue);
+        return;
+
+    case Inspector::Protocol::Page::Setting::NeedsSiteSpecificQuirks:
+        inspectedPageSettings.setNeedsSiteSpecificQuirksInspectorOverride(overrideValue);
+        return;
+
+    case Inspector::Protocol::Page::Setting::ScriptEnabled:
+        inspectedPageSettings.setScriptEnabledInspectorOverride(overrideValue);
+        return;
+
+    case Inspector::Protocol::Page::Setting::ShowDebugBorders:
+        inspectedPageSettings.setShowDebugBordersInspectorOverride(overrideValue);
+        return;
+
+    case Inspector::Protocol::Page::Setting::ShowRepaintCounter:
+        inspectedPageSettings.setShowRepaintCounterInspectorOverride(overrideValue);
+        return;
+
+    case Inspector::Protocol::Page::Setting::WebRTCEncryptionEnabled:
+        inspectedPageSettings.setWebRTCEncryptionEnabledInspectorOverride(overrideValue);
+        return;
+
+    case Inspector::Protocol::Page::Setting::WebSecurityEnabled:
+        inspectedPageSettings.setWebSecurityEnabledInspectorOverride(overrideValue);
+        return;
     }
 
-    // Update the UIProcess / client for particular overrides.
-    if (setting.value() == Inspector::Protocol::Page::Setting::MockCaptureDevicesEnabled)
-        m_client->setMockCaptureDevicesEnabledOverride(overrideValue);
+    ASSERT_NOT_REACHED();
 }
 
 static Inspector::Protocol::Page::CookieSameSitePolicy cookieSameSitePolicyJSON(Cookie::SameSitePolicy policy)

Modified: trunk/Source/WebInspectorUI/ChangeLog (261102 => 261103)


--- trunk/Source/WebInspectorUI/ChangeLog	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebInspectorUI/ChangeLog	2020-05-04 19:51:18 UTC (rev 261103)
@@ -1,3 +1,19 @@
+2020-05-04  Devin Rousso  <[email protected]>
+
+        Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode
+        https://bugs.webkit.org/show_bug.cgi?id=209763
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Base/Main.js:
+        (WI._handleDeviceSettingsTabBarButtonClicked):
+        Add a new section to the device settings popover:
+
+            Enable: [ ] ITP Debug Mode
+                    [ ] Ad Click Attribution Debug Mode
+
+        * Localizations/en.lproj/localizedStrings.js:
+
 2020-05-02  Devin Rousso  <[email protected]>
 
         [CSS Easing 1] implement `jump-*` step positions

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (261102 => 261103)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2020-05-04 19:51:18 UTC (rev 261103)
@@ -94,6 +94,7 @@
 localizedStrings["Action"] = "Action";
 /* Tooltip for a time range bar that represents when a CSS animation/transition is running */
 localizedStrings["Active"] = "Active";
+localizedStrings["Ad Click Attribution Debug Mode"] = "Ad Click Attribution Debug Mode";
 localizedStrings["Add"] = "Add";
 localizedStrings["Add %s Rule"] = "Add %s Rule";
 localizedStrings["Add Action"] = "Add Action";
@@ -506,6 +507,7 @@
 localizedStrings["Enable all breakpoints (%s)"] = "Enable all breakpoints (%s)";
 localizedStrings["Enable paint flashing"] = "Enable paint flashing";
 localizedStrings["Enable source maps"] = "Enable source maps";
+localizedStrings["Enable:"] = "Enable:";
 localizedStrings["Enabled"] = "Enabled";
 localizedStrings["Encoded"] = "Encoded";
 localizedStrings["Encoding"] = "Encoding";
@@ -658,6 +660,7 @@
 localizedStrings["ICO"] = "ICO";
 localizedStrings["IP"] = "IP";
 localizedStrings["IP Address"] = "IP Address";
+localizedStrings["ITP Debug Mode"] = "ITP Debug Mode";
 localizedStrings["Identity"] = "Identity";
 localizedStrings["Idle"] = "Idle";
 localizedStrings["If the URL of any script matches one of the regular _expression_ patterns below, any pauses that would have happened in that script will be deferred until execution has continued to outside of that script."] = "If the URL of any script matches one of the regular _expression_ patterns below, any pauses that would have happened in that script will be deferred until execution has continued to outside of that script.";

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (261102 => 261103)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2020-05-04 19:51:18 UTC (rev 261103)
@@ -2275,6 +2275,15 @@
             ],
         },
         {
+            name: WI.UIString("Enable:"),
+            columns: [
+                [
+                    {name: WI.UIString("ITP Debug Mode"), setting: InspectorBackend.Enum.Page.Setting.ITPDebugModeEnabled, value: true},
+                    {name: WI.UIString("Ad Click Attribution Debug Mode"), setting: InspectorBackend.Enum.Page.Setting.AdClickAttributionDebugModeEnabled, value: true},
+                ],
+            ],
+        },
+        {
             name: WI.UIString("%s:").format(WI.unlocalizedString("WebRTC")),
             columns: [
                 [

Modified: trunk/Source/WebKit/ChangeLog (261102 => 261103)


--- trunk/Source/WebKit/ChangeLog	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/ChangeLog	2020-05-04 19:51:18 UTC (rev 261103)
@@ -1,3 +1,46 @@
+2020-05-04  Devin Rousso  <[email protected]>
+
+        Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode
+        https://bugs.webkit.org/show_bug.cgi?id=209763
+
+        Reviewed by Brian Burg.
+
+        Generalize the `setMockCaptureDevicesEnabledOverride` to be `setDeveloperPreferenceOverride`
+        that uses an enum `WebCore::InspectorClient::DeveloperPreference` to know what to do.
+
+        Communicate with the NetworkProcess (from the WebProcess via the UIProcess) in the case of:
+         - `AdClickAttributionDebugModeEnabled`
+         - `ITPDebugModeEnabled`
+
+        * WebProcess/Inspector/WebInspectorClient.h:
+        * WebProcess/Inspector/WebInspectorClient.cpp:
+        (WebKit::WebInspectorClient::setDeveloperPreferenceOverride): Added.
+        (WebKit::WebInspectorClient::setMockCaptureDevicesEnabledOverride): Deleted.
+        * WebProcess/Inspector/WebInspector.h:
+        * WebProcess/Inspector/WebInspector.cpp:
+        (WebKit::WebInspector::setDeveloperPreferenceOverride): Added.
+        (WebKit::WebInspector::setMockCaptureDevicesEnabledOverride): Deleted.
+
+        * UIProcess/Inspector/WebInspectorProxy.messages.in:
+        * UIProcess/Inspector/WebInspectorProxy.h:
+        * UIProcess/Inspector/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::setDeveloperPreferenceOverride): Added.
+        (WebKit::WebInspectorProxy::setMockCaptureDevicesEnabledOverride): Deleted.
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::setAdClickAttributionDebugMode): Added.
+        * UIProcess/Network/NetworkProcessProxy.h:
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::setAdClickAttributionDebugMode): Added.
+
+        * NetworkProcess/NetworkProcess.messages.in:
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        (WebKit::NetworkProcess::setAdClickAttributionDebugMode): Added.
+        * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
+        (WebKit::ResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
+
 2020-05-04  Chris Dumez  <[email protected]>
 
         [iOS] Unable to take RunningBoard process assertions in the iOS Simulator

Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp (261102 => 261103)


--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp	2020-05-04 19:51:18 UTC (rev 261103)
@@ -292,6 +292,9 @@
 {
     ASSERT(!RunLoop::isMain());
 
+    if (m_debugModeEnabled == enable)
+        return;
+
     m_debugModeEnabled = enable;
     m_debugLoggingEnabled = enable;
 

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (261102 => 261103)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2020-05-04 19:51:18 UTC (rev 261103)
@@ -335,7 +335,7 @@
     m_isITPDatabaseEnabled = parameters.shouldEnableITPDatabase;
 #endif
 
-    WebCore::RuntimeEnabledFeatures::sharedFeatures().setAdClickAttributionDebugModeEnabled(parameters.enableAdClickAttributionDebugMode);
+    setAdClickAttributionDebugMode(parameters.enableAdClickAttributionDebugMode);
 
     SandboxExtension::consumePermanently(parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsParameters.directoryExtensionHandle);
 
@@ -1357,6 +1357,21 @@
 }
 #endif // ENABLE(RESOURCE_LOAD_STATISTICS)
 
+void NetworkProcess::setAdClickAttributionDebugMode(bool debugMode)
+{
+    if (RuntimeEnabledFeatures::sharedFeatures().adClickAttributionDebugModeEnabled() == debugMode)
+        return;
+
+    RuntimeEnabledFeatures::sharedFeatures().setAdClickAttributionDebugModeEnabled(debugMode);
+
+    String message = debugMode ? "[Ad Click Attribution] Turned Debug Mode on."_s : "[Ad Click Attribution] Turned Debug Mode off."_s;
+    for (auto& networkConnectionToWebProcess : m_webProcessConnections.values()) {
+        if (networkConnectionToWebProcess->sessionID().isEphemeral())
+            continue;
+        networkConnectionToWebProcess->broadcastConsoleMessage(MessageSource::AdClickAttribution, MessageLevel::Info, message);
+    }
+}
+
 void NetworkProcess::preconnectTo(PAL::SessionID sessionID, const URL& url, const String& userAgent, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain)
 {
 #if ENABLE(SERVER_PRECONNECT)

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (261102 => 261103)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h	2020-05-04 19:51:18 UTC (rev 261103)
@@ -269,6 +269,8 @@
     void setToSameSiteStrictCookiesForTesting(PAL::SessionID, const WebCore::RegistrableDomain&, CompletionHandler<void()>&&);
 #endif
 
+    void setAdClickAttributionDebugMode(bool);
+
     using CacheStorageRootPathCallback = CompletionHandler<void(String&&)>;
     void cacheStorageRootPath(PAL::SessionID, CacheStorageRootPathCallback&&);
 

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (261102 => 261103)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in	2020-05-04 19:51:18 UTC (rev 261103)
@@ -148,6 +148,8 @@
     SetToSameSiteStrictCookiesForTesting(PAL::SessionID sessionID, WebCore::RegistrableDomain domain) -> () Async
 #endif
 
+    SetAdClickAttributionDebugMode(bool debugMode)
+
     SetSessionIsControlledByAutomation(PAL::SessionID sessionID, bool controlled);
 
     RegisterURLSchemeAsSecure(String scheme)

Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.cpp (261102 => 261103)


--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.cpp	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.cpp	2020-05-04 19:51:18 UTC (rev 261103)
@@ -620,16 +620,28 @@
     m_isProfilingPage = active;
 }
 
-void WebInspectorProxy::setMockCaptureDevicesEnabledOverride(Optional<bool> enabled)
+void WebInspectorProxy::setDeveloperPreferenceOverride(WebCore::InspectorClient::DeveloperPreference developerPreference, Optional<bool> overrideValue)
 {
+    switch (developerPreference) {
+    case InspectorClient::DeveloperPreference::AdClickAttributionDebugModeEnabled:
+        if (m_inspectedPage)
+            m_inspectedPage->websiteDataStore().setAdClickAttributionDebugMode(overrideValue && overrideValue.value());
+        return;
+
+    case InspectorClient::DeveloperPreference::ITPDebugModeEnabled:
+        if (m_inspectedPage)
+            m_inspectedPage->websiteDataStore().setResourceLoadStatisticsDebugMode(overrideValue && overrideValue.value());
+        return;
+
+    case InspectorClient::DeveloperPreference::MockCaptureDevicesEnabled:
 #if ENABLE(MEDIA_STREAM)
-    if (!m_inspectedPage)
+        if (m_inspectedPage)
+            m_inspectedPage->setMockCaptureDevicesEnabledOverride(overrideValue);
+#endif // ENABLE(MEDIA_STREAM)
         return;
+    }
 
-    m_inspectedPage->setMockCaptureDevicesEnabledOverride(enabled);
-#else
-    UNUSED_PARAM(enabled);
-#endif
+    ASSERT_NOT_REACHED();
 }
 
 void WebInspectorProxy::setDiagnosticLoggingAvailable(bool available)

Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.h (261102 => 261103)


--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.h	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.h	2020-05-04 19:51:18 UTC (rev 261103)
@@ -33,6 +33,7 @@
 #include "WebInspectorUtilities.h"
 #include <_javascript_Core/InspectorFrontendChannel.h>
 #include <WebCore/FloatRect.h>
+#include <WebCore/InspectorClient.h>
 #include <WebCore/InspectorFrontendClient.h>
 #include <wtf/Forward.h>
 #include <wtf/RefPtr.h>
@@ -242,7 +243,7 @@
     void showCertificate(const WebCore::CertificateInfo&);
     void elementSelectionChanged(bool);
     void timelineRecordingChanged(bool);
-    void setMockCaptureDevicesEnabledOverride(Optional<bool>);
+    void setDeveloperPreferenceOverride(WebCore::InspectorClient::DeveloperPreference, Optional<bool>);
 
     void save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs);
     void append(const String& filename, const String& content);

Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.messages.in (261102 => 261103)


--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.messages.in	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.messages.in	2020-05-04 19:51:18 UTC (rev 261103)
@@ -39,7 +39,7 @@
     ShowCertificate(WebCore::CertificateInfo certificateInfo)
     ElementSelectionChanged(bool active)
     TimelineRecordingChanged(bool active)
-    SetMockCaptureDevicesEnabledOverride(Optional<bool> enabled)
+    SetDeveloperPreferenceOverride(WebCore::InspectorClient::DeveloperPreference developerPreference, Optional<bool> overrideValue)
 
     Save(String filename, String content, bool base64Encoded, bool forceSaveAs)
     Append(String filename, String content)

Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (261102 => 261103)


--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2020-05-04 19:51:18 UTC (rev 261103)
@@ -1167,6 +1167,14 @@
 }
 #endif // ENABLE(RESOURCE_LOAD_STATISTICS)
 
+void NetworkProcessProxy::setAdClickAttributionDebugMode(bool debugMode)
+{
+    if (!canSendMessage())
+        return;
+
+    send(Messages::NetworkProcess::SetAdClickAttributionDebugMode(debugMode), 0);
+}
+
 void NetworkProcessProxy::sendProcessWillSuspendImminentlyForTesting()
 {
     if (canSendMessage())

Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (261102 => 261103)


--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h	2020-05-04 19:51:18 UTC (rev 261103)
@@ -181,6 +181,8 @@
     void setFirstPartyWebsiteDataRemovalModeForTesting(PAL::SessionID, WebCore::FirstPartyWebsiteDataRemovalMode, CompletionHandler<void()>&&);
     void setToSameSiteStrictCookiesForTesting(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&);
 #endif
+
+    void setAdClickAttributionDebugMode(bool);
     
     void synthesizeAppIsBackground(bool background);
 

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (261102 => 261103)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2020-05-04 19:51:18 UTC (rev 261103)
@@ -2144,6 +2144,12 @@
     completionHandler(false);
 }
 
+void WebsiteDataStore::setAdClickAttributionDebugMode(bool enabled)
+{
+    for (auto& processPool : processPools())
+        processPool->ensureNetworkProcess().setAdClickAttributionDebugMode(enabled);
+}
+
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
 void WebsiteDataStore::logTestingEvent(const String& event)
 {

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (261102 => 261103)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2020-05-04 19:51:18 UTC (rev 261103)
@@ -125,6 +125,8 @@
     void setResourceLoadStatisticsDebugMode(bool, CompletionHandler<void()>&&);
     void isResourceLoadStatisticsEphemeral(CompletionHandler<void(bool)>&&) const;
 
+    void setAdClickAttributionDebugMode(bool);
+
     uint64_t perOriginStorageQuota() const { return m_resolvedConfiguration->perOriginStorageQuota(); }
     uint64_t perThirdPartyOriginStorageQuota() const;
     const String& cacheStorageDirectory() const { return m_resolvedConfiguration->cacheStorageDirectory(); }

Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspector.cpp (261102 => 261103)


--- trunk/Source/WebKit/WebProcess/Inspector/WebInspector.cpp	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspector.cpp	2020-05-04 19:51:18 UTC (rev 261103)
@@ -281,9 +281,9 @@
     WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::TimelineRecordingChanged(active), m_page->identifier());
 }
 
-void WebInspector::setMockCaptureDevicesEnabledOverride(Optional<bool> enabled)
+void WebInspector::setDeveloperPreferenceOverride(InspectorClient::DeveloperPreference developerPreference, Optional<bool> overrideValue)
 {
-    WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::SetMockCaptureDevicesEnabledOverride(enabled), m_page->identifier());
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::SetDeveloperPreferenceOverride(developerPreference, overrideValue), m_page->identifier());
 }
 
 bool WebInspector::canAttachWindow()

Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspector.h (261102 => 261103)


--- trunk/Source/WebKit/WebProcess/Inspector/WebInspector.h	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspector.h	2020-05-04 19:51:18 UTC (rev 261103)
@@ -29,6 +29,7 @@
 #include "Connection.h"
 #include "MessageReceiver.h"
 #include <WebCore/FrameIdentifier.h>
+#include <WebCore/InspectorClient.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/text/WTFString.h>
 
@@ -74,7 +75,7 @@
     void stopElementSelection();
     void elementSelectionChanged(bool);
     void timelineRecordingChanged(bool);
-    void setMockCaptureDevicesEnabledOverride(Optional<bool>);
+    void setDeveloperPreferenceOverride(WebCore::InspectorClient::DeveloperPreference, Optional<bool>);
 
     void setFrontendConnection(IPC::Attachment);
 

Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.cpp (261102 => 261103)


--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.cpp	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.cpp	2020-05-04 19:51:18 UTC (rev 261103)
@@ -218,10 +218,10 @@
         m_page->inspector()->timelineRecordingChanged(active);
 }
 
-void WebInspectorClient::setMockCaptureDevicesEnabledOverride(Optional<bool> enabled)
+void WebInspectorClient::setDeveloperPreferenceOverride(WebCore::InspectorClient::DeveloperPreference developerPreference, Optional<bool> overrideValue)
 {
     if (m_page->inspector())
-        m_page->inspector()->setMockCaptureDevicesEnabledOverride(enabled);
+        m_page->inspector()->setDeveloperPreferenceOverride(developerPreference, overrideValue);
 }
 
 void WebInspectorClient::willMoveToPage(PageOverlay&, Page* page)

Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.h (261102 => 261103)


--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.h	2020-05-04 19:49:11 UTC (rev 261102)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.h	2020-05-04 19:51:18 UTC (rev 261103)
@@ -73,7 +73,7 @@
     bool overridesShowPaintRects() const override { return true; }
     void showPaintRect(const WebCore::FloatRect&) override;
 
-    void setMockCaptureDevicesEnabledOverride(Optional<bool>) final;
+    void setDeveloperPreferenceOverride(WebCore::InspectorClient::DeveloperPreference, Optional<bool>) final;
 
     // PageOverlay::Client
     void willMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to