Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/ConditionalFeaturesForModules.cpp

Issue 2698083008: Make the navigator.usb attribute accessible only in secure contexts. (Closed)
Patch Set: Moved [NoInterfaceObject] change to a separate patch. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/modules/v8/ConditionalFeaturesForModules.h" 5 #include "bindings/modules/v8/ConditionalFeaturesForModules.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h" 8 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h"
9 #include "bindings/core/v8/V8Navigator.h" 9 #include "bindings/core/v8/V8Navigator.h"
10 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h" 10 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if (!executionContext) 48 if (!executionContext)
49 return; 49 return;
50 v8::Isolate* isolate = scriptState->isolate(); 50 v8::Isolate* isolate = scriptState->isolate();
51 const DOMWrapperWorld& world = scriptState->world(); 51 const DOMWrapperWorld& world = scriptState->world();
52 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) { 52 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) {
53 if (OriginTrials::webShareEnabled(executionContext)) { 53 if (OriginTrials::webShareEnabled(executionContext)) {
54 V8NavigatorPartial::installWebShare(isolate, world, 54 V8NavigatorPartial::installWebShare(isolate, world,
55 v8::Local<v8::Object>(), 55 v8::Local<v8::Object>(),
56 prototypeObject, interfaceObject); 56 prototypeObject, interfaceObject);
57 } 57 }
58 if (OriginTrials::webUSBEnabled(executionContext)) { 58 // Mimics the [SecureContext] extended attribute.
59 if (OriginTrials::webUSBEnabled(executionContext) &&
60 executionContext->isSecureContext()) {
chasej 2017/02/22 19:34:18 The check for secure context is redundant. Origin
59 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), 61 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(),
60 prototypeObject, interfaceObject); 62 prototypeObject, interfaceObject);
61 } 63 }
62 if (OriginTrials::webVREnabled(executionContext)) { 64 if (OriginTrials::webVREnabled(executionContext)) {
63 V8NavigatorPartial::installWebVR(isolate, world, v8::Local<v8::Object>(), 65 V8NavigatorPartial::installWebVR(isolate, world, v8::Local<v8::Object>(),
64 prototypeObject, interfaceObject); 66 prototypeObject, interfaceObject);
65 } 67 }
66 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) { 68 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) {
67 v8::Local<v8::Object> instanceObject = scriptState->context()->Global(); 69 v8::Local<v8::Object> instanceObject = scriptState->context()->Global();
68 if (OriginTrials::imageCaptureEnabled(executionContext)) { 70 if (OriginTrials::imageCaptureEnabled(executionContext)) {
69 V8WindowPartial::installImageCapture(isolate, world, instanceObject, 71 V8WindowPartial::installImageCapture(isolate, world, instanceObject,
70 prototypeObject, interfaceObject); 72 prototypeObject, interfaceObject);
71 } 73 }
72 if (OriginTrials::webUSBEnabled(executionContext)) { 74 // Mimics the [SecureContext] extended attribute.
75 if (OriginTrials::webUSBEnabled(executionContext) &&
76 executionContext->isSecureContext()) {
chasej 2017/02/22 19:34:18 Ditto.
73 V8WindowPartial::installWebUSB(isolate, world, instanceObject, 77 V8WindowPartial::installWebUSB(isolate, world, instanceObject,
74 prototypeObject, interfaceObject); 78 prototypeObject, interfaceObject);
75 } 79 }
76 if (OriginTrials::webVREnabled(executionContext)) { 80 if (OriginTrials::webVREnabled(executionContext)) {
77 V8WindowPartial::installWebVR(isolate, world, instanceObject, 81 V8WindowPartial::installWebVR(isolate, world, instanceObject,
78 prototypeObject, interfaceObject); 82 prototypeObject, interfaceObject);
79 } 83 }
80 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { 84 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) {
81 V8WindowPartial::installGamepadExtensions( 85 V8WindowPartial::installGamepadExtensions(
82 isolate, world, instanceObject, prototypeObject, interfaceObject); 86 isolate, world, instanceObject, prototypeObject, interfaceObject);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 void registerInstallConditionalFeaturesForModules() { 254 void registerInstallConditionalFeaturesForModules() {
251 s_originalInstallConditionalFeaturesFunction = 255 s_originalInstallConditionalFeaturesFunction =
252 setInstallConditionalFeaturesFunction( 256 setInstallConditionalFeaturesFunction(
253 &installConditionalFeaturesForModules); 257 &installConditionalFeaturesForModules);
254 s_originalInstallPendingConditionalFeatureFunction = 258 s_originalInstallPendingConditionalFeatureFunction =
255 setInstallPendingConditionalFeatureFunction( 259 setInstallPendingConditionalFeatureFunction(
256 &installPendingConditionalFeatureForModules); 260 &installPendingConditionalFeatureForModules);
257 } 261 }
258 262
259 } // namespace blink 263 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698