Merge inbound to central, a=merge
authorWes Kocher <wkocher@mozilla.com>
Fri, 03 Mar 2017 17:16:06 -0800
changeset 394802 9a117f52a1371a223ff79a1f67a4b8cf08f9b69b
parent 394779 942165e408f0241cf543c368db00fefe22a9997a (current diff)
parent 394801 6bd0aa101e17792acc0c5094d195a48d4fc20a37 (diff)
child 394819 80c06df83395314697d464f88f8daa98bf05465c
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone54.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 inbound to central, a=merge MozReview-Commit-ID: 3JBhsbYgniv
dom/base/test/test_bug793311.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-001-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-001.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-002-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-002.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-003-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-003.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-004-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-004.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-005-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-005.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-006.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-007.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-008-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-008.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-009.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-010-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-010.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-011-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-011.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-012.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-013.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-014-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-014.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-015.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-016-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-016.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-017-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-017.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-018-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-018.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-019-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-019.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-020-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-020.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-021-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-021.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-022-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-022.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-023-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-023.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-024-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-024.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-001-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-001.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-002-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-002.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-003-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-003.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-004-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-004.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-005-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-005.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-006-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-006.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-007-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-007.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-008-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-008.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-009-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-009.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-010.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-011-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-011.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-012.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-013-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-013.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-014-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-014.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-015-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-015.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-016-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-016.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-017-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-017.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-018-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-018.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-019-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-019.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-020-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-020.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-001-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-001.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-002-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-002.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-003-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-003.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-004-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-004.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-005-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-005.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-006-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-006.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-007-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-007.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-008-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-008.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-009-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-009.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-010-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-010.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-011-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-011.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-012-ref.html
layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-012.html
testing/web-platform/mozilla/meta/wasm/conversions.wast.js.html.ini
--- a/browser/base/content/test/general/browser_save_link-perwindowpb.js
+++ b/browser/base/content/test/general/browser_save_link-perwindowpb.js
@@ -35,17 +35,17 @@ function triggerSave(aWindow, aCallback)
     var destFile = destDir.clone();
 
     MockFilePicker.displayDirectory = destDir;
     MockFilePicker.showCallback = function(fp) {
       info("showCallback");
       fileName = fp.defaultString;
       info("fileName: " + fileName);
       destFile.append(fileName);
-      MockFilePicker.returnFiles = [destFile];
+      MockFilePicker.setFiles([destFile]);
       MockFilePicker.filterIndex = 1; // kSaveAsType_URL
       info("done showCallback");
     };
 
     mockTransferCallback = function(downloadSuccess) {
       info("mockTransferCallback");
       onTransferComplete(aWindow, downloadSuccess, destDir);
       destDir.remove(true);
--- a/browser/base/content/test/general/browser_save_link_when_window_navigates.js
+++ b/browser/base/content/test/general/browser_save_link_when_window_navigates.js
@@ -40,17 +40,17 @@ function triggerSave(aWindow, aCallback)
   var destFile = destDir.clone();
 
   MockFilePicker.displayDirectory = destDir;
   MockFilePicker.showCallback = function(fp) {
     info("showCallback");
     fileName = fp.defaultString;
     info("fileName: " + fileName);
     destFile.append(fileName);
-    MockFilePicker.returnFiles = [destFile];
+    MockFilePicker.setFiles([destFile]);
     MockFilePicker.filterIndex = 1; // kSaveAsType_URL
     info("done showCallback");
   };
 
   mockTransferCallback = function(downloadSuccess) {
     info("mockTransferCallback");
     onTransferComplete(aWindow, downloadSuccess, destDir);
     destDir.remove(true);
--- a/browser/base/content/test/general/browser_save_private_link_perwindowpb.js
+++ b/browser/base/content/test/general/browser_save_private_link_perwindowpb.js
@@ -53,17 +53,17 @@ function promiseImageDownloaded() {
     // Create the folder the image will be saved into.
     var destDir = createTemporarySaveDirectory();
     var destFile = destDir.clone();
 
     MockFilePicker.displayDirectory = destDir;
     MockFilePicker.showCallback = function(fp) {
       fileName = fp.defaultString;
       destFile.append(fileName);
-      MockFilePicker.returnFiles = [destFile];
+      MockFilePicker.setFiles([destFile]);
       MockFilePicker.filterIndex = 1; // kSaveAsType_URL
     };
 
     mockTransferCallback = onTransferComplete;
     mockTransferRegisterer.register();
 
     registerCleanupFunction(function() {
       mockTransferCallback = null;
--- a/browser/base/content/test/general/browser_save_video.js
+++ b/browser/base/content/test/general/browser_save_video.js
@@ -29,17 +29,17 @@ add_task(function* () {
   // Create the folder the video will be saved into.
   var destDir = createTemporarySaveDirectory();
   var destFile = destDir.clone();
 
   MockFilePicker.displayDirectory = destDir;
   MockFilePicker.showCallback = function(fp) {
     fileName = fp.defaultString;
     destFile.append(fileName);
-    MockFilePicker.returnFiles = [destFile];
+    MockFilePicker.setFiles([destFile]);
     MockFilePicker.filterIndex = 1; // kSaveAsType_URL
   };
 
   let transferCompletePromise = new Promise((resolve) => {
     function onTransferComplete(downloadSuccess) {
       ok(downloadSuccess, "Video file should have been downloaded successfully");
 
       is(fileName, "web-video1-expectedName.ogv",
--- a/browser/base/content/test/general/browser_save_video_frame.js
+++ b/browser/base/content/test/general/browser_save_video_frame.js
@@ -80,17 +80,17 @@ add_task(function*() {
 
   // Create the folder the video will be saved into.
   let destDir = createTemporarySaveDirectory();
   let destFile = destDir.clone();
 
   MockFilePicker.displayDirectory = destDir;
   MockFilePicker.showCallback = function(fp) {
     destFile.append(fp.defaultString);
-    MockFilePicker.returnFiles = [destFile];
+    MockFilePicker.setFiles([destFile]);
     MockFilePicker.filterIndex = 1; // kSaveAsType_URL
   };
 
   mockTransferRegisterer.register();
 
   // Make sure that we clean these things up when we're done.
   registerCleanupFunction(function() {
     mockTransferRegisterer.unregister();
--- a/browser/base/content/test/webextensions/browser_permissions_local_file.js
+++ b/browser/base/content/test/webextensions/browser_permissions_local_file.js
@@ -5,19 +5,19 @@ async function installFile(filename) {
                                      .getService(Ci.nsIChromeRegistry);
   let chromeUrl = Services.io.newURI(gTestPath);
   let fileUrl = ChromeRegistry.convertChromeURL(chromeUrl);
   let file = fileUrl.QueryInterface(Ci.nsIFileURL).file;
   file.leafName = filename;
 
   let MockFilePicker = SpecialPowers.MockFilePicker;
   MockFilePicker.init(window);
-  MockFilePicker.returnFiles = [file];
+  MockFilePicker.setFiles([file]);
+  MockFilePicker.afterOpenCallback = MockFilePicker.cleanup;
 
   await BrowserOpenAddonsMgr("addons://list/extension");
   let contentWin = gBrowser.selectedTab.linkedBrowser.contentWindow;
 
   // Do the install...
   contentWin.gViewController.doCommand("cmd_installFromFile");
-  MockFilePicker.cleanup();
 }
 
 add_task(() => testInstallMethod(installFile));
--- a/browser/components/contextualidentity/test/browser/browser.ini
+++ b/browser/components/contextualidentity/test/browser/browser.ini
@@ -8,17 +8,16 @@ support-files =
   worker.js
 
 [browser_aboutURLs.js]
 [browser_eme.js]
 [browser_favicon.js]
 [browser_forgetaboutsite.js]
 [browser_forgetAPI_cookie_getCookiesWithOriginAttributes.js]
 [browser_forgetAPI_EME_forgetThisSite.js]
-skip-if = e10s # Bug 1315042
 [browser_forgetAPI_quota_clearStoragesForPrincipal.js]
 [browser_newtabButton.js]
 [browser_usercontext.js]
 [browser_usercontextid_tabdrop.js]
 skip-if = os == "mac" || os == "win" # Intermittent failure - bug 1268276
 [browser_windowName.js]
 tags = openwindow
 [browser_windowOpen.js]
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir.js
@@ -50,17 +50,17 @@ function test() {
                            aGlobalLastDir, aCallback) {
     // Check lastDir preference.
     is(prefs.getComplexValue("lastDir", Ci.nsIFile).path, aDisplayDir.path,
        "LastDir should be the expected display dir");
     // Check gDownloadLastDir value.
     is(gDownloadLastDir.file.path, aDisplayDir.path,
        "gDownloadLastDir should be the expected display dir");
 
-    MockFilePicker.returnFiles = [aFile];
+    MockFilePicker.setFiles([aFile]);
     MockFilePicker.displayDirectory = null;
 
     launcher.saveDestinationAvailable = function(file) {
       ok(!!file, "promptForSaveToFile correctly returned a file");
 
       // File picker should start with expected display dir.
       is(MockFilePicker.displayDirectory.path, aDisplayDir.path,
         "File picker should start with browser.download.lastDir");
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir_c.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir_c.js
@@ -57,17 +57,17 @@ function test() {
                            aGlobalLastDir, aCallback) {
     // Check lastDir preference.
     is(prefs.getComplexValue("lastDir", Ci.nsIFile).path, aDisplayDir.path,
        "LastDir should be the expected display dir");
     // Check gDownloadLastDir value.
     is(gDownloadLastDir.file.path, aDisplayDir.path,
        "gDownloadLastDir should be the expected display dir");
 
-    MockFilePicker.returnFiles = [aFile];
+    MockFilePicker.setFiles([aFile]);
     MockFilePicker.displayDirectory = null;
     aWin.promiseTargetFile(params).then(function() {
       // File picker should start with expected display dir.
       is(MockFilePicker.displayDirectory.path, aDisplayDir.path,
          "File picker should start with browser.download.lastDir");
       // browser.download.lastDir should be modified on not private windows
       is(prefs.getComplexValue("lastDir", Ci.nsIFile).path, aLastDir.path,
          "LastDir should be the expected last dir");
--- a/devtools/client/aboutdebugging/components/addons/controls.js
+++ b/devtools/client/aboutdebugging/components/addons/controls.js
@@ -42,32 +42,33 @@ module.exports = createClass({
   },
 
   loadAddonFromFile() {
     this.setState({ installError: null });
     let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
     fp.init(window,
       Strings.GetStringFromName("selectAddonFromFile2"),
       Ci.nsIFilePicker.modeOpen);
-    let res = fp.show();
-    if (res == Ci.nsIFilePicker.returnCancel || !fp.file) {
-      return;
-    }
-    let file = fp.file;
-    // AddonManager.installTemporaryAddon accepts either
-    // addon directory or final xpi file.
-    if (!file.isDirectory() && !file.leafName.endsWith(".xpi")) {
-      file = file.parent;
-    }
+    fp.open(res => {
+      if (res == Ci.nsIFilePicker.returnCancel || !fp.file) {
+        return;
+      }
+      let file = fp.file;
+      // AddonManager.installTemporaryAddon accepts either
+      // addon directory or final xpi file.
+      if (!file.isDirectory() && !file.leafName.endsWith(".xpi")) {
+        file = file.parent;
+      }
 
-    AddonManager.installTemporaryAddon(file)
-      .catch(e => {
-        console.error(e);
-        this.setState({ installError: e.message });
-      });
+      AddonManager.installTemporaryAddon(file)
+        .catch(e => {
+          console.error(e);
+          this.setState({ installError: e.message });
+        });
+    });
   },
 
   render() {
     let { debugDisabled } = this.props;
 
     return dom.div({ className: "addons-top" },
       dom.div({ className: "addons-controls" },
         dom.div({ className: "addons-options toggle-container-with-text" },
--- a/devtools/client/aboutdebugging/test/browser_addons_install.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_install.js
@@ -18,29 +18,29 @@ add_task(function* () {
 
   // Install the add-on, and verify that it disappears in the about:debugging UI
   yield uninstallAddon({document, id: ADDON_ID, name: ADDON_NAME});
 
   yield closeAboutDebugging(tab);
 });
 
 add_task(function* () {
-  let { tab, document } = yield openAboutDebugging("addons");
+  let { tab, document, window } = yield openAboutDebugging("addons");
   yield waitForInitialAddonList(document);
 
   // Start an observer that looks for the install error before
   // actually doing the install
   let top = document.querySelector(".addons-top");
   let promise = waitForMutation(top, { childList: true });
 
   // Mock the file picker to select a test addon
   let MockFilePicker = SpecialPowers.MockFilePicker;
-  MockFilePicker.init(null);
+  MockFilePicker.init(window);
   let file = getSupportsFile("addons/bad/manifest.json");
-  MockFilePicker.returnFiles = [file.file];
+  MockFilePicker.setFiles([file.file]);
 
   // Trigger the file picker by clicking on the button
   document.getElementById("load-addon-from-file").click();
 
   // Now wait for the install error to appear.
   yield promise;
 
   // And check that it really is there.
--- a/devtools/client/aboutdebugging/test/head.js
+++ b/devtools/client/aboutdebugging/test/head.js
@@ -30,22 +30,23 @@ function* openAboutDebugging(page, win) 
   let url = "about:debugging";
   if (page) {
     url += "#" + page;
   }
 
   let tab = yield addTab(url, { window: win });
   let browser = tab.linkedBrowser;
   let document = browser.contentDocument;
+  let window = browser.contentWindow;
 
   if (!document.querySelector(".app")) {
     yield waitForMutation(document.body, { childList: true });
   }
 
-  return { tab, document };
+  return { tab, document, window };
 }
 
 /**
  * Change url hash for current about:debugging tab, return a promise after
  * new content is loaded.
  * @param  {DOMDocument}  document   container document from current tab
  * @param  {String}       hash       hash for about:debugging
  * @return {Promise}
@@ -108,19 +109,19 @@ function getServiceWorkerList(document) 
 function getTabList(document) {
   return document.querySelector("#tabs .target-list") ||
     document.querySelector("#tabs.targets");
 }
 
 function* installAddon({document, path, name, isWebExtension}) {
   // Mock the file picker to select a test addon
   let MockFilePicker = SpecialPowers.MockFilePicker;
-  MockFilePicker.init(null);
+  MockFilePicker.init(window);
   let file = getSupportsFile(path);
-  MockFilePicker.returnFiles = [file.file];
+  MockFilePicker.setFiles([file.file]);
 
   let addonList = getAddonList(document);
   let addonListMutation = waitForMutation(addonList, { childList: true });
 
   let onAddonInstalled;
 
   if (isWebExtension) {
     onAddonInstalled = new Promise(done => {
--- a/devtools/client/canvasdebugger/snapshotslist.js
+++ b/devtools/client/canvasdebugger/snapshotslist.js
@@ -352,48 +352,50 @@ var SnapshotsListView = Heritage.extend(
    * The click listener for the "import" button in this container.
    */
   _onImportButtonClick: function () {
     let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
     fp.init(window, L10N.getStr("snapshotsList.saveDialogTitle"), Ci.nsIFilePicker.modeOpen);
     fp.appendFilter(L10N.getStr("snapshotsList.saveDialogJSONFilter"), "*.json");
     fp.appendFilter(L10N.getStr("snapshotsList.saveDialogAllFilter"), "*.*");
 
-    if (fp.show() != Ci.nsIFilePicker.returnOK) {
-      return;
-    }
-
-    let channel = NetUtil.newChannel({
-      uri: NetUtil.newURI(fp.file), loadUsingSystemPrincipal: true});
-    channel.contentType = "text/plain";
-
-    NetUtil.asyncFetch(channel, (inputStream, status) => {
-      if (!Components.isSuccessCode(status)) {
-        console.error("Could not import recorded animation frame snapshot file.");
-        return;
-      }
-      try {
-        let string = NetUtil.readInputStreamToString(inputStream, inputStream.available());
-        var data = JSON.parse(string);
-      } catch (e) {
-        console.error("Could not read animation frame snapshot file.");
-        return;
-      }
-      if (data.fileType != CALLS_LIST_SERIALIZER_IDENTIFIER) {
-        console.error("Unrecognized animation frame snapshot file.");
+    fp.open(rv => {
+      if (rv != Ci.nsIFilePicker.returnOK) {
         return;
       }
 
-      // Add a `isLoadedFromDisk` flag on everything to avoid sending invalid
-      // requests to the backend, since we're not dealing with actors anymore.
-      let snapshotItem = this.addSnapshot();
-      snapshotItem.isLoadedFromDisk = true;
-      data.calls.forEach(e => e.isLoadedFromDisk = true);
+      let channel = NetUtil.newChannel({
+        uri: NetUtil.newURI(fp.file), loadUsingSystemPrincipal: true});
+      channel.contentType = "text/plain";
 
-      this.customizeSnapshot(snapshotItem, data.calls, data);
+      NetUtil.asyncFetch(channel, (inputStream, status) => {
+        if (!Components.isSuccessCode(status)) {
+          console.error("Could not import recorded animation frame snapshot file.");
+          return;
+        }
+        try {
+          let string = NetUtil.readInputStreamToString(inputStream, inputStream.available());
+          var data = JSON.parse(string);
+        } catch (e) {
+          console.error("Could not read animation frame snapshot file.");
+          return;
+        }
+        if (data.fileType != CALLS_LIST_SERIALIZER_IDENTIFIER) {
+          console.error("Unrecognized animation frame snapshot file.");
+          return;
+        }
+
+        // Add a `isLoadedFromDisk` flag on everything to avoid sending invalid
+        // requests to the backend, since we're not dealing with actors anymore.
+        let snapshotItem = this.addSnapshot();
+        snapshotItem.isLoadedFromDisk = true;
+        data.calls.forEach(e => e.isLoadedFromDisk = true);
+
+        this.customizeSnapshot(snapshotItem, data.calls, data);
+      });
     });
   },
 
   /**
    * The click listener for the "save" button of each item in this container.
    */
   _onSaveButtonClick: function (e) {
     let snapshotItem = this.getItemForElement(e.target);
--- a/devtools/client/jsonview/main.js
+++ b/devtools/client/jsonview/main.js
@@ -45,18 +45,18 @@ var JsonView = {
 
   // Message handlers for events from child processes
 
   /**
    * Save JSON to a file needs to be implemented here
    * in the parent process.
    */
   onSave: function (message) {
-    let value = message.data;
-    let file = JsonViewUtils.getTargetFile();
-    if (file) {
-      JsonViewUtils.saveToFile(file, value);
-    }
+    JsonViewUtils.getTargetFile(file => {
+      if (file) {
+        JsonViewUtils.saveToFile(file, message.data);
+      }
+    });
   }
 };
 
 // Exports from this module
 module.exports.JsonView = JsonView;
--- a/devtools/client/jsonview/utils.js
+++ b/devtools/client/jsonview/utils.js
@@ -18,31 +18,34 @@ const OPEN_FLAGS = {
   TRUNCATE: parseInt("0x20", 16),
   EXCL: parseInt("0x80", 16)
 };
 
 /**
  * Open File Save As dialog and let the user to pick proper file location.
  */
 exports.getTargetFile = function () {
-  let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
+  return new Promise(resolve => {
+    let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
 
-  let win = getMostRecentBrowserWindow();
-  fp.init(win, null, Ci.nsIFilePicker.modeSave);
-  fp.appendFilter("JSON Files", "*.json; *.jsonp;");
-  fp.appendFilters(Ci.nsIFilePicker.filterText);
-  fp.appendFilters(Ci.nsIFilePicker.filterAll);
-  fp.filterIndex = 0;
+    let win = getMostRecentBrowserWindow();
+    fp.init(win, null, Ci.nsIFilePicker.modeSave);
+    fp.appendFilter("JSON Files", "*.json; *.jsonp;");
+    fp.appendFilters(Ci.nsIFilePicker.filterText);
+    fp.appendFilters(Ci.nsIFilePicker.filterAll);
+    fp.filterIndex = 0;
 
-  let rv = fp.show();
-  if (rv == Ci.nsIFilePicker.returnOK || rv == Ci.nsIFilePicker.returnReplace) {
-    return fp.file;
-  }
-
-  return null;
+    fp.open(rv => {
+      if (rv == Ci.nsIFilePicker.returnOK || rv == Ci.nsIFilePicker.returnReplace) {
+        resolve(fp.file);
+      } else {
+        resolve(null);
+      }
+    });
+  });
 };
 
 /**
  * Save JSON to a file
  */
 exports.saveToFile = function (file, jsonString) {
   let foStream = Cc["@mozilla.org/network/file-output-stream;1"]
     .createInstance(Ci.nsIFileOutputStream);
--- a/devtools/client/netmonitor/har/har-utils.js
+++ b/devtools/client/netmonitor/har/har-utils.js
@@ -21,18 +21,16 @@ XPCOMUtils.defineLazyGetter(this, "ZipWr
 XPCOMUtils.defineLazyGetter(this, "LocalFile", function () {
   return new CC("@mozilla.org/file/local;1", "nsILocalFile", "initWithPath");
 });
 
 XPCOMUtils.defineLazyGetter(this, "getMostRecentBrowserWindow", function () {
   return require("sdk/window/utils").getMostRecentBrowserWindow;
 });
 
-const nsIFilePicker = Ci.nsIFilePicker;
-
 const OPEN_FLAGS = {
   RDONLY: parseInt("0x01", 16),
   WRONLY: parseInt("0x02", 16),
   CREATE_FILE: parseInt("0x08", 16),
   APPEND: parseInt("0x10", 16),
   TRUNCATE: parseInt("0x20", 16),
   EXCL: parseInt("0x80", 16)
 };
@@ -47,40 +45,16 @@ function formatDate(date) {
 
   return `${year}-${month}-${day} ${hour}-${minutes}-${seconds}`;
 }
 
 /**
  * Helper API for HAR export features.
  */
 var HarUtils = {
-  /**
-   * Open File Save As dialog and let the user pick the proper file
-   * location for generated HAR log.
-   */
-  getTargetFile: function (fileName, jsonp, compress) {
-    let browser = getMostRecentBrowserWindow();
-
-    let fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
-    fp.init(browser, null, nsIFilePicker.modeSave);
-    fp.appendFilter(
-      "HTTP Archive Files", "*.har; *.harp; *.json; *.jsonp; *.zip");
-    fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText);
-    fp.filterIndex = 1;
-
-    fp.defaultString = this.getHarFileName(fileName, jsonp, compress);
-
-    let rv = fp.show();
-    if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
-      return fp.file;
-    }
-
-    return null;
-  },
-
   getHarFileName: function (defaultFileName, jsonp, compress) {
     let extension = jsonp ? ".harp" : ".har";
 
     let now = new Date();
     let name = defaultFileName.replace(/%date/g, formatDate(now));
     name = name.replace(/\:/gm, "-", "");
     name = name.replace(/\//gm, "_", "");
 
--- a/devtools/client/netmonitor/utils/mdn-utils.js
+++ b/devtools/client/netmonitor/utils/mdn-utils.js
@@ -18,119 +18,159 @@ const SUPPORTED_HEADERS = [
   "Access-Control-Allow-Headers",
   "Access-Control-Allow-Methods",
   "Access-Control-Allow-Origin",
   "Access-Control-Expose-Headers",
   "Access-Control-Max-Age",
   "Access-Control-Request-Headers",
   "Access-Control-Request-Method",
   "Age",
+  "Allow",
+  "Authorization",
   "Cache-Control",
   "Connection",
   "Content-Disposition",
   "Content-Encoding",
   "Content-Language",
   "Content-Length",
   "Content-Location",
+  "Content-Range",
   "Content-Security-Policy",
   "Content-Security-Policy-Report-Only",
   "Content-Type",
   "Cookie",
   "Cookie2",
   "DNT",
   "Date",
   "ETag",
+  "Expect",
   "Expires",
+  "Forwarded",
   "From",
   "Host",
   "If-Match",
   "If-Modified-Since",
   "If-None-Match",
   "If-Range",
   "If-Unmodified-Since",
   "Keep-Alive",
+  "Large-Allocation",
   "Last-Modified",
   "Location",
   "Origin",
   "Pragma",
+  "Proxy-Authenticate",
+  "Proxy-Authorization",
   "Public-Key-Pins",
   "Public-Key-Pins-Report-Only",
+  "Range",
   "Referer",
   "Referrer-Policy",
   "Retry-After",
   "Server",
   "Set-Cookie",
   "Set-Cookie2",
   "Strict-Transport-Security",
   "TE",
   "Tk",
   "Trailer",
   "Transfer-Encoding",
   "Upgrade-Insecure-Requests",
   "User-Agent",
   "Vary",
   "Via",
+  "WWW-Authenticate",
   "Warning",
   "X-Content-Type-Options",
   "X-DNS-Prefetch-Control",
+  "X-Forwarded-For",
+  "X-Forwarded-Host",
+  "X-Forwarded-Proto",
   "X-Frame-Options",
   "X-XSS-Protection"
 ];
 
 /**
  * A mapping of HTTP status codes to external documentation. Any code included
  * here will show a MDN link alongside it.
  */
 const SUPPORTED_HTTP_CODES = [
     "100",
+    "101",
     "200",
     "201",
+    "202",
+    "203",
     "204",
+    "205",
     "206",
+    "300",
     "301",
     "302",
     "303",
     "304",
     "307",
     "308",
+    "400",
+    "401",
+    "403",
     "404",
+    "405",
     "406",
+    "407",
+    "408",
+    "409",
     "410",
+    "411",
     "412",
+    "413",
+    "414",
+    "415",
+    "416",
+    "417",
+    "426",
+    "428",
+    "429",
+    "431",
     "451",
     "500",
     "501",
     "502",
     "503",
-    "504"
+    "504",
+    "505",
+    "511"
 ];
 
+const GA_PARAMS =
+  "?utm_source=mozilla&utm_medium=devtools-netmonitor&utm_campaign=default";
+
 /**
  * Get the MDN URL for the specified header.
  *
  * @param {string} header Name of the header for the baseURL to use.
  *
  * @return {string} The MDN URL for the header, or null if not available.
  */
 function getHeadersURL(header) {
   const lowerCaseHeader = header.toLowerCase();
   let idx = SUPPORTED_HEADERS.findIndex(item =>
     item.toLowerCase() === lowerCaseHeader);
   return idx > -1 ?
-    `https://developer.mozilla.org/docs/Web/HTTP/Headers/${SUPPORTED_HEADERS[idx]}?utm_source=mozilla&utm_medium=devtools-netmonitor&utm_campaign=default` : null;
+    `https://developer.mozilla.org/docs/Web/HTTP/Headers/${SUPPORTED_HEADERS[idx] + GA_PARAMS}` : null;
 }
 
 /**
  * Get the MDN URL for the specified HTTP status code.
  *
  * @param {string} HTTP status code for the baseURL to use.
  *
  * @return {string} The MDN URL for the HTTP status code, or null if not available.
  */
 function getHTTPStatusCodeURL(statusCode) {
   let idx = SUPPORTED_HTTP_CODES.indexOf(statusCode);
-  return idx > -1 ? `https://developer.mozilla.org/docs/Web/HTTP/Status/${SUPPORTED_HTTP_CODES[idx]}` : null;
+  return idx > -1 ? `https://developer.mozilla.org/docs/Web/HTTP/Status/${SUPPORTED_HTTP_CODES[idx] + GA_PARAMS}` : null;
 }
 
 module.exports = {
   getHeadersURL,
   getHTTPStatusCodeURL,
 };
--- a/devtools/client/performance/performance-view.js
+++ b/devtools/client/performance/performance-view.js
@@ -354,19 +354,21 @@ var PerformanceView = {
    */
   _onImportButtonClick: function (e) {
     let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
     fp.init(window, L10N.getStr("recordingsList.importDialogTitle"),
             Ci.nsIFilePicker.modeOpen);
     fp.appendFilter(L10N.getStr("recordingsList.saveDialogJSONFilter"), "*.json");
     fp.appendFilter(L10N.getStr("recordingsList.saveDialogAllFilter"), "*.*");
 
-    if (fp.show() == Ci.nsIFilePicker.returnOK) {
-      this.emit(EVENTS.UI_IMPORT_RECORDING, fp.file);
-    }
+    fp.open(rv => {
+      if (rv == Ci.nsIFilePicker.returnOK) {
+        this.emit(EVENTS.UI_IMPORT_RECORDING, fp.file);
+      }
+    });
   },
 
   /**
    * Fired when a recording is selected. Used to toggle the profiler view state.
    */
   _onRecordingSelected: function (_, recording) {
     if (!recording) {
       this.setState("empty");
--- a/devtools/client/webide/content/newapp.js
+++ b/devtools/client/webide/content/newapp.js
@@ -105,70 +105,73 @@ function doOK() {
   }
 
   let templatelistNode = document.querySelector("#templatelist");
   if (templatelistNode.selectedIndex < 0) {
     console.error("No template selected");
     return false;
   }
 
-  let folder;
-
   /* Chrome mochitest support */
-  let testOptions = window.arguments[0].testOptions;
-  if (testOptions) {
-    folder = testOptions.folder;
-  } else {
-    let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
-    fp.init(window, "Select directory where to create app directory", Ci.nsIFilePicker.modeGetFolder);
-    let res = fp.show();
-    if (res == Ci.nsIFilePicker.returnCancel) {
-      console.error("No directory selected");
-      return false;
+  let promise = new Promise((resolve, reject) => {
+    let testOptions = window.arguments[0].testOptions;
+    if (testOptions) {
+      resolve(testOptions.folder);
+    } else {
+      let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
+      fp.init(window, "Select directory where to create app directory", Ci.nsIFilePicker.modeGetFolder);
+      fp.open(res => {
+        if (res == Ci.nsIFilePicker.returnCancel) {
+          console.error("No directory selected");
+          reject(null);
+        } else {
+          resolve(fp.file);
+        }
+      });
     }
-    folder = fp.file;
-  }
-
-  // Create subfolder with fs-friendly name of project
-  let subfolder = projectName.replace(/[\\/:*?"<>|]/g, "").toLowerCase();
-  let win = Services.wm.getMostRecentWindow("devtools:webide");
-  folder.append(subfolder);
-
-  try {
-    folder.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
-  } catch (e) {
-    win.UI.reportError("error_folderCreationFailed");
-    window.close();
-    return false;
-  }
-
-  // Download boilerplate zip
-  let template = gTemplateList[templatelistNode.selectedIndex];
-  let source = template.file;
-  let target = folder.clone();
-  target.append(subfolder + ".zip");
+  });
 
   let bail = (e) => {
     console.error(e);
     window.close();
   };
 
-  Downloads.fetch(source, target).then(() => {
-    ZipUtils.extractFiles(target, folder);
-    target.remove(false);
-    AppProjects.addPackaged(folder).then((project) => {
-      window.arguments[0].location = project.location;
-      AppManager.validateAndUpdateProject(project).then(() => {
-        if (project.manifest) {
-          project.manifest.name = projectName;
-          AppManager.writeManifest(project).then(() => {
-            AppManager.validateAndUpdateProject(project).then(
-              () => {window.close();}, bail);
-          }, bail);
-        } else {
-          bail("Manifest not found");
-        }
+  promise.then(folder => {
+    // Create subfolder with fs-friendly name of project
+    let subfolder = projectName.replace(/[\\/:*?"<>|]/g, "").toLowerCase();
+    let win = Services.wm.getMostRecentWindow("devtools:webide");
+    folder.append(subfolder);
+
+    try {
+      folder.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
+    } catch (e) {
+      win.UI.reportError("error_folderCreationFailed");
+      window.close();
+      return;
+    }
+
+    // Download boilerplate zip
+    let template = gTemplateList[templatelistNode.selectedIndex];
+    let source = template.file;
+    let target = folder.clone();
+    target.append(subfolder + ".zip");
+    Downloads.fetch(source, target).then(() => {
+      ZipUtils.extractFiles(target, folder);
+      target.remove(false);
+      AppProjects.addPackaged(folder).then((project) => {
+        window.arguments[0].location = project.location;
+        AppManager.validateAndUpdateProject(project).then(() => {
+          if (project.manifest) {
+            project.manifest.name = projectName;
+            AppManager.writeManifest(project).then(() => {
+              AppManager.validateAndUpdateProject(project).then(
+                () => {window.close();}, bail);
+            }, bail);
+          } else {
+            bail("Manifest not found");
+          }
+        }, bail);
       }, bail);
     }, bail);
   }, bail);
 
   return false;
 }
--- a/devtools/client/webide/content/simulator.js
+++ b/devtools/client/webide/content/simulator.js
@@ -284,39 +284,41 @@ var SimulatorEditor = {
     let input = event.target;
     switch (input.name) {
       case "name":
         simulator.options.name = input.value;
         break;
       case "version":
         switch (input.value) {
           case "pick":
-            let file = utils.getCustomBinary(window);
-            if (file) {
-              this.version = file.path;
-            }
-            // Whatever happens, don't stay on the "pick" option.
-            this.updateVersionSelector();
+            utils.getCustomBinary(window).then(file => {
+              if (file) {
+                this.version = file.path;
+              }
+              // Whatever happens, don't stay on the "pick" option.
+              this.updateVersionSelector();
+            });
             break;
           case "custom":
             this.version = input[input.selectedIndex].textContent;
             break;
           default:
             this.version = input.value;
         }
         break;
       case "profile":
         switch (input.value) {
           case "pick":
-            let directory = utils.getCustomProfile(window);
-            if (directory) {
-              this.profile = directory.path;
-            }
-            // Whatever happens, don't stay on the "pick" option.
-            this.updateProfileSelector();
+            utils.getCustomProfile(window).then(directory => {
+              if (directory) {
+                this.profile = directory.path;
+              }
+              // Whatever happens, don't stay on the "pick" option.
+              this.updateProfileSelector();
+            });
             break;
           case "custom":
             this.profile = input[input.selectedIndex].textContent;
             break;
           default:
             this.profile = input.value;
         }
         break;
--- a/devtools/client/webide/modules/project-list.js
+++ b/devtools/client/webide/modules/project-list.js
@@ -87,17 +87,17 @@ ProjectList.prototype = {
       self._telemetry.actionOccurred("webideNewProject");
     }), "creating new app");
   },
 
   importPackagedApp: function (location) {
     let parentWindow = this._parentWindow;
     let UI = this._UI;
     return UI.busyUntil(Task.spawn(function* () {
-      let directory = utils.getPackagedDirectory(parentWindow, location);
+      let directory = yield utils.getPackagedDirectory(parentWindow, location);
 
       if (!directory) {
         // User cancelled directory selection
         return;
       }
 
       yield UI.importAndSelectApp(directory);
     }), "importing packaged app");
--- a/devtools/client/webide/modules/utils.js
+++ b/devtools/client/webide/modules/utils.js
@@ -10,25 +10,30 @@ const Strings = Services.strings.createB
 function doesFileExist(location) {
   let file = new FileUtils.File(location);
   return file.exists();
 }
 exports.doesFileExist = doesFileExist;
 
 function _getFile(location, ...pickerParams) {
   if (location) {
-    return new FileUtils.File(location);
+    return Promise.resolve(new FileUtils.File(location));
   }
   let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
   fp.init(...pickerParams);
-  let res = fp.show();
-  if (res == Ci.nsIFilePicker.returnCancel) {
-    return null;
-  }
-  return fp.file;
+
+  return new Promise(resolve => {
+    fp.open(res => {
+      if (res == Ci.nsIFilePicker.returnCancel) {
+        resolve(null);
+      } else {
+        resolve(fp.file);
+      }
+    });
+  });
 }
 
 function getCustomBinary(window, location) {
   return _getFile(location, window, Strings.GetStringFromName("selectCustomBinary_title"), Ci.nsIFilePicker.modeOpen);
 }
 exports.getCustomBinary = getCustomBinary;
 
 function getCustomProfile(window, location) {
--- a/devtools/client/webide/test/test_simulators.html
+++ b/devtools/client/webide/test/test_simulators.html
@@ -185,28 +185,28 @@
 
           yield set(form.version, sim20.addonID);
 
           ok(!form.version.classList.contains("custom"), "Version selector is not customized after addon change");
           is(form.name.value, customName + "2.0", "Simulator name was updated to new version");
 
           // Pick custom binary, but act like the user aborted the file picker.
 
-          MockFilePicker.returnFiles = [];
+          MockFilePicker.setFiles([]);
           yield set(form.version, "pick");
 
           is(form.version.value, sim20.addonID, "Version selector reverted to last valid choice after customization abort");
           ok(!form.version.classList.contains("custom"), "Version selector is not customized after customization abort");
 
           // Pick custom binary, and actually follow through. (success, verify value = "custom" and textContent = custom path)
 
-          MockFilePicker.useAnyFile();
+          yield MockFilePicker.useAnyFile();
           yield set(form.version, "pick");
 
-          let fakeBinary = MockFilePicker.returnFiles[0];
+          let fakeBinary = MockFilePicker.file;
 
           ok(form.version.value == "custom", "Version selector was set to a new custom binary");
           ok(form.version.classList.contains("custom"), "Version selector is now customized");
           is(form.version.selectedOptions[0].textContent, fakeBinary.path, "Custom option textContent is correct");
 
           yield set(form.version, sim10.addonID);
 
           ok(form.version.classList.contains("custom"), "Version selector remains customized after change back to addon");
@@ -216,25 +216,25 @@
 
           ok(form.version.value == "custom", "Version selector is back to custom");
 
           // Test `profile`.
 
           is(form.profile.value, "default", "Default simulator profile");
           ok(!form.profile.classList.contains("custom"), "Profile selector is not customized");
 
-          MockFilePicker.returnFiles = [];
+          MockFilePicker.setFiles([]);
           yield set(form.profile, "pick");
 
           is(form.profile.value, "default", "Profile selector reverted to last valid choice after customization abort");
           ok(!form.profile.classList.contains("custom"), "Profile selector is not customized after customization abort");
 
           let fakeProfile = FileUtils.getDir("TmpD", []);
 
-          MockFilePicker.returnFiles = [ fakeProfile ];
+          MockFilePicker.setFiles([ fakeProfile ]);
           yield set(form.profile, "pick");
 
           ok(form.profile.value == "custom", "Profile selector was set to a new custom directory");
           ok(form.profile.classList.contains("custom"), "Profile selector is now customized");
           is(form.profile.selectedOptions[0].textContent, fakeProfile.path, "Custom option textContent is correct");
 
           yield set(form.profile, "default");
 
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2805,37 +2805,16 @@ nsDOMWindowUtils::GetContainerElement(ns
 
   nsCOMPtr<nsIDOMElement> element =
     do_QueryInterface(window->GetFrameElementInternal());
 
   element.forget(aResult);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsDOMWindowUtils::WrapDOMFile(nsIFile *aFile,
-                              nsISupports **aDOMFile)
-{
-  if (!aFile) {
-    return NS_ERROR_FAILURE;
-  }
-
-  nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
-  NS_ENSURE_STATE(window);
-
-  nsPIDOMWindowInner* innerWindow = window->GetCurrentInnerWindow();
-  if (!innerWindow) {
-    return NS_ERROR_FAILURE;
-  }
-
-  nsCOMPtr<nsIDOMBlob> blob = File::CreateFromFile(innerWindow, aFile);
-  blob.forget(aDOMFile);
-  return NS_OK;
-}
-
 #ifdef DEBUG
 static bool
 CheckLeafLayers(Layer* aLayer, const nsIntPoint& aOffset, nsIntRegion* aCoveredRegion)
 {
   gfx::Matrix transform;
   if (!aLayer->GetTransform().Is2D(&transform) ||
       transform.HasNonIntegerTranslation())
     return false;
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -527,17 +527,16 @@ skip-if = toolkit == 'android' #bug 6870
 [test_bug750096.html]
 [test_bug753278.html]
 [test_bug761120.html]
 [test_bug769117.html]
 [test_bug782342.html]
 [test_bug787778.html]
 [test_bug789315.html]
 [test_bug789856.html]
-[test_bug793311.html]
 [test_bug804395.html]
 [test_bug809003.html]
 [test_bug810494.html]
 [test_bug811701.html]
 [test_bug811701.xhtml]
 [test_bug813919.html]
 [test_bug814576.html]
 [test_bug819051.html]
deleted file mode 100644
--- a/dom/base/test/test_bug793311.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=793311
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 793311</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript">
-
-  /** Test for Bug {793311} **/
-  SimpleTest.waitForExplicitFinish();
-
-  try {
-    SpecialPowers.DOMWindowUtils.wrapDOMFile(null);
-    ok(false, "wrapDOMFile(null) throws an exception");
-  } catch(e) {
-    ok(true, "wrapDOMFile(null) throws an exception");
-  }
-  SimpleTest.finish();
-
-  </script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=793311">Mozilla Bug 793311</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-</pre>
-</body>
-</html>
--- a/dom/file/FileBlobImpl.h
+++ b/dom/file/FileBlobImpl.h
@@ -45,16 +45,26 @@ public:
                                  ErrorResult& aRv) override;
 
   virtual bool IsDirectory() const override;
 
   // We always have size and date for this kind of blob.
   virtual bool IsSizeUnknown() const override { return false; }
   virtual bool IsDateUnknown() const override { return false; }
 
+  void SetName(const nsAString& aName)
+  {
+    mName = aName;
+  }
+
+  void SetType(const nsAString& aType)
+  {
+    mContentType = aType;
+  }
+
 protected:
   virtual ~FileBlobImpl() = default;
 
 private:
   // Create slice
   FileBlobImpl(const FileBlobImpl* aOther, uint64_t aStart,
                uint64_t aLength, const nsAString& aContentType);
 
--- a/dom/file/FileCreatorHelper.cpp
+++ b/dom/file/FileCreatorHelper.cpp
@@ -77,17 +77,18 @@ FileCreatorHelper::CreateFileInternal(ns
   int64_t lastModified = 0;
   if (aBag.mLastModified.WasPassed()) {
     lastModifiedPassed = true;
     lastModified = aBag.mLastModified.Value();
   }
 
   RefPtr<BlobImpl> blobImpl;
   aRv = CreateBlobImpl(aFile, aBag.mType, aBag.mName, lastModifiedPassed,
-                       lastModified, aIsFromNsIFile, getter_AddRefs(blobImpl));
+                       lastModified, aBag.mExistenceCheck, aIsFromNsIFile,
+                       getter_AddRefs(blobImpl));
   if (aRv.Failed()) {
      return nullptr;
   }
 
   RefPtr<File> file = File::Create(aWindow, blobImpl);
   return file.forget();
 }
 
@@ -125,17 +126,18 @@ FileCreatorHelper::SendRequest(nsIFile* 
 
   nsAutoString path;
   aRv = aFile->GetPath(path);
   if (NS_WARN_IF(aRv.Failed())) {
     return;
   }
 
   cc->FileCreationRequest(uuid, this, path, aBag.mType, aBag.mName,
-                          aBag.mLastModified, aIsFromNsIFile);
+                          aBag.mLastModified, aBag.mExistenceCheck,
+                          aIsFromNsIFile);
 }
 
 void
 FileCreatorHelper::ResponseReceived(BlobImpl* aBlobImpl, nsresult aRv)
 {
   if (NS_FAILED(aRv)) {
     mPromise->MaybeReject(aRv);
     return;
@@ -146,38 +148,59 @@ FileCreatorHelper::ResponseReceived(Blob
 }
 
 /* static */ nsresult
 FileCreatorHelper::CreateBlobImplForIPC(const nsAString& aPath,
                                         const nsAString& aType,
                                         const nsAString& aName,
                                         bool aLastModifiedPassed,
                                         int64_t aLastModified,
+                                        bool aExistenceCheck,
                                         bool aIsFromNsIFile,
                                         BlobImpl** aBlobImpl)
 {
   nsCOMPtr<nsIFile> file;
   nsresult rv = NS_NewLocalFile(aPath, true, getter_AddRefs(file));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return CreateBlobImpl(file, aType, aName, aLastModifiedPassed, aLastModified,
-                        aIsFromNsIFile, aBlobImpl);
+                        aExistenceCheck, aIsFromNsIFile, aBlobImpl);
 }
 
 /* static */ nsresult
 FileCreatorHelper::CreateBlobImpl(nsIFile* aFile,
                                   const nsAString& aType,
                                   const nsAString& aName,
                                   bool aLastModifiedPassed,
                                   int64_t aLastModified,
+                                  bool aExistenceCheck,
                                   bool aIsFromNsIFile,
                                   BlobImpl** aBlobImpl)
 {
+  if (!aExistenceCheck) {
+    RefPtr<FileBlobImpl> impl = new FileBlobImpl(aFile);
+
+    if (!aName.IsEmpty()) {
+      impl->SetName(aName);
+    }
+
+    if (!aType.IsEmpty()) {
+      impl->SetType(aType);
+    }
+
+    if (aLastModifiedPassed) {
+      impl->SetLastModified(aLastModified);
+    }
+
+    impl.forget(aBlobImpl);
+    return NS_OK;
+  }
+
   RefPtr<MultipartBlobImpl> impl = new MultipartBlobImpl(EmptyString());
   nsresult rv =
     impl->InitializeChromeFile(aFile, aType, aName, aLastModifiedPassed,
                                aLastModified, aIsFromNsIFile);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
--- a/dom/file/FileCreatorHelper.h
+++ b/dom/file/FileCreatorHelper.h
@@ -46,16 +46,17 @@ public:
 
   // For IPC only
   static nsresult
   CreateBlobImplForIPC(const nsAString& aPath,
                        const nsAString& aType,
                        const nsAString& aName,
                        bool aLastModifiedPassed,
                        int64_t aLastModified,
+                       bool aExistenceCheck,
                        bool aIsFromNsIFile,
                        BlobImpl** aBlobImpl);
 
 private:
   static already_AddRefed<File>
   CreateFileInternal(nsPIDOMWindowInner* aWindow,
                      nsIFile* aFile,
                      const ChromeFilePropertyBag& aBag,
@@ -63,16 +64,17 @@ private:
                      ErrorResult& aRv);
 
   static nsresult
   CreateBlobImpl(nsIFile* aFile,
                  const nsAString& aType,
                  const nsAString& aName,
                  bool aLastModifiedPassed,
                  int64_t aLastModified,
+                 bool aExistenceCheck,
                  bool aIsFromNsIFile,
                  BlobImpl** aBlobImpl);
 
   FileCreatorHelper(Promise* aPromise, nsPIDOMWindowInner* aWindow);
   ~FileCreatorHelper();
 
   void
   SendRequest(nsIFile* aFile, const ChromeFilePropertyBag& aBag,
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -1559,22 +1559,16 @@ interface nsIDOMWindowUtils : nsISupport
    * property.
    */
   double computeAnimationDistance(in nsIDOMElement element,
                                   in AString property,
                                   in AString value1,
                                   in AString value2);
 
   /**
-   * Wrap an nsIFile in an DOM File
-   * Returns a File object.
-   */
-  nsISupports wrapDOMFile(in nsIFile aFile);
-
-  /**
    * Get the type of the currently focused html input, if any.
    */
   readonly attribute string focusedInputType;
 
   /**
    * Find the view ID for a given element. This is the reverse of
    * findElementWithViewId().
    */
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -3170,30 +3170,32 @@ ContentChild::GetConstructedEventTarget(
 }
 
 void
 ContentChild::FileCreationRequest(nsID& aUUID, FileCreatorHelper* aHelper,
                                   const nsAString& aFullPath,
                                   const nsAString& aType,
                                   const nsAString& aName,
                                   const Optional<int64_t>& aLastModified,
+                                  bool aExistenceCheck,
                                   bool aIsFromNsIFile)
 {
   MOZ_ASSERT(aHelper);
 
   bool lastModifiedPassed = false;
   int64_t lastModified = 0;
   if (aLastModified.WasPassed()) {
     lastModifiedPassed = true;
     lastModified = aLastModified.Value();
   }
 
   Unused << SendFileCreationRequest(aUUID, nsString(aFullPath), nsString(aType),
                                     nsString(aName), lastModifiedPassed,
-                                    lastModified, aIsFromNsIFile);
+                                    lastModified, aExistenceCheck,
+                                    aIsFromNsIFile);
   mFileCreationPending.Put(aUUID, aHelper);
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvFileCreationResponse(const nsID& aUUID,
                                        const FileCreationResult& aResult)
 {
   FileCreatorHelper* helper = mFileCreationPending.GetWeak(aUUID);
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -628,17 +628,17 @@ public:
                                              base::ProcessId aOtherPid);
 
   // This method is used by FileCreatorHelper for the creation of a BlobImpl.
   void
   FileCreationRequest(nsID& aUUID, FileCreatorHelper* aHelper,
                       const nsAString& aFullPath, const nsAString& aType,
                       const nsAString& aName,
                       const Optional<int64_t>& aLastModified,
-                      bool aIsFromNsIFile);
+                      bool aExistenceCheck, bool aIsFromNsIFile);
 
 private:
   static void ForceKillTimerCallback(nsITimer* aTimer, void* aClosure);
   void StartForceKillTimer();
 
   virtual void ActorDestroy(ActorDestroyReason why) override;
 
   virtual void ProcessingError(Result aCode, const char* aReason) override;
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -5140,23 +5140,25 @@ ContentParent::RecvClassifyLocal(const U
 
 mozilla::ipc::IPCResult
 ContentParent::RecvFileCreationRequest(const nsID& aID,
                                        const nsString& aFullPath,
                                        const nsString& aType,
                                        const nsString& aName,
                                        const bool& aLastModifiedPassed,
                                        const int64_t& aLastModified,
+                                       const bool& aExistenceCheck,
                                        const bool& aIsFromNsIFile)
 {
   RefPtr<BlobImpl> blobImpl;
   nsresult rv =
     FileCreatorHelper::CreateBlobImplForIPC(aFullPath, aType, aName,
                                             aLastModifiedPassed,
-                                            aLastModified, aIsFromNsIFile,
+                                            aLastModified, aExistenceCheck,
+                                            aIsFromNsIFile,
                                             getter_AddRefs(blobImpl));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     if (!SendFileCreationResponse(aID, FileCreationErrorResult(rv))) {
       return IPC_FAIL_NO_REASON(this);
     }
 
     return IPC_OK();
   }
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -1107,16 +1107,17 @@ private:
 
   virtual mozilla::ipc::IPCResult RecvDeleteGetFilesRequest(const nsID& aID) override;
 
   virtual mozilla::ipc::IPCResult
   RecvFileCreationRequest(const nsID& aID, const nsString& aFullPath,
                           const nsString& aType, const nsString& aName,
                           const bool& aLastModifiedPassed,
                           const int64_t& aLastModified,
+                          const bool& aExistenceCheck,
                           const bool& aIsFromNsIFile) override;
 
   virtual mozilla::ipc::IPCResult RecvAccumulateChildHistograms(
     InfallibleTArray<Accumulation>&& aAccumulations) override;
   virtual mozilla::ipc::IPCResult RecvAccumulateChildKeyedHistograms(
     InfallibleTArray<KeyedAccumulation>&& aAccumulations) override;
   virtual mozilla::ipc::IPCResult RecvUpdateChildScalars(
     InfallibleTArray<ScalarAction>&& aScalarActions) override;
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -1172,17 +1172,18 @@ parent:
      */
      async NotifyLowMemory();
 
      async GetFilesRequest(nsID aID, nsString aDirectory, bool aRecursiveFlag);
      async DeleteGetFilesRequest(nsID aID);
 
      async FileCreationRequest(nsID aID, nsString aFullPath, nsString aType,
                                nsString aName, bool lastModifiedPassed,
-                               int64_t lastModified, bool aIsFromNsIFile);
+                               int64_t lastModified, bool aExistenceCheck,
+                               bool aIsFromNsIFile);
 
      async StoreAndBroadcastBlobURLRegistration(nsCString url, PBlob blob,
                                                 Principal principal);
 
      async UnstoreAndBroadcastBlobURLUnregistration(nsCString url);
 
      async BroadcastLocalStorageChange(nsString documentURI,
                                        nsString key,
--- a/dom/ipc/tests/test_bug1086684.html
+++ b/dom/ipc/tests/test_bug1086684.html
@@ -20,17 +20,17 @@
     function childFrameScript() {
       "use strict";
 
       let { MockFilePicker } =
         Components.utils.import("chrome://specialpowers/content/MockFilePicker.jsm", {});
 
       function parentReady(message) {
         MockFilePicker.init(content);
-        MockFilePicker.returnFiles = [message.data.file];
+        MockFilePicker.setFiles([message.data.file]);
         MockFilePicker.returnValue = MockFilePicker.returnOK;
 
         let input = content.document.getElementById("f");
         input.addEventListener("change", () => {
           MockFilePicker.cleanup();
           let value = input.value;
           message.target.sendAsyncMessage("testBug1086684:childDone", { value });
         });
--- a/dom/webidl/File.webidl
+++ b/dom/webidl/File.webidl
@@ -21,16 +21,17 @@ interface File : Blob {
 
 dictionary FilePropertyBag {
   DOMString type = "";
   long long lastModified;
 };
 
 dictionary ChromeFilePropertyBag : FilePropertyBag {
   DOMString name = "";
+  boolean existenceCheck = true;
 };
 
 // Mozilla extensions
 partial interface File {
   [GetterThrows, Deprecated="FileLastModifiedDate"]
   readonly attribute Date lastModifiedDate;
 
   [BinaryName="relativePath", Func="mozilla::dom::Directory::WebkitBlinkDirectoryPickerEnabled"]
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -2565,30 +2565,35 @@ GCMarker::sizeOfExcludingThis(mozilla::M
     size_t size = stack.sizeOfExcludingThis(mallocSizeOf);
     for (ZonesIter zone(runtime(), WithAtoms); !zone.done(); zone.next())
         size += zone->gcGrayRoots().sizeOfExcludingThis(mallocSizeOf);
     return size;
 }
 
 #ifdef DEBUG
 Zone*
-GCMarker::stackContainsCrossZonePointerTo(const TenuredCell* target) const
+GCMarker::stackContainsCrossZonePointerTo(const Cell* target) const
 {
     MOZ_ASSERT(!JS::CurrentThreadIsHeapCollecting());
 
+    Zone* targetZone = target->asTenured().zone();
+
     for (MarkStackIter iter(stack); !iter.done(); iter.next()) {
         if (iter.peekTag() != MarkStack::ObjectTag)
             continue;
 
         auto source = iter.peekPtr().as<JSObject>();
-        if (source->is<ProxyObject>() &&
-            source->as<ProxyObject>().target() == static_cast<const Cell*>(target) &&
-            source->zone() != target->zone())
+        Zone* sourceZone = source->zone();
+        if (sourceZone == targetZone)
+            continue;
+
+        if ((source->is<ProxyObject>() && source->as<ProxyObject>().target() == target) ||
+            Debugger::isDebuggerCrossCompartmentEdge(source, target))
         {
-            return source->zone();
+            return sourceZone;
         }
     }
 
     return nullptr;
 }
 #endif // DEBUG
 
 
--- a/js/src/gc/Marking.h
+++ b/js/src/gc/Marking.h
@@ -299,17 +299,17 @@ class GCMarker : public JSTracer
     void setGCMode(JSGCMode mode) { stack.setGCMode(mode); }
 
     size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
 
 #ifdef DEBUG
 
     bool shouldCheckCompartments() { return strictCompartmentChecking; }
 
-    Zone* stackContainsCrossZonePointerTo(const gc::TenuredCell* cell) const;
+    Zone* stackContainsCrossZonePointerTo(const gc::Cell* cell) const;
 
 #endif
 
     void markEphemeronValues(gc::Cell* markedCell, gc::WeakEntryVector& entry);
 
     static GCMarker* fromTracer(JSTracer* trc) {
         MOZ_ASSERT(trc->isMarkingTracer());
         return static_cast<GCMarker*>(trc);
--- a/js/src/jit-test/tests/wasm/conversion.js
+++ b/js/src/jit-test/tests/wasm/conversion.js
@@ -84,16 +84,23 @@ function testTrap(resultType, opcode, pa
     testConversion('f32', 'convert_s', 'i64', 0, 0.0);
     testConversion('f32', 'convert_s', 'i64', "0x7fffffffffffffff", 9223372036854775807.0);
     testConversion('f32', 'convert_s', 'i64', "0x8000000000000000", -9223372036854775808.0);
     testConversion('f32', 'convert_s', 'i64', "0x11db9e76a2483", 314159275180032.0);
     testConversion('f32', 'convert_s', 'i64', "0x7fffffff", 2147483648.0); // closesth approx.
     testConversion('f32', 'convert_s', 'i64', "0x80000000", 2147483648.0);
     testConversion('f32', 'convert_s', 'i64', "0x80000001", 2147483648.0); // closesth approx.
 
+    // Interesting values at the boundaries.
+    testConversion('f32', 'convert_s', 'i64', "0x358a09a000000002", 3857906751034621952);
+    testConversion('f32', 'convert_s', 'i64', "0x8000004000000001", -9223371487098961920);
+    testConversion('f32', 'convert_s', 'i64', "0xffdfffffdfffffff", -9007200328482816);
+    testConversion('f32', 'convert_s', 'i64', "0x0020000020000001", 9007200328482816);
+    testConversion('f32', 'convert_s', 'i64', "0x7fffff4000000001", 9223371487098961920);
+
     testConversion('f64', 'convert_s', 'i64', 1, 1.0);
     testConversion('f64', 'convert_s', 'i64', -1, -1.0);
     testConversion('f64', 'convert_s', 'i64', 0, 0.0);
     testConversion('f64', 'convert_s', 'i64', "0x7fffffffffffffff", 9223372036854775807.0);
     testConversion('f64', 'convert_s', 'i64', "0x8000000000000000", -9223372036854775808.0);
     testConversion('f64', 'convert_s', 'i64', "0x10969d374b968e", 4669201609102990);
     testConversion('f64', 'convert_s', 'i64', "0x7fffffff", 2147483647.0);
     testConversion('f64', 'convert_s', 'i64', "0x80000000", 2147483648.0);
@@ -101,22 +108,34 @@ function testTrap(resultType, opcode, pa
 
     testConversion('f32', 'convert_u', 'i64', 1, 1.0);
     testConversion('f32', 'convert_u', 'i64', 0, 0.0);
     testConversion('f32', 'convert_u', 'i64', "0x7fffffffffffffff", 9223372036854775807.0);
     testConversion('f32', 'convert_u', 'i64', "0x8000000000000000", 9223372036854775808.0);
     testConversion('f32', 'convert_u', 'i64', -1, 18446744073709551616.0);
     testConversion('f32', 'convert_u', 'i64', "0xffff0000ffff0000", 18446462598732840000.0);
 
+    // Interesting values at the boundaries.
+    testConversion('f32', 'convert_u', 'i64', "0x100404900000008", 72128280609685500);
+    testConversion('f32', 'convert_u', 'i64', "0x7fffff4000000001", 9223371487098962000);
+    testConversion('f32', 'convert_u', 'i64', "0x0020000020000001", 9007200328482816);
+    testConversion('f32', 'convert_u', 'i64', "0x7fffffbfffffffff", 9223371487098961920);
+    testConversion('f32', 'convert_u', 'i64', "0x8000008000000001", 9223373136366403584);
+    testConversion('f32', 'convert_u', 'i64', "0xfffffe8000000001", 18446742974197923840);
+
     testConversion('f64', 'convert_u', 'i64', 1, 1.0);
     testConversion('f64', 'convert_u', 'i64', 0, 0.0);
     testConversion('f64', 'convert_u', 'i64', "0x7fffffffffffffff", 9223372036854775807.0);
     testConversion('f64', 'convert_u', 'i64', "0x8000000000000000", 9223372036854775808.0);
     testConversion('f64', 'convert_u', 'i64', -1, 18446744073709551616.0);
     testConversion('f64', 'convert_u', 'i64', "0xffff0000ffff0000", 18446462603027743000.0);
+    testConversion('f64', 'convert_u', 'i64', "0xbf869c3369c26401", 13800889852755077000);
+    testConversion('f64', 'convert_u', 'i64', "0x7fffff4000000001", 9223371212221054976);
+    testConversion('f64', 'convert_u', 'i64', "0x8000008000000001", 9223372586610589696);
+    testConversion('f64', 'convert_u', 'i64', "0xfffffe8000000001", 18446742424442109952);
 
     testConversion('i64', 'trunc_s', 'f64', 0.0, 0);
     testConversion('i64', 'trunc_s', 'f64', "-0.0", 0);
     testConversion('i64', 'trunc_s', 'f64', 1.0, 1);
     testConversion('i64', 'trunc_s', 'f64', 1.1, 1);
     testConversion('i64', 'trunc_s', 'f64', 1.5, 1);
     testConversion('i64', 'trunc_s', 'f64', 1.99, 1);
     testConversion('i64', 'trunc_s', 'f64', 40.1, 40);
--- a/js/src/jit/IonTypes.h
+++ b/js/src/jit/IonTypes.h
@@ -801,16 +801,21 @@ enum ABIFunctionType
     Args_Double_None = ArgType_Double << RetType_Shift,
 
     // int f(double)
     Args_Int_Double = Args_General0 | (ArgType_Double << ArgType_Shift),
 
     // float f(float)
     Args_Float32_Float32 = (ArgType_Float32 << RetType_Shift) | (ArgType_Float32 << ArgType_Shift),
 
+    // float f(int, int)
+    Args_Float32_IntInt = (ArgType_Float32 << RetType_Shift) |
+        (ArgType_General << (ArgType_Shift * 1)) |
+        (ArgType_General << (ArgType_Shift * 2)),
+
     // double f(double)
     Args_Double_Double = Args_Double_None | (ArgType_Double << ArgType_Shift),
 
     // double f(int)
     Args_Double_Int = Args_Double_None | (ArgType_General << ArgType_Shift),
 
     // double f(int, int)
     Args_Double_IntInt = Args_Double_Int | (ArgType_General << (ArgType_Shift * 2)),
--- a/js/src/jit/SharedIC.cpp
+++ b/js/src/jit/SharedIC.cpp
@@ -1552,23 +1552,20 @@ DoCompareFallback(JSContext* cx, void* p
             ICStub* objectStub = compiler.getStub(compiler.getStubSpace(info.outerScript(cx)));
             if (!objectStub)
                 return false;
 
             stub->addNewStub(objectStub);
             return true;
         }
 
-        if ((lhs.isObject() || lhs.isNull() || lhs.isUndefined()) &&
-            (rhs.isObject() || rhs.isNull() || rhs.isUndefined()) &&
-            !stub->hasStub(ICStub::Compare_ObjectWithUndefined))
-        {
-            JitSpew(JitSpew_BaselineIC, "  Generating %s(Obj/Null/Undef, Obj/Null/Undef) stub",
+        if (lhs.isNullOrUndefined() || rhs.isNullOrUndefined()) {
+            JitSpew(JitSpew_BaselineIC, "  Generating %s(Null/Undef or X, Null/Undef or X) stub",
                     CodeName[op]);
-            bool lhsIsUndefined = lhs.isNull() || lhs.isUndefined();
+            bool lhsIsUndefined = lhs.isNullOrUndefined();
             bool compareWithNull = lhs.isNull() || rhs.isNull();
             ICCompare_ObjectWithUndefined::Compiler compiler(cx, op, engine,
                                                              lhsIsUndefined, compareWithNull);
             ICStub* objectStub = compiler.getStub(compiler.getStubSpace(info.outerScript(cx)));
             if (!objectStub)
                 return false;
 
             stub->addNewStub(objectStub);
@@ -1805,24 +1802,41 @@ ICCompare_ObjectWithUndefined::Compiler:
         masm.bind(&emulatesUndefined);
         masm.moveValue(BooleanValue(op == JSOP_EQ), R0);
         EmitReturnFromIC(masm);
     }
 
     masm.bind(&notObject);
 
     // Also support null == null or undefined == undefined comparisons.
+    Label differentTypes;
     if (compareWithNull)
-        masm.branchTestNull(Assembler::NotEqual, objectOperand, &failure);
+        masm.branchTestNull(Assembler::NotEqual, objectOperand, &differentTypes);
     else
-        masm.branchTestUndefined(Assembler::NotEqual, objectOperand, &failure);
+        masm.branchTestUndefined(Assembler::NotEqual, objectOperand, &differentTypes);
 
     masm.moveValue(BooleanValue(op == JSOP_STRICTEQ || op == JSOP_EQ), R0);
     EmitReturnFromIC(masm);
 
+    masm.bind(&differentTypes);
+    // Also support null == undefined or undefined == null.
+    Label neverEqual;
+    if (compareWithNull)
+        masm.branchTestUndefined(Assembler::NotEqual, objectOperand, &neverEqual);
+    else
+        masm.branchTestNull(Assembler::NotEqual, objectOperand, &neverEqual);
+
+    masm.moveValue(BooleanValue(op == JSOP_EQ || op == JSOP_STRICTNE), R0);
+    EmitReturnFromIC(masm);
+
+    // null/undefined can only be equal to null/undefined or emulatesUndefined.
+    masm.bind(&neverEqual);
+    masm.moveValue(BooleanValue(op == JSOP_NE || op == JSOP_STRICTNE), R0);
+    EmitReturnFromIC(masm);
+
     // Failure case - jump to next stub
     masm.bind(&failure);
     EmitStubGuardFailure(masm);
     return true;
 }
 
 //
 // Compare_Int32WithBoolean
--- a/js/src/jit/arm/CodeGenerator-arm.cpp
+++ b/js/src/jit/arm/CodeGenerator-arm.cpp
@@ -3021,40 +3021,42 @@ CodeGeneratorARM::visitOutOfLineWasmTrun
                                          ool->isUnsigned(), ool->rejoin(),
                                          ool->trapOffset());
 }
 
 void
 CodeGeneratorARM::visitInt64ToFloatingPointCall(LInt64ToFloatingPointCall* lir)
 {
     Register64 input = ToRegister64(lir->getInt64Operand(0));
-    FloatRegister output = ToFloatRegister(lir->output());
 
     MInt64ToFloatingPoint* mir = lir->mir();
     MIRType toType = mir->type();
 
     // We are free to clobber all registers, since this is a call instruction.
     AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All());
     regs.take(input.low);
     regs.take(input.high);
     Register temp = regs.takeAny();
 
     masm.setupUnalignedABICall(temp);
     masm.passABIArg(input.high);
     masm.passABIArg(input.low);
-    if (lir->mir()->isUnsigned())
-        masm.callWithABI(wasm::SymbolicAddress::Uint64ToFloatingPoint, MoveOp::DOUBLE);
-    else
-        masm.callWithABI(wasm::SymbolicAddress::Int64ToFloatingPoint, MoveOp::DOUBLE);
-
-    MOZ_ASSERT_IF(toType == MIRType::Double, output == ReturnDoubleReg);
-    if (toType == MIRType::Float32) {
-        MOZ_ASSERT(output == ReturnFloat32Reg);
-        masm.convertDoubleToFloat32(ReturnDoubleReg, output);
-    }
+
+    bool isUnsigned = mir->isUnsigned();
+    wasm::SymbolicAddress callee = toType == MIRType::Float32
+                                   ? (isUnsigned ? wasm::SymbolicAddress::Uint64ToFloat32
+                                                 : wasm::SymbolicAddress::Int64ToFloat32)
+                                   : (isUnsigned ? wasm::SymbolicAddress::Uint64ToDouble
+                                                 : wasm::SymbolicAddress::Int64ToDouble);
+
+    masm.callWithABI(callee, toType == MIRType::Float32 ? MoveOp::FLOAT32 : MoveOp::DOUBLE);
+
+    DebugOnly<FloatRegister> output(ToFloatRegister(lir->output()));
+    MOZ_ASSERT_IF(toType == MIRType::Double, output.value == ReturnDoubleReg);
+    MOZ_ASSERT_IF(toType == MIRType::Float32, output.value == ReturnFloat32Reg);
 }
 
 void
 CodeGeneratorARM::visitCopySignF(LCopySignF* ins)
 {
     FloatRegister lhs = ToFloatRegister(ins->getOperand(0));
     FloatRegister rhs = ToFloatRegister(ins->getOperand(1));
     FloatRegister output = ToFloatRegister(ins->getDef(0));
--- a/js/src/jit/arm/Simulator-arm.cpp
+++ b/js/src/jit/arm/Simulator-arm.cpp
@@ -2433,16 +2433,17 @@ typedef double (*Prototype_Double_Double
 typedef double (*Prototype_Double_Int)(int32_t arg0);
 typedef double (*Prototype_Double_IntInt)(int32_t arg0, int32_t arg1);
 typedef int32_t (*Prototype_Int_Double)(double arg0);
 typedef int64_t (*Prototype_Int64_Double)(double arg0);
 typedef int32_t (*Prototype_Int_DoubleIntInt)(double arg0, int32_t arg1, int32_t arg2);
 typedef int32_t (*Prototype_Int_IntDoubleIntInt)(int32_t arg0, double arg1, int32_t arg2,
                                                  int32_t arg3);
 typedef float (*Prototype_Float32_Float32)(float arg0);
+typedef float (*Prototype_Float32_IntInt)(int arg0, int arg1);
 
 typedef double (*Prototype_DoubleInt)(double arg0, int32_t arg1);
 typedef double (*Prototype_Double_IntDouble)(int32_t arg0, double arg1);
 typedef double (*Prototype_Double_DoubleDouble)(double arg0, double arg1);
 typedef int32_t (*Prototype_Int_IntDouble)(int32_t arg0, double arg1);
 
 typedef double (*Prototype_Double_DoubleDoubleDouble)(double arg0, double arg1, double arg2);
 typedef double (*Prototype_Double_DoubleDoubleDoubleDouble)(double arg0, double arg1,
@@ -2620,16 +2621,23 @@ Simulator::softwareInterrupt(SimInstruct
             else
                 fval0 = mozilla::BitwiseCast<float>(arg0);
             Prototype_Float32_Float32 target = reinterpret_cast<Prototype_Float32_Float32>(external);
             float fresult = target(fval0);
             scratchVolatileRegisters(/* scratchFloat = true */);
             setCallResultFloat(fresult);
             break;
           }
+          case Args_Float32_IntInt: {
+            Prototype_Float32_IntInt target = reinterpret_cast<Prototype_Float32_IntInt>(external);
+            float fresult = target(arg0, arg1);
+            scratchVolatileRegisters(/* scratchFloat = true */);
+            setCallResultFloat(fresult);
+            break;
+          }
           case Args_Double_Int: {
             Prototype_Double_Int target = reinterpret_cast<Prototype_Double_Int>(external);
             double dresult = target(arg0);
             scratchVolatileRegisters(/* scratchFloat = true */);
             setCallResultDouble(dresult);
             break;
           }
           case Args_Double_IntInt: {
--- a/js/src/jit/x64/CodeGenerator-x64.cpp
+++ b/js/src/jit/x64/CodeGenerator-x64.cpp
@@ -734,27 +734,31 @@ CodeGeneratorX64::visitWasmTruncateToInt
 }
 
 void
 CodeGeneratorX64::visitInt64ToFloatingPoint(LInt64ToFloatingPoint* lir)
 {
     Register64 input = ToRegister64(lir->getInt64Operand(0));
     FloatRegister output = ToFloatRegister(lir->output());
 
-    MIRType outputType = lir->mir()->type();
+    MInt64ToFloatingPoint* mir = lir->mir();
+    bool isUnsigned = mir->isUnsigned();
+
+    MIRType outputType = mir->type();
     MOZ_ASSERT(outputType == MIRType::Double || outputType == MIRType::Float32);
+    MOZ_ASSERT(isUnsigned == !lir->getTemp(0)->isBogusTemp());
 
     if (outputType == MIRType::Double) {
-        if (lir->mir()->isUnsigned())
-            masm.convertUInt64ToDouble(input, output, Register::Invalid());
+        if (isUnsigned)
+            masm.convertUInt64ToDouble(input, output, ToRegister(lir->getTemp(0)));
         else
             masm.convertInt64ToDouble(input, output);
     } else {
-        if (lir->mir()->isUnsigned())
-            masm.convertUInt64ToFloat32(input, output, Register::Invalid());
+        if (isUnsigned)
+            masm.convertUInt64ToFloat32(input, output, ToRegister(lir->getTemp(0)));
         else
             masm.convertInt64ToFloat32(input, output);
     }
 }
 
 void
 CodeGeneratorX64::visitNotI64(LNotI64* lir)
 {
--- a/js/src/jit/x64/Lowering-x64.cpp
+++ b/js/src/jit/x64/Lowering-x64.cpp
@@ -480,16 +480,17 @@ LIRGeneratorX64::visitWasmTruncateToInt6
 
 void
 LIRGeneratorX64::visitInt64ToFloatingPoint(MInt64ToFloatingPoint* ins)
 {
     MDefinition* opd = ins->input();
     MOZ_ASSERT(opd->type() == MIRType::Int64);
     MOZ_ASSERT(IsFloatingPointType(ins->type()));
 
-    define(new(alloc()) LInt64ToFloatingPoint(useInt64Register(opd), LDefinition::BogusTemp()), ins);
+    LDefinition maybeTemp = ins->isUnsigned() ? temp() : LDefinition::BogusTemp();
+    define(new(alloc()) LInt64ToFloatingPoint(useInt64Register(opd), maybeTemp), ins);
 }
 
 void
 LIRGeneratorX64::visitExtendInt32ToInt64(MExtendInt32ToInt64* ins)
 {
     defineInt64(new(alloc()) LExtendInt32ToInt64(useAtStart(ins->input())), ins);
 }
--- a/js/src/jit/x64/MacroAssembler-x64.cpp
+++ b/js/src/jit/x64/MacroAssembler-x64.cpp
@@ -88,71 +88,75 @@ MacroAssemblerX64::convertInt64ToFloat32
     zeroFloat32(output);
 
     vcvtsq2ss(input.reg, output, output);
 }
 
 bool
 MacroAssemblerX64::convertUInt64ToDoubleNeedsTemp()
 {
-    return false;
+    return true;
 }
 
 void
 MacroAssemblerX64::convertUInt64ToDouble(Register64 input, FloatRegister output, Register temp)
 {
-    MOZ_ASSERT(temp == Register::Invalid());
-
     // Zero the output register to break dependencies, see convertInt32ToDouble.
     zeroDouble(output);
 
     // If the input's sign bit is not set we use vcvtsq2sd directly.
-    // Else, we divide by 2, convert to double, and multiply the result by 2.
+    // Else, we divide by 2 and keep the LSB, convert to double, and multiply
+    // the result by 2.
     Label done;
     Label isSigned;
 
     testq(input.reg, input.reg);
     j(Assembler::Signed, &isSigned);
     vcvtsq2sd(input.reg, output, output);
     jump(&done);
 
     bind(&isSigned);
 
     ScratchRegisterScope scratch(asMasm());
     mov(input.reg, scratch);
+    mov(input.reg, temp);
     shrq(Imm32(1), scratch);
+    andq(Imm32(1), temp);
+    orq(temp, scratch);
+
     vcvtsq2sd(scratch, output, output);
     vaddsd(output, output, output);
 
     bind(&done);
 }
 
 void
 MacroAssemblerX64::convertUInt64ToFloat32(Register64 input, FloatRegister output, Register temp)
 {
-    MOZ_ASSERT(temp == Register::Invalid());
-
     // Zero the output register to break dependencies, see convertInt32ToDouble.
     zeroFloat32(output);
 
-    // If the input's sign bit is not set we use vcvtsq2ss directly.
-    // Else, we divide by 2, convert to float, and multiply the result by 2.
+    // See comment in convertUInt64ToDouble.
     Label done;
     Label isSigned;
 
     testq(input.reg, input.reg);
     j(Assembler::Signed, &isSigned);
     vcvtsq2ss(input.reg, output, output);
     jump(&done);
 
     bind(&isSigned);
 
     ScratchRegisterScope scratch(asMasm());
     mov(input.reg, scratch);
+    mov(input.reg, temp);
     shrq(Imm32(1), scratch);
+    andq(Imm32(1), temp);
+    orq(temp, scratch);
+
     vcvtsq2ss(scratch, output, output);
     vaddss(output, output, output);
 
     bind(&done);
 }
 
 void
 MacroAssemblerX64::wasmTruncateDoubleToInt64(FloatRegister input, Register64 output, Label* oolEntry,
--- a/js/src/jit/x86/Lowering-x86.cpp
+++ b/js/src/jit/x86/Lowering-x86.cpp
@@ -633,18 +633,21 @@ LIRGeneratorX86::visitWasmTruncateToInt6
 
 void
 LIRGeneratorX86::visitInt64ToFloatingPoint(MInt64ToFloatingPoint* ins)
 {
     MDefinition* opd = ins->input();
     MOZ_ASSERT(opd->type() == MIRType::Int64);
     MOZ_ASSERT(IsFloatingPointType(ins->type()));
 
-    LDefinition maybeTemp =
-        (ins->isUnsigned() && AssemblerX86Shared::HasSSE3()) ? temp() : LDefinition::BogusTemp();
+    LDefinition maybeTemp = (ins->isUnsigned() &&
+                             ((ins->type() == MIRType::Double && AssemblerX86Shared::HasSSE3()) ||
+                              ins->type() == MIRType::Float32))
+                            ? temp()
+                            : LDefinition::BogusTemp();
 
     define(new(alloc()) LInt64ToFloatingPoint(useInt64Register(opd), maybeTemp), ins);
 }
 
 void
 LIRGeneratorX86::visitExtendInt32ToInt64(MExtendInt32ToInt64* ins)
 {
     if (ins->isUnsigned()) {
--- a/js/src/jit/x86/MacroAssembler-x86.cpp
+++ b/js/src/jit/x86/MacroAssembler-x86.cpp
@@ -57,17 +57,17 @@ MacroAssemblerX86::convertUInt64ToDouble
         double add_constant = 18446744073709551616.0; // 2^64
         store64(Imm64(mozilla::BitwiseCast<uint64_t>(add_constant)), Address(esp, 0));
         fld(Operand(esp, 0));
         faddp();
         bind(&notNegative);
 
         fstp(Operand(esp, 0));
         vmovsd(Address(esp, 0), dest);
-        asMasm().freeStack(2*sizeof(intptr_t));
+        asMasm().freeStack(2 * sizeof(intptr_t));
         return;
     }
 
     // Following operation uses entire 128-bit of dest XMM register.
     // Currently higher 64-bit is free when we have access to lower 64-bit.
     MOZ_ASSERT(dest.size() == 8);
     FloatRegister dest128 = FloatRegister(dest.encoding(), FloatRegisters::Simd128);
 
@@ -898,31 +898,69 @@ MacroAssemblerX86::convertInt64ToDouble(
     zeroDouble(output);
 
     asMasm().Push(input.high);
     asMasm().Push(input.low);
     fild(Operand(esp, 0));
 
     fstp(Operand(esp, 0));
     vmovsd(Address(esp, 0), output);
-    asMasm().freeStack(2*sizeof(intptr_t));
+    asMasm().freeStack(2 * sizeof(intptr_t));
 }
 
 void
 MacroAssemblerX86::convertInt64ToFloat32(Register64 input, FloatRegister output)
 {
-    convertInt64ToDouble(input, output);
-    convertDoubleToFloat32(output, output);
+    // Zero the output register to break dependencies, see convertInt32ToDouble.
+    zeroDouble(output);
+
+    asMasm().Push(input.high);
+    asMasm().Push(input.low);
+    fild(Operand(esp, 0));
+
+    fstp32(Operand(esp, 0));
+    vmovss(Address(esp, 0), output);
+    asMasm().freeStack(2 * sizeof(intptr_t));
 }
 
 void
 MacroAssemblerX86::convertUInt64ToFloat32(Register64 input, FloatRegister output, Register temp)
 {
-    convertUInt64ToDouble(input, output.asDouble(), temp);
-    convertDoubleToFloat32(output, output);
+    // Zero the dest register to break dependencies, see convertInt32ToDouble.
+    zeroDouble(output);
+
+    // Set the FPU precision to 80 bits.
+    asMasm().reserveStack(2 * sizeof(intptr_t));
+    fnstcw(Operand(esp, 0));
+    load32(Operand(esp, 0), temp);
+    orl(Imm32(0x300), temp);
+    store32(temp, Operand(esp, sizeof(intptr_t)));
+    fldcw(Operand(esp, sizeof(intptr_t)));
+
+    asMasm().Push(input.high);
+    asMasm().Push(input.low);
+    fild(Operand(esp, 0));
+
+    Label notNegative;
+    asMasm().branch32(Assembler::NotSigned, input.high, Imm32(0), &notNegative);
+    double add_constant = 18446744073709551616.0; // 2^64
+    uint64_t add_constant_u64 = mozilla::BitwiseCast<uint64_t>(add_constant);
+    store64(Imm64(add_constant_u64), Address(esp, 0));
+
+    fld(Operand(esp, 0));
+    faddp();
+    bind(&notNegative);
+
+    fstp32(Operand(esp, 0));
+    vmovss(Address(esp, 0), output);
+    asMasm().freeStack(2 * sizeof(intptr_t));
+
+    // Restore FPU precision to the initial value.
+    fldcw(Operand(esp, 0));
+    asMasm().freeStack(2 * sizeof(intptr_t));
 }
 
 void
 MacroAssemblerX86::wasmTruncateDoubleToInt64(FloatRegister input, Register64 output, Label* oolEntry,
                                              Label* oolRejoin, FloatRegister tempReg)
 {
     Label fail, convert;
     Register temp = output.high;
--- a/js/src/jscntxtinlines.h
+++ b/js/src/jscntxtinlines.h
@@ -63,17 +63,17 @@ class CompartmentChecker
     }
 
     void checkZone(JS::Zone* z) {
         if (compartment && z != compartment->zone())
             fail(compartment->zone(), z);
     }
 
     void check(JSObject* obj) {
-        MOZ_ASSERT_IF(obj, IsInsideNursery(obj) || !obj->asTenured().isMarked(gc::GRAY));
+        MOZ_ASSERT(JS::ObjectIsNotGray(obj));
         if (obj)
             check(obj->compartment());
     }
 
     template<typename T>
     void check(const Rooted<T>& rooted) {
         check(rooted.get());
     }
@@ -95,17 +95,17 @@ class CompartmentChecker
         if (compartment) {
             JSRuntime* rt = compartment->runtimeFromAnyThread();
             MOZ_ASSERT(rt->gc.atomMarking.atomIsMarked(compartment->zone(), cell));
         }
 #endif
     }
 
     void check(JSString* str) {
-        MOZ_ASSERT(!str->isMarked(gc::GRAY));
+        MOZ_ASSERT(JS::CellIsNotGray(str));
         if (str->isAtom()) {
             checkAtom(str);
         } else {
             checkZone(str->zone());
         }
     }
 
     void check(JS::Symbol* symbol) {
@@ -156,17 +156,17 @@ class CompartmentChecker
     }
 
     void check(jsid id) {
         if (JSID_IS_GCTHING(id))
             checkAtom(JSID_TO_GCTHING(id).asCell());
     }
 
     void check(JSScript* script) {
-        MOZ_ASSERT_IF(script, !script->isMarked(gc::GRAY));
+        MOZ_ASSERT(JS::CellIsNotGray(script));
         if (script)
             check(script->compartment());
     }
 
     void check(InterpreterFrame* fp);
     void check(AbstractFramePtr frame);
     void check(SavedStacks* stacks);
 
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -11705,16 +11705,38 @@ JS::dbg::GetDebuggeeGlobals(JSContext* c
     }
 
     for (WeakGlobalObjectSet::Range r = dbg->allDebuggees(); !r.empty(); r.popFront())
         vector.infallibleAppend(static_cast<JSObject*>(r.front()));
 
     return true;
 }
 
+#ifdef DEBUG
+/* static */ bool
+Debugger::isDebuggerCrossCompartmentEdge(JSObject* obj, const gc::Cell* target)
+{
+    MOZ_ASSERT(target);
+
+    auto cls = obj->getClass();
+    const gc::Cell* referent = nullptr;
+    if (cls == &DebuggerScript_class) {
+        referent = GetScriptReferentCell(obj);
+    } else if (cls == &DebuggerSource_class) {
+        referent = GetSourceReferentRawObject(obj);
+    } else if (obj->is<DebuggerObject>()) {
+        referent = static_cast<gc::Cell*>(obj->as<DebuggerObject>().getPrivate());
+    } else if (obj->is<DebuggerEnvironment>()) {
+        referent = static_cast<gc::Cell*>(obj->as<DebuggerEnvironment>().getPrivate());
+    }
+
+    return referent == target;
+}
+#endif
+
 
 /*** JS::dbg::GarbageCollectionEvent **************************************************************/
 
 namespace JS {
 namespace dbg {
 
 /* static */ GarbageCollectionEvent::Ptr
 GarbageCollectionEvent::Create(JSRuntime* rt, ::js::gcstats::Statistics& stats, uint64_t gcNumber)
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -831,16 +831,19 @@ class Debugger : private mozilla::Linked
      * returns true. If not, it returns false.
      */
     static void traceIncomingCrossCompartmentEdges(JSTracer* tracer);
     static MOZ_MUST_USE bool markIteratively(GCMarker* marker);
     static void traceAllForMovingGC(JSTracer* trc);
     static void sweepAll(FreeOp* fop);
     static void detachAllDebuggersFromGlobal(FreeOp* fop, GlobalObject* global);
     static void findZoneEdges(JS::Zone* v, gc::ZoneComponentFinder& finder);
+#ifdef DEBUG
+    static bool isDebuggerCrossCompartmentEdge(JSObject* obj, const js::gc::Cell* cell);
+#endif
 
     // Checks it the current compartment is allowed to execute code.
     static inline MOZ_MUST_USE bool checkNoExecute(JSContext* cx, HandleScript script);
 
     /*
      * JSTrapStatus Overview
      * ---------------------
      *
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -3225,21 +3225,23 @@ class BaseCompiler
 # else
         MOZ_CRASH("BaseCompiler platform hook: truncateF64ToI64");
 # endif
         return true;
     }
 #endif // FLOAT_TO_I64_CALLOUT
 
 #ifndef I64_TO_FLOAT_CALLOUT
-    bool convertI64ToFloatNeedsTemp(bool isUnsigned) const {
+    bool convertI64ToFloatNeedsTemp(ValType to, bool isUnsigned) const {
 # if defined(JS_CODEGEN_X86)
-        return isUnsigned && AssemblerX86Shared::HasSSE3();
+        return isUnsigned &&
+               ((to == ValType::F64 && AssemblerX86Shared::HasSSE3()) ||
+               to == ValType::F32);
 # else
-        return false;
+        return isUnsigned;
 # endif
     }
 
     void convertI64ToF32(RegI64 src, bool isUnsigned, RegF32 dest, RegI32 temp) {
 # if defined(JS_CODEGEN_X64) || defined(JS_CODEGEN_X86)
         if (isUnsigned)
             masm.convertUInt64ToFloat32(src, dest, temp);
         else
@@ -5019,17 +5021,17 @@ BaseCompiler::emitConvertI64ToF32()
 }
 
 void
 BaseCompiler::emitConvertU64ToF32()
 {
     RegI64 r0 = popI64();
     RegF32 f0 = needF32();
     RegI32 temp;
-    if (convertI64ToFloatNeedsTemp(IsUnsigned(true)))
+    if (convertI64ToFloatNeedsTemp(ValType::F32, IsUnsigned(true)))
         temp = needI32();
     convertI64ToF32(r0, IsUnsigned(true), f0, temp);
     if (temp != Register::Invalid())
         freeI32(temp);
     freeI64(r0);
     pushF32(f0);
 }
 #endif
@@ -5076,17 +5078,17 @@ BaseCompiler::emitConvertI64ToF64()
 }
 
 void
 BaseCompiler::emitConvertU64ToF64()
 {
     RegI64 r0 = popI64();
     RegF64 d0 = needF64();
     RegI32 temp;
-    if (convertI64ToFloatNeedsTemp(IsUnsigned(true)))
+    if (convertI64ToFloatNeedsTemp(ValType::F64, IsUnsigned(true)))
         temp = needI32();
     convertI64ToF64(r0, IsUnsigned(true), d0, temp);
     if (temp != Register::Invalid())
         freeI32(temp);
     freeI64(r0);
     pushF64(d0);
 }
 #endif // I64_TO_FLOAT_CALLOUT
@@ -5966,31 +5968,25 @@ BaseCompiler::emitConvertInt64ToFloating
 
     masm.setupUnalignedABICall(temp);
 # ifdef JS_NUNBOX32
     masm.passABIArg(input.high);
     masm.passABIArg(input.low);
 # else
     MOZ_CRASH("BaseCompiler platform hook: emitConvertInt64ToFloatingCallout");
 # endif
-    masm.callWithABI(callee, MoveOp::DOUBLE);
+    masm.callWithABI(callee, resultType == ValType::F32 ? MoveOp::FLOAT32 : MoveOp::DOUBLE);
 
     freeI32(temp);
     freeI64(input);
 
-    RegF64 rv = captureReturnedF64(call);
-
-    if (resultType == ValType::F32) {
-        RegF32 rv2 = needF32();
-        masm.convertDoubleToFloat32(rv, rv2);
-        freeF64(rv);
-        pushF32(rv2);
-    } else {
-        pushF64(rv);
-    }
+    if (resultType == ValType::F32)
+        pushF32(captureReturnedF32(call));
+    else
+        pushF64(captureReturnedF64(call));
 
     return true;
 }
 #endif // I64_TO_FLOAT_CALLOUT
 
 #ifdef FLOAT_TO_I64_CALLOUT
 // `Callee` always takes a double, so a float32 input must be converted.
 bool
@@ -7115,25 +7111,25 @@ BaseCompiler::emitBody()
             CHECK_NEXT(emitConversion(emitConvertF64ToF32, ValType::F64, ValType::F32));
           case uint16_t(Op::F32ConvertSI32):
             CHECK_NEXT(emitConversion(emitConvertI32ToF32, ValType::I32, ValType::F32));
           case uint16_t(Op::F32ConvertUI32):
             CHECK_NEXT(emitConversion(emitConvertU32ToF32, ValType::I32, ValType::F32));
           case uint16_t(Op::F32ConvertSI64):
 #ifdef I64_TO_FLOAT_CALLOUT
             CHECK_NEXT(emitCalloutConversionOOM(emitConvertInt64ToFloatingCallout,
-                                                SymbolicAddress::Int64ToFloatingPoint,
+                                                SymbolicAddress::Int64ToFloat32,
                                                 ValType::I64, ValType::F32));
 #else
             CHECK_NEXT(emitConversion(emitConvertI64ToF32, ValType::I64, ValType::F32));
 #endif
           case uint16_t(Op::F32ConvertUI64):
 #ifdef I64_TO_FLOAT_CALLOUT
             CHECK_NEXT(emitCalloutConversionOOM(emitConvertInt64ToFloatingCallout,
-                                                SymbolicAddress::Uint64ToFloatingPoint,
+                                                SymbolicAddress::Uint64ToFloat32,
                                                 ValType::I64, ValType::F32));
 #else
             CHECK_NEXT(emitConversion(emitConvertU64ToF32, ValType::I64, ValType::F32));
 #endif
           case uint16_t(Op::F32ReinterpretI32):
             CHECK_NEXT(emitConversion(emitReinterpretI32AsF32, ValType::I32, ValType::F32));
           case uint16_t(Op::F32Load):
             CHECK_NEXT(emitLoad(ValType::F32, Scalar::Float32));
@@ -7180,25 +7176,25 @@ BaseCompiler::emitBody()
             CHECK_NEXT(emitConversion(emitConvertF32ToF64, ValType::F32, ValType::F64));
           case uint16_t(Op::F64ConvertSI32):
             CHECK_NEXT(emitConversion(emitConvertI32ToF64, ValType::I32, ValType::F64));
           case uint16_t(Op::F64ConvertUI32):
             CHECK_NEXT(emitConversion(emitConvertU32ToF64, ValType::I32, ValType::F64));
           case uint16_t(Op::F64ConvertSI64):
 #ifdef I64_TO_FLOAT_CALLOUT
             CHECK_NEXT(emitCalloutConversionOOM(emitConvertInt64ToFloatingCallout,
-                                                SymbolicAddress::Int64ToFloatingPoint,
+                                                SymbolicAddress::Int64ToDouble,
                                                 ValType::I64, ValType::F64));
 #else
             CHECK_NEXT(emitConversion(emitConvertI64ToF64, ValType::I64, ValType::F64));
 #endif
           case uint16_t(Op::F64ConvertUI64):
 #ifdef I64_TO_FLOAT_CALLOUT
             CHECK_NEXT(emitCalloutConversionOOM(emitConvertInt64ToFloatingCallout,
-                                                SymbolicAddress::Uint64ToFloatingPoint,
+                                                SymbolicAddress::Uint64ToDouble,
                                                 ValType::I64, ValType::F64));
 #else
             CHECK_NEXT(emitConversion(emitConvertU64ToF64, ValType::I64, ValType::F64));
 #endif
           case uint16_t(Op::F64Load):
             CHECK_NEXT(emitLoad(ValType::F64, Scalar::Float64));
           case uint16_t(Op::F64Store):
             CHECK_NEXT(emitStore(ValType::F64, Scalar::Float64));
--- a/js/src/wasm/WasmTypes.cpp
+++ b/js/src/wasm/WasmTypes.cpp
@@ -338,29 +338,43 @@ TruncateDoubleToUint64(double input)
     // Note: UINT64_MAX is not representable in double. It is actually UINT64_MAX + 1.
     // Therefore also sending the failure value.
     if (input >= double(UINT64_MAX) || input <= -1.0 || IsNaN(input))
         return 0x8000000000000000;
     return uint64_t(input);
 }
 
 static double
-Int64ToFloatingPoint(int32_t x_hi, uint32_t x_lo)
+Int64ToDouble(int32_t x_hi, uint32_t x_lo)
 {
     int64_t x = int64_t((uint64_t(x_hi) << 32)) + int64_t(x_lo);
     return double(x);
 }
 
+static float
+Int64ToFloat32(int32_t x_hi, uint32_t x_lo)
+{
+    int64_t x = int64_t((uint64_t(x_hi) << 32)) + int64_t(x_lo);
+    return float(x);
+}
+
 static double
-Uint64ToFloatingPoint(int32_t x_hi, uint32_t x_lo)
+Uint64ToDouble(int32_t x_hi, uint32_t x_lo)
 {
     uint64_t x = (uint64_t(x_hi) << 32) + uint64_t(x_lo);
     return double(x);
 }
 
+static float
+Uint64ToFloat32(int32_t x_hi, uint32_t x_lo)
+{
+    uint64_t x = (uint64_t(x_hi) << 32) + uint64_t(x_lo);
+    return float(x);
+}
+
 template <class F>
 static inline void*
 FuncCast(F* pf, ABIFunctionType type)
 {
     void *pv = JS_FUNC_TO_DATA_PTR(void*, pf);
 #ifdef JS_SIMULATOR
     pv = Simulator::RedirectNativeFunction(pv, type);
 #endif
@@ -408,20 +422,24 @@ wasm::AddressOf(SymbolicAddress imm, JSC
       case SymbolicAddress::ModI64:
         return FuncCast(ModI64, Args_General4);
       case SymbolicAddress::UModI64:
         return FuncCast(UModI64, Args_General4);
       case SymbolicAddress::TruncateDoubleToUint64:
         return FuncCast(TruncateDoubleToUint64, Args_Int64_Double);
       case SymbolicAddress::TruncateDoubleToInt64:
         return FuncCast(TruncateDoubleToInt64, Args_Int64_Double);
-      case SymbolicAddress::Uint64ToFloatingPoint:
-        return FuncCast(Uint64ToFloatingPoint, Args_Double_IntInt);
-      case SymbolicAddress::Int64ToFloatingPoint:
-        return FuncCast(Int64ToFloatingPoint, Args_Double_IntInt);
+      case SymbolicAddress::Uint64ToDouble:
+        return FuncCast(Uint64ToDouble, Args_Double_IntInt);
+      case SymbolicAddress::Uint64ToFloat32:
+        return FuncCast(Uint64ToFloat32, Args_Float32_IntInt);
+      case SymbolicAddress::Int64ToDouble:
+        return FuncCast(Int64ToDouble, Args_Double_IntInt);
+      case SymbolicAddress::Int64ToFloat32:
+        return FuncCast(Int64ToFloat32, Args_Float32_IntInt);
 #if defined(JS_CODEGEN_ARM)
       case SymbolicAddress::aeabi_idivmod:
         return FuncCast(__aeabi_idivmod, Args_General2);
       case SymbolicAddress::aeabi_uidivmod:
         return FuncCast(__aeabi_uidivmod, Args_General2);
       case SymbolicAddress::AtomicCmpXchg:
         return FuncCast(atomics_cmpxchg_asm_callout, Args_General5);
       case SymbolicAddress::AtomicXchg:
--- a/js/src/wasm/WasmTypes.h
+++ b/js/src/wasm/WasmTypes.h
@@ -1030,18 +1030,20 @@ enum class SymbolicAddress
     CoerceInPlace_ToInt32,
     CoerceInPlace_ToNumber,
     DivI64,
     UDivI64,
     ModI64,
     UModI64,
     TruncateDoubleToInt64,
     TruncateDoubleToUint64,
-    Uint64ToFloatingPoint,
-    Int64ToFloatingPoint,
+    Uint64ToFloat32,
+    Uint64ToDouble,
+    Int64ToFloat32,
+    Int64ToDouble,
     GrowMemory,
     CurrentMemory,
     Limit
 };
 
 void*
 AddressOf(SymbolicAddress imm, JSContext* cx);
 
--- a/layout/forms/test/test_bug536567_perwindowpb.html
+++ b/layout/forms/test/test_bug536567_perwindowpb.html
@@ -111,17 +111,17 @@ function runTest() {
     runTest();
   } else if (test == "clear history") {
     Services.obs.notifyObservers(null, "browser:purge-session-history", "");
     testIndex++;
     runTest();
   } else {
     var file = dirs[test[2]].clone();
     file.append("file.file");
-    MockFilePicker.returnFiles = [file];
+    MockFilePicker.setFiles([file]);
     content.setAttribute('src', domains[test[0]] + '/chrome/layout/forms/test/bug536567_subframe.html');
   }
 }
 
 function endTest() {
   for(var i = 0; i < dirs.length - 1; i++) {
     dirs[i].remove(true);
   }
--- a/layout/reftests/image/reftest-stylo.list
+++ b/layout/reftests/image/reftest-stylo.list
@@ -12,17 +12,17 @@ random-if(/^Windows\x20NT\x205\.1/.test(
 random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == sync-image-switch-1c.html sync-image-switch-1c.html
 random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == sync-image-switch-1d.html sync-image-switch-1d.html
 
 # Tests for "object-fit" & "object-position"
 == image-object-fit-dyn-1.html image-object-fit-dyn-1.html
 fails skip-if(stylo) == image-object-fit-with-background-1.html image-object-fit-with-background-1.html # Bug 1342188
 fails == image-object-fit-with-background-2.html image-object-fit-with-background-2.html
 == image-object-position-dyn-1.html image-object-position-dyn-1.html
-fails == image-object-position-with-background-1.html image-object-position-with-background-1.html
+asserts(0-1) fails == image-object-position-with-background-1.html image-object-position-with-background-1.html
 == image-object-position-with-background-2.html image-object-position-with-background-2.html
 
 # Tests for image-orientation used with 'from-image' (note that all
 # image-orientation tests are fuzzy because the JPEG images do not perfectly
 # reproduce blocks of solid color, even at maximum quality):
 fuzzy(2,5) == image-orientation-from-image.html?none image-orientation-from-image.html?none
 fuzzy(1,1) == image-orientation-from-image.html?0 image-orientation-from-image.html?0
 fails == image-orientation-from-image.html?90 image-orientation-from-image.html?90
--- a/layout/reftests/w3c-css/submitted/shapes1/reftest.list
+++ b/layout/reftests/w3c-css/submitted/shapes1/reftest.list
@@ -32,68 +32,68 @@ fails == shape-outside-border-box-border
 == shape-outside-border-box-border-radius-011.html shape-outside-border-box-border-radius-011-ref.html
 == shape-outside-border-box-border-radius-012.html shape-outside-border-box-border-radius-012-ref.html
 == shape-outside-padding-box-border-radius-001.html shape-outside-padding-box-border-radius-001-ref.html
 == shape-outside-padding-box-border-radius-002.html shape-outside-padding-box-border-radius-002-ref.html
 == shape-outside-content-box-border-radius-001.html shape-outside-content-box-border-radius-001-ref.html
 == shape-outside-content-box-border-radius-002.html shape-outside-content-box-border-radius-002-ref.html
 
 # Basic shape: circle()
-== shape-outside-circle-001.html shape-outside-circle-001-ref.html
-== shape-outside-circle-002.html shape-outside-circle-002-ref.html
-== shape-outside-circle-003.html shape-outside-circle-003-ref.html
-== shape-outside-circle-004.html shape-outside-circle-004-ref.html
-== shape-outside-circle-005.html shape-outside-circle-005-ref.html
-== shape-outside-circle-006.html shape-outside-circle-005-ref.html
-== shape-outside-circle-007.html shape-outside-circle-005-ref.html
-== shape-outside-circle-008.html shape-outside-circle-008-ref.html
-== shape-outside-circle-009.html shape-outside-circle-008-ref.html
-== shape-outside-circle-010.html shape-outside-circle-010-ref.html
-== shape-outside-circle-011.html shape-outside-circle-011-ref.html
-== shape-outside-circle-012.html shape-outside-circle-011-ref.html
-== shape-outside-circle-013.html shape-outside-circle-011-ref.html
-== shape-outside-circle-014.html shape-outside-circle-014-ref.html
-== shape-outside-circle-015.html shape-outside-circle-014-ref.html
-== shape-outside-circle-016.html shape-outside-circle-016-ref.html
-== shape-outside-circle-017.html shape-outside-circle-017-ref.html
-== shape-outside-circle-018.html shape-outside-circle-018-ref.html
-== shape-outside-circle-019.html shape-outside-circle-019-ref.html
-== shape-outside-circle-020.html shape-outside-circle-020-ref.html
-== shape-outside-circle-021.html shape-outside-circle-021-ref.html
-== shape-outside-circle-022.html shape-outside-circle-022-ref.html
-== shape-outside-circle-023.html shape-outside-circle-023-ref.html
-== shape-outside-circle-024.html shape-outside-circle-024-ref.html
+== shape-outside-circle-032.html shape-outside-circle-032-ref.html
+== shape-outside-circle-033.html shape-outside-circle-033-ref.html
+== shape-outside-circle-034.html shape-outside-circle-034-ref.html
+== shape-outside-circle-035.html shape-outside-circle-035-ref.html
+== shape-outside-circle-036.html shape-outside-circle-036-ref.html
+== shape-outside-circle-037.html shape-outside-circle-036-ref.html
+== shape-outside-circle-038.html shape-outside-circle-036-ref.html
+== shape-outside-circle-039.html shape-outside-circle-039-ref.html
+== shape-outside-circle-040.html shape-outside-circle-039-ref.html
+== shape-outside-circle-041.html shape-outside-circle-041-ref.html
+== shape-outside-circle-042.html shape-outside-circle-042-ref.html
+== shape-outside-circle-043.html shape-outside-circle-042-ref.html
+== shape-outside-circle-044.html shape-outside-circle-042-ref.html
+== shape-outside-circle-045.html shape-outside-circle-045-ref.html
+== shape-outside-circle-046.html shape-outside-circle-045-ref.html
+== shape-outside-circle-047.html shape-outside-circle-047-ref.html
+== shape-outside-circle-048.html shape-outside-circle-048-ref.html
+== shape-outside-circle-049.html shape-outside-circle-049-ref.html
+== shape-outside-circle-050.html shape-outside-circle-050-ref.html
+== shape-outside-circle-051.html shape-outside-circle-051-ref.html
+== shape-outside-circle-052.html shape-outside-circle-052-ref.html
+== shape-outside-circle-053.html shape-outside-circle-053-ref.html
+== shape-outside-circle-054.html shape-outside-circle-054-ref.html
+== shape-outside-circle-055.html shape-outside-circle-055-ref.html
 
 # Basic shape: ellipse()
-== shape-outside-ellipse-001.html shape-outside-ellipse-001-ref.html
-== shape-outside-ellipse-002.html shape-outside-ellipse-002-ref.html
-== shape-outside-ellipse-003.html shape-outside-ellipse-003-ref.html
-== shape-outside-ellipse-004.html shape-outside-ellipse-004-ref.html
-== shape-outside-ellipse-005.html shape-outside-ellipse-005-ref.html
-== shape-outside-ellipse-006.html shape-outside-ellipse-006-ref.html
-== shape-outside-ellipse-007.html shape-outside-ellipse-007-ref.html
-== shape-outside-ellipse-008.html shape-outside-ellipse-008-ref.html
-== shape-outside-ellipse-009.html shape-outside-ellipse-009-ref.html
-== shape-outside-ellipse-010.html shape-outside-ellipse-009-ref.html
-== shape-outside-ellipse-011.html shape-outside-ellipse-011-ref.html
-== shape-outside-ellipse-012.html shape-outside-ellipse-011-ref.html
-== shape-outside-ellipse-013.html shape-outside-ellipse-013-ref.html
-== shape-outside-ellipse-014.html shape-outside-ellipse-014-ref.html
-== shape-outside-ellipse-015.html shape-outside-ellipse-015-ref.html
-== shape-outside-ellipse-016.html shape-outside-ellipse-016-ref.html
-== shape-outside-ellipse-017.html shape-outside-ellipse-017-ref.html
-== shape-outside-ellipse-018.html shape-outside-ellipse-018-ref.html
-== shape-outside-ellipse-019.html shape-outside-ellipse-019-ref.html
-== shape-outside-ellipse-020.html shape-outside-ellipse-020-ref.html
+== shape-outside-ellipse-032.html shape-outside-ellipse-032-ref.html
+== shape-outside-ellipse-033.html shape-outside-ellipse-033-ref.html
+== shape-outside-ellipse-034.html shape-outside-ellipse-034-ref.html
+== shape-outside-ellipse-035.html shape-outside-ellipse-035-ref.html
+== shape-outside-ellipse-036.html shape-outside-ellipse-036-ref.html
+== shape-outside-ellipse-037.html shape-outside-ellipse-037-ref.html
+== shape-outside-ellipse-038.html shape-outside-ellipse-038-ref.html
+== shape-outside-ellipse-039.html shape-outside-ellipse-039-ref.html
+== shape-outside-ellipse-040.html shape-outside-ellipse-040-ref.html
+== shape-outside-ellipse-041.html shape-outside-ellipse-040-ref.html
+== shape-outside-ellipse-042.html shape-outside-ellipse-042-ref.html
+== shape-outside-ellipse-043.html shape-outside-ellipse-042-ref.html
+== shape-outside-ellipse-044.html shape-outside-ellipse-044-ref.html
+== shape-outside-ellipse-045.html shape-outside-ellipse-045-ref.html
+== shape-outside-ellipse-046.html shape-outside-ellipse-046-ref.html
+== shape-outside-ellipse-047.html shape-outside-ellipse-047-ref.html
+== shape-outside-ellipse-048.html shape-outside-ellipse-048-ref.html
+== shape-outside-ellipse-049.html shape-outside-ellipse-049-ref.html
+== shape-outside-ellipse-050.html shape-outside-ellipse-050-ref.html
+== shape-outside-ellipse-051.html shape-outside-ellipse-051-ref.html
 
 # Basic shape: inset()
-== shape-outside-inset-001.html shape-outside-inset-001-ref.html
-== shape-outside-inset-002.html shape-outside-inset-002-ref.html
-== shape-outside-inset-003.html shape-outside-inset-003-ref.html
-== shape-outside-inset-004.html shape-outside-inset-004-ref.html
-== shape-outside-inset-005.html shape-outside-inset-005-ref.html
-== shape-outside-inset-006.html shape-outside-inset-006-ref.html
-== shape-outside-inset-007.html shape-outside-inset-007-ref.html
-== shape-outside-inset-008.html shape-outside-inset-008-ref.html
-== shape-outside-inset-009.html shape-outside-inset-009-ref.html
-== shape-outside-inset-010.html shape-outside-inset-010-ref.html
-== shape-outside-inset-011.html shape-outside-inset-011-ref.html
-== shape-outside-inset-012.html shape-outside-inset-012-ref.html
+== shape-outside-inset-016.html shape-outside-inset-016-ref.html
+== shape-outside-inset-017.html shape-outside-inset-017-ref.html
+== shape-outside-inset-018.html shape-outside-inset-018-ref.html
+== shape-outside-inset-019.html shape-outside-inset-019-ref.html
+== shape-outside-inset-020.html shape-outside-inset-020-ref.html
+== shape-outside-inset-021.html shape-outside-inset-021-ref.html
+== shape-outside-inset-022.html shape-outside-inset-022-ref.html
+== shape-outside-inset-023.html shape-outside-inset-023-ref.html
+== shape-outside-inset-024.html shape-outside-inset-024-ref.html
+== shape-outside-inset-025.html shape-outside-inset-025-ref.html
+== shape-outside-inset-026.html shape-outside-inset-026-ref.html
+== shape-outside-inset-027.html shape-outside-inset-027-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-001-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-032-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-001.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-032.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-001.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-032.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, circle(50% at left top)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-001-ref.html">
+  <link rel="match" href="shape-outside-circle-032-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape circle(50% at left top) value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-002-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-033-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-002.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-033.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-002.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-033.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, circle(50% at right bottom)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-002-ref.html">
+  <link rel="match" href="shape-outside-circle-033-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape circle(50% at right bottom) value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-003-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-034-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-003.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-034.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-003.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-034.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, circle(50% at right top)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-003-ref.html">
+  <link rel="match" href="shape-outside-circle-034-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape circle(50% at right top) value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-004-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-035-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-004.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-035.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-004.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-035.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, circle(50% at left bottom)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-004-ref.html">
+  <link rel="match" href="shape-outside-circle-035-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape circle(50% at left bottom) value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-005-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-036-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-005.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-036.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-005.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-036.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, circle()</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-005-ref.html">
+  <link rel="match" href="shape-outside-circle-036-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape circle() value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-006.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-037.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-006.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-037.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, circle(closest-side at center) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-005-ref.html">
+  <link rel="match" href="shape-outside-circle-036-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape circle(closest-side at center) border-box value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-007.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-038.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-007.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-038.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, circle(farthest-side at center)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-005-ref.html">
+  <link rel="match" href="shape-outside-circle-036-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape circle(farthest-side at center) value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-008-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-039-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-008.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-039.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-008.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-039.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, circle(0%) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-008-ref.html">
+  <link rel="match" href="shape-outside-circle-039-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the left float shape defines an empty float area by the basic shape circle(0%) border-box value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-009.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-040.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-009.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-040.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, circle(closest-side at left center) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-008-ref.html">
+  <link rel="match" href="shape-outside-circle-039-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the left float shape defines an empty float area by the basic shape circle(closest-side at left center) border-box value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-010-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-041-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-010.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-041.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-010.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-041.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, circle(100%)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-010-ref.html">
+  <link rel="match" href="shape-outside-circle-041-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape circle(100%) value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-011-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-042-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-011.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-042.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-011.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-042.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, circle()</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-011-ref.html">
+  <link rel="match" href="shape-outside-circle-042-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape circle() value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-012.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-043.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-012.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-043.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, circle(closest-side at center) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-011-ref.html">
+  <link rel="match" href="shape-outside-circle-042-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape circle(closest-side at center) border-box value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-013.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-044.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-013.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-044.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, circle(farthest-side at center)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-011-ref.html">
+  <link rel="match" href="shape-outside-circle-042-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape circle(farthest-side at center) value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-014-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-045-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-014.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-045.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-014.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-045.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, circle(0%) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-014-ref.html">
+  <link rel="match" href="shape-outside-circle-045-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the right float shape defines an empty float area by the basic shape circle(0%) border-box value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-015.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-046.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-015.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-046.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, circle(closest-side at right center) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-014-ref.html">
+  <link rel="match" href="shape-outside-circle-045-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the right float shape defines an empty float area by the basic shape circle(closest-side at right center) border-box value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-016-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-047-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-016.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-047.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-016.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-047.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, circle(100%)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-016-ref.html">
+  <link rel="match" href="shape-outside-circle-047-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape circle(100%) value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-017-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-048-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-017.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-048.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-017.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-048.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-rl, float left, circle(50% at left 40px top 40px)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-017-ref.html">
+  <link rel="match" href="shape-outside-circle-048-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by circle(50% at left 40px top 40px) value under vertical-rl writing-mode.">
   <style>
   .container {
     writing-mode: vertical-rl;
     inline-size: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-018-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-049-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-018.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-049.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-018.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-049.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-rl, float right, circle(50% at left 40px bottom 40px)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-018-ref.html">
+  <link rel="match" href="shape-outside-circle-049-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by circle(50% at left 40px bottom 40px) value under vertical-rl writing-mode.">
   <style>
   .container {
     writing-mode: vertical-rl;
     direction: rtl;
     inline-size: 200px;
     line-height: 0;
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-019-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-050-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-019.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-050.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-019.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-050.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-lr, float left, circle(50% at right 40px top 40px)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-019-ref.html">
+  <link rel="match" href="shape-outside-circle-050-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by circle(50% at right 40px top 40px) value under vertical-lr writing-mode.">
   <style>
   .container {
     writing-mode: vertical-lr;
     inline-size: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-020-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-051-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-020.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-051.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-020.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-051.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-lr, float right, circle(50% at right 40px bottom 40px)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-020-ref.html">
+  <link rel="match" href="shape-outside-circle-051-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by circle(50% at right 40px bottom 40px) value under vertical-lr writing-mode.">
   <style>
   .container {
     writing-mode: vertical-lr;
     direction: rtl;
     inline-size: 200px;
     line-height: 0;
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-021-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-052-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-021.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-052.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-021.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-052.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: sideways-lr, float left, circle(50% at right 40px bottom 40px)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-021-ref.html">
+  <link rel="match" href="shape-outside-circle-052-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by circle(50% at right 40px bottom 40px) value under sideways-lr writing-mode.">
   <style>
   .container {
     writing-mode: sideways-lr;
     inline-size: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-022-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-053-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-022.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-053.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-022.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-053.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: sideways-lr, float right, circle(50% at right 40px top 40px)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-022-ref.html">
+  <link rel="match" href="shape-outside-circle-053-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by circle(50% at right 40px top 40px) value under sideways-lr writing-mode.">
   <style>
   .container {
     writing-mode: sideways-lr;
     direction: rtl;
     inline-size: 200px;
     line-height: 0;
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-023-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-054-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-023.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-054.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-023.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-054.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: horizontal-tb, float left, circle(50% at left 40px bottom 40px)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-023-ref.html">
+  <link rel="match" href="shape-outside-circle-054-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by circle(50% at left 40px bottom 40px) value under horizontal-tb writing-mode.">
   <style>
   .container {
     writing-mode: horizontal-tb;
     inline-size: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-024-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-055-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-024.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-055.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-024.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-circle-055.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: horizontal-tb, float right, circle(50% at right 40px bottom 40px)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-circle-024-ref.html">
+  <link rel="match" href="shape-outside-circle-055-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by circle(50% at right 40px bottom 40px) value under horizontal-tb writing-mode.">
   <style>
   .container {
     writing-mode: horizontal-tb;
     direction: rtl;
     inline-size: 200px;
     line-height: 0;
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-001-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-032-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-001.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-032.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-001.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-032.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, ellipse(40px 60px at left top)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-001-ref.html">
+  <link rel="match" href="shape-outside-ellipse-032-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape ellipse(40px 60px at left top) value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-002-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-033-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-002.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-033.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-002.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-033.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, ellipse(40px 60px at right bottom)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-002-ref.html">
+  <link rel="match" href="shape-outside-ellipse-033-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape ellipse(40px 60px at right bottom) value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-003-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-034-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-003.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-034.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-003.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-034.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, ellipse(40px 60px at right top)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-003-ref.html">
+  <link rel="match" href="shape-outside-ellipse-034-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape ellipse(40px 60px at right top)">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-004-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-035-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-004.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-035.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-004.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-035.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, ellipse(40px 60px at left bottom)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-004-ref.html">
+  <link rel="match" href="shape-outside-ellipse-035-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape ellipse(40px 60px at left bottom) value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-005-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-036-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-005.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-036.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-005.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-036.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, ellipse()</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-005-ref.html">
+  <link rel="match" href="shape-outside-ellipse-036-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape ellipse() value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-006-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-037-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-006.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-037.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-006.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-037.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, ellipse(closest-side farthest-side at left 40px top 60px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-006-ref.html">
+  <link rel="match" href="shape-outside-ellipse-037-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape ellipse(closest-side farthest-side at left 40px top 60px) border-box">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-007-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-038-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-007.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-038.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-007.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-038.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, ellipse()</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-007-ref.html">
+  <link rel="match" href="shape-outside-ellipse-038-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape ellipse() value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-008-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-039-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-008.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-039.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-008.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-039.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, ellipse(closest-side farthest-side at right 40px top 60px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-008-ref.html">
+  <link rel="match" href="shape-outside-ellipse-039-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape ellipse(closest-side farthest-side at right 40px top 60px) border-box">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-009-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-040-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-009.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-040.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-009.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-040.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, ellipse(0% 0%)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-009-ref.html">
+  <link rel="match" href="shape-outside-ellipse-040-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the left float shape defines an empty float area by the basic shape ellipse(0% 0%) value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-010.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-041.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-010.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-041.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, ellipse(closest-side closest-side at top left)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-009-ref.html">
+  <link rel="match" href="shape-outside-ellipse-040-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the left float shape defines an empty float area by the basic shape ellipse(0% 0closest-side closest-side at top left) value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-011-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-042-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-011.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-042.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-011.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-042.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, ellipse(0% 0%)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-011-ref.html">
+  <link rel="match" href="shape-outside-ellipse-042-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the right float shape defines an empty float area by the basic shape ellipse(0% 0%) value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-012.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-043.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-012.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-043.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, ellipse(closest-side closest-side at top right)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-011-ref.html">
+  <link rel="match" href="shape-outside-ellipse-042-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the right float shape defines an empty float area by the basic shape ellipse(0% 0closest-side closest-side at top right) value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-013-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-044-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-013.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-044.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-013.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-044.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, ellipse(100% 100%)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-013-ref.html">
+  <link rel="match" href="shape-outside-ellipse-044-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape ellipse(100% 100%) value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-014-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-045-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-014.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-045.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-014.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-045.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, ellipse(100% 100%)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-014-ref.html">
+  <link rel="match" href="shape-outside-ellipse-045-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape ellipse(100% 100%) value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-015-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-046-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-015.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-046.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-015.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-046.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-rl, float left, ellipse(closest-side farthest-side at top 40px right 60px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-015-ref.html">
+  <link rel="match" href="shape-outside-ellipse-046-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape ellipse(closest-side farthest-side at top 40px right 60px) border-box">
   <style>
   .container {
     writing-mode: vertical-rl;
     inline-size: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-016-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-047-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-016.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-047.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-016.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-047.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-rl, float right, ellipse(closest-side farthest-side at top 40px right 60px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-016-ref.html">
+  <link rel="match" href="shape-outside-ellipse-047-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape ellipse(closest-side farthest-side at top 40px right 60px) border-box">
   <style>
   .container {
     writing-mode: vertical-rl;
     direction: rtl;
     inline-size: 200px;
     line-height: 0;
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-017-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-048-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-017.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-048.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-017.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-048.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-lr, float left, ellipse(closest-side farthest-side at top 40px left 60px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-017-ref.html">
+  <link rel="match" href="shape-outside-ellipse-048-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape ellipse(closest-side farthest-side at left 40px top 60px) border-box">
   <style>
   .container {
     writing-mode: vertical-lr;
     inline-size: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-018-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-049-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-018.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-049.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-018.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-049.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-lr, float right, ellipse(closest-side farthest-side at top 40px left 60px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-018-ref.html">
+  <link rel="match" href="shape-outside-ellipse-049-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape ellipse(closest-side farthest-side at left 40px top 60px) border-box">
   <style>
   .container {
     writing-mode: vertical-lr;
     direction: rtl;
     inline-size: 200px;
     line-height: 0;
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-019-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-050-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-019.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-050.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-019.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-050.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: sideways-lr, float left, ellipse(closest-side farthest-side at top 40px left 60px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-019-ref.html">
+  <link rel="match" href="shape-outside-ellipse-050-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the basic shape ellipse(closest-side farthest-side at left 40px top 60px) border-box">
   <style>
   .container {
     writing-mode: sideways-lr;
     inline-size: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-020-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-051-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-020.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-051.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-020.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-ellipse-051.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: sideways-lr, float right, ellipse(closest-side farthest-side at top 40px left 60px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-ellipse-020-ref.html">
+  <link rel="match" href="shape-outside-ellipse-051-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the basic shape ellipse(closest-side farthest-side at left 40px top 60px) border-box">
   <style>
   .container {
     writing-mode: sideways-lr;
     direction: rtl;
     inline-size: 200px;
     line-height: 0;
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-001-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-016-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-001.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-016.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-001.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-016.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, inset(20px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-001-ref.html">
+  <link rel="match" href="shape-outside-inset-016-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the inset(20px) border-box value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-002-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-017-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-002.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-017.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-002.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-017.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, inset(20px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-002-ref.html">
+  <link rel="match" href="shape-outside-inset-017-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the inset(20px) border-box value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-003-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-018-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-003.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-018.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-003.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-018.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float left, inset(50%)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-003-ref.html">
+  <link rel="match" href="shape-outside-inset-018-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the left float shape defines an empty float area by the basic shape inset(50%) value.">
   <style>
   .container {
     width: 200px;
     line-height: 0;
   }
 
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-004-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-019-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-004.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-019.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-004.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-019.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: float right, inset(50%)</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-004-ref.html">
+  <link rel="match" href="shape-outside-inset-019-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the right float shape defines an empty float area by the basic shape inset(50%) value.">
   <style>
   .container {
     direction: rtl;
     width: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-005-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-020-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-005.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-020.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-005.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-020.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: horizontal-tb, float left, inset(10px round 0 40px/ 0 60px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-005-ref.html">
+  <link rel="match" href="shape-outside-inset-020-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the inset(10px round 0 40px/ 0 60px) border-box value under horizontal-tb writing-mode.">
   <style>
   .container {
     writing-mode: horizontal-tb;
     inline-size: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-006-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-021-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-006.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-021.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-006.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-021.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: horizontal-tb, float right, inset(10px round 0 40px/ 0 60px) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-006-ref.html">
+  <link rel="match" href="shape-outside-inset-021-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the inset(10px round 0 40px/ 0 60px) border-box value under horizontal-tb writing-mode.">
   <style>
   .container {
     writing-mode: horizontal-tb;
     direction: rtl;
     inline-size: 200px;
     line-height: 0;
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-007-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-022-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-007.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-022.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-007.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-022.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-rl, float left, inset(10px round 60px 0/ 40px 0) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-007-ref.html">
+  <link rel="match" href="shape-outside-inset-022-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the inset(10px round 60px 0/ 40px 0) border-box value under vertical-rl writing-mode.">
   <style>
   .container {
     writing-mode: vertical-rl;
     inline-size: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-008-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-023-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-008.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-023.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-008.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-023.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-rl, float right, inset(10px round 60px 0/ 40px 0) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-008-ref.html">
+  <link rel="match" href="shape-outside-inset-023-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the inset(10px round 60px 0/ 40px 0) border-box value under vertical-rl writing-mode.">
   <style>
   .container {
     writing-mode: vertical-rl;
     direction: rtl;
     inline-size: 200px;
     line-height: 0;
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-009-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-024-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-009.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-024.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-009.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-024.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-lr, float left, inset(10px round 60px 0/ 40px 0) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-009-ref.html">
+  <link rel="match" href="shape-outside-inset-024-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the inset(10px round 60px 0/ 40px 0) border-box value under vertical-lr writing-mode.">
   <style>
   .container {
     writing-mode: vertical-lr;
     inline-size: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-010-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-025-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-010.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-025.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-010.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-025.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: vertical-lr, float right, inset(10px round 60px 0/ 40px 0) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-010-ref.html">
+  <link rel="match" href="shape-outside-inset-025-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the inset(10px round 60px 0/ 40px 0) border-box value under vertical-lr writing-mode.">
   <style>
   .container {
     writing-mode: vertical-lr;
     direction: rtl;
     inline-size: 200px;
     line-height: 0;
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-011-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-026-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-011.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-026.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-011.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-026.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: sideways-lr, float left, inset(10px round 60px 0/ 40px 0) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-011-ref.html">
+  <link rel="match" href="shape-outside-inset-026-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the left float shape defined by the inset(10px round 60px 0/ 40px 0) border-box value under sideways-lr writing-mode.">
   <style>
   .container {
     writing-mode: sideways-lr;
     inline-size: 200px;
     line-height: 0;
   }
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-012-ref.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-027-ref.html
rename from layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-012.html
rename to layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-027.html
--- a/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-012.html
+++ b/layout/reftests/w3c-css/submitted/shapes1/shape-outside-inset-027.html
@@ -3,17 +3,17 @@
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <html>
   <meta charset="utf-8">
   <title>CSS Shape Test: sideways-lr, float right, inset(10px round 60px 0/ 40px 0) border-box</title>
   <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
   <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
   <link rel="help" href="https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes">
-  <link rel="match" href="shape-outside-inset-012-ref.html">
+  <link rel="match" href="shape-outside-inset-027-ref.html">
   <meta name="flags" content="">
   <meta name="assert" content="Test the boxes are wrapping around the right float shape defined by the inset(10px round 60px 0/ 40px 0) border-box value under sideways-lr writing-mode.">
   <style>
   .container {
     writing-mode: sideways-lr;
     direction: rtl;
     inline-size: 200px;
     line-height: 0;
--- a/layout/reftests/w3c-css/submitted/writing-modes-3/logical-physical-mapping-001-ref.html
+++ b/layout/reftests/w3c-css/submitted/writing-modes-3/logical-physical-mapping-001-ref.html
@@ -35,21 +35,21 @@
   direction: ltr;
 }
 #body tr td:nth-child(2n+3) div {
   direction: rtl;
 }
 
 
 td {
-  padding: 10px;
-  font-size: 15px;
-  background-color: grey;
-  width: 80px;
-  height: 80px;
+  padding: 5px;
+  font-size: 13px;
+  background-color: silver;
+  width: 70px;
+  height: 70px;
 }
 
 
 .top {
   border-bottom: 2px dotted blue;
   border-top: 2px dotted orange;
 }
 .right {
--- a/layout/reftests/w3c-css/submitted/writing-modes-3/logical-physical-mapping-001.html
+++ b/layout/reftests/w3c-css/submitted/writing-modes-3/logical-physical-mapping-001.html
@@ -50,21 +50,21 @@
   direction: ltr;
 }
 #body tr td:nth-child(2n+3) div {
   direction: rtl;
 }
 
 
 td {
-  padding: 10px;
-  font-size: 15px;
-  background-color: grey;
-  width: 80px;
-  height: 80px;
+  padding: 5px;
+  font-size: 13px;
+  background-color: silver;
+  width: 70px;
+  height: 70px;
 }
 
 
 .top {
   border-bottom: 2px dotted blue;
 }
 .right {
   border-left: 2px dotted blue;
--- a/layout/tools/layout-debug/ui/content/layoutdebug.js
+++ b/layout/tools/layout-debug/ui/content/layoutdebug.js
@@ -162,20 +162,22 @@ function toggle(menuitem)
 
 function openFile()
 {
   var nsIFilePicker = Components.interfaces.nsIFilePicker;
   var fp = Components.classes["@mozilla.org/filepicker;1"]
         .createInstance(nsIFilePicker);
   fp.init(window, "Select a File", nsIFilePicker.modeOpen);
   fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterAll);
-  if (fp.show() == nsIFilePicker.returnOK && fp.fileURL.spec &&
-                fp.fileURL.spec.length > 0) {
-    gBrowser.loadURI(fp.fileURL.spec);
-  }
+  fp.open(rv => {
+    if (rv == nsIFilePicker.returnOK && fp.fileURL.spec &&
+        fp.fileURL.spec.length > 0) {
+      gBrowser.loadURI(fp.fileURL.spec);
+    }
+  });
 }
 const LDB_RDFNS = "http://mozilla.org/newlayout/LDB-rdf#";
 const NC_RDFNS = "http://home.netscape.com/NC-rdf#";
 
 function RTestIndexList() {
   this.init();
 }
 
@@ -259,27 +261,29 @@ RTestIndexList.prototype = {
 
       var fp = Components.classes[NS_FILEPICKER_CONTRACTID].
                    createInstance(nsIFilePicker);
 
       // XXX l10n (but this is just for 5 developers, so no problem)
       fp.init(window, "New Regression Test List", nsIFilePicker.modeOpen);
       fp.appendFilters(nsIFilePicker.filterAll);
       fp.defaultString = "rtest.lst";
-      if (fp.show() != nsIFilePicker.returnOK)
-        return;
+      fp.open(rv => {
+        if (rv != nsIFilePicker.returnOK) {
+          return;
+        }
 
-      var file = fp.file.persistentDescriptor;
-      var resource = this.mRDFService.GetResource(file);
-      var literal = this.mRDFService.GetLiteral(file);
-      this.mDataSource.Assert(this.mLDB_Root, this.mNC_Child, resource, true);
-      this.mDataSource.Assert(resource, this.mNC_Name, literal, true);
+        var file = fp.file.persistentDescriptor;
+        var resource = this.mRDFService.GetResource(file);
+        var literal = this.mRDFService.GetLiteral(file);
+        this.mDataSource.Assert(this.mLDB_Root, this.mNC_Child, resource, true);
+        this.mDataSource.Assert(resource, this.mNC_Name, literal, true);
 
-      this.save();
-
+        this.save();
+      });
     },
 
   remove : function(file)
     {
       var resource = this.mRDFService.GetResource(file);
       var literal = this.mRDFService.GetLiteral(file);
       this.mDataSource.Unassert(this.mLDB_Root, this.mNC_Child, resource);
       this.mDataSource.Unassert(resource, this.mNC_Name, literal);
--- a/mobile/android/components/FilePicker.js
+++ b/mobile/android/components/FilePicker.js
@@ -224,25 +224,23 @@ FilePicker.prototype = {
       this._filePath = file || null;
       this._promptActive = false;
 
       if (!file) {
         return;
       }
 
       if (this._domWin) {
-        let utils = this._domWin.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
-        this._domFile = utils.wrapDOMFile(this.file);
-        return;
+        return this._domWin.File.createFromNsIFile(this.file, { existenceCheck: false });
       }
 
-      return File.createFromNsIFile(this.file).then(domFile => {
-        this._domFile = domFile;
-      });
-    }).catch(() => {
+      return File.createFromNsIFile(this.file, { existenceCheck: false });
+    }).then(domFile => {
+      this._domFile = domFile;
+    }, () => {
     }).then(() => {
       if (this._callback) {
         this._callback.done(this._filePath ?
           Ci.nsIFilePicker.returnOK : Ci.nsIFilePicker.returnCancel);
       }
       delete this._callback;
     });
   },
--- a/security/manager/pki/resources/content/certManager.js
+++ b/security/manager/pki/resources/content/certManager.js
@@ -327,20 +327,21 @@ function backupCerts()
   var bundle = document.getElementById("pippki_bundle");
   var fp = Components.classes[nsFilePicker].createInstance(nsIFilePicker);
   fp.init(window,
           bundle.getString("chooseP12BackupFileDialog"),
           nsIFilePicker.modeSave);
   fp.appendFilter(bundle.getString("file_browse_PKCS12_spec"),
                   "*.p12");
   fp.appendFilters(nsIFilePicker.filterAll);
-  var rv = fp.show();
-  if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
-    certdb.exportPKCS12File(fp.file, selected_certs.length, selected_certs);
-  }
+  fp.open(rv => {
+    if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
+      certdb.exportPKCS12File(fp.file, selected_certs.length, selected_certs);
+    }
+  });
 }
 
 function backupAllCerts()
 {
   // Select all rows, then call doBackup()
   var items = userTreeView.selection.selectAll();
   backupCerts();
 }
@@ -362,17 +363,21 @@ function restoreCerts()
   fp.init(window,
           bundle.getString("chooseP12RestoreFileDialog2"),
           nsIFilePicker.modeOpen);
   fp.appendFilter(bundle.getString("file_browse_PKCS12_spec"),
                   "*.p12; *.pfx");
   fp.appendFilter(bundle.getString("file_browse_Certificate_spec"),
                   gCertFileTypes);
   fp.appendFilters(nsIFilePicker.filterAll);
-  if (fp.show() == nsIFilePicker.returnOK) {
+  fp.open(rv => {
+    if (rv != nsIFilePicker.returnOK) {
+      return;
+    }
+
     // If this is an X509 user certificate, import it as one.
 
     var isX509FileType = false;
     var fileTypesList = gCertFileTypes.slice(1).split("; *");
     for (var type of fileTypesList) {
       if (fp.file.path.endsWith(type)) {
         isX509FileType = true;
         break;
@@ -402,17 +407,17 @@ function restoreCerts()
     }
 
     var certcache = certdb.getCerts();
     userTreeView.loadCertsFromCache(certcache, nsIX509Cert.USER_CERT);
     userTreeView.selection.clearSelection();
     caTreeView.loadCertsFromCache(certcache, nsIX509Cert.CA_CERT);
     caTreeView.selection.clearSelection();
     enableBackupAllButton();
-  }
+  });
 }
 
 function exportCerts()
 {
   getSelectedCerts();
 
   for (let cert of selected_certs) {
     exportToFile(window, cert);
@@ -480,21 +485,23 @@ function addCACerts()
   var bundle = document.getElementById("pippki_bundle");
   var fp = Components.classes[nsFilePicker].createInstance(nsIFilePicker);
   fp.init(window,
           bundle.getString("importCACertsPrompt"),
           nsIFilePicker.modeOpen);
   fp.appendFilter(bundle.getString("file_browse_Certificate_spec"),
                   gCertFileTypes);
   fp.appendFilters(nsIFilePicker.filterAll);
-  if (fp.show() == nsIFilePicker.returnOK) {
-    certdb.importCertsFromFile(fp.file, nsIX509Cert.CA_CERT);
-    caTreeView.loadCerts(nsIX509Cert.CA_CERT);
-    caTreeView.selection.clearSelection();
-  }
+  fp.open(rv => {
+    if (rv == nsIFilePicker.returnOK) {
+      certdb.importCertsFromFile(fp.file, nsIX509Cert.CA_CERT);
+      caTreeView.loadCerts(nsIX509Cert.CA_CERT);
+      caTreeView.selection.clearSelection();
+    }
+  });
 }
 
 function onSmartCardChange()
 {
   var certcache = certdb.getCerts();
   // We've change the state of the smart cards inserted or removed
   // that means the available certs may have changed. Update the display
   userTreeView.loadCertsFromCache(certcache, nsIX509Cert.USER_CERT);
@@ -514,24 +521,26 @@ function addEmailCert()
   var bundle = document.getElementById("pippki_bundle");
   var fp = Components.classes[nsFilePicker].createInstance(nsIFilePicker);
   fp.init(window,
           bundle.getString("importEmailCertPrompt"),
           nsIFilePicker.modeOpen);
   fp.appendFilter(bundle.getString("file_browse_Certificate_spec"),
                   gCertFileTypes);
   fp.appendFilters(nsIFilePicker.filterAll);
-  if (fp.show() == nsIFilePicker.returnOK) {
-    certdb.importCertsFromFile(fp.file, nsIX509Cert.EMAIL_CERT);
-    var certcache = certdb.getCerts();
-    emailTreeView.loadCertsFromCache(certcache, nsIX509Cert.EMAIL_CERT);
-    emailTreeView.selection.clearSelection();
-    caTreeView.loadCertsFromCache(certcache, nsIX509Cert.CA_CERT);
-    caTreeView.selection.clearSelection();
-  }
+  fp.open(rv => {
+    if (rv == nsIFilePicker.returnOK) {
+      certdb.importCertsFromFile(fp.file, nsIX509Cert.EMAIL_CERT);
+      var certcache = certdb.getCerts();
+      emailTreeView.loadCertsFromCache(certcache, nsIX509Cert.EMAIL_CERT);
+      emailTreeView.selection.clearSelection();
+      caTreeView.loadCertsFromCache(certcache, nsIX509Cert.CA_CERT);
+      caTreeView.selection.clearSelection();
+    }
+  });
 }
 
 function addException()
 {
   window.openDialog("chrome://pippki/content/exceptionDialog.xul", "",
                     "chrome,centerscreen,modal");
   var certcache = certdb.getCerts();
   serverTreeView.loadCertsFromCache(certcache, nsIX509Cert.SERVER_CERT);
--- a/security/nss/TAG-INFO
+++ b/security/nss/TAG-INFO
@@ -1,1 +1,1 @@
-6511e19a2c6c
+dec8c06d7ed9
--- a/security/nss/coreconf/coreconf.dep
+++ b/security/nss/coreconf/coreconf.dep
@@ -5,8 +5,9 @@
 
 /*
  * A dummy header file that is a dependency for all the object files.
  * Used to force a full recompilation of NSS in Mozilla's Tinderbox
  * depend builds.  See comments in rules.mk.
  */
 
 #error "Do not include this header file."
+
--- a/security/nss/gtests/ssl_gtest/ssl_agent_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_agent_unittest.cc
@@ -62,43 +62,39 @@ TEST_P(TlsAgentTest, EarlyFinished) {
 
 TEST_P(TlsAgentTest, EarlyCertificateVerify) {
   DataBuffer buffer;
   MakeTrivialHandshakeRecord(kTlsHandshakeCertificateVerify, 0, &buffer);
   ProcessMessage(buffer, TlsAgent::STATE_ERROR,
                  SSL_ERROR_RX_UNEXPECTED_CERT_VERIFY);
 }
 
-TEST_P(TlsAgentTestClient, CannedHello) {
+TEST_P(TlsAgentTestClient13, CannedHello) {
   DataBuffer buffer;
   EnsureInit();
-  agent_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_3,
-                          SSL_LIBRARY_VERSION_TLS_1_3);
   DataBuffer server_hello;
   MakeHandshakeMessage(kTlsHandshakeServerHello, kCannedTls13ServerHello,
                        sizeof(kCannedTls13ServerHello), &server_hello);
   MakeRecord(kTlsHandshakeType, SSL_LIBRARY_VERSION_TLS_1_3,
              server_hello.data(), server_hello.len(), &buffer);
   ProcessMessage(buffer, TlsAgent::STATE_CONNECTING);
 }
 
-TEST_P(TlsAgentTestClient, EncryptedExtensionsInClear) {
+TEST_P(TlsAgentTestClient13, EncryptedExtensionsInClear) {
   DataBuffer server_hello;
   MakeHandshakeMessage(kTlsHandshakeServerHello, kCannedTls13ServerHello,
                        sizeof(kCannedTls13ServerHello), &server_hello);
   DataBuffer encrypted_extensions;
   MakeHandshakeMessage(kTlsHandshakeEncryptedExtensions, nullptr, 0,
                        &encrypted_extensions, 1);
   server_hello.Append(encrypted_extensions);
   DataBuffer buffer;
   MakeRecord(kTlsHandshakeType, SSL_LIBRARY_VERSION_TLS_1_3,
              server_hello.data(), server_hello.len(), &buffer);
   EnsureInit();
-  agent_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_3,
-                          SSL_LIBRARY_VERSION_TLS_1_3);
   ProcessMessage(buffer, TlsAgent::STATE_ERROR,
                  SSL_ERROR_RX_UNEXPECTED_HANDSHAKE);
 }
 
 TEST_F(TlsAgentStreamTestClient, EncryptedExtensionsInClearTwoPieces) {
   DataBuffer server_hello;
   MakeHandshakeMessage(kTlsHandshakeServerHello, kCannedTls13ServerHello,
                        sizeof(kCannedTls13ServerHello), &server_hello);
@@ -196,15 +192,19 @@ TEST_F(TlsAgentStreamTestServer, Set0Rtt
              kCannedTls13ClientHello, sizeof(kCannedTls13ClientHello), &buffer);
   ProcessMessage(buffer, TlsAgent::STATE_CONNECTING);
   MakeRecord(kTlsApplicationDataType, SSL_LIBRARY_VERSION_TLS_1_3,
              reinterpret_cast<const uint8_t *>(k0RttData), strlen(k0RttData),
              &buffer);
   ProcessMessage(buffer, TlsAgent::STATE_ERROR, SSL_ERROR_BAD_MAC_READ);
 }
 
-INSTANTIATE_TEST_CASE_P(
-    AgentTests, TlsAgentTest,
-    ::testing::Combine(TlsAgentTestBase::kTlsRolesAll,
-                       TlsConnectTestBase::kTlsModesStream));
+INSTANTIATE_TEST_CASE_P(AgentTests, TlsAgentTest,
+                        ::testing::Combine(TlsAgentTestBase::kTlsRolesAll,
+                                           TlsConnectTestBase::kTlsModesStream,
+                                           TlsConnectTestBase::kTlsVAll));
 INSTANTIATE_TEST_CASE_P(ClientTests, TlsAgentTestClient,
-                        TlsConnectTestBase::kTlsModesAll);
+                        ::testing::Combine(TlsConnectTestBase::kTlsModesAll,
+                                           TlsConnectTestBase::kTlsVAll));
+INSTANTIATE_TEST_CASE_P(ClientTests13, TlsAgentTestClient13,
+                        ::testing::Combine(TlsConnectTestBase::kTlsModesAll,
+                                           TlsConnectTestBase::kTlsV13));
 }  // namespace nss_test
--- a/security/nss/gtests/ssl_gtest/ssl_hrr_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_hrr_unittest.cc
@@ -263,18 +263,16 @@ TEST_F(TlsConnectTest, Select12AfterHell
   EXPECT_EQ(SSL_ERROR_RX_MALFORMED_SERVER_HELLO, client_->error_code());
 }
 
 class HelloRetryRequestAgentTest : public TlsAgentTestClient {
  protected:
   void SetUp() override {
     TlsAgentTestClient::SetUp();
     EnsureInit();
-    agent_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_3,
-                            SSL_LIBRARY_VERSION_TLS_1_3);
     agent_->StartConnect();
   }
 
   void MakeCannedHrr(const uint8_t* body, size_t len, DataBuffer* hrr_record,
                      uint32_t seq_num = 0) const {
     DataBuffer hrr_data;
     hrr_data.Allocate(len + 4);
     size_t i = 0;
@@ -349,16 +347,17 @@ TEST_P(HelloRetryRequestAgentTest, Handl
   ProcessMessage(hrr, TlsAgent::STATE_CONNECTING);
   const size_t cookie_pos = 2 + 2;  // cookie_xtn, extension len
   DataBuffer cookie(canned_cookie_hrr + cookie_pos,
                     sizeof(canned_cookie_hrr) - cookie_pos);
   EXPECT_EQ(cookie, capture->extension());
 }
 
 INSTANTIATE_TEST_CASE_P(HelloRetryRequestAgentTests, HelloRetryRequestAgentTest,
-                        TlsConnectTestBase::kTlsModesAll);
+                        ::testing::Combine(TlsConnectTestBase::kTlsModesAll,
+                                           TlsConnectTestBase::kTlsV13));
 #ifndef NSS_DISABLE_TLS_1_3
 INSTANTIATE_TEST_CASE_P(HelloRetryRequestKeyExchangeTests, TlsKeyExchange13,
                         ::testing::Combine(TlsConnectTestBase::kTlsModesAll,
                                            TlsConnectTestBase::kTlsV13));
 #endif
 
 }  // namespace nss_test
--- a/security/nss/gtests/ssl_gtest/tls_agent.cc
+++ b/security/nss/gtests/ssl_gtest/tls_agent.cc
@@ -901,16 +901,19 @@ void TlsAgentTestBase::TearDown() {
   SSL_ClearSessionCache();
   SSL_ShutdownServerSessionIDCache();
 }
 
 void TlsAgentTestBase::Reset(const std::string& server_name) {
   agent_.reset(
       new TlsAgent(role_ == TlsAgent::CLIENT ? TlsAgent::kClient : server_name,
                    role_, mode_));
+  if (version_) {
+    agent_->SetVersionRange(version_, version_);
+  }
   agent_->adapter()->SetPeer(sink_adapter_);
   agent_->StartConnect();
 }
 
 void TlsAgentTestBase::EnsureInit() {
   if (!agent_) {
     Reset();
   }
--- a/security/nss/gtests/ssl_gtest/tls_agent.h
+++ b/security/nss/gtests/ssl_gtest/tls_agent.h
@@ -374,20 +374,21 @@ inline std::ostream& operator<<(std::ost
                                 const TlsAgent::State& state) {
   return stream << TlsAgent::state_str(state);
 }
 
 class TlsAgentTestBase : public ::testing::Test {
  public:
   static ::testing::internal::ParamGenerator<std::string> kTlsRolesAll;
 
-  TlsAgentTestBase(TlsAgent::Role role, Mode mode)
+  TlsAgentTestBase(TlsAgent::Role role, Mode mode, uint16_t version = 0)
       : agent_(nullptr),
         role_(role),
         mode_(mode),
+        version_(version),
         sink_adapter_(new DummyPrSocket("sink", mode)) {}
   virtual ~TlsAgentTestBase() {}
 
   void SetUp();
   void TearDown();
 
   static void MakeRecord(Mode mode, uint8_t type, uint16_t version,
                          const uint8_t* buf, size_t len, DataBuffer* out,
@@ -416,36 +417,42 @@ class TlsAgentTestBase : public ::testin
  protected:
   void EnsureInit();
   void ProcessMessage(const DataBuffer& buffer, TlsAgent::State expected_state,
                       int32_t error_code = 0);
 
   std::unique_ptr<TlsAgent> agent_;
   TlsAgent::Role role_;
   Mode mode_;
+  uint16_t version_;
   // This adapter is here just to accept packets from this agent.
   std::shared_ptr<DummyPrSocket> sink_adapter_;
 };
 
 class TlsAgentTest : public TlsAgentTestBase,
                      public ::testing::WithParamInterface<
-                         std::tuple<std::string, std::string>> {
+                         std::tuple<std::string, std::string, uint16_t>> {
  public:
   TlsAgentTest()
       : TlsAgentTestBase(ToRole(std::get<0>(GetParam())),
-                         ToMode(std::get<1>(GetParam()))) {}
+                         ToMode(std::get<1>(GetParam())),
+                         std::get<2>(GetParam())) {}
 };
 
-class TlsAgentTestClient : public TlsAgentTestBase,
-                           public ::testing::WithParamInterface<std::string> {
+class TlsAgentTestClient
+    : public TlsAgentTestBase,
+      public ::testing::WithParamInterface<std::tuple<std::string, uint16_t>> {
  public:
   TlsAgentTestClient()
-      : TlsAgentTestBase(TlsAgent::CLIENT, ToMode(GetParam())) {}
+      : TlsAgentTestBase(TlsAgent::CLIENT, ToMode(std::get<0>(GetParam())),
+                         std::get<1>(GetParam())) {}
 };
 
+class TlsAgentTestClient13 : public TlsAgentTestClient {};
+
 class TlsAgentStreamTestClient : public TlsAgentTestBase {
  public:
   TlsAgentStreamTestClient() : TlsAgentTestBase(TlsAgent::CLIENT, STREAM) {}
 };
 
 class TlsAgentStreamTestServer : public TlsAgentTestBase {
  public:
   TlsAgentStreamTestServer() : TlsAgentTestBase(TlsAgent::SERVER, STREAM) {}
--- a/security/nss/lib/pk11wrap/pk11akey.c
+++ b/security/nss/lib/pk11wrap/pk11akey.c
@@ -881,16 +881,20 @@ PK11_GetPrivateModulusLen(SECKEYPrivateK
 
     switch (key->keyType) {
         case rsaKey:
             crv = PK11_GetAttributes(NULL, slot, key->pkcs11ID, &theTemplate, 1);
             if (crv != CKR_OK) {
                 PORT_SetError(PK11_MapError(crv));
                 return -1;
             }
+            if (theTemplate.pValue == NULL) {
+                PORT_SetError(PK11_MapError(CKR_ATTRIBUTE_VALUE_INVALID));
+                return -1;
+            }
             length = theTemplate.ulValueLen;
             if (*(unsigned char *)theTemplate.pValue == 0) {
                 length--;
             }
             PORT_Free(theTemplate.pValue);
             return (int)length;
 
         case fortezzaKey:
--- a/security/nss/lib/ssl/ssl3con.c
+++ b/security/nss/lib/ssl/ssl3con.c
@@ -9789,27 +9789,25 @@ ssl3_HandleCertificateVerify(sslSocket *
     SSL3Hashes localHashes;
     SSL3Hashes *hashesForVerify = NULL;
 
     SSL_TRC(3, ("%d: SSL3[%d]: handle certificate_verify handshake",
                 SSL_GETPID(), ss->fd));
     PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
     PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
 
-    /* TLS 1.3 is handled by tls13_HandleCertificateVerify */
-    PORT_Assert(ss->ssl3.prSpec->version <= SSL_LIBRARY_VERSION_TLS_1_2);
-
-    isTLS = (PRBool)(ss->ssl3.prSpec->version > SSL_LIBRARY_VERSION_3_0);
-
     if (ss->ssl3.hs.ws != wait_cert_verify) {
         desc = unexpected_message;
         errCode = SSL_ERROR_RX_UNEXPECTED_CERT_VERIFY;
         goto alert_loser;
     }
 
+    /* TLS 1.3 is handled by tls13_HandleCertificateVerify */
+    PORT_Assert(ss->ssl3.prSpec->version <= SSL_LIBRARY_VERSION_TLS_1_2);
+
     if (!hashes) {
         PORT_Assert(0);
         desc = internal_error;
         errCode = SEC_ERROR_LIBRARY_FAILURE;
         goto alert_loser;
     }
 
     if (ss->ssl3.hs.hashType == handshake_hash_record) {
@@ -9847,16 +9845,18 @@ ssl3_HandleCertificateVerify(sslSocket *
         sigScheme = ssl_sig_none;
     }
 
     rv = ssl3_ConsumeHandshakeVariable(ss, &signed_hash, 2, &b, &length);
     if (rv != SECSuccess) {
         goto loser; /* malformed. */
     }
 
+    isTLS = (PRBool)(ss->ssl3.prSpec->version > SSL_LIBRARY_VERSION_3_0);
+
     /* XXX verify that the key & kea match */
     rv = ssl3_VerifySignedHashes(ss, sigScheme, hashesForVerify, &signed_hash);
     if (rv != SECSuccess) {
         errCode = PORT_GetError();
         desc = isTLS ? decrypt_error : handshake_failure;
         goto alert_loser;
     }
 
@@ -13342,18 +13342,16 @@ ssl3_DestroySSL3Info(sslSocket *ss)
     if (ss->ssl3.hs.exporterSecret)
         PK11_FreeSymKey(ss->ssl3.hs.exporterSecret);
 
     ss->ssl3.hs.zeroRttState = ssl_0rtt_none;
     /* Destroy TLS 1.3 buffered early data. */
     tls13_DestroyEarlyData(&ss->ssl3.hs.bufferedEarlyData);
 
     ss->ssl3.initialized = PR_FALSE;
-
-    SECITEM_FreeItem(&ss->xtnData.nextProto, PR_FALSE);
 }
 
 #define MAP_NULL(x) (((x) != 0) ? (x) : SEC_OID_NULL_CIPHER)
 
 SECStatus
 ssl3_ApplyNSSPolicy(void)
 {
     unsigned i;
--- a/security/nss/lib/ssl/sslsock.c
+++ b/security/nss/lib/ssl/sslsock.c
@@ -3699,28 +3699,28 @@ ssl_NewSocket(PRBool makeLocks, SSLProto
     for (i = 0; i < SSL_NAMED_GROUP_COUNT; ++i) {
         ss->namedGroupPreferences[i] = &ssl_named_groups[i];
     }
     ss->additionalShares = 0;
     PR_INIT_CLIST(&ss->ssl3.hs.remoteExtensions);
     PR_INIT_CLIST(&ss->ssl3.hs.lastMessageFlight);
     PR_INIT_CLIST(&ss->ssl3.hs.cipherSpecs);
     PR_INIT_CLIST(&ss->ssl3.hs.bufferedEarlyData);
+    ssl3_InitExtensionData(&ss->xtnData);
     if (makeLocks) {
         rv = ssl_MakeLocks(ss);
         if (rv != SECSuccess)
             goto loser;
     }
     rv = ssl_CreateSecurityInfo(ss);
     if (rv != SECSuccess)
         goto loser;
     rv = ssl3_InitGather(&ss->gs);
     if (rv != SECSuccess)
         goto loser;
-    ssl3_InitExtensionData(&ss->xtnData);
     return ss;
 
 loser:
     ssl_DestroySocketContents(ss);
     ssl_DestroyLocks(ss);
     PORT_Free(ss);
     return NULL;
 }
--- a/security/nss/lib/ssl/tls13con.c
+++ b/security/nss/lib/ssl/tls13con.c
@@ -2872,16 +2872,19 @@ tls13_DestroyKeyShareEntry(TLS13KeyShare
     PORT_ZFree(offer, sizeof(*offer));
 }
 
 void
 tls13_DestroyKeyShares(PRCList *list)
 {
     PRCList *cur_p;
 
+    /* The list must be initialized. */
+    PORT_Assert(PR_LIST_HEAD(list));
+
     while (!PR_CLIST_IS_EMPTY(list)) {
         cur_p = PR_LIST_TAIL(list);
         PR_REMOVE_LINK(cur_p);
         tls13_DestroyKeyShareEntry((TLS13KeyShareEntry *)cur_p);
     }
 }
 
 void
--- a/taskcluster/taskgraph/target_tasks.py
+++ b/taskcluster/taskgraph/target_tasks.py
@@ -207,17 +207,17 @@ def target_tasks_mozilla_beta(full_task_
     of builds and signing, but does not include beetmover or balrog jobs."""
     def filter(task):
         platform = task.attributes.get('build_platform')
         if platform in ('android-api-15', 'android-x86'):
             return True
         if platform in ('linux64-nightly', 'linux-nightly'):
             if task.kind not in [
                 'balrog', 'beetmover', 'beetmover-checksums', 'beetmover-l10n',
-                'checksums-signing',
+                'checksums-signing', 'nightly-l10n', 'nightly-l10n-signing'
             ]:
                 return task.attributes.get('nightly', False)
     return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]
 
 
 @_target_task('mozilla_release_tasks')
 def target_tasks_mozilla_release(full_task_graph, parameters):
     """Select the set of tasks required for a promotable beta or release build
--- a/testing/specialpowers/content/MockFilePicker.jsm
+++ b/testing/specialpowers/content/MockFilePicker.jsm
@@ -48,16 +48,17 @@ this.MockFilePicker = {
   filterXML: Ci.nsIFilePicker.filterXML,
   filterXUL: Ci.nsIFilePicker.filterXUL,
   filterApps: Ci.nsIFilePicker.filterApps,
   filterAllowURLs: Ci.nsIFilePicker.filterAllowURLs,
   filterAudio: Ci.nsIFilePicker.filterAudio,
   filterVideo: Ci.nsIFilePicker.filterVideo,
 
   window: null,
+  pendingPromises: [],
 
   init: function(window) {
     this.window = window;
 
     this.reset();
     this.factory = newFactory(window);
     if (!registrar.isCIDRegistered(newClassID)) {
       oldClassID = registrar.contractIDToCID(CONTRACT_ID);
@@ -68,59 +69,95 @@ this.MockFilePicker = {
   },
 
   reset: function() {
     this.appendFilterCallback = null;
     this.appendFiltersCallback = null;
     this.displayDirectory = null;
     this.filterIndex = 0;
     this.mode = null;
-    this.returnFiles = [];
+    this.returnData = [];
     this.returnValue = null;
     this.showCallback = null;
+    this.afterOpenCallback = null;
     this.shown = false;
     this.showing = false;
   },
 
   cleanup: function() {
     var previousFactory = this.factory;
     this.reset();
     this.factory = null;
     if (oldFactory) {
       registrar.unregisterFactory(newClassID, previousFactory);
       registrar.registerFactory(oldClassID, "", CONTRACT_ID, oldFactory);
     }
   },
 
+  internalFileData(obj) {
+    return {
+      nsIFile: "nsIFile" in obj ? obj.nsIFile : null,
+      domFile: "domFile" in obj ? obj.domFile : null,
+      domDirectory: "domDirectory" in obj ? obj.domDirectory : null,
+    };
+  },
+
   useAnyFile: function() {
     var file = FileUtils.getDir("TmpD", [], false);
     file.append("testfile");
     file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
-    this.returnFiles = [file];
+    let promise = this.window.File.createFromNsIFile(file)
+                  .then(domFile => domFile, () => null)
+                  // domFile can be null.
+                  .then(domFile => {
+                    this.returnData = [this.internalFileData({ nsIFile: file, domFile: domFile })];
+                  }).then(() => file);
+
+    this.pendingPromises = [promise];
+
+    // We return a promise in order to support some existing mochitests.
+    return promise;
   },
 
   useBlobFile: function() {
     var blob = new this.window.Blob([]);
     var file = new this.window.File([blob], 'helloworld.txt', { type: 'plain/text' });
-    this.returnFiles = [file];
+    this.returnData = [this.internalFileData({ domFile: file })];
+    this.pendingPromises = [];
   },
 
   useDirectory: function(aPath) {
     var directory = new this.window.Directory(aPath);
-    this.returnFiles = [directory];
+    this.returnData = [this.internalFileData({ domDirectory: directory })];
+    this.pendingPromises = [];
   },
 
-  isNsIFile: function(aFile) {
-    let ret = false;
-    try {
-      if (aFile.QueryInterface(Ci.nsIFile))
-        ret = true;
-    } catch(e) {}
+  setFiles(files) {
+    this.returnData = [];
+    this.pendingPromises = [];
+
+    for (let file of files) {
+      if (file instanceof this.window.File) {
+        this.returnData.push(this.internalFileData({ domFile: file }));
+      } else {
+        let promise = this.window.File.createFromNsIFile(file, { existenceCheck: false });
 
-    return ret;
+        promise.then(domFile => {
+          this.returnData.push(this.internalFileData({ nsIFile: file, domFile: domFile }));
+        });
+        this.pendingPromises.push(promise);
+      }
+    }
+  },
+
+  getNsIFile() {
+    if (this.returnData.length >= 1) {
+      return this.returnData[0].nsIFile;
+    }
+    return null;
   }
 };
 
 function MockFilePickerInstance(window) {
   this.window = window;
 };
 MockFilePickerInstance.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIFilePicker]),
@@ -138,98 +175,134 @@ MockFilePickerInstance.prototype = {
       MockFilePicker.appendFiltersCallback(this, aFilterMask);
   },
   defaultString: "",
   defaultExtension: "",
   parent: null,
   filterIndex: 0,
   displayDirectory: null,
   get file() {
-    if (MockFilePicker.returnFiles.length >= 1 &&
-        // window.File does not implement nsIFile
-        MockFilePicker.isNsIFile(MockFilePicker.returnFiles[0])) {
-      return MockFilePicker.returnFiles[0];
+    if (MockFilePicker.returnData.length >= 1) {
+      return MockFilePicker.returnData[0].nsIFile;
     }
 
     return null;
   },
 
   // We don't support directories here.
   get domFileOrDirectory()  {
-    if (MockFilePicker.returnFiles.length >= 1) {
-      // window.File does not implement nsIFile
-      if (!MockFilePicker.isNsIFile(MockFilePicker.returnFiles[0])) {
-        return MockFilePicker.returnFiles[0];
-      }
+    if (MockFilePicker.returnData.length < 1) {
+      return null;
+    }
 
-      let utils = this.parent.QueryInterface(Ci.nsIInterfaceRequestor)
-                             .getInterface(Ci.nsIDOMWindowUtils);
-      return utils.wrapDOMFile(MockFilePicker.returnFiles[0]);
+    if (MockFilePicker.returnData[0].domFile) {
+      return MockFilePicker.returnData[0].domFile;
     }
+
+    if (MockFilePicker.returnData[0].domDirectory) {
+      return MockFilePicker.returnData[0].domDirectory;
+    }
+
     return null;
   },
   get fileURL() {
-    if (MockFilePicker.returnFiles.length >= 1 &&
-        // window.File does not implement nsIFile
-        MockFilePicker.isNsIFile(MockFilePicker.returnFiles[0])) {
-      return Services.io.newFileURI(MockFilePicker.returnFiles[0]);
+    if (MockFilePicker.returnData.length >= 1 &&
+        MockFilePicker.returnData[0].nsIFile) {
+      return Services.io.newFileURI(MockFilePicker.returnData[0].nsIFile);
     }
 
     return null;
   },
   get files() {
     return {
       index: 0,
       QueryInterface: XPCOMUtils.generateQI([Ci.nsISimpleEnumerator]),
       hasMoreElements: function() {
-        return this.index < MockFilePicker.returnFiles.length;
+        return this.index < MockFilePicker.returnData.length;
       },
       getNext: function() {
-        // window.File does not implement nsIFile
-        if (!MockFilePicker.isNsIFile(MockFilePicker.returnFiles[this.index])) {
+        if (!MockFilePicker.returnData[this.index].nsIFile) {
           return null;
         }
-        return MockFilePicker.returnFiles[this.index++];
+        return MockFilePicker.returnData[this.index++].nsIFile;
       }
     };
   },
   get domFileOrDirectoryEnumerator()  {
     let utils = this.parent.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindowUtils);
     return {
       index: 0,
       QueryInterface: XPCOMUtils.generateQI([Ci.nsISimpleEnumerator]),
       hasMoreElements: function() {
-        return this.index < MockFilePicker.returnFiles.length;
+        return this.index < MockFilePicker.returnData.length;
       },
       getNext: function() {
         // window.File does not implement nsIFile
-        if (!MockFilePicker.isNsIFile(MockFilePicker.returnFiles[this.index])) {
-          return MockFilePicker.returnFiles[this.index++];
+        if (MockFilePicker.returnData[this.index].domFile) {
+          return MockFilePicker.returnData[this.index++].domFile;
         }
-        return utils.wrapDOMFile(MockFilePicker.returnFiles[this.index++]);
+
+        if (MockFilePicker.returnData[this.index].domDirectory) {
+          return MockFilePicker.returnData[this.index++].domDirectory;
+        }
+
+        return null;
       }
     };
   },
   show: function() {
-    MockFilePicker.displayDirectory = this.displayDirectory;
-    MockFilePicker.shown = true;
-    if (typeof MockFilePicker.showCallback == "function") {
-      var returnValue = MockFilePicker.showCallback(this);
-      if (typeof returnValue != "undefined")
-        return returnValue;
-    }
-    return MockFilePicker.returnValue;
+    throw "This is not implemented";
   },
   open: function(aFilePickerShownCallback) {
     MockFilePicker.showing = true;
-    this.window.setTimeout(function() {
-      let result = Components.interfaces.nsIFilePicker.returnCancel;
-      try {
-        result = this.show();
-      } catch(ex) {
-      }
-      if (aFilePickerShownCallback) {
-        aFilePickerShownCallback.done(result);
-      }
-    }.bind(this), 0);
+    this.window.setTimeout(() => {
+      // Maybe all the pending promises are already resolved, but we want to be sure.
+      Promise.all(MockFilePicker.pendingPromises).then(() => {
+        return Ci.nsIFilePicker.returnOK;
+      }, () => {
+        return Ci.nsIFilePicker.returnCancel;
+      }).then(result => {
+        // Nothing else has to be done.
+        MockFilePicker.pendingPromises = [];
+
+        if (result == Ci.nsIFilePicker.returnCancel) {
+          return result;
+        }
+
+        MockFilePicker.displayDirectory = this.displayDirectory;
+        MockFilePicker.shown = true;
+        if (typeof MockFilePicker.showCallback == "function") {
+          try {
+            var returnValue = MockFilePicker.showCallback(this);
+            if (typeof returnValue != "undefined") {
+              return returnValue;
+            }
+          } catch(ex) {
+            return Ci.nsIFilePicker.returnCancel;
+          }
+        }
+
+        return MockFilePicker.returnValue;
+      }).then(result => {
+        // Some additional result file can be set by the callback. Let's
+        // resolve the pending promises again.
+        return Promise.all(MockFilePicker.pendingPromises).then(() => {
+          return result;
+        }, () => {
+          return Ci.nsIFilePicker.returnCancel;
+        });
+      }).then(result => {
+        MockFilePicker.pendingPromises = [];
+
+        if (aFilePickerShownCallback) {
+          aFilePickerShownCallback.done(result);
+        }
+
+        if (typeof MockFilePicker.afterOpenCallback == "function") {
+          this.window.setTimeout(() => {
+            MockFilePicker.afterOpenCallback(this);
+          }, 0);
+        }
+      });
+    });
   }
 };
deleted file mode 100644
--- a/testing/web-platform/mozilla/meta/wasm/conversions.wast.js.html.ini
+++ /dev/null
@@ -1,9 +0,0 @@
-[conversions.wast.js.html]
-  disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1336139
-  type: testharness
-  [#499 A wast test that runs without any special assertion.]
-    expected: FAIL
-
-  [#505 A wast test that runs without any special assertion.]
-    expected: FAIL
-
--- a/toolkit/components/apppicker/content/appPicker.js
+++ b/toolkit/components/apppicker/content/appPicker.js
@@ -188,23 +188,25 @@ AppPicker.prototype =
       } else if (AppConstants.platform == "macosx") {
         startLocation = "LocApp"; // Local Applications
       } else {
         startLocation = "Home";
       }
       fp.displayDirectory =
         fileLoc.get(startLocation, Components.interfaces.nsILocalFile);
 
-      if (fp.show() == nsIFilePicker.returnOK && fp.file) {
-          var localHandlerApp =
-            Components.classes["@mozilla.org/uriloader/local-handler-app;1"].
-            createInstance(Components.interfaces.nsILocalHandlerApp);
-          localHandlerApp.executable = fp.file;
+      fp.open(rv => {
+          if (rv == nsIFilePicker.returnOK && fp.file) {
+              var localHandlerApp =
+                Components.classes["@mozilla.org/uriloader/local-handler-app;1"].
+                createInstance(Components.interfaces.nsILocalHandlerApp);
+              localHandlerApp.executable = fp.file;
 
-          this._incomingParams.handlerApp = localHandlerApp;
-          window.close();
-      }
+              this._incomingParams.handlerApp = localHandlerApp;
+              window.close();
+          }
+      });
       return true;
     }
 }
 
 // Global object
 var g_dialog = new AppPicker();
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_saveAs.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_saveAs.html
@@ -14,42 +14,43 @@
 
 add_task(function* test_downloads_saveAs() {
   function background() {
     const url = URL.createObjectURL(new Blob(["file content"]));
     browser.test.onMessage.addListener(async () => {
       try {
         let id = await browser.downloads.download({url, saveAs: true});
         browser.downloads.onChanged.addListener(delta => {
-          if (delta.state.current === "complete") {
+          if (delta.id == id && delta.state.current === "complete") {
             browser.test.sendMessage("done", {ok: true, id});
           }
         });
       } catch ({message}) {
         browser.test.sendMessage("done", {ok: false, message});
       }
     });
     browser.test.sendMessage("ready");
   }
 
   const {MockFilePicker} = SpecialPowers;
   const manifest = {background, manifest: {permissions: ["downloads"]}};
   const extension = ExtensionTestUtils.loadExtension(manifest);
 
   MockFilePicker.init(window);
-  MockFilePicker.useAnyFile();
-  const [file] = MockFilePicker.returnFiles;
+  const file = yield MockFilePicker.useAnyFile();
 
   yield extension.startup();
   yield extension.awaitMessage("ready");
 
   extension.sendMessage("download");
   let result = yield extension.awaitMessage("done");
 
   ok(result.ok, "downloads.download() works with saveAs");
+
+  ok(file.exists(), "the file exists.");
   is(file.fileSize, 12, "downloaded file is the correct size");
   file.remove(false);
 
   // Test the user canceling the save dialog.
   MockFilePicker.returnValue = MockFilePicker.returnCancel;
 
   extension.sendMessage("download");
   result = yield extension.awaitMessage("done");
--- a/toolkit/components/filepicker/nsFilePicker.js
+++ b/toolkit/components/filepicker/nsFilePicker.js
@@ -99,45 +99,16 @@ nsFilePicker.prototype = {
     return enumerator ? enumerator.mFiles[0] : null;
   },
 
   /* readonly attribute nsISimpleEnumerator domFileOrDirectoryEnumerator; */
   get domFileOrDirectoryEnumerator() {
     if (!this.mFilesEnumerator) {
       return null;
     }
-
-    if (!this.mDOMFilesEnumerator) {
-      this.mDOMFilesEnumerator = {
-        QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISimpleEnumerator]),
-
-        mFiles: [],
-        mIndex: 0,
-
-        hasMoreElements() {
-          return (this.mIndex < this.mFiles.length);
-        },
-
-        getNext() {
-          if (this.mIndex >= this.mFiles.length) {
-            throw Components.results.NS_ERROR_FAILURE;
-          }
-          return this.mFiles[this.mIndex++];
-        }
-      };
-
-      var utils = this.mParentWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-                                    .getInterface(Components.interfaces.nsIDOMWindowUtils);
-
-      for (var i = 0; i < this.mFilesEnumerator.mFiles.length; ++i) {
-        var file = utils.wrapDOMFile(this.mFilesEnumerator.mFiles[i]);
-        this.mDOMFilesEnumerator.mFiles.push(file);
-      }
-    }
-
     return this.mDOMFilesEnumerator;
   },
 
   /* readonly attribute nsIURI fileURL; */
   get fileURL() {
     if (this.mFileURL)
       return this.mFileURL;
 
@@ -225,26 +196,64 @@ nsFilePicker.prototype = {
   appendFilter(title, extensions) {
     this.mFilterTitles.push(title);
     this.mFilters.push(extensions);
   },
 
   open(aFilePickerShownCallback) {
     var tm = Components.classes["@mozilla.org/thread-manager;1"]
                        .getService(Components.interfaces.nsIThreadManager);
-    tm.mainThread.dispatch(function() {
+    tm.mainThread.dispatch(() => {
       let result = Components.interfaces.nsIFilePicker.returnCancel;
       try {
         result = this.show();
       } catch (ex) {
       }
-      if (aFilePickerShownCallback) {
-        aFilePickerShownCallback.done(result);
+
+      let promises = [];
+
+      // Let's create the DOMFileEnumerator right now because it requires some
+      // async operation.
+      if (this.mFilesEnumerator) {
+        this.mDOMFilesEnumerator = {
+          QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISimpleEnumerator]),
+
+          mFiles: [],
+          mIndex: 0,
+
+          hasMoreElements() {
+            return (this.mIndex < this.mFiles.length);
+          },
+
+          getNext() {
+            if (this.mIndex >= this.mFiles.length) {
+              throw Components.results.NS_ERROR_FAILURE;
+            }
+            return this.mFiles[this.mIndex++];
+          }
+        };
+
+        for (let i = 0; i < this.mFilesEnumerator.mFiles.length; ++i) {
+          if (this.mFilesEnumerator.mFiles[i].exists()) {
+            let promise =
+              this.mParentWindow.File.createFromNsIFile(
+                this.mFilesEnumerator.mFiles[i]).then(file => {
+                  this.mDOMFilesEnumerator.mFiles.push(file);
+                });
+            promises.push(promise);
+          }
+        }
       }
-    }.bind(this), Components.interfaces.nsIThread.DISPATCH_NORMAL);
+
+      Promise.all(promises).then(() => {
+        if (aFilePickerShownCallback) {
+          aFilePickerShownCallback.done(result);
+        }
+      });
+    }, Components.interfaces.nsIThread.DISPATCH_NORMAL);
   },
 
   show() {
     var o = {};
     o.title = this.mTitle;
     o.mode = this.mMode;
     o.displayDirectory = this.mDisplayDirectory;
     o.defaultString = this.mDefaultString;
--- a/toolkit/components/printing/content/printdialog.js
+++ b/toolkit/components/printing/content/printdialog.js
@@ -297,84 +297,97 @@ function onLoad() {
   // default return value is "cancel"
   paramBlock.SetInt(0, 0);
 
   loadDialog();
 }
 
 // ---------------------------------------------------
 function onAccept() {
-  if (gPrintSettings != null) {
+  let promise;
+
+  if (gPrintSettings == null) {
+    promise = Promise.resolve();
+  } else {
     var print_howToEnableUI = gPrintSetInterface.kFrameEnableNone;
 
     // save these out so they can be picked up by the device spec
     gPrintSettings.printerName = dialog.printerList.value;
     print_howToEnableUI        = gPrintSettings.howToEnableFrameUI;
     gPrintSettings.printToFile = dialog.fileCheck.checked;
 
-    if (gPrintSettings.printToFile && !chooseFile())
-      return false;
+    if (gPrintSettings.printToFile) {
+      promise = chooseFile();
+    } else {
+      promise = Promise.resolve();
+    }
 
-    if (dialog.allpagesRadio.selected) {
-      gPrintSettings.printRange = gPrintSetInterface.kRangeAllPages;
-    } else if (dialog.rangeRadio.selected) {
-      gPrintSettings.printRange = gPrintSetInterface.kRangeSpecifiedPageRange;
-    } else if (dialog.selectionRadio.selected) {
-      gPrintSettings.printRange = gPrintSetInterface.kRangeSelection;
-    }
-    gPrintSettings.startPageRange = dialog.frompageInput.value;
-    gPrintSettings.endPageRange   = dialog.topageInput.value;
-    gPrintSettings.numCopies      = dialog.numCopiesInput.value;
+    promise = promise.then(() => {
+      if (dialog.allpagesRadio.selected) {
+        gPrintSettings.printRange = gPrintSetInterface.kRangeAllPages;
+      } else if (dialog.rangeRadio.selected) {
+        gPrintSettings.printRange = gPrintSetInterface.kRangeSpecifiedPageRange;
+      } else if (dialog.selectionRadio.selected) {
+        gPrintSettings.printRange = gPrintSetInterface.kRangeSelection;
+      }
+      gPrintSettings.startPageRange = dialog.frompageInput.value;
+      gPrintSettings.endPageRange   = dialog.topageInput.value;
+      gPrintSettings.numCopies      = dialog.numCopiesInput.value;
 
-    var frametype = gPrintSetInterface.kNoFrames;
-    if (print_howToEnableUI != gPrintSetInterface.kFrameEnableNone) {
-      if (dialog.aslaidoutRadio.selected) {
-        frametype = gPrintSetInterface.kFramesAsIs;
-      } else if (dialog.selectedframeRadio.selected) {
-        frametype = gPrintSetInterface.kSelectedFrame;
-      } else if (dialog.eachframesepRadio.selected) {
-        frametype = gPrintSetInterface.kEachFrameSep;
-      } else {
-        frametype = gPrintSetInterface.kSelectedFrame;
+      var frametype = gPrintSetInterface.kNoFrames;
+      if (print_howToEnableUI != gPrintSetInterface.kFrameEnableNone) {
+        if (dialog.aslaidoutRadio.selected) {
+          frametype = gPrintSetInterface.kFramesAsIs;
+        } else if (dialog.selectedframeRadio.selected) {
+          frametype = gPrintSetInterface.kSelectedFrame;
+        } else if (dialog.eachframesepRadio.selected) {
+          frametype = gPrintSetInterface.kEachFrameSep;
+        } else {
+          frametype = gPrintSetInterface.kSelectedFrame;
+        }
       }
-    }
-    gPrintSettings.printFrameType = frametype;
-    if (doDebug) {
-      dump("onAccept*********************************************\n");
-      dump("frametype      " + frametype + "\n");
-      dump("numCopies      " + gPrintSettings.numCopies + "\n");
-      dump("printRange     " + gPrintSettings.printRange + "\n");
-      dump("printerName    " + gPrintSettings.printerName + "\n");
-      dump("startPageRange " + gPrintSettings.startPageRange + "\n");
-      dump("endPageRange   " + gPrintSettings.endPageRange + "\n");
-      dump("printToFile    " + gPrintSettings.printToFile + "\n");
-    }
+      gPrintSettings.printFrameType = frametype;
+      if (doDebug) {
+        dump("onAccept*********************************************\n");
+        dump("frametype      " + frametype + "\n");
+        dump("numCopies      " + gPrintSettings.numCopies + "\n");
+        dump("printRange     " + gPrintSettings.printRange + "\n");
+        dump("printerName    " + gPrintSettings.printerName + "\n");
+        dump("startPageRange " + gPrintSettings.startPageRange + "\n");
+        dump("endPageRange   " + gPrintSettings.endPageRange + "\n");
+        dump("printToFile    " + gPrintSettings.printToFile + "\n");
+      }
+    });
   }
 
-  var saveToPrefs = false;
+  promise.then(() => {
+    var saveToPrefs = false;
 
-  saveToPrefs = gPrefs.getBoolPref("print.save_print_settings");
+    saveToPrefs = gPrefs.getBoolPref("print.save_print_settings");
 
-  if (saveToPrefs && printService != null) {
-    var flags = gPrintSetInterface.kInitSavePaperSize |
-                gPrintSetInterface.kInitSaveEdges |
-                gPrintSetInterface.kInitSaveInColor |
-                gPrintSetInterface.kInitSaveShrinkToFit |
-                gPrintSetInterface.kInitSaveScaling;
-    printService.savePrintSettingsToPrefs(gPrintSettings, true, flags);
-  }
+    if (saveToPrefs && printService != null) {
+      var flags = gPrintSetInterface.kInitSavePaperSize |
+                  gPrintSetInterface.kInitSaveEdges |
+                  gPrintSetInterface.kInitSaveInColor |
+                  gPrintSetInterface.kInitSaveShrinkToFit |
+                  gPrintSetInterface.kInitSaveScaling;
+      printService.savePrintSettingsToPrefs(gPrintSettings, true, flags);
+    }
 
-  // set return value to "print"
-  if (paramBlock) {
-    paramBlock.SetInt(0, 1);
-  } else {
-    dump("*** FATAL ERROR: No paramBlock\n");
-  }
+    // set return value to "print"
+    if (paramBlock) {
+      paramBlock.SetInt(0, 1);
+    } else {
+      dump("*** FATAL ERROR: No paramBlock\n");
+    }
 
-  return true;
+    window.close();
+  });
+
+  return false;
 }
 
 // ---------------------------------------------------
 function onCancel() {
   // set return value to "cancel"
   if (paramBlock) {
     paramBlock.SetInt(0, 0);
   } else {
@@ -382,24 +395,22 @@ function onCancel() {
   }
 
   return true;
 }
 
 // ---------------------------------------------------
 const nsIFilePicker = Components.interfaces.nsIFilePicker;
 function chooseFile() {
-  try {
+  return new Promise(resolve => {
     var fp = Components.classes["@mozilla.org/filepicker;1"]
                        .createInstance(nsIFilePicker);
     fp.init(window, dialog.fpDialog.getAttribute("label"), nsIFilePicker.modeSave);
     fp.appendFilters(nsIFilePicker.filterAll);
-    if (fp.show() != Components.interfaces.nsIFilePicker.returnCancel &&
-        fp.file && fp.file.path) {
-      gPrintSettings.toFileName = fp.file.path;
-      return true;
-    }
-  } catch (ex) {
-    dump(ex);
-  }
-
-  return false;
+    fp.open(rv => {
+      if (rv != Components.interfaces.nsIFilePicker.returnCancel &&
+          fp.file && fp.file.path) {
+        gPrintSettings.toFileName = fp.file.path;
+        resolve(null);
+      }
+    });
+  });
 }
--- a/toolkit/components/tooltiptext/tests/browser_input_file_tooltips.js
+++ b/toolkit/components/tooltiptext/tests/browser_input_file_tooltips.js
@@ -58,32 +58,31 @@ function* do_test(test) {
   });
 
   if (test.value) {
     info("Creating mock filepicker to select files");
     let MockFilePicker = SpecialPowers.MockFilePicker;
     MockFilePicker.init(window);
     MockFilePicker.returnValue = MockFilePicker.returnOK;
     MockFilePicker.displayDirectory = FileUtils.getDir("TmpD", [], false);
-    MockFilePicker.returnFiles = [tempFile];
+    MockFilePicker.setFiles([tempFile]);
+    MockFilePicker.afterOpenCallback = MockFilePicker.cleanup;
 
     try {
       // Open the File Picker dialog (MockFilePicker) to select
       // the files for the test.
       yield BrowserTestUtils.synthesizeMouseAtCenter("#test_input", {}, tab.linkedBrowser);
       info("Waiting for the input to have the requisite files");
       yield ContentTask.spawn(tab.linkedBrowser, {}, function*() {
         let input = content.document.querySelector("#test_input");
         yield ContentTaskUtils.waitForCondition(() => input.files.length,
           "The input should have at least one file selected");
         info(`The input has ${input.files.length} file(s) selected.`);
       });
-    } finally {
-      MockFilePicker.cleanup();
-    }
+    } catch (e) {}
   } else {
     info("No real file selection required.");
   }
 
   let awaitTooltipOpen = new Promise(resolve => {
     let tooltipId = Services.appinfo.browserTabsRemoteAutostart ?
                       "remoteBrowserTooltip" :
                       "aHTMLTooltip";
--- a/toolkit/content/tests/browser/browser_save_resend_postdata.js
+++ b/toolkit/content/tests/browser/browser_save_resend_postdata.js
@@ -48,17 +48,17 @@ function test() {
 
   function handleInnerSubmit() {
     gBrowser.removeEventListener("DOMContentLoaded", handleInnerSubmit);
 
     // Create the folder the page will be saved into.
     var destDir = createTemporarySaveDirectory();
     var file = destDir.clone();
     file.append("no_default_file_name");
-    MockFilePicker.returnFiles = [file];
+    MockFilePicker.setFiles([file]);
     MockFilePicker.showCallback = function(fp) {
       MockFilePicker.filterIndex = 1; // kSaveAsType_URL
     };
 
     mockTransferCallback = onTransferComplete;
     mockTransferRegisterer.register();
 
     registerCleanupFunction(function() {
@@ -75,17 +75,17 @@ function test() {
                  docToSave.referrer ? makeURI(docToSave.referrer) : null,
                  docToSave, false, null);
   }
 
   function onTransferComplete(downloadSuccess) {
     ok(downloadSuccess, "The inner frame should have been downloaded successfully");
 
     // Read the entire saved file.
-    var file = MockFilePicker.returnFiles[0];
+    var file = MockFilePicker.getNsIFile();
     var fileContents = readShortFile(file);
 
     // Check if outer POST data is found (bug 471962).
     is(fileContents.indexOf("inputfield=outer"), -1,
        "The saved inner frame does not contain outer POST data");
 
     // Check if inner POST data is found (bug 485196).
     isnot(fileContents.indexOf("inputfield=inner"), -1,
--- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
+++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
@@ -311,63 +311,65 @@ nsUnknownContentTypeDialog.prototype = {
       // return a valid directory path, so we can safely default to it.
       let preferredDir = yield Downloads.getPreferredDownloadsDirectory();
       picker.displayDirectory = new FileUtils.File(preferredDir);
 
       gDownloadLastDir.getFileAsync(aLauncher.source, function LastDirCallback(lastDir) {
         if (lastDir && isUsableDirectory(lastDir))
           picker.displayDirectory = lastDir;
 
-        if (picker.show() == nsIFilePicker.returnCancel) {
-          // null result means user cancelled.
-          aLauncher.saveDestinationAvailable(null);
-          return;
-        }
-
-        // Be sure to save the directory the user chose through the Save As...
-        // dialog  as the new browser.download.dir since the old one
-        // didn't exist.
-        result = picker.file;
-
-        if (result) {
-          try {
-            // Remove the file so that it's not there when we ensure non-existence later;
-            // this is safe because for the file to exist, the user would have had to
-            // confirm that he wanted the file overwritten.
-            // Only remove file if final name exists
-            if (result.exists() && this.getFinalLeafName(result.leafName) == result.leafName)
-              result.remove(false);
-          }
-          catch (ex) {
-            // As it turns out, the failure to remove the file, for example due to
-            // permission error, will be handled below eventually somehow.
+        picker.open(returnValue => {
+          if (returnValue == nsIFilePicker.returnCancel) {
+            // null result means user cancelled.
+            aLauncher.saveDestinationAvailable(null);
+            return;
           }
 
-          var newDir = result.parent.QueryInterface(Components.interfaces.nsILocalFile);
-
-          // Do not store the last save directory as a pref inside the private browsing mode
-          gDownloadLastDir.setFile(aLauncher.source, newDir);
+          // Be sure to save the directory the user chose through the Save As...
+          // dialog  as the new browser.download.dir since the old one
+          // didn't exist.
+          result = picker.file;
 
-          try {
-            result = this.validateLeafName(newDir, result.leafName, null);
-          }
-          catch (ex) {
-            // When the chosen download directory is write-protected,
-            // display an informative error message.
-            // In all cases, download will be stopped.
-
-            if (ex.result == Components.results.NS_ERROR_FILE_ACCESS_DENIED) {
-              this.displayBadPermissionAlert();
-              aLauncher.saveDestinationAvailable(null);
-              return;
+          if (result) {
+            try {
+              // Remove the file so that it's not there when we ensure non-existence later;
+              // this is safe because for the file to exist, the user would have had to
+              // confirm that he wanted the file overwritten.
+              // Only remove file if final name exists
+              if (result.exists() && this.getFinalLeafName(result.leafName) == result.leafName)
+                result.remove(false);
+            }
+            catch (ex) {
+              // As it turns out, the failure to remove the file, for example due to
+              // permission error, will be handled below eventually somehow.
             }
 
+            var newDir = result.parent.QueryInterface(Components.interfaces.nsILocalFile);
+
+            // Do not store the last save directory as a pref inside the private browsing mode
+            gDownloadLastDir.setFile(aLauncher.source, newDir);
+
+            try {
+              result = this.validateLeafName(newDir, result.leafName, null);
+            }
+            catch (ex) {
+              // When the chosen download directory is write-protected,
+              // display an informative error message.
+              // In all cases, download will be stopped.
+
+              if (ex.result == Components.results.NS_ERROR_FILE_ACCESS_DENIED) {
+                this.displayBadPermissionAlert();
+                aLauncher.saveDestinationAvailable(null);
+                return;
+              }
+
+            }
           }
-        }
-        aLauncher.saveDestinationAvailable(result);
+          aLauncher.saveDestinationAvailable(result);
+        });
       }.bind(this));
     }.bind(this)).then(null, Components.utils.reportError);
   },
 
   getFinalLeafName: function (aLeafName, aFileExt)
   {
     // Remove any leading periods, since we don't want to save hidden files
     // automatically.
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -1408,27 +1408,29 @@ var gViewController = {
                 gStrings.ext.GetStringFromName("installFromFile.dialogTitle"),
                 nsIFilePicker.modeOpenMultiple);
         try {
           fp.appendFilter(gStrings.ext.GetStringFromName("installFromFile.filterName"),
                           "*.xpi;*.jar;*.zip");
           fp.appendFilters(nsIFilePicker.filterAll);
         } catch (e) { }
 
-        if (fp.show() != nsIFilePicker.returnOK)
-          return;
-
-        let browser = getBrowserElement();
-        let files = fp.files;
-        while (files.hasMoreElements()) {
-          let file = files.getNext();
-          AddonManager.getInstallForFile(file, install => {
-            AddonManager.installAddonFromAOM(browser, document.documentURI, install);
-          });
-        }
+        fp.open(result => {
+          if (result != nsIFilePicker.returnOK)
+            return;
+
+          let browser = getBrowserElement();
+          let files = fp.files;
+          while (files.hasMoreElements()) {
+            let file = files.getNext();
+            AddonManager.getInstallForFile(file, install => {
+              AddonManager.installAddonFromAOM(browser, document.documentURI, install);
+            });
+          }
+        });
       }
     },
 
     cmd_debugAddons: {
       isEnabled() {
         return true;
       },
       doCommand() {
--- a/toolkit/mozapps/extensions/content/setting.xml
+++ b/toolkit/mozapps/extensions/content/setting.xml
@@ -369,20 +369,22 @@
               let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
               file.initWithPath(this.value);
               filePicker.displayDirectory = this.type == "file" ? file.parent : file;
               if (this.type == "file") {
                 filePicker.defaultString = file.leafName;
               }
             } catch (e) {}
           }
-          if (filePicker.show() != Ci.nsIFilePicker.returnCancel) {
-            this.value = filePicker.file.path;
-            this.inputChanged();
-          }
+          filePicker.open(rv => {
+            if (rv != Ci.nsIFilePicker.returnCancel && filePicker.file) {
+              this.value = filePicker.file.path;
+              this.inputChanged();
+            }
+          });
         ]]>
         </body>
       </method>
 
       <method name="valueFromPreference">
         <body>
         <![CDATA[
           this.value = Preferences.get(this.pref, "");
--- a/toolkit/mozapps/extensions/test/browser/browser_bug567127.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug567127.js
@@ -86,17 +86,17 @@ function checkInstallConfirmation(...url
 
 add_task(function* test_install_from_file() {
   gManagerWindow = yield open_manager("addons://list/extension");
 
   var filePaths = [
                    get_addon_file_url("browser_bug567127_1.xpi"),
                    get_addon_file_url("browser_bug567127_2.xpi")
                   ];
-  MockFilePicker.returnFiles = filePaths.map(aPath => aPath.file);
+  MockFilePicker.setFiles(filePaths.map(aPath => aPath.file));
 
   // Set handler that executes the core test after the window opens,
   // and resolves the promise when the window closes
   let pInstallURIClosed = checkInstallConfirmation(...filePaths.map(path => path.spec));
 
   gManagerWindow.gViewController.doCommand("cmd_installFromFile");
 
   yield pInstallURIClosed;
--- a/toolkit/mozapps/extensions/test/browser/browser_inlinesettings.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_inlinesettings.js
@@ -272,74 +272,94 @@ add_test(function() {
     input.focus();
     EventUtils.synthesizeKey("VK_RIGHT", {}, gManagerWindow);
     EventUtils.synthesizeKey("VK_RIGHT", {}, gManagerWindow);
     EventUtils.synthesizeKey("VK_RETURN", {}, gManagerWindow);
     input.hidePopup();
     is(input.color, "#FF9900", "Color picker should have updated value");
     is(Services.prefs.getCharPref("extensions.inlinesettings1.color"), "#FF9900", "Color pref should have been updated");
 
-    try {
-      ok(!settings[6].hasAttribute("first-row"), "Not the first row");
-      var button = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "button");
-      input = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "input");
-      is(input.value, "", "Label value should be empty");
-      is(input.tooltipText, "", "Label tooltip should be empty");
+    ok(!settings[6].hasAttribute("first-row"), "Not the first row");
+    var button = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "button");
+    input = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "input");
+    is(input.value, "", "Label value should be empty");
+    is(input.tooltipText, "", "Label tooltip should be empty");
+
+    var testFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
+    testFile.append("\u2622");
+    var curProcD = Services.dirsvc.get("CurProcD", Ci.nsIFile);
 
-      var testFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
-      testFile.append("\u2622");
-      var curProcD = Services.dirsvc.get("CurProcD", Ci.nsIFile);
+    MockFilePicker.setFiles([testFile]);
+    MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
 
-      MockFilePicker.returnFiles = [testFile];
-      MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
+    let promise = new Promise(resolve => {
+      MockFilePicker.afterOpenCallback = resolve;
       EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+    });
+
+    promise.then(() => {
       is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file");
       is(input.value, testFile.path, "Label value should match file chosen");
       is(input.tooltipText, testFile.path, "Label tooltip should match file chosen");
       is(Preferences.get("extensions.inlinesettings1.file", "wrong"), testFile.path, "File pref should match file chosen");
 
-      MockFilePicker.returnFiles = [curProcD];
+      MockFilePicker.setFiles([curProcD]);
       MockFilePicker.returnValue = Ci.nsIFilePicker.returnCancel;
-      EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+
+      return new Promise(resolve => {
+        MockFilePicker.afterOpenCallback = resolve;
+        EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+      });
+    }).then(() => {
       is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file");
       is(input.value, testFile.path, "Label value should not have changed");
       is(input.tooltipText, testFile.path, "Label tooltip should not have changed");
       is(Preferences.get("extensions.inlinesettings1.file", "wrong"), testFile.path, "File pref should not have changed");
 
       ok(!settings[7].hasAttribute("first-row"), "Not the first row");
       button = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "button");
       input = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "input");
       is(input.value, "", "Label value should be empty");
       is(input.tooltipText, "", "Label tooltip should be empty");
 
-      MockFilePicker.returnFiles = [testFile];
+      MockFilePicker.setFiles([testFile]);
       MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
-      EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+
+      return new Promise(resolve => {
+        MockFilePicker.afterOpenCallback = resolve;
+        EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+      });
+    }).then(() => {
       is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory");
       is(input.value, testFile.path, "Label value should match file chosen");
       is(input.tooltipText, testFile.path, "Label tooltip should match file chosen");
       is(Preferences.get("extensions.inlinesettings1.directory", "wrong"), testFile.path, "Directory pref should match file chosen");
 
-      MockFilePicker.returnFiles = [curProcD];
+      MockFilePicker.setFiles([curProcD]);
       MockFilePicker.returnValue = Ci.nsIFilePicker.returnCancel;
-      EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+
+      return new Promise(resolve => {
+        MockFilePicker.afterOpenCallback = resolve;
+        EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+      });
+    }).then(() => {
       is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory");
       is(input.value, testFile.path, "Label value should not have changed");
       is(input.tooltipText, testFile.path, "Label tooltip should not have changed");
       is(Preferences.get("extensions.inlinesettings1.directory", "wrong"), testFile.path, "Directory pref should not have changed");
 
       var unsizedInput = gManagerWindow.document.getAnonymousElementByAttribute(settings[2], "anonid", "input");
       var sizedInput = gManagerWindow.document.getAnonymousElementByAttribute(settings[8], "anonid", "input");
       is(unsizedInput.clientWidth > sizedInput.clientWidth, true, "Input with size attribute should be smaller than input without");
-    } finally {
+    }).then(() => {
       button = gManagerWindow.document.getElementById("detail-prefs-btn");
       is_element_hidden(button, "Preferences button should not be visible");
 
       gCategoryUtilities.openType("extension", run_next_test);
-    }
+    });
   });
 });
 
 // Tests for the setting.xml bindings introduced after Mozilla 7
 add_test(function() {
   observer.checkHidden("inlinesettings1@tests.mozilla.org");
 
   var addon = get_addon_element(gManagerWindow, "inlinesettings3@tests.mozilla.org");
--- a/toolkit/mozapps/extensions/test/browser/browser_inlinesettings_info.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_inlinesettings_info.js
@@ -264,74 +264,93 @@ add_test(function() {
     input.focus();
     EventUtils.synthesizeKey("VK_RIGHT", {}, gManagerWindow);
     EventUtils.synthesizeKey("VK_RIGHT", {}, gManagerWindow);
     EventUtils.synthesizeKey("VK_RETURN", {}, gManagerWindow);
     input.hidePopup();
     is(input.color, "#FF9900", "Color picker should have updated value");
     is(Services.prefs.getCharPref("extensions.inlinesettings1.color"), "#FF9900", "Color pref should have been updated");
 
-    try {
-      ok(!settings[6].hasAttribute("first-row"), "Not the first row");
-      var button = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "button");
+    ok(!settings[6].hasAttribute("first-row"), "Not the first row");
+    var button = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "button");
 
-      // Workaround for bug 1155324 - we need to ensure that the button is scrolled into view.
-      button.scrollIntoView();
+    // Workaround for bug 1155324 - we need to ensure that the button is scrolled into view.
+    button.scrollIntoView();
+
+    input = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "input");
+    is(input.value, "", "Label value should be empty");
+    is(input.tooltipText, "", "Label tooltip should be empty");
 
-      input = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "input");
-      is(input.value, "", "Label value should be empty");
-      is(input.tooltipText, "", "Label tooltip should be empty");
+    var profD = Services.dirsvc.get("ProfD", Ci.nsIFile);
+    var curProcD = Services.dirsvc.get("CurProcD", Ci.nsIFile);
+
+    MockFilePicker.setFiles([profD]);
+    MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
 
-      var profD = Services.dirsvc.get("ProfD", Ci.nsIFile);
-      var curProcD = Services.dirsvc.get("CurProcD", Ci.nsIFile);
+    let promise = new Promise(resolve => {
+      MockFilePicker.afterOpenCallback = resolve;
+      EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+    });
 
-      MockFilePicker.returnFiles = [profD];
-      MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
-      EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+    promise.then(() => {
       is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file");
       is(input.value, profD.path, "Label value should match file chosen");
       is(input.tooltipText, profD.path, "Label tooltip should match file chosen");
       is(Services.prefs.getCharPref("extensions.inlinesettings1.file"), profD.path, "File pref should match file chosen");
 
-      MockFilePicker.returnFiles = [curProcD];
+      MockFilePicker.setFiles([curProcD]);
       MockFilePicker.returnValue = Ci.nsIFilePicker.returnCancel;
-      EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+
+      return promise = new Promise(resolve => {
+        MockFilePicker.afterOpenCallback = resolve;
+        EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+      });
+    }).then(() => {
       is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file");
       is(input.value, profD.path, "Label value should not have changed");
       is(input.tooltipText, profD.path, "Label tooltip should not have changed");
       is(Services.prefs.getCharPref("extensions.inlinesettings1.file"), profD.path, "File pref should not have changed");
 
       ok(!settings[7].hasAttribute("first-row"), "Not the first row");
       button = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "button");
       input = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "input");
       is(input.value, "", "Label value should be empty");
       is(input.tooltipText, "", "Label tooltip should be empty");
 
-      MockFilePicker.returnFiles = [profD];
+      MockFilePicker.setFiles([profD]);
       MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
-      EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+
+      return new Promise(resolve => {
+        MockFilePicker.afterOpenCallback = resolve;
+        EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+      });
+    }).then(() => {
       is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory");
       is(input.value, profD.path, "Label value should match file chosen");
       is(input.tooltipText, profD.path, "Label tooltip should match file chosen");
       is(Services.prefs.getCharPref("extensions.inlinesettings1.directory"), profD.path, "Directory pref should match file chosen");
 
-      MockFilePicker.returnFiles = [curProcD];
+      MockFilePicker.setFiles([curProcD]);
       MockFilePicker.returnValue = Ci.nsIFilePicker.returnCancel;
-      EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+
+      return new Promise(resolve => {
+        MockFilePicker.afterOpenCallback = resolve;
+        EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+      });
+    }).then(() => {
       is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory");
       is(input.value, profD.path, "Label value should not have changed");
       is(input.tooltipText, profD.path, "Label tooltip should not have changed");
       is(Services.prefs.getCharPref("extensions.inlinesettings1.directory"), profD.path, "Directory pref should not have changed");
-
-    } finally {
+    }).then(() => {
       button = gManagerWindow.document.getElementById("detail-prefs-btn");
       is_element_hidden(button, "Preferences button should not be visible");
 
       gCategoryUtilities.openType("extension", run_next_test);
-    }
+    });
   });
 });
 
 // Tests for the setting.xml bindings introduced after Mozilla 7
 add_test(function() {
   observer.checkHidden("inlinesettings1@tests.mozilla.org");
 
   var addon = get_addon_element(gManagerWindow, "inlinesettings3@tests.mozilla.org");
--- a/toolkit/mozapps/handling/content/dialog.js
+++ b/toolkit/mozapps/handling/content/dialog.js
@@ -161,45 +161,47 @@ var dialog = {
   chooseApplication: function chooseApplication() {
     var bundle = document.getElementById("base-strings");
     var title = bundle.getString("choose.application.title");
 
     var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
     fp.init(window, title, Ci.nsIFilePicker.modeOpen);
     fp.appendFilters(Ci.nsIFilePicker.filterApps);
 
-    if (fp.show() == Ci.nsIFilePicker.returnOK && fp.file) {
-      let uri = Cc["@mozilla.org/network/util;1"].
-                getService(Ci.nsIIOService).
-                newFileURI(fp.file);
+    fp.open(rv => {
+      if (rv == Ci.nsIFilePicker.returnOK && fp.file) {
+        let uri = Cc["@mozilla.org/network/util;1"].
+                  getService(Ci.nsIIOService).
+                  newFileURI(fp.file);
 
-      let handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
-                       createInstance(Ci.nsILocalHandlerApp);
-      handlerApp.executable = fp.file;
+        let handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
+                         createInstance(Ci.nsILocalHandlerApp);
+        handlerApp.executable = fp.file;
 
-      // if this application is already in the list, select it and don't add it again
-      let parent = document.getElementById("items");
-      for (let i = 0; i < parent.childNodes.length; ++i) {
-        let elm = parent.childNodes[i];
-        if (elm.obj instanceof Ci.nsILocalHandlerApp && elm.obj.equals(handlerApp)) {
-          parent.selectedItem = elm;
-          parent.ensureSelectedElementIsVisible();
-          return;
+        // if this application is already in the list, select it and don't add it again
+        let parent = document.getElementById("items");
+        for (let i = 0; i < parent.childNodes.length; ++i) {
+          let elm = parent.childNodes[i];
+          if (elm.obj instanceof Ci.nsILocalHandlerApp && elm.obj.equals(handlerApp)) {
+            parent.selectedItem = elm;
+            parent.ensureSelectedElementIsVisible();
+            return;
+          }
         }
+
+        let elm = document.createElement("richlistitem");
+        elm.setAttribute("type", "handler");
+        elm.setAttribute("name", fp.file.leafName);
+        elm.setAttribute("image", "moz-icon://" + uri.spec + "?size=32");
+        elm.obj = handlerApp;
+
+        parent.selectedItem = parent.insertBefore(elm, parent.firstChild);
+        parent.ensureSelectedElementIsVisible();
       }
-
-      let elm = document.createElement("richlistitem");
-      elm.setAttribute("type", "handler");
-      elm.setAttribute("name", fp.file.leafName);
-      elm.setAttribute("image", "moz-icon://" + uri.spec + "?size=32");
-      elm.obj = handlerApp;
-
-      parent.selectedItem = parent.insertBefore(elm, parent.firstChild);
-      parent.ensureSelectedElementIsVisible();
-    }
+    });
   },
 
  /**
   * Function called when the OK button is pressed.
   */
   onAccept: function onAccept() {
     var checkbox = document.getElementById("remember");
     if (!checkbox.hidden) {
--- a/tools/profiler/core/ProfileBuffer.h
+++ b/tools/profiler/core/ProfileBuffer.h
@@ -19,17 +19,17 @@ public:
 
   ~ProfileBuffer();
 
   void addTag(const ProfileBufferEntry& aTag);
   void StreamSamplesToJSON(SpliceableJSONWriter& aWriter, int aThreadId, double aSinceTime,
                            JSContext* cx, UniqueStacks& aUniqueStacks);
   void StreamMarkersToJSON(SpliceableJSONWriter& aWriter, int aThreadId, double aSinceTime,
                            UniqueStacks& aUniqueStacks);
-  void DuplicateLastSample(int aThreadId, const mozilla::TimeStamp& aStartTime);
+  bool DuplicateLastSample(int aThreadId, const mozilla::TimeStamp& aStartTime);
 
   void addStoredMarker(ProfilerMarker* aStoredMarker);
 
   // The following two methods are not signal safe! They delete markers.
   void deleteExpiredStoredMarkers();
   void reset();
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
--- a/tools/profiler/core/ProfileBufferEntry.cpp
+++ b/tools/profiler/core/ProfileBufferEntry.cpp
@@ -746,50 +746,52 @@ int ProfileBuffer::FindLastSampleOfThrea
            readPos !=  (mReadPos + mEntrySize - 1) % mEntrySize;
            readPos  =   (readPos + mEntrySize - 1) % mEntrySize) {
     ProfileBufferEntry entry = mEntries[readPos];
     if (entry.isThreadId() && entry.mTagInt == aThreadId) {
       return readPos;
     }
   }
 
+  // This is rare. It typically happens after ProfileBuffer::reset() occurs.
   return -1;
 }
 
-void
+bool
 ProfileBuffer::DuplicateLastSample(int aThreadId, const TimeStamp& aStartTime)
 {
   int lastSampleStartPos = FindLastSampleOfThread(aThreadId);
   if (lastSampleStartPos == -1) {
-    return;
+    return false;
   }
 
   MOZ_ASSERT(mEntries[lastSampleStartPos].isThreadId());
 
   addTag(mEntries[lastSampleStartPos]);
 
   // Go through the whole entry and duplicate it, until we find the next one.
   for (int readPos = (lastSampleStartPos + 1) % mEntrySize;
        readPos != mWritePos;
        readPos = (readPos + 1) % mEntrySize) {
     switch (mEntries[readPos].kind()) {
       case ProfileBufferEntry::Kind::ThreadId:
         // We're done.
-        return;
+        return true;
       case ProfileBufferEntry::Kind::Time:
         // Copy with new time
         addTag(ProfileBufferEntry::Time((TimeStamp::Now() -
                                          aStartTime).ToMilliseconds()));
         break;
       case ProfileBufferEntry::Kind::Marker:
         // Don't copy markers
         break;
       default:
         // Copy anything else we don't know about
         addTag(mEntries[readPos]);
         break;
     }
   }
+  return true;
 }
 
 // END ProfileBuffer
 ////////////////////////////////////////////////////////////////////////
 
--- a/tools/profiler/core/ThreadInfo.cpp
+++ b/tools/profiler/core/ThreadInfo.cpp
@@ -231,23 +231,16 @@ ThreadInfo::FlushSamplesAndMarkers(Profi
 }
 
 mozilla::Mutex&
 ThreadInfo::GetMutex()
 {
   return *mMutex.get();
 }
 
-void
-ThreadInfo::DuplicateLastSample(ProfileBuffer* aBuffer,
-                                const TimeStamp& aStartTime)
-{
-  aBuffer->DuplicateLastSample(mThreadId, aStartTime);
-}
-
 size_t
 ThreadInfo::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
 {
   size_t n = aMallocSizeOf(this);
 
   n += aMallocSizeOf(mName.get());
   n += mPseudoStack->SizeOfIncludingThis(aMallocSizeOf);
 
--- a/tools/profiler/core/ThreadInfo.h
+++ b/tools/profiler/core/ThreadInfo.h
@@ -60,19 +60,16 @@ public:
   mozilla::Mutex& GetMutex();
   void StreamJSON(ProfileBuffer* aBuffer, SpliceableJSONWriter& aWriter,
                   double aSinceTime = 0);
 
   // Call this method when the JS entries inside the buffer are about to
   // become invalid, i.e., just before JS shutdown.
   void FlushSamplesAndMarkers(ProfileBuffer* aBuffer);
 
-  void DuplicateLastSample(ProfileBuffer* aBuffer,
-                           const mozilla::TimeStamp& aStartTime);
-
   ThreadResponsiveness* GetThreadResponsiveness() { return &mRespInfo; }
 
   void UpdateThreadResponsiveness() {
     mRespInfo.Update(mIsMainThread, mThread);
   }
 
   void StreamSamplesAndMarkers(ProfileBuffer* aBuffer,
                                SpliceableJSONWriter& aWriter,
--- a/tools/profiler/core/platform-linux-android.cpp
+++ b/tools/profiler/core/platform-linux-android.cpp
@@ -361,18 +361,18 @@ SigprofSender(void* aArg)
       for (uint32_t i = 0; i < gRegisteredThreads->size(); i++) {
         ThreadInfo* info = (*gRegisteredThreads)[i];
 
         // This will be null if we're not interested in profiling this thread.
         if (!info->HasProfile() || info->IsPendingDelete()) {
           continue;
         }
 
-        if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
-          info->DuplicateLastSample(gBuffer, gStartTime);
+        if (info->Stack()->CanDuplicateLastSampleDueToSleep() &&
+            gBuffer->DuplicateLastSample(info->ThreadId(), gStartTime)) {
           continue;
         }
 
         info->UpdateThreadResponsiveness();
 
         int threadId = info->ThreadId();
         MOZ_ASSERT(threadId != my_tid);
 
--- a/tools/profiler/core/platform-macos.cpp
+++ b/tools/profiler/core/platform-macos.cpp
@@ -158,18 +158,18 @@ public:
         for (uint32_t i = 0; i < gRegisteredThreads->size(); i++) {
           ThreadInfo* info = (*gRegisteredThreads)[i];
 
           // This will be null if we're not interested in profiling this thread.
           if (!info->HasProfile() || info->IsPendingDelete()) {
             continue;
           }
 
-          if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
-            info->DuplicateLastSample(gBuffer, gStartTime);
+          if (info->Stack()->CanDuplicateLastSampleDueToSleep() &&
+              gBuffer->DuplicateLastSample(info->ThreadId(), gStartTime)) {
             continue;
           }
 
           info->UpdateThreadResponsiveness();
 
           SampleContext(info, isFirstProfiledThread);
           isFirstProfiledThread = false;
         }
--- a/tools/profiler/core/platform-win32.cpp
+++ b/tools/profiler/core/platform-win32.cpp
@@ -167,18 +167,18 @@ class SamplerThread
         for (uint32_t i = 0; i < gRegisteredThreads->size(); i++) {
           ThreadInfo* info = (*gRegisteredThreads)[i];
 
           // This will be null if we're not interested in profiling this thread.
           if (!info->HasProfile() || info->IsPendingDelete()) {
             continue;
           }
 
-          if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
-            info->DuplicateLastSample(gBuffer, gStartTime);
+          if (info->Stack()->CanDuplicateLastSampleDueToSleep() &&
+              gBuffer->DuplicateLastSample(info->ThreadId(), gStartTime)) {
             continue;
           }
 
           info->UpdateThreadResponsiveness();
 
           SampleContext(info, isFirstProfiledThread);
           isFirstProfiledThread = false;
         }
--- a/widget/nsIFilePicker.idl
+++ b/widget/nsIFilePicker.idl
@@ -160,16 +160,18 @@ interface nsIFilePicker : nsISupports
   * Controls whether the chosen file(s) should be added to the system's recent
   * documents list. This attribute will be ignored if the system has no "Recent
   * Docs" concept, or if the application is in private browsing mode (in which
   * case the file will not be added). Defaults to true.
   */
   attribute boolean addToRecentDocs;
 
  /**
+  * This method is **deprecated**. Please use open()
+  *
   * Show File Dialog. The dialog is displayed modally.
   *
   * @return returnOK if the user selects OK, returnCancel if the user selects cancel
   *
   */
   [deprecated] short show();
 
 
--- a/widget/tests/mochitest.ini
+++ b/widget/tests/mochitest.ini
@@ -1,9 +1,9 @@
 [DEFAULT]
 support-files = utils.js
 
 [test_assign_event_data.html]
 subsuite = clipboard
-skip-if = toolkit == "cocoa" # Mac: Bug 933303
+skip-if = toolkit == "cocoa" || (toolkit == 'android' && debug) # Mac: Bug 933303, Android bug 1285414
 [test_picker_no_crash.html]
 skip-if = toolkit != "windows" || e10s # Bug 1267491
 support-files = window_picker_no_crash_child.html
--- a/xpcom/rust/nsstring/gtest/Test.cpp
+++ b/xpcom/rust/nsstring/gtest/Test.cpp
@@ -124,8 +124,13 @@ extern "C" void Rust_AutoAssignFromCpp()
 TEST(RustNsString, AutoAssignFromCpp) {
   Rust_AutoAssignFromCpp();
 }
 
 extern "C" void Rust_StringWrite();
 TEST(RustNsString, StringWrite) {
   Rust_StringWrite();
 }
+
+extern "C" void Rust_FromEmptyRustString();
+TEST(RustNsString, FromEmptyRustString) {
+  Rust_FromEmptyRustString();
+}
--- a/xpcom/rust/nsstring/gtest/test.rs
+++ b/xpcom/rust/nsstring/gtest/test.rs
@@ -105,8 +105,14 @@ pub extern fn Rust_StringWrite() {
     expect_eq!(s, "abc");
     expect_eq!(cs, "abc");
     write!(s, "{}", 123).unwrap();
     write!(cs, "{}", 123).unwrap();
     expect_eq!(s, "abc123");
     expect_eq!(cs, "abc123");
 }
 
+#[no_mangle]
+pub extern fn Rust_FromEmptyRustString() {
+    let mut test = nsString::from("Blah");
+    test.assign_utf8(&nsCString::from(String::new()));
+    assert!(test.is_empty());
+}
--- a/xpcom/rust/nsstring/src/lib.rs
+++ b/xpcom/rust/nsstring/src/lib.rs
@@ -308,28 +308,32 @@ macro_rules! define_string_types {
             }
         }
 
         impl<'a> From<&'a [$char_t]> for $String<'a> {
             fn from(s: &'a [$char_t]) -> $String<'a> {
                 assert!(s.len() < (u32::MAX as usize));
                 $String {
                     hdr: $StringRepr {
-                        data: s.as_ptr(),
+                        data: if s.is_empty() { ptr::null() } else { s.as_ptr() },
                         length: s.len() as u32,
                         flags: F_NONE,
                     },
                     _marker: PhantomData,
                 }
             }
         }
 
         impl From<Box<[$char_t]>> for $String<'static> {
             fn from(s: Box<[$char_t]>) -> $String<'static> {
                 assert!(s.len() < (u32::MAX as usize));
+                if s.is_empty() {
+                    return $String::new();
+                }
+
                 // SAFETY NOTE: This method produces an F_OWNED ns[C]String from
                 // a Box<[$char_t]>. this is only safe because in the Gecko
                 // tree, we use the same allocator for Rust code as for C++
                 // code, meaning that our box can be legally freed with
                 // libc::free().
                 let length = s.len() as u32;
                 let ptr = s.as_ptr();
                 mem::forget(s);