IsLoggedIn: Add as experimental feature
https://bugs.webkit.org/show_bug.cgi?id=202707
<rdar://problem/56095064>

Reviewed by Brent Fulgham and Chris Dumez.

IsLoggedIn was proposed to the WebAppSec WG at TPAC 2019.
So far there is only an explainer posted to the mailing list:
https://lists.w3.org/Archives/Public/public-webappsec/2019Sep/0004.html

Source/WebCore:

This patch adds the three experimental web APIs:
- Promise<void> setLoggedIn()
- Promise<void> setLoggedOut()
- Promise<bool> isLoggedIn()

It also tests that those APIs are only exposed in secure contexts.

The functionality is implemented as a supplement to Navigator.

Tests: http/tests/is-logged-in/available-in-secure-contexts.https.html
       http/tests/is-logged-in/unavailable-in-insecure-contexts.html

* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/NavigatorIsLoggedIn.cpp: Added.
(WebCore::NavigatorIsLoggedIn::from):
(WebCore::NavigatorIsLoggedIn::supplementName):
(WebCore::NavigatorIsLoggedIn::setLoggedIn):
(WebCore::NavigatorIsLoggedIn::setLoggedOut):
(WebCore::NavigatorIsLoggedIn::isLoggedIn):
* page/NavigatorIsLoggedIn.h: Added.
* page/NavigatorIsLoggedIn.idl: Added.
* page/PointerCaptureController.cpp:
* page/PointerCaptureController.h:
* page/Settings.yaml:

Source/WebKit:

* Shared/WebPreferences.yaml:

LayoutTests:

* http/tests/is-logged-in/available-in-secure-contexts.https-expected.txt: Added.
* http/tests/is-logged-in/available-in-secure-contexts.https.html: Added.
* http/tests/is-logged-in/unavailable-in-insecure-contexts-expected.txt: Added.
* http/tests/is-logged-in/unavailable-in-insecure-contexts.html: Added.
* platform/ios-device-wk1/TestExpectations:
* platform/ios-simulator-wk1/TestExpectations:
* platform/ios-wk1/TestExpectations:
* platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/mac-wk1/TestExpectations:
* platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/wincairo-wk1/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@250944 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/http/tests/is-logged-in/unavailable-in-insecure-contexts.html b/LayoutTests/http/tests/is-logged-in/unavailable-in-insecure-contexts.html
new file mode 100644
index 0000000..64158d2
--- /dev/null
+++ b/LayoutTests/http/tests/is-logged-in/unavailable-in-insecure-contexts.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <script src="/js-test-resources/js-test.js"></script>
+</head>
+<body>
+<script>
+    description("Tests that IsLoggedIn is unavailable in insecure contexts.");
+
+    if (internals)
+        internals.markContextAsInsecure();
+
+    if (navigator.setLoggedIn === undefined)
+        testPassed("navigator.setLoggedIn is undefined on a page with protocol " + document.location.protocol);
+    else
+        testFailed("navigator.setLoggedIn is defined and is of type " + typeof navigator.setLoggedIn + " on a page with protocol " + document.location.protocol);
+</script>
+</body>
+</html>