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/ChangeLog b/LayoutTests/ChangeLog
index 3a793a5..b3bc645 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,27 @@
+2019-10-09  John Wilander  <wilander@apple.com>
+
+        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
+
+        * 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:
+
 2019-10-09  Zalan Bujtas  <zalan@apple.com>
 
         [iOS] LayoutTest fast/events/touch/ios/double-tap-for-double-click2.html is timing out
diff --git a/LayoutTests/http/tests/is-logged-in/available-in-secure-contexts.https-expected.txt b/LayoutTests/http/tests/is-logged-in/available-in-secure-contexts.https-expected.txt
new file mode 100644
index 0000000..79f1470
--- /dev/null
+++ b/LayoutTests/http/tests/is-logged-in/available-in-secure-contexts.https-expected.txt
@@ -0,0 +1,10 @@
+Tests that IsLoggedIn is available in secure contexts.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS navigator.setLoggedIn is defined as a function on a page with protocol https:
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/is-logged-in/available-in-secure-contexts.https.html b/LayoutTests/http/tests/is-logged-in/available-in-secure-contexts.https.html
new file mode 100644
index 0000000..30c226c
--- /dev/null
+++ b/LayoutTests/http/tests/is-logged-in/available-in-secure-contexts.https.html
@@ -0,0 +1,16 @@
+<!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 available in secure contexts.");
+    if (navigator.setLoggedIn !== undefined && typeof navigator.setLoggedIn === "function")
+        testPassed("navigator.setLoggedIn is defined as a function on a page with protocol " + document.location.protocol);
+    else
+        testFailed("navigator.setLoggedIn is undefined or not of type function on a page with protocol " + document.location.protocol);
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/is-logged-in/unavailable-in-insecure-contexts-expected.txt b/LayoutTests/http/tests/is-logged-in/unavailable-in-insecure-contexts-expected.txt
new file mode 100644
index 0000000..bd6378c
--- /dev/null
+++ b/LayoutTests/http/tests/is-logged-in/unavailable-in-insecure-contexts-expected.txt
@@ -0,0 +1,10 @@
+Tests that IsLoggedIn is unavailable in insecure contexts.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS navigator.setLoggedIn is undefined on a page with protocol http:
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
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>
diff --git a/LayoutTests/platform/ios-device-wk1/TestExpectations b/LayoutTests/platform/ios-device-wk1/TestExpectations
index fd0ea63..0694e61 100644
--- a/LayoutTests/platform/ios-device-wk1/TestExpectations
+++ b/LayoutTests/platform/ios-device-wk1/TestExpectations
@@ -4,3 +4,6 @@
 #
 
 webkit.org/b/196286 fast/events/touch/ios/content-observation/remove-subframe-while-observing.html [ Failure ]
+
+# Skip IsLoggedIn
+http/tests/is-logged-in/ [ Skip ]
\ No newline at end of file
diff --git a/LayoutTests/platform/ios-simulator-wk1/TestExpectations b/LayoutTests/platform/ios-simulator-wk1/TestExpectations
index 58110fc..e0c6b06 100644
--- a/LayoutTests/platform/ios-simulator-wk1/TestExpectations
+++ b/LayoutTests/platform/ios-simulator-wk1/TestExpectations
@@ -15,4 +15,7 @@
 editing/pasteboard/data-transfer-item-list-add-file-multiple-times.html [ Pass ]
 editing/pasteboard/data-transfer-items-add-custom-data.html [ Pass ]
 
-webkit.org/b/196286 fast/events/touch/ios/content-observation/remove-subframe-while-observing.html [ Failure ]
\ No newline at end of file
+webkit.org/b/196286 fast/events/touch/ios/content-observation/remove-subframe-while-observing.html [ Failure ]
+
+# Skip IsLoggedIn
+http/tests/is-logged-in/ [ Skip ]
diff --git a/LayoutTests/platform/ios-wk1/TestExpectations b/LayoutTests/platform/ios-wk1/TestExpectations
index 06ed74a..6f5ac1f 100644
--- a/LayoutTests/platform/ios-wk1/TestExpectations
+++ b/LayoutTests/platform/ios-wk1/TestExpectations
@@ -2002,3 +2002,6 @@
 inspector/canvas/recording-html-2d.html
 
 webkit.org/b/159724 [ Debug ] imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm [ Skip ]
+
+# Skip IsLoggedIn
+http/tests/is-logged-in/ [ Skip ]
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt b/LayoutTests/platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt
index 285b1e7..f7e3b16 100644
--- a/LayoutTests/platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt
+++ b/LayoutTests/platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: Unhandled Promise Rejection: undefined
 CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
 This tests that the navigator object of a deleted frame is disconnected properly. Accessing fields or methods shouldn't crash the browser. 
  Check Navigator
@@ -8,6 +9,7 @@
 navigator.cookieEnabled is OK
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
+navigator.isLoggedIn() is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
@@ -21,6 +23,8 @@
 navigator.productSub is OK
 navigator.sendBeacon() threw err TypeError: Not enough arguments
 navigator.serviceWorker is OK
+navigator.setLoggedIn() is OK
+navigator.setLoggedOut() is OK
 navigator.share() is OK
 navigator.userAgent is OK
 navigator.vendor is OK
@@ -33,6 +37,7 @@
 navigator.cookieEnabled is OK
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
+navigator.isLoggedIn() is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
@@ -46,6 +51,8 @@
 navigator.productSub is OK
 navigator.sendBeacon() threw err TypeError: Not enough arguments
 navigator.serviceWorker is OK
+navigator.setLoggedIn() is OK
+navigator.setLoggedOut() is OK
 navigator.share() is OK
 navigator.userAgent is OK
 navigator.vendor is OK
diff --git a/LayoutTests/platform/mac-wk1/TestExpectations b/LayoutTests/platform/mac-wk1/TestExpectations
index 6914ddd..75ee166 100644
--- a/LayoutTests/platform/mac-wk1/TestExpectations
+++ b/LayoutTests/platform/mac-wk1/TestExpectations
@@ -797,3 +797,6 @@
 [ Mojave+ ] fast/images/animated-heics-verify.html [ Skip ]
 
 webkit.org/b/200002 [ Mojave+ Debug ] imported/blink/storage/indexeddb/blob-basics-metadata.html [ Timeout ]
+
+# Skip IsLoggedIn
+http/tests/is-logged-in/ [ Skip ]
diff --git a/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt b/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt
index 3412840..896ad85 100644
--- a/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt
+++ b/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt
@@ -1,4 +1,5 @@
 CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Not enough arguments
+CONSOLE MESSAGE: Unhandled Promise Rejection: undefined
 CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
 This tests that the navigator object of a deleted frame is disconnected properly. Accessing fields or methods shouldn't crash the browser. 
  Check Navigator
@@ -10,6 +11,7 @@
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
 navigator.gpu is OK
+navigator.isLoggedIn() is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
@@ -24,6 +26,8 @@
 navigator.requestMediaKeySystemAccess() is OK
 navigator.sendBeacon() threw err TypeError: Not enough arguments
 navigator.serviceWorker is OK
+navigator.setLoggedIn() is OK
+navigator.setLoggedOut() is OK
 navigator.share() is OK
 navigator.userAgent is OK
 navigator.vendor is OK
@@ -37,6 +41,7 @@
 navigator.credentials is OK
 navigator.getStorageUpdates() is OK
 navigator.gpu is OK
+navigator.isLoggedIn() is OK
 navigator.javaEnabled() is OK
 navigator.language is OK
 navigator.languages is OK
@@ -51,6 +56,8 @@
 navigator.requestMediaKeySystemAccess() is OK
 navigator.sendBeacon() threw err TypeError: Not enough arguments
 navigator.serviceWorker is OK
+navigator.setLoggedIn() is OK
+navigator.setLoggedOut() is OK
 navigator.share() is OK
 navigator.userAgent is OK
 navigator.vendor is OK
diff --git a/LayoutTests/platform/wincairo-wk1/TestExpectations b/LayoutTests/platform/wincairo-wk1/TestExpectations
index 915d763..cacf993 100644
--- a/LayoutTests/platform/wincairo-wk1/TestExpectations
+++ b/LayoutTests/platform/wincairo-wk1/TestExpectations
@@ -335,3 +335,6 @@
 # WinCairo wk1 doesn't support inspector tests.
 webkit.org/b/191498 http/tests/inspector/network/resource-security-certificate.html [ Skip ]
 webkit.org/b/191498 http/tests/inspector/network/getSerializedCertificate.html [ Skip ]
+
+# Skip IsLoggedIn
+http/tests/is-logged-in/ [ Skip ]
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 1282dfa..57edd56 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,45 @@
+2019-10-09  John Wilander  <wilander@apple.com>
+
+        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
+
+        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:
+
 2019-10-09  Russell Epstein  <repstein@apple.com>
 
         Unreviewed, rolling out r250930.
diff --git a/Source/WebCore/DerivedSources-input.xcfilelist b/Source/WebCore/DerivedSources-input.xcfilelist
index f320855..8e84e68 100644
--- a/Source/WebCore/DerivedSources-input.xcfilelist
+++ b/Source/WebCore/DerivedSources-input.xcfilelist
@@ -885,6 +885,7 @@
 $(PROJECT_DIR)/page/Location.idl
 $(PROJECT_DIR)/page/Navigator.idl
 $(PROJECT_DIR)/page/NavigatorID.idl
+$(PROJECT_DIR)/page/NavigatorIsLoggedIn.idl
 $(PROJECT_DIR)/page/NavigatorLanguage.idl
 $(PROJECT_DIR)/page/NavigatorOnLine.idl
 $(PROJECT_DIR)/page/NavigatorServiceWorker.idl
diff --git a/Source/WebCore/DerivedSources-output.xcfilelist b/Source/WebCore/DerivedSources-output.xcfilelist
index 162d44d..951ddf3 100644
--- a/Source/WebCore/DerivedSources-output.xcfilelist
+++ b/Source/WebCore/DerivedSources-output.xcfilelist
@@ -1093,6 +1093,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorGeolocation.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorID.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorID.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorIsLoggedIn.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorIsLoggedIn.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorLanguage.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorLanguage.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigatorMaxTouchPoints.cpp
diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make
index 8e77e6d..f587cb32 100644
--- a/Source/WebCore/DerivedSources.make
+++ b/Source/WebCore/DerivedSources.make
@@ -879,6 +879,7 @@
     $(WebCore)/page/Location.idl \
     $(WebCore)/page/Navigator.idl \
     $(WebCore)/page/NavigatorID.idl \
+    $(WebCore)/page/NavigatorIsLoggedIn.idl \
     $(WebCore)/page/NavigatorLanguage.idl \
     $(WebCore)/page/NavigatorOnLine.idl \
     $(WebCore)/page/NavigatorServiceWorker.idl \
diff --git a/Source/WebCore/Headers.cmake b/Source/WebCore/Headers.cmake
index 5b2f53b..0d18608 100644
--- a/Source/WebCore/Headers.cmake
+++ b/Source/WebCore/Headers.cmake
@@ -791,6 +791,7 @@
     page/MediaCanStartListener.h
     page/MediaProducer.h
     page/MemoryRelease.h
+    page/NavigatorIsLoggedIn.h
     page/Page.h
     page/PageConfiguration.h
     page/PageConsoleClient.h
diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt
index f5eff73..766a790 100644
--- a/Source/WebCore/Sources.txt
+++ b/Source/WebCore/Sources.txt
@@ -1596,6 +1596,7 @@
 page/MouseEventWithHitTestResults.cpp
 page/Navigator.cpp
 page/NavigatorBase.cpp
+page/NavigatorIsLoggedIn.cpp
 page/OriginAccessEntry.cpp
 page/Page.cpp
 page/PageConfiguration.cpp
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index e373c81..538c967 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1973,6 +1973,7 @@
 		6B1F48112298A37E00DE8B82 /* CrossSiteNavigationDataTransfer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1F480F22989EC400DE8B82 /* CrossSiteNavigationDataTransfer.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6B3480940EEF50D400AC1B41 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3480920EEF50D400AC1B41 /* NativeImage.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6B4E8613221B713F0022F389 /* RegistrableDomain.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B4E8612221B713F0022F389 /* RegistrableDomain.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		6B507A24234BF34100BE7C62 /* NavigatorIsLoggedIn.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B507A21234BF34100BE7C62 /* NavigatorIsLoggedIn.h */; };
 		6B693A2E1C51A82E00B03BEF /* ResourceLoadObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B693A2D1C51A82E00B03BEF /* ResourceLoadObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6BDB5DC2227BD3B800919770 /* DocumentStorageAccess.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BDB5DC0227BD3B800919770 /* DocumentStorageAccess.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6C4C96DF1AD4483500363F64 /* JSReadableByteStreamController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C4C96DB1AD4483500363F64 /* JSReadableByteStreamController.h */; };
@@ -9112,6 +9113,9 @@
 		6B1F480F22989EC400DE8B82 /* CrossSiteNavigationDataTransfer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CrossSiteNavigationDataTransfer.h; sourceTree = "<group>"; };
 		6B3480920EEF50D400AC1B41 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; };
 		6B4E8612221B713F0022F389 /* RegistrableDomain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RegistrableDomain.h; sourceTree = "<group>"; };
+		6B507A21234BF34100BE7C62 /* NavigatorIsLoggedIn.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NavigatorIsLoggedIn.h; sourceTree = "<group>"; };
+		6B507A22234BF34100BE7C62 /* NavigatorIsLoggedIn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = NavigatorIsLoggedIn.cpp; sourceTree = "<group>"; };
+		6B507A23234BF34100BE7C62 /* NavigatorIsLoggedIn.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NavigatorIsLoggedIn.idl; sourceTree = "<group>"; };
 		6B693A2D1C51A82E00B03BEF /* ResourceLoadObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadObserver.h; sourceTree = "<group>"; };
 		6B693A331C51A95D00B03BEF /* ResourceLoadObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadObserver.cpp; sourceTree = "<group>"; };
 		6BDB5DC0227BD3B800919770 /* DocumentStorageAccess.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DocumentStorageAccess.h; sourceTree = "<group>"; };
@@ -20402,6 +20406,9 @@
 				E12719C90EEEC21300F61213 /* NavigatorBase.cpp */,
 				E12719C60EEEC16800F61213 /* NavigatorBase.h */,
 				7C5BEA3A1E9EE77100CC517B /* NavigatorID.idl */,
+				6B507A22234BF34100BE7C62 /* NavigatorIsLoggedIn.cpp */,
+				6B507A21234BF34100BE7C62 /* NavigatorIsLoggedIn.h */,
+				6B507A23234BF34100BE7C62 /* NavigatorIsLoggedIn.idl */,
 				7C5BEA3B1E9EE77100CC517B /* NavigatorLanguage.idl */,
 				7C5BEA3C1E9EE77100CC517B /* NavigatorOnLine.idl */,
 				5182C24B1F313AE00059BA7C /* NavigatorServiceWorker.idl */,
@@ -31068,6 +31075,7 @@
 				F440E77A233D94D70063F9AB /* NavigatorClipboard.h in Headers */,
 				372D3E57216578AE00C5E021 /* NavigatorCredentials.h in Headers */,
 				9711460414EF009A00674FD9 /* NavigatorGeolocation.h in Headers */,
+				6B507A24234BF34100BE7C62 /* NavigatorIsLoggedIn.h in Headers */,
 				5EA725D61ACABD5700EAD17B /* NavigatorMediaDevices.h in Headers */,
 				996E59DF1DF0128D006612B9 /* NavigatorWebDriver.h in Headers */,
 				8A309C9F123950BE00CB9204 /* NestingLevelIncrementer.h in Headers */,
diff --git a/Source/WebCore/page/NavigatorIsLoggedIn.cpp b/Source/WebCore/page/NavigatorIsLoggedIn.cpp
new file mode 100644
index 0000000..629dd7d
--- /dev/null
+++ b/Source/WebCore/page/NavigatorIsLoggedIn.cpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NavigatorIsLoggedIn.h"
+
+#include "JSDOMPromiseDeferred.h"
+#include "Navigator.h"
+
+namespace WebCore {
+
+NavigatorIsLoggedIn* NavigatorIsLoggedIn::from(Navigator& navigator)
+{
+    auto* supplement = static_cast<NavigatorIsLoggedIn*>(Supplement<Navigator>::from(&navigator, supplementName()));
+    if (!supplement) {
+        auto newSupplement = makeUnique<NavigatorIsLoggedIn>(navigator);
+        supplement = newSupplement.get();
+        provideTo(&navigator, supplementName(), WTFMove(newSupplement));
+    }
+    return supplement;
+}
+
+const char* NavigatorIsLoggedIn::supplementName()
+{
+    return "NavigatorIsLoggedIn";
+}
+
+void NavigatorIsLoggedIn::setLoggedIn(Navigator& navigator, Ref<DeferredPromise>&& promise)
+{
+    NavigatorIsLoggedIn::from(navigator)->setLoggedIn(WTFMove(promise));
+}
+
+void NavigatorIsLoggedIn::setLoggedOut(Navigator& navigator, Ref<DeferredPromise>&& promise)
+{
+    NavigatorIsLoggedIn::from(navigator)->setLoggedOut(WTFMove(promise));
+}
+
+void NavigatorIsLoggedIn::isLoggedIn(Navigator& navigator, Ref<DeferredPromise>&& promise)
+{
+    NavigatorIsLoggedIn::from(navigator)->isLoggedIn(WTFMove(promise));
+}
+
+void NavigatorIsLoggedIn::setLoggedIn(Ref<DeferredPromise>&& promise)
+{
+    if (m_navigator.cookieEnabled())
+        promise->resolve();
+    else
+        promise->reject();
+}
+
+void NavigatorIsLoggedIn::setLoggedOut(Ref<DeferredPromise>&& promise)
+{
+    promise->resolve();
+}
+
+void NavigatorIsLoggedIn::isLoggedIn(Ref<DeferredPromise>&& promise)
+{
+    if (m_navigator.cookieEnabled())
+        promise->resolve<IDLBoolean>(true);
+    else
+        promise->resolve<IDLBoolean>(false);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/page/NavigatorIsLoggedIn.h b/Source/WebCore/page/NavigatorIsLoggedIn.h
new file mode 100644
index 0000000..feb94f8
--- /dev/null
+++ b/Source/WebCore/page/NavigatorIsLoggedIn.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "Supplementable.h"
+
+namespace WebCore {
+
+class DeferredPromise;
+class Navigator;
+
+class NavigatorIsLoggedIn final : public Supplement<Navigator> {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit NavigatorIsLoggedIn(Navigator& navigator)
+        : m_navigator(navigator)
+    {
+    }
+    static void setLoggedIn(Navigator&, Ref<DeferredPromise>&&);
+    static void setLoggedOut(Navigator&, Ref<DeferredPromise>&&);
+    static void isLoggedIn(Navigator&, Ref<DeferredPromise>&&);
+
+private:    
+    void setLoggedIn(Ref<DeferredPromise>&&);
+    void setLoggedOut(Ref<DeferredPromise>&&);
+    void isLoggedIn(Ref<DeferredPromise>&&);
+    
+    static NavigatorIsLoggedIn* from(Navigator&);
+    static const char* supplementName();
+
+    Navigator& m_navigator;
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/page/NavigatorIsLoggedIn.idl b/Source/WebCore/page/NavigatorIsLoggedIn.idl
new file mode 100644
index 0000000..5ff8032
--- /dev/null
+++ b/Source/WebCore/page/NavigatorIsLoggedIn.idl
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    SecureContext,
+    Exposed=Window,
+    EnabledBySetting=IsLoggedInAPI
+] partial interface Navigator {
+    Promise<void> setLoggedIn();
+    Promise<void> setLoggedOut();
+    Promise<bool> isLoggedIn();
+};
diff --git a/Source/WebCore/page/PointerCaptureController.cpp b/Source/WebCore/page/PointerCaptureController.cpp
index 26a98df..fda80d5 100644
--- a/Source/WebCore/page/PointerCaptureController.cpp
+++ b/Source/WebCore/page/PointerCaptureController.cpp
@@ -32,6 +32,7 @@
 #include "EventHandler.h"
 #include "EventNames.h"
 #include "EventTarget.h"
+#include "HitTestResult.h"
 #include "Page.h"
 #include "PointerEvent.h"
 #include <wtf/CheckedArithmetic.h>
diff --git a/Source/WebCore/page/PointerCaptureController.h b/Source/WebCore/page/PointerCaptureController.h
index 2c9c76d..5780a9a 100644
--- a/Source/WebCore/page/PointerCaptureController.h
+++ b/Source/WebCore/page/PointerCaptureController.h
@@ -26,13 +26,18 @@
 
 #if ENABLE(POINTER_EVENTS)
 
+#include "ExceptionOr.h"
 #include "PointerID.h"
 #include <wtf/HashMap.h>
 
 namespace WebCore {
 
+class Document;
 class Element;
 class EventTarget;
+class IntPoint;
+class MouseEvent;
+class Page;
 class PointerEvent;
 
 class PointerCaptureController {
diff --git a/Source/WebCore/page/Settings.yaml b/Source/WebCore/page/Settings.yaml
index 87d1968..72fe8c0 100644
--- a/Source/WebCore/page/Settings.yaml
+++ b/Source/WebCore/page/Settings.yaml
@@ -870,6 +870,9 @@
 isITPSessionSwitchingEnabled:
   initial: true
 
+isLoggedInAPIEnabled:
+  initial: false
+
 # Deprecated
 
 iceCandidateFilteringEnabled:
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index cc30af5..1070230 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,17 @@
+2019-10-09  John Wilander  <wilander@apple.com>
+
+        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
+
+        * Shared/WebPreferences.yaml:
+
 2019-10-09  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebAuthn] Move the mock testing entrance to Internals
diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml
index 67f0184..edba9d2 100644
--- a/Source/WebKit/Shared/WebPreferences.yaml
+++ b/Source/WebKit/Shared/WebPreferences.yaml
@@ -1782,6 +1782,13 @@
   webcoreBinding: RuntimeEnabledFeatures
   category: internal
 
+IsLoggedInAPIEnabled:
+    type: bool
+    defaultValue: false
+    humanReadableName: "IsLoggedIn web API"
+    humanReadableDescription: "Enable the proposed IsLoggedIn web API"
+    category: experimental
+
 # Deprecated
 
 ICECandidateFilteringEnabled: