Implement W3C Secure Contexts Draft Specification
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jun 2017 20:21:00 +0000 (20:21 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jun 2017 20:21:00 +0000 (20:21 +0000)
commit6ed35b998344894a2aec2a5b51c8b80cf6142dbd
treeef23a7d45fa29c9091a0aec9689adb44ea3aac36
parent4464650ef0bfdc766290f4ac391802d05679b0f6
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/JavaScriptCore:

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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/win/TestExpectations
LayoutTests/security/isSecureContext-disabled-expected.txt [new file with mode: 0644]
LayoutTests/security/isSecureContext-disabled.html [new file with mode: 0644]
LayoutTests/security/resources/worker-isSecureContext-disabled.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/WebCore/ChangeLog
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebCore/page/WindowOrWorkerGlobalScope.idl
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
Source/WebKit/win/WebPreferenceKeysPrivate.h
Source/WebKit/win/WebPreferences.cpp
Source/WebKit/win/WebPreferences.h
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/DumpRenderTree/TestOptions.h
Tools/DumpRenderTree/TestOptions.mm
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/win/DumpRenderTree.cpp
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestOptions.h