Title: [218196] trunk
Revision
218196
Author
dba...@webkit.org
Date
2017-06-13 13:21:00 -0700 (Tue, 13 Jun 2017)

Log Message

Implement W3C Secure Contexts Draft Specification
https://bugs.webkit.org/show_bug.cgi?id=158121
<rdar://problem/26012994>

Reviewed by Brent Fulgham.

Part 4

Source/_javascript_Core:

Adds isSecureContext to the list of common identifiers as needed to support
toggling its exposure from a runtime enabled feature flag.

* runtime/CommonIdentifiers.h:

Source/WebCore:

Adds runtime enabled feature flag, isSecureContextAttributeEnabled, to toggle exposing
the global object property isSecureContext (defaults: true - expose the property).

Test: security/isSecureContext-disabled.html

* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setIsSecureContextAttributeEnabled):
(WebCore::RuntimeEnabledFeatures::isSecureContextAttributeEnabled):
* page/WindowOrWorkerGlobalScope.idl:

Source/WebKit/mac:

Adds a preference to toggle the runtime enabled feature flag isSecureContextAttributeEnabled.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences isSecureContextAttributeEnabled]):
(-[WebPreferences setIsSecureContextAttributeEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit/win:

Adds a preference to toggle the runtime enabled feature flag isSecureContextAttributeEnabled.

* Interfaces/IWebPreferencesPrivate.idl: Bump the version.
* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings):
(WebPreferences::QueryInterface):
(WebPreferences::setIsSecureContextAttributeEnabled):
(WebPreferences::isSecureContextAttributeEnabled):
* WebPreferences.h:
* WebView.cpp:
(WebView::notifyPreferencesChanged):

Source/WebKit2:

Adds a preference to toggle the runtime enabled feature flag isSecureContextAttributeEnabled.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetIsSecureContextAttributeEnabled):
(WKPreferencesGetIsSecureContextAttributeEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

Expose the isSecureContext attribute by default in DumpRenderTree and WebKitTestRunner.
Teach DumpRenderTree for Mac and WebKitTestRunner to parse the test option enableIsSecureContextAttribute
to toggle the runtime enabled feature flag isSecureContextAttributeEnabled.

* DumpRenderTree/TestOptions.h:
* DumpRenderTree/TestOptions.mm:
(TestOptions::TestOptions):
* DumpRenderTree/mac/DumpRenderTree.mm:
(setWebPreferencesForTestOptions):
* DumpRenderTree/win/DumpRenderTree.cpp:
(enableExperimentalFeatures):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::hasSameInitializationOptions):

LayoutTests:

Adds a test to ensure that the global object property isSecureContext is not
exposed (is undefined) when the runtime enabled feature flag isSecureContextAttributeEnabled
is disabled.

* platform/win/TestExpectations: Skip the test as DumpRenderTree on Windows does not support
parsing of test options. See <https://bugs.webkit.org/show_bug.cgi?id=173281> for more details.
* security/isSecureContext-disabled-expected.txt: Added.
* security/isSecureContext-disabled.html: Added.
* security/resources/worker-isSecureContext-disabled.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (218195 => 218196)


--- trunk/LayoutTests/ChangeLog	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/LayoutTests/ChangeLog	2017-06-13 20:21:00 UTC (rev 218196)
@@ -1,3 +1,23 @@
+2017-06-13  Daniel Bates  <daba...@apple.com>
+
+        Implement W3C Secure Contexts Draft Specification
+        https://bugs.webkit.org/show_bug.cgi?id=158121
+        <rdar://problem/26012994>
+
+        Reviewed by Brent Fulgham.
+
+        Part 4
+
+        Adds a test to ensure that the global object property isSecureContext is not
+        exposed (is undefined) when the runtime enabled feature flag isSecureContextAttributeEnabled
+        is disabled.
+
+        * platform/win/TestExpectations: Skip the test as DumpRenderTree on Windows does not support
+        parsing of test options. See <https://bugs.webkit.org/show_bug.cgi?id=173281> for more details.
+        * security/isSecureContext-disabled-expected.txt: Added.
+        * security/isSecureContext-disabled.html: Added.
+        * security/resources/worker-isSecureContext-disabled.js: Added.
+
 2017-06-13  Youenn Fablet  <you...@apple.com>
 
         getReceivers() should return transceivers that have only an active receiver

Modified: trunk/LayoutTests/platform/win/TestExpectations (218195 => 218196)


--- trunk/LayoutTests/platform/win/TestExpectations	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/LayoutTests/platform/win/TestExpectations	2017-06-13 20:21:00 UTC (rev 218196)
@@ -84,6 +84,10 @@
 ################################################################################
 ##############    Missing Functionality Prevents Testing        ################
 ################################################################################
+
+# FIXME: Implement test options parsing (<!-- webkit-test-runner [ ... ] -->).
+webkit.org/b/173281 security/isSecureContext-disabled.html [ Skip ]
+
 # TODO HW filters not yet supported on Windows
 webkit.org/b/74716 css3/filters/effect-blur-hw.html [ Skip ]
 webkit.org/b/74716 css3/filters/effect-combined-hw.html [ Skip ]

Added: trunk/LayoutTests/security/isSecureContext-disabled-expected.txt (0 => 218196)


--- trunk/LayoutTests/security/isSecureContext-disabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/security/isSecureContext-disabled-expected.txt	2017-06-13 20:21:00 UTC (rev 218196)
@@ -0,0 +1,12 @@
+Tests that global property isSecureContexts is undefined when the Setting isSecureContextAttributeEnabled is disabled.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.isSecureContext is undefined.
+Starting worker: resources/worker-isSecureContext-disabled.js
+PASS [Worker] self.isSecureContext is undefined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/security/isSecureContext-disabled.html (0 => 218196)


--- trunk/LayoutTests/security/isSecureContext-disabled.html	                        (rev 0)
+++ trunk/LayoutTests/security/isSecureContext-disabled.html	2017-06-13 20:21:00 UTC (rev 218196)
@@ -0,0 +1,16 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableIsSecureContextAttribute=false ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+window.jsTestIsAsync = true;
+
+description("Tests that global property isSecureContexts is undefined when the Setting isSecureContextAttributeEnabled is disabled.");
+
+shouldBeUndefined("window.isSecureContext");
+startWorker("resources/worker-isSecureContext-disabled.js");
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/security/resources/worker-isSecureContext-disabled.js (0 => 218196)


--- trunk/LayoutTests/security/resources/worker-isSecureContext-disabled.js	                        (rev 0)
+++ trunk/LayoutTests/security/resources/worker-isSecureContext-disabled.js	2017-06-13 20:21:00 UTC (rev 218196)
@@ -0,0 +1,7 @@
+importScripts("../../resources/js-test.js");
+
+if (typeof(self.isSecureContext) === 'undefined')
+    testPassed("self.isSecureContext is undefined.");
+else
+    testFailed("self.isSecureContext is defined.");
+finishJSTest();

Modified: trunk/Source/_javascript_Core/ChangeLog (218195 => 218196)


--- trunk/Source/_javascript_Core/ChangeLog	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-06-13 20:21:00 UTC (rev 218196)
@@ -1,3 +1,18 @@
+2017-06-13  Daniel Bates  <daba...@apple.com>
+
+        Implement W3C Secure Contexts Draft Specification
+        https://bugs.webkit.org/show_bug.cgi?id=158121
+        <rdar://problem/26012994>
+
+        Reviewed by Brent Fulgham.
+
+        Part 4
+
+        Adds isSecureContext to the list of common identifiers as needed to support
+        toggling its exposure from a runtime enabled feature flag.
+
+        * runtime/CommonIdentifiers.h:
+
 2017-06-13  Don Olmstead  <don.olmst...@sony.com>
 
         [JSC] Remove redundant includes in config.h

Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (218195 => 218196)


--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2017-06-13 20:21:00 UTC (rev 218196)
@@ -241,6 +241,7 @@
     macro(isArray) \
     macro(isEnabled) \
     macro(isPrototypeOf) \
+    macro(isSecureContext) \
     macro(isView) \
     macro(isWatchpoint) \
     macro(jettisonReason) \

Modified: trunk/Source/WebCore/ChangeLog (218195 => 218196)


--- trunk/Source/WebCore/ChangeLog	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebCore/ChangeLog	2017-06-13 20:21:00 UTC (rev 218196)
@@ -1,3 +1,23 @@
+2017-06-13  Daniel Bates  <daba...@apple.com>
+
+        Implement W3C Secure Contexts Draft Specification
+        https://bugs.webkit.org/show_bug.cgi?id=158121
+        <rdar://problem/26012994>
+
+        Reviewed by Brent Fulgham.
+
+        Part 4
+
+        Adds runtime enabled feature flag, isSecureContextAttributeEnabled, to toggle exposing
+        the global object property isSecureContext (defaults: true - expose the property).
+
+        Test: security/isSecureContext-disabled.html
+
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setIsSecureContextAttributeEnabled):
+        (WebCore::RuntimeEnabledFeatures::isSecureContextAttributeEnabled):
+        * page/WindowOrWorkerGlobalScope.idl:
+
 2017-06-13  Jer Noble  <jer.no...@apple.com>
 
         Protect lifetime of media element during HTMLMediaElement::notifyAboutPlaying()

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (218195 => 218196)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2017-06-13 20:21:00 UTC (rev 218196)
@@ -78,6 +78,9 @@
     void setCredentialManagementEnabled(bool isEnabled) { m_isCredentialManagementEnabled = isEnabled; }
     bool credentialManagementEnabled() const { return m_isCredentialManagementEnabled; }
 
+    void setIsSecureContextAttributeEnabled(bool isEnabled) { m_isSecureContextAttributeEnabled = isEnabled; }
+    bool isSecureContextAttributeEnabled() const { return m_isSecureContextAttributeEnabled; }
+
 #if ENABLE(INDEXED_DATABASE_IN_WORKERS)
     void setIndexedDBWorkersEnabled(bool isEnabled) { m_isIndexedDBWorkersEnabled = isEnabled; }
     bool indexedDBWorkersEnabled() const { return m_isIndexedDBWorkersEnabled; }
@@ -209,6 +212,7 @@
     bool m_isUserTimingEnabled { false };
     bool m_isInteractiveFormValidationEnabled { false };
     bool m_isCredentialManagementEnabled { false };
+    bool m_isSecureContextAttributeEnabled { false };
 
     bool m_isDisplayContentsEnabled { false };
     bool m_isShadowDOMEnabled { true };

Modified: trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl (218195 => 218196)


--- trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl	2017-06-13 20:21:00 UTC (rev 218196)
@@ -41,5 +41,5 @@
     [MayThrowException] DOMString btoa(DOMString string);
 
     // Secure Contexts
-    readonly attribute boolean isSecureContext;
+    [EnabledAtRuntime=IsSecureContextAttribute] readonly attribute boolean isSecureContext;
 };

Modified: trunk/Source/WebKit/mac/ChangeLog (218195 => 218196)


--- trunk/Source/WebKit/mac/ChangeLog	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-06-13 20:21:00 UTC (rev 218196)
@@ -1,3 +1,24 @@
+2017-06-13  Daniel Bates  <daba...@apple.com>
+
+        Implement W3C Secure Contexts Draft Specification
+        https://bugs.webkit.org/show_bug.cgi?id=158121
+        <rdar://problem/26012994>
+
+        Reviewed by Brent Fulgham.
+
+        Part 4
+
+        Adds a preference to toggle the runtime enabled feature flag isSecureContextAttributeEnabled.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences isSecureContextAttributeEnabled]):
+        (-[WebPreferences setIsSecureContextAttributeEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2017-06-13  Sam Weinig  <s...@webkit.org>
 
         Rename JSDOMWindowShell to JSDOMWindowProxy to match the HTML5 spec.

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (218195 => 218196)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2017-06-13 20:21:00 UTC (rev 218196)
@@ -185,6 +185,7 @@
 #define WebKitMediaPreloadingEnabledPreferenceKey @"WebKitMediaPreloadingEnabled"
 #define WebKitCredentialManagementEnabledPreferenceKey @"WebKitCredentialManagementEnabled"
 #define WebKitMediaUserGestureInheritsFromDocument @"WebKitMediaUserGestureInheritsFromDocument"
+#define WebKitIsSecureContextAttributeEnabledPreferenceKey @"WebKitIsSecureContextAttributeEnabled"
 
 #if !TARGET_OS_IPHONE
 // These are private both because callers should be using the cover methods and because the

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (218195 => 218196)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2017-06-13 20:21:00 UTC (rev 218196)
@@ -668,6 +668,7 @@
         @NO, WebKitResourceTimingEnabledPreferenceKey,
         @NO, WebKitCredentialManagementEnabledPreferenceKey,
         @NO, WebKitMediaUserGestureInheritsFromDocument,
+        @NO, WebKitIsSecureContextAttributeEnabledPreferenceKey,
         (NSString *)Settings::defaultMediaContentTypesRequiringHardwareSupport(), WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
         nil];
 
@@ -3103,6 +3104,17 @@
 {
     [self _setStringValue:value forKey:WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey];
 }
+
+- (BOOL)isSecureContextAttributeEnabled
+{
+    return [self _boolValueForKey:WebKitIsSecureContextAttributeEnabledPreferenceKey];
+}
+
+- (void)setIsSecureContextAttributeEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitIsSecureContextAttributeEnabledPreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)

Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (218195 => 218196)


--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2017-06-13 20:21:00 UTC (rev 218196)
@@ -547,6 +547,9 @@
 - (void)setCredentialManagementEnabled:(BOOL)flag;
 - (BOOL)credentialManagementEnabled;
 
+- (void)setIsSecureContextAttributeEnabled:(BOOL)flag;
+- (BOOL)isSecureContextAttributeEnabled;
+
 @property (nonatomic) BOOL visualViewportEnabled;
 @property (nonatomic) BOOL largeImageAsyncDecodingEnabled;
 @property (nonatomic) BOOL animatedImageAsyncDecodingEnabled;
@@ -561,6 +564,7 @@
 @property (nonatomic) BOOL linkPreloadEnabled;
 @property (nonatomic) BOOL credentialManagementEnabled;
 @property (nonatomic) BOOL mediaUserGestureInheritsFromDocument;
+@property (nonatomic) BOOL isSecureContextAttributeEnabled;
 
 #if TARGET_OS_IPHONE
 @property (nonatomic) BOOL quickLookDocumentSavingEnabled;

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (218195 => 218196)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2017-06-13 20:21:00 UTC (rev 218196)
@@ -3057,6 +3057,7 @@
     RuntimeEnabledFeatures::sharedFeatures().setLinkPreloadEnabled(preferences.linkPreloadEnabled);
     RuntimeEnabledFeatures::sharedFeatures().setMediaPreloadingEnabled(preferences.mediaPreloadingEnabled);
     RuntimeEnabledFeatures::sharedFeatures().setCredentialManagementEnabled(preferences.credentialManagementEnabled);
+    RuntimeEnabledFeatures::sharedFeatures().setIsSecureContextAttributeEnabled(preferences.isSecureContextAttributeEnabled);
 
     NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds];
     if (timeout > 0)

Modified: trunk/Source/WebKit/win/ChangeLog (218195 => 218196)


--- trunk/Source/WebKit/win/ChangeLog	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit/win/ChangeLog	2017-06-13 20:21:00 UTC (rev 218196)
@@ -1,3 +1,26 @@
+2017-06-13  Daniel Bates  <daba...@apple.com>
+
+        Implement W3C Secure Contexts Draft Specification
+        https://bugs.webkit.org/show_bug.cgi?id=158121
+        <rdar://problem/26012994>
+
+        Reviewed by Brent Fulgham.
+
+        Part 4
+
+        Adds a preference to toggle the runtime enabled feature flag isSecureContextAttributeEnabled.
+
+        * Interfaces/IWebPreferencesPrivate.idl: Bump the version.
+        * WebPreferenceKeysPrivate.h:
+        * WebPreferences.cpp:
+        (WebPreferences::initializeDefaultSettings):
+        (WebPreferences::QueryInterface):
+        (WebPreferences::setIsSecureContextAttributeEnabled):
+        (WebPreferences::isSecureContextAttributeEnabled):
+        * WebPreferences.h:
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+
 2017-06-13  Per Arne Vollan  <pvol...@apple.com>
 
         [Win] WebKit fails to paint the bottom lines of the window at 125% scale.

Modified: trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl (218195 => 218196)


--- trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl	2017-06-13 20:21:00 UTC (rev 218196)
@@ -202,3 +202,10 @@
     HRESULT clearNetworkLoaderSession();
     HRESULT switchNetworkLoaderToNewTestingSession();
 }
+
+[uuid(9C4CBF53-19BC-46B3-831E-6A8B88200F20)]
+interface IWebPreferencesPrivate5 : IWebPreferencesPrivate4
+{
+    HRESULT isSecureContextAttributeEnabled([out, retval] BOOL*);
+    HRESULT setIsSecureContextAttributeEnabled([in] BOOL enabled);
+}

Modified: trunk/Source/WebKit/win/WebPreferenceKeysPrivate.h (218195 => 218196)


--- trunk/Source/WebKit/win/WebPreferenceKeysPrivate.h	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit/win/WebPreferenceKeysPrivate.h	2017-06-13 20:21:00 UTC (rev 218196)
@@ -185,3 +185,5 @@
 #define WebKitLinkPreloadEnabledPreferenceKey "WebKitLinkPreloadEnabled"
 
 #define WebKitMediaPreloadingEnabledPreferenceKey "WebKitMediaPreloadingEnabled"
+
+#define WebKitIsSecureContextAttributeEnabledPreferenceKey "WebKitIsSecureContextAttributeEnabled"

Modified: trunk/Source/WebKit/win/WebPreferences.cpp (218195 => 218196)


--- trunk/Source/WebKit/win/WebPreferences.cpp	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit/win/WebPreferences.cpp	2017-06-13 20:21:00 UTC (rev 218196)
@@ -316,6 +316,8 @@
 
     CFDictionaryAddValue(defaults, CFSTR(WebKitMediaPreloadingEnabledPreferenceKey), kCFBooleanFalse);
 
+    CFDictionaryAddValue(defaults, CFSTR(WebKitIsSecureContextAttributeEnabledPreferenceKey), kCFBooleanFalse);
+
     defaultSettings = defaults;
 }
 
@@ -561,6 +563,8 @@
         *ppvObject = static_cast<IWebPreferencesPrivate3*>(this);
     else if (IsEqualGUID(riid, IID_IWebPreferencesPrivate4))
         *ppvObject = static_cast<IWebPreferencesPrivate4*>(this);
+    else if (IsEqualGUID(riid, IID_IWebPreferencesPrivate5))
+        *ppvObject = static_cast<IWebPreferencesPrivate5*>(this);
     else if (IsEqualGUID(riid, CLSID_WebPreferences))
         *ppvObject = this;
     else
@@ -2041,6 +2045,20 @@
     return S_OK;
 }
 
+HRESULT WebPreferences::setIsSecureContextAttributeEnabled(BOOL enabled)
+{
+    setBoolValue(WebKitIsSecureContextAttributeEnabledPreferenceKey, enabled);
+    return S_OK;
+}
+
+HRESULT WebPreferences::isSecureContextAttributeEnabled(_Out_ BOOL* enabled)
+{
+    if (!enabled)
+        return E_POINTER;
+    *enabled = boolValueForKey(WebKitIsSecureContextAttributeEnabledPreferenceKey);
+    return S_OK;
+}
+
 HRESULT WebPreferences::setApplicationId(BSTR applicationId)
 {
     m_applicationId = String(applicationId).createCFString();

Modified: trunk/Source/WebKit/win/WebPreferences.h (218195 => 218196)


--- trunk/Source/WebKit/win/WebPreferences.h	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit/win/WebPreferences.h	2017-06-13 20:21:00 UTC (rev 218196)
@@ -30,7 +30,7 @@
 #include <WebCore/BString.h>
 #include <wtf/RetainPtr.h>
 
-class WebPreferences : public IWebPreferences, public IWebPreferencesPrivate4 {
+class WebPreferences : public IWebPreferences, public IWebPreferencesPrivate5 {
 public:
     static WebPreferences* createInstance();
 protected:
@@ -256,6 +256,10 @@
     virtual HRESULT STDMETHODCALLTYPE clearNetworkLoaderSession();
     virtual HRESULT STDMETHODCALLTYPE switchNetworkLoaderToNewTestingSession();
 
+    // IWebPreferencesPrivate5
+    virtual HRESULT STDMETHODCALLTYPE isSecureContextAttributeEnabled(_Out_ BOOL*);
+    virtual HRESULT STDMETHODCALLTYPE setIsSecureContextAttributeEnabled(BOOL);
+
     // WebPreferences
 
     // This method accesses a different preference key than developerExtrasEnabled.

Modified: trunk/Source/WebKit/win/WebView.cpp (218195 => 218196)


--- trunk/Source/WebKit/win/WebView.cpp	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit/win/WebView.cpp	2017-06-13 20:21:00 UTC (rev 218196)
@@ -5190,7 +5190,7 @@
     settings.setShouldDisplayTextDescriptions(enabled);
 #endif
 
-    COMPtr<IWebPreferencesPrivate4> prefsPrivate(Query, preferences);
+    COMPtr<IWebPreferencesPrivate5> prefsPrivate { Query, preferences };
     if (prefsPrivate) {
         hr = prefsPrivate->localStorageDatabasePath(&str);
         if (FAILED(hr))
@@ -5286,6 +5286,11 @@
         return hr;
     RuntimeEnabledFeatures::sharedFeatures().setMediaPreloadingEnabled(!!enabled);
 
+    hr = prefsPrivate->isSecureContextAttributeEnabled(&enabled);
+    if (FAILED(hr))
+        return hr;
+    RuntimeEnabledFeatures::sharedFeatures().setIsSecureContextAttributeEnabled(!!enabled);
+
     hr = preferences->privateBrowsingEnabled(&enabled);
     if (FAILED(hr))
         return hr;

Modified: trunk/Source/WebKit2/ChangeLog (218195 => 218196)


--- trunk/Source/WebKit2/ChangeLog	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit2/ChangeLog	2017-06-13 20:21:00 UTC (rev 218196)
@@ -1,3 +1,25 @@
+2017-06-13  Daniel Bates  <daba...@apple.com>
+
+        Implement W3C Secure Contexts Draft Specification
+        https://bugs.webkit.org/show_bug.cgi?id=158121
+        <rdar://problem/26012994>
+
+        Reviewed by Brent Fulgham.
+
+        Part 4
+
+        Adds a preference to toggle the runtime enabled feature flag isSecureContextAttributeEnabled.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetIsSecureContextAttributeEnabled):
+        (WKPreferencesGetIsSecureContextAttributeEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2017-06-13  Brent Fulgham  <bfulg...@apple.com>
 
         [WK2][macOS] Allow AppleEvents in Citrix View Plugin

Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (218195 => 218196)


--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2017-06-13 20:21:00 UTC (rev 218196)
@@ -355,6 +355,7 @@
     macro(ConstantPropertiesEnabled, constantPropertiesEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "Constant Properties", "Enable CSS constant() properties") \
     macro(DisplayContentsEnabled, displayContentsEnabled, Bool, bool, false, "CSS display: contents", "Enable CSS display: contents support") \
     macro(SpringTimingFunctionEnabled, springTimingFunctionEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "CSS Spring Animations", "CSS Spring Animation prototype") \
+    macro(IsSecureContextAttributeEnabled, isSecureContextAttributeEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "isSecureContext attribute", "Enable isSecureContext attribute") \
     macro(LinkPreloadEnabled, linkPreloadEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "Link Preload", "Link preload support") \
     macro(WebRTCLegacyAPIDisabled, webRTCLegacyAPIDisabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "Remove Legacy WebRTC API", "Remove Legacy WebRTC API") \
     macro(SubresourceIntegrityEnabled, subresourceIntegrityEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "SubresourceIntegrity", "Enable SubresourceIntegrity") \

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (218195 => 218196)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2017-06-13 20:21:00 UTC (rev 218196)
@@ -1781,3 +1781,12 @@
     return toCopiedAPI(toImpl(preferencesRef)->mediaContentTypesRequiringHardwareSupport());
 }
 
+void WKPreferencesSetIsSecureContextAttributeEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setIsSecureContextAttributeEnabled(flag);
+}
+
+bool WKPreferencesGetIsSecureContextAttributeEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->isSecureContextAttributeEnabled();
+}

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h (218195 => 218196)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h	2017-06-13 20:21:00 UTC (rev 218196)
@@ -501,6 +501,10 @@
 WK_EXPORT void WKPreferencesSetMediaContentTypesRequiringHardwareSupport(WKPreferencesRef, WKStringRef);
 WK_EXPORT WKStringRef WKPreferencesCopyMediaContentTypesRequiringHardwareSupport(WKPreferencesRef);
 
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetIsSecureContextAttributeEnabled(WKPreferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetIsSecureContextAttributeEnabled(WKPreferencesRef);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (218195 => 218196)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2017-06-13 20:21:00 UTC (rev 218196)
@@ -224,6 +224,11 @@
         RuntimeEnabledFeatures::sharedFeatures().setWebRTCLegacyAPIEnabled(enabled);
 #endif
 
+    if (preference == "WebKitIsSecureContextAttributeEnabled") {
+        WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::isSecureContextAttributeEnabledKey(), enabled);
+        RuntimeEnabledFeatures::sharedFeatures().setIsSecureContextAttributeEnabled(enabled);
+    }
+
     // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore.
 #define FOR_EACH_OVERRIDE_BOOL_PREFERENCE(macro) \
     macro(WebKitAcceleratedCompositingEnabled, AcceleratedCompositingEnabled, acceleratedCompositingEnabled) \

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (218195 => 218196)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-06-13 20:21:00 UTC (rev 218196)
@@ -3364,6 +3364,7 @@
     RuntimeEnabledFeatures::sharedFeatures().setLinkPreloadEnabled(store.getBoolValueForKey(WebPreferencesKey::linkPreloadEnabledKey()));
     RuntimeEnabledFeatures::sharedFeatures().setMediaPreloadingEnabled(store.getBoolValueForKey(WebPreferencesKey::mediaPreloadingEnabledKey()));
     RuntimeEnabledFeatures::sharedFeatures().setCredentialManagementEnabled(store.getBoolValueForKey(WebPreferencesKey::credentialManagementEnabledKey()));
+    RuntimeEnabledFeatures::sharedFeatures().setIsSecureContextAttributeEnabled(store.getBoolValueForKey(WebPreferencesKey::isSecureContextAttributeEnabledKey()));
 
     bool processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());
     if (m_processSuppressionEnabled != processSuppressionEnabled) {

Modified: trunk/Tools/ChangeLog (218195 => 218196)


--- trunk/Tools/ChangeLog	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Tools/ChangeLog	2017-06-13 20:21:00 UTC (rev 218196)
@@ -1,3 +1,30 @@
+2017-06-13  Daniel Bates  <daba...@apple.com>
+
+        Implement W3C Secure Contexts Draft Specification
+        https://bugs.webkit.org/show_bug.cgi?id=158121
+        <rdar://problem/26012994>
+
+        Reviewed by Brent Fulgham.
+
+        Part 4
+
+        Expose the isSecureContext attribute by default in DumpRenderTree and WebKitTestRunner.
+        Teach DumpRenderTree for Mac and WebKitTestRunner to parse the test option enableIsSecureContextAttribute
+        to toggle the runtime enabled feature flag isSecureContextAttributeEnabled.
+
+        * DumpRenderTree/TestOptions.h:
+        * DumpRenderTree/TestOptions.mm:
+        (TestOptions::TestOptions):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (setWebPreferencesForTestOptions):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (enableExperimentalFeatures):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetPreferencesToConsistentValues):
+        (WTR::updateTestOptionsFromTestHeader):
+        * WebKitTestRunner/TestOptions.h:
+        (WTR::TestOptions::hasSameInitializationOptions):
+
 2017-06-13  Alex Christensen  <achristen...@webkit.org>
 
         Test persistent WKHTTPCookieStorages on iOS

Modified: trunk/Tools/DumpRenderTree/TestOptions.h (218195 => 218196)


--- trunk/Tools/DumpRenderTree/TestOptions.h	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Tools/DumpRenderTree/TestOptions.h	2017-06-13 20:21:00 UTC (rev 218196)
@@ -35,6 +35,7 @@
     bool enableCredentialManagement { false };
     bool enableDragDestinationActionLoad { false };
     bool layerBackedWebView { false };
+    bool enableIsSecureContextAttribute { true };
 
     TestOptions(NSURL*, const TestCommand&);
     bool webViewIsCompatibleWithOptions(const TestOptions&) const;

Modified: trunk/Tools/DumpRenderTree/TestOptions.mm (218195 => 218196)


--- trunk/Tools/DumpRenderTree/TestOptions.mm	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Tools/DumpRenderTree/TestOptions.mm	2017-06-13 20:21:00 UTC (rev 218196)
@@ -92,6 +92,8 @@
             this->enableDragDestinationActionLoad = parseBooleanTestHeaderValue(value);
         else if (key == "layerBackedWebView")
             this->layerBackedWebView = parseBooleanTestHeaderValue(value);
+        else if (key == "enableIsSecureContextAttribute")
+            this->enableIsSecureContextAttribute = parseBooleanTestHeaderValue(value);
         pairStart = pairEnd + 1;
     }
 }

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (218195 => 218196)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2017-06-13 20:21:00 UTC (rev 218196)
@@ -974,6 +974,7 @@
     preferences.intersectionObserverEnabled = options.enableIntersectionObserver;
     preferences.modernMediaControlsEnabled = options.enableModernMediaControls;
     preferences.credentialManagementEnabled = options.enableCredentialManagement;
+    preferences.isSecureContextAttributeEnabled = options.enableIsSecureContextAttribute;
 }
 
 // Called once on DumpRenderTree startup.

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (218195 => 218196)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2017-06-13 20:21:00 UTC (rev 218196)
@@ -768,19 +768,20 @@
 
 static void enableExperimentalFeatures(IWebPreferences* preferences)
 {
-    COMPtr<IWebPreferencesPrivate4> prefsPrivate4(Query, preferences);    
+    COMPtr<IWebPreferencesPrivate5> prefsPrivate { Query, preferences };
 
     // FIXME: CSSGridLayout
     // FIXME: SpringTimingFunction
     // FIXME: Gamepads
-    prefsPrivate4->setLinkPreloadEnabled(TRUE);
-    prefsPrivate4->setMediaPreloadingEnabled(TRUE);
+    prefsPrivate->setLinkPreloadEnabled(TRUE);
+    prefsPrivate->setMediaPreloadingEnabled(TRUE);
     // FIXME: ModernMediaControls
     // FIXME: InputEvents
     // FIXME: SubtleCrypto
-    prefsPrivate4->setWebAnimationsEnabled(TRUE);
+    prefsPrivate->setWebAnimationsEnabled(TRUE);
     // FIXME: WebGL2
     // FIXME: WebRTC
+    prefsPrivate->setIsSecureContextAttributeEnabled(TRUE);
 }
 
 static void resetWebPreferencesToConsistentValues(IWebPreferences* preferences)

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (218195 => 218196)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2017-06-13 20:21:00 UTC (rev 218196)
@@ -682,6 +682,7 @@
     WKPreferencesSetIntersectionObserverEnabled(preferences, options.enableIntersectionObserver);
     WKPreferencesSetModernMediaControlsEnabled(preferences, options.enableModernMediaControls);
     WKPreferencesSetCredentialManagementEnabled(preferences, options.enableCredentialManagement);
+    WKPreferencesSetIsSecureContextAttributeEnabled(preferences, options.enableIsSecureContextAttribute);
 
     static WKStringRef defaultTextEncoding = WKStringCreateWithUTF8CString("ISO-8859-1");
     WKPreferencesSetDefaultTextEncodingName(preferences, defaultTextEncoding);
@@ -1016,6 +1017,8 @@
             testOptions.enablePointerLock = parseBooleanTestHeaderValue(value);
         if (key == "enableCredentialManagement")
             testOptions.enableCredentialManagement = parseBooleanTestHeaderValue(value);
+        if (key == "enableIsSecureContextAttribute")
+            testOptions.enableIsSecureContextAttribute = parseBooleanTestHeaderValue(value);
         pairStart = pairEnd + 1;
     }
 }

Modified: trunk/Tools/WebKitTestRunner/TestOptions.h (218195 => 218196)


--- trunk/Tools/WebKitTestRunner/TestOptions.h	2017-06-13 20:12:29 UTC (rev 218195)
+++ trunk/Tools/WebKitTestRunner/TestOptions.h	2017-06-13 20:21:00 UTC (rev 218196)
@@ -47,6 +47,7 @@
     bool enableModernMediaControls { true };
     bool enablePointerLock { false };
     bool enableCredentialManagement { false };
+    bool enableIsSecureContextAttribute { true };
 
     float deviceScaleFactor { 1 };
     Vector<String> overrideLanguages;
@@ -67,7 +68,8 @@
             || enableIntersectionObserver != options.enableIntersectionObserver
             || enableModernMediaControls != options.enableModernMediaControls
             || enablePointerLock != options.enablePointerLock
-            || enableCredentialManagement != options.enableCredentialManagement)
+            || enableCredentialManagement != options.enableCredentialManagement
+            || enableIsSecureContextAttribute != options.enableIsSecureContextAttribute)
             return false;
 
         return true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to