Skip to content

Commit b667cd6

Browse files
linusgtrflynn89
authored andcommitted
Browser: Add a banner to tabs controlled by WebDriver
From https://www.w3.org/TR/webdriver/#security: It is also suggested that user agents make an effort to visually distinguish a user agent session that is under control of WebDriver from those used for normal browsing sessions. This can be done through a browser chrome element such as a “door hanger”, colorful decoration of the OS window, or some widget element that is prevalent in the window so that it easy to identify automation windows.
1 parent 3ed1a14 commit b667cd6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Userland/Applications/Browser/Tab.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,8 @@ void Tab::hide_event(GUI::HideEvent&)
668668
void Tab::enable_webdriver_mode()
669669
{
670670
m_web_content_view->set_is_webdriver_active(true);
671+
auto& webdriver_banner = *find_descendant_of_type_named<GUI::Widget>("webdriver_banner");
672+
webdriver_banner.set_visible(true);
671673
}
672674

673675
}

Userland/Applications/Browser/Tab.gml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@
1111
}
1212
}
1313

14+
@GUI::Frame {
15+
name: "webdriver_banner"
16+
shape: "Box"
17+
shadow: "Sunken"
18+
thickness: 1
19+
preferred_height: "shrink"
20+
foreground_role: "TooltipText"
21+
background_role: "Tooltip"
22+
fill_with_background_color: true
23+
visible: false
24+
layout: @GUI::HorizontalBoxLayout {
25+
margins: [0, 4]
26+
}
27+
28+
@GUI::Label {
29+
text: "This Browser window is controlled by WebDriver."
30+
text_alignment: "CenterLeft"
31+
}
32+
}
33+
1434
@GUI::Widget {
1535
name: "webview_container"
1636
layout: @GUI::VerticalBoxLayout {}

0 commit comments

Comments
 (0)