Bug 1381645 - Restrict access to WebVR to HTTPS only sites draft
authorKearwood "Kip" Gilbert <kgilbert@mozilla.com>
Wed, 22 Nov 2017 15:57:23 -0800
changeset 750855 dab04580f4e418c1e155bca9b0fc7ede1d7cb9ce
parent 750719 2638ae89f86fbb5f224ef0511b3f77aec5503a51
child 750856 2c61c17663ef544540ac919efba85dafd6d7e360
push id97764
push userkgilbert@mozilla.com
push dateFri, 02 Feb 2018 23:23:46 +0000
bugs1381645
milestone60.0a1
Bug 1381645 - Restrict access to WebVR to HTTPS only sites MozReview-Commit-ID: BsqUzSH55nN
dom/webidl/Navigator.webidl
dom/webidl/VRDisplay.webidl
--- a/dom/webidl/Navigator.webidl
+++ b/dom/webidl/Navigator.webidl
@@ -212,20 +212,20 @@ partial interface Navigator {
   sequence<Gamepad?> getGamepads();
 };
 partial interface Navigator {
   [Pref="dom.gamepad.test.enabled"]
   GamepadServiceTest requestGamepadServiceTest();
 };
 
 partial interface Navigator {
-  [Throws, Pref="dom.vr.enabled"]
+  [SecureContext, Throws, Pref="dom.vr.enabled"]
   Promise<sequence<VRDisplay>> getVRDisplays();
   // TODO: Use FrozenArray once available. (Bug 1236777)
-  [Frozen, Cached, Pure, Pref="dom.vr.enabled"]
+  [SecureContext, Frozen, Cached, Pure, Pref="dom.vr.enabled"]
   readonly attribute sequence<VRDisplay> activeVRDisplays;
   [ChromeOnly, Pref="dom.vr.enabled"]
   readonly attribute boolean isWebVRContentDetected;
   [ChromeOnly, Pref="dom.vr.enabled"]
   readonly attribute boolean isWebVRContentPresenting;
   [ChromeOnly, Pref="dom.vr.enabled"]
   void requestVRPresentation(VRDisplay display);
 };
--- a/dom/webidl/VRDisplay.webidl
+++ b/dom/webidl/VRDisplay.webidl
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 enum VREye {
   "left",
   "right"
 };
 
 [Pref="dom.vr.enabled",
+ SecureContext,
  HeaderFile="mozilla/dom/VRDisplay.h"]
 interface VRFieldOfView {
   readonly attribute double upDegrees;
   readonly attribute double rightDegrees;
   readonly attribute double downDegrees;
   readonly attribute double leftDegrees;
 };
 
@@ -44,16 +45,17 @@ dictionary VRLayer {
   sequence<float> rightBounds = [];
 };
 
 /**
  * Values describing the capabilities of a VRDisplay.
  * These are expected to be static per-device/per-user.
  */
 [Pref="dom.vr.enabled",
+ SecureContext,
  HeaderFile="mozilla/dom/VRDisplay.h"]
 interface VRDisplayCapabilities {
   /**
    * hasPosition is true if the VRDisplay is capable of tracking its position.
    */
   readonly attribute boolean hasPosition;
 
   /**
@@ -85,16 +87,17 @@ interface VRDisplayCapabilities {
   readonly attribute unsigned long maxLayers;
 };
 
 /**
  * Values describing the the stage / play area for devices
  * that support room-scale experiences.
  */
 [Pref="dom.vr.enabled",
+ SecureContext,
  HeaderFile="mozilla/dom/VRDisplay.h"]
 interface VRStageParameters {
   /**
    * A 16-element array containing the components of a column-major 4x4
    * affine transform matrix. This matrix transforms the sitting-space position
    * returned by get{Immediate}Pose() to a standing-space position.
    */
   [Throws] readonly attribute Float32Array sittingToStandingTransform;
@@ -110,16 +113,17 @@ interface VRStageParameters {
    * the bounds resulting in position values outside of
    * this rectangle.
    */
   readonly attribute float sizeX;
   readonly attribute float sizeZ;
 };
 
 [Pref="dom.vr.enabled",
+ SecureContext,
  HeaderFile="mozilla/dom/VRDisplay.h"]
 interface VRPose
 {
   /**
    * position, linearVelocity, and linearAcceleration are 3-component vectors.
    * position is relative to a sitting space. Transforming this point with
    * VRStageParameters.sittingToStandingTransform converts this to standing space.
    */
@@ -131,16 +135,17 @@ interface VRPose
   [Constant, Throws] readonly attribute Float32Array? orientation;
   /* angularVelocity and angularAcceleration are the components of 3-dimensional vectors. */
   [Constant, Throws] readonly attribute Float32Array? angularVelocity;
   [Constant, Throws] readonly attribute Float32Array? angularAcceleration;
 };
 
 [Constructor,
  Pref="dom.vr.enabled",
+ SecureContext,
  HeaderFile="mozilla/dom/VRDisplay.h"]
 interface VRFrameData {
   readonly attribute DOMHighResTimeStamp timestamp;
 
   [Throws, Pure] readonly attribute Float32Array leftProjectionMatrix;
   [Throws, Pure] readonly attribute Float32Array leftViewMatrix;
 
   [Throws, Pure] readonly attribute Float32Array rightProjectionMatrix;
@@ -153,16 +158,17 @@ interface VRFrameData {
  Pref="dom.vr.test.enabled",
  HeaderFile="mozilla/dom/VRDisplay.h"]
 interface VRSubmitFrameResult {
   readonly attribute unsigned long frameNum;
   readonly attribute DOMString? base64Image;
 };
 
 [Pref="dom.vr.enabled",
+ SecureContext,
  HeaderFile="mozilla/dom/VRDisplay.h"]
 interface VREyeParameters {
   /**
    * offset is a 3-component vector representing an offset to
    * translate the eye. This value may vary from frame
    * to frame if the user adjusts their headset ipd.
    */
   [Constant, Throws] readonly attribute Float32Array offset;
@@ -176,16 +182,17 @@ interface VREyeParameters {
    * in a single render target, then the render target should be made large
    * enough to fit both viewports.
    */
   [Constant] readonly attribute unsigned long renderWidth;
   [Constant] readonly attribute unsigned long renderHeight;
 };
 
 [Pref="dom.vr.enabled",
+ SecureContext,
  HeaderFile="mozilla/dom/VRDisplay.h"]
 interface VRDisplay : EventTarget {
   /**
    * presentingGroups is a bitmask indicating which VR session groups
    * have an active VR presentation.
    */
   [ChromeOnly] readonly attribute unsigned long presentingGroups;
   /**