Merge mozilla-central to mozilla-inbound. a=merge
authorMihai Alexandru Michis <malexandru@mozilla.com>
Wed, 03 Jul 2019 12:50:49 +0300
changeset 543926 3619d80d3bce3fa94c9887cf86774010b4a6544c
parent 543925 f2bacc7bfee31ac349cc418c305cb7571fb17515 (current diff)
parent 543904 c52f9ebca761485c75ba9eda3d1bb7c1ed1c53f8 (diff)
child 543973 403c620d36f717bf85518ae24d8762d03e8beb65
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-central to mozilla-inbound. a=merge
testing/web-platform/meta/css/geometry/DOMQuad-002.html.ini
testing/web-platform/meta/css/geometry/DOMRect-002.html.ini
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1739,17 +1739,18 @@ pref("extensions.pocket.oAuthConsumerKey
 pref("extensions.pocket.site", "getpocket.com");
 
 pref("signon.schemeUpgrades", true);
 pref("signon.privateBrowsingCapture.enabled", true);
 pref("signon.showAutoCompleteFooter", true);
 pref("signon.management.page.enabled", false);
 pref("signon.showAutoCompleteOrigins", true);
 pref("signon.includeOtherSubdomainsInLookup", true);
-pref("signon.feedbackURL",
+pref("signon.management.page.faqURL", "https://lockwise.firefox.com/faq.html");
+pref("signon.management.page.feedbackURL",
      "https://www.surveygizmo.com/s3/5036102/Lockwise-feedback?ver=%VERSION%");
 
 // Enable the "Simplify Page" feature in Print Preview. This feature
 // is disabled by default in toolkit.
 pref("print.use_simplify_page", true);
 
 // Space separated list of URLS that are allowed to send objects (instead of
 // only strings) through webchannels. This list is duplicated in mobile/android/app/mobile.js
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -84,16 +84,17 @@ let LEGACY_ACTORS = {
     child: {
       matches: ["about:logins", "about:logins?*"],
       module: "resource:///actors/AboutLoginsChild.jsm",
       events: {
         "AboutLoginsCreateLogin": {wantUntrusted: true},
         "AboutLoginsDeleteLogin": {wantUntrusted: true},
         "AboutLoginsImport": {wantUntrusted: true},
         "AboutLoginsInit": {wantUntrusted: true},
+        "AboutLoginsOpenFAQ": {wantUntrusted: true},
         "AboutLoginsOpenFeedback": {wantUntrusted: true},
         "AboutLoginsOpenPreferences": {wantUntrusted: true},
         "AboutLoginsOpenSite": {wantUntrusted: true},
         "AboutLoginsRecordTelemetryEvent": {wantUntrusted: true},
         "AboutLoginsUpdateLogin": {wantUntrusted: true},
       },
       messages: [
         "AboutLogins:AllLogins",
@@ -578,16 +579,17 @@ const listeners = {
     "webrtc:UpdateGlobalIndicators": ["webrtcUI"],
     "webrtc:UpdatingIndicators": ["webrtcUI"],
   },
 
   mm: {
     "AboutLogins:CreateLogin": ["AboutLoginsParent"],
     "AboutLogins:DeleteLogin": ["AboutLoginsParent"],
     "AboutLogins:Import": ["AboutLoginsParent"],
+    "AboutLogins:OpenFAQ": ["AboutLoginsParent"],
     "AboutLogins:OpenFeedback": ["AboutLoginsParent"],
     "AboutLogins:OpenPreferences": ["AboutLoginsParent"],
     "AboutLogins:OpenSite": ["AboutLoginsParent"],
     "AboutLogins:Subscribe": ["AboutLoginsParent"],
     "AboutLogins:UpdateLogin": ["AboutLoginsParent"],
     "Content:Click": ["ContentClick"],
     "ContentSearch": ["ContentSearch"],
     "FormValidation:ShowPopup": ["FormValidationHandler"],
--- a/browser/components/aboutlogins/AboutLoginsChild.jsm
+++ b/browser/components/aboutlogins/AboutLoginsChild.jsm
@@ -37,24 +37,28 @@ class AboutLoginsChild extends ActorChil
       case "AboutLoginsCreateLogin": {
         this.mm.sendAsyncMessage("AboutLogins:CreateLogin", {login: event.detail});
         break;
       }
       case "AboutLoginsDeleteLogin": {
         this.mm.sendAsyncMessage("AboutLogins:DeleteLogin", {login: event.detail});
         break;
       }
+      case "AboutLoginsImport": {
+        this.mm.sendAsyncMessage("AboutLogins:Import");
+        break;
+      }
+      case "AboutLoginsOpenFAQ": {
+        this.mm.sendAsyncMessage("AboutLogins:OpenFAQ");
+        break;
+      }
       case "AboutLoginsOpenFeedback": {
         this.mm.sendAsyncMessage("AboutLogins:OpenFeedback");
         break;
       }
-      case "AboutLoginsImport": {
-        this.mm.sendAsyncMessage("AboutLogins:Import");
-        break;
-      }
       case "AboutLoginsOpenPreferences": {
         this.mm.sendAsyncMessage("AboutLogins:OpenPreferences");
         break;
       }
       case "AboutLoginsOpenSite": {
         this.mm.sendAsyncMessage("AboutLogins:OpenSite", {login: event.detail});
         break;
       }
--- a/browser/components/aboutlogins/AboutLoginsParent.jsm
+++ b/browser/components/aboutlogins/AboutLoginsParent.jsm
@@ -24,19 +24,22 @@ const ABOUT_LOGINS_ORIGIN = "about:login
 const MASTER_PASSWORD_NOTIFICATION_ID = "master-password-login-required";
 
 const PRIVILEGEDABOUT_PROCESS_PREF =
   "browser.tabs.remote.separatePrivilegedContentProcess";
 const PRIVILEGEDABOUT_PROCESS_ENABLED =
   Services.prefs.getBoolPref(PRIVILEGEDABOUT_PROCESS_PREF, false);
 
 
-const FEEDBACK_URL_PREF = "signon.feedbackURL";
+const FEEDBACK_URL_PREF = "signon.management.page.feedbackURL";
 const FEEDBACK_URL = Services.urlFormatter.formatURLPref(FEEDBACK_URL_PREF);
 
+const FAQ_URL_PREF = "signon.management.page.faqURL";
+const FAQ_URL = Services.prefs.getStringPref(FAQ_URL_PREF);
+
 // When the privileged content process is enabled, we expect about:logins
 // to load in it. Otherwise, it's in a normal web content process.
 const EXPECTED_ABOUTLOGINS_REMOTE_TYPE =
   PRIVILEGEDABOUT_PROCESS_ENABLED ? E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE
                                   : E10SUtils.DEFAULT_REMOTE_TYPE;
 
 const isValidLogin = login => {
   return !(login.origin || "").startsWith("chrome://");
@@ -108,16 +111,20 @@ var AboutLoginsParent = {
           Cu.reportError(ex);
         }
         break;
       }
       case "AboutLogins:OpenFeedback": {
         message.target.ownerGlobal.openWebLinkIn(FEEDBACK_URL, "tab", {relatedToCurrent: true});
         break;
       }
+      case "AboutLogins:OpenFAQ": {
+        message.target.ownerGlobal.openWebLinkIn(FAQ_URL, "tab", {relatedToCurrent: true});
+        break;
+      }
       case "AboutLogins:OpenPreferences": {
         message.target.ownerGlobal.openPreferences("privacy-logins");
         break;
       }
       case "AboutLogins:OpenSite": {
         let guid = message.data.login.guid;
         let logins = LoginHelper.searchLoginsWithObject({guid});
         if (logins.length != 1) {
--- a/browser/components/aboutlogins/content/aboutLogins.css
+++ b/browser/components/aboutlogins/content/aboutLogins.css
@@ -22,17 +22,16 @@ header {
 
 login-filter {
   flex: auto;
   align-self: center;
 }
 
 login-list {
   grid-area: logins;
-  overflow: hidden auto;
 }
 
 login-item {
   grid-area: login;
   max-width: 800px;
 }
 
 #branding-logo {
--- a/browser/components/aboutlogins/content/aboutLogins.ftl
+++ b/browser/components/aboutlogins/content/aboutLogins.ftl
@@ -13,16 +13,17 @@
 about-logins-page-title = Logins & Passwords
 
 create-login-button = New Login
 
 login-filter =
   .placeholder = Search Logins
 
 login-list =
+  .aria-label = Logins matching search query
   .count =
     { $count ->
         [one] { $count } login
        *[other] { $count } logins
     }
   .last-changed-option = Last Changed
   .last-used-option = Last Used
   .missing-username = (no username)
@@ -56,15 +57,16 @@ login-item =
 master-password-notification-message = Please enter your master password to view saved logins & passwords
 # TODO: Not sure how to use formatValue with these as attributes on a single ID
 master-password-reload-button-label = Log in
 # TODO: Not sure how to use formatValue with these as attributes on a single ID
 master-password-reload-button-accesskey = L
 
 menu-button =
   .button-title = Open menu
+  .menuitem-faq = Frequently Asked Questions
   .menuitem-feedback = Leave Feedback
   .menuitem-import = Import Passwords…
   .menuitem-preferences =
     { PLATFORM() ->
         [windows] Options
        *[other] Preferences
     }
--- a/browser/components/aboutlogins/content/aboutLogins.html
+++ b/browser/components/aboutlogins/content/aboutLogins.html
@@ -23,23 +23,25 @@
   <body>
     <header>
       <img id="branding-logo" src="chrome://branding/content/aboutlogins.svg" alt=""/>
       <login-filter data-l10n-id="login-filter"
                     data-l10n-attrs="placeholder"></login-filter>
       <button id="create-login-button" data-l10n-id="create-login-button"></button>
       <menu-button data-l10n-id="menu-button"
                    data-l10n-attrs="button-title,
+                                    menuitem-faq,
                                     menuitem-feedback,
                                     menuitem-import,
                                     menuitem-preferences"></menu-button>
     </header>
     <login-list data-l10n-id="login-list"
                 data-l10n-args='{"count": 0}'
-                data-l10n-attrs="count,
+                data-l10n-attrs="aria-label,
+                                 count,
                                  last-changed-option,
                                  last-used-option,
                                  missing-username,
                                  name-option,
                                  new-login-subtitle,
                                  new-login-title,
                                  sort-label-text"></login-list>
     <login-item data-l10n-id="login-item"
@@ -74,17 +76,17 @@
           <select id="login-sort">
             <option class="name-option" value="name"/>
             <option class="last-used-option" value="last-used"/>
             <option class="last-changed-option" value="last-changed"/>
           </select>
         </label>
         <span class="count"></span>
       </div>
-      <ol>
+      <ol role="listbox" tabindex="0">
       </ol>
     </template>
 
     <template id="login-list-item-template">
       <link rel="stylesheet" href="chrome://global/skin/in-content/common.css">
       <link rel="stylesheet" href="chrome://browser/content/aboutlogins/components/login-list-item.css">
       <span class="title"></span>
       <span class="username"></span>
@@ -141,25 +143,20 @@
     </template>
 
     <template id="menu-button-template">
       <link rel="stylesheet" href="chrome://global/skin/in-content/common.css">
       <link rel="stylesheet" href="chrome://browser/content/aboutlogins/common.css">
       <link rel="stylesheet" href="chrome://browser/content/aboutlogins/components/menu-button.css">
       <button class="menu-button alternate-button"></button>
       <ul class="menu" role="menu" hidden>
-        <li role="menuitem" class="menuitem windows-only">
-          <button class="menuitem-button menuitem-import alternate-button" data-event-name="AboutLoginsImport"></button>
-        </li>
-        <li role="menuitem" class="menuitem">
-          <button class="menuitem-button menuitem-feedback alternate-button" data-event-name="AboutLoginsOpenFeedback"></button>
-        </li>
-        <li role="menuitem" class="menuitem">
-          <button class="menuitem-button menuitem-preferences alternate-button" data-event-name="AboutLoginsOpenPreferences"></button>
-        </li>
+        <button role="menuitem" class="menuitem-button menuitem-import alternate-button" hidden data-supported-platforms="Win32" data-event-name="AboutLoginsImport"></button>
+        <button role="menuitem" class="menuitem-button menuitem-preferences alternate-button" data-event-name="AboutLoginsOpenPreferences"></button>
+        <button role="menuitem" class="menuitem-button menuitem-feedback alternate-button" data-event-name="AboutLoginsOpenFeedback"></button>
+        <button role="menuitem" class="menuitem-button menuitem-faq alternate-button" data-event-name="AboutLoginsOpenFAQ"></button>
       </ul>
     </template>
 
     <template id="copy-to-clipboard-button-template">
       <link rel="stylesheet" href="chrome://global/skin/in-content/common.css">
       <link rel="stylesheet" href="chrome://browser/content/aboutlogins/components/copy-to-clipboard-button.css">
       <button class="copy-button">
         <span class="copied-button-text"></span>
--- a/browser/components/aboutlogins/content/common.css
+++ b/browser/components/aboutlogins/content/common.css
@@ -1,12 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* [hidden] isn't applying to elements in Shadow DOM. */
+:host([hidden]),
+[hidden] {
+  display: none !important;
+}
+
 .alternate-button {
   background-color: transparent;
 }
 
 .alternate-button:hover {
   background-color: var(--in-content-button-background-hover);
 }
 
--- a/browser/components/aboutlogins/content/components/login-item.css
+++ b/browser/components/aboutlogins/content/components/login-item.css
@@ -125,16 +125,26 @@
 .reveal-password-checkbox:hover:active {
   opacity: var(--reveal-checkbox-opacity-active);
 }
 
 .reveal-password-checkbox:checked {
   background-image: url("chrome://browser/content/aboutlogins/icons/hide-password.svg") !important;
 }
 
+.reveal-password-checkbox:-moz-focusring {
+  outline: 2px solid var(--in-content-border-active);
+  /* offset outline to align with 1px border-width set for buttons/menulists above. */
+  outline-offset: -1px;
+  /* Make outline-radius slightly bigger than the border-radius set above,
+   * to make the thicker outline corners look smooth */
+  -moz-outline-radius: 3px;
+  box-shadow: 0 0 0 4px var(--in-content-border-active-shadow);
+}
+
 @supports -moz-bool-pref("browser.in-content.dark-mode") {
 @media (prefers-color-scheme: dark) {
   :host {
     --reveal-checkbox-opacity: .8;
     --reveal-checkbox-opacity-hover: 1;
     --reveal-checkbox-opacity-active: .6;
   }
 }
--- a/browser/components/aboutlogins/content/components/login-item.js
+++ b/browser/components/aboutlogins/content/components/login-item.js
@@ -248,16 +248,17 @@ export default class LoginItem extends R
       delete this.dataset.isNewLogin;
     } else {
       this.dataset.isNewLogin = true;
     }
     this._toggleEditing(!login.guid);
 
     this._revealCheckbox.checked = false;
 
+    this._editButton.focus();
     this.render();
   }
 
   /**
    * Updates the view if the login argument matches the login currently
    * displayed.
    *
    * @param {login} login The login that was added to storage. The login object is
@@ -359,21 +360,26 @@ export default class LoginItem extends R
     } else {
       // Need to set a shorter width than -moz-available so the reveal checkbox
       // will still appear next to the password.
       this._passwordInput.style.width = (this._login.password || "").length + "ch";
     }
 
     this._deleteButton.disabled = this.dataset.isNewLogin;
     this._editButton.disabled = shouldEdit;
-    this._originInput.readOnly = !this.dataset.isNewLogin;
+    let inputTabIndex = !shouldEdit ? -1 : 0;
+    this._originInput.readOnly = !shouldEdit;
+    this._originInput.tabIndex = inputTabIndex;
     this._usernameInput.readOnly = !shouldEdit;
+    this._usernameInput.tabIndex = inputTabIndex;
     this._passwordInput.readOnly = !shouldEdit;
+    this._passwordInput.tabIndex = inputTabIndex;
     if (shouldEdit) {
       this.dataset.editing = true;
+      this._originInput.focus();
     } else {
       delete this.dataset.editing;
     }
   }
 
   _updatePasswordRevealState() {
     let labelAttr = this._revealCheckbox.checked ? "password-show-title"
                                                  : "password-hide-title";
--- a/browser/components/aboutlogins/content/components/login-list-item.css
+++ b/browser/components/aboutlogins/content/components/login-list-item.css
@@ -6,29 +6,29 @@
   display: block;
   padding: 10px;
   padding-inline-end: 18px;
   padding-inline-start: 14px;
   border-inline-start: 4px solid transparent;
   border-bottom: 1px solid var(--in-content-box-border-color);
 }
 
-/* [hidden] isn't applying to elements in Shadow DOM. */
-:host([hidden]) {
-  display: none;
-}
-
 :host(:hover) {
   background-color: var(--in-content-box-background-hover);
 }
 
 :host(:hover:active) {
   background-color: var(--in-content-box-background-active);
 }
 
+:host(.keyboard-selected) {
+  border-inline-start-color: var(--in-content-border-active-shadow);
+  background-color: var(--in-content-box-background-odd);
+}
+
 :host(.selected) {
   border-inline-start-color: var(--in-content-border-highlight);
   background-color: var(--in-content-box-background-hover);
 }
 
 .title {
   font-weight: bold;
 }
--- a/browser/components/aboutlogins/content/components/login-list-item.js
+++ b/browser/components/aboutlogins/content/components/login-list-item.js
@@ -3,30 +3,35 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 import {recordTelemetryEvent} from "../aboutLoginsUtils.js";
 
 export default class LoginListItem extends HTMLElement {
   constructor(login) {
     super();
     this._login = login;
+    this.id = login.guid ?
+      // Prepend the ID with a string since IDs must not begin with a number.
+      "lli-" + this._login.guid :
+      "new-login-list-item";
   }
 
   connectedCallback() {
     if (this.shadowRoot) {
       this.render();
       return;
     }
 
     let loginListItemTemplate = document.querySelector("#login-list-item-template");
     this.attachShadow({mode: "open"})
         .appendChild(loginListItemTemplate.content.cloneNode(true));
 
     this._title = this.shadowRoot.querySelector(".title");
     this._username = this.shadowRoot.querySelector(".username");
+    this.setAttribute("role", "option");
 
     this.render();
 
     this.addEventListener("click", this);
   }
 
   render() {
     if (!this._login.guid) {
--- a/browser/components/aboutlogins/content/components/login-list.css
+++ b/browser/components/aboutlogins/content/components/login-list.css
@@ -11,18 +11,16 @@
 }
 
 .meta {
   display: flex;
   align-items: center;
   padding: 10px 18px;
   border-bottom: 1px solid var(--in-content-box-border-color);
   background-color: var(--in-content-box-info-background);
-  position: sticky;
-  top: 0;
 }
 
 .count {
   flex: auto;
   text-align: end;
   font-size: smaller;
   margin-inline-start: 18px;
 }
--- a/browser/components/aboutlogins/content/components/login-list.js
+++ b/browser/components/aboutlogins/content/components/login-list.js
@@ -32,38 +32,43 @@ export default class LoginList extends R
     this._list = this.shadowRoot.querySelector("ol");
 
     this.render();
 
     this.shadowRoot.getElementById("login-sort")
                    .addEventListener("change", this);
     window.addEventListener("AboutLoginsLoginSelected", this);
     window.addEventListener("AboutLoginsFilterLogins", this);
+    this.addEventListener("keydown", this);
 
     super.connectedCallback();
   }
 
   render() {
     this._list.textContent = "";
 
     if (!this._logins.length) {
       document.l10n.setAttributes(this, "login-list", {count: 0});
       return;
     }
 
     if (!this._selectedGuid) {
       this._blankLoginListItem.classList.add("selected");
+      this._blankLoginListItem.setAttribute("aria-selected", "true");
+      this._list.setAttribute("aria-activedescendant", this._blankLoginListItem.id);
       this._list.append(this._blankLoginListItem);
     }
 
     for (let login of this._logins) {
       let listItem = new LoginListItem(login);
       listItem.setAttribute("missing-username", this.getAttribute("missing-username"));
       if (login.guid == this._selectedGuid) {
         listItem.classList.add("selected");
+        listItem.setAttribute("aria-selected", "true");
+        this._list.setAttribute("aria-activedescendant", listItem.id);
       }
       this._list.append(listItem);
     }
 
     let visibleLoginCount = this._applyFilter();
     document.l10n.setAttributes(this, "login-list", {count: visibleLoginCount});
   }
 
@@ -84,36 +89,45 @@ export default class LoginList extends R
         if (this._selectedGuid == event.detail.guid) {
           return;
         }
 
         this._selectedGuid = event.detail.guid || null;
         this.render();
         break;
       }
+      case "keydown": {
+        this._handleKeyboardNav(event);
+        break;
+      }
     }
   }
 
   static get reflectedFluentIDs() {
-    return ["count",
+    return ["aria-label",
+            "count",
             "last-used-option",
             "last-changed-option",
             "missing-username",
             "name-option",
             "new-login-subtitle",
             "new-login-title",
             "sort-label-text"];
   }
 
   static get observedAttributes() {
     return this.reflectedFluentIDs;
   }
 
   handleSpecialCaseFluentString(attrName) {
     switch (attrName) {
+      case "aria-label": {
+        this._list.setAttribute("aria-label", this.getAttribute(attrName));
+        break;
+      }
       case "missing-username": {
         break;
       }
       case "new-login-subtitle":
       case "new-login-title": {
         this._blankLoginListItem.setAttribute(attrName, this.getAttribute(attrName));
         break;
       }
@@ -189,10 +203,89 @@ export default class LoginList extends R
         }
       } else if (!listItem.hidden) {
         listItem.hidden = true;
       }
     }
 
     return matchingLoginGuids.length;
   }
+
+  _handleKeyboardNav(event) {
+    if (this._list != this.shadowRoot.activeElement) {
+      return;
+    }
+
+    let isLTR = document.dir == "ltr";
+    let activeDescendantId = this._list.getAttribute("aria-activedescendant");
+    let activeDescendant = activeDescendantId ?
+      this.shadowRoot.getElementById(activeDescendantId) :
+      this._list.firstElementChild;
+    let newlyFocusedItem = null;
+    switch (event.key) {
+      case "ArrowDown": {
+        let nextItem = activeDescendant.nextElementSibling;
+        if (!nextItem) {
+          return;
+        }
+        newlyFocusedItem = nextItem;
+        break;
+      }
+      case "ArrowLeft": {
+        let item = isLTR ?
+          activeDescendant.previousElementSibling :
+          activeDescendant.nextElementSibling;
+        if (!item) {
+          return;
+        }
+        newlyFocusedItem = item;
+        break;
+      }
+      case "ArrowRight": {
+        let item = isLTR ?
+          activeDescendant.nextElementSibling :
+          activeDescendant.previousElementSibling;
+        if (!item) {
+          return;
+        }
+        newlyFocusedItem = item;
+        break;
+      }
+      case "ArrowUp": {
+        let previousItem = activeDescendant.previousElementSibling;
+        if (!previousItem) {
+          return;
+        }
+        newlyFocusedItem = previousItem;
+        break;
+      }
+      case "Tab": {
+        // Bug 1562716: Pressing Tab from the login-list cycles back to the
+        // login-sort dropdown due to the login-list having `overflow`
+        // CSS property set. Explicitly forward focus here until
+        // this keyboard trap is fixed.
+        if (event.shiftKey) {
+          return;
+        }
+        let loginItem = document.querySelector("login-item");
+        if (loginItem) {
+          event.preventDefault();
+          loginItem.shadowRoot.querySelector(".edit-button").focus();
+        }
+        return;
+      }
+      case " ":
+      case "Enter": {
+        event.preventDefault();
+        activeDescendant.click();
+        return;
+      }
+      default:
+        return;
+    }
+    event.preventDefault();
+    this._list.setAttribute("aria-activedescendant", newlyFocusedItem.id);
+    activeDescendant.classList.remove("keyboard-selected");
+    newlyFocusedItem.classList.add("keyboard-selected");
+    newlyFocusedItem.scrollIntoView(false);
+  }
 }
 customElements.define("login-list", LoginList);
--- a/browser/components/aboutlogins/content/components/menu-button.css
+++ b/browser/components/aboutlogins/content/components/menu-button.css
@@ -25,40 +25,39 @@
   margin: 0;
   padding: 5px 0;
   background-color: var(--in-content-box-background);
   border: 1px solid var(--in-content-box-border-color);
   border-radius: 2px;
   box-shadow: var(--shadow-10);
   min-width: max-content;
   list-style-type: none;
+  display: flex;
+  flex-direction: column;
 }
 
 .menu:dir(rtl) {
   right: auto;
   left: 0;
 }
 
-.menuitem {
-  display: flex;
-}
-
 .menuitem-button {
   padding: 4px 8px;
   /* 32px = 8px (padding) + 16px (icon) + 8px (padding) */
   padding-inline-start: 32px;
   background-repeat: no-repeat;
   background-position: left 8px center;
   background-size: 16px;
   margin: 0;
   border-radius: 0;
   /* Override common.inc.css box-shadow on these buttons */
   box-shadow: none !important;
-  flex-grow: 1;
   text-align: start;
+  -moz-context-properties: fill;
+  fill: currentColor;
 }
 
 .menuitem-button:dir(rtl) {
   background-position: right 8px center;
 }
 
 .menuitem-import {
   background-image: url("chrome://browser/skin/save.svg");
@@ -67,11 +66,11 @@
 .menuitem-preferences {
   background-image: url("chrome://browser/skin/settings.svg");
 }
 
 .menuitem-feedback {
   background-image: url("chrome://browser/content/aboutlogins/icons/feedback.svg");
 }
 
-:host(:not(.Win32)) .windows-only {
-  display: none;
+.menuitem-faq {
+  background-image: url("chrome://browser/content/aboutlogins/icons/faq.svg");
 }
--- a/browser/components/aboutlogins/content/components/menu-button.js
+++ b/browser/components/aboutlogins/content/components/menu-button.js
@@ -9,34 +9,37 @@ export default class MenuButton extends 
     if (this.shadowRoot) {
       return;
     }
 
     let MenuButtonTemplate = document.querySelector("#menu-button-template");
     this.attachShadow({mode: "open"})
         .appendChild(MenuButtonTemplate.content.cloneNode(true));
 
-    if (navigator.platform == "Win32") {
-      // We can't add navigator.platform in all cases
-      // because some platforms, such as Ubuntu 64-bit,
-      // use "Linux x86_64" which is an invalid className.
-      this.classList.add(navigator.platform);
+    for (let menuitem of this.shadowRoot.querySelectorAll(".menuitem-button[data-supported-platforms]")) {
+      let supportedPlatforms = menuitem.dataset.supportedPlatforms.split(",").map(platform => platform.trim());
+      if (supportedPlatforms.includes(navigator.platform)) {
+        menuitem.hidden = false;
+      }
     }
 
     this._menu = this.shadowRoot.querySelector(".menu");
     this._menuButton = this.shadowRoot.querySelector(".menu-button");
 
+    this.addEventListener("blur", this);
     this._menuButton.addEventListener("click", this);
+    this.addEventListener("keydown", this, true);
 
     super.connectedCallback();
   }
 
   static get reflectedFluentIDs() {
     return [
       "button-title",
+      "menuitem-faq",
       "menuitem-import",
       "menuitem-feedback",
       "menuitem-preferences",
     ];
   }
 
   static get observedAttributes() {
     return MenuButton.reflectedFluentIDs;
@@ -49,41 +52,82 @@ export default class MenuButton extends 
     }
 
     this._menuButton.setAttribute("title", this.getAttribute(attrName));
     return true;
   }
 
   handleEvent(event) {
     switch (event.type) {
+      case "blur": {
+        if (event.relatedTarget &&
+            event.relatedTarget.closest(".menu") == this._menu) {
+          // Only hide the menu if focus has left the menu-button.
+          return;
+        }
+        this._hideMenu();
+        break;
+      }
       case "click": {
         // Skip the catch-all event listener if it was the menu-button
         // that was clicked on.
         if (event.currentTarget == document.documentElement &&
             event.target == this &&
             event.originalTarget == this._menuButton) {
           return;
         }
         let classList = event.originalTarget.classList;
         if (classList.contains("menuitem-import") ||
+            classList.contains("menuitem-faq") ||
             classList.contains("menuitem-feedback") ||
             classList.contains("menuitem-preferences")) {
           let eventName = event.originalTarget.dataset.eventName;
           document.dispatchEvent(new CustomEvent(eventName, {
             bubbles: true,
           }));
           this._hideMenu();
           break;
         }
         this._toggleMenu();
         break;
       }
+      case "keydown": {
+        this._handleKeyDown(event);
+      }
     }
   }
 
+  _handleKeyDown(event) {
+    if (event.key == "Enter") {
+      event.preventDefault();
+      this._toggleMenu();
+    } else if (event.key == "Escape") {
+      this._hideMenu();
+      this._menuButton.focus();
+    }
+
+    if (!event.key.startsWith("Arrow")) {
+      return;
+    }
+
+    let activeMenuitem = this.shadowRoot.activeElement ||
+                         this._menu.querySelector(".menuitem-button:not([hidden])");
+
+    let newlyFocusedItem = null;
+    if (event.key == "ArrowDown") {
+      newlyFocusedItem = activeMenuitem.nextElementSibling;
+    } else if (event.key == "ArrowUp") {
+      newlyFocusedItem = activeMenuitem.previousElementSibling;
+    }
+    if (!newlyFocusedItem) {
+      return;
+    }
+    newlyFocusedItem.focus();
+  }
+
   _hideMenu() {
     this._menu.hidden = true;
     document.documentElement.removeEventListener("click", this, true);
   }
 
   _showMenu() {
     this._menu.hidden = false;
 
new file mode 100644
--- /dev/null
+++ b/browser/components/aboutlogins/content/icons/faq.svg
@@ -0,0 +1,6 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
+    <path fill="context-fill" fill-rule="evenodd" d="M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16zM8 2.719a2.925 2.925 0 0 0-3.115 3.114.948.948 0 1 0 1.896 0c0-1.083.65-1.218 1.219-1.218a1.197 1.197 0 0 1 1.224.806c.1.457-.142.92-.574 1.1a2.966 2.966 0 0 0-1.598 2.562v.365a.948.948 0 0 0 1.896 0v-.4c.048-.393.298-.732.66-.893a2.857 2.857 0 0 0 1.447-3.232A3.074 3.074 0 0 0 8 2.72zm0 8.26a1.354 1.354 0 1 0 0 2.708 1.354 1.354 0 0 0 0-2.708z"/>
+</svg>
--- a/browser/components/aboutlogins/jar.mn
+++ b/browser/components/aboutlogins/jar.mn
@@ -11,19 +11,20 @@ browser.jar:
   content/browser/aboutlogins/components/login-item.js         (content/components/login-item.js)
   content/browser/aboutlogins/components/login-list.css        (content/components/login-list.css)
   content/browser/aboutlogins/components/login-list.js         (content/components/login-list.js)
   content/browser/aboutlogins/components/login-list-item.css   (content/components/login-list-item.css)
   content/browser/aboutlogins/components/login-list-item.js    (content/components/login-list-item.js)
   content/browser/aboutlogins/components/menu-button.css       (content/components/menu-button.css)
   content/browser/aboutlogins/components/menu-button.js        (content/components/menu-button.js)
   content/browser/aboutlogins/components/reflected-fluent-element.js  (content/components/reflected-fluent-element.js)
-  content/browser/aboutlogins/icons/delete.svg  (content/icons/delete.svg)
-  content/browser/aboutlogins/icons/edit.svg    (content/icons/edit.svg)
-  content/browser/aboutlogins/icons/favicon.svg   (content/icons/favicon.svg)
-  content/browser/aboutlogins/icons/feedback.svg  (content/icons/feedback.svg)
+  content/browser/aboutlogins/icons/delete.svg        (content/icons/delete.svg)
+  content/browser/aboutlogins/icons/edit.svg          (content/icons/edit.svg)
+  content/browser/aboutlogins/icons/faq.svg           (content/icons/faq.svg)
+  content/browser/aboutlogins/icons/favicon.svg       (content/icons/favicon.svg)
+  content/browser/aboutlogins/icons/feedback.svg      (content/icons/feedback.svg)
   content/browser/aboutlogins/icons/hide-password.svg (content/icons/hide-password.svg)
   content/browser/aboutlogins/icons/show-password.svg (content/icons/show-password.svg)
   content/browser/aboutlogins/aboutLogins.css   (content/aboutLogins.css)
   content/browser/aboutlogins/aboutLogins.js    (content/aboutLogins.js)
   content/browser/aboutlogins/aboutLogins.html  (content/aboutLogins.html)
   content/browser/aboutlogins/aboutLoginsUtils.js (content/aboutLoginsUtils.js)
   content/browser/aboutlogins/common.css        (content/common.css)
--- a/browser/components/aboutlogins/tests/chrome/test_login_list.html
+++ b/browser/components/aboutlogins/tests/chrome/test_login_list.html
@@ -2,16 +2,17 @@
 <html>
 <!--
 Test the login-list component
 -->
 <head>
   <meta charset="utf-8">
   <title>Test the login-list component</title>
   <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
   <script type="module" src="chrome://browser/content/aboutlogins/components/login-list.js"></script>
   <script src="aboutlogins_common.js"></script>
 
   <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
   <p id="display">
   </p>
@@ -69,17 +70,69 @@ add_task(async function setup() {
   displayEl.appendChild(gLoginList);
 });
 
 add_task(async function test_empty_list() {
   ok(gLoginList, "loginList exists");
   is(gLoginList.textContent, "", "Initially empty");
 });
 
+add_task(async function test_keyboard_navigation() {
+  gLoginList.setLogins([TEST_LOGIN_1, TEST_LOGIN_2, TEST_LOGIN_3]);
+
+  while (document.activeElement != gLoginList) {
+    sendKey("TAB");
+    await new Promise(resolve => requestAnimationFrame(resolve));
+  }
+
+  sendKey("TAB");
+  sendKey("TAB");
+  let loginSort = gLoginList.shadowRoot.querySelector("#login-sort");
+  await SimpleTest.promiseWaitForCondition(() => loginSort == gLoginList.shadowRoot.activeElement,
+    "waiting for login-sort to get focus");
+  ok(loginSort == gLoginList.shadowRoot.activeElement, "#login-sort should be focused after tabbing to it");
+
+  sendKey("TAB");
+  let ol = gLoginList.shadowRoot.querySelector("ol");
+  await SimpleTest.promiseWaitForCondition(() => ol.matches(":focus"),
+    "waiting for 'ol' to get focus");
+  ok(ol.matches(":focus"), "'ol' should be focused after tabbing to it");
+
+  for (let [keyFwd, keyRev] of [["LEFT", "RIGHT"], ["DOWN", "UP"]]) {
+    sendKey(keyFwd);
+    await SimpleTest.promiseWaitForCondition(() => ol.getAttribute("aria-activedescendant") == ol.children[1].id,
+      `waiting for second item in list to get focused (${keyFwd})`);
+    ok(ol.children[1].classList.contains("keyboard-selected"), `second item should be marked as keyboard-selected (${keyFwd})`);
+
+    sendKey(keyRev);
+    await SimpleTest.promiseWaitForCondition(() => ol.getAttribute("aria-activedescendant") == ol.children[0].id,
+      `waiting for first item in list to get focused (${keyRev})`);
+    ok(ol.children[0].classList.contains("keyboard-selected"), `first item should be marked as keyboard-selected (${keyRev})`);
+  }
+
+  sendKey("DOWN");
+  await SimpleTest.promiseWaitForCondition(() => ol.getAttribute("aria-activedescendant") == ol.children[1].id,
+    `waiting for second item in list to get focused (DOWN)`);
+  ok(ol.children[1].classList.contains("keyboard-selected"), `second item should be marked as keyboard-selected (DOWN)`);
+  let selectedGuid = ol.children[1].dataset.guid;
+
+  let loginSelectedEvent = null;
+  gLoginList.addEventListener("AboutLoginsLoginSelected", event => loginSelectedEvent = event, {once: true});
+  sendKey("RETURN");
+  is(ol.querySelector(".selected").dataset.guid, selectedGuid, "item should be marked as selected");
+  ok(loginSelectedEvent, "AboutLoginsLoginSelected event should be dispatched on pressing Enter");
+  is(loginSelectedEvent.detail.guid, selectedGuid, "event should have expected login attached");
+});
+
 add_task(async function test_empty_login_username_in_list() {
+  // Clear the selection so the 'new' login will be in the list too.
+  window.dispatchEvent(new CustomEvent("AboutLoginsLoginSelected", {
+    detail: {},
+  }));
+
   gLoginList.setLogins([TEST_LOGIN_3]);
   let loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
   is(loginListItems.length, 2, "A blank login and the one stored login should be displayed");
   ok(!loginListItems[0].dataset.guid, "first login-list-item should be the 'new' item");
   is(loginListItems[1].dataset.guid, TEST_LOGIN_3.guid, "login-list-item should have correct guid attribute");
 
   loginListItems[1].setAttribute("missing-username", "(no username)");
   loginListItems[1].render();
--- a/browser/components/aboutlogins/tests/chrome/test_menu_button.html
+++ b/browser/components/aboutlogins/tests/chrome/test_menu_button.html
@@ -43,43 +43,65 @@ add_task(async function setup() {
 
 add_task(async function test_menu_open_close() {
   is(document.activeElement, gMenuButton, "menu-button should be focused to start the test");
 
   let menu = gMenuButton.shadowRoot.querySelector(".menu");
   is(true, menu.hidden, "menu should be hidden before pressing 'space'");
   sendKey("SPACE");
   await new Promise(resolve => requestAnimationFrame(resolve));
-  is(false, menu.hidden, "menu should be visible after pressing 'space'");
+  ok(!menu.hidden, "menu should be visible after pressing 'space'");
+
+  sendKey("ESCAPE");
+  await new Promise(resolve => requestAnimationFrame(resolve));
+  ok(menu.hidden, "menu should be hidden after pressing 'escape'");
+  is(gMenuButton.shadowRoot.activeElement, gMenuButton.shadowRoot.querySelector(".menu-button"),
+    "the .menu-button should be focused after closing the menu via keyboard");
+
+  sendKey("RETURN");
+  await new Promise(resolve => requestAnimationFrame(resolve));
+  ok(!menu.hidden, "menu should be visible after pressing 'return'");
 
-  let feedbackItem = gMenuButton.shadowRoot.querySelector(".menuitem-feedback");
-  ok(!feedbackItem.matches(":focus"), ".menuitem-feedback should not be focused before tabbing to it");
-  // The Import menuitem is only visible on Windows, where we will need a second Tab
-  // press to get to the Feedback item.
-  let tabs = navigator.platform == "Win32" ? 2 : 1;
-  while (tabs--) {
+  let firstVisibleItem = gMenuButton.shadowRoot.querySelector(".menuitem-button:not([hidden])");
+  ok(!firstVisibleItem.matches(":focus"), "the first item should not be focused before tabbing to it");
+  sendKey("TAB");
+  await SimpleTest.promiseWaitForCondition(() => firstVisibleItem.matches(":focus"),
+    "waiting for firstVisibleItem to get focus");
+  ok(firstVisibleItem.matches(":focus"), "firstVisibleItem should be focused after tabbing to it");
+  synthesizeKey("VK_TAB", { shiftKey: true });
+  await SimpleTest.promiseWaitForCondition(() => !firstVisibleItem.matches(":focus"),
+    "waiting for firstVisibleItem to lose focus");
+  ok(!firstVisibleItem.matches(":focus"), "firstVisibleItem should lose focus after tabbing away from it");
+  sendKey("TAB");
+  await SimpleTest.promiseWaitForCondition(() => firstVisibleItem.matches(":focus"),
+    "waiting for firstVisibleItem to get focus again");
+  ok(firstVisibleItem.matches(":focus"), "firstVisibleItem should be focused after tabbing to it again");
+
+  if (navigator.platform == "Win32") {
+    // The Import menuitem is only visible on Windows, where we will need another Tab
+    // press to get to the Preferences item.
+    let preferencesItem = gMenuButton.shadowRoot.querySelector(".menuitem-preferences");
+    sendKey("DOWN");
+    await SimpleTest.promiseWaitForCondition(() => preferencesItem.matches(":focus"),
+      "waiting for preferencesItem to gain focus");
+    ok(preferencesItem.matches(":focus"), `.menuitem-preferences should be now be focused (DOWN)`);
+    sendKey("UP");
+    await SimpleTest.promiseWaitForCondition(() => !preferencesItem.matches(":focus"),
+      `waiting for preferencesItem to lose focus (UP)`);
+    ok(!preferencesItem.matches(":focus"), `.menuitem-preferences should lose focus after pressing up`);
+
     sendKey("TAB");
+    await SimpleTest.promiseWaitForCondition(() => preferencesItem.matches(":focus"),
+      "waiting for preferencesItem to get focus");
+    ok(preferencesItem.matches(":focus"), ".menuitem-preferences should be focused after tabbing to it");
   }
 
-  await SimpleTest.promiseWaitForCondition(() => feedbackItem.matches(":focus"),
-                                           "waiting for feedbackItem to get focus");
-  ok(feedbackItem.matches(":focus"), ".menuitem-feedback should be focused after tabbing to it");
-
-  let preferencesItem = gMenuButton.shadowRoot.querySelector(".menuitem-preferences");
-  ok(!preferencesItem.matches(":focus"), ".menuitem-preferences should not be focused before tabbing to it");
-  // We will need a third Tab press to get to the Preferences item.
-  sendKey("TAB");
-
-  await SimpleTest.promiseWaitForCondition(() => preferencesItem.matches(":focus"),
-    "waiting for preferencesItem to get focus");
-  ok(preferencesItem.matches(":focus"), ".menuitem-preferences should be focused after tabbing to it");
-
   let openPreferencesEvent = null;
-  is(false, menu.hidden, "menu should be visible before pressing 'space' on .menuitem-preferences");
+  ok(!menu.hidden, "menu should be visible before pressing 'space' on .menuitem-preferences");
   window.addEventListener("AboutLoginsOpenPreferences", event => openPreferencesEvent = event);
   sendKey("SPACE");
   ok(openPreferencesEvent, "AboutLoginsOpenPreferences event should be dispatched after pressing 'space' on .menuitem-preferences");
-  is(true, menu.hidden, "menu should be hidden after pressing 'space' on .menuitem-preferences");
+  ok(menu.hidden, "menu should be hidden after pressing 'space' on .menuitem-preferences");
 });
 </script>
 
 </body>
 </html>
--- a/build/moz.configure/java.configure
+++ b/build/moz.configure/java.configure
@@ -19,16 +19,20 @@ def java_search_paths(host, path):
         return path
     # With no path specified, look for javac and jar in $JAVA_HOME (if set),
     # JDK registery on Windows, and $PATH.
     if 'JAVA_HOME' in environ:
         return [os.path.join(environ['JAVA_HOME'], 'bin')]
     if host.os == 'WINNT':
         for x in get_registry_values(r'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.8\JavaHome', get_32_and_64_bit=True):
             return [os.path.join(x[0], 'bin')]
+    if host.os == 'OSX':
+        home = check_cmd_output('/usr/libexec/java_home', '-v', '1.8', onerror=lambda: '').rstrip()
+        if home:
+            return [os.path.join(home, 'bin')]
     return [environ.get('PATH')]
 
 # Finds the given java tool, failing with a custom error message if we can't
 # find it.
 
 
 @template
 def check_java_tool(tool):
--- a/dom/base/DOMMatrix.cpp
+++ b/dom/base/DOMMatrix.cpp
@@ -155,16 +155,44 @@ already_AddRefed<DOMMatrixReadOnly> DOMM
   };
 
   RefPtr<DOMMatrixReadOnly> rval =
       new DOMMatrixReadOnly(aGlobal.GetAsSupports(), matrixInit.mIs2D.Value());
   rval->SetDataFromMatrixInit(matrixInit);
   return rval.forget();
 }
 
+already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::FromFloat32Array(
+    const GlobalObject& aGlobal, const Float32Array& aArray32,
+    ErrorResult& aRv) {
+  aArray32.ComputeLengthAndData();
+
+  const int length = aArray32.Length();
+  const bool is2D = length == 6;
+  RefPtr<DOMMatrixReadOnly> obj =
+      new DOMMatrixReadOnly(aGlobal.GetAsSupports(), is2D);
+  SetDataInMatrix(obj, aArray32.Data(), length, aRv);
+
+  return obj.forget();
+}
+
+already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::FromFloat64Array(
+    const GlobalObject& aGlobal, const Float64Array& aArray64,
+    ErrorResult& aRv) {
+  aArray64.ComputeLengthAndData();
+
+  const int length = aArray64.Length();
+  const bool is2D = length == 6;
+  RefPtr<DOMMatrixReadOnly> obj =
+      new DOMMatrixReadOnly(aGlobal.GetAsSupports(), is2D);
+  SetDataInMatrix(obj, aArray64.Data(), length, aRv);
+
+  return obj.forget();
+}
+
 already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::Constructor(
     const GlobalObject& aGlobal,
     const Optional<StringOrUnrestrictedDoubleSequence>& aArg,
     ErrorResult& aRv) {
   if (!aArg.WasPassed()) {
     RefPtr<DOMMatrixReadOnly> rval =
         new DOMMatrixReadOnly(aGlobal.GetAsSupports());
     return rval.forget();
@@ -588,16 +616,42 @@ already_AddRefed<DOMMatrix> DOMMatrix::F
 already_AddRefed<DOMMatrix> DOMMatrix::FromMatrix(
     const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit,
     ErrorResult& aRv) {
   RefPtr<DOMMatrix> matrix =
       FromMatrix(aGlobal.GetAsSupports(), aMatrixInit, aRv);
   return matrix.forget();
 }
 
+already_AddRefed<DOMMatrix> DOMMatrix::FromFloat32Array(
+    const GlobalObject& aGlobal, const Float32Array& aArray32,
+    ErrorResult& aRv) {
+  aArray32.ComputeLengthAndData();
+
+  const int length = aArray32.Length();
+  const bool is2D = length == 6;
+  RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D);
+  SetDataInMatrix(obj, aArray32.Data(), length, aRv);
+
+  return obj.forget();
+}
+
+already_AddRefed<DOMMatrix> DOMMatrix::FromFloat64Array(
+    const GlobalObject& aGlobal, const Float64Array& aArray64,
+    ErrorResult& aRv) {
+  aArray64.ComputeLengthAndData();
+
+  const int length = aArray64.Length();
+  const bool is2D = length == 6;
+  RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D);
+  SetDataInMatrix(obj, aArray64.Data(), length, aRv);
+
+  return obj.forget();
+}
+
 already_AddRefed<DOMMatrix> DOMMatrix::Constructor(const GlobalObject& aGlobal,
                                                    ErrorResult& aRv) {
   RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports());
   return obj.forget();
 }
 
 already_AddRefed<DOMMatrix> DOMMatrix::Constructor(
     const GlobalObject& aGlobal, const nsAString& aTransformList,
@@ -651,37 +705,23 @@ static void SetDataInMatrix(DOMMatrixRea
     lengthStr.AppendInt(aLength);
     aRv.ThrowTypeError<MSG_MATRIX_INIT_LENGTH_WRONG>(lengthStr);
   }
 }
 
 already_AddRefed<DOMMatrix> DOMMatrix::Constructor(const GlobalObject& aGlobal,
                                                    const Float32Array& aArray32,
                                                    ErrorResult& aRv) {
-  aArray32.ComputeLengthAndData();
-
-  const int length = aArray32.Length();
-  const bool is2D = length == 6;
-  RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D);
-  SetDataInMatrix(obj, aArray32.Data(), length, aRv);
-
-  return obj.forget();
+  return FromFloat32Array(aGlobal, aArray32, aRv);
 }
 
 already_AddRefed<DOMMatrix> DOMMatrix::Constructor(const GlobalObject& aGlobal,
                                                    const Float64Array& aArray64,
                                                    ErrorResult& aRv) {
-  aArray64.ComputeLengthAndData();
-
-  const int length = aArray64.Length();
-  const bool is2D = length == 6;
-  RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D);
-  SetDataInMatrix(obj, aArray64.Data(), length, aRv);
-
-  return obj.forget();
+  return FromFloat64Array(aGlobal, aArray64, aRv);
 }
 
 already_AddRefed<DOMMatrix> DOMMatrix::Constructor(
     const GlobalObject& aGlobal, const Sequence<double>& aNumberSequence,
     ErrorResult& aRv) {
   const int length = aNumberSequence.Length();
   const bool is2D = length == 6;
   RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D);
--- a/dom/base/DOMMatrix.h
+++ b/dom/base/DOMMatrix.h
@@ -55,16 +55,24 @@ class DOMMatrixReadOnly : public nsWrapp
   nsISupports* GetParentObject() const { return mParent; }
   virtual JSObject* WrapObject(JSContext* cx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
   static already_AddRefed<DOMMatrixReadOnly> FromMatrix(
       const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit,
       ErrorResult& aRv);
 
+  static already_AddRefed<DOMMatrixReadOnly> FromFloat32Array(
+      const GlobalObject& aGlobal, const Float32Array& aArray32,
+      ErrorResult& aRv);
+
+  static already_AddRefed<DOMMatrixReadOnly> FromFloat64Array(
+      const GlobalObject& aGlobal, const Float64Array& aArray64,
+      ErrorResult& aRv);
+
   static already_AddRefed<DOMMatrixReadOnly> Constructor(
       const GlobalObject& aGlobal,
       const Optional<StringOrUnrestrictedDoubleSequence>& aArg,
       ErrorResult& aRv);
 
   static already_AddRefed<DOMMatrixReadOnly> ReadStructuredClone(
       JSContext* aCx, nsIGlobalObject* aGlobal,
       JSStructuredCloneReader* aReader);
@@ -244,16 +252,24 @@ class DOMMatrix : public DOMMatrixReadOn
 
   static already_AddRefed<DOMMatrix> FromMatrix(
       nsISupports* aParent, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv);
 
   static already_AddRefed<DOMMatrix> FromMatrix(
       const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit,
       ErrorResult& aRv);
 
+  static already_AddRefed<DOMMatrix> FromFloat32Array(
+      const GlobalObject& aGlobal, const Float32Array& aArray32,
+      ErrorResult& aRv);
+
+  static already_AddRefed<DOMMatrix> FromFloat64Array(
+      const GlobalObject& aGlobal, const Float64Array& aArray64,
+      ErrorResult& aRv);
+
   static already_AddRefed<DOMMatrix> Constructor(const GlobalObject& aGlobal,
                                                  ErrorResult& aRv);
   static already_AddRefed<DOMMatrix> Constructor(
       const GlobalObject& aGlobal, const nsAString& aTransformList,
       ErrorResult& aRv);
   static already_AddRefed<DOMMatrix> Constructor(
       const GlobalObject& aGlobal, const DOMMatrixReadOnly& aOther,
       ErrorResult& aRv);
--- a/dom/base/DOMQuad.cpp
+++ b/dom/base/DOMQuad.cpp
@@ -31,16 +31,40 @@ DOMQuad::DOMQuad(nsISupports* aParent) :
 
 DOMQuad::~DOMQuad() {}
 
 JSObject* DOMQuad::WrapObject(JSContext* aCx,
                               JS::Handle<JSObject*> aGivenProto) {
   return DOMQuad_Binding::Wrap(aCx, this, aGivenProto);
 }
 
+already_AddRefed<DOMQuad> DOMQuad::FromRect(const GlobalObject& aGlobal,
+                                            const DOMRectInit& aInit) {
+  nsISupports* parent = aGlobal.GetAsSupports();
+  RefPtr<DOMQuad> obj = new DOMQuad(parent);
+  obj->mPoints[0] = new DOMPoint(parent, aInit.mX, aInit.mY, 0, 1);
+  obj->mPoints[1] =
+      new DOMPoint(parent, aInit.mX + aInit.mWidth, aInit.mY, 0, 1);
+  obj->mPoints[2] = new DOMPoint(parent, aInit.mX + aInit.mWidth,
+                                 aInit.mY + aInit.mHeight, 0, 1);
+  obj->mPoints[3] =
+      new DOMPoint(parent, aInit.mX, aInit.mY + aInit.mHeight, 0, 1);
+  return obj.forget();
+}
+
+already_AddRefed<DOMQuad> DOMQuad::FromQuad(const GlobalObject& aGlobal,
+                                            const DOMQuadInit& aInit) {
+  RefPtr<DOMQuad> obj = new DOMQuad(aGlobal.GetAsSupports());
+  obj->mPoints[0] = DOMPoint::FromPoint(aGlobal, aInit.mP1);
+  obj->mPoints[1] = DOMPoint::FromPoint(aGlobal, aInit.mP2);
+  obj->mPoints[2] = DOMPoint::FromPoint(aGlobal, aInit.mP3);
+  obj->mPoints[3] = DOMPoint::FromPoint(aGlobal, aInit.mP4);
+  return obj.forget();
+}
+
 already_AddRefed<DOMQuad> DOMQuad::Constructor(const GlobalObject& aGlobal,
                                                const DOMPointInit& aP1,
                                                const DOMPointInit& aP2,
                                                const DOMPointInit& aP3,
                                                const DOMPointInit& aP4,
                                                ErrorResult& aRV) {
   RefPtr<DOMQuad> obj = new DOMQuad(aGlobal.GetAsSupports());
   obj->mPoints[0] = DOMPoint::FromPoint(aGlobal, aP1);
--- a/dom/base/DOMQuad.h
+++ b/dom/base/DOMQuad.h
@@ -20,31 +20,38 @@
 class nsIGlobalObject;
 
 namespace mozilla {
 namespace dom {
 
 class DOMRectReadOnly;
 class DOMPoint;
 struct DOMPointInit;
+struct DOMQuadInit;
 
 class DOMQuad final : public nsWrapperCache {
   ~DOMQuad();
 
  public:
   DOMQuad(nsISupports* aParent, CSSPoint aPoints[4]);
   explicit DOMQuad(nsISupports* aParent);
 
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMQuad)
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMQuad)
 
   nsISupports* GetParentObject() const { return mParent; }
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
+  static already_AddRefed<DOMQuad> FromRect(const GlobalObject& aGlobal,
+                                            const DOMRectInit& aInit);
+
+  static already_AddRefed<DOMQuad> FromQuad(const GlobalObject& aGlobal,
+                                            const DOMQuadInit& aInit);
+
   static already_AddRefed<DOMQuad> Constructor(const GlobalObject& aGlobal,
                                                const DOMPointInit& aP1,
                                                const DOMPointInit& aP2,
                                                const DOMPointInit& aP3,
                                                const DOMPointInit& aP4,
                                                ErrorResult& aRV);
   static already_AddRefed<DOMQuad> Constructor(const GlobalObject& aGlobal,
                                                const DOMRectReadOnly& aRect,
--- a/dom/base/DOMRect.cpp
+++ b/dom/base/DOMRect.cpp
@@ -22,16 +22,23 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
 NS_INTERFACE_MAP_END
 
 JSObject* DOMRectReadOnly::WrapObject(JSContext* aCx,
                                       JS::Handle<JSObject*> aGivenProto) {
   MOZ_ASSERT(mParent);
   return DOMRectReadOnly_Binding::Wrap(aCx, this, aGivenProto);
 }
 
+already_AddRefed<DOMRectReadOnly> DOMRectReadOnly::FromRect(
+    const GlobalObject& aGlobal, const DOMRectInit& aInit) {
+  RefPtr<DOMRectReadOnly> obj = new DOMRectReadOnly(
+      aGlobal.GetAsSupports(), aInit.mX, aInit.mY, aInit.mWidth, aInit.mHeight);
+  return obj.forget();
+}
+
 already_AddRefed<DOMRectReadOnly> DOMRectReadOnly::Constructor(
     const GlobalObject& aGlobal, double aX, double aY, double aWidth,
     double aHeight, ErrorResult& aRv) {
   RefPtr<DOMRectReadOnly> obj =
       new DOMRectReadOnly(aGlobal.GetAsSupports(), aX, aY, aWidth, aHeight);
   return obj.forget();
 }
 
@@ -82,16 +89,23 @@ bool DOMRectReadOnly::ReadStructuredClon
 // -----------------------------------------------------------------------------
 
 JSObject* DOMRect::WrapObject(JSContext* aCx,
                               JS::Handle<JSObject*> aGivenProto) {
   MOZ_ASSERT(mParent);
   return DOMRect_Binding::Wrap(aCx, this, aGivenProto);
 }
 
+already_AddRefed<DOMRect> DOMRect::FromRect(const GlobalObject& aGlobal,
+                                            const DOMRectInit& aInit) {
+  RefPtr<DOMRect> obj = new DOMRect(aGlobal.GetAsSupports(), aInit.mX, aInit.mY,
+                                    aInit.mWidth, aInit.mHeight);
+  return obj.forget();
+}
+
 already_AddRefed<DOMRect> DOMRect::Constructor(const GlobalObject& aGlobal,
                                                double aX, double aY,
                                                double aWidth, double aHeight,
                                                ErrorResult& aRv) {
   RefPtr<DOMRect> obj =
       new DOMRect(aGlobal.GetAsSupports(), aX, aY, aWidth, aHeight);
   return obj.forget();
 }
--- a/dom/base/DOMRect.h
+++ b/dom/base/DOMRect.h
@@ -18,16 +18,18 @@
 #include <algorithm>
 
 struct nsRect;
 class nsIGlobalObject;
 
 namespace mozilla {
 namespace dom {
 
+struct DOMRectInit;
+
 class DOMRectReadOnly : public nsISupports, public nsWrapperCache {
  protected:
   virtual ~DOMRectReadOnly() {}
 
  public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMRectReadOnly)
 
@@ -38,16 +40,19 @@ class DOMRectReadOnly : public nsISuppor
   nsISupports* GetParentObject() const {
     MOZ_ASSERT(mParent);
     return mParent;
   }
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
+  static already_AddRefed<DOMRectReadOnly> FromRect(const GlobalObject& aGlobal,
+                                                    const DOMRectInit& aInit);
+
   static already_AddRefed<DOMRectReadOnly> Constructor(
       const GlobalObject& aGlobal, double aX, double aY, double aWidth,
       double aHeight, ErrorResult& aRv);
 
   double X() const { return mX; }
   double Y() const { return mY; }
   double Width() const { return mWidth; }
   double Height() const { return mHeight; }
@@ -88,16 +93,19 @@ class DOMRectReadOnly : public nsISuppor
 class DOMRect final : public DOMRectReadOnly {
  public:
   explicit DOMRect(nsISupports* aParent, double aX = 0, double aY = 0,
                    double aWidth = 0, double aHeight = 0)
       : DOMRectReadOnly(aParent, aX, aY, aWidth, aHeight) {}
 
   NS_INLINE_DECL_REFCOUNTING_INHERITED(DOMRect, DOMRectReadOnly)
 
+  static already_AddRefed<DOMRect> FromRect(const GlobalObject& aGlobal,
+                                            const DOMRectInit& aInit);
+
   static already_AddRefed<DOMRect> Constructor(const GlobalObject& aGlobal,
                                                double aX, double aY,
                                                double aWidth, double aHeight,
                                                ErrorResult& aRv);
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
--- a/dom/canvas/WebGLContext.h
+++ b/dom/canvas/WebGLContext.h
@@ -1091,16 +1091,19 @@ class WebGLContext : public nsICanvasRen
   std::vector<IndexedBufferBinding> mIndexedUniformBufferBindings;
 
   WebGLRefPtr<WebGLBuffer>& GetBufferSlotByTarget(GLenum target);
   WebGLRefPtr<WebGLBuffer>& GetBufferSlotByTargetIndexed(GLenum target,
                                                          GLuint index);
 
   // -
 
+  void GenErrorIllegalUse(GLenum useTarget, uint32_t useId, GLenum boundTarget,
+                          uint32_t boundId) const;
+
   bool ValidateBufferForNonTf(const WebGLBuffer&, GLenum nonTfTarget,
                               uint32_t nonTfId) const;
 
   bool ValidateBufferForNonTf(const WebGLBuffer* const nonTfBuffer,
                               const GLenum nonTfTarget,
                               const uint32_t nonTfId = -1) const {
     if (!nonTfBuffer) return true;
     return ValidateBufferForNonTf(*nonTfBuffer, nonTfTarget, nonTfId);
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -197,33 +197,33 @@ bool WebGLContext::ValidateStencilParams
         " [0, (2^s)-1], where `s` is the number of enabled stencil"
         " bits in the draw framebuffer)");
   }
   return ok;
 }
 
 // -
 
-static void GenErrorIllegalUse(const WebGLContext& webgl,
-                               const GLenum useTarget, const uint32_t useId,
-                               const GLenum boundTarget,
-                               const uint32_t boundId) {
+void WebGLContext::GenErrorIllegalUse(const GLenum useTarget,
+                                      const uint32_t useId,
+                                      const GLenum boundTarget,
+                                      const uint32_t boundId) const {
   const auto fnName = [&](const GLenum target, const uint32_t id) {
     auto name = nsCString(EnumString(target).c_str());
     if (id != static_cast<uint32_t>(-1)) {
       name += nsPrintfCString("[%u]", id);
     }
     return name;
   };
   const auto& useName = fnName(useTarget, useId);
   const auto& boundName = fnName(boundTarget, boundId);
-  webgl.GenerateError(LOCAL_GL_INVALID_OPERATION,
-                      "Illegal use of buffer at %s"
-                      " while also bound to %s.",
-                      useName.BeginReading(), boundName.BeginReading());
+  GenerateError(LOCAL_GL_INVALID_OPERATION,
+                "Illegal use of buffer at %s"
+                " while also bound to %s.",
+                useName.BeginReading(), boundName.BeginReading());
 }
 
 bool WebGLContext::ValidateBufferForNonTf(const WebGLBuffer& nonTfBuffer,
                                           const GLenum nonTfTarget,
                                           const uint32_t nonTfId) const {
   bool dupe = false;
   const auto& tfAttribs = mBoundTransformFeedback->mIndexedBindings;
   for (const auto& cur : tfAttribs) {
@@ -231,17 +231,17 @@ bool WebGLContext::ValidateBufferForNonT
   }
   if (MOZ_LIKELY(!dupe)) return true;
 
   dupe = false;
   for (const auto tfId : IntegerRange(tfAttribs.size())) {
     const auto& tfBuffer = tfAttribs[tfId].mBufferBinding;
     if (&nonTfBuffer == tfBuffer) {
       dupe = true;
-      GenErrorIllegalUse(*this, nonTfTarget, nonTfId,
+      GenErrorIllegalUse(nonTfTarget, nonTfId,
                          LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER, tfId);
     }
   }
   MOZ_ASSERT(dupe);
   return false;
 }
 
 bool WebGLContext::ValidateBuffersForTf(
@@ -280,17 +280,17 @@ bool WebGLContext::ValidateBuffersForTf(
       dupe |= (nonTf && tf.buffer == nonTf);
     }
 
     if (MOZ_LIKELY(!dupe)) return false;
 
     for (const auto& tf : tfBuffers) {
       if (nonTf && tf.buffer == nonTf) {
         dupe = true;
-        GenErrorIllegalUse(*this, LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER, tf.id,
+        GenErrorIllegalUse(LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER, tf.id,
                            nonTfTarget, nonTfId);
       }
     }
     return true;
   };
 
   fnCheck(mBoundArrayBuffer.get(), LOCAL_GL_ARRAY_BUFFER, -1);
   fnCheck(mBoundCopyReadBuffer.get(), LOCAL_GL_COPY_READ_BUFFER, -1);
--- a/dom/canvas/WebGLTexture.cpp
+++ b/dom/canvas/WebGLTexture.cpp
@@ -630,28 +630,42 @@ static bool ZeroTextureData(const WebGLC
   ScopedUnpackReset scopedReset(webgl);
   gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT,
                    1);  // Don't bother with striding it well.
   const auto error = DoTexSubImage(gl, target, level, 0, 0, 0, width, height,
                                    depth, packing, zeros.get());
   return !error;
 }
 
+template <typename T, typename R>
+static R Clamp(const T val, const R min, const R max) {
+  if (val < min) return min;
+  if (val > max) return max;
+  return static_cast<R>(val);
+}
+
+template <typename T, typename A, typename B>
+static void ClampSelf(T* const out, const A min, const B max) {
+  if (*out < min) {
+    *out = T{min};
+  } else if (*out > max) {
+    *out = T{max};
+  }
+}
+
 void WebGLTexture::ClampLevelBaseAndMax() {
   if (!mImmutable) return;
 
   // GLES 3.0.4, p158:
   // "For immutable-format textures, `level_base` is clamped to the range
   //  `[0, levels-1]`, `level_max` is then clamped to the range `
   //  `[level_base, levels-1]`, where `levels` is the parameter passed to
   //   TexStorage* for the texture object."
-  mBaseMipmapLevel =
-      Clamp<uint32_t>(mBaseMipmapLevel, 0, mImmutableLevelCount - 1);
-  mMaxMipmapLevel = Clamp<uint32_t>(mMaxMipmapLevel, mBaseMipmapLevel,
-                                    mImmutableLevelCount - 1);
+  ClampSelf(&mBaseMipmapLevel, 0u, mImmutableLevelCount - 1u);
+  ClampSelf(&mMaxMipmapLevel, mBaseMipmapLevel, mImmutableLevelCount - 1u);
 
   // Note: This means that immutable textures are *always* texture-complete!
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
 // GL calls
 
 bool WebGLTexture::BindTexture(TexTarget texTarget) {
@@ -975,27 +989,32 @@ void WebGLTexture::TexParameter(TexTarge
   }
 
   ////////////////
   // Store any needed values
 
   FloatOrInt clamped = param;
   bool invalidate = true;
   switch (pname) {
-    case LOCAL_GL_TEXTURE_BASE_LEVEL:
+    case LOCAL_GL_TEXTURE_BASE_LEVEL: {
       mBaseMipmapLevel = clamped.i;
       ClampLevelBaseAndMax();
-      clamped = FloatOrInt(GLint(mBaseMipmapLevel));
+      const auto forDriver =
+          Clamp(mBaseMipmapLevel, uint8_t{0}, kMaxLevelCount);
+      clamped = FloatOrInt(forDriver);
       break;
+    }
 
-    case LOCAL_GL_TEXTURE_MAX_LEVEL:
+    case LOCAL_GL_TEXTURE_MAX_LEVEL: {
       mMaxMipmapLevel = clamped.i;
       ClampLevelBaseAndMax();
-      clamped = FloatOrInt(GLint(mMaxMipmapLevel));
+      const auto forDriver = Clamp(mMaxMipmapLevel, uint8_t{0}, kMaxLevelCount);
+      clamped = FloatOrInt(forDriver);
       break;
+    }
 
     case LOCAL_GL_TEXTURE_MIN_FILTER:
       mSamplingState.minFilter = clamped.i;
       break;
 
     case LOCAL_GL_TEXTURE_MAG_FILTER:
       mSamplingState.magFilter = clamped.i;
       break;
--- a/dom/canvas/WebGLTransformFeedback.cpp
+++ b/dom/canvas/WebGLTransformFeedback.cpp
@@ -2,16 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WebGLTransformFeedback.h"
 
 #include "GLContext.h"
 #include "mozilla/dom/WebGL2RenderingContextBinding.h"
+#include "mozilla/IntegerRange.h"
 #include "WebGL2Context.h"
 #include "WebGLProgram.h"
 
 namespace mozilla {
 
 WebGLTransformFeedback::WebGLTransformFeedback(WebGLContext* webgl, GLuint tf)
     : WebGLRefCountedObject(webgl),
       mGLName(tf),
@@ -68,16 +69,26 @@ void WebGLTransformFeedback::BeginTransf
     if (!buffer) {
       mContext->ErrorInvalidOperation(
           "No buffer attached to required transform"
           " feedback index %u.",
           (uint32_t)i);
       return;
     }
 
+    for (const auto iBound : IntegerRange(mIndexedBindings.size())) {
+      const auto& bound = mIndexedBindings[iBound].mBufferBinding.get();
+      if (iBound != i && buffer == bound) {
+        mContext->GenErrorIllegalUse(
+            LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER, static_cast<uint32_t>(i),
+            LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER, static_cast<uint32_t>(iBound));
+        return;
+      }
+    }
+
     const size_t vertCapacity = buffer->ByteLength() / 4 / componentsPerVert;
     minVertCapacity = std::min(minVertCapacity, vertCapacity);
   }
 
   ////
 
   const auto& gl = mContext->gl;
   gl->fBeginTransformFeedback(primMode);
--- a/dom/canvas/test/webgl-conf/generated-mochitest.ini
+++ b/dom/canvas/test/webgl-conf/generated-mochitest.ini
@@ -7376,18 +7376,16 @@ subsuite = webgl2-ext
 [generated/test_2_conformance2__textures__webgl_canvas__tex-3d-srgb8_alpha8-rgba-unsigned_byte.html]
 subsuite = webgl2-ext
 [generated/test_2_conformance2__transform_feedback__default_transform_feedback.html]
 subsuite = webgl2-core
 [generated/test_2_conformance2__transform_feedback__non-existent-varying.html]
 subsuite = webgl2-core
 [generated/test_2_conformance2__transform_feedback__same-buffer-two-binding-points.html]
 subsuite = webgl2-core
-fail-if = 1
-skip-if = (os == 'win')
 [generated/test_2_conformance2__transform_feedback__simultaneous_binding.html]
 subsuite = webgl2-core
 [generated/test_2_conformance2__transform_feedback__switching-objects.html]
 subsuite = webgl2-core
 [generated/test_2_conformance2__transform_feedback__too-small-buffers.html]
 subsuite = webgl2-core
 skip-if = 1
 [generated/test_2_conformance2__transform_feedback__transform_feedback.html]
@@ -7431,17 +7429,16 @@ subsuite = webgl2-core
 [generated/test_2_conformance__attribs__gl-matrix-attributes.html]
 subsuite = webgl2-core
 [generated/test_2_conformance__attribs__gl-vertex-attrib-context-switch.html]
 subsuite = webgl2-core
 [generated/test_2_conformance__attribs__gl-vertex-attrib-render.html]
 subsuite = webgl2-core
 [generated/test_2_conformance__attribs__gl-vertex-attrib-unconsumed-out-of-bounds.html]
 subsuite = webgl2-core
-skip-if = (os == 'mac')
 [generated/test_2_conformance__attribs__gl-vertex-attrib-zero-issues.html]
 subsuite = webgl2-core
 [generated/test_2_conformance__attribs__gl-vertexattribpointer-offsets.html]
 subsuite = webgl2-core
 [generated/test_2_conformance__attribs__gl-vertexattribpointer.html]
 subsuite = webgl2-core
 [generated/test_2_conformance__buffers__buffer-bind-test.html]
 subsuite = webgl2-core
@@ -10754,17 +10751,16 @@ subsuite = webgl1-core
 [generated/test_conformance__attribs__gl-matrix-attributes.html]
 subsuite = webgl1-core
 [generated/test_conformance__attribs__gl-vertex-attrib-context-switch.html]
 subsuite = webgl1-core
 [generated/test_conformance__attribs__gl-vertex-attrib-render.html]
 subsuite = webgl1-core
 [generated/test_conformance__attribs__gl-vertex-attrib-unconsumed-out-of-bounds.html]
 subsuite = webgl1-core
-skip-if = (os == 'mac')
 [generated/test_conformance__attribs__gl-vertex-attrib-zero-issues.html]
 subsuite = webgl1-core
 [generated/test_conformance__attribs__gl-vertex-attrib.html]
 subsuite = webgl1-core
 [generated/test_conformance__attribs__gl-vertexattribpointer-offsets.html]
 subsuite = webgl1-core
 [generated/test_conformance__attribs__gl-vertexattribpointer.html]
 subsuite = webgl1-core
--- a/dom/canvas/test/webgl-conf/mochitest-errata.ini
+++ b/dom/canvas/test/webgl-conf/mochitest-errata.ini
@@ -171,20 +171,16 @@ fail-if = 1
 fail-if = 1
 [generated/test_2_conformance2__textures__video__tex-2d-rgb10_a2-rgba-unsigned_int_2_10_10_10_rev.html]
 fail-if = 1
 [generated/test_2_conformance2__textures__video__tex-3d-rgb10_a2-rgba-unsigned_int_2_10_10_10_rev.html]
 fail-if = 1
 
 [generated/test_2_conformance2__textures__misc__tex-unpack-params-with-flip-y-and-premultiply-alpha.html]
 fail-if = 1
-[generated/test_2_conformance2__transform_feedback__same-buffer-two-binding-points.html]
-fail-if = 1
-# ABORT_ON_ERROR from ANGLE
-skip-if = (os == 'win')
 
 ########################################################################
 # Complicated
 
 [generated/test_conformance__context__context-attributes-alpha-depth-stencil-antialias.html]
 # Asserts on linux debug. Crashes on Android.
 skip-if = (os == 'linux') || (os == 'android')
 
@@ -643,33 +639,16 @@ skip-if = (os == 'mac')
 # New OSX r7 machines and 10.10.5 is causing perma failure (bug 1216549)
 skip-if = (os == 'mac')
 [generated/test_conformance__rendering__multisample-corruption.html]
 # application crashed [@ gldAttachDrawable + 0x9e0]. Also crash on Android.
 skip-if = (os == 'mac') || (os == 'android') || (os == 'win')
 [generated/test_2_conformance__textures__misc__copy-tex-image-2d-formats.html]
 # Assertion: ""GFX: We should have caught all other errors"" in WebGLTextureUpload.cpp
 skip-if = (os == 'mac')
-[generated/test_2_conformance__attribs__gl-vertex-attrib-unconsumed-out-of-bounds.html]
-#19:23:02     INFO -  6  GLEngine + 0x5584f
-#19:23:02     INFO -     rbp = 0x00007fff57356440   rsp = 0x00007fff57356430
-#19:23:02     INFO -     rip = 0x00007fff969ab84f
-#19:23:02     INFO -     Found by: previous frame's frame pointer
-#19:23:02     INFO -  7  XUL!mozilla::gl::GLContext::AfterGLCall_Debug(char const*) const [GLContext.cpp:6c8751f7f673a9751917d907e630d37abefe186b : 3013 + 0x6]
-#19:23:02     INFO -     rbp = 0x00007fff57356470   rsp = 0x00007fff57356450
-#19:23:02     INFO -     rip = 0x0000000109aff123
-#19:23:02     INFO -     Found by: previous frame's frame pointer
-#19:23:02     INFO -  8  XUL!mozilla::WebGLContext::DrawArraysInstanced(unsigned int, int, int, int, char const*) [GLContext.h:6c8751f7f673a9751917d907e630d37abefe186b : 2419 + 0x15]
-#19:23:02     INFO -     rbx = 0x0000000111820000   rbp = 0x00007fff57356550
-#19:23:02     INFO -     rsp = 0x00007fff57356480   r14 = 0x000000010efbbd99
-#19:23:02     INFO -     r15 = 0x0000000000000003   rip = 0x000000010b0b61ef
-#19:23:02     INFO -     Found by: call frame info
-skip-if = (os == 'mac')
-[generated/test_conformance__attribs__gl-vertex-attrib-unconsumed-out-of-bounds.html]
-skip-if = (os == 'mac')
 [generated/test_2_conformance2__textures__misc__generate-mipmap-with-large-base-level.html]
 # getError expected: NO_ERROR. Was OUT_OF_MEMORY
 fail-if = (os == 'mac')
 [generated/test_2_conformance2__textures__misc__tex-unpack-params-imagedata.html]
 # areArraysEqual(actual, expected) should be true. Was false.
 fail-if = (os == 'mac')
 
 ####################
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1549,18 +1549,17 @@ void ContentParent::ProcessingError(Resu
   }
 #ifndef FUZZING
   // Other errors are big deals.
   KillHard(aReason);
 #endif
 }
 
 void ContentParent::ActorDestroy(ActorDestroyReason why) {
-  RefPtr<ContentParent> kungFuDeathGrip(mSelfRef.forget());
-  MOZ_RELEASE_ASSERT(kungFuDeathGrip);
+  MOZ_RELEASE_ASSERT(mSelfRef);
 
   if (mForceKillTimer) {
     mForceKillTimer->Cancel();
     mForceKillTimer = nullptr;
   }
 
   // Signal shutdown completion regardless of error state, so we can
   // finish waiting in the xpcom-shutdown/profile-before-change observer.
@@ -1662,26 +1661,16 @@ void ContentParent::ActorDestroy(ActorDe
   // Delete any remaining replaying children.
   for (auto& replayingProcess : mReplayingChildren) {
     if (replayingProcess) {
       replayingProcess->Destroy();
       replayingProcess = nullptr;
     }
   }
 
-  // IPDL rules require actors to live on past ActorDestroy, but it
-  // may be that the kungFuDeathGrip above is the last reference to
-  // |this|.  If so, when we go out of scope here, we're deleted and
-  // all hell breaks loose.
-  //
-  // This runnable ensures that a reference to |this| lives on at
-  // least until after the current task finishes running.
-  NS_DispatchToCurrentThread(NS_NewRunnableFunction(
-      "DelayedReleaseContentParent", [kungFuDeathGrip] {}));
-
   ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
   nsTArray<ContentParentId> childIDArray =
       cpm->GetAllChildProcessById(this->ChildID());
 
   // Destroy any processes created by this ContentParent
   for (uint32_t i = 0; i < childIDArray.Length(); i++) {
     ContentParent* cp = cpm->GetContentProcessById(childIDArray[i]);
     MessageLoop::current()->PostTask(NewRunnableMethod<ShutDownMethod>(
@@ -1710,16 +1699,18 @@ void ContentParent::ActorDestroy(ActorDe
 
   for (auto iter = groups.Iter(); !iter.Done(); iter.Next()) {
     iter.Get()->GetKey()->Unsubscribe(this);
   }
 
   MOZ_DIAGNOSTIC_ASSERT(mGroups.IsEmpty());
 }
 
+void ContentParent::ActorDealloc() { mSelfRef = nullptr; }
+
 bool ContentParent::TryToRecycle() {
   // This life time check should be replaced by a memory health check (memory
   // usage + fragmentation).
   const double kMaxLifeSpan = 5;
   if (mShutdownPending || mCalledKillHard || !IsAlive() ||
       !mRemoteType.EqualsLiteral(DEFAULT_REMOTE_TYPE) ||
       (TimeStamp::Now() - mActivateTS).ToSeconds() > kMaxLifeSpan ||
       !PreallocatedProcessManager::Provide(this)) {
@@ -2129,17 +2120,17 @@ void ContentParent::LaunchSubprocessInte
   RefPtr<ContentParent> self(this);
 
   auto reject = [self, this](GeckoChildProcessHost::LaunchError err) {
     NS_ERROR("failed to launch child in the parent");
     MarkAsDead();
     return LaunchPromise::CreateAndReject(err, __func__);
   };
 
-  // See also ActorDestroy.
+  // See also ActorDealloc.
   mSelfRef = this;
 
   // Lifetime note: the GeckoChildProcessHost holds a strong reference
   // to the launch promise, which takes ownership of these closures,
   // which hold strong references to this ContentParent; the
   // ContentParent then owns the GeckoChildProcessHost (and that
   // ownership is not exposed to the cycle collector).  Therefore,
   // this all stays alive until the promise is resolved or rejected.
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -641,17 +641,18 @@ class ContentParent final : public PCont
       BrowsingContext* aContext, const ClonedMessageData& aMessage,
       const PostMessageData& aData);
 
   FORWARD_SHMEM_ALLOCATOR_TO(PContentParent)
 
  protected:
   void OnChannelConnected(int32_t pid) override;
 
-  virtual void ActorDestroy(ActorDestroyReason why) override;
+  void ActorDestroy(ActorDestroyReason why) override;
+  void ActorDealloc() override;
 
   bool ShouldContinueFromReplyTimeout() override;
 
   void OnVarChanged(const GfxVarUpdate& aVar) override;
   void OnCompositorUnexpectedShutdown() override;
 
  private:
   /**
@@ -1209,17 +1210,17 @@ class ContentParent final : public PCont
   void OnBrowsingContextGroupSubscribe(BrowsingContextGroup* aGroup);
   void OnBrowsingContextGroupUnsubscribe(BrowsingContextGroup* aGroup);
 
   void UpdateNetworkLinkType();
 
   static bool ShouldSyncPreference(const char16_t* aData);
 
  private:
-  // Released in ActorDestroy; deliberately not exposed to the CC.
+  // Released in ActorDealloc; deliberately not exposed to the CC.
   RefPtr<ContentParent> mSelfRef;
 
   // If you add strong pointers to cycle collected objects here, be sure to
   // release these objects in ShutDownProcess.  See the comment there for more
   // details.
 
   GeckoChildProcessHost* mSubprocess;
   const TimeStamp mLaunchTS;  // used to calculate time to start content process
--- a/dom/vr/VRServiceTest.cpp
+++ b/dom/vr/VRServiceTest.cpp
@@ -626,29 +626,21 @@ void VRServiceTest::ClearController(uint
   MOZ_ASSERT(aControllerIdx < kVRControllerMaxCount);
   mPendingState.controllerState[aControllerIdx].Clear();
   mEncodedState.controllerState[aControllerIdx].Clear();
   AddCommand((uint64_t)VRPuppet_Command::VRPuppet_ClearController |
              (uint64_t)aControllerIdx);
 }
 
 void VRServiceTest::Timeout(uint32_t aDuration) {
-  // Clamp to 32-bit unsigned value
-  if (aDuration > 0xffffffff) {
-    aDuration = 0xffffffff;
-  }
   AddCommand((uint64_t)VRPuppet_Command::VRPuppet_Timeout |
              (uint64_t)aDuration);
 }
 
 void VRServiceTest::Wait(uint32_t aDuration) {
-  // Clamp to 32-bit unsigned value
-  if (aDuration > 0xffffffff) {
-    aDuration = 0xffffffff;
-  }
   AddCommand((uint64_t)VRPuppet_Command::VRPuppet_Wait | (uint64_t)aDuration);
 }
 
 void VRServiceTest::WaitHapticIntensity(uint32_t aControllerIdx,
                                         uint32_t aHapticIdx, double aIntensity,
                                         ErrorResult& aRv) {
   if (aControllerIdx >= kVRControllerMaxCount) {
     aRv.Throw(NS_ERROR_INVALID_ARG);
--- a/dom/webidl/DOMMatrix.webidl
+++ b/dom/webidl/DOMMatrix.webidl
@@ -11,16 +11,19 @@
  */
 
 [Pref="layout.css.DOMMatrix.enabled",
  Constructor(optional (DOMString or sequence<unrestricted double>) init),
  Exposed=(Window,Worker),
  Serializable]
 interface DOMMatrixReadOnly {
     [NewObject, Throws] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other);
+    [NewObject, Throws] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32);
+    [NewObject, Throws] static DOMMatrixReadOnly fromFloat64Array(Float64Array array64);
+
 
     // These attributes are simple aliases for certain elements of the 4x4 matrix
     readonly attribute unrestricted double a;
     readonly attribute unrestricted double b;
     readonly attribute unrestricted double c;
     readonly attribute unrestricted double d;
     readonly attribute unrestricted double e;
     readonly attribute unrestricted double f;
@@ -90,16 +93,19 @@ interface DOMMatrixReadOnly {
  Constructor(DOMMatrixReadOnly other),
  Constructor(Float32Array array32),
  Constructor(Float64Array array64),
  Constructor(sequence<unrestricted double> numberSequence),
  Exposed=(Window,Worker),
  Serializable]
 interface DOMMatrix : DOMMatrixReadOnly {
     [NewObject, Throws] static DOMMatrix fromMatrix(optional DOMMatrixInit other);
+    [NewObject, Throws] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32);
+    [NewObject, Throws] static DOMMatrixReadOnly fromFloat64Array(Float64Array array64);
+
 
     // These attributes are simple aliases for certain elements of the 4x4 matrix
     inherit attribute unrestricted double a;
     inherit attribute unrestricted double b;
     inherit attribute unrestricted double c;
     inherit attribute unrestricted double d;
     inherit attribute unrestricted double e;
     inherit attribute unrestricted double f;
--- a/dom/webidl/DOMQuad.webidl
+++ b/dom/webidl/DOMQuad.webidl
@@ -12,23 +12,26 @@
 
 [Pref="layout.css.DOMQuad.enabled",
  Constructor(optional DOMPointInit p1, optional DOMPointInit p2,
              optional DOMPointInit p3, optional DOMPointInit p4),
  Constructor(DOMRectReadOnly rect),
  Exposed=(Window,Worker),
  Serializable]
 interface DOMQuad {
+    [NewObject] static DOMQuad fromRect(optional DOMRectInit other);
+    [NewObject] static DOMQuad fromQuad(optional DOMQuadInit other);
+
     [SameObject] readonly attribute DOMPoint p1;
     [SameObject] readonly attribute DOMPoint p2;
     [SameObject] readonly attribute DOMPoint p3;
     [SameObject] readonly attribute DOMPoint p4;
     [NewObject] DOMRectReadOnly getBounds();
 
     [Default] object toJSON();
 };
 
 dictionary DOMQuadInit {
-    DOMPointInit p1;
-    DOMPointInit p2;
-    DOMPointInit p3;
-    DOMPointInit p4;
+    DOMPointInit p1 = null;
+    DOMPointInit p2 = null;
+    DOMPointInit p3 = null;
+    DOMPointInit p4 = null;
 };
--- a/dom/webidl/DOMRect.webidl
+++ b/dom/webidl/DOMRect.webidl
@@ -10,28 +10,32 @@
  * liability, trademark and document use rules apply.
  */
 
 [Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
              optional unrestricted double width = 0, optional unrestricted double height = 0),
  Exposed=(Window,Worker),
  Serializable]
 interface DOMRect : DOMRectReadOnly {
+    [NewObject] static DOMRect fromRect(optional DOMRectInit other);
+
     inherit attribute unrestricted double x;
     inherit attribute unrestricted double y;
     inherit attribute unrestricted double width;
     inherit attribute unrestricted double height;
 };
 
 [ProbablyShortLivingWrapper,
  Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
              optional unrestricted double width = 0, optional unrestricted double height = 0),
  Exposed=(Window,Worker),
  Serializable]
 interface DOMRectReadOnly {
+    [NewObject] static DOMRectReadOnly fromRect(optional DOMRectInit other);
+
     readonly attribute unrestricted double x;
     readonly attribute unrestricted double y;
     readonly attribute unrestricted double width;
     readonly attribute unrestricted double height;
     readonly attribute unrestricted double top;
     readonly attribute unrestricted double right;
     readonly attribute unrestricted double bottom;
     readonly attribute unrestricted double left;
--- a/gfx/vr/VRPuppetCommandBuffer.cpp
+++ b/gfx/vr/VRPuppetCommandBuffer.cpp
@@ -1,512 +1,512 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "VRPuppetCommandBuffer.h"
-#include "prthread.h"
-#include "mozilla/ClearOnShutdown.h"
-
-namespace mozilla {
-namespace gfx {
-
-static StaticRefPtr<VRPuppetCommandBuffer> sVRPuppetCommandBufferSingleton;
-
-VRPuppetCommandBuffer& VRPuppetCommandBuffer::Get() {
-  if (sVRPuppetCommandBufferSingleton == nullptr) {
-    sVRPuppetCommandBufferSingleton = new VRPuppetCommandBuffer();
-    ClearOnShutdown(&sVRPuppetCommandBufferSingleton);
-  }
-  return *sVRPuppetCommandBufferSingleton;
-}
-
-VRPuppetCommandBuffer::VRPuppetCommandBuffer()
-    : mMutex("VRPuppetCommandBuffer::mMutex") {
-  MOZ_COUNT_CTOR(VRPuppetCommandBuffer);
-  MOZ_ASSERT(sVRPuppetCommandBufferSingleton == nullptr);
-  Reset();
-}
-
-VRPuppetCommandBuffer::~VRPuppetCommandBuffer() {
-  MOZ_COUNT_DTOR(VRPuppetCommandBuffer);
-}
-
-void VRPuppetCommandBuffer::Submit(const InfallibleTArray<uint64_t>& aBuffer) {
-  MutexAutoLock lock(mMutex);
-  mBuffer.AppendElements(aBuffer);
-  mEnded = false;
-  mEndedWithTimeout = false;
-}
-
-bool VRPuppetCommandBuffer::HasEnded() {
-  MutexAutoLock lock(mMutex);
-  return mEnded;
-}
-
-void VRPuppetCommandBuffer::Reset() {
-  MutexAutoLock lock(mMutex);
-  memset(&mPendingState, 0, sizeof(VRSystemState));
-  memset(&mCommittedState, 0, sizeof(VRSystemState));
-  for (int iControllerIdx = 0; iControllerIdx < kVRControllerMaxCount;
-       iControllerIdx++) {
-    for (int iHaptic = 0; iHaptic < kNumPuppetHaptics; iHaptic++) {
-      mHapticPulseRemaining[iControllerIdx][iHaptic] = 0.0f;
-      mHapticPulseIntensity[iControllerIdx][iHaptic] = 0.0f;
-    }
-  }
-  mDataOffset = 0;
-  mPresentationRequested = false;
-  mFrameSubmitted = false;
-  mFrameAccepted = false;
-  mTimeoutDuration = 10.0f;
-  mWaitRemaining = 0.0f;
-  mBlockedTime = 0.0f;
-  mTimerElapsed = 0.0f;
-  mEnded = true;
-  mEndedWithTimeout = false;
-  mLastRunTimestamp = TimeStamp();
-  mTimerSamples.Clear();
-  mBuffer.Clear();
-}
-
-bool VRPuppetCommandBuffer::RunCommand(uint64_t aCommand, double aDeltaTime) {
-  /**
-   * Run a single command.  If the command is blocking on a state change and
-   * can't be executed, return false.
-   *
-   * VRPuppetCommandBuffer::RunCommand is only called by
-   *VRPuppetCommandBuffer::Run(), which is already holding the mutex.
-   *
-   * Note that VRPuppetCommandBuffer::RunCommand may potentially be called >1000
-   *times per frame. It might not hurt to add an assert here, but we should
-   *avoid adding code which may potentially malloc (eg string handling) even for
-   *debug builds here.  This function will need to be reasonably fast, even in
-   *debug builds which will be using it during tests.
-   **/
-  switch ((VRPuppet_Command)(aCommand & 0xff00000000000000)) {
-    case VRPuppet_Command::VRPuppet_End:
-      CompleteTest(false);
-      break;
-    case VRPuppet_Command::VRPuppet_ClearAll:
-      memset(&mPendingState, 0, sizeof(VRSystemState));
-      memset(&mCommittedState, 0, sizeof(VRSystemState));
-      mPresentationRequested = false;
-      mFrameSubmitted = false;
-      mFrameAccepted = false;
-      break;
-    case VRPuppet_Command::VRPuppet_ClearController: {
-      uint8_t controllerIdx = aCommand & 0x00000000000000ff;
-      if (controllerIdx < kVRControllerMaxCount) {
-        mPendingState.controllerState[controllerIdx].Clear();
-      }
-    } break;
-    case VRPuppet_Command::VRPuppet_Timeout:
-      mTimeoutDuration = (double)(aCommand & 0x00000000ffffffff) / 1000.0f;
-      break;
-    case VRPuppet_Command::VRPuppet_Wait:
-      if (mWaitRemaining == 0.0f) {
-        mWaitRemaining = (double)(aCommand & 0x00000000ffffffff) / 1000.0f;
-        // Wait timer started, block
-        return false;
-      }
-      mWaitRemaining -= aDeltaTime;
-      if (mWaitRemaining > 0.0f) {
-        // Wait timer still running, block
-        return false;
-      }
-      // Wait timer has elapsed, unblock
-      mWaitRemaining = 0.0f;
-      break;
-    case VRPuppet_Command::VRPuppet_WaitSubmit:
-      if (!mFrameSubmitted) {
-        return false;
-      }
-      break;
-    case VRPuppet_Command::VRPuppet_CaptureFrame:
-      // TODO - Capture the frame and record the output (Bug 1555180)
-      break;
-    case VRPuppet_Command::VRPuppet_AcknowledgeFrame:
-      mFrameSubmitted = false;
-      mFrameAccepted = true;
-      break;
-    case VRPuppet_Command::VRPuppet_RejectFrame:
-      mFrameSubmitted = false;
-      mFrameAccepted = false;
-      break;
-    case VRPuppet_Command::VRPuppet_WaitPresentationStart:
-      if (!mPresentationRequested) {
-        return false;
-      }
-      break;
-    case VRPuppet_Command::VRPuppet_WaitPresentationEnd:
-      if (mPresentationRequested) {
-        return false;
-      }
-      break;
-    case VRPuppet_Command::VRPuppet_WaitHapticIntensity: {
-      // 0x0800cchhvvvvvvvv - VRPuppet_WaitHapticIntensity(c, h, v)
-      uint8_t iControllerIdx = (aCommand & 0x0000ff0000000000) >> 40;
-      if (iControllerIdx >= kVRControllerMaxCount) {
-        // Puppet test is broken, ensure it fails
-        return false;
-      }
-      uint8_t iHapticIdx = (aCommand & 0x000000ff00000000) >> 32;
-      if (iHapticIdx >= kNumPuppetHaptics) {
-        // Puppet test is broken, ensure it fails
-        return false;
-      }
-      uint32_t iHapticIntensity =
-          aCommand & 0x00000000ffffffff;  // interpreted as 16.16 fixed point
-
-      SimulateHaptics(aDeltaTime);
-      uint64_t iCurrentIntensity =
-          round(mHapticPulseIntensity[iControllerIdx][iHapticIdx] *
-                (1 << 16));  // convert to 16.16 fixed point
-      if (iCurrentIntensity > 0xffffffff) {
-        iCurrentIntensity = 0xffffffff;
-      }
-      if (iCurrentIntensity != iHapticIntensity) {
-        return false;
-      }
-    } break;
-
-    case VRPuppet_Command::VRPuppet_StartTimer:
-      mTimerElapsed = 0.0f;
-      break;
-    case VRPuppet_Command::VRPuppet_StopTimer:
-      mTimerSamples.AppendElements(mTimerElapsed);
-      // TODO - Return the timer samples to Javascript once the command buffer
-      // is complete (Bug 1555182)
-      break;
-
-    case VRPuppet_Command::VRPuppet_UpdateDisplay:
-      mDataOffset = (uint8_t*)&mPendingState.displayState -
-                    (uint8_t*)&mPendingState + (aCommand & 0x00000000ffffffff);
-      break;
-    case VRPuppet_Command::VRPuppet_UpdateSensor:
-      mDataOffset = (uint8_t*)&mPendingState.sensorState -
-                    (uint8_t*)&mPendingState + (aCommand & 0x00000000ffffffff);
-      break;
-    case VRPuppet_Command::VRPuppet_UpdateControllers:
-      mDataOffset = (uint8_t*)&mPendingState
-                        .controllerState[aCommand & 0x00000000000000ff] -
-                    (uint8_t*)&mPendingState + (aCommand & 0x00000000ffffffff);
-      break;
-    case VRPuppet_Command::VRPuppet_Commit:
-      memcpy(&mCommittedState, &mPendingState, sizeof(VRSystemState));
-      break;
-
-    case VRPuppet_Command::VRPuppet_Data7:
-      WriteData((aCommand & 0x00ff000000000000) >> 48);
-      MOZ_FALLTHROUGH;
-      // Purposefully, no break
-    case VRPuppet_Command::VRPuppet_Data6:
-      WriteData((aCommand & 0x0000ff0000000000) >> 40);
-      MOZ_FALLTHROUGH;
-      // Purposefully, no break
-    case VRPuppet_Command::VRPuppet_Data5:
-      WriteData((aCommand & 0x000000ff00000000) >> 32);
-      MOZ_FALLTHROUGH;
-      // Purposefully, no break
-    case VRPuppet_Command::VRPuppet_Data4:
-      WriteData((aCommand & 0x00000000ff000000) >> 24);
-      MOZ_FALLTHROUGH;
-      // Purposefully, no break
-    case VRPuppet_Command::VRPuppet_Data3:
-      WriteData((aCommand & 0x0000000000ff0000) >> 16);
-      MOZ_FALLTHROUGH;
-      // Purposefully, no break
-    case VRPuppet_Command::VRPuppet_Data2:
-      WriteData((aCommand & 0x000000000000ff00) >> 8);
-      MOZ_FALLTHROUGH;
-      // Purposefully, no break
-    case VRPuppet_Command::VRPuppet_Data1:
-      WriteData(aCommand & 0x00000000000000ff);
-      break;
-  }
-  return true;
-}
-
-void VRPuppetCommandBuffer::WriteData(uint8_t aData) {
-  if (mDataOffset && mDataOffset < sizeof(VRSystemState)) {
-    ((uint8_t*)&mPendingState)[mDataOffset++] = aData;
-  }
-}
-
-void VRPuppetCommandBuffer::Run() {
-  MutexAutoLock lock(mMutex);
-  TimeStamp now = TimeStamp::Now();
-  double deltaTime = 0.0f;
-  if (!mLastRunTimestamp.IsNull()) {
-    deltaTime = (now - mLastRunTimestamp).ToSeconds();
-  }
-  mLastRunTimestamp = now;
-  mTimerElapsed += deltaTime;
-  size_t transactionLength = 0;
-  while (transactionLength < mBuffer.Length() && !mEnded) {
-    if (RunCommand(mBuffer[transactionLength], deltaTime)) {
-      mBlockedTime = 0.0f;
-      transactionLength++;
-    } else {
-      mBlockedTime += deltaTime;
-      if (mBlockedTime > mTimeoutDuration) {
-        CompleteTest(true);
-      }
-      // If a command is blocked, we don't increment transactionLength,
-      // allowing the command to be retried on the next cycle
-      break;
-    }
-  }
-  mBuffer.RemoveElementsAt(0, transactionLength);
-}
-
-void VRPuppetCommandBuffer::Run(VRSystemState& aState) {
-  Run();
-  // We don't want to stomp over some members
-  bool bEnumerationCompleted = aState.enumerationCompleted;
-  bool bShutdown = aState.displayState.shutdown;
-  uint32_t minRestartInterval = aState.displayState.minRestartInterval;
-
-  // Overwrite it all
-  memcpy(&aState, &mCommittedState, sizeof(VRSystemState));
-
-  // Restore the members
-  aState.enumerationCompleted = bEnumerationCompleted;
-  aState.displayState.shutdown = bShutdown;
-  aState.displayState.minRestartInterval = minRestartInterval;
-}
-
-void VRPuppetCommandBuffer::StartPresentation() {
-  mPresentationRequested = true;
-  Run();
-}
-
-void VRPuppetCommandBuffer::StopPresentation() {
-  mPresentationRequested = false;
-  Run();
-}
-
-bool VRPuppetCommandBuffer::SubmitFrame() {
-  // Emulate blocking behavior of various XR API's as
-  // described by puppet script
-  mFrameSubmitted = true;
-  mFrameAccepted = false;
-  while (true) {
-    Run();
-    if (!mFrameSubmitted || mEnded) {
-      break;
-    }
-    PR_Sleep(PR_INTERVAL_NO_WAIT);  // Yield
-  }
-
-  return mFrameAccepted;
-}
-
-void VRPuppetCommandBuffer::VibrateHaptic(uint32_t aControllerIdx,
-                                          uint32_t aHapticIndex,
-                                          float aIntensity, float aDuration) {
-  if (aHapticIndex >= kNumPuppetHaptics ||
-      aControllerIdx >= kVRControllerMaxCount) {
-    return;
-  }
-
-  // We must Run() before and after updating haptic state to avoid script
-  // deadlocks
-  // The deadlocks would be caused by scripts that include two
-  // VRPuppet_WaitHapticIntensity commands.  If
-  // VRPuppetCommandBuffer::VibrateHaptic() is called twice without advancing
-  // through the command buffer with VRPuppetCommandBuffer::Run() in between,
-  // the first VRPuppet_WaitHapticInensity may not see the transient value that
-  // it is waiting for, thus blocking forever and deadlocking the script.
-  Run();
-  mHapticPulseRemaining[aControllerIdx][aHapticIndex] = aDuration;
-  mHapticPulseIntensity[aControllerIdx][aHapticIndex] = aIntensity;
-  Run();
-}
-
-void VRPuppetCommandBuffer::StopVibrateHaptic(uint32_t aControllerIdx) {
-  if (aControllerIdx >= kVRControllerMaxCount) {
-    return;
-  }
-  // We must Run() before and after updating haptic state to avoid script
-  // deadlocks
-  Run();
-  for (int iHaptic = 0; iHaptic < kNumPuppetHaptics; iHaptic++) {
-    mHapticPulseRemaining[aControllerIdx][iHaptic] = 0.0f;
-    mHapticPulseIntensity[aControllerIdx][iHaptic] = 0.0f;
-  }
-  Run();
-}
-
-void VRPuppetCommandBuffer::StopAllHaptics() {
-  // We must Run() before and after updating haptic state to avoid script
-  // deadlocks
-  Run();
-  for (int iControllerIdx = 0; iControllerIdx < kVRControllerMaxCount;
-       iControllerIdx++) {
-    for (int iHaptic = 0; iHaptic < kNumPuppetHaptics; iHaptic++) {
-      mHapticPulseRemaining[iControllerIdx][iHaptic] = 0.0f;
-      mHapticPulseIntensity[iControllerIdx][iHaptic] = 0.0f;
-    }
-  }
-  Run();
-}
-
-void VRPuppetCommandBuffer::SimulateHaptics(double aDeltaTime) {
-  for (int iControllerIdx = 0; iControllerIdx < kVRControllerMaxCount;
-       iControllerIdx++) {
-    for (int iHaptic = 0; iHaptic < kNumPuppetHaptics; iHaptic++) {
-      if (mHapticPulseIntensity[iControllerIdx][iHaptic] > 0.0f) {
-        mHapticPulseRemaining[iControllerIdx][iHaptic] -= aDeltaTime;
-        if (mHapticPulseRemaining[iControllerIdx][iHaptic] <= 0.0f) {
-          mHapticPulseRemaining[iControllerIdx][iHaptic] = 0.0f;
-          mHapticPulseIntensity[iControllerIdx][iHaptic] = 0.0f;
-        }
-      }
-    }
-  }
-}
-
-void VRPuppetCommandBuffer::CompleteTest(bool aTimedOut) {
-  mEndedWithTimeout = aTimedOut;
-  mEnded = true;
-}
-
-/**
- *  Generates a sequence of VRPuppet_Data# commands, as described
- *  in VRPuppetCommandBuffer.h, to encode the changes to be made to
- *  a "destination" structure to match the "source" structure.
- *  As the commands are encoded, the destination structure is updated
- *  to match the source.
- *
- * @param aBuffer
- *     The buffer in which the commands will be appended.
- * @param aSrcStart
- *     Byte pointer to the start of the structure that
- *     will be copied from.
- * @param aDstStart
- *     Byte pointer to the start of the structure that
- *     will be copied to.
- * @param aLength
- *     Length of the structure that will be copied.
- * @param aUpdateCommand
- *     VRPuppet_... command indicating which structure is being
- *     copied:
- *     VRPuppet_Command::VRPuppet_UpdateDisplay:
- *         A single VRDisplayState struct
- *     VRPuppet_Command::VRPuppet_UpdateSensor:
- *         A single VRHMDSensorState struct
- *     VRPuppet_Command::VRPuppet_UpdateControllers:
- *         An array of VRControllerState structs with a
- *         count of kVRControllerMaxCount
- */
-void VRPuppetCommandBuffer::EncodeStruct(nsTArray<uint64_t>& aBuffer,
-                                         uint8_t* aSrcStart, uint8_t* aDstStart,
-                                         size_t aLength,
-                                         VRPuppet_Command aUpdateCommand) {
-  // Naive implementation, but will not be executed in realtime, so will not
-  // affect test timer results. Could be improved to avoid unaligned reads and
-  // to use SSE.
-
-  // Pointer to source byte being compared+copied
-  uint8_t* src = aSrcStart;
-
-  // Pointer to destination byte being compared+copied
-  uint8_t* dst = aDstStart;
-
-  // Number of bytes packed into bufData
-  uint8_t bufLen = 0;
-
-  // 64-bits to be interpreted as up to 7 separate bytes
-  // This will form the lower 56 bits of the command
-  uint64_t bufData = 0;
-
-  // purgebuffer takes the bytes stored in bufData and generates a VRPuppet
-  // command representing those bytes as "VRPuppet Data".
-  // VRPUppet_Data1 encodes 1 byte
-  // VRPuppet_Data2 encodes 2 bytes
-  // and so on, until..
-  // VRPuppet_Data7 encodes 7 bytes
-  // This command is appended to aBuffer, then bufLen and bufData are reset
-  auto purgeBuffer = [&]() {
-    // Only emit a command if there are data bytes in bufData
-    if (bufLen > 0) {
-      MOZ_ASSERT(bufLen <= 7);
-      uint64_t command = (uint64_t)VRPuppet_Command::VRPuppet_Data1;
-      command += ((uint64_t)VRPuppet_Command::VRPuppet_Data2 -
-                  (uint64_t)VRPuppet_Command::VRPuppet_Data1) *
-                 (bufLen - 1);
-      command |= bufData;
-      aBuffer.AppendElement(command);
-      bufLen = 0;
-      bufData = 0;
-    }
-  };
-
-  // Loop through the bytes of the structs.
-  // While copying the struct at aSrcStart to aDstStart,
-  // the differences are encoded as VRPuppet commands and
-  // appended to aBuffer.
-  for (size_t i = 0; i < aLength; i++) {
-    if (*src != *dst) {
-      // This byte is different
-
-      // Copy the byte to the destination
-      *dst = *src;
-
-      if (bufLen == 0) {
-        // This is the start of a new span of changed bytes
-
-        // Output a command to specify the offset of the
-        // span.
-        aBuffer.AppendElement((uint64_t)aUpdateCommand + i);
-
-        // Store this first byte in bufData.
-        // We will batch up to 7 bytes in one VRPuppet_DataXX
-        // command, so we won't emit it yet.
-        bufLen = 1;
-        bufData = *src;
-      } else if (bufLen <= 6) {
-        // This is the continuation of a span of changed bytes.
-        // There is room to add more bytes to bufData.
-
-        // Store the next byte in bufData.
-        // We will batch up to 7 bytes in one VRPuppet_DataXX
-        // command, so we won't emit it yet.
-        bufData = (bufData << 8) | *src;
-        bufLen++;
-      } else {
-        MOZ_ASSERT(bufLen == 7);
-        // This is the continuation of a span of changed bytes.
-        // There are already 7 bytes in bufData, so we must emit
-        // the VRPuppet_Data7 command for the prior bytes before
-        // starting a new command.
-        aBuffer.AppendElement((uint64_t)VRPuppet_Command::VRPuppet_Data7 +
-                              bufData);
-
-        // Store this byte to be included in the next VRPuppet_DataXX
-        // command.
-        bufLen = 1;
-        bufData = *src;
-      }
-    } else {
-      // This byte is the same.
-      // If there are bytes in bufData, the span has now ended and we must
-      // emit a VRPuppet_DataXX command for the accumulated bytes.
-      // purgeBuffer will not emit any commands if there are no bytes
-      // accumulated.
-      purgeBuffer();
-    }
-    // Advance to the next source and destination byte.
-    ++src;
-    ++dst;
-  }
-  // In the event that the very last byte of the structs differ, we must
-  // ensure that the accumulated bytes are emitted as a VRPuppet_DataXX
-  // command.
-  purgeBuffer();
-}
-
-}  // namespace gfx
-}  // namespace mozilla
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "VRPuppetCommandBuffer.h"
+#include "prthread.h"
+#include "mozilla/ClearOnShutdown.h"
+
+namespace mozilla {
+namespace gfx {
+
+static StaticRefPtr<VRPuppetCommandBuffer> sVRPuppetCommandBufferSingleton;
+
+VRPuppetCommandBuffer& VRPuppetCommandBuffer::Get() {
+  if (sVRPuppetCommandBufferSingleton == nullptr) {
+    sVRPuppetCommandBufferSingleton = new VRPuppetCommandBuffer();
+    ClearOnShutdown(&sVRPuppetCommandBufferSingleton);
+  }
+  return *sVRPuppetCommandBufferSingleton;
+}
+
+VRPuppetCommandBuffer::VRPuppetCommandBuffer()
+    : mMutex("VRPuppetCommandBuffer::mMutex") {
+  MOZ_COUNT_CTOR(VRPuppetCommandBuffer);
+  MOZ_ASSERT(sVRPuppetCommandBufferSingleton == nullptr);
+  Reset();
+}
+
+VRPuppetCommandBuffer::~VRPuppetCommandBuffer() {
+  MOZ_COUNT_DTOR(VRPuppetCommandBuffer);
+}
+
+void VRPuppetCommandBuffer::Submit(const InfallibleTArray<uint64_t>& aBuffer) {
+  MutexAutoLock lock(mMutex);
+  mBuffer.AppendElements(aBuffer);
+  mEnded = false;
+  mEndedWithTimeout = false;
+}
+
+bool VRPuppetCommandBuffer::HasEnded() {
+  MutexAutoLock lock(mMutex);
+  return mEnded;
+}
+
+void VRPuppetCommandBuffer::Reset() {
+  MutexAutoLock lock(mMutex);
+  memset(&mPendingState, 0, sizeof(VRSystemState));
+  memset(&mCommittedState, 0, sizeof(VRSystemState));
+  for (int iControllerIdx = 0; iControllerIdx < kVRControllerMaxCount;
+       iControllerIdx++) {
+    for (int iHaptic = 0; iHaptic < kNumPuppetHaptics; iHaptic++) {
+      mHapticPulseRemaining[iControllerIdx][iHaptic] = 0.0f;
+      mHapticPulseIntensity[iControllerIdx][iHaptic] = 0.0f;
+    }
+  }
+  mDataOffset = 0;
+  mPresentationRequested = false;
+  mFrameSubmitted = false;
+  mFrameAccepted = false;
+  mTimeoutDuration = 10.0f;
+  mWaitRemaining = 0.0f;
+  mBlockedTime = 0.0f;
+  mTimerElapsed = 0.0f;
+  mEnded = true;
+  mEndedWithTimeout = false;
+  mLastRunTimestamp = TimeStamp();
+  mTimerSamples.Clear();
+  mBuffer.Clear();
+}
+
+bool VRPuppetCommandBuffer::RunCommand(uint64_t aCommand, double aDeltaTime) {
+  /**
+   * Run a single command.  If the command is blocking on a state change and
+   * can't be executed, return false.
+   *
+   * VRPuppetCommandBuffer::RunCommand is only called by
+   *VRPuppetCommandBuffer::Run(), which is already holding the mutex.
+   *
+   * Note that VRPuppetCommandBuffer::RunCommand may potentially be called >1000
+   *times per frame. It might not hurt to add an assert here, but we should
+   *avoid adding code which may potentially malloc (eg string handling) even for
+   *debug builds here.  This function will need to be reasonably fast, even in
+   *debug builds which will be using it during tests.
+   **/
+  switch ((VRPuppet_Command)(aCommand & 0xff00000000000000)) {
+    case VRPuppet_Command::VRPuppet_End:
+      CompleteTest(false);
+      break;
+    case VRPuppet_Command::VRPuppet_ClearAll:
+      memset(&mPendingState, 0, sizeof(VRSystemState));
+      memset(&mCommittedState, 0, sizeof(VRSystemState));
+      mPresentationRequested = false;
+      mFrameSubmitted = false;
+      mFrameAccepted = false;
+      break;
+    case VRPuppet_Command::VRPuppet_ClearController: {
+      uint8_t controllerIdx = aCommand & 0x00000000000000ff;
+      if (controllerIdx < kVRControllerMaxCount) {
+        mPendingState.controllerState[controllerIdx].Clear();
+      }
+    } break;
+    case VRPuppet_Command::VRPuppet_Timeout:
+      mTimeoutDuration = (double)(aCommand & 0x00000000ffffffff) / 1000.0f;
+      break;
+    case VRPuppet_Command::VRPuppet_Wait:
+      if (mWaitRemaining == 0.0f) {
+        mWaitRemaining = (double)(aCommand & 0x00000000ffffffff) / 1000.0f;
+        // Wait timer started, block
+        return false;
+      }
+      mWaitRemaining -= aDeltaTime;
+      if (mWaitRemaining > 0.0f) {
+        // Wait timer still running, block
+        return false;
+      }
+      // Wait timer has elapsed, unblock
+      mWaitRemaining = 0.0f;
+      break;
+    case VRPuppet_Command::VRPuppet_WaitSubmit:
+      if (!mFrameSubmitted) {
+        return false;
+      }
+      break;
+    case VRPuppet_Command::VRPuppet_CaptureFrame:
+      // TODO - Capture the frame and record the output (Bug 1555180)
+      break;
+    case VRPuppet_Command::VRPuppet_AcknowledgeFrame:
+      mFrameSubmitted = false;
+      mFrameAccepted = true;
+      break;
+    case VRPuppet_Command::VRPuppet_RejectFrame:
+      mFrameSubmitted = false;
+      mFrameAccepted = false;
+      break;
+    case VRPuppet_Command::VRPuppet_WaitPresentationStart:
+      if (!mPresentationRequested) {
+        return false;
+      }
+      break;
+    case VRPuppet_Command::VRPuppet_WaitPresentationEnd:
+      if (mPresentationRequested) {
+        return false;
+      }
+      break;
+    case VRPuppet_Command::VRPuppet_WaitHapticIntensity: {
+      // 0x0800cchhvvvvvvvv - VRPuppet_WaitHapticIntensity(c, h, v)
+      uint8_t iControllerIdx = (aCommand & 0x0000ff0000000000) >> 40;
+      if (iControllerIdx >= kVRControllerMaxCount) {
+        // Puppet test is broken, ensure it fails
+        return false;
+      }
+      uint8_t iHapticIdx = (aCommand & 0x000000ff00000000) >> 32;
+      if (iHapticIdx >= kNumPuppetHaptics) {
+        // Puppet test is broken, ensure it fails
+        return false;
+      }
+      uint32_t iHapticIntensity =
+          aCommand & 0x00000000ffffffff;  // interpreted as 16.16 fixed point
+
+      SimulateHaptics(aDeltaTime);
+      uint64_t iCurrentIntensity =
+          round(mHapticPulseIntensity[iControllerIdx][iHapticIdx] *
+                (1 << 16));  // convert to 16.16 fixed point
+      if (iCurrentIntensity > 0xffffffff) {
+        iCurrentIntensity = 0xffffffff;
+      }
+      if (iCurrentIntensity != iHapticIntensity) {
+        return false;
+      }
+    } break;
+
+    case VRPuppet_Command::VRPuppet_StartTimer:
+      mTimerElapsed = 0.0f;
+      break;
+    case VRPuppet_Command::VRPuppet_StopTimer:
+      mTimerSamples.AppendElements(mTimerElapsed);
+      // TODO - Return the timer samples to Javascript once the command buffer
+      // is complete (Bug 1555182)
+      break;
+
+    case VRPuppet_Command::VRPuppet_UpdateDisplay:
+      mDataOffset = (uint8_t*)&mPendingState.displayState -
+                    (uint8_t*)&mPendingState + (aCommand & 0x00000000ffffffff);
+      break;
+    case VRPuppet_Command::VRPuppet_UpdateSensor:
+      mDataOffset = (uint8_t*)&mPendingState.sensorState -
+                    (uint8_t*)&mPendingState + (aCommand & 0x00000000ffffffff);
+      break;
+    case VRPuppet_Command::VRPuppet_UpdateControllers:
+      mDataOffset = (uint8_t*)&mPendingState
+                        .controllerState[aCommand & 0x00000000000000ff] -
+                    (uint8_t*)&mPendingState + (aCommand & 0x00000000ffffffff);
+      break;
+    case VRPuppet_Command::VRPuppet_Commit:
+      memcpy(&mCommittedState, &mPendingState, sizeof(VRSystemState));
+      break;
+
+    case VRPuppet_Command::VRPuppet_Data7:
+      WriteData((aCommand & 0x00ff000000000000) >> 48);
+      MOZ_FALLTHROUGH;
+      // Purposefully, no break
+    case VRPuppet_Command::VRPuppet_Data6:
+      WriteData((aCommand & 0x0000ff0000000000) >> 40);
+      MOZ_FALLTHROUGH;
+      // Purposefully, no break
+    case VRPuppet_Command::VRPuppet_Data5:
+      WriteData((aCommand & 0x000000ff00000000) >> 32);
+      MOZ_FALLTHROUGH;
+      // Purposefully, no break
+    case VRPuppet_Command::VRPuppet_Data4:
+      WriteData((aCommand & 0x00000000ff000000) >> 24);
+      MOZ_FALLTHROUGH;
+      // Purposefully, no break
+    case VRPuppet_Command::VRPuppet_Data3:
+      WriteData((aCommand & 0x0000000000ff0000) >> 16);
+      MOZ_FALLTHROUGH;
+      // Purposefully, no break
+    case VRPuppet_Command::VRPuppet_Data2:
+      WriteData((aCommand & 0x000000000000ff00) >> 8);
+      MOZ_FALLTHROUGH;
+      // Purposefully, no break
+    case VRPuppet_Command::VRPuppet_Data1:
+      WriteData(aCommand & 0x00000000000000ff);
+      break;
+  }
+  return true;
+}
+
+void VRPuppetCommandBuffer::WriteData(uint8_t aData) {
+  if (mDataOffset && mDataOffset < sizeof(VRSystemState)) {
+    ((uint8_t*)&mPendingState)[mDataOffset++] = aData;
+  }
+}
+
+void VRPuppetCommandBuffer::Run() {
+  MutexAutoLock lock(mMutex);
+  TimeStamp now = TimeStamp::Now();
+  double deltaTime = 0.0f;
+  if (!mLastRunTimestamp.IsNull()) {
+    deltaTime = (now - mLastRunTimestamp).ToSeconds();
+  }
+  mLastRunTimestamp = now;
+  mTimerElapsed += deltaTime;
+  size_t transactionLength = 0;
+  while (transactionLength < mBuffer.Length() && !mEnded) {
+    if (RunCommand(mBuffer[transactionLength], deltaTime)) {
+      mBlockedTime = 0.0f;
+      transactionLength++;
+    } else {
+      mBlockedTime += deltaTime;
+      if (mBlockedTime > mTimeoutDuration) {
+        CompleteTest(true);
+      }
+      // If a command is blocked, we don't increment transactionLength,
+      // allowing the command to be retried on the next cycle
+      break;
+    }
+  }
+  mBuffer.RemoveElementsAt(0, transactionLength);
+}
+
+void VRPuppetCommandBuffer::Run(VRSystemState& aState) {
+  Run();
+  // We don't want to stomp over some members
+  bool bEnumerationCompleted = aState.enumerationCompleted;
+  bool bShutdown = aState.displayState.shutdown;
+  uint32_t minRestartInterval = aState.displayState.minRestartInterval;
+
+  // Overwrite it all
+  memcpy(&aState, &mCommittedState, sizeof(VRSystemState));
+
+  // Restore the members
+  aState.enumerationCompleted = bEnumerationCompleted;
+  aState.displayState.shutdown = bShutdown;
+  aState.displayState.minRestartInterval = minRestartInterval;
+}
+
+void VRPuppetCommandBuffer::StartPresentation() {
+  mPresentationRequested = true;
+  Run();
+}
+
+void VRPuppetCommandBuffer::StopPresentation() {
+  mPresentationRequested = false;
+  Run();
+}
+
+bool VRPuppetCommandBuffer::SubmitFrame() {
+  // Emulate blocking behavior of various XR API's as
+  // described by puppet script
+  mFrameSubmitted = true;
+  mFrameAccepted = false;
+  while (true) {
+    Run();
+    if (!mFrameSubmitted || mEnded) {
+      break;
+    }
+    PR_Sleep(PR_INTERVAL_NO_WAIT);  // Yield
+  }
+
+  return mFrameAccepted;
+}
+
+void VRPuppetCommandBuffer::VibrateHaptic(uint32_t aControllerIdx,
+                                          uint32_t aHapticIndex,
+                                          float aIntensity, float aDuration) {
+  if (aHapticIndex >= kNumPuppetHaptics ||
+      aControllerIdx >= kVRControllerMaxCount) {
+    return;
+  }
+
+  // We must Run() before and after updating haptic state to avoid script
+  // deadlocks
+  // The deadlocks would be caused by scripts that include two
+  // VRPuppet_WaitHapticIntensity commands.  If
+  // VRPuppetCommandBuffer::VibrateHaptic() is called twice without advancing
+  // through the command buffer with VRPuppetCommandBuffer::Run() in between,
+  // the first VRPuppet_WaitHapticInensity may not see the transient value that
+  // it is waiting for, thus blocking forever and deadlocking the script.
+  Run();
+  mHapticPulseRemaining[aControllerIdx][aHapticIndex] = aDuration;
+  mHapticPulseIntensity[aControllerIdx][aHapticIndex] = aIntensity;
+  Run();
+}
+
+void VRPuppetCommandBuffer::StopVibrateHaptic(uint32_t aControllerIdx) {
+  if (aControllerIdx >= kVRControllerMaxCount) {
+    return;
+  }
+  // We must Run() before and after updating haptic state to avoid script
+  // deadlocks
+  Run();
+  for (int iHaptic = 0; iHaptic < kNumPuppetHaptics; iHaptic++) {
+    mHapticPulseRemaining[aControllerIdx][iHaptic] = 0.0f;
+    mHapticPulseIntensity[aControllerIdx][iHaptic] = 0.0f;
+  }
+  Run();
+}
+
+void VRPuppetCommandBuffer::StopAllHaptics() {
+  // We must Run() before and after updating haptic state to avoid script
+  // deadlocks
+  Run();
+  for (int iControllerIdx = 0; iControllerIdx < kVRControllerMaxCount;
+       iControllerIdx++) {
+    for (int iHaptic = 0; iHaptic < kNumPuppetHaptics; iHaptic++) {
+      mHapticPulseRemaining[iControllerIdx][iHaptic] = 0.0f;
+      mHapticPulseIntensity[iControllerIdx][iHaptic] = 0.0f;
+    }
+  }
+  Run();
+}
+
+void VRPuppetCommandBuffer::SimulateHaptics(double aDeltaTime) {
+  for (int iControllerIdx = 0; iControllerIdx < kVRControllerMaxCount;
+       iControllerIdx++) {
+    for (int iHaptic = 0; iHaptic < kNumPuppetHaptics; iHaptic++) {
+      if (mHapticPulseIntensity[iControllerIdx][iHaptic] > 0.0f) {
+        mHapticPulseRemaining[iControllerIdx][iHaptic] -= aDeltaTime;
+        if (mHapticPulseRemaining[iControllerIdx][iHaptic] <= 0.0f) {
+          mHapticPulseRemaining[iControllerIdx][iHaptic] = 0.0f;
+          mHapticPulseIntensity[iControllerIdx][iHaptic] = 0.0f;
+        }
+      }
+    }
+  }
+}
+
+void VRPuppetCommandBuffer::CompleteTest(bool aTimedOut) {
+  mEndedWithTimeout = aTimedOut;
+  mEnded = true;
+}
+
+/**
+ *  Generates a sequence of VRPuppet_Data# commands, as described
+ *  in VRPuppetCommandBuffer.h, to encode the changes to be made to
+ *  a "destination" structure to match the "source" structure.
+ *  As the commands are encoded, the destination structure is updated
+ *  to match the source.
+ *
+ * @param aBuffer
+ *     The buffer in which the commands will be appended.
+ * @param aSrcStart
+ *     Byte pointer to the start of the structure that
+ *     will be copied from.
+ * @param aDstStart
+ *     Byte pointer to the start of the structure that
+ *     will be copied to.
+ * @param aLength
+ *     Length of the structure that will be copied.
+ * @param aUpdateCommand
+ *     VRPuppet_... command indicating which structure is being
+ *     copied:
+ *     VRPuppet_Command::VRPuppet_UpdateDisplay:
+ *         A single VRDisplayState struct
+ *     VRPuppet_Command::VRPuppet_UpdateSensor:
+ *         A single VRHMDSensorState struct
+ *     VRPuppet_Command::VRPuppet_UpdateControllers:
+ *         An array of VRControllerState structs with a
+ *         count of kVRControllerMaxCount
+ */
+void VRPuppetCommandBuffer::EncodeStruct(nsTArray<uint64_t>& aBuffer,
+                                         uint8_t* aSrcStart, uint8_t* aDstStart,
+                                         size_t aLength,
+                                         VRPuppet_Command aUpdateCommand) {
+  // Naive implementation, but will not be executed in realtime, so will not
+  // affect test timer results. Could be improved to avoid unaligned reads and
+  // to use SSE.
+
+  // Pointer to source byte being compared+copied
+  uint8_t* src = aSrcStart;
+
+  // Pointer to destination byte being compared+copied
+  uint8_t* dst = aDstStart;
+
+  // Number of bytes packed into bufData
+  uint8_t bufLen = 0;
+
+  // 64-bits to be interpreted as up to 7 separate bytes
+  // This will form the lower 56 bits of the command
+  uint64_t bufData = 0;
+
+  // purgebuffer takes the bytes stored in bufData and generates a VRPuppet
+  // command representing those bytes as "VRPuppet Data".
+  // VRPUppet_Data1 encodes 1 byte
+  // VRPuppet_Data2 encodes 2 bytes
+  // and so on, until..
+  // VRPuppet_Data7 encodes 7 bytes
+  // This command is appended to aBuffer, then bufLen and bufData are reset
+  auto purgeBuffer = [&]() {
+    // Only emit a command if there are data bytes in bufData
+    if (bufLen > 0) {
+      MOZ_ASSERT(bufLen <= 7);
+      uint64_t command = (uint64_t)VRPuppet_Command::VRPuppet_Data1;
+      command += ((uint64_t)VRPuppet_Command::VRPuppet_Data2 -
+                  (uint64_t)VRPuppet_Command::VRPuppet_Data1) *
+                 (bufLen - 1);
+      command |= bufData;
+      aBuffer.AppendElement(command);
+      bufLen = 0;
+      bufData = 0;
+    }
+  };
+
+  // Loop through the bytes of the structs.
+  // While copying the struct at aSrcStart to aDstStart,
+  // the differences are encoded as VRPuppet commands and
+  // appended to aBuffer.
+  for (size_t i = 0; i < aLength; i++) {
+    if (*src != *dst) {
+      // This byte is different
+
+      // Copy the byte to the destination
+      *dst = *src;
+
+      if (bufLen == 0) {
+        // This is the start of a new span of changed bytes
+
+        // Output a command to specify the offset of the
+        // span.
+        aBuffer.AppendElement((uint64_t)aUpdateCommand + i);
+
+        // Store this first byte in bufData.
+        // We will batch up to 7 bytes in one VRPuppet_DataXX
+        // command, so we won't emit it yet.
+        bufLen = 1;
+        bufData = *src;
+      } else if (bufLen <= 6) {
+        // This is the continuation of a span of changed bytes.
+        // There is room to add more bytes to bufData.
+
+        // Store the next byte in bufData.
+        // We will batch up to 7 bytes in one VRPuppet_DataXX
+        // command, so we won't emit it yet.
+        bufData = (bufData << 8) | *src;
+        bufLen++;
+      } else {
+        MOZ_ASSERT(bufLen == 7);
+        // This is the continuation of a span of changed bytes.
+        // There are already 7 bytes in bufData, so we must emit
+        // the VRPuppet_Data7 command for the prior bytes before
+        // starting a new command.
+        aBuffer.AppendElement((uint64_t)VRPuppet_Command::VRPuppet_Data7 +
+                              bufData);
+
+        // Store this byte to be included in the next VRPuppet_DataXX
+        // command.
+        bufLen = 1;
+        bufData = *src;
+      }
+    } else {
+      // This byte is the same.
+      // If there are bytes in bufData, the span has now ended and we must
+      // emit a VRPuppet_DataXX command for the accumulated bytes.
+      // purgeBuffer will not emit any commands if there are no bytes
+      // accumulated.
+      purgeBuffer();
+    }
+    // Advance to the next source and destination byte.
+    ++src;
+    ++dst;
+  }
+  // In the event that the very last byte of the structs differ, we must
+  // ensure that the accumulated bytes are emitted as a VRPuppet_DataXX
+  // command.
+  purgeBuffer();
+}
+
+}  // namespace gfx
+}  // namespace mozilla
--- a/gfx/vr/VRPuppetCommandBuffer.h
+++ b/gfx/vr/VRPuppetCommandBuffer.h
@@ -1,235 +1,235 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef GFX_VR_SERVICE_VRPUPPETCOMMANDBUFFER_H
-#define GFX_VR_SERVICE_VRPUPPETCOMMANDBUFFER_H
-
-#include <inttypes.h>
-#include "mozilla/Mutex.h"
-#include "nsTArray.h"
-#include "moz_external_vr.h"
-#include "mozilla/TimeStamp.h"
-
-namespace mozilla {
-namespace gfx {
-
-/**
- * A Puppet Device command buffer consists of a stream of 64-bit
- * commands.
- * The first 8 bits identifies the command and informs format of
- * the remaining 56 bits.
- *
- * These commands will be streamed into a buffer until
- * VRPuppet_End (0x0000000000000000) has been received.
- *
- * When VRPuppet_End is received, this command buffer will
- * be executed asynchronously, collecting the timer results
- * requested.
- *
- * In addition to the effects seen through the WebXR/VR API, tests
- * can get further feedback from the Puppet device.
- * Command buffers can be constructed such that when expected states
- * are not reached, the timeout timer will expire.
- * Data recorded with timer commands is returned when the command
- * buffer is completed, to validate against accepted ranges and to
- * quantify performance regressions.
- * Images submitted to the Puppet display are rendered with the
- * 2d browser output in order to enable reftests to validate
- * output against reference images.
- *
- * The state of the virtual puppet device is expressed to the VR service
- * in the same manner as physical devices -- using the VRDisplayState,
- * VRHMDSensorState and VRControllerState structures.
- *
- * By enabling partial updates of these structures, the command buffer
- * size is reduced to the values that change each frame.  This enables
- * realtime capture of a session, with physical hardware, for
- * replay in automated tests and benchmarks.
- *
- * All updates to the state structures are atomically updated in the
- * VR session thread, triggered by VRPuppet_Commit (0x1500000000000000).
- *
- * Command buffers are expected to be serialized to a human readable,
- * ascii format if stored on disk.  The binary representation is not
- * guaranteed to be consistent between versions or target platforms.
- * They should be re-constructed with the VRServiceTest DOM api at
- * runtime.
- *
- * The command set:
- *
- * 0x0000000000000000 - VRPuppet_End()
- * - End of stream, resolve promise returned by VRServiceTest::Play()
- *
- * 0x0100000000000000 - VRPuppet_ClearAll()
- * - Clear all structs
- *
- * 0x02000000000000nn - VRPuppet_ClearController(n)
- * - Clear a single controller struct
- *
- * 0x03000000nnnnnnnn - VRPuppet_Timeout(n)
- * - Reset the timeout timer to n milliseconds
- * - Initially the timeout timer starts at 10 seconds
- *
- * 0x04000000nnnnnnnn - VRPuppet_Wait(n)
- * - Wait n milliseconds before advancing to next command
- *
- * 0x0500000000000000 - VRPuppet_WaitSubmit()
- * - Wait until a frame has been submitted before advancing to the next command
- *
- * 0x0600000000000000 - VRPuppet_WaitPresentationStart()
- * - Wait until a presentation becomes active
- *
- * 0x0700000000000000 - VRPuppet_WaitPresentationEnd()
- * - Wait until a presentation ends
- *
- * 0x0800cchhvvvvvvvv - VRPuppet_WaitHapticIntensity(c, h, v)
- * - Wait until controller at index c's haptic actuator at index h reaches value
- * v.
- * - v is a 16.16 fixed point value, with 1.0f being the highest intensity and
- * 0.0f indicating that the haptic actuator is not running
- *
- * 0x0900000000000000 - VRPuppet_CaptureFrame()
- * - Captures the submitted frame.  Must later call
- *   VRPuppet_AcknowledgeFrame or VRPuppet_RejectFrame
- *   to unblock
- *
- * 0x0900000000000000 - VRPuppet_AcknowledgeFrame()
- * - Acknowledge the submitted frame, unblocking the Submit call.
- *
- * 0x0a00000000000000 - VRPuppet_RejectFrame()
- * - Reject the submitted frame, unblocking the Submit call.
- *
- * 0x0b00000000000000 - VRPuppet_StartTimer()
- * - Starts the timer
- *
- * 0x0c00000000000000 - VRPuppet_StopTimer()
- * - Stops the timer, the elapsed duration is recorded for access after the end
- *   of stream
- *
- * 0x0d000000aaaaaaaa - VRPuppet_UpdateDisplay(a)
- * - Start writing data to the VRDisplayState struct, at offset a
- *
- * 0x0e000000aaaaaaaa - VRPuppet_UpdateSensor(a)
- * - Start writing data to the VRHMDSensorState struct, at offset a
- *
- * 0x0f000000aaaaaaaa - VRPuppet_UpdateControllers(a)
- * - Start writing data to the VRControllerState array, at offset a
- *
- * 0x100000000000000 - VRPuppet_Commit
- * - Atomically commit the VRPuppet_Data updates to VRDisplayState,
- *   VRHMDSensorState and VRControllerState.
- *
- * 0xf0000000000000dd - VRPuppet_Data(d)
- * - 1 byte of data
- *
- * 0xf10000000000dddd - VRPuppet_Data(d)
- * - 2 bytes of data
- *
- * 0xf200000000dddddd - VRPuppet_Data(d)
- * - 3 bytes of data
- *
- * 0xf3000000dddddddd - VRPuppet_Data(d)
- * - 4 bytes of data
- *
- * 0xf40000dddddddddd - VRPuppet_Data(d)
- * - 5 bytes of data
- *
- * 0xf500dddddddddddd - VRPuppet_Data(d)
- * - 6 bytes of data
- *
- * 0xf6dddddddddddddd - VRPuppet_Data(d)
- * - 7 bytes of data
- *
- */
-enum class VRPuppet_Command : uint64_t {
-  VRPuppet_End = 0x0000000000000000,
-  VRPuppet_ClearAll = 0x0100000000000000,
-  VRPuppet_ClearController = 0x0200000000000000,
-  VRPuppet_Timeout = 0x0300000000000000,
-  VRPuppet_Wait = 0x0400000000000000,
-  VRPuppet_WaitSubmit = 0x0500000000000000,
-  VRPuppet_WaitPresentationStart = 0x0600000000000000,
-  VRPuppet_WaitPresentationEnd = 0x0700000000000000,
-  VRPuppet_WaitHapticIntensity = 0x0800000000000000,
-  VRPuppet_CaptureFrame = 0x0900000000000000,
-  VRPuppet_AcknowledgeFrame = 0x0a00000000000000,
-  VRPuppet_RejectFrame = 0x0b00000000000000,
-  VRPuppet_StartTimer = 0x0c00000000000000,
-  VRPuppet_StopTimer = 0x0d00000000000000,
-  VRPuppet_UpdateDisplay = 0x0e00000000000000,
-  VRPuppet_UpdateSensor = 0x0f00000000000000,
-  VRPuppet_UpdateControllers = 0x1000000000000000,
-  VRPuppet_Commit = 0x1100000000000000,
-  VRPuppet_Data1 = 0xf000000000000000,
-  VRPuppet_Data2 = 0xf100000000000000,
-  VRPuppet_Data3 = 0xf200000000000000,
-  VRPuppet_Data4 = 0xf300000000000000,
-  VRPuppet_Data5 = 0xf400000000000000,
-  VRPuppet_Data6 = 0xf500000000000000,
-  VRPuppet_Data7 = 0xf600000000000000,
-};
-
-static const int kNumPuppetHaptics = 8;
-
-class VRPuppetCommandBuffer {
- public:
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(mozilla::gfx::VRPuppetCommandBuffer)
-  static VRPuppetCommandBuffer& Get();
-
-  // Interface to VRTestSystem
-  void Submit(const InfallibleTArray<uint64_t>& aBuffer);
-  void Reset();
-  bool HasEnded();
-
-  // Interface to PuppetSession
-  void Run(VRSystemState& aState);
-  void StartPresentation();
-  void StopPresentation();
-  bool SubmitFrame();
-  void VibrateHaptic(uint32_t aControllerIdx, uint32_t aHapticIndex,
-                     float aIntensity, float aDuration);
-  void StopVibrateHaptic(uint32_t aControllerIdx);
-  void StopAllHaptics();
-
-  static void EncodeStruct(nsTArray<uint64_t>& aBuffer, uint8_t* aSrcStart,
-                           uint8_t* aDstStart, size_t aLength,
-                           gfx::VRPuppet_Command aUpdateCommand);
-
- private:
-  VRPuppetCommandBuffer();
-  ~VRPuppetCommandBuffer();
-  void Run();
-  bool RunCommand(uint64_t aCommand, double aDeltaTime);
-  void WriteData(uint8_t aData);
-  void SimulateHaptics(double aDeltaTime);
-  void CompleteTest(bool aTimedOut);
-  nsTArray<uint64_t> mBuffer;
-  mozilla::Mutex mMutex;
-  VRSystemState mPendingState;
-  VRSystemState mCommittedState;
-  double mHapticPulseRemaining[kVRControllerMaxCount][kNumPuppetHaptics];
-  float mHapticPulseIntensity[kVRControllerMaxCount][kNumPuppetHaptics];
-
-  size_t mDataOffset;
-  bool mPresentationRequested;
-  bool mFrameSubmitted;
-  bool mFrameAccepted;
-  double mTimeoutDuration;  // Seconds
-  double mWaitRemaining;    // Seconds
-  double mBlockedTime;      // Seconds
-  double mTimerElapsed;     // Seconds
-  TimeStamp mLastRunTimestamp;
-
-  // Test Results:
-  bool mEnded;
-  bool mEndedWithTimeout;
-  nsTArray<double> mTimerSamples;
-};
-
-}  // namespace gfx
-}  // namespace mozilla
-
-#endif  // GFX_VR_SERVICE_VRPUPPETCOMMANDBUFFER_H
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GFX_VR_SERVICE_VRPUPPETCOMMANDBUFFER_H
+#define GFX_VR_SERVICE_VRPUPPETCOMMANDBUFFER_H
+
+#include <inttypes.h>
+#include "mozilla/Mutex.h"
+#include "nsTArray.h"
+#include "moz_external_vr.h"
+#include "mozilla/TimeStamp.h"
+
+namespace mozilla {
+namespace gfx {
+
+/**
+ * A Puppet Device command buffer consists of a stream of 64-bit
+ * commands.
+ * The first 8 bits identifies the command and informs format of
+ * the remaining 56 bits.
+ *
+ * These commands will be streamed into a buffer until
+ * VRPuppet_End (0x0000000000000000) has been received.
+ *
+ * When VRPuppet_End is received, this command buffer will
+ * be executed asynchronously, collecting the timer results
+ * requested.
+ *
+ * In addition to the effects seen through the WebXR/VR API, tests
+ * can get further feedback from the Puppet device.
+ * Command buffers can be constructed such that when expected states
+ * are not reached, the timeout timer will expire.
+ * Data recorded with timer commands is returned when the command
+ * buffer is completed, to validate against accepted ranges and to
+ * quantify performance regressions.
+ * Images submitted to the Puppet display are rendered with the
+ * 2d browser output in order to enable reftests to validate
+ * output against reference images.
+ *
+ * The state of the virtual puppet device is expressed to the VR service
+ * in the same manner as physical devices -- using the VRDisplayState,
+ * VRHMDSensorState and VRControllerState structures.
+ *
+ * By enabling partial updates of these structures, the command buffer
+ * size is reduced to the values that change each frame.  This enables
+ * realtime capture of a session, with physical hardware, for
+ * replay in automated tests and benchmarks.
+ *
+ * All updates to the state structures are atomically updated in the
+ * VR session thread, triggered by VRPuppet_Commit (0x1500000000000000).
+ *
+ * Command buffers are expected to be serialized to a human readable,
+ * ascii format if stored on disk.  The binary representation is not
+ * guaranteed to be consistent between versions or target platforms.
+ * They should be re-constructed with the VRServiceTest DOM api at
+ * runtime.
+ *
+ * The command set:
+ *
+ * 0x0000000000000000 - VRPuppet_End()
+ * - End of stream, resolve promise returned by VRServiceTest::Play()
+ *
+ * 0x0100000000000000 - VRPuppet_ClearAll()
+ * - Clear all structs
+ *
+ * 0x02000000000000nn - VRPuppet_ClearController(n)
+ * - Clear a single controller struct
+ *
+ * 0x03000000nnnnnnnn - VRPuppet_Timeout(n)
+ * - Reset the timeout timer to n milliseconds
+ * - Initially the timeout timer starts at 10 seconds
+ *
+ * 0x04000000nnnnnnnn - VRPuppet_Wait(n)
+ * - Wait n milliseconds before advancing to next command
+ *
+ * 0x0500000000000000 - VRPuppet_WaitSubmit()
+ * - Wait until a frame has been submitted before advancing to the next command
+ *
+ * 0x0600000000000000 - VRPuppet_WaitPresentationStart()
+ * - Wait until a presentation becomes active
+ *
+ * 0x0700000000000000 - VRPuppet_WaitPresentationEnd()
+ * - Wait until a presentation ends
+ *
+ * 0x0800cchhvvvvvvvv - VRPuppet_WaitHapticIntensity(c, h, v)
+ * - Wait until controller at index c's haptic actuator at index h reaches value
+ * v.
+ * - v is a 16.16 fixed point value, with 1.0f being the highest intensity and
+ * 0.0f indicating that the haptic actuator is not running
+ *
+ * 0x0900000000000000 - VRPuppet_CaptureFrame()
+ * - Captures the submitted frame.  Must later call
+ *   VRPuppet_AcknowledgeFrame or VRPuppet_RejectFrame
+ *   to unblock
+ *
+ * 0x0900000000000000 - VRPuppet_AcknowledgeFrame()
+ * - Acknowledge the submitted frame, unblocking the Submit call.
+ *
+ * 0x0a00000000000000 - VRPuppet_RejectFrame()
+ * - Reject the submitted frame, unblocking the Submit call.
+ *
+ * 0x0b00000000000000 - VRPuppet_StartTimer()
+ * - Starts the timer
+ *
+ * 0x0c00000000000000 - VRPuppet_StopTimer()
+ * - Stops the timer, the elapsed duration is recorded for access after the end
+ *   of stream
+ *
+ * 0x0d000000aaaaaaaa - VRPuppet_UpdateDisplay(a)
+ * - Start writing data to the VRDisplayState struct, at offset a
+ *
+ * 0x0e000000aaaaaaaa - VRPuppet_UpdateSensor(a)
+ * - Start writing data to the VRHMDSensorState struct, at offset a
+ *
+ * 0x0f000000aaaaaaaa - VRPuppet_UpdateControllers(a)
+ * - Start writing data to the VRControllerState array, at offset a
+ *
+ * 0x100000000000000 - VRPuppet_Commit
+ * - Atomically commit the VRPuppet_Data updates to VRDisplayState,
+ *   VRHMDSensorState and VRControllerState.
+ *
+ * 0xf0000000000000dd - VRPuppet_Data(d)
+ * - 1 byte of data
+ *
+ * 0xf10000000000dddd - VRPuppet_Data(d)
+ * - 2 bytes of data
+ *
+ * 0xf200000000dddddd - VRPuppet_Data(d)
+ * - 3 bytes of data
+ *
+ * 0xf3000000dddddddd - VRPuppet_Data(d)
+ * - 4 bytes of data
+ *
+ * 0xf40000dddddddddd - VRPuppet_Data(d)
+ * - 5 bytes of data
+ *
+ * 0xf500dddddddddddd - VRPuppet_Data(d)
+ * - 6 bytes of data
+ *
+ * 0xf6dddddddddddddd - VRPuppet_Data(d)
+ * - 7 bytes of data
+ *
+ */
+enum class VRPuppet_Command : uint64_t {
+  VRPuppet_End = 0x0000000000000000,
+  VRPuppet_ClearAll = 0x0100000000000000,
+  VRPuppet_ClearController = 0x0200000000000000,
+  VRPuppet_Timeout = 0x0300000000000000,
+  VRPuppet_Wait = 0x0400000000000000,
+  VRPuppet_WaitSubmit = 0x0500000000000000,
+  VRPuppet_WaitPresentationStart = 0x0600000000000000,
+  VRPuppet_WaitPresentationEnd = 0x0700000000000000,
+  VRPuppet_WaitHapticIntensity = 0x0800000000000000,
+  VRPuppet_CaptureFrame = 0x0900000000000000,
+  VRPuppet_AcknowledgeFrame = 0x0a00000000000000,
+  VRPuppet_RejectFrame = 0x0b00000000000000,
+  VRPuppet_StartTimer = 0x0c00000000000000,
+  VRPuppet_StopTimer = 0x0d00000000000000,
+  VRPuppet_UpdateDisplay = 0x0e00000000000000,
+  VRPuppet_UpdateSensor = 0x0f00000000000000,
+  VRPuppet_UpdateControllers = 0x1000000000000000,
+  VRPuppet_Commit = 0x1100000000000000,
+  VRPuppet_Data1 = 0xf000000000000000,
+  VRPuppet_Data2 = 0xf100000000000000,
+  VRPuppet_Data3 = 0xf200000000000000,
+  VRPuppet_Data4 = 0xf300000000000000,
+  VRPuppet_Data5 = 0xf400000000000000,
+  VRPuppet_Data6 = 0xf500000000000000,
+  VRPuppet_Data7 = 0xf600000000000000,
+};
+
+static const int kNumPuppetHaptics = 8;
+
+class VRPuppetCommandBuffer {
+ public:
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(mozilla::gfx::VRPuppetCommandBuffer)
+  static VRPuppetCommandBuffer& Get();
+
+  // Interface to VRTestSystem
+  void Submit(const InfallibleTArray<uint64_t>& aBuffer);
+  void Reset();
+  bool HasEnded();
+
+  // Interface to PuppetSession
+  void Run(VRSystemState& aState);
+  void StartPresentation();
+  void StopPresentation();
+  bool SubmitFrame();
+  void VibrateHaptic(uint32_t aControllerIdx, uint32_t aHapticIndex,
+                     float aIntensity, float aDuration);
+  void StopVibrateHaptic(uint32_t aControllerIdx);
+  void StopAllHaptics();
+
+  static void EncodeStruct(nsTArray<uint64_t>& aBuffer, uint8_t* aSrcStart,
+                           uint8_t* aDstStart, size_t aLength,
+                           gfx::VRPuppet_Command aUpdateCommand);
+
+ private:
+  VRPuppetCommandBuffer();
+  ~VRPuppetCommandBuffer();
+  void Run();
+  bool RunCommand(uint64_t aCommand, double aDeltaTime);
+  void WriteData(uint8_t aData);
+  void SimulateHaptics(double aDeltaTime);
+  void CompleteTest(bool aTimedOut);
+  nsTArray<uint64_t> mBuffer;
+  mozilla::Mutex mMutex;
+  VRSystemState mPendingState;
+  VRSystemState mCommittedState;
+  double mHapticPulseRemaining[kVRControllerMaxCount][kNumPuppetHaptics];
+  float mHapticPulseIntensity[kVRControllerMaxCount][kNumPuppetHaptics];
+
+  size_t mDataOffset;
+  bool mPresentationRequested;
+  bool mFrameSubmitted;
+  bool mFrameAccepted;
+  double mTimeoutDuration;  // Seconds
+  double mWaitRemaining;    // Seconds
+  double mBlockedTime;      // Seconds
+  double mTimerElapsed;     // Seconds
+  TimeStamp mLastRunTimestamp;
+
+  // Test Results:
+  bool mEnded;
+  bool mEndedWithTimeout;
+  nsTArray<double> mTimerSamples;
+};
+
+}  // namespace gfx
+}  // namespace mozilla
+
+#endif  // GFX_VR_SERVICE_VRPUPPETCOMMANDBUFFER_H
--- a/gfx/vr/service/PuppetSession.cpp
+++ b/gfx/vr/service/PuppetSession.cpp
@@ -1,114 +1,114 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "PuppetSession.h"
-
-#include "nsString.h"
-#include "VRPuppetCommandBuffer.h"
-#include "mozilla/StaticPrefs.h"
-
-#if defined(XP_WIN)
-#  include <d3d11.h>
-#  include "mozilla/gfx/DeviceManagerDx.h"
-#elif defined(XP_MACOSX)
-#  include "mozilla/gfx/MacIOSurface.h"
-#endif
-
-using namespace mozilla::gfx;
-
-namespace mozilla {
-namespace gfx {
-
-PuppetSession::PuppetSession() : VRSession() {}
-
-PuppetSession::~PuppetSession() { Shutdown(); }
-
-bool PuppetSession::Initialize(mozilla::gfx::VRSystemState& aSystemState) {
-  if (!StaticPrefs::dom_vr_enabled() || !StaticPrefs::dom_vr_puppet_enabled()) {
-    return false;
-  }
-  VRPuppetCommandBuffer::Get().Run(aSystemState);
-  if (!aSystemState.displayState.isConnected) {
-    return false;
-  }
-#if defined(XP_WIN)
-  if (!CreateD3DObjects()) {
-    Shutdown();
-    return false;
-  }
-#endif
-
-  // Succeeded
-  return true;
-}
-
-#if defined(XP_WIN)
-bool PuppetSession::CreateD3DObjects() {
-  RefPtr<ID3D11Device> device = gfx::DeviceManagerDx::Get()->GetVRDevice();
-  if (!device) {
-    return false;
-  }
-  if (!CreateD3DContext(device)) {
-    return false;
-  }
-  return true;
-}
-#endif
-
-void PuppetSession::Shutdown() {}
-
-void PuppetSession::StartFrame(mozilla::gfx::VRSystemState& aSystemState) {
-  VRPuppetCommandBuffer::Get().Run(aSystemState);
-}
-
-void PuppetSession::ProcessEvents(mozilla::gfx::VRSystemState& aSystemState) {
-  VRPuppetCommandBuffer& puppet = VRPuppetCommandBuffer::Get();
-  puppet.Run(aSystemState);
-  if (!aSystemState.displayState.isConnected) {
-    mShouldQuit = true;
-  }
-}
-
-#if defined(XP_WIN)
-bool PuppetSession::SubmitFrame(
-    const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
-    ID3D11Texture2D* aTexture) {
-  return VRPuppetCommandBuffer::Get().SubmitFrame();
-}
-#elif defined(XP_MACOSX)
-bool PuppetSession::SubmitFrame(
-    const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
-    const VRLayerTextureHandle& aTexture) {
-  return VRPuppetCommandBuffer::Get().SubmitFrame();
-}
-#endif
-
-void PuppetSession::StopPresentation() {
-  VRPuppetCommandBuffer::Get().StopPresentation();
-}
-
-bool PuppetSession::StartPresentation() {
-  VRPuppetCommandBuffer::Get().StartPresentation();
-  return true;
-}
-
-void PuppetSession::VibrateHaptic(uint32_t aControllerIdx,
-                                  uint32_t aHapticIndex, float aIntensity,
-                                  float aDuration) {
-  VRPuppetCommandBuffer::Get().VibrateHaptic(aControllerIdx, aHapticIndex,
-                                             aIntensity, aDuration);
-}
-
-void PuppetSession::StopVibrateHaptic(uint32_t aControllerIdx) {
-  VRPuppetCommandBuffer::Get().StopVibrateHaptic(aControllerIdx);
-}
-
-void PuppetSession::StopAllHaptics() {
-  VRPuppetCommandBuffer::Get().StopAllHaptics();
-}
-
-}  // namespace gfx
-}  // namespace mozilla
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "PuppetSession.h"
+
+#include "nsString.h"
+#include "VRPuppetCommandBuffer.h"
+#include "mozilla/StaticPrefs.h"
+
+#if defined(XP_WIN)
+#  include <d3d11.h>
+#  include "mozilla/gfx/DeviceManagerDx.h"
+#elif defined(XP_MACOSX)
+#  include "mozilla/gfx/MacIOSurface.h"
+#endif
+
+using namespace mozilla::gfx;
+
+namespace mozilla {
+namespace gfx {
+
+PuppetSession::PuppetSession() : VRSession() {}
+
+PuppetSession::~PuppetSession() { Shutdown(); }
+
+bool PuppetSession::Initialize(mozilla::gfx::VRSystemState& aSystemState) {
+  if (!StaticPrefs::dom_vr_enabled() || !StaticPrefs::dom_vr_puppet_enabled()) {
+    return false;
+  }
+  VRPuppetCommandBuffer::Get().Run(aSystemState);
+  if (!aSystemState.displayState.isConnected) {
+    return false;
+  }
+#if defined(XP_WIN)
+  if (!CreateD3DObjects()) {
+    Shutdown();
+    return false;
+  }
+#endif
+
+  // Succeeded
+  return true;
+}
+
+#if defined(XP_WIN)
+bool PuppetSession::CreateD3DObjects() {
+  RefPtr<ID3D11Device> device = gfx::DeviceManagerDx::Get()->GetVRDevice();
+  if (!device) {
+    return false;
+  }
+  if (!CreateD3DContext(device)) {
+    return false;
+  }
+  return true;
+}
+#endif
+
+void PuppetSession::Shutdown() {}
+
+void PuppetSession::StartFrame(mozilla::gfx::VRSystemState& aSystemState) {
+  VRPuppetCommandBuffer::Get().Run(aSystemState);
+}
+
+void PuppetSession::ProcessEvents(mozilla::gfx::VRSystemState& aSystemState) {
+  VRPuppetCommandBuffer& puppet = VRPuppetCommandBuffer::Get();
+  puppet.Run(aSystemState);
+  if (!aSystemState.displayState.isConnected) {
+    mShouldQuit = true;
+  }
+}
+
+#if defined(XP_WIN)
+bool PuppetSession::SubmitFrame(
+    const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
+    ID3D11Texture2D* aTexture) {
+  return VRPuppetCommandBuffer::Get().SubmitFrame();
+}
+#elif defined(XP_MACOSX)
+bool PuppetSession::SubmitFrame(
+    const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
+    const VRLayerTextureHandle& aTexture) {
+  return VRPuppetCommandBuffer::Get().SubmitFrame();
+}
+#endif
+
+void PuppetSession::StopPresentation() {
+  VRPuppetCommandBuffer::Get().StopPresentation();
+}
+
+bool PuppetSession::StartPresentation() {
+  VRPuppetCommandBuffer::Get().StartPresentation();
+  return true;
+}
+
+void PuppetSession::VibrateHaptic(uint32_t aControllerIdx,
+                                  uint32_t aHapticIndex, float aIntensity,
+                                  float aDuration) {
+  VRPuppetCommandBuffer::Get().VibrateHaptic(aControllerIdx, aHapticIndex,
+                                             aIntensity, aDuration);
+}
+
+void PuppetSession::StopVibrateHaptic(uint32_t aControllerIdx) {
+  VRPuppetCommandBuffer::Get().StopVibrateHaptic(aControllerIdx);
+}
+
+void PuppetSession::StopAllHaptics() {
+  VRPuppetCommandBuffer::Get().StopAllHaptics();
+}
+
+}  // namespace gfx
+}  // namespace mozilla
--- a/gfx/vr/service/PuppetSession.h
+++ b/gfx/vr/service/PuppetSession.h
@@ -1,57 +1,57 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef GFX_VR_SERVICE_PUPPETSESSION_H
-#define GFX_VR_SERVICE_PUPPETSESSION_H
-
-#include "VRSession.h"
-
-#include "mozilla/TimeStamp.h"
-#include "moz_external_vr.h"
-
-#if defined(XP_WIN)
-#  include <d3d11_1.h>
-#endif
-class nsITimer;
-
-namespace mozilla {
-namespace gfx {
-
-class PuppetSession : public VRSession {
- public:
-  PuppetSession();
-  virtual ~PuppetSession();
-
-  bool Initialize(mozilla::gfx::VRSystemState& aSystemState) override;
-  void Shutdown() override;
-  void ProcessEvents(mozilla::gfx::VRSystemState& aSystemState) override;
-  void StartFrame(mozilla::gfx::VRSystemState& aSystemState) override;
-  bool StartPresentation() override;
-  void StopPresentation() override;
-  void VibrateHaptic(uint32_t aControllerIdx, uint32_t aHapticIndex,
-                     float aIntensity, float aDuration) override;
-  void StopVibrateHaptic(uint32_t aControllerIdx) override;
-  void StopAllHaptics() override;
-
- protected:
-#if defined(XP_WIN)
-  bool SubmitFrame(const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
-                   ID3D11Texture2D* aTexture) override;
-#elif defined(XP_MACOSX)
-  bool SubmitFrame(const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
-                   const VRLayerTextureHandle& aTexture) override;
-#endif
-
- private:
-#if defined(XP_WIN)
-  bool CreateD3DObjects();
-#endif
-};
-
-}  // namespace gfx
-}  // namespace mozilla
-
-#endif  // GFX_VR_SERVICE_PUPPETSESSION_H
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GFX_VR_SERVICE_PUPPETSESSION_H
+#define GFX_VR_SERVICE_PUPPETSESSION_H
+
+#include "VRSession.h"
+
+#include "mozilla/TimeStamp.h"
+#include "moz_external_vr.h"
+
+#if defined(XP_WIN)
+#  include <d3d11_1.h>
+#endif
+class nsITimer;
+
+namespace mozilla {
+namespace gfx {
+
+class PuppetSession : public VRSession {
+ public:
+  PuppetSession();
+  virtual ~PuppetSession();
+
+  bool Initialize(mozilla::gfx::VRSystemState& aSystemState) override;
+  void Shutdown() override;
+  void ProcessEvents(mozilla::gfx::VRSystemState& aSystemState) override;
+  void StartFrame(mozilla::gfx::VRSystemState& aSystemState) override;
+  bool StartPresentation() override;
+  void StopPresentation() override;
+  void VibrateHaptic(uint32_t aControllerIdx, uint32_t aHapticIndex,
+                     float aIntensity, float aDuration) override;
+  void StopVibrateHaptic(uint32_t aControllerIdx) override;
+  void StopAllHaptics() override;
+
+ protected:
+#if defined(XP_WIN)
+  bool SubmitFrame(const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
+                   ID3D11Texture2D* aTexture) override;
+#elif defined(XP_MACOSX)
+  bool SubmitFrame(const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
+                   const VRLayerTextureHandle& aTexture) override;
+#endif
+
+ private:
+#if defined(XP_WIN)
+  bool CreateD3DObjects();
+#endif
+};
+
+}  // namespace gfx
+}  // namespace mozilla
+
+#endif  // GFX_VR_SERVICE_PUPPETSESSION_H
--- a/gfx/vr/service/binding/OpenVRKnucklesBinding.h
+++ b/gfx/vr/service/binding/OpenVRKnucklesBinding.h
@@ -1,300 +1,300 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef GFX_VR_BLINDING_OPENVRKNUCKLESBINDING_H
-#define GFX_VR_BLINDING_OPENVRKNUCKLESBINDING_H
-
-namespace mozilla {
-namespace gfx {
-
-struct OpenVRKnucklesBinding {
-  const char* binding =
-      // clang-format off
-  "{\n"
-    "  \"version\" : \"0.1\", \n"
-    "  \"controller_type\" : \"knuckles\", \n"
-    "  \"description\" : \"Bindings for Firefox OpenVR for the Knuckles controller\", \n"
-    "  \"name\" : \"Firefox bindings for Knuckles Controller\", \n"
-    "  \"bindings\" : { \n"
-    "     \"/actions/firefox\" : { \n"
-    "         \"poses\" : [        \n"
-    "           {                \n"
-    "             \"output\" : \"/actions/firefox/in/LHand_pose\", \n"
-    "              \"path\" : \"/user/hand/left/pose/raw\"     \n"
-    "            },\n"
-    "            {                                             \n"
-    "              \"output\" : \"/actions/firefox/in/RHand_pose\", \n"
-    "              \"path\" : \"/user/hand/right/pose/raw\"    \n"
-    "            }\n"
-    "         ],\n"
-    "         \"haptics\" : [ \n"
-    "            {\n"
-    "              \"output\" : \"/actions/firefox/out/LHand_haptic\",  \n"
-    "              \"path\" : \"/user/hand/left/output/haptic\"     \n"
-    "            },\n"
-    "            { \n"
-    "              \"output\" : \"/actions/firefox/out/RHand_haptic\", \n"
-    "              \"path\" : \"/user/hand/right/output/haptic\"    \n"
-    "            }\n"
-    "		  ],\n"
-    "       \"sources\" : [ \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"position\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_analog\" \n"
-    "               }, \n"
-    "               \"click\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_pressed\" \n"
-    "               }, \n"
-    "               \"touch\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_touched\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"trackpad\", \n"
-    "             \"path\" : \"/user/hand/left/input/trackpad\" \n"
-    "           },\n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"position\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_analog\" \n"
-    "               }, \n"
-    "               \"click\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_pressed\" \n"
-    "               }, \n"
-    "               \"touch\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_touched\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"trackpad\", \n"
-    "             \"path\" : \"/user/hand/right/input/trackpad\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "                 \"pull\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/LHand_trigger_value\"  \n"
-    "                   } \n"
-    "              },\n"
-    "             \"mode\" : \"trigger\", \n"
-    "             \"path\" : \"/user/hand/left/input/trigger\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "                 \"pull\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/RHand_trigger_value\"  \n"
-    "                   } \n"
-    "              },\n"
-    "             \"mode\" : \"trigger\", \n"
-    "             \"path\" : \"/user/hand/right/input/trigger\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"click\" : { \n"
-    "                \"output\" : \"/actions/firefox/in/LHand_grip_pressed\" \n"
-    "              }, \n"
-    "               \"touch\" : { \n"
-    "                \"output\" : \"/actions/firefox/in/LHand_grip_touched\" \n"
-    "              } \n"
-    "             }, \n"
-    "             \"mode\" : \"button\", \n"
-    "             \"path\" : \"/user/hand/left/input/grip\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"click\" : { \n"
-    "                \"output\" : \"/actions/firefox/in/RHand_grip_pressed\" \n"
-    "              }, \n"
-    "               \"touch\" : { \n"
-    "                 \"output\" : \"/actions/firefox/in/RHand_grip_touched\" \n"
-    "              } \n"
-    "           }, \n"
-    "             \"mode\" : \"button\", \n"
-    "             \"path\" : \"/user/hand/right/input/grip\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "                 \"click\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/LHand_system_pressed\"  \n"
-    "                   }, \n"
-    "                 \"touch\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/LHand_system_touched\"  \n"
-    "                   } \n"
-    "              },\n"
-    "             \"mode\" : \"button\", \n"
-    "             \"path\" : \"/user/hand/left/input/system\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "                 \"click\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/RHand_system_pressed\"  \n"
-    "                   }, \n"
-    "                 \"touch\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/RHand_system_touched\"  \n"
-    "                   } \n"
-    "              },\n"
-    "             \"mode\" : \"button\", \n"
-    "             \"path\" : \"/user/hand/right/input/system\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "                 \"click\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/LHand_a_pressed\"  \n"
-    "                   }, \n"
-    "                 \"touch\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/LHand_a_touched\"  \n"
-    "                   } \n"
-    "              },\n"
-    "             \"mode\" : \"button\", \n"
-    "             \"path\" : \"/user/hand/left/input/a\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "                 \"click\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/RHand_a_pressed\"  \n"
-    "                   }, \n"
-    "                 \"touch\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/RHand_a_touched\"  \n"
-    "                   } \n"
-    "              },\n"
-    "             \"mode\" : \"button\", \n"
-    "             \"path\" : \"/user/hand/right/input/a\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "                 \"click\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/LHand_b_pressed\"  \n"
-    "                   }, \n"
-    "                 \"touch\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/LHand_b_touched\"  \n"
-    "                   } \n"
-    "              },\n"
-    "             \"mode\" : \"button\", \n"
-    "             \"path\" : \"/user/hand/left/input/b\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "                 \"click\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/RHand_b_pressed\"  \n"
-    "                   }, \n"
-    "                 \"touch\" : { \n"
-    "                    \"output\" : \"/actions/firefox/in/RHand_b_touched\"  \n"
-    "                   } \n"
-    "              },\n"
-    "             \"mode\" : \"button\", \n"
-    "             \"path\" : \"/user/hand/right/input/b\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"position\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/LHand_thumbstick_analog\" \n"
-    "               }, \n"
-    "               \"click\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/LHand_thumbstick_pressed\" \n"
-    "               }, \n"
-    "               \"touch\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/LHand_thumbstick_touched\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"joystick\", \n"
-    "             \"path\" : \"/user/hand/left/input/thumbstick\" \n"
-    "           },\n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"position\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/RHand_thumbstick_analog\" \n"
-    "               }, \n"
-    "               \"click\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/RHand_thumbstick_pressed\" \n"
-    "               }, \n"
-    "               \"touch\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/RHand_thumbstick_touched\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"joystick\", \n"
-    "             \"path\" : \"/user/hand/right/input/thumbstick\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"pull\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/LHand_finger_index_value\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"trigger\", \n"
-    "             \"path\" : \"/user/hand/left/input/finger/index\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"pull\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/RHand_finger_index_value\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"trigger\", \n"
-    "             \"path\" : \"/user/hand/right/input/finger/index\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"pull\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/LHand_finger_middle_value\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"trigger\", \n"
-    "             \"path\" : \"/user/hand/left/input/finger/middle\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"pull\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/RHand_finger_middle_value\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"trigger\", \n"
-    "             \"path\" : \"/user/hand/right/input/finger/middle\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"pull\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/LHand_finger_ring_value\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"trigger\", \n"
-    "             \"path\" : \"/user/hand/left/input/finger/ring\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"pull\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/RHand_finger_ring_value\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"trigger\", \n"
-    "             \"path\" : \"/user/hand/right/input/finger/ring\" \n"
-    "           }, \n"
-      "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"pull\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/LHand_finger_pinky_value\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"trigger\", \n"
-    "             \"path\" : \"/user/hand/left/input/finger/pinky\" \n"
-    "           }, \n"
-    "           {\n"
-    "             \"inputs\" : { \n"
-    "               \"pull\" : { \n"
-    "                   \"output\" : \"/actions/firefox/in/RHand_finger_pinky_value\" \n"
-    "               } \n"
-    "             }, \n"
-    "             \"mode\" : \"trigger\", \n"
-    "             \"path\" : \"/user/hand/right/input/finger/pinky\" \n"
-    "           } \n"
-    "         ]\n"
-    "     }\n"
-    "  }\n"
-    "}";
-  // clang-format on
-};
-
-}  // namespace gfx
-}  // namespace mozilla
-
-#endif  // GFX_VR_BLINDING_OPENVRKNUCKLESBINDING_H
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GFX_VR_BLINDING_OPENVRKNUCKLESBINDING_H
+#define GFX_VR_BLINDING_OPENVRKNUCKLESBINDING_H
+
+namespace mozilla {
+namespace gfx {
+
+struct OpenVRKnucklesBinding {
+  const char* binding =
+      // clang-format off
+  "{\n"
+    "  \"version\" : \"0.1\", \n"
+    "  \"controller_type\" : \"knuckles\", \n"
+    "  \"description\" : \"Bindings for Firefox OpenVR for the Knuckles controller\", \n"
+    "  \"name\" : \"Firefox bindings for Knuckles Controller\", \n"
+    "  \"bindings\" : { \n"
+    "     \"/actions/firefox\" : { \n"
+    "         \"poses\" : [        \n"
+    "           {                \n"
+    "             \"output\" : \"/actions/firefox/in/LHand_pose\", \n"
+    "              \"path\" : \"/user/hand/left/pose/raw\"     \n"
+    "            },\n"
+    "            {                                             \n"
+    "              \"output\" : \"/actions/firefox/in/RHand_pose\", \n"
+    "              \"path\" : \"/user/hand/right/pose/raw\"    \n"
+    "            }\n"
+    "         ],\n"
+    "         \"haptics\" : [ \n"
+    "            {\n"
+    "              \"output\" : \"/actions/firefox/out/LHand_haptic\",  \n"
+    "              \"path\" : \"/user/hand/left/output/haptic\"     \n"
+    "            },\n"
+    "            { \n"
+    "              \"output\" : \"/actions/firefox/out/RHand_haptic\", \n"
+    "              \"path\" : \"/user/hand/right/output/haptic\"    \n"
+    "            }\n"
+    "		  ],\n"
+    "       \"sources\" : [ \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"position\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_analog\" \n"
+    "               }, \n"
+    "               \"click\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_pressed\" \n"
+    "               }, \n"
+    "               \"touch\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_touched\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"trackpad\", \n"
+    "             \"path\" : \"/user/hand/left/input/trackpad\" \n"
+    "           },\n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"position\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_analog\" \n"
+    "               }, \n"
+    "               \"click\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_pressed\" \n"
+    "               }, \n"
+    "               \"touch\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_touched\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"trackpad\", \n"
+    "             \"path\" : \"/user/hand/right/input/trackpad\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "                 \"pull\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/LHand_trigger_value\"  \n"
+    "                   } \n"
+    "              },\n"
+    "             \"mode\" : \"trigger\", \n"
+    "             \"path\" : \"/user/hand/left/input/trigger\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "                 \"pull\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/RHand_trigger_value\"  \n"
+    "                   } \n"
+    "              },\n"
+    "             \"mode\" : \"trigger\", \n"
+    "             \"path\" : \"/user/hand/right/input/trigger\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"click\" : { \n"
+    "                \"output\" : \"/actions/firefox/in/LHand_grip_pressed\" \n"
+    "              }, \n"
+    "               \"touch\" : { \n"
+    "                \"output\" : \"/actions/firefox/in/LHand_grip_touched\" \n"
+    "              } \n"
+    "             }, \n"
+    "             \"mode\" : \"button\", \n"
+    "             \"path\" : \"/user/hand/left/input/grip\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"click\" : { \n"
+    "                \"output\" : \"/actions/firefox/in/RHand_grip_pressed\" \n"
+    "              }, \n"
+    "               \"touch\" : { \n"
+    "                 \"output\" : \"/actions/firefox/in/RHand_grip_touched\" \n"
+    "              } \n"
+    "           }, \n"
+    "             \"mode\" : \"button\", \n"
+    "             \"path\" : \"/user/hand/right/input/grip\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "                 \"click\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/LHand_system_pressed\"  \n"
+    "                   }, \n"
+    "                 \"touch\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/LHand_system_touched\"  \n"
+    "                   } \n"
+    "              },\n"
+    "             \"mode\" : \"button\", \n"
+    "             \"path\" : \"/user/hand/left/input/system\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "                 \"click\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/RHand_system_pressed\"  \n"
+    "                   }, \n"
+    "                 \"touch\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/RHand_system_touched\"  \n"
+    "                   } \n"
+    "              },\n"
+    "             \"mode\" : \"button\", \n"
+    "             \"path\" : \"/user/hand/right/input/system\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "                 \"click\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/LHand_a_pressed\"  \n"
+    "                   }, \n"
+    "                 \"touch\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/LHand_a_touched\"  \n"
+    "                   } \n"
+    "              },\n"
+    "             \"mode\" : \"button\", \n"
+    "             \"path\" : \"/user/hand/left/input/a\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "                 \"click\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/RHand_a_pressed\"  \n"
+    "                   }, \n"
+    "                 \"touch\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/RHand_a_touched\"  \n"
+    "                   } \n"
+    "              },\n"
+    "             \"mode\" : \"button\", \n"
+    "             \"path\" : \"/user/hand/right/input/a\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "                 \"click\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/LHand_b_pressed\"  \n"
+    "                   }, \n"
+    "                 \"touch\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/LHand_b_touched\"  \n"
+    "                   } \n"
+    "              },\n"
+    "             \"mode\" : \"button\", \n"
+    "             \"path\" : \"/user/hand/left/input/b\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "                 \"click\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/RHand_b_pressed\"  \n"
+    "                   }, \n"
+    "                 \"touch\" : { \n"
+    "                    \"output\" : \"/actions/firefox/in/RHand_b_touched\"  \n"
+    "                   } \n"
+    "              },\n"
+    "             \"mode\" : \"button\", \n"
+    "             \"path\" : \"/user/hand/right/input/b\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"position\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/LHand_thumbstick_analog\" \n"
+    "               }, \n"
+    "               \"click\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/LHand_thumbstick_pressed\" \n"
+    "               }, \n"
+    "               \"touch\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/LHand_thumbstick_touched\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"joystick\", \n"
+    "             \"path\" : \"/user/hand/left/input/thumbstick\" \n"
+    "           },\n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"position\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/RHand_thumbstick_analog\" \n"
+    "               }, \n"
+    "               \"click\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/RHand_thumbstick_pressed\" \n"
+    "               }, \n"
+    "               \"touch\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/RHand_thumbstick_touched\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"joystick\", \n"
+    "             \"path\" : \"/user/hand/right/input/thumbstick\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"pull\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/LHand_finger_index_value\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"trigger\", \n"
+    "             \"path\" : \"/user/hand/left/input/finger/index\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"pull\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/RHand_finger_index_value\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"trigger\", \n"
+    "             \"path\" : \"/user/hand/right/input/finger/index\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"pull\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/LHand_finger_middle_value\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"trigger\", \n"
+    "             \"path\" : \"/user/hand/left/input/finger/middle\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"pull\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/RHand_finger_middle_value\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"trigger\", \n"
+    "             \"path\" : \"/user/hand/right/input/finger/middle\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"pull\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/LHand_finger_ring_value\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"trigger\", \n"
+    "             \"path\" : \"/user/hand/left/input/finger/ring\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"pull\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/RHand_finger_ring_value\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"trigger\", \n"
+    "             \"path\" : \"/user/hand/right/input/finger/ring\" \n"
+    "           }, \n"
+      "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"pull\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/LHand_finger_pinky_value\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"trigger\", \n"
+    "             \"path\" : \"/user/hand/left/input/finger/pinky\" \n"
+    "           }, \n"
+    "           {\n"
+    "             \"inputs\" : { \n"
+    "               \"pull\" : { \n"
+    "                   \"output\" : \"/actions/firefox/in/RHand_finger_pinky_value\" \n"
+    "               } \n"
+    "             }, \n"
+    "             \"mode\" : \"trigger\", \n"
+    "             \"path\" : \"/user/hand/right/input/finger/pinky\" \n"
+    "           } \n"
+    "         ]\n"
+    "     }\n"
+    "  }\n"
+    "}";
+  // clang-format on
+};
+
+}  // namespace gfx
+}  // namespace mozilla
+
+#endif  // GFX_VR_BLINDING_OPENVRKNUCKLESBINDING_H
--- a/gfx/vr/service/binding/OpenVRViveBinding.h
+++ b/gfx/vr/service/binding/OpenVRViveBinding.h
@@ -1,174 +1,174 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef GFX_VR_BLINDING_OPENVRVIVEBINDING_H
-#define GFX_VR_BLINDING_OPENVRVIVEBINDING_H
-
-namespace mozilla {
-namespace gfx {
-
-struct OpenVRViveBinding {
-  const char* binding =
-      // clang-format off
-  "{\n"
-  "  \"version\" : \"0.1\", \n"
-  "  \"controller_type\" : \"vive_controller\", \n"
-  "  \"description\" : \"Bindings for Firefox OpenVR for the Vive controller\", \n"
-  "  \"name\" : \"Firefox bindings for Vive Controller\", \n"
-  "  \"bindings\" : { \n"
-  "     \"/actions/firefox\" : { \n"
-  "         \"poses\" : [        \n"
-  "           {                \n"
-  "             \"output\" : \"/actions/firefox/in/LHand_pose\", \n"
-  "              \"path\" : \"/user/hand/left/pose/raw\"     \n"
-  "            },\n"
-  "            {                                             \n"
-  "              \"output\" : \"/actions/firefox/in/RHand_pose\", \n"
-  "              \"path\" : \"/user/hand/right/pose/raw\"    \n"
-  "            }\n"
-  "         ],\n"
-  "         \"haptics\" : [ \n"
-  "            {\n"
-  "              \"output\" : \"/actions/firefox/out/LHand_haptic\",  \n"
-  "              \"path\" : \"/user/hand/left/output/haptic\"     \n"
-  "            },\n"
-  "            { \n"
-  "              \"output\" : \"/actions/firefox/out/RHand_haptic\", \n"
-  "              \"path\" : \"/user/hand/right/output/haptic\"    \n"
-  "            }\n"
-  "		  ],\n"
-  "       \"sources\" : [ \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "               \"position\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_analog\" \n"
-  "               }, \n"
-  "               \"click\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_pressed\" \n"
-  "               }, \n"
-  "               \"touch\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_touched\" \n"
-  "               } \n"
-  "             }, \n"
-  "             \"mode\" : \"trackpad\", \n"
-  "             \"path\" : \"/user/hand/left/input/trackpad\" \n"
-  "           },\n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "               \"position\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_analog\" \n"
-  "               }, \n"
-  "               \"click\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_pressed\" \n"
-  "               }, \n"
-  "               \"touch\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_touched\" \n"
-  "               } \n"
-  "             }, \n"
-  "             \"mode\" : \"trackpad\", \n"
-  "             \"path\" : \"/user/hand/right/input/trackpad\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"pull\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/LHand_trigger_value\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"trigger\", \n"
-  "             \"path\" : \"/user/hand/left/input/trigger\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"pull\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/RHand_trigger_value\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"trigger\", \n"
-  "             \"path\" : \"/user/hand/right/input/trigger\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "               \"click\" : { \n"
-  "                \"output\" : \"/actions/firefox/in/LHand_grip_pressed\" \n"
-  "              }, \n"
-  "               \"touch\" : { \n"
-  "                 \"output\" : \"/actions/firefox/in/LHand_grip_touched\" \n"
-  "              } \n"
-  "             }, \n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/left/input/grip\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "               \"click\" : { \n"
-  "               \"output\" : \"/actions/firefox/in/RHand_grip_pressed\" \n"
-  "              }, \n"
-  "               \"touch\" : { \n"
-  "                \"output\" : \"/actions/firefox/in/RHand_grip_touched\" \n"
-  "              } \n"
-  "           }, \n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/right/input/grip\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"click\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/LHand_menu_pressed\"  \n"
-  "                   }, \n"
-  "                 \"touch\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/LHand_menu_touched\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/left/input/application_menu\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"click\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/RHand_menu_pressed\"  \n"
-  "                   }, \n"
-  "                 \"touch\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/RHand_menu_touched\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/right/input/application_menu\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"click\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/LHand_system_pressed\"  \n"
-  "                   }, \n"
-  "                 \"touch\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/LHand_system_touched\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/left/input/system\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"click\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/RHand_system_pressed\"  \n"
-  "                   }, \n"
-  "                 \"touch\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/RHand_system_touched\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/right/input/system\" \n"
-  "           } \n"
-  "         ]\n"
-  "     }\n"
-  "  }\n"
-  "}";
-  // clang-format on
-};
-
-}  // namespace gfx
-}  // namespace mozilla
-
-#endif  // GFX_VR_BLINDING_OPENVRVIVEBINDING_H
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GFX_VR_BLINDING_OPENVRVIVEBINDING_H
+#define GFX_VR_BLINDING_OPENVRVIVEBINDING_H
+
+namespace mozilla {
+namespace gfx {
+
+struct OpenVRViveBinding {
+  const char* binding =
+      // clang-format off
+  "{\n"
+  "  \"version\" : \"0.1\", \n"
+  "  \"controller_type\" : \"vive_controller\", \n"
+  "  \"description\" : \"Bindings for Firefox OpenVR for the Vive controller\", \n"
+  "  \"name\" : \"Firefox bindings for Vive Controller\", \n"
+  "  \"bindings\" : { \n"
+  "     \"/actions/firefox\" : { \n"
+  "         \"poses\" : [        \n"
+  "           {                \n"
+  "             \"output\" : \"/actions/firefox/in/LHand_pose\", \n"
+  "              \"path\" : \"/user/hand/left/pose/raw\"     \n"
+  "            },\n"
+  "            {                                             \n"
+  "              \"output\" : \"/actions/firefox/in/RHand_pose\", \n"
+  "              \"path\" : \"/user/hand/right/pose/raw\"    \n"
+  "            }\n"
+  "         ],\n"
+  "         \"haptics\" : [ \n"
+  "            {\n"
+  "              \"output\" : \"/actions/firefox/out/LHand_haptic\",  \n"
+  "              \"path\" : \"/user/hand/left/output/haptic\"     \n"
+  "            },\n"
+  "            { \n"
+  "              \"output\" : \"/actions/firefox/out/RHand_haptic\", \n"
+  "              \"path\" : \"/user/hand/right/output/haptic\"    \n"
+  "            }\n"
+  "		  ],\n"
+  "       \"sources\" : [ \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "               \"position\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_analog\" \n"
+  "               }, \n"
+  "               \"click\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_pressed\" \n"
+  "               }, \n"
+  "               \"touch\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_touched\" \n"
+  "               } \n"
+  "             }, \n"
+  "             \"mode\" : \"trackpad\", \n"
+  "             \"path\" : \"/user/hand/left/input/trackpad\" \n"
+  "           },\n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "               \"position\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_analog\" \n"
+  "               }, \n"
+  "               \"click\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_pressed\" \n"
+  "               }, \n"
+  "               \"touch\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_touched\" \n"
+  "               } \n"
+  "             }, \n"
+  "             \"mode\" : \"trackpad\", \n"
+  "             \"path\" : \"/user/hand/right/input/trackpad\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"pull\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/LHand_trigger_value\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"trigger\", \n"
+  "             \"path\" : \"/user/hand/left/input/trigger\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"pull\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/RHand_trigger_value\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"trigger\", \n"
+  "             \"path\" : \"/user/hand/right/input/trigger\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "               \"click\" : { \n"
+  "                \"output\" : \"/actions/firefox/in/LHand_grip_pressed\" \n"
+  "              }, \n"
+  "               \"touch\" : { \n"
+  "                 \"output\" : \"/actions/firefox/in/LHand_grip_touched\" \n"
+  "              } \n"
+  "             }, \n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/left/input/grip\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "               \"click\" : { \n"
+  "               \"output\" : \"/actions/firefox/in/RHand_grip_pressed\" \n"
+  "              }, \n"
+  "               \"touch\" : { \n"
+  "                \"output\" : \"/actions/firefox/in/RHand_grip_touched\" \n"
+  "              } \n"
+  "           }, \n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/right/input/grip\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"click\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/LHand_menu_pressed\"  \n"
+  "                   }, \n"
+  "                 \"touch\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/LHand_menu_touched\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/left/input/application_menu\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"click\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/RHand_menu_pressed\"  \n"
+  "                   }, \n"
+  "                 \"touch\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/RHand_menu_touched\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/right/input/application_menu\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"click\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/LHand_system_pressed\"  \n"
+  "                   }, \n"
+  "                 \"touch\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/LHand_system_touched\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/left/input/system\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"click\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/RHand_system_pressed\"  \n"
+  "                   }, \n"
+  "                 \"touch\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/RHand_system_touched\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/right/input/system\" \n"
+  "           } \n"
+  "         ]\n"
+  "     }\n"
+  "  }\n"
+  "}";
+  // clang-format on
+};
+
+}  // namespace gfx
+}  // namespace mozilla
+
+#endif  // GFX_VR_BLINDING_OPENVRVIVEBINDING_H
--- a/gfx/vr/service/binding/OpenVRWMRBinding.h
+++ b/gfx/vr/service/binding/OpenVRWMRBinding.h
@@ -1,192 +1,192 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef GFX_VR_BLINDING_OPENVRWMRBINDING_H
-#define GFX_VR_BLINDING_OPENVRWMRBINDING_H
-
-namespace mozilla {
-namespace gfx {
-
-struct OpenVRWMRBinding {
-  const char* binding =
-      // clang-format off
-  "{\n"
-  "  \"version\" : \"0.1\", \n"
-  "  \"controller_type\" : \"holographic_controller\", \n"
-  "  \"description\" : \"Bindings for Firefox OpenVR for the Windows Mixed Reality controller\", \n"
-  "  \"name\" : \"Firefox bindings for Mixed Reality Controller\", \n"
-  "  \"bindings\" : { \n"
-  "     \"/actions/firefox\" : { \n"
-  "         \"poses\" : [        \n"
-  "           {                \n"
-  "             \"output\" : \"/actions/firefox/in/LHand_pose\", \n"
-  "              \"path\" : \"/user/hand/left/pose/raw\"     \n"
-  "            },\n"
-  "            {                                             \n"
-  "              \"output\" : \"/actions/firefox/in/RHand_pose\", \n"
-  "              \"path\" : \"/user/hand/right/pose/raw\"    \n"
-  "            }\n"
-  "         ],\n"
-  "         \"haptics\" : [ \n"
-  "            {\n"
-  "              \"output\" : \"/actions/firefox/out/LHand_haptic\",  \n"
-  "              \"path\" : \"/user/hand/left/output/haptic\"     \n"
-  "            },\n"
-  "            { \n"
-  "              \"output\" : \"/actions/firefox/out/RHand_haptic\", \n"
-  "              \"path\" : \"/user/hand/right/output/haptic\"    \n"
-  "            }\n"
-  "		  ],\n"
-  "       \"sources\" : [ \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "               \"position\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_analog\" \n"
-  "               }, \n"
-  "               \"click\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_pressed\" \n"
-  "               }, \n"
-  "               \"touch\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_touched\" \n"
-  "               } \n"
-  "             }, \n"
-  "             \"mode\" : \"trackpad\", \n"
-  "             \"path\" : \"/user/hand/left/input/trackpad\" \n"
-  "           },\n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "               \"position\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_analog\" \n"
-  "               }, \n"
-  "               \"click\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_pressed\" \n"
-  "               }, \n"
-  "               \"touch\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_touched\" \n"
-  "               } \n"
-  "             }, \n"
-  "             \"mode\" : \"trackpad\", \n"
-  "             \"path\" : \"/user/hand/right/input/trackpad\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"pull\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/LHand_trigger_value\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"trigger\", \n"
-  "             \"path\" : \"/user/hand/left/input/trigger\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"pull\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/RHand_trigger_value\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"trigger\", \n"
-  "             \"path\" : \"/user/hand/right/input/trigger\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "               \"click\" : { \n"
-  "                \"output\" : \"/actions/firefox/in/LHand_grip_pressed\" \n"
-  "              }, \n"
-  "               \"touch\" : { \n"
-  "                 \"output\" : \"/actions/firefox/in/LHand_grip_touched\" \n"
-  "              } \n"
-  "             }, \n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/left/input/grip\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "               \"click\" : { \n"
-  "                \"output\" : \"/actions/firefox/in/RHand_grip_pressed\" \n"
-  "              }, \n"
-  "               \"touch\" : { \n"
-  "                 \"output\" : \"/actions/firefox/in/RHand_grip_touched\" \n"
-  "              } \n"
-  "             }, \n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/right/input/grip\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"click\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/LHand_menu_pressed\"  \n"
-  "                   }, \n"
-  "                 \"touch\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/LHand_menu_touched\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/left/input/application_menu\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"click\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/RHand_menu_pressed\"  \n"
-  "                   }, \n"
-  "                 \"touch\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/RHand_menu_touched\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/right/input/application_menu\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"click\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/LHand_system_pressed\"  \n"
-  "                   }, \n"
-  "                 \"touch\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/LHand_system_touched\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/left/input/system\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "                 \"click\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/RHand_system_pressed\"  \n"
-  "                   }, \n"
-  "                 \"touch\" : { \n"
-  "                    \"output\" : \"/actions/firefox/in/RHand_system_touched\"  \n"
-  "                   } \n"
-  "              },\n"
-  "             \"mode\" : \"button\", \n"
-  "             \"path\" : \"/user/hand/right/input/system\" \n"
-  "           }, \n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "               \"position\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/LHand_thumbstick_analog\" \n"
-  "               } \n"
-  "             }, \n"
-  "             \"mode\" : \"joystick\", \n"
-  "             \"path\" : \"/user/hand/left/input/joystick\" \n"
-  "           },\n"
-  "           {\n"
-  "             \"inputs\" : { \n"
-  "               \"position\" : { \n"
-  "                   \"output\" : \"/actions/firefox/in/RHand_thumbstick_analog\" \n"
-  "               } \n"
-  "             }, \n"
-  "             \"mode\" : \"joystick\", \n"
-  "             \"path\" : \"/user/hand/right/input/joystick\" \n"
-  "           } \n"
-  "         ]\n"
-  "     }\n"
-  "  }\n"
-  "}";
-  // clang-format on
-};
-
-}  // namespace gfx
-}  // namespace mozilla
-
-#endif  // GFX_VR_BLINDING_OPENVRWMRBINDING_H
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GFX_VR_BLINDING_OPENVRWMRBINDING_H
+#define GFX_VR_BLINDING_OPENVRWMRBINDING_H
+
+namespace mozilla {
+namespace gfx {
+
+struct OpenVRWMRBinding {
+  const char* binding =
+      // clang-format off
+  "{\n"
+  "  \"version\" : \"0.1\", \n"
+  "  \"controller_type\" : \"holographic_controller\", \n"
+  "  \"description\" : \"Bindings for Firefox OpenVR for the Windows Mixed Reality controller\", \n"
+  "  \"name\" : \"Firefox bindings for Mixed Reality Controller\", \n"
+  "  \"bindings\" : { \n"
+  "     \"/actions/firefox\" : { \n"
+  "         \"poses\" : [        \n"
+  "           {                \n"
+  "             \"output\" : \"/actions/firefox/in/LHand_pose\", \n"
+  "              \"path\" : \"/user/hand/left/pose/raw\"     \n"
+  "            },\n"
+  "            {                                             \n"
+  "              \"output\" : \"/actions/firefox/in/RHand_pose\", \n"
+  "              \"path\" : \"/user/hand/right/pose/raw\"    \n"
+  "            }\n"
+  "         ],\n"
+  "         \"haptics\" : [ \n"
+  "            {\n"
+  "              \"output\" : \"/actions/firefox/out/LHand_haptic\",  \n"
+  "              \"path\" : \"/user/hand/left/output/haptic\"     \n"
+  "            },\n"
+  "            { \n"
+  "              \"output\" : \"/actions/firefox/out/RHand_haptic\", \n"
+  "              \"path\" : \"/user/hand/right/output/haptic\"    \n"
+  "            }\n"
+  "		  ],\n"
+  "       \"sources\" : [ \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "               \"position\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_analog\" \n"
+  "               }, \n"
+  "               \"click\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_pressed\" \n"
+  "               }, \n"
+  "               \"touch\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/LHand_trackpad_touched\" \n"
+  "               } \n"
+  "             }, \n"
+  "             \"mode\" : \"trackpad\", \n"
+  "             \"path\" : \"/user/hand/left/input/trackpad\" \n"
+  "           },\n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "               \"position\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_analog\" \n"
+  "               }, \n"
+  "               \"click\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_pressed\" \n"
+  "               }, \n"
+  "               \"touch\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/RHand_trackpad_touched\" \n"
+  "               } \n"
+  "             }, \n"
+  "             \"mode\" : \"trackpad\", \n"
+  "             \"path\" : \"/user/hand/right/input/trackpad\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"pull\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/LHand_trigger_value\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"trigger\", \n"
+  "             \"path\" : \"/user/hand/left/input/trigger\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"pull\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/RHand_trigger_value\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"trigger\", \n"
+  "             \"path\" : \"/user/hand/right/input/trigger\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "               \"click\" : { \n"
+  "                \"output\" : \"/actions/firefox/in/LHand_grip_pressed\" \n"
+  "              }, \n"
+  "               \"touch\" : { \n"
+  "                 \"output\" : \"/actions/firefox/in/LHand_grip_touched\" \n"
+  "              } \n"
+  "             }, \n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/left/input/grip\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "               \"click\" : { \n"
+  "                \"output\" : \"/actions/firefox/in/RHand_grip_pressed\" \n"
+  "              }, \n"
+  "               \"touch\" : { \n"
+  "                 \"output\" : \"/actions/firefox/in/RHand_grip_touched\" \n"
+  "              } \n"
+  "             }, \n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/right/input/grip\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"click\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/LHand_menu_pressed\"  \n"
+  "                   }, \n"
+  "                 \"touch\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/LHand_menu_touched\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/left/input/application_menu\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"click\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/RHand_menu_pressed\"  \n"
+  "                   }, \n"
+  "                 \"touch\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/RHand_menu_touched\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/right/input/application_menu\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"click\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/LHand_system_pressed\"  \n"
+  "                   }, \n"
+  "                 \"touch\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/LHand_system_touched\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/left/input/system\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "                 \"click\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/RHand_system_pressed\"  \n"
+  "                   }, \n"
+  "                 \"touch\" : { \n"
+  "                    \"output\" : \"/actions/firefox/in/RHand_system_touched\"  \n"
+  "                   } \n"
+  "              },\n"
+  "             \"mode\" : \"button\", \n"
+  "             \"path\" : \"/user/hand/right/input/system\" \n"
+  "           }, \n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "               \"position\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/LHand_thumbstick_analog\" \n"
+  "               } \n"
+  "             }, \n"
+  "             \"mode\" : \"joystick\", \n"
+  "             \"path\" : \"/user/hand/left/input/joystick\" \n"
+  "           },\n"
+  "           {\n"
+  "             \"inputs\" : { \n"
+  "               \"position\" : { \n"
+  "                   \"output\" : \"/actions/firefox/in/RHand_thumbstick_analog\" \n"
+  "               } \n"
+  "             }, \n"
+  "             \"mode\" : \"joystick\", \n"
+  "             \"path\" : \"/user/hand/right/input/joystick\" \n"
+  "           } \n"
+  "         ]\n"
+  "     }\n"
+  "  }\n"
+  "}";
+  // clang-format on
+};
+
+}  // namespace gfx
+}  // namespace mozilla
+
+#endif  // GFX_VR_BLINDING_OPENVRWMRBINDING_H
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/SessionLifecycleTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/SessionLifecycleTest.kt
@@ -10,17 +10,17 @@ import org.mozilla.geckoview.GeckoSessio
 import org.mozilla.geckoview.GeckoView
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.AssertCalled
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.ClosedSessionAtStart
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.NullDelegate
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.ReuseSession
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.WithDevToolsAPI
 import org.mozilla.geckoview.test.util.Callbacks
 import org.mozilla.geckoview.test.util.UiThreadUtils
-import org.junit.Assume.assumeThat
+import org.junit.Ignore
 
 import android.os.Bundle
 import android.os.Debug
 import android.os.Parcelable
 import android.os.SystemClock
 import android.support.test.InstrumentationRegistry
 import android.support.test.filters.MediumTest
 import android.support.test.runner.AndroidJUnit4
@@ -413,19 +413,18 @@ class SessionLifecycleTest : BaseSession
         // We should keep the session open when restoring the same open session.
         val view = testRestoreInstanceState(mainSession, mainSession)
         assertThat("View session is unchanged", view.session, equalTo(mainSession))
         assertThat("View session is open", view.session!!.isOpen, equalTo(true))
         view.session!!.reload()
         sessionRule.waitForPageStop()
     }
 
+    @Ignore // Bug 1533934 - disabled createFromParcel on pgo for frequent failures
     @Test fun createFromParcel() {
-        // disable test on pgo for frequent failures #Bug 1533934
-        assumeThat(sessionRule.env.isDebugBuild, equalTo(true))
         val session = sessionRule.createOpenSession()
 
         session.toParcel { parcel ->
             val newSession = sessionRule.wrapSession(
                     GeckoSession.CREATOR.createFromParcel(parcel))
 
             assertThat("New session has same settings",
                        newSession.settings, equalTo(session.settings))
--- a/python/mach/mach/config.py
+++ b/python/mach/mach/config.py
@@ -17,17 +17,17 @@ settings are available.
 from __future__ import absolute_import, unicode_literals
 
 import collections
 import os
 import sys
 import six
 from functools import wraps
 from six.moves.configparser import RawConfigParser, NoSectionError
-from six import string_types as str_type
+from six import string_types
 
 
 class ConfigException(Exception):
     pass
 
 
 class ConfigType(object):
     """Abstract base class for config values."""
@@ -57,17 +57,17 @@ class ConfigType(object):
     @staticmethod
     def to_config(value):
         return value
 
 
 class StringType(ConfigType):
     @staticmethod
     def validate(value):
-        if not isinstance(value, str_type):
+        if not isinstance(value, string_types):
             raise TypeError()
 
     @staticmethod
     def from_config(config, section, option):
         return config.get(section, option)
 
 
 class BooleanType(ConfigType):
@@ -104,17 +104,17 @@ class PositiveIntegerType(IntegerType):
 
         if value < 0:
             raise ValueError()
 
 
 class PathType(StringType):
     @staticmethod
     def validate(value):
-        if not isinstance(value, str_type):
+        if not isinstance(value, string_types):
             raise TypeError()
 
     @staticmethod
     def from_config(config, section, option):
         return config.get(section, option)
 
 
 TYPE_CLASSES = {
@@ -332,17 +332,17 @@ class ConfigSettings(collections.Mapping
         Each setting has the following optional parameters:
 
             default -- The default value for the setting. If None (the default)
                 there is no default.
 
             extra -- A dict of additional key/value pairs to add to the
                 setting metadata.
         """
-        if isinstance(type_cls, basestring):
+        if isinstance(type_cls, string_types):
             type_cls = TYPE_CLASSES[type_cls]
 
         meta = {
             'description': description,
             'type_cls': type_cls,
         }
 
         if default != DefaultValue:
--- a/python/mach/mach/main.py
+++ b/python/mach/mach/main.py
@@ -1,43 +1,43 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # This module provides functionality for the command-line build tool
 # (mach). It is packaged as a module because everything is a library.
 
 from __future__ import absolute_import, print_function, unicode_literals
-from collections import Iterable
 
 import argparse
 import codecs
 import errno
 import imp
 import logging
 import os
 import sys
 import traceback
 import uuid
+from collections import Iterable
+
+from six import string_types
 
 from .base import (
     CommandContext,
     MachError,
     MissingFileError,
     NoCommandError,
     UnknownCommandError,
     UnrecognizedArgumentError,
     FailedCommandError,
 )
-
+from .config import ConfigSettings
 from .decorators import (
     CommandProvider,
 )
-
-from .config import ConfigSettings
 from .dispatcher import CommandAction
 from .logging import LoggingManager
 from .registrar import Registrar
 
 SUGGEST_MACH_BUSTED = r'''
 You can invoke |./mach busted| to check if this issue is already on file. If it
 isn't, please use |./mach busted file| to report it. If |./mach busted| is
 misbehaving, you can also inspect the dependencies of bug 1543241.
@@ -251,21 +251,21 @@ To see more help for a specific command,
 
         This takes a path to a file and loads it as a Python module under the
         module name specified. If no name is specified, a random one will be
         chosen.
         """
         if module_name is None:
             # Ensure parent module is present otherwise we'll (likely) get
             # an error due to unknown parent.
-            if b'mach.commands' not in sys.modules:
-                mod = imp.new_module(b'mach.commands')
-                sys.modules[b'mach.commands'] = mod
+            if 'mach.commands' not in sys.modules:
+                mod = imp.new_module('mach.commands')
+                sys.modules['mach.commands'] = mod
 
-            module_name = 'mach.commands.%s' % uuid.uuid4().get_hex()
+            module_name = 'mach.commands.%s' % uuid.uuid4().hex
 
         try:
             imp.load_source(module_name, path)
         except IOError as e:
             if e.errno != errno.ENOENT:
                 raise
 
             raise MissingFileError('%s does not exist' % path)
@@ -334,24 +334,25 @@ To see more help for a specific command,
 
         sys.stdin = stdin
         sys.stdout = stdout
         sys.stderr = stderr
 
         orig_env = dict(os.environ)
 
         try:
-            if stdin.encoding is None:
-                sys.stdin = codecs.getreader('utf-8')(stdin)
+            if sys.version_info < (3, 0):
+                if stdin.encoding is None:
+                    sys.stdin = codecs.getreader('utf-8')(stdin)
 
-            if stdout.encoding is None:
-                sys.stdout = codecs.getwriter('utf-8')(stdout)
+                if stdout.encoding is None:
+                    sys.stdout = codecs.getwriter('utf-8')(stdout)
 
-            if stderr.encoding is None:
-                sys.stderr = codecs.getwriter('utf-8')(stderr)
+                if stderr.encoding is None:
+                    sys.stderr = codecs.getwriter('utf-8')(stderr)
 
             # Allow invoked processes (which may not have a handle on the
             # original stdout file descriptor) to know if the original stdout
             # is a TTY. This provides a mechanism to allow said processes to
             # enable emitting code codes, for example.
             if os.isatty(orig_stdout.fileno()):
                 os.environ[b'MACH_STDOUT_ISATTY'] = b'1'
 
@@ -599,17 +600,17 @@ To see more help for a specific command,
     def load_settings(self, paths):
         """Load the specified settings files.
 
         If a directory is specified, the following basenames will be
         searched for in this order:
 
             machrc, .machrc
         """
-        if isinstance(paths, basestring):
+        if isinstance(paths, string_types):
             paths = [paths]
 
         valid_names = ('machrc', '.machrc')
 
         def find_in_dir(base):
             if os.path.isfile(base):
                 return base
 
--- a/python/mach/mach/test/common.py
+++ b/python/mach/mach/test/common.py
@@ -1,18 +1,24 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import unicode_literals
 
-from StringIO import StringIO
 import os
+import sys
 import unittest
 
+try:
+    from StringIO import StringIO
+except ImportError:
+    # TODO io.StringIO causes failures with Python 2 (needs to be sorted out)
+    from io import StringIO
+
 from mach.main import Mach
 
 here = os.path.abspath(os.path.dirname(__file__))
 
 
 class TestBase(unittest.TestCase):
     provider_dir = os.path.join(here, 'providers')
 
@@ -29,17 +35,19 @@ class TestBase(unittest.TestCase):
 
         return m
 
     def _run_mach(self, argv, *args, **kwargs):
         m = self.get_mach(*args, **kwargs)
 
         stdout = StringIO()
         stderr = StringIO()
-        stdout.encoding = 'UTF-8'
-        stderr.encoding = 'UTF-8'
+
+        if sys.version_info < (3, 0):
+            stdout.encoding = 'UTF-8'
+            stderr.encoding = 'UTF-8'
 
         try:
             result = m.run(argv, stdout=stdout, stderr=stderr)
         except SystemExit:
             result = None
 
         return (result, stdout.getvalue(), stderr.getvalue())
--- a/python/mach/mach/test/python.ini
+++ b/python/mach/mach/test/python.ini
@@ -1,10 +1,13 @@
 [DEFAULT]
-skip-if = python == 3
+subsuite = mach
 
 [test_conditions.py]
+skip-if = python == 3
 [test_config.py]
 [test_dispatcher.py]
 [test_entry_point.py]
 [test_error_output.py]
+skip-if = python == 3
 [test_logger.py]
 [test_telemetry.py]
+skip-if = python == 3
--- a/python/mach/mach/test/test_config.py
+++ b/python/mach/mach/test/test_config.py
@@ -135,17 +135,18 @@ class TestConfigSettings(unittest.TestCa
 
     def test_assignment_validation(self):
         s = ConfigSettings()
         s.register_provider(Provider2)
 
         a = s.a
 
         # Assigning an undeclared setting raises.
-        with self.assertRaises(AttributeError):
+        exc_type = AttributeError if sys.version_info < (3, 0) else KeyError
+        with self.assertRaises(exc_type):
             a.undefined = True
 
         with self.assertRaises(KeyError):
             a['undefined'] = True
 
         # Basic type validation.
         a.string = 'foo'
         a.string = 'foo'
--- a/python/mach/mach/test/test_dispatcher.py
+++ b/python/mach/mach/test/test_dispatcher.py
@@ -1,37 +1,38 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import unicode_literals
 
 import os
-from cStringIO import StringIO
+from io import StringIO
+
+from mozunit import main
+from six import string_types
 
 from mach.base import CommandContext
 from mach.registrar import Registrar
 from mach.test.common import TestBase
 
-from mozunit import main
-
 here = os.path.abspath(os.path.dirname(__file__))
 
 
 class TestDispatcher(TestBase):
     """Tests dispatch related code"""
 
     def get_parser(self, config=None):
         mach = self.get_mach('basic.py')
 
         for provider in Registrar.settings_providers:
             mach.settings.register_provider(provider)
 
         if config:
-            if isinstance(config, basestring):
+            if isinstance(config, string_types):
                 config = StringIO(config)
             mach.settings.load_fps([config])
 
         context = CommandContext(settings=mach.settings)
         return mach.get_argument_parser(context)
 
     def test_command_aliases(self):
         config = """
--- a/python/mach/mach/test/test_entry_point.py
+++ b/python/mach/mach/test/test_entry_point.py
@@ -34,19 +34,19 @@ class TestEntryPoints(TestBase):
 
     def _run_mach(self):
         return TestBase._run_mach(self, ['help'], entry_point='mach.providers')
 
     @patch('pkg_resources.iter_entry_points')
     def test_load_entry_point_from_directory(self, mock):
         # Ensure parent module is present otherwise we'll (likely) get
         # an error due to unknown parent.
-        if b'mach.commands' not in sys.modules:
-            mod = imp.new_module(b'mach.commands')
-            sys.modules[b'mach.commands'] = mod
+        if 'mach.commands' not in sys.modules:
+            mod = imp.new_module('mach.commands')
+            sys.modules['mach.commands'] = mod
 
         mock.return_value = [Entry([self.provider_dir])]
         # Mach error raised due to conditions_invalid.py
         with self.assertRaises(MachError):
             self._run_mach()
 
     @patch('pkg_resources.iter_entry_points')
     def test_load_entry_point_from_file(self, mock):
--- a/python/mozboot/mozboot/android.py
+++ b/python/mozboot/mozboot/android.py
@@ -287,25 +287,20 @@ def ensure_android_packages(sdkmanager_t
         cmd = args[0]
         e = subprocess.CalledProcessError(retcode, cmd)
         e.output = output
         raise e
 
     print(output)
 
 
-def suggest_mozconfig(os_name, artifact_mode=False, java_bin_path=None):
+def suggest_mozconfig(os_name, artifact_mode=False):
     moz_state_dir, sdk_path, ndk_path = get_paths(os_name)
 
     extra_lines = []
-    if java_bin_path:
-        extra_lines += [
-            '# With the following java:',
-            'ac_add_options --with-java-bin-path="{}"'.format(java_bin_path),
-        ]
     if extra_lines:
         extra_lines.append('')
 
     if artifact_mode:
         template = MOBILE_ANDROID_ARTIFACT_MODE_MOZCONFIG_TEMPLATE
     else:
         template = MOBILE_ANDROID_MOZCONFIG_TEMPLATE
 
--- a/python/mozboot/mozboot/osx.py
+++ b/python/mozboot/mozboot/osx.py
@@ -375,19 +375,17 @@ class OSXBootstrapper(BaseBootstrapper):
         self.ensure_java()
         from mozboot import android
 
         android.ensure_android('macosx', artifact_mode=artifact_mode,
                                no_interactive=self.no_interactive)
 
     def suggest_homebrew_mobile_android_mozconfig(self, artifact_mode=False):
         from mozboot import android
-        # Path to java from the homebrew/cask-versions/adoptopenjdk8 cask.
-        android.suggest_mozconfig('macosx', artifact_mode=artifact_mode,
-                                  java_bin_path=JAVA_PATH)
+        android.suggest_mozconfig('macosx', artifact_mode=artifact_mode)
 
     def _ensure_macports_packages(self, packages):
         self.port = self.which('port')
         assert self.port is not None
 
         installed = set(self.check_output([self.port, 'installed']).split())
 
         missing = [package for package in packages if package not in installed]
--- a/taskcluster/ci/source-test/python.yml
+++ b/taskcluster/ci/source-test/python.yml
@@ -35,16 +35,32 @@ taskgraph-tests:
     run:
         using: python-test
         subsuite: taskgraph
     when:
         files-changed:
             - 'taskcluster/**/*.py'
             - 'python/mach/**/*.py'
 
+mach:
+    description: python/mach unit tests
+    platform:
+        - linux64/opt
+        - macosx1010-64/opt
+        - windows10-64/opt
+    python-version: [2, 3]
+    treeherder:
+        symbol: mach
+    run:
+        using: python-test
+        subsuite: mach
+    when:
+        files-changed:
+            - 'python/mach/**'
+
 marionette-harness:
     description: testing/marionette/harness unit tests
     platform:
         - linux64/opt
         - windows10-64/opt
     python-version: [2]
     treeherder:
         symbol: mnh
--- a/testing/web-platform/meta/css/geometry/DOMQuad-001.html.ini
+++ b/testing/web-platform/meta/css/geometry/DOMQuad-001.html.ini
@@ -1,34 +1,3 @@
 [DOMQuad-001.html]
-  [testConstructor5: bounds]
-    expected: FAIL
-
-  [testConstructor6: bounds]
-    expected: FAIL
-
-  [testConstructor7: bounds]
-    expected: FAIL
-
   [p1Top4Attributes1: bounds]
     expected: FAIL
-
-  [boundsAttribute0: bounds]
-    expected: FAIL
-
-  [fromRect() method on DOMQuad: points]
-    expected: FAIL
-
-  [fromRect() method on DOMQuad: bounds]
-    expected: FAIL
-
-  [fromRect() method on DOMQuad with negatives: points]
-    expected: FAIL
-
-  [fromRect() method on DOMQuad with negatives: bounds]
-    expected: FAIL
-
-  [fromRect() method on DOMQuad with Infinity: points]
-    expected: FAIL
-
-  [fromRect() method on DOMQuad with Infinity: bounds]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/css/geometry/DOMQuad-002.html.ini
+++ /dev/null
@@ -1,13 +0,0 @@
-[DOMQuad-002.html]
-  [test fromRect]
-    expected: FAIL
-
-  [test fromRect with Infinity]
-    expected: FAIL
-
-  [test fromQuad]
-    expected: FAIL
-
-  [test getBounds]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/css/geometry/DOMRect-002.html.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[DOMRect-002.html]
-  [DOMRect.fromRect]
-    expected: FAIL
-
-  [DOMRectReadOnly.fromRect]
-    expected: FAIL
-
--- a/testing/web-platform/meta/css/geometry/interfaces.html.ini
+++ b/testing/web-platform/meta/css/geometry/interfaces.html.ini
@@ -12,64 +12,14 @@
     expected: FAIL
 
   [DOMPointReadOnly interface: new DOMPoint() must inherit property "matrixTransform(DOMMatrixInit)" with the proper type]
     expected: FAIL
 
   [DOMPointReadOnly interface: calling matrixTransform(DOMMatrixInit) on new DOMPoint() with too few arguments must throw TypeError]
     expected: FAIL
 
-  [DOMRectReadOnly interface: operation fromRect(DOMRectInit)]
-    expected: FAIL
-
-  [DOMRectReadOnly interface: calling fromRect(DOMRectInit) on new DOMRectReadOnly() with too few arguments must throw TypeError]
-    expected: FAIL
-
   [DOMRect interface: legacy window alias]
     expected: FAIL
 
-  [DOMRect interface: operation fromRect(DOMRectInit)]
-    expected: FAIL
-
-  [DOMRect interface: calling fromRect(DOMRectInit) on new DOMRect() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMRectReadOnly interface: calling fromRect(DOMRectInit) on new DOMRect() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMQuad interface: operation fromRect(DOMRectInit)]
-    expected: FAIL
-
-  [DOMQuad interface: operation fromQuad(DOMQuadInit)]
-    expected: FAIL
-
-  [DOMQuad interface: calling fromRect(DOMRectInit) on new DOMQuad() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMQuad interface: calling fromQuad(DOMQuadInit) on new DOMQuad() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMMatrixReadOnly interface: operation fromFloat32Array(Float32Array)]
-    expected: FAIL
-
-  [DOMMatrixReadOnly interface: operation fromFloat64Array(Float64Array)]
-    expected: FAIL
-
-  [DOMMatrixReadOnly interface: calling fromFloat32Array(Float32Array) on new DOMMatrixReadOnly() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMMatrixReadOnly interface: calling fromFloat64Array(Float64Array) on new DOMMatrixReadOnly() with too few arguments must throw TypeError]
-    expected: FAIL
-
   [DOMMatrix interface: legacy window alias]
     expected: FAIL
 
-  [DOMMatrix interface: operation fromFloat32Array(Float32Array)]
-    expected: FAIL
-
-  [DOMMatrix interface: operation fromFloat64Array(Float64Array)]
-    expected: FAIL
-
-  [DOMMatrix interface: calling fromFloat32Array(Float32Array) on new DOMMatrix() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMMatrix interface: calling fromFloat64Array(Float64Array) on new DOMMatrix() with too few arguments must throw TypeError]
-    expected: FAIL
--- a/testing/web-platform/meta/css/geometry/interfaces.worker.js.ini
+++ b/testing/web-platform/meta/css/geometry/interfaces.worker.js.ini
@@ -8,59 +8,8 @@
   [DOMPointReadOnly interface: calling matrixTransform(DOMMatrixInit) on new DOMPointReadOnly() with too few arguments must throw TypeError]
     expected: FAIL
 
   [DOMPointReadOnly interface: new DOMPoint() must inherit property "matrixTransform(DOMMatrixInit)" with the proper type]
     expected: FAIL
 
   [DOMPointReadOnly interface: calling matrixTransform(DOMMatrixInit) on new DOMPoint() with too few arguments must throw TypeError]
     expected: FAIL
-
-  [DOMRectReadOnly interface: operation fromRect(DOMRectInit)]
-    expected: FAIL
-
-  [DOMRectReadOnly interface: calling fromRect(DOMRectInit) on new DOMRectReadOnly() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMRect interface: operation fromRect(DOMRectInit)]
-    expected: FAIL
-
-  [DOMRect interface: calling fromRect(DOMRectInit) on new DOMRect() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMRectReadOnly interface: calling fromRect(DOMRectInit) on new DOMRect() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMQuad interface: operation fromRect(DOMRectInit)]
-    expected: FAIL
-
-  [DOMQuad interface: operation fromQuad(DOMQuadInit)]
-    expected: FAIL
-
-  [DOMQuad interface: calling fromRect(DOMRectInit) on new DOMQuad() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMQuad interface: calling fromQuad(DOMQuadInit) on new DOMQuad() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMMatrixReadOnly interface: operation fromFloat32Array(Float32Array)]
-    expected: FAIL
-
-  [DOMMatrixReadOnly interface: operation fromFloat64Array(Float64Array)]
-    expected: FAIL
-
-  [DOMMatrixReadOnly interface: calling fromFloat32Array(Float32Array) on new DOMMatrixReadOnly() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMMatrixReadOnly interface: calling fromFloat64Array(Float64Array) on new DOMMatrixReadOnly() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMMatrix interface: operation fromFloat32Array(Float32Array)]
-    expected: FAIL
-
-  [DOMMatrix interface: operation fromFloat64Array(Float64Array)]
-    expected: FAIL
-
-  [DOMMatrix interface: calling fromFloat32Array(Float32Array) on new DOMMatrix() with too few arguments must throw TypeError]
-    expected: FAIL
-
-  [DOMMatrix interface: calling fromFloat64Array(Float64Array) on new DOMMatrix() with too few arguments must throw TypeError]
-    expected: FAIL
--- a/testing/web-platform/meta/css/geometry/spec-examples.html.ini
+++ b/testing/web-platform/meta/css/geometry/spec-examples.html.ini
@@ -1,10 +1,7 @@
 [spec-examples.html]
   [matrixTransform]
     expected: FAIL
 
-  [DOMQuad]
-    expected: FAIL
-
   [DOMMatrix NaN]
     expected: FAIL
 
--- a/testing/web-platform/meta/media-source/mediasource-seek-beyond-duration.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-seek-beyond-duration.html.ini
@@ -1,6 +1,7 @@
 [mediasource-seek-beyond-duration.html]
   disabled:
     if (os == "android") and not e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=1499003
     if (os == "android") and e10s: bug 1550895 (frequently fails on geckoview)
+    if (os == "android") and debug: https://bugzilla.mozilla.org/show_bug.cgi?id=1560524
   expected: ERROR
 
--- a/testing/web-platform/meta/xhr/send-after-setting-document-domain.htm.ini
+++ b/testing/web-platform/meta/xhr/send-after-setting-document-domain.htm.ini
@@ -1,7 +1,10 @@
 [send-after-setting-document-domain.htm]
+  disabled:
+    if (os == "android") and debug: https://bugzilla.mozilla.org/show_bug.cgi?id=1550758
+
   expected:
     if (os == "android") and not debug and e10s: TIMEOUT
   [All tests ran]
     expected:
       if (os == "android") and not debug and e10s: TIMEOUT
 
--- a/toolkit/components/extensions/parent/ext-geckoProfiler.js
+++ b/toolkit/components/extensions/parent/ext-geckoProfiler.js
@@ -99,16 +99,37 @@ this.geckoProfiler = class extends Exten
         async pause() {
           Services.profiler.PauseSampling();
         },
 
         async resume() {
           Services.profiler.ResumeSampling();
         },
 
+        async dumpProfileToFile(fileName) {
+          if (!Services.profiler.IsActive()) {
+            throw new ExtensionError("The profiler is stopped. " +
+              "You need to start the profiler before you can capture a profile.");
+          }
+
+          if (fileName.includes("\\") || fileName.includes("/")) {
+            throw new ExtensionError("Path cannot contain a subdirectory.");
+          }
+
+          let fragments = [OS.Constants.Path.profileDir, "profiler", fileName];
+          let filePath = OS.Path.join(...fragments);
+
+          try {
+            await Services.profiler.dumpProfileToFileAsync(filePath);
+          } catch (e) {
+            Cu.reportError(e);
+            throw new ExtensionError(`Dumping profile to ${filePath} failed.`);
+          }
+        },
+
         async getProfile() {
           if (!Services.profiler.IsActive()) {
             throw new ExtensionError("The profiler is stopped. " +
               "You need to start the profiler before you can capture a profile.");
           }
 
           return Services.profiler.getProfileDataAsync();
         },
--- a/toolkit/components/extensions/schemas/geckoProfiler.json
+++ b/toolkit/components/extensions/schemas/geckoProfiler.json
@@ -109,16 +109,29 @@
       {
         "name": "resume",
         "type": "function",
         "description": "Resumes the profiler with the settings that were initially used to start it.",
         "async": true,
         "parameters": []
       },
       {
+        "name": "dumpProfileToFile",
+        "type": "function",
+        "description": "Gathers the profile data from the current profiling session, and writes it to disk. The returned promise resolves to a path that locates the created file.",
+        "async": true,
+        "parameters": [
+          {
+            "type": "string",
+            "name": "fileName",
+            "description": "The name of the file inside the profile/profiler directory"
+          }
+        ]
+      },
+      {
         "name": "getProfile",
         "type": "function",
         "description": "Gathers the profile data from the current profiling session.",
         "async": true,
         "parameters": []
       },
       {
         "name": "getProfileAsArrayBuffer",
--- a/toolkit/components/extensions/test/xpcshell/test_ext_geckoProfiler_control.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_geckoProfiler_control.js
@@ -1,24 +1,27 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
+const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm");
+
+
 let getExtension = () => {
   return ExtensionTestUtils.loadExtension({
     background: async function() {
       const runningListener = isRunning => {
         if (isRunning) {
           browser.test.sendMessage("started");
         } else {
           browser.test.sendMessage("stopped");
         }
       };
 
-      browser.test.onMessage.addListener(async message => {
+      browser.test.onMessage.addListener(async (message, data) => {
         let result;
         switch (message) {
           case "start":
             result = await browser.geckoProfiler.start({
               bufferSize: 10000,
               windowLength: 20,
               interval: 0.5,
               features: ["js"],
@@ -44,16 +47,24 @@ let getExtension = () => {
             result = await browser.geckoProfiler.getProfile();
             browser.test.assertTrue("libs" in result, "The profile contains libs.");
             browser.test.assertTrue("meta" in result, "The profile contains meta.");
             browser.test.assertTrue("threads" in result, "The profile contains threads.");
             browser.test.assertTrue(result.threads.some(t => t.name == "GeckoMain"),
                                     "The profile contains a GeckoMain thread.");
             browser.test.sendMessage("tested profile");
             break;
+          case "test dump to file":
+            try {
+              await browser.geckoProfiler.dumpProfileToFile(data.fileName);
+              browser.test.sendMessage("tested dump to file", {});
+            } catch (e) {
+              browser.test.sendMessage("tested dump to file", {error: e.message});
+            }
+            break;
           case "test profile as array buffer":
             let arrayBuffer = await browser.geckoProfiler.getProfileAsArrayBuffer();
             browser.test.assertTrue(arrayBuffer.byteLength >= 2, "The profile array buffer contains data.");
             let textDecoder = new TextDecoder();
             let profile = JSON.parse(textDecoder.decode(arrayBuffer));
             browser.test.assertTrue("libs" in profile, "The profile contains libs.");
             browser.test.assertTrue("meta" in profile, "The profile contains meta.");
             browser.test.assertTrue("threads" in profile, "The profile contains threads.");
@@ -79,31 +90,76 @@ let getExtension = () => {
         "gecko": {
           "id": "profilertest@mozilla.com",
         },
       },
     },
   });
 };
 
+let verifyProfileData = bytes => {
+  let textDecoder = new TextDecoder();
+  let profile = JSON.parse(textDecoder.decode(bytes));
+  ok("libs" in profile, "The profile contains libs.");
+  ok("meta" in profile, "The profile contains meta.");
+  ok("threads" in profile, "The profile contains threads.");
+  ok(profile.threads.some(t => t.name == "GeckoMain"),
+     "The profile contains a GeckoMain thread.");
+};
+
 add_task(async function testProfilerControl() {
   const acceptedExtensionIdsPref = "extensions.geckoProfiler.acceptedExtensionIds";
   Services.prefs.setCharPref(acceptedExtensionIdsPref, "profilertest@mozilla.com");
 
   let extension = getExtension();
   await extension.startup();
   await extension.awaitMessage("ready");
   await extension.awaitMessage("stopped");
 
   extension.sendMessage("start");
   await extension.awaitMessage("started");
 
   extension.sendMessage("test profile");
   await extension.awaitMessage("tested profile");
 
+  const profilerPath = OS.Path.join(OS.Constants.Path.profileDir, "profiler");
+  let data, fileName, targetPath;
+
+  // test with file name only
+  fileName = "bar.profile";
+  targetPath = OS.Path.join(profilerPath, fileName);
+  extension.sendMessage("test dump to file", {fileName});
+  data = await extension.awaitMessage("tested dump to file");
+  equal(data.error, undefined, "No error thrown");
+  ok(await OS.File.exists(targetPath), "Saved gecko profile exists.");
+  verifyProfileData(await OS.File.read(targetPath));
+
+  // test overwriting the formerly created file
+  extension.sendMessage("test dump to file", {fileName});
+  data = await extension.awaitMessage("tested dump to file");
+  equal(data.error, undefined, "No error thrown");
+  ok(await OS.File.exists(targetPath), "Saved gecko profile exists.");
+  verifyProfileData(await OS.File.read(targetPath));
+
+  // test with a POSIX path, which is not allowed
+  fileName = "foo/bar.profile";
+  targetPath = OS.Path.join(profilerPath, ...fileName.split("/"));
+  extension.sendMessage("test dump to file", {fileName});
+  data = await extension.awaitMessage("tested dump to file");
+  equal(data.error, "Path cannot contain a subdirectory.");
+  ok(!await OS.File.exists(targetPath), "Gecko profile hasn't been saved.");
+
+  // test with a non POSIX path which is not allowed
+  fileName = "foo\\bar.profile";
+  targetPath = OS.Path.join(profilerPath, ...fileName.split("\\"));
+  extension.sendMessage("test dump to file", {fileName});
+  data = await extension.awaitMessage("tested dump to file");
+  equal(data.error, "Path cannot contain a subdirectory.");
+  ok(!await OS.File.exists(targetPath), "Gecko profile hasn't been saved.");
+
   extension.sendMessage("test profile as array buffer");
   await extension.awaitMessage("tested profile as array buffer");
 
   extension.sendMessage("pause");
   await extension.awaitMessage("paused");
 
   extension.sendMessage("resume");
   await extension.awaitMessage("resumed");