| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bindings/core/v8/ConditionalFeatures.h" | 5 #include "bindings/core/v8/ConditionalFeatures.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/V8Document.h" | 8 #include "bindings/core/v8/V8Document.h" |
| 9 #include "bindings/core/v8/V8HTMLLinkElement.h" | 9 #include "bindings/core/v8/V8HTMLLinkElement.h" |
| 10 #include "bindings/core/v8/V8Navigator.h" | 10 #include "bindings/core/v8/V8Navigator.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const DOMWrapperWorld& world = scriptState->world(); | 31 const DOMWrapperWorld& world = scriptState->world(); |
| 32 if (wrapperTypeInfo == &V8HTMLLinkElement::wrapperTypeInfo) { | 32 if (wrapperTypeInfo == &V8HTMLLinkElement::wrapperTypeInfo) { |
| 33 if (RuntimeEnabledFeatures::linkServiceWorkerEnabled() || | 33 if (RuntimeEnabledFeatures::linkServiceWorkerEnabled() || |
| 34 (originTrialContext && | 34 (originTrialContext && |
| 35 originTrialContext->isTrialEnabled("ForeignFetch"))) { | 35 originTrialContext->isTrialEnabled("ForeignFetch"))) { |
| 36 V8HTMLLinkElement::installLinkServiceWorker( | 36 V8HTMLLinkElement::installLinkServiceWorker( |
| 37 isolate, world, v8::Local<v8::Object>(), prototypeObject, | 37 isolate, world, v8::Local<v8::Object>(), prototypeObject, |
| 38 interfaceObject); | 38 interfaceObject); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | |
| 42 // Install feature-policy-controlled features | |
| 43 LocalFrame* frame = nullptr; | |
| 44 if (executionContext->isDocument()) | |
| 45 frame = toDocument(executionContext)->executingFrame(); | |
| 46 | |
| 47 if (wrapperTypeInfo == &V8Document::wrapperTypeInfo) { | |
| 48 if (isFeatureEnabledInFrame(blink::kDocumentCookie, frame)) { | |
| 49 V8Document::installDocumentCookie(isolate, world, v8::Local<v8::Object>(), | |
| 50 prototypeObject, interfaceObject); | |
| 51 } | |
| 52 if (isFeatureEnabledInFrame(blink::kDocumentDomain, frame)) { | |
| 53 V8Document::installDocumentDomain(isolate, world, v8::Local<v8::Object>(), | |
| 54 prototypeObject, interfaceObject); | |
| 55 } | |
| 56 if (isFeatureEnabledInFrame(blink::kDocumentWrite, frame)) { | |
| 57 V8Document::installDocumentWrite(isolate, world, v8::Local<v8::Object>(), | |
| 58 prototypeObject, interfaceObject); | |
| 59 } | |
| 60 } | |
| 61 } | 41 } |
| 62 | 42 |
| 63 namespace { | 43 namespace { |
| 64 | 44 |
| 65 InstallConditionalFeaturesFunction s_installConditionalFeaturesFunction = | 45 InstallConditionalFeaturesFunction s_installConditionalFeaturesFunction = |
| 66 &installConditionalFeaturesCore; | 46 &installConditionalFeaturesCore; |
| 67 } | 47 } |
| 68 | 48 |
| 69 InstallConditionalFeaturesFunction setInstallConditionalFeaturesFunction( | 49 InstallConditionalFeaturesFunction setInstallConditionalFeaturesFunction( |
| 70 InstallConditionalFeaturesFunction newInstallConditionalFeaturesFunction) { | 50 InstallConditionalFeaturesFunction newInstallConditionalFeaturesFunction) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 101 return enabledByDefault; | 81 return enabledByDefault; |
| 102 FeaturePolicy* featurePolicy = frame->securityContext()->getFeaturePolicy(); | 82 FeaturePolicy* featurePolicy = frame->securityContext()->getFeaturePolicy(); |
| 103 if (!featurePolicy) | 83 if (!featurePolicy) |
| 104 return enabledByDefault; | 84 return enabledByDefault; |
| 105 | 85 |
| 106 // Otherwise, check policy. | 86 // Otherwise, check policy. |
| 107 return featurePolicy->isFeatureEnabled(feature); | 87 return featurePolicy->isFeatureEnabled(feature); |
| 108 } | 88 } |
| 109 | 89 |
| 110 } // namespace blink | 90 } // namespace blink |
| OLD | NEW |