No Issue - Add navigator.webdriver attribute.

This patch adds an enumerable, configurable, readonly attribute "webdriver" to
the Navigator object. The attribute is always false because we do not support
WebDriver or scripted automation.

The navigator.webdriver attribute is meant as an indication to web authors that
a document is visited by WebDriver. It is important to stress that it is not
meant as a way to detect that a website is being visited by a browser automation
tool or bot, but as a tool for web documents to take alternate code paths.

On the off-chance exposing navigator.webdriver turns out to be catastrophic,
we put it behind a new preference dom.webdriver.enabled that controls its
exposure.
This commit is contained in:
Moonchild 2024-06-17 09:44:52 +02:00 committed by roytam1
commit 6a200d5284
4 changed files with 22 additions and 0 deletions

View file

@ -1532,6 +1532,14 @@ Navigator::Clipboard()
return mClipboard;
}
/* static */
bool
Navigator::Webdriver()
{
// We don't support Selenium or marionette, so this is always false.
return false;
}
#ifdef MOZ_EME
static nsCString
ToCString(const nsString& aString)