Implement W3C Secure Contexts Draft Specification
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Jun 2017 23:38:05 +0000 (23:38 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Jun 2017 23:38:05 +0000 (23:38 +0000)
commit6265ef9ee1e4ac277f412a95bc027eac3058c8cd
tree31755dc464b0e8d144d4830df62812d9b4e790b1
parent7bf6058be39fecf415451abd453672778af59a4f
Implement W3C Secure Contexts Draft Specification
https://bugs.webkit.org/show_bug.cgi?id=158121
<rdar://problem/26012994>

Reviewed by Chris Dumez.

Part 1

Teach the bindings code generator to generate a runtime check for an interface, attribute or
function annotated with the extended attribute [SecureContext]. For now, the runtime check
(ScriptExecutionContext::isSecureContext()) always returns true. We will flesh out the
implementation of this runtime check in a subsequent commit.

* bindings/scripts/CodeGeneratorJS.pm:
(NeedsRuntimeCheck):
(GenerateRuntimeEnableConditionalString):
Generate a runtime check for an interface, attribute, or function that is annotated with
the extended attribute [SecureContext].

* bindings/scripts/IDLAttributes.json: Update JSON now that we support SecureContext.
* bindings/scripts/preprocess-idls.pl:
(GenerateConstructorAttributes): Add the SecureContext extended attribute to a constructor,
if applicable.

* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
(WebCore::JSTestGenerateIsReachablePrototype::finishCreation):
(WebCore::IDLAttribute<JSTestGenerateIsReachable>::cast):
(WebCore::jsTestGenerateIsReachableASecretAttributeGetter):
(WebCore::jsTestGenerateIsReachableASecretAttribute):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::JSTestGlobalObject::finishCreation):
(WebCore::jsTestGlobalObjectInstanceFunctionCalculateSecretResultBody):
(WebCore::jsTestGlobalObjectInstanceFunctionCalculateSecretResult):
(WebCore::jsTestGlobalObjectInstanceFunctionGetSecretBooleanBody):
(WebCore::jsTestGlobalObjectInstanceFunctionGetSecretBoolean):
(WebCore::jsTestGlobalObjectInstanceFunctionTestFeatureGetSecretBooleanBody):
(WebCore::jsTestGlobalObjectInstanceFunctionTestFeatureGetSecretBoolean):
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSTestNodePrototype::finishCreation):
(WebCore::jsTestNodePrototypeFunctionCalculateSecretResultBody):
(WebCore::jsTestNodePrototypeFunctionCalculateSecretResult):
(WebCore::jsTestNodePrototypeFunctionGetSecretBooleanBody):
(WebCore::jsTestNodePrototypeFunctionGetSecretBoolean):
(WebCore::jsTestNodePrototypeFunctionTestFeatureGetSecretBooleanBody):
(WebCore::jsTestNodePrototypeFunctionTestFeatureGetSecretBoolean):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjPrototype::finishCreation):
(WebCore::jsTestObjPrototypeFunctionCalculateSecretResultBody):
(WebCore::jsTestObjPrototypeFunctionCalculateSecretResult):
(WebCore::jsTestObjPrototypeFunctionGetSecretBooleanBody):
(WebCore::jsTestObjPrototypeFunctionGetSecretBoolean):
(WebCore::jsTestObjPrototypeFunctionTestFeatureGetSecretBooleanBody):
(WebCore::jsTestObjPrototypeFunctionTestFeatureGetSecretBoolean):
Update expected results.

* bindings/scripts/test/TestGenerateIsReachable.idl:
* bindings/scripts/test/TestGlobalObject.idl:
* bindings/scripts/test/TestNode.idl:
* bindings/scripts/test/TestObj.idl:
Add test cases.

* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::isSecureContext): Added. For now, always returns true.
We will implement this function in a subsequent commit.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@218027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/IDLAttributes.json
Source/WebCore/bindings/scripts/preprocess-idls.pl
Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/TestGenerateIsReachable.idl
Source/WebCore/bindings/scripts/test/TestGlobalObject.idl
Source/WebCore/bindings/scripts/test/TestNode.idl
Source/WebCore/bindings/scripts/test/TestObj.idl
Source/WebCore/dom/ScriptExecutionContext.h