commit 0cab465a411451f2aec502b8efebbff1ea4294ba
parent db92e9971c9e8e9a4d5b79f15a52663f99dcc2a0
Author: Josh Matthews <josh@joshmatthews.net>
Date: Fri, 28 Nov 2025 14:53:47 +0000
Bug 2000777 [wpt PR 56082] - servodriver: Clear cookies between tests., a=testonly
Automatic update from web-platform-tests
servodriver: Clear cookies between tests.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
--
wpt-commits: 5fa4eef9b91a79fc53f56a12b78375746e0cdb9b
wpt-pr: 56082
Diffstat:
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorservodriver.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorservodriver.py
@@ -2,7 +2,13 @@
import os
-from .executorwebdriver import WebDriverProtocol, WebDriverTestharnessExecutor, WebDriverRefTestExecutor, WebDriverCrashtestExecutor
+from .executorwebdriver import (
+ WebDriverProtocol,
+ WebDriverTestharnessExecutor,
+ WebDriverTestharnessProtocolPart,
+ WebDriverRefTestExecutor,
+ WebDriverCrashtestExecutor,
+)
webdriver = None
ServoCommandExtensions = None
@@ -36,6 +42,10 @@ def do_delayed_imports():
body = {}
return self.session.send_session_command("DELETE", "servo/shutdown", body)
+ # Clear all cookies for all origins.
+ def reset_all_cookies(self):
+ body = {}
+ return self.session.send_session_command("POST", "servo/cookies/reset", body)
def change_prefs(self, old_prefs, new_prefs):
# Servo interprets reset with an empty list as reset everything
@@ -56,10 +66,23 @@ def parse_pref_value(value):
return value
+class ServoDriverTestharnessProtocolPart(WebDriverTestharnessProtocolPart):
+ def reset_browser_state(self):
+ self.parent.webdriver.extension.reset_all_cookies()
+
+
class ServoWebDriverProtocol(WebDriverProtocol):
+ implements = [
+ ServoDriverTestharnessProtocolPart,
+ ]
+ for base_part in WebDriverProtocol.implements:
+ if base_part.name not in {part.name for part in implements}:
+ implements.append(base_part)
+
def __init__(self, executor, browser, capabilities, **kwargs):
do_delayed_imports()
- WebDriverProtocol.__init__(self, executor, browser, capabilities, **kwargs)
+ self.implements = list(ServoWebDriverProtocol.implements)
+ super().__init__(executor, browser, capabilities, **kwargs)
def connect(self):
"""Connect to browser via WebDriver and crete a WebDriver session."""