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