Merge backout, a=bustage
authorJames Willcox <jwillcox@mozilla.com>
Wed, 05 Nov 2014 19:37:45 -0600
changeset 225957 4cd1151d9de0
parent 225956 375b5fca3825 (current diff)
parent 225955 c8d99c0a36d9 (diff)
child 225958 81cf187bba10
push id4084
push userjwillcox@mozilla.com
push date2014-11-06 01:38 +0000
treeherdermozilla-beta@4cd1151d9de0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
milestone34.0
Merge backout, a=bustage
dom/base/test/test_location_searchParams.html
layout/style/test/test_flexbox_flex_basis_values.html
--- a/browser/app/macbuild/Contents/MacOS-files.in
+++ b/browser/app/macbuild/Contents/MacOS-files.in
@@ -1,10 +1,9 @@
 /*.app/***
 /*.dylib
 /certutil
 /firefox-bin
 /gtest/***
 /pk12util
 /ssltunnel
-/webapprt-stub
 /xpcshell
 /XUL
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -1100,24 +1100,24 @@ toolbarpaletteitem[dragover] {
 
 #customization-palette-container {
   display: flex;
   flex-direction: column;
 }
 
 #customization-palette:not([hidden]) {
   display: block;
-  flex: 1 1 main-size;
+  flex: 1 1 auto;
   overflow: auto;
   min-height: 3em;
 }
 
 #customization-footer-spacer,
 #customization-spacer {
-  flex: 1 1 main-size;
+  flex: 1 1 auto;
 }
 
 #customization-footer {
   display: flex;
   flex-shrink: 0;
   flex-wrap: wrap;
 }
 
--- a/browser/devtools/markupview/markup-view.css
+++ b/browser/devtools/markupview/markup-view.css
@@ -30,17 +30,17 @@
    * the editor covers up any content to the left (including expander arrows
    * and hover effects). */
   margin-left: -1000em;
   padding-left: 1000em;
 }
 
 .html-editor-inner {
   border: solid .1px;
-  flex: 1 1 main-size;
+  flex: 1 1 auto;
 }
 
 .html-editor iframe {
   height: 100%;
   width: 100%;
   border: none;
   margin: 0;
   padding: 0;
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -841,21 +841,17 @@ bin/libfreebl_32int64_3.so
 #endif
 #endif
 
 #ifdef MOZ_WEBAPP_RUNTIME
 [WebappRuntime]
 #ifdef XP_WIN
 @BINPATH@/webapp-uninstaller@BIN_SUFFIX@
 #endif
-#ifdef XP_MACOSX
-@APPNAME@/Contents/MacOS/webapprt-stub@BIN_SUFFIX@
-#else
 @BINPATH@/webapprt-stub@BIN_SUFFIX@
-#endif
 @BINPATH@/webapprt/webapprt.ini
 @BINPATH@/webapprt/chrome.manifest
 @BINPATH@/webapprt/chrome/webapprt@JAREXT@
 @BINPATH@/webapprt/chrome/webapprt.manifest
 @BINPATH@/webapprt/chrome/@AB_CD@@JAREXT@
 @BINPATH@/webapprt/chrome/@AB_CD@.manifest
 @BINPATH@/webapprt/components/CommandLineHandler.js
 @BINPATH@/webapprt/components/ContentPermission.js
--- a/browser/metro/theme/config.css
+++ b/browser/metro/theme/config.css
@@ -52,17 +52,17 @@ body {
     border: none;
     background-image: none;
     background-color: transparent;
     display: inline-block;
     width: 12em;
     min-width: 0;
     color: #000000;
     opacity: 1;
-    flex: 1 1 main-size;
+    flex: 1 1 auto;
 }
 
 #filter-input:-moz-placeholder {
     color: rgba(255,255,255,0.5);
 }
 
 .toolbar input {
     display: inline-block;
@@ -188,17 +188,17 @@ li {
     text-align: left;
     text-overflow: ellipsis;
     overflow: hidden;
     background-image: none;
 }
 
 .pref-value {
     color: rgba(0,0,0,0.5);
-    flex: 1 1 main-size;
+    flex: 1 1 auto;
     border: none;
     -moz-appearance: none;
     background-image: none;
     background-color: transparent;
 }
 
 .pref-name[locked] {
     padding-right: 20px;
@@ -222,37 +222,37 @@ li {
 .pref-item-line {
     border-top: 1px solid rgba(0,0,0,0.05);
     color: rgba(0,0,0,0.5);
     display: flex;
     flex-direction: row;
 }
 
 #new-pref-value-boolean {
-    flex: 1 1 main-size;
+    flex: 1 1 auto;
 }
 
 /* Disable newPref dialog spinbuttons, use custom version from Android */
 /* Filed Bug 962359 to enhance the default spinbutton style to be touch-friendly */
 #new-pref-value-int {
     -moz-appearance: textfield;
 }
 
 #new-pref-container .pref-button.toggle {
     display: inline-block;
     opacity: 1;
-    flex: 0 1 main-size;
+    flex: 0 1 auto;
     float: right;
 }
 
 #new-pref-container .pref-button.cancel,
 #new-pref-container .pref-button.create {
     display: inline-block;
     opacity: 1;
-    flex: 1 1 main-size;
+    flex: 1 1 auto;
 }
 
 .pref-item-line {
     pointer-events: none;
 }
 
 #new-pref-container .pref-item-line,
 .pref-item.selected .pref-item-line,
--- a/browser/themes/shared/customizableui/panelUIOverlay.inc.css
+++ b/browser/themes/shared/customizableui/panelUIOverlay.inc.css
@@ -243,17 +243,17 @@ panelview:not([mainview]) .toolbarbutton
 }
 
 .cui-widget-panel.cui-widget-panelWithFooter > .panel-arrowcontainer > .panel-arrowcontent {
   padding-bottom: 0;
 }
 
 #PanelUI-contents {
   display: block;
-  flex: 1 0 main-size;
+  flex: 1 0 auto;
   margin-left: auto;
   margin-right: auto;
   padding: .5em 0;
   max-width: @menuPanelWidth@;
 }
 
 #PanelUI-contents-scroller {
   overflow-y: auto;
--- a/browser/themes/shared/devtools/webconsole.inc.css
+++ b/browser/themes/shared/devtools/webconsole.inc.css
@@ -119,17 +119,17 @@ a {
 
 .message-body {
   white-space: pre-wrap;
   word-wrap: break-word;
 }
 
 .message-flex-body > .message-body {
   display: block;
-  flex: 1 1 main-size;
+  flex: 1 1 auto;
   vertical-align: middle;
 }
 
 .message-flex-body > .message-location {
   margin-top: 0;
 }
 
 .jsterm-input-container {
@@ -246,17 +246,17 @@ a {
   display: flex;
 }
 
 .message[category=network] .method {
   flex: none;
 }
 
 .message[category=network]:not(.navigation-marker) .url {
-  flex: 1 1 main-size;
+  flex: 1 1 auto;
   /* Make sure the URL is very small initially, let flex change width as needed. */
   width: 100px;
   min-width: 5em;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
 }
 
@@ -464,17 +464,17 @@ a {
 
 .stacktrace li {
   display: flex;
   margin: 0;
 }
 
 .stacktrace .function {
   display: block;
-  flex: 1 1 main-size;
+  flex: 1 1 auto;
 }
 
 .cm-s-mozilla a[class] {
   font-style: italic;
   text-decoration: none;
 }
 
 .cm-s-mozilla a[class]:hover,
--- a/content/media/AudioBufferUtils.h
+++ b/content/media/AudioBufferUtils.h
@@ -72,19 +72,28 @@ public:
 
   /**
    * Check that the buffer is completly filled, and reset internal state so this
    * instance can be reused.
    */
   void BufferFilled() {
     // It's okay to have exactly zero samples here, it can happen we have an
     // audio callback driver because of a hint on MSG creation, but the
-    // AudioOutputStream has not been created yet.
+    // AudioOutputStream has not been created yet, or if all the streams have finished
+    // but we're still running.
+    // Note: it's also ok if we had data in the scratch buffer - and we usually do - and
+    // all the streams were ended (no mixer callback occured).
+    // XXX Remove this warning, or find a way to avoid it if the mixer callback
+    // isn't called.
     NS_WARN_IF_FALSE(Available() == 0 || mSampleWriteOffset == 0,
             "Audio Buffer is not full by the end of the callback.");
+    // Make sure the data returned is always set and not random!
+    if (Available()) {
+      PodZero(mBuffer + mSampleWriteOffset, FramesToSamples(CHANNELS, Available()));
+    }
     MOZ_ASSERT(mSamples, "Buffer not set.");
     mSamples = 0;
     mSampleWriteOffset = 0;
     mBuffer = nullptr;
   }
 
 private:
   /* This is not an owned pointer, but the pointer passed to use via the audio
--- a/content/media/fmp4/apple/AppleATDecoder.cpp
+++ b/content/media/fmp4/apple/AppleATDecoder.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <AudioToolbox/AudioToolbox.h>
 #include "AppleUtils.h"
 #include "MP4Reader.h"
 #include "MP4Decoder.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/ReentrantMonitor.h"
+#include "mp4_demuxer/Adts.h"
 #include "mp4_demuxer/DecoderData.h"
 #include "nsIThread.h"
 #include "AppleATDecoder.h"
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 PRLogModuleInfo* GetAppleMediaLog();
 #define LOG(...) PR_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__))
@@ -350,16 +351,29 @@ AppleATDecoder::SetupDecoder()
     mConverter = nullptr;
     mCallback->Error();
   }
 }
 
 void
 AppleATDecoder::SubmitSample(nsAutoPtr<mp4_demuxer::MP4Sample> aSample)
 {
+  // Prepend ADTS header to AAC audio.
+  if (!strcmp(mConfig.mime_type, "audio/mp4a-latm")) {
+    bool rv = mp4_demuxer::Adts::ConvertSample(mConfig.channel_count,
+                                               mConfig.frequency_index,
+                                               mConfig.aac_profile,
+                                               aSample);
+    if (!rv) {
+      NS_ERROR("Failed to apply ADTS header");
+      mCallback->Error();
+      return;
+    }
+  }
+  // Push the sample to the AudioFileStream for parsing.
   mSamplePosition = aSample->byte_offset;
   mCurrentAudioTimestamp = aSample->composition_timestamp;
   uint32_t flags = mFlushed ? kAudioFileStreamParseFlag_Discontinuity : 0;
   OSStatus rv = AudioFileStreamParseBytes(mStream,
                                           aSample->size,
                                           aSample->data,
                                           flags);
   if (rv != noErr) {
--- a/content/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp
+++ b/content/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp
@@ -3,29 +3,31 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaTaskQueue.h"
 #include "FFmpegRuntimeLinker.h"
 
 #include "FFmpegAudioDecoder.h"
+#include "mp4_demuxer/Adts.h"
 
 #define MAX_CHANNELS 16
 
 typedef mp4_demuxer::MP4Sample MP4Sample;
 
 namespace mozilla
 {
 
 FFmpegAudioDecoder<LIBAV_VER>::FFmpegAudioDecoder(
   MediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
   const mp4_demuxer::AudioDecoderConfig& aConfig)
   : FFmpegDataDecoder(aTaskQueue, GetCodecId(aConfig.mime_type))
   , mCallback(aCallback)
+  , mConfig(aConfig)
 {
   MOZ_COUNT_CTOR(FFmpegAudioDecoder);
 }
 
 nsresult
 FFmpegAudioDecoder<LIBAV_VER>::Init()
 {
   nsresult rv = FFmpegDataDecoder::Init();
@@ -78,16 +80,29 @@ CopyAndPackAudio(AVFrame* aFrame, uint32
   }
 
   return audio.forget();
 }
 
 void
 FFmpegAudioDecoder<LIBAV_VER>::DecodePacket(MP4Sample* aSample)
 {
+  // Prepend ADTS header to AAC audio.
+  if (!strcmp(mConfig.mime_type, "audio/mp4a-latm")) {
+    bool rv = mp4_demuxer::Adts::ConvertSample(mConfig.channel_count,
+                                               mConfig.frequency_index,
+                                               mConfig.aac_profile,
+                                               aSample);
+    if (!rv) {
+      NS_ERROR("Failed to apply ADTS header");
+      mCallback->Error();
+      return;
+    }
+  }
+
   AVPacket packet;
   av_init_packet(&packet);
 
   aSample->Pad(FF_INPUT_BUFFER_PADDING_SIZE);
   packet.data = aSample->data;
   packet.size = aSample->size;
   packet.pos = aSample->byte_offset;
 
--- a/content/media/fmp4/ffmpeg/FFmpegAudioDecoder.h
+++ b/content/media/fmp4/ffmpeg/FFmpegAudioDecoder.h
@@ -30,13 +30,14 @@ public:
   virtual nsresult Input(mp4_demuxer::MP4Sample* aSample) MOZ_OVERRIDE;
   virtual nsresult Drain() MOZ_OVERRIDE;
   static AVCodecID GetCodecId(const char* aMimeType);
 
 private:
   void DecodePacket(mp4_demuxer::MP4Sample* aSample);
 
   MediaDataDecoderCallback* mCallback;
+  const mp4_demuxer::AudioDecoderConfig& mConfig;
 };
 
 } // namespace mozilla
 
 #endif // __FFmpegAACDecoder_h__
--- a/content/media/fmp4/gonk/GonkAudioDecoderManager.cpp
+++ b/content/media/fmp4/gonk/GonkAudioDecoderManager.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #include "MediaCodecProxy.h"
 #include <OMX_IVCommon.h>
 #include <gui/Surface.h>
 #include <ICrypto.h>
 #include "GonkAudioDecoderManager.h"
 #include "MediaDecoderReader.h"
+#include "mp4_demuxer/Adts.h"
 #include "VideoUtils.h"
 #include "nsTArray.h"
 #include "prlog.h"
 #include "stagefright/MediaBuffer.h"
 #include "stagefright/MetaData.h"
 #include "stagefright/MediaErrors.h"
 #include <stagefright/foundation/AMessage.h>
 #include <stagefright/foundation/ALooper.h>
@@ -37,21 +38,26 @@ typedef android::MediaCodecProxy MediaCo
 namespace mozilla {
 
 GonkAudioDecoderManager::GonkAudioDecoderManager(
   const mp4_demuxer::AudioDecoderConfig& aConfig)
   : mAudioChannels(aConfig.channel_count)
   , mAudioRate(aConfig.samples_per_second)
   , mAudioProfile(aConfig.aac_profile)
   , mAudioBuffer(nullptr)
+  , mUseAdts(true)
 {
   MOZ_COUNT_CTOR(GonkAudioDecoderManager);
   MOZ_ASSERT(mAudioChannels);
   mUserData.AppendElements(&aConfig.audio_specific_config[0],
                            aConfig.audio_specific_config.length());
+  // Pass through mp3 without applying an ADTS header.
+  if (strcmp(aConfig.mime_type, "audio/mp4a-latm") != 0) {
+      mUseAdts = false;
+  }
 }
 
 GonkAudioDecoderManager::~GonkAudioDecoderManager()
 {
   MOZ_COUNT_DTOR(GonkAudioDecoderManager);
 }
 
 android::sp<MediaCodecProxy>
@@ -215,16 +221,28 @@ void GonkAudioDecoderManager::ReleaseAud
 
 nsresult
 GonkAudioDecoderManager::Input(mp4_demuxer::MP4Sample* aSample)
 {
   if (mDecoder == nullptr) {
     ALOG("Decoder is not inited");
     return NS_ERROR_UNEXPECTED;
   }
+  if (aSample && mUseAdts) {
+    int8_t frequency_index =
+        mp4_demuxer::Adts::GetFrequencyIndex(mAudioRate);
+    bool rv = mp4_demuxer::Adts::ConvertSample(mAudioChannels,
+                                               frequency_index,
+                                               mAudioProfile,
+                                               aSample);
+    if (!rv) {
+      ALOG("Failed to apply ADTS header");
+      return NS_ERROR_FAILURE;
+    }
+  }
 
   status_t rv;
   if (aSample) {
     const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data);
     uint32_t length = aSample->size;
     rv = mDecoder->Input(data, length, aSample->composition_timestamp, 0);
   } else {
     // Inputted data is null, so it is going to notify decoder EOS
--- a/content/media/fmp4/gonk/GonkAudioDecoderManager.h
+++ b/content/media/fmp4/gonk/GonkAudioDecoderManager.h
@@ -40,16 +40,17 @@ private:
   void ReleaseAudioBuffer();
   // MediaCodedc's wrapper that performs the decoding.
   android::sp<MediaCodecProxy> mDecoder;
 
   const uint32_t mAudioChannels;
   const uint32_t mAudioRate;
   const uint32_t mAudioProfile;
   nsTArray<uint8_t> mUserData;
+  bool mUseAdts;
 
   MediaDataDecoderCallback*  mReaderCallback;
   android::MediaBuffer* mAudioBuffer;
   android::sp<ALooper> mLooper;
 };
 
 } // namespace mozilla
 
--- a/content/media/fmp4/wmf/WMFAudioMFTManager.cpp
+++ b/content/media/fmp4/wmf/WMFAudioMFTManager.cpp
@@ -17,17 +17,18 @@ PRLogModuleInfo* GetDemuxerLog();
 #define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__))
 #else
 #define LOG(...)
 #endif
 
 namespace mozilla {
 
 static void
-AACAudioSpecificConfigToUserData(const uint8_t* aAudioSpecConfig,
+AACAudioSpecificConfigToUserData(uint8_t aAACProfileLevelIndication,
+                                 const uint8_t* aAudioSpecConfig,
                                  uint32_t aConfigLength,
                                  nsTArray<BYTE>& aOutUserData)
 {
   MOZ_ASSERT(aOutUserData.IsEmpty());
 
   // The MF_MT_USER_DATA for AAC is defined here:
   // http://msdn.microsoft.com/en-us/library/windows/desktop/dd742784%28v=vs.85%29.aspx
   //
@@ -54,18 +55,18 @@ AACAudioSpecificConfigToUserData(const u
   //      DWORD        dwReserved2;
   //    }
   const UINT32 heeInfoLen = 4 * sizeof(WORD) + sizeof(DWORD);
 
   // The HEAACWAVEINFO must have payload and profile set,
   // the rest can be all 0x00.
   BYTE heeInfo[heeInfoLen] = {0};
   WORD* w = (WORD*)heeInfo;
-  w[0] = 0x1; // Payload type ADTS
-  w[1] = 0xFE; // Profile level indication, none specified.
+  w[0] = 0x0; // Payload type raw AAC packet
+  w[1] = aAACProfileLevelIndication;
 
   aOutUserData.AppendElements(heeInfo, heeInfoLen);
   aOutUserData.AppendElements(aAudioSpecConfig, aConfigLength);
 }
 
 WMFAudioMFTManager::WMFAudioMFTManager(
   const mp4_demuxer::AudioDecoderConfig& aConfig)
   : mAudioChannels(aConfig.channel_count)
@@ -76,17 +77,18 @@ WMFAudioMFTManager::WMFAudioMFTManager(
   , mMustRecaptureAudioPosition(true)
 {
   MOZ_COUNT_CTOR(WMFAudioMFTManager);
 
   if (!strcmp(aConfig.mime_type, "audio/mpeg")) {
     mStreamType = MP3;
   } else if (!strcmp(aConfig.mime_type, "audio/mp4a-latm")) {
     mStreamType = AAC;
-    AACAudioSpecificConfigToUserData(&aConfig.audio_specific_config[0],
+    AACAudioSpecificConfigToUserData(aConfig.aac_profile,
+                                     &aConfig.audio_specific_config[0],
                                      aConfig.audio_specific_config.length(),
                                      mUserData);
   } else {
     mStreamType = Unknown;
   }
 }
 
 WMFAudioMFTManager::~WMFAudioMFTManager()
@@ -140,17 +142,17 @@ WMFAudioMFTManager::Init()
 
   hr = type->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, mAudioRate);
   NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
 
   hr = type->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, mAudioChannels);
   NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
 
   if (mStreamType == AAC) {
-    hr = type->SetUINT32(MF_MT_AAC_PAYLOAD_TYPE, 0x1); // ADTS
+    hr = type->SetUINT32(MF_MT_AAC_PAYLOAD_TYPE, 0x0); // Raw AAC packet
     NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
 
     hr = type->SetBlob(MF_MT_USER_DATA,
                        mUserData.Elements(),
                        mUserData.Length());
     NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
   }
 
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -45,17 +45,16 @@ skip-if = buildapp == 'mulet' || buildap
 [test_gsp-standards.html]
 [test_getFeature_with_perm.html]
 [test_getFeature_without_perm.html]
 [test_hasFeature.html]
 [test_history_document_open.html]
 [test_history_state_null.html]
 [test_Image_constructor.html]
 [test_innersize_scrollport.html]
-[test_location_searchParams.html]
 [test_messageChannel.html]
 [test_messageChannel_cloning.html]
 [test_messageChannel_pingpong.html]
 [test_messageChannel_post.html]
 [test_messageChannel_pref.html]
 [test_messageChannel_start.html]
 [test_messagemanager_targetchain.html]
 [test_messageChannel_transferable.html]
deleted file mode 100644
--- a/dom/base/test/test_location_searchParams.html
+++ /dev/null
@@ -1,89 +0,0 @@
-
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1037715
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 1037715</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1037715">Mozilla Bug 1037715</a>
-  <iframe id="a"></iframe>
-  <script type="application/javascript">
-
-var l;
-
-var iframe = document.getElementById('a');
-function onload0() {
-  iframe.removeEventListener('load', onload0);
-
-  l = iframe.contentWindow.location;
-  is(l.searchParams.get('a'), 'test0', 'l.searchParams value is ok');
-
-  info('changing location from JS...');
-  iframe.addEventListener('load', onload1);
-  iframe.contentWindow.location.href = 'file_empty.html?a=test1';
-}
-
-function onload1() {
-  iframe.removeEventListener('load', onload1);
-
-  var ll = iframe.contentWindow.location;
-  is(ll.searchParams.get('a'), 'test1', 'location.searchParams value is ok');
-  is(l.searchParams.get('a'), 'test1', 'l.searchParams value is ok');
-  isnot(ll.searchParams, l.searchParams, '2 different objects.');
-
-  info('changing location using l.searchParams...');
-  iframe.addEventListener('load', onload2);
-  l.searchParams.set('a', 'test2');
-}
-
-function onload2() {
-  iframe.removeEventListener('load', onload2);
-
-  var ll = iframe.contentWindow.location;
-  is(ll.searchParams.get('a'), 'test2', 'location.searchParams value is ok');
-  is(l.searchParams.get('a'), 'test2', 'l.searchParams value is ok');
-  isnot(ll.searchParams, l.searchParams, '2 different objects.');
-
-  info('changing iframe.src...');
-  iframe.addEventListener('load', onload3);
-  l.search = 'a=test3';
-}
-
-function onload3() {
-  iframe.removeEventListener('load', onload3);
-
-  var ll = iframe.contentWindow.location;
-  is(ll.searchParams.get('a'), 'test3', 'location.searchParams value is ok');
-  is(l.searchParams.get('a'), 'test3', 'l.searchParams value is ok');
-  isnot(ll.searchParams, l.searchParams, '2 different objects.');
-
-  info('changing iframe.src...');
-  iframe.addEventListener('load', onload4);
-  iframe.src = 'file_empty.html?a=test4';
-}
-
-function onload4() {
-  iframe.removeEventListener('load', onload4);
-
-  var ll = iframe.contentWindow.location;
-  is(ll.searchParams.get('a'), 'test4', 'location.searchParams value is ok');
-  is(l.searchParams.get('a'), 'test4', 'l.searchParams value is ok');
-  isnot(ll.searchParams, l.searchParams, '2 different objects.');
-
-  SimpleTest.finish();
-}
-
-iframe.addEventListener('load', onload0);
-iframe.src = "file_empty.html?a=test0";
-SimpleTest.waitForExplicitFinish();
-
-  </script>
-
-</body>
-</html>
--- a/dom/webidl/HTMLAnchorElement.webidl
+++ b/dom/webidl/HTMLAnchorElement.webidl
@@ -26,16 +26,17 @@ interface HTMLAnchorElement : HTMLElemen
            attribute DOMString hreflang;
            [SetterThrows]
            attribute DOMString type;
 
            [SetterThrows]
            attribute DOMString text;
 };
 HTMLAnchorElement implements URLUtils;
+HTMLAnchorElement implements URLUtilsSearchParams;
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLAnchorElement {
            [SetterThrows]
            attribute DOMString coords;
            [SetterThrows]
            attribute DOMString charset;
            [SetterThrows]
--- a/dom/webidl/HTMLAreaElement.webidl
+++ b/dom/webidl/HTMLAreaElement.webidl
@@ -33,14 +33,15 @@ interface HTMLAreaElement : HTMLElement 
   // not implemented.
   //
   //       [SetterThrows]
   //       attribute DOMString hreflang;
   //       [SetterThrows]
   //       attribute DOMString type;
 };
 HTMLAreaElement implements URLUtils;
+HTMLAreaElement implements URLUtilsSearchParams;
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLAreaElement {
            [SetterThrows]
            attribute boolean noHref;
 };
--- a/dom/webidl/Location.webidl
+++ b/dom/webidl/Location.webidl
@@ -16,10 +16,11 @@ interface Location {
   [Throws]
   void assign(DOMString url);
   [Throws, CrossOriginCallable]
   void replace(DOMString url);
   // XXXbz there is no forceget argument in the spec!  See bug 1037721.
   [Throws]
   void reload(optional boolean forceget = false);
 };
-// No support for .searchParams on Location yet.  See bug 1037715.
+// No support for .searchParams on Location yet.  See bug 1082734.
+
 Location implements URLUtils;
--- a/dom/webidl/URL.webidl
+++ b/dom/webidl/URL.webidl
@@ -14,16 +14,17 @@
 
 // [Constructor(DOMString url, optional (URL or DOMString) base = "about:blank")]
 [Constructor(DOMString url, URL base),
  Constructor(DOMString url, optional DOMString base = "about:blank"),
  Exposed=(Window,Worker)]
 interface URL {
 };
 URL implements URLUtils;
+URL implements URLUtilsSearchParams;
 
 partial interface URL {
   [Throws]
   static DOMString? createObjectURL(Blob blob, optional objectURLOptions options);
   [Throws]
   static DOMString? createObjectURL(MediaStream stream, optional objectURLOptions options);
   static void revokeObjectURL(DOMString url);
 };
--- a/dom/webidl/URLUtils.webidl
+++ b/dom/webidl/URLUtils.webidl
@@ -35,17 +35,21 @@ interface URLUtils {
            attribute DOMString hostname;
   [Throws]
            attribute DOMString port;
   [Throws]
            attribute DOMString pathname;
   [Throws]
            attribute DOMString search;
 
-           attribute URLSearchParams searchParams;
-
   [Throws]
            attribute DOMString hash;
 
   // Bug 824857 should remove this.
   [Throws]
   stringifier;
 };
+
+[NoInterfaceObject,
+ Exposed=(Window, Worker)]
+interface URLUtilsSearchParams {
+           attribute URLSearchParams searchParams;
+};
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1531,16 +1531,31 @@ bool DoesD3D11DeviceWork(ID3D11Device *d
     if (displayLinkModuleVersion <= GFX_DRIVER_VERSION(8,6,1,36484)) {
 #if defined(MOZ_CRASHREPORTER)
       CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("DisplayLink: too old version\n"));
 #endif
       return false;
     }
   }
 
+  if (GetModuleHandleW(L"atidxx32.dll")) {
+    nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
+    if (gfxInfo) {
+      nsString vendorID, vendorID2;
+      gfxInfo->GetAdapterVendorID(vendorID);
+      gfxInfo->GetAdapterVendorID2(vendorID2);
+      if (vendorID.EqualsLiteral("0x8086") && vendorID2.IsEmpty()) {
+#if defined(MOZ_CRASHREPORTER)
+        CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Unexpected Intel/AMD dual-GPU setup\n"));
+#endif
+        return false;
+      }
+    }
+  }
+
   RefPtr<ID3D11Texture2D> texture;
   D3D11_TEXTURE2D_DESC desc;
   desc.Width = 32;
   desc.Height = 32;
   desc.MipLevels = 1;
   desc.ArraySize = 1;
   desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
   desc.SampleDesc.Count = 1;
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -66,17 +66,16 @@
 #include "nsTextFrame.h"
 #include "nsFontFaceList.h"
 #include "nsFontInflationData.h"
 #include "nsSVGUtils.h"
 #include "SVGImageContext.h"
 #include "SVGTextFrame.h"
 #include "nsStyleStructInlines.h"
 #include "nsStyleTransformMatrix.h"
-#include "nsStyleUtil.h"
 #include "nsIFrameInlines.h"
 #include "ImageContainer.h"
 #include "nsComputedDOMStyle.h"
 #include "ActiveLayerTracker.h"
 #include "mozilla/gfx/2D.h"
 #include "gfx2DGlue.h"
 #include "mozilla/LookAndFeel.h"
 #include "UnitTransforms.h"
@@ -4158,29 +4157,42 @@ nsLayoutUtils::ComputeSizeWithIntrinsicD
     aWM.IsVertical() ? &stylePos->mWidth : &stylePos->mHeight;
 
   bool isFlexItem = aFrame->IsFlexItem();
   bool isInlineFlexItem = false;
 
   if (isFlexItem) {
     // Flex items use their "flex-basis" property in place of their main-size
     // property (e.g. "width") for sizing purposes, *unless* they have
-    // "flex-basis:main-size", in which case they use their main-size property
-    // after all.
+    // "flex-basis:auto", in which case they use their main-size property after
+    // all.
     uint32_t flexDirection =
       aFrame->GetParent()->StylePosition()->mFlexDirection;
     isInlineFlexItem =
       flexDirection == NS_STYLE_FLEX_DIRECTION_ROW ||
       flexDirection == NS_STYLE_FLEX_DIRECTION_ROW_REVERSE;
 
     // NOTE: The logic here should match the similar chunk for determining
     // inlineStyleCoord and blockStyleCoord in nsFrame::ComputeSize().
     const nsStyleCoord* flexBasis = &(stylePos->mFlexBasis);
-    if (!nsStyleUtil::IsFlexBasisMainSize(*flexBasis, isInlineFlexItem)) {
-      (isInlineFlexItem ? inlineStyleCoord : blockStyleCoord) = flexBasis;
+    if (flexBasis->GetUnit() != eStyleUnit_Auto) {
+      if (isInlineFlexItem) {
+        inlineStyleCoord = flexBasis;
+      } else {
+        // One caveat for vertical flex items: We don't support enumerated
+        // values (e.g. "max-content") for height properties yet. So, if our
+        // computed flex-basis is an enumerated value, we'll just behave as if
+        // it were "auto", which means "use the main-size property after all"
+        // (which is "height", in this case).
+        // NOTE: Once we support intrinsic sizing keywords for "height",
+        // we should remove this check.
+        if (flexBasis->GetUnit() != eStyleUnit_Enumerated) {
+          blockStyleCoord = flexBasis;
+        }
+      }
     }
   }
 
   // Handle intrinsic sizes and their interaction with
   // {min-,max-,}{width,height} according to the rules in
   // http://www.w3.org/TR/CSS21/visudet.html#min-max-widths
 
   // Note: throughout the following section of the function, I avoid
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -12,17 +12,16 @@
 #include "nsCSSAnonBoxes.h"
 #include "nsDisplayList.h"
 #include "nsIFrameInlines.h"
 #include "nsLayoutUtils.h"
 #include "nsPlaceholderFrame.h"
 #include "nsPresContext.h"
 #include "nsRenderingContext.h"
 #include "nsStyleContext.h"
-#include "nsStyleUtil.h"
 #include "prlog.h"
 #include <algorithm>
 #include "mozilla/LinkedList.h"
 
 using namespace mozilla;
 using namespace mozilla::layout;
 
 // Convenience typedefs for helper classes that we forward-declare in .h file
@@ -567,18 +566,17 @@ protected:
   const float mFlexGrow;
   const float mFlexShrink;
 
   const nsMargin mBorderPadding;
   nsMargin mMargin; // non-const because we need to resolve auto margins
 
   // These are non-const so that we can lazily update them with the item's
   // intrinsic size (obtained via a "measuring" reflow), when necessary.
-  // (e.g. if we have a vertical flex item with "flex-basis:auto",
-  // "flex-basis:main-size;height:auto", or "min-height:auto")
+  // (e.g. for "flex-basis:auto;height:auto" & "min-height:auto")
   nscoord mFlexBaseSize;
   nscoord mMainMinSize;
   nscoord mMainMaxSize;
 
   const nscoord mCrossMinSize;
   const nscoord mCrossMaxSize;
 
   // Values that we compute after constructor:
@@ -1159,20 +1157,20 @@ PartiallyResolveAutoMinSize(const FlexIt
 {
   MOZ_ASSERT(aFlexItem.NeedsMinSizeAutoResolution(),
              "only call for FlexItems that need min-size auto resolution");
 
   nscoord minMainSize = nscoord_MAX; // Intentionally huge; we'll shrink it
                                      // from here, w/ std::min().
 
   // We need the smallest of:
-  // * the used flex-basis, if the computed flex-basis was 'main-size':
-  const nsStyleCoord& flexBasis = aItemReflowState.mStylePosition->mFlexBasis;
-  const bool isHorizontal = IsAxisHorizontal(aAxisTracker.GetMainAxis());
-  if (nsStyleUtil::IsFlexBasisMainSize(flexBasis, isHorizontal) &&
+  // * the used flex-basis, if the computed flex-basis was 'auto':
+  // XXXdholbert ('auto' might be renamed to 'main-size'; see bug 1032922)
+  if (eStyleUnit_Auto ==
+      aItemReflowState.mStylePosition->mFlexBasis.GetUnit() &&
       aFlexItem.GetFlexBaseSize() != NS_AUTOHEIGHT) {
     // NOTE: We skip this if the flex base size depends on content & isn't yet
     // resolved. This is OK, because the caller is responsible for computing
     // the min-content height and min()'ing it with the value we return, which
     // is equivalent to what would happen if we min()'d that at this point.
     minMainSize = std::min(minMainSize, aFlexItem.GetFlexBaseSize());
   }
 
@@ -1216,17 +1214,17 @@ ResolveAutoFlexBasisFromRatio(FlexItem& 
                               const nsHTMLReflowState& aItemReflowState,
                               const nsSize& aIntrinsicRatio,
                               const FlexboxAxisTracker& aAxisTracker)
 {
   MOZ_ASSERT(NS_AUTOHEIGHT == aFlexItem.GetFlexBaseSize(),
              "Should only be called to resolve an 'auto' flex-basis");
   // If the flex item has ...
   //  - an intrinsic aspect ratio,
-  //  - a [used] flex-basis of 'main-size' [We have this, if we're here.]
+  //  - a [used] flex-basis of 'main-size' [auto?] [We have this, if we're here.]
   //  - a definite cross size
   // then the flex base size is calculated from its inner cross size and the
   // flex item’s intrinsic aspect ratio.
   if (aAxisTracker.GetCrossComponent(aIntrinsicRatio) != 0) {
     // We have a usable aspect ratio. (not going to divide by 0)
     const bool useMinSizeIfCrossSizeIsIndefinite = false;
     nscoord crossSizeToUseWithRatio =
       CrossSizeToUseWithRatio(aFlexItem, aItemReflowState,
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -24,17 +24,16 @@
 #include "nsReadableUtils.h"
 #include "nsStyleContext.h"
 #include "nsTableOuterFrame.h"
 #include "nsView.h"
 #include "nsViewManager.h"
 #include "nsIScrollableFrame.h"
 #include "nsPresContext.h"
 #include "nsStyleConsts.h"
-#include "nsStyleUtil.h"
 #include "nsIPresShell.h"
 #include "prlog.h"
 #include "prprf.h"
 #include "nsFrameManager.h"
 #include "nsLayoutUtils.h"
 #include "RestyleManager.h"
 
 #include "nsIDOMNode.h"
@@ -4089,30 +4088,42 @@ nsFrame::ComputeSize(nsRenderingContext 
   }
 
   bool isFlexItem = IsFlexItem();
   bool isInlineFlexItem = false;
  
   if (isFlexItem) {
     // Flex items use their "flex-basis" property in place of their main-size
     // property (e.g. "width") for sizing purposes, *unless* they have
-    // "flex-basis:main-size", in which case they use their main-size property
-    // after all.
+    // "flex-basis:auto", in which case they use their main-size property after
+    // all.
     uint32_t flexDirection = GetParent()->StylePosition()->mFlexDirection;
     isInlineFlexItem =
       flexDirection == NS_STYLE_FLEX_DIRECTION_ROW ||
       flexDirection == NS_STYLE_FLEX_DIRECTION_ROW_REVERSE;
 
     // NOTE: The logic here should match the similar chunk for determining
     // inlineStyleCoord and blockStyleCoord in
     // nsLayoutUtils::ComputeSizeWithIntrinsicDimensions().
     const nsStyleCoord* flexBasis = &(stylePos->mFlexBasis);
-    if (!nsStyleUtil::IsFlexBasisMainSize(*flexBasis, isInlineFlexItem)) {
-      (isInlineFlexItem ?
-       inlineStyleCoord : blockStyleCoord) = flexBasis;
+    if (flexBasis->GetUnit() != eStyleUnit_Auto) {
+      if (isInlineFlexItem) {
+        inlineStyleCoord = flexBasis;
+      } else {
+        // One caveat for vertical flex items: We don't support enumerated
+        // values (e.g. "max-content") for height properties yet. So, if our
+        // computed flex-basis is an enumerated value, we'll just behave as if
+        // it were "auto", which means "use the main-size property after all"
+        // (which is "height", in this case).
+        // NOTE: Once we support intrinsic sizing keywords for "height",
+        // we should remove this check.
+        if (flexBasis->GetUnit() != eStyleUnit_Enumerated) {
+          blockStyleCoord = flexBasis;
+        }
+      }
     }
   }
 
   // Compute inline-axis size
 
   if (inlineStyleCoord->GetUnit() != eStyleUnit_Auto) {
     result.ISize(aWM) =
       nsLayoutUtils::ComputeWidthValue(aRenderingContext, this,
--- a/layout/reftests/flexbox/flexbox-position-absolute-1.xhtml
+++ b/layout/reftests/flexbox/flexbox-position-absolute-1.xhtml
@@ -23,23 +23,23 @@
         border: 2px dotted black;
       }
       div.flexbox {
         width: 200px;
         height: 100px;
         display: flex;
       }
       div.a {
-        flex: 1 0 main-size;
+        flex: 1 0 auto;
         width: 30px;
         height: 100px;
         background: lightgreen;
       }
       div.b {
-        flex: 2 0 main-size;
+        flex: 2 0 auto;
         width: 20px;
         height: 100px;
         background: yellow;
       }
       div.inflex {
         flex: none;
         width: 20px;
         height: 100px;
--- a/layout/reftests/flexbox/flexbox-position-absolute-2.xhtml
+++ b/layout/reftests/flexbox/flexbox-position-absolute-2.xhtml
@@ -24,23 +24,23 @@
         border: 2px dotted black;
       }
       div.flexbox {
         width: 200px;
         height: 100px;
         display: flex;
       }
       div.a {
-        flex: 1 0 main-size;
+        flex: 1 0 auto;
         width: 30px;
         height: 100px;
         background: lightgreen;
       }
       div.b {
-        flex: 2 0 main-size;
+        flex: 2 0 auto;
         width: 20px;
         height: 100px;
         background: yellow;
       }
       div.inflex {
         flex: none;
         width: 20px;
         height: 100px;
--- a/layout/reftests/flexbox/flexbox-position-absolute-4.xhtml
+++ b/layout/reftests/flexbox/flexbox-position-absolute-4.xhtml
@@ -27,17 +27,17 @@
         left: 40px;
         width: 200px;
         height: 100px;
         display: flex;
         position: absolute;
         border: 1px solid black;
       }
       div.a {
-        flex: 1 0 main-size;
+        flex: 1 0 auto;
         width:  30px;
         height: 100px;
         background: lightgreen;
       }
       div.b {
         flex: 2 0 20px;
         height: 100px;
         background: yellow;
--- a/layout/reftests/flexbox/flexbox-position-fixed-1.xhtml
+++ b/layout/reftests/flexbox/flexbox-position-fixed-1.xhtml
@@ -23,23 +23,23 @@
         border: 2px dotted black;
       }
       div.flexbox {
         width: 200px;
         height: 100px;
         display: flex;
       }
       div.a {
-        flex: 1 0 main-size;
+        flex: 1 0 auto;
         width: 30px;
         height: 100px;
         background: lightgreen;
       }
       div.b {
-        flex: 2 0 main-size;
+        flex: 2 0 auto;
         width: 20px;
         height: 100px;
         background: yellow;
       }
       div.inflex {
         flex: none;
         width: 20px;
         height: 100px;
--- a/layout/reftests/flexbox/flexbox-position-fixed-2.xhtml
+++ b/layout/reftests/flexbox/flexbox-position-fixed-2.xhtml
@@ -24,23 +24,23 @@
         border: 2px dotted black;
       }
       div.flexbox {
         width: 200px;
         height: 100px;
         display: flex;
       }
       div.a {
-        flex: 1 0 main-size;
+        flex: 1 0 auto;
         width: 30px;
         height: 100px;
         background: lightgreen;
       }
       div.b {
-        flex: 2 0 main-size;
+        flex: 2 0 auto;
         width: 20px;
         height: 100px;
         background: yellow;
       }
       div.inflex {
         flex: none;
         width: 20px;
         height: 100px;
--- a/layout/reftests/flexbox/flexbox-position-fixed-4.xhtml
+++ b/layout/reftests/flexbox/flexbox-position-fixed-4.xhtml
@@ -27,17 +27,17 @@
         left: 40px;
         width: 200px;
         height: 100px;
         display: flex;
         position: fixed;
         border: 2px dashed teal;
       }
       div.a {
-        flex: 1 0 main-size;
+        flex: 1 0 auto;
         width:  30px;
         height: 100px;
         background: lightgreen;
       }
       div.b {
         flex: 2 0 20px;
         height: 100px;
         background: yellow;
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-horiz-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-horiz-1.xhtml
@@ -57,45 +57,45 @@
     <!-- D) Two canvas elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <canvas style="width: 33px; flex: 2 main-size"/>
-      <canvas style="width: 13px; flex: 3 main-size"/>
+      <canvas style="width: 33px; flex: 2 auto"/>
+      <canvas style="width: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <canvas style="width: 150px; flex: 1 4 main-size"/>
-      <canvas style="width: 100px; flex: 1 3 main-size"/>
+      <canvas style="width: 150px; flex: 1 4 auto"/>
+      <canvas style="width: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-width -->
     <!-- Same as (D), except we've added a max-width on the second element.
       -->
     <div class="flexbox">
-      <canvas style="width: 33px; flex: 2 main-size"/>
-      <canvas style="width: 13px; max-width: 90px; flex: 3 main-size"/>
+      <canvas style="width: 33px; flex: 2 auto"/>
+      <canvas style="width: 13px; max-width: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-width -->
     <!-- Same as (C), except we've added a min-width on the second element.
       -->
     <div class="flexbox">
-      <canvas style="width: 33px; flex: 2 main-size"/>
-      <canvas style="width: 13px; min-width: 150px; flex: 3 main-size"/>
+      <canvas style="width: 33px; flex: 2 auto"/>
+      <canvas style="width: 13px; min-width: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-1.xhtml
@@ -59,45 +59,45 @@
     <!-- D) Two canvas elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <canvas style="height: 33px; flex: 2 main-size"/>
-      <canvas style="height: 13px; flex: 3 main-size"/>
+      <canvas style="height: 33px; flex: 2 auto"/>
+      <canvas style="height: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <canvas style="height: 150px; flex: 1 4 main-size"/>
-      <canvas style="height: 100px; flex: 1 3 main-size"/>
+      <canvas style="height: 150px; flex: 1 4 auto"/>
+      <canvas style="height: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-height -->
     <!-- Same as (D), except we've added a max-height on the second element.
       -->
     <div class="flexbox">
-      <canvas style="height: 33px; flex: 2 main-size"/>
-      <canvas style="height: 13px; max-height: 90px; flex: 3 main-size"/>
+      <canvas style="height: 33px; flex: 2 auto"/>
+      <canvas style="height: 13px; max-height: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-height -->
     <!-- Same as (C), except we've added a min-height on the second element.
       -->
     <div class="flexbox">
-      <canvas style="height: 33px; flex: 2 main-size"/>
-      <canvas style="height: 13px; min-height: 150px; flex: 3 main-size"/>
+      <canvas style="height: 33px; flex: 2 auto"/>
+      <canvas style="height: 13px; min-height: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-horiz-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-horiz-1.xhtml
@@ -61,45 +61,45 @@
     <!-- D) Two fieldset elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <fieldset style="width: 33px; flex: 2 main-size"/>
-      <fieldset style="width: 13px; flex: 3 main-size"/>
+      <fieldset style="width: 33px; flex: 2 auto"/>
+      <fieldset style="width: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <fieldset style="width: 150px; flex: 1 4 main-size"/>
-      <fieldset style="width: 100px; flex: 1 3 main-size"/>
+      <fieldset style="width: 150px; flex: 1 4 auto"/>
+      <fieldset style="width: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-width -->
     <!-- Same as (D), except we've added a max-width on the second element.
       -->
     <div class="flexbox">
-      <fieldset style="width: 33px; flex: 2 main-size"/>
-      <fieldset style="width: 13px; max-width: 90px; flex: 3 main-size"/>
+      <fieldset style="width: 33px; flex: 2 auto"/>
+      <fieldset style="width: 13px; max-width: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-width -->
     <!-- Same as (C), except we've added a min-width on the second element.
       -->
     <div class="flexbox">
-      <fieldset style="width: 33px; flex: 2 main-size"/>
-      <fieldset style="width: 13px; min-width: 150px; flex: 3 main-size"/>
+      <fieldset style="width: 33px; flex: 2 auto"/>
+      <fieldset style="width: 13px; min-width: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-vert-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-vert-1.xhtml
@@ -63,45 +63,45 @@
     <!-- D) Two fieldset elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <fieldset style="height: 33px; flex: 2 main-size"/>
-      <fieldset style="height: 13px; flex: 3 main-size"/>
+      <fieldset style="height: 33px; flex: 2 auto"/>
+      <fieldset style="height: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <fieldset style="height: 150px; flex: 1 4 main-size"/>
-      <fieldset style="height: 100px; flex: 1 3 main-size"/>
+      <fieldset style="height: 150px; flex: 1 4 auto"/>
+      <fieldset style="height: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-height -->
     <!-- Same as (D), except we've added a max-height on the second element.
       -->
     <div class="flexbox">
-      <fieldset style="height: 33px; flex: 2 main-size"/>
-      <fieldset style="height: 13px; max-height: 90px; flex: 3 main-size"/>
+      <fieldset style="height: 33px; flex: 2 auto"/>
+      <fieldset style="height: 13px; max-height: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-height -->
     <!-- Same as (C), except we've added a min-height on the second element.
       -->
     <div class="flexbox">
-      <fieldset style="height: 33px; flex: 2 main-size"/>
-      <fieldset style="height: 13px; min-height: 150px; flex: 3 main-size"/>
+      <fieldset style="height: 33px; flex: 2 auto"/>
+      <fieldset style="height: 13px; min-height: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-horiz-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-horiz-1.xhtml
@@ -58,45 +58,45 @@
     <!-- D) Two iframe elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <iframe style="width: 33px; flex: 2 main-size"/>
-      <iframe style="width: 13px; flex: 3 main-size"/>
+      <iframe style="width: 33px; flex: 2 auto"/>
+      <iframe style="width: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <iframe style="width: 150px; flex: 1 4 main-size"/>
-      <iframe style="width: 100px; flex: 1 3 main-size"/>
+      <iframe style="width: 150px; flex: 1 4 auto"/>
+      <iframe style="width: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-width -->
     <!-- Same as (D), except we've added a max-width on the second element.
       -->
     <div class="flexbox">
-      <iframe style="width: 33px; flex: 2 main-size"/>
-      <iframe style="width: 13px; max-width: 90px; flex: 3 main-size"/>
+      <iframe style="width: 33px; flex: 2 auto"/>
+      <iframe style="width: 13px; max-width: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-width -->
     <!-- Same as (C), except we've added a min-width on the second element.
       -->
     <div class="flexbox">
-      <iframe style="width: 33px; flex: 2 main-size"/>
-      <iframe style="width: 13px; min-width: 150px; flex: 3 main-size"/>
+      <iframe style="width: 33px; flex: 2 auto"/>
+      <iframe style="width: 13px; min-width: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-vert-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-vert-1.xhtml
@@ -60,45 +60,45 @@
     <!-- D) Two iframe elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <iframe style="height: 33px; flex: 2 main-size"/>
-      <iframe style="height: 13px; flex: 3 main-size"/>
+      <iframe style="height: 33px; flex: 2 auto"/>
+      <iframe style="height: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <iframe style="height: 150px; flex: 1 4 main-size"/>
-      <iframe style="height: 100px; flex: 1 3 main-size"/>
+      <iframe style="height: 150px; flex: 1 4 auto"/>
+      <iframe style="height: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-height -->
     <!-- Same as (D), except we've added a max-height on the second element.
       -->
     <div class="flexbox">
-      <iframe style="height: 33px; flex: 2 main-size"/>
-      <iframe style="height: 13px; max-height: 90px; flex: 3 main-size"/>
+      <iframe style="height: 33px; flex: 2 auto"/>
+      <iframe style="height: 13px; max-height: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-height -->
     <!-- Same as (C), except we've added a min-height on the second element.
       -->
     <div class="flexbox">
-      <iframe style="height: 33px; flex: 2 main-size"/>
-      <iframe style="height: 13px; min-height: 150px; flex: 3 main-size"/>
+      <iframe style="height: 33px; flex: 2 auto"/>
+      <iframe style="height: 13px; min-height: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-img-horiz-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-img-horiz-1.xhtml
@@ -57,49 +57,47 @@
     <!-- D) Two img elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <img src="support/solidblue.png" style="width: 33px; flex: 2 main-size"/>
-      <img src="support/solidblue.png" style="width: 13px; flex: 3 main-size"/>
+      <img src="support/solidblue.png" style="width: 33px; flex: 2 auto"/>
+      <img src="support/solidblue.png" style="width: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <img src="support/solidblue.png"
-           style="width: 150px; flex: 1 4 main-size"/>
-      <img src="support/solidblue.png"
-           style="width: 100px; flex: 1 3 main-size"/>
+      <img src="support/solidblue.png" style="width: 150px; flex: 1 4 auto"/>
+      <img src="support/solidblue.png" style="width: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-width -->
     <!-- Same as (D), except we've added a max-width on the second element.
       -->
     <div class="flexbox">
-      <img src="support/solidblue.png" style="width: 33px; flex: 2 main-size"/>
+      <img src="support/solidblue.png" style="width: 33px; flex: 2 auto"/>
       <img src="support/solidblue.png"
-           style="width: 13px; max-width: 90px; flex: 3 main-size"/>
+           style="width: 13px; max-width: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-width -->
     <!-- Same as (C), except we've added a min-width on the second element.
       -->
     <div class="flexbox">
-      <img src="support/solidblue.png" style="width: 33px; flex: 2 main-size"/>
+      <img src="support/solidblue.png" style="width: 33px; flex: 2 auto"/>
       <img src="support/solidblue.png"
-           style="width: 13px; min-width: 150px; flex: 3 main-size"/>
+           style="width: 13px; min-width: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-img-vert-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-img-vert-1.xhtml
@@ -59,49 +59,47 @@
     <!-- D) Two img elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <img src="support/solidblue.png" style="height: 33px; flex: 2 main-size"/>
-      <img src="support/solidblue.png" style="height: 13px; flex: 3 main-size"/>
+      <img src="support/solidblue.png" style="height: 33px; flex: 2 auto"/>
+      <img src="support/solidblue.png" style="height: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <img src="support/solidblue.png"
-           style="height: 150px; flex: 1 4 main-size"/>
-      <img src="support/solidblue.png"
-           style="height: 100px; flex: 1 3 main-size"/>
+      <img src="support/solidblue.png" style="height: 150px; flex: 1 4 auto"/>
+      <img src="support/solidblue.png" style="height: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-height -->
     <!-- Same as (D), except we've added a max-height on the second element.
       -->
     <div class="flexbox">
-      <img src="support/solidblue.png" style="height: 33px; flex: 2 main-size"/>
+      <img src="support/solidblue.png" style="height: 33px; flex: 2 auto"/>
       <img src="support/solidblue.png"
-           style="height: 13px; max-height: 90px; flex: 3 main-size"/>
+           style="height: 13px; max-height: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-height -->
     <!-- Same as (C), except we've added a min-height on the second element.
       -->
     <div class="flexbox">
-      <img src="support/solidblue.png" style="height: 33px; flex: 2 main-size"/>
+      <img src="support/solidblue.png" style="height: 33px; flex: 2 auto"/>
       <img src="support/solidblue.png"
-           style="height: 13px; min-height: 150px; flex: 3 main-size"/>
+           style="height: 13px; min-height: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-textarea-horiz-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-textarea-horiz-1.xhtml
@@ -62,47 +62,47 @@
     <!-- D) Two textarea elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <textarea style="width: 33px; flex: 2 main-size"/>
-      <textarea style="width: 13px; flex: 3 main-size"/>
+      <textarea style="width: 33px; flex: 2 auto"/>
+      <textarea style="width: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <textarea style="width: 150px; flex: 1 4 main-size"/>
-      <textarea style="width: 100px; flex: 1 3 main-size"/>
+      <textarea style="width: 150px; flex: 1 4 auto"/>
+      <textarea style="width: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-width -->
     <!-- Same as (D), except we've added a max-width on the second element.
       -->
     <div class="flexbox">
-      <textarea style="width: 33px; flex: 2 main-size"/>
+      <textarea style="width: 33px; flex: 2 auto"/>
       <textarea
-         style="width: 13px; max-width: 90px; flex: 3 main-size"/>
+         style="width: 13px; max-width: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-width -->
     <!-- Same as (C), except we've added a min-width on the second element.
       -->
     <div class="flexbox">
-      <textarea style="width: 33px; flex: 2 main-size"/>
+      <textarea style="width: 33px; flex: 2 auto"/>
       <textarea
-         style="width: 13px; min-width: 150px; flex: 3 main-size"/>
+         style="width: 13px; min-width: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-textarea-vert-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-textarea-vert-1.xhtml
@@ -65,47 +65,47 @@
     <!-- D) Two textarea elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <textarea style="height: 33px; flex: 2 main-size"/>
-      <textarea style="height: 13px; flex: 3 main-size"/>
+      <textarea style="height: 33px; flex: 2 auto"/>
+      <textarea style="height: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <textarea style="height: 150px; flex: 1 4 main-size"/>
-      <textarea style="height: 100px; flex: 1 3 main-size"/>
+      <textarea style="height: 150px; flex: 1 4 auto"/>
+      <textarea style="height: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-height -->
     <!-- Same as (D), except we've added a max-height on the second element.
       -->
     <div class="flexbox">
-      <textarea style="height: 33px; flex: 2 main-size"/>
+      <textarea style="height: 33px; flex: 2 auto"/>
       <textarea
-         style="height: 13px; max-height: 90px; flex: 3 main-size"/>
+         style="height: 13px; max-height: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-height -->
     <!-- Same as (C), except we've added a min-height on the second element.
       -->
     <div class="flexbox">
-      <textarea style="height: 33px; flex: 2 main-size"/>
+      <textarea style="height: 33px; flex: 2 auto"/>
       <textarea
-         style="height: 13px; min-height: 150px; flex: 3 main-size"/>
+         style="height: 13px; min-height: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-video-horiz-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-video-horiz-1.xhtml
@@ -57,45 +57,45 @@
     <!-- D) Two video elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <video style="width: 33px; flex: 2 main-size"/>
-      <video style="width: 13px; flex: 3 main-size"/>
+      <video style="width: 33px; flex: 2 auto"/>
+      <video style="width: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <video style="width: 150px; flex: 1 4 main-size"/>
-      <video style="width: 100px; flex: 1 3 main-size"/>
+      <video style="width: 150px; flex: 1 4 auto"/>
+      <video style="width: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-width -->
     <!-- Same as (D), except we've added a max-width on the second element.
       -->
     <div class="flexbox">
-      <video style="width: 33px; flex: 2 main-size"/>
-      <video style="width: 13px; max-width: 90px; flex: 3 main-size"/>
+      <video style="width: 33px; flex: 2 auto"/>
+      <video style="width: 13px; max-width: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-width -->
     <!-- Same as (C), except we've added a min-width on the second element.
       -->
     <div class="flexbox">
-      <video style="width: 33px; flex: 2 main-size"/>
-      <video style="width: 13px; min-width: 150px; flex: 3 main-size"/>
+      <video style="width: 33px; flex: 2 auto"/>
+      <video style="width: 13px; min-width: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-video-vert-1.xhtml
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-video-vert-1.xhtml
@@ -59,45 +59,45 @@
     <!-- D) Two video elements, getting stretched by different ratios, from
          different flex bases.
 
          Space-to-be-distributed = 200px - (33 + 1 + 1) - (13 + 1 + 1) = 150px
          1st element gets 2/5 of space: 33px + 2/5 * 150px = 93px
          1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px
       -->
     <div class="flexbox">
-      <video style="height: 33px; flex: 2 main-size"/>
-      <video style="height: 13px; flex: 3 main-size"/>
+      <video style="height: 33px; flex: 2 auto"/>
+      <video style="height: 13px; flex: 3 auto"/>
     </div>
 
     <!-- E) Two flex items, getting shrunk by different amounts.
 
          Space-to-be-distributed = 200px - (150 + 1 + 1) - (100 + 1 + 1) = -54px
          First element scaled flex ratio = 4 * 150 = 600
          Second element scaled flex ratio = 3 * 100 = 300
            * So, total flexibility is 600 + 300 = 900
 
          1st element gets 600/900 of space: 150 + 600/900 * -54 = 114px
          2nd element gets 300/900 of space: 100 + 300/900 * -54 = 82px
       -->
     <div class="flexbox">
-      <video style="height: 150px; flex: 1 4 main-size"/>
-      <video style="height: 100px; flex: 1 3 main-size"/>
+      <video style="height: 150px; flex: 1 4 auto"/>
+      <video style="height: 100px; flex: 1 3 auto"/>
     </div>
 
     <!-- F) Making sure we don't grow past max-height -->
     <!-- Same as (D), except we've added a max-height on the second element.
       -->
     <div class="flexbox">
-      <video style="height: 33px; flex: 2 main-size"/>
-      <video style="height: 13px; max-height: 90px; flex: 3 main-size"/>
+      <video style="height: 33px; flex: 2 auto"/>
+      <video style="height: 13px; max-height: 90px; flex: 3 auto"/>
     </div>
 
     <!-- G) Making sure we grow at least as large as min-height -->
     <!-- Same as (C), except we've added a min-height on the second element.
       -->
     <div class="flexbox">
-      <video style="height: 33px; flex: 2 main-size"/>
-      <video style="height: 13px; min-height: 150px; flex: 3 main-size"/>
+      <video style="height: 33px; flex: 2 auto"/>
+      <video style="height: 13px; min-height: 150px; flex: 3 auto"/>
     </div>
 
   </body>
 </html>
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-collapsed-item-horiz-1-ref.html
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-collapsed-item-horiz-1-ref.html
@@ -25,17 +25,17 @@
       /* All flex items have 20px base size */
       width: 20px;
     }
     .collapse {
       flex-basis: 0;
       height: 20px;
     }
     .flexible {
-      flex: 1 main-size;
+      flex: 1 auto;
     }
     .heightTall {
       height: 40px;
       background: purple;
     }
     .heightAuto {
       background: teal;
     }
--- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-collapsed-item-horiz-1.html
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-collapsed-item-horiz-1.html
@@ -21,17 +21,17 @@
     .flexContainer > * {
       /* All flex items have 20px base size */
       width: 20px;
     }
     .collapse {
       visibility: collapse;
     }
     .flexible {
-      flex: 1 main-size;
+      flex: 1 auto;
     }
     .heightTall {
       height: 40px;
       background: purple;
     }
     .heightAuto {
       background: teal;
     }
--- a/layout/style/nsCSSKeywordList.h
+++ b/layout/style/nsCSSKeywordList.h
@@ -335,17 +335,16 @@ CSS_KEY(lining-nums, lining_nums)
 CSS_KEY(list-item, list_item)
 CSS_KEY(local, local)
 CSS_KEY(logical, logical)
 CSS_KEY(looped, looped)
 CSS_KEY(lowercase, lowercase)
 CSS_KEY(ltr, ltr)
 CSS_KEY(luminance, luminance)
 CSS_KEY(luminosity, luminosity)
-CSS_KEY(main-size, main_size)
 CSS_KEY(manipulation, manipulation)
 CSS_KEY(manual, manual)
 CSS_KEY(margin-box, margin_box)
 CSS_KEY(markers, markers)
 CSS_KEY(matrix, matrix)
 CSS_KEY(matrix3d, matrix3d)
 CSS_KEY(max-content, max_content)
 CSS_KEY(medium, medium)
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -7404,22 +7404,21 @@ CSSParserImpl::ParseFlex()
   nsCSSValue tmpVal;
   if (ParseVariant(tmpVal, VARIANT_INHERIT, nullptr)) {
     AppendValue(eCSSProperty_flex_grow, tmpVal);
     AppendValue(eCSSProperty_flex_shrink, tmpVal);
     AppendValue(eCSSProperty_flex_basis, tmpVal);
     return true;
   }
 
-  // Next, check for 'none' == '0 0 main-size'
+  // Next, check for 'none' == '0 0 auto'
   if (ParseVariant(tmpVal, VARIANT_NONE, nullptr)) {
     AppendValue(eCSSProperty_flex_grow, nsCSSValue(0.0f, eCSSUnit_Number));
     AppendValue(eCSSProperty_flex_shrink, nsCSSValue(0.0f, eCSSUnit_Number));
-    AppendValue(eCSSProperty_flex_basis,
-                nsCSSValue(NS_STYLE_FLEX_BASIS_MAIN_SIZE, eCSSUnit_Enumerated));
+    AppendValue(eCSSProperty_flex_basis, nsCSSValue(eCSSUnit_Auto));
     return true;
   }
 
   // OK, try parsing our value as individual per-subproperty components:
   //   [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
 
   // Each subproperty has a default value that it takes when it's omitted in a
   // "flex" shorthand value. These default values are *only* for the shorthand
@@ -7449,17 +7448,17 @@ CSSParserImpl::ParseFlex()
   //
   // NOTE: if we encounter unitless 0 here, we *must* interpret it as a
   // 'flex-grow' value (a number), *not* as a 'flex-basis' value (a length).
   // Conveniently, that's the behavior this combined variant-mask gives us --
   // it'll treat unitless 0 as a number. The flexbox spec requires this:
   // "a unitless zero that is not already preceded by two flex factors must be
   //  interpreted as a flex factor.
   if (!ParseNonNegativeVariant(tmpVal, flexBasisVariantMask | VARIANT_NUMBER,
-                               nsCSSProps::kFlexBasisKTable)) {
+                               nsCSSProps::kWidthKTable)) {
     // First component was not a valid flex-basis or flex-grow value. Fail.
     return false;
   }
 
   // Record what we just parsed as either flex-basis or flex-grow:
   bool wasFirstComponentFlexBasis = (tmpVal.GetUnit() != eCSSUnit_Number);
   (wasFirstComponentFlexBasis ? flexBasis : flexGrow) = tmpVal;
 
@@ -7467,25 +7466,16 @@ CSSParserImpl::ParseFlex()
   bool doneParsing = false;
   if (wasFirstComponentFlexBasis) {
     if (ParseNonNegativeVariant(tmpVal, VARIANT_NUMBER, nullptr)) {
       flexGrow = tmpVal;
     } else {
       // Failed to parse anything after our flex-basis -- that's fine. We can
       // skip the remaining parsing.
       doneParsing = true;
-      if (flexBasis.GetUnit() == eCSSUnit_Auto) {
-        // We've just parsed "flex:auto", without a number after "auto".  In
-        // this case, "auto" is *not* actually the flex-basis -- it's a special
-        // keyword for the "flex" shorthand, which expands to "1 1 main-size".
-        // Fortunately, the variables flexGrow & flexShrink are already set to
-        // 1, so we don't need to adjust them; we just need to set flexBasis.
-        flexBasis.SetIntValue(NS_STYLE_FLEX_BASIS_MAIN_SIZE,
-                              eCSSUnit_Enumerated);
-      }
     }
   }
 
   if (!doneParsing) {
     // (c) OK -- the last thing we parsed was flex-grow, so look for a
     //     flex-shrink in the next position.
     if (ParseNonNegativeVariant(tmpVal, VARIANT_NUMBER, nullptr)) {
       flexShrink = tmpVal;
@@ -7506,17 +7496,17 @@ CSSParserImpl::ParseFlex()
     // accepted this unitless 0 as the 'flex-shrink' value, up above (since
     // it's a valid flex-shrink value), and we'd have moved on to the next
     // token (if any). And of course, if we instead had a unitless 0 preceded
     // by *no* flex factors (if it were the first token), we would've already
     // parsed it in our very first call to ParseNonNegativeVariant().  So, any
     // unitless 0 encountered here *must* have been preceded by 2 flex factors.
     if (!wasFirstComponentFlexBasis &&
         ParseNonNegativeVariant(tmpVal, flexBasisVariantMask,
-                                nsCSSProps::kFlexBasisKTable)) {
+                                nsCSSProps::kWidthKTable)) {
       flexBasis = tmpVal;
     }
   }
 
   AppendValue(eCSSProperty_flex_grow,   flexGrow);
   AppendValue(eCSSProperty_flex_shrink, flexShrink);
   AppendValue(eCSSProperty_flex_basis,  flexBasis);
 
--- a/layout/style/nsCSSPropList.h
+++ b/layout/style/nsCSSPropList.h
@@ -1652,17 +1652,17 @@ CSS_PROP_POSITION(
     CSS_PROPERTY_PARSE_VALUE |
         CSS_PROPERTY_VALUE_NONNEGATIVE |
         CSS_PROPERTY_STORES_CALC,
     "",
     // NOTE: The parsing implementation for the 'flex' shorthand property has
     // its own code to parse each subproperty. It does not depend on the
     // longhand parsing defined here.
     VARIANT_AHKLP | VARIANT_CALC,
-    kFlexBasisKTable,
+    kWidthKTable,
     offsetof(nsStylePosition, mFlexBasis),
     eStyleAnimType_Coord)
 CSS_PROP_POSITION(
     flex-direction,
     flex_direction,
     FlexDirection,
     CSS_PROPERTY_PARSE_VALUE,
     "",
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -1120,25 +1120,16 @@ const KTableValue nsCSSProps::kAlignSelf
   eCSSKeyword_flex_end,   NS_STYLE_ALIGN_ITEMS_FLEX_END,
   eCSSKeyword_center,     NS_STYLE_ALIGN_ITEMS_CENTER,
   eCSSKeyword_baseline,   NS_STYLE_ALIGN_ITEMS_BASELINE,
   eCSSKeyword_stretch,    NS_STYLE_ALIGN_ITEMS_STRETCH,
   eCSSKeyword_auto,       NS_STYLE_ALIGN_SELF_AUTO,
   eCSSKeyword_UNKNOWN,-1
 };
 
-const KTableValue nsCSSProps::kFlexBasisKTable[] = {
-  eCSSKeyword__moz_max_content, NS_STYLE_WIDTH_MAX_CONTENT,
-  eCSSKeyword__moz_min_content, NS_STYLE_WIDTH_MIN_CONTENT,
-  eCSSKeyword__moz_fit_content, NS_STYLE_WIDTH_FIT_CONTENT,
-  eCSSKeyword__moz_available,   NS_STYLE_WIDTH_AVAILABLE,
-  eCSSKeyword_main_size,        NS_STYLE_FLEX_BASIS_MAIN_SIZE,
-  eCSSKeyword_UNKNOWN,-1
-};
-
 const KTableValue nsCSSProps::kFlexDirectionKTable[] = {
   eCSSKeyword_row,            NS_STYLE_FLEX_DIRECTION_ROW,
   eCSSKeyword_row_reverse,    NS_STYLE_FLEX_DIRECTION_ROW_REVERSE,
   eCSSKeyword_column,         NS_STYLE_FLEX_DIRECTION_COLUMN,
   eCSSKeyword_column_reverse, NS_STYLE_FLEX_DIRECTION_COLUMN_REVERSE,
   eCSSKeyword_UNKNOWN,-1
 };
 
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -561,17 +561,16 @@ public:
   // Not const because we modify its entries when the pref
   // "layout.css.grid.enabled" changes:
   static KTableValue kDisplayKTable[];
   static const KTableValue kElevationKTable[];
   static const KTableValue kEmptyCellsKTable[];
   static const KTableValue kAlignContentKTable[];
   static const KTableValue kAlignItemsKTable[];
   static const KTableValue kAlignSelfKTable[];
-  static const KTableValue kFlexBasisKTable[];
   static const KTableValue kFlexDirectionKTable[];
   static const KTableValue kFlexWrapKTable[];
   static const KTableValue kJustifyContentKTable[];
   static const KTableValue kFloatKTable[];
   static const KTableValue kFloatEdgeKTable[];
   static const KTableValue kFontKTable[];
   static const KTableValue kFontKerningKTable[];
   static const KTableValue kFontSizeKTable[];
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -3666,17 +3666,17 @@ nsComputedDOMStyle::DoGetFlexBasis()
   //     if (my flex container is horizontal) {
   //       percentageBaseGetter = &nsComputedDOMStyle::GetCBContentWidth;
   //     } else {
   //       percentageBaseGetter = &nsComputedDOMStyle::GetCBContentHeight;
   //     }
   //   }
 
   SetValueToCoord(val, StylePosition()->mFlexBasis, true,
-                  nullptr, nsCSSProps::kFlexBasisKTable);
+                  nullptr, nsCSSProps::kWidthKTable);
   return val;
 }
 
 CSSValue*
 nsComputedDOMStyle::DoGetFlexDirection()
 {
   nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
   val->SetIdent(
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -7547,28 +7547,20 @@ nsRuleNode::ComputePositionData(void* aS
                 SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
                 parentPos->mAlignSelf, // (unused -- we handled inherit above)
                 NS_STYLE_ALIGN_SELF_AUTO, // initial == auto
                 0, 0, 0, 0);
   }
 
   // flex-basis: auto, length, percent, enum, calc, inherit, initial
   // (Note: The flags here should match those used for 'width' property above.)
-  const nsCSSValue* flexBasisValue = aRuleData->ValueForFlexBasis();
-  if (!SetCoord(*flexBasisValue,
-                pos->mFlexBasis, parentPos->mFlexBasis,
-                SETCOORD_LPAEH | SETCOORD_STORE_CALC,
-                aContext, mPresContext, canStoreInRuleTree)) {
-    if (eCSSUnit_Initial == flexBasisValue->GetUnit() ||
-        eCSSUnit_Unset == flexBasisValue->GetUnit()) {
-      // flex-basis initial value is "main-size"
-      pos->mFlexBasis.SetIntValue(NS_STYLE_FLEX_BASIS_MAIN_SIZE,
-                                  eStyleUnit_Enumerated);
-    }
-  }
+  SetCoord(*aRuleData->ValueForFlexBasis(), pos->mFlexBasis, parentPos->mFlexBasis,
+           SETCOORD_LPAEH | SETCOORD_INITIAL_AUTO | SETCOORD_STORE_CALC |
+             SETCOORD_UNSET_INITIAL,
+           aContext, mPresContext, canStoreInRuleTree);
 
   // flex-direction: enum, inherit, initial
   SetDiscrete(*aRuleData->ValueForFlexDirection(),
               pos->mFlexDirection, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
               parentPos->mFlexDirection,
               NS_STYLE_FLEX_DIRECTION_ROW, 0, 0, 0, 0);
 
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -587,22 +587,16 @@ static inline mozilla::css::Side operato
 #define NS_MATHML_DISPLAYSTYLE_INLINE           0
 #define NS_MATHML_DISPLAYSTYLE_BLOCK            1
 
 // See nsStylePosition::mWidth, mMinWidth, mMaxWidth
 #define NS_STYLE_WIDTH_MAX_CONTENT              0
 #define NS_STYLE_WIDTH_MIN_CONTENT              1
 #define NS_STYLE_WIDTH_FIT_CONTENT              2
 #define NS_STYLE_WIDTH_AVAILABLE                3
-// NOTE: The "main-size" keyword here is really for the "flex-basis" property,
-// not for width / min-width / max-width.  I'm listing it here with the "width"
-// keywords' enumerated values, because we need to make sure it doesn't collide
-// with any "width" enumerated values (because "flex-basis" accepts all valid
-// "width" keywords, in addition to accepting "main-size").
-#define NS_STYLE_FLEX_BASIS_MAIN_SIZE           4
 
 // See nsStyleDisplay.mPosition
 #define NS_STYLE_POSITION_STATIC                0
 #define NS_STYLE_POSITION_RELATIVE              1
 #define NS_STYLE_POSITION_ABSOLUTE              2
 #define NS_STYLE_POSITION_FIXED                 3
 #define NS_STYLE_POSITION_STICKY                4
 
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1230,17 +1230,17 @@ nsStylePosition::nsStylePosition(void)
   mOffset.SetRight(autoCoord);
   mOffset.SetBottom(autoCoord);
   mWidth.SetAutoValue();
   mMinWidth.SetAutoValue();
   mMaxWidth.SetNoneValue();
   mHeight.SetAutoValue();
   mMinHeight.SetAutoValue();
   mMaxHeight.SetNoneValue();
-  mFlexBasis.SetIntValue(NS_STYLE_FLEX_BASIS_MAIN_SIZE, eStyleUnit_Enumerated);
+  mFlexBasis.SetAutoValue();
 
   // The initial value of grid-auto-columns and grid-auto-rows is 'auto',
   // which computes to 'minmax(min-content, max-content)'.
   mGridAutoColumnsMin.SetIntValue(NS_STYLE_GRID_TRACK_BREADTH_MIN_CONTENT,
                                   eStyleUnit_Enumerated);
   mGridAutoColumnsMax.SetIntValue(NS_STYLE_GRID_TRACK_BREADTH_MAX_CONTENT,
                                   eStyleUnit_Enumerated);
   mGridAutoRowsMin.SetIntValue(NS_STYLE_GRID_TRACK_BREADTH_MIN_CONTENT,
--- a/layout/style/nsStyleUtil.cpp
+++ b/layout/style/nsStyleUtil.cpp
@@ -537,39 +537,16 @@ nsStyleUtil::IsSignificantChild(nsIConte
   }
 
   return aTextIsSignificant && isText && aChild->TextLength() != 0 &&
          (aWhitespaceIsSignificant ||
           !aChild->TextIsOnlyWhitespace());
 }
 
 /* static */ bool
-nsStyleUtil::IsFlexBasisMainSize(const nsStyleCoord& aFlexBasis,
-                                 bool aIsMainAxisHorizontal)
-{
-  // "main-size" is stored as an enumerated value; so if we're not enumerated,
-  // we're not "main-size".
-  if (aFlexBasis.GetUnit() != eStyleUnit_Enumerated) {
-    return false;
-  }
-
-  if (!aIsMainAxisHorizontal) {
-    // Special case for vertical flex items: We don't support any enumerated
-    // values (e.g. "-moz-max-content") for "height"-flavored properties
-    // yet. So, if our computed flex-basis is *any* enumerated value, we'll
-    // just behave as if it were "main-size" (the initial value of flex-basis).
-    // NOTE: Once we support intrinsic sizing keywords for "height",
-    // we can remove this special-case.
-    return true;
-  }
-
-  return aFlexBasis.GetIntValue() == NS_STYLE_FLEX_BASIS_MAIN_SIZE;
-}
-
-/* static */ bool
 nsStyleUtil::CSPAllowsInlineStyle(nsIContent* aContent,
                                   nsIPrincipal* aPrincipal,
                                   nsIURI* aSourceURI,
                                   uint32_t aLineNumber,
                                   const nsSubstring& aStyleText,
                                   nsresult* aRv)
 {
   nsresult rv;
--- a/layout/style/nsStyleUtil.h
+++ b/layout/style/nsStyleUtil.h
@@ -105,33 +105,16 @@ public:
   static float ColorComponentToFloat(uint8_t aAlpha);
 
   /*
    * Does this child count as significant for selector matching?
    */
   static bool IsSignificantChild(nsIContent* aChild,
                                    bool aTextIsSignificant,
                                    bool aWhitespaceIsSignificant);
-
-  /*
-   * Should we treat the given "flex-basis" value as "main-size"?
-   *
-   * In a horizontal flex container, this is merely a check for whether
-   * aFlexBasis has the enumerated value NS_STYLE_FLEX_BASIS_MAIN_SIZE.
-   *
-   * In a vertical flex container, we *also* treat other enumerated
-   * values (like "NS_STYLE_WIDTH_MAX_CONTENT") as if they were "main-size"
-   * (and return true from this function), because we don't currently support
-   * those other values for vertical/height-flavored properties. So, if we
-   * encounter them, we fall back to behaving as if we had flex-basis's initial
-   * value.
-   */
-  static bool IsFlexBasisMainSize(const nsStyleCoord& aFlexBasis,
-                                  bool aIsMainAxisHorizontal);
-
   /*
    *  Does this principal have a CSP that blocks the application of
    *  inline styles? Returns false if application of the style should
    *  be blocked.
    *
    *  @param aContent
    *      The <style> element that the caller wants to know whether to honor.
    *      Included to check the nonce attribute if one is provided. Allowed to
--- a/layout/style/test/flexbox_layout_testcases.js
+++ b/layout/style/test/flexbox_layout_testcases.js
@@ -474,18 +474,17 @@ var gFlexboxTestcases =
          "flex": "2999998",
          // NOTE: Expected value is off slightly, from float error when
          // resolving flexible lengths & when generating computed value string:
          "_main-size": [ null,  "3000000px" ]
        },
      ]
  },
 
- // Trying "flex: auto" (== "1 1 main-size") on one flex item, w/ a mix of
- // flex-grow/flex-basis values on the other flex items.
+ // Trying "flex: auto" (== "1 1 auto") w/ a mix of flex-grow/flex-basis values
  {
    items:
      [
        {
          "flex": "auto",
          "_main-size": [ null, "45px" ]
        },
        {
@@ -706,17 +705,17 @@ var gFlexboxTestcases =
    items:
      [
        {
          "flex": "auto",
          "_min-main-size": "20px",
          "_main-size": [ null,  "20px" ]
        },
        {
-         "flex": "9 main-size",
+         "flex": "9 auto",
          "_min-main-size": "150px",
          "_main-size": [ "50px",  "180px" ]
        },
      ]
  },
  {
    items:
      [
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -119,17 +119,16 @@ skip-if = toolkit == 'android' #bug 5366
 [test_css_supports_variables.html]
 [test_default_bidi_css.html]
 [test_descriptor_storage.html]
 [test_descriptor_syntax_errors.html]
 [test_dont_use_document_colors.html]
 [test_extra_inherit_initial.html]
 [test_flexbox_align_self_auto.html]
 [test_flexbox_child_display_values.xhtml]
-[test_flexbox_flex_basis_values.html]
 [test_flexbox_flex_grow_and_shrink.html]
 [test_flexbox_flex_shorthand.html]
 [test_flexbox_layout.html]
 support-files = flexbox_layout_testcases.js
 [test_flexbox_min_size_auto.html]
 [test_flexbox_order.html]
 [test_flexbox_order_table.html]
 [test_font_face_parser.html]
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -3889,28 +3889,23 @@ var gCSSProperties = {
     domProp: "flex",
     inherited: false,
     type: CSS_TYPE_TRUE_SHORTHAND,
     subproperties: [
       "flex-grow",
       "flex-shrink",
       "flex-basis"
     ],
-    initial_values: [ "0 1 main-size", "main-size 0 1", "0 main-size", "main-size 0" ],
+    initial_values: [ "0 1 auto", "auto 0 1", "0 auto", "auto 0" ],
     other_values: [
       "none",
-      "auto",
       "1",
       "0",
       "0 1",
       "0.5",
-      "5px",
-      "15%",
-      "calc(5px)",
-      "main-size",
       "1.2 3.4",
       "0 0 0",
       "0 0 0px",
       "0px 0 0",
       "5px 0 0",
       "2 auto",
       "auto 4",
       "auto 5.6 7.8",
@@ -3929,25 +3924,23 @@ var gCSSProperties = {
       "-1",
       "1 -1"
     ]
   },
   "flex-basis": {
     domProp: "flexBasis",
     inherited: false,
     type: CSS_TYPE_LONGHAND,
-    initial_values: [ "main-size" ],
+    initial_values: [ " auto" ],
         // NOTE: This is cribbed directly from the "width" chunk, since this
         // property takes the exact same values as width (albeit with
         // different semantics on 'auto').
         // XXXdholbert (Maybe these should get separated out into
         // a reusable array defined at the top of this file?)
-    other_values: [
-      "auto",
-      "15px", "3em", "15%", "-moz-max-content", "-moz-min-content", "-moz-fit-content", "-moz-available",
+    other_values: [ "15px", "3em", "15%", "-moz-max-content", "-moz-min-content", "-moz-fit-content", "-moz-available",
       // valid calc() values
       "calc(-2px)",
       "calc(2px)",
       "calc(50%)",
       "calc(50% + 2px)",
       "calc( 50% + 2px)",
       "calc(50% + 2px )",
       "calc( 50% + 2px )",
deleted file mode 100644
--- a/layout/style/test/test_flexbox_flex_basis_values.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1032922
--->
-<head>
-  <meta charset="utf-8">
-  <title>
-    Test that 'flex-basis' accepts all valid values for 'width' and 'height'
-    (helper for Bug 1032922)
-  </title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="property_database.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-<div id="testnode"></div>
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.7">
-"use strict";
-
-/**
- * Test that 'flex-basis' accepts all valid values for 'width' and 'height'
- * (helper for Bug 1032922)
- *
- * PEDANTIC NOTE: Technically, the flexbox spec's "value" definition for
- * "flex-basis" only says it accepts "main-size | <'width'>" -- there's no
- * mention of <'height'>.
- *
- * However, the prose later on is clear that all valid "height" values are
- * supposed to be accepted as well:
- *  # The flex-basis property [...] accepts the same values
- *  # as the 'width' and 'height' property.
- * http://dev.w3.org/csswg/css-flexbox/#propdef-flex-basis
- *
- * Presumably the spec's value-definition omits <'height'> just for brevity's
- * sake, since <'width'> already covers the full range of valid "height"
- * values (for now at least; and probably forever).
- *
- * In any case: in this test, we ensure that flex-basis really does accept all
- * of property_database's valid sample-values for both "width" *and* "height",
- * to be on the safe side.
- */
-
-function check_accepted(decl, origPropName, val)
-{
-  decl.setProperty("flex-basis", val, "");
-
-  // Note: decl.getPropertyValue() will return something non-empty here if the
-  // value was parsed successfully. Otherwise (i.e. if the value is rejected),
-  // it'll return the empty string.
-  isnot(decl.getPropertyValue("flex-basis"), "",
-       "value '" + val + "' which is valid for '" + origPropName +
-       "' should also be valid for 'flex-basis' ");
-
-  decl.removeProperty("flex-basis");
-}
-
-function main()
-{
-  let decl = document.getElementById("testnode").style;
-
-  let props = [ "width", "height" ];
-  props.forEach(function(prop) {
-    let info = gCSSProperties[prop];
-    let all_values = info.initial_values.concat(info.other_values);
-    all_values.forEach(function(value) {
-      check_accepted(decl, prop, value);
-    });
-  });
-}
-
-main();
-
-</script>
-</pre>
-</body>
-</html>
--- a/layout/style/test/test_flexbox_flex_shorthand.html
+++ b/layout/style/test/test_flexbox_flex_shorthand.html
@@ -63,41 +63,32 @@ let gFlexShorthandTestcases = [
   // Initial values of subproperties:
   // --------------------------------
   // (checked by another test that uses property_database.js, too, but
   // might as well check here, too, for thoroughness).
   {
     "flex":        "",
     "flex-grow":   "0",
     "flex-shrink": "1",
-    "flex-basis":  "main-size",
+    "flex-basis":  "auto",
   },
   {
     "flex":        "initial",
     "flex-grow":   "0",
     "flex-shrink": "1",
-    "flex-basis":  "main-size",
+    "flex-basis":  "auto",
   },
 
-  // Special keyword "none" --> "0 0 main-size"
+  // Special keyword "none" --> "0 0 auto"
   // -------------------------------------
   {
     "flex":        "none",
     "flex-grow":   "0",
     "flex-shrink": "0",
-    "flex-basis":  "main-size",
-  },
-
-  // Special keyword "auto" --> "1 1 main-size"
-  // -------------------------------------
-  {
-    "flex":        "auto",
-    "flex-grow":   "1",
-    "flex-shrink": "1",
-    "flex-basis":  "main-size",
+    "flex-basis":  "auto",
   },
 
   // One Value (numeric) --> sets flex-grow
   // --------------------------------------
   {
     "flex":        "0",
     "flex-grow":   "0",
   },
@@ -132,31 +123,31 @@ let gFlexShorthandTestcases = [
     "flex":        "25px",
     "flex-basis":  "25px",
   },
   {
     "flex":        "5%",
     "flex-basis":  "5%",
   },
   {
+    "flex":        "auto",
+    "flex-basis":  "auto",
+  },
+  {
     "flex":        "-moz-fit-content",
     "flex-basis":  "-moz-fit-content",
   },
   {
     "flex":        "calc(5px + 6px)",
     "flex-basis":  "11px",
   },
   {
     "flex":        "calc(15% + 30px)",
     "flex-basis":  "calc(30px + 15%)",
   },
-  {
-    "flex":        "main-size",
-    "flex-basis":  "main-size",
-  },
 
   // Two Values (numeric) --> sets flex-grow, flex-shrink
   // ----------------------------------------------------
   {
     "flex":        "0 0",
     "flex-grow":   "0",
     "flex-shrink": "0",
   },
@@ -209,21 +200,16 @@ let gFlexShorthandTestcases = [
     "flex-basis":  "99%",
   },
   {
     "flex":        "auto 5",
     "flex-grow":   "5",
     "flex-basis":  "auto",
   },
   {
-    "flex":        "main-size 5",
-    "flex-grow":   "5",
-    "flex-basis":  "main-size",
-  },
-  {
     "flex":        "5 -moz-fit-content",
     "flex-grow":   "5",
     "flex-basis":  "-moz-fit-content",
   },
   {
     "flex":        "calc(5% + 10px) 3",
     "flex-grow":   "3",
     "flex-basis":  "calc(10px + 5%)",
--- a/media/libstagefright/binding/Adts.cpp
+++ b/media/libstagefright/binding/Adts.cpp
@@ -28,18 +28,18 @@ Adts::GetFrequencyIndex(uint16_t aSample
   if (!freq_lookup[i]) {
     return -1;
   }
 
   return i;
 }
 
 bool
-Adts::ConvertEsdsToAdts(uint16_t aChannelCount, int8_t aFrequencyIndex,
-                        int8_t aProfile, MP4Sample* aSample)
+Adts::ConvertSample(uint16_t aChannelCount, int8_t aFrequencyIndex,
+                    int8_t aProfile, MP4Sample* aSample)
 {
   static const int kADTSHeaderSize = 7;
 
   size_t newSize = aSample->size + kADTSHeaderSize;
 
   // ADTS header uses 13 bits for packet size.
   if (newSize >= (1 << 13) || aChannelCount > 15 ||
       aFrequencyIndex < 0 || aProfile < 1 || aProfile > 4)
--- a/media/libstagefright/binding/include/mp4_demuxer/Adts.h
+++ b/media/libstagefright/binding/include/mp4_demuxer/Adts.h
@@ -11,14 +11,14 @@ namespace mp4_demuxer
 {
 
 class MP4Sample;
 
 class Adts
 {
 public:
   static int8_t GetFrequencyIndex(uint16_t aSamplesPerSecond);
-  static bool ConvertEsdsToAdts(uint16_t aChannelCount, int8_t aFrequencyIndex,
-                                int8_t aProfile, MP4Sample* aSample);
+  static bool ConvertSample(uint16_t aChannelCount, int8_t aFrequencyIndex,
+                            int8_t aProfile, MP4Sample* aSample);
 };
 }
 
 #endif
--- a/media/libstagefright/binding/mp4_demuxer.cpp
+++ b/media/libstagefright/binding/mp4_demuxer.cpp
@@ -2,17 +2,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "include/MPEG4Extractor.h"
 #include "media/stagefright/DataSource.h"
 #include "media/stagefright/MediaDefs.h"
 #include "media/stagefright/MediaSource.h"
 #include "media/stagefright/MetaData.h"
-#include "mp4_demuxer/Adts.h"
 #include "mp4_demuxer/mp4_demuxer.h"
 #include "mp4_demuxer/Index.h"
 #include "MediaResource.h"
 
 #include <stdint.h>
 #include <algorithm>
 #include <limits>
 
@@ -170,23 +169,16 @@ MP4Demuxer::DemuxAudioSample()
     mPrivate->mAudio->read(&sample->mMediaBuffer, &mPrivate->mAudioOptions);
   mPrivate->mAudioOptions.clearSeekTo();
 
   if (status < 0) {
     return nullptr;
   }
 
   sample->Update();
-  if (!strcmp(mAudioConfig.mime_type, MEDIA_MIMETYPE_AUDIO_AAC)) {
-    if (!Adts::ConvertEsdsToAdts(mAudioConfig.channel_count,
-                                 mAudioConfig.frequency_index,
-                                 mAudioConfig.aac_profile, sample)) {
-      return nullptr;
-    }
-  }
 
   return sample.forget();
 }
 
 MP4Sample*
 MP4Demuxer::DemuxVideoSample()
 {
   nsAutoPtr<MP4Sample> sample(new MP4Sample());
--- a/media/libstagefright/moz.build
+++ b/media/libstagefright/moz.build
@@ -43,16 +43,17 @@ if CONFIG['OS_TARGET'] != 'Android':
     ]
     UNIFIED_SOURCES += [
         'system/core/libcutils/strdup16to8.c',
         'system/core/liblog/logd_write.c',
         'system/core/liblog/logprint.c',
     ]
 
 EXPORTS.mp4_demuxer += [
+    'binding/include/mp4_demuxer/Adts.h',
     'binding/include/mp4_demuxer/AnnexB.h',
     'binding/include/mp4_demuxer/BufferStream.h',
     'binding/include/mp4_demuxer/ByteReader.h',
     'binding/include/mp4_demuxer/DecoderData.h',
     'binding/include/mp4_demuxer/Interval.h',
     'binding/include/mp4_demuxer/MoofParser.h',
     'binding/include/mp4_demuxer/mp4_demuxer.h',
 ]
--- a/mobile/android/themes/core/aboutReader.css
+++ b/mobile/android/themes/core/aboutReader.css
@@ -425,17 +425,17 @@ body {
   list-style: none;
   padding: 10px 5px;
   white-space: nowrap;
 }
 
 #font-type-buttons > li,
 .segmented-button > li {
   width: 50px; /* combined with flex, this acts as a minimum width */
-  flex: 1 0 main-size;
+  flex: 1 0 auto;
   text-align: center;
   line-height: 20px;
 }
 
 #font-type-buttons > li {
   padding: 10px 0;
 }
 
--- a/mobile/android/themes/core/config.css
+++ b/mobile/android/themes/core/config.css
@@ -52,17 +52,17 @@ body {
     border: none;
     background-image: none;
     background-color: transparent;
     display: inline-block;
     width: 12em;
     min-width: 0;
     color: #000000;
     opacity: 1;
-    flex: 1 1 main-size;
+    flex: 1 1 auto;
 }
 
 #filter-input:-moz-placeholder {
     color: rgba(255,255,255,0.5);
 }
 
 .toolbar input {
     display: inline-block;
@@ -188,17 +188,17 @@ li {
     text-align: left;
     text-overflow: ellipsis;
     overflow: hidden;
     background-image: none;
 }
 
 .pref-value {
     color: rgba(0,0,0,0.5);
-    flex: 1 1 main-size;
+    flex: 1 1 auto;
     border: none;
     -moz-appearance: none;
     background-image: none;
     background-color: transparent;
 }
 
 .pref-name[locked] {
     padding-right: 20px;
@@ -222,31 +222,31 @@ li {
 .pref-item-line {
     border-top: 1px solid rgba(0,0,0,0.05);
     color: rgba(0,0,0,0.5);
     display: flex;
     flex-direction: row;
 }
 
 #new-pref-value-boolean {
-    flex: 1 1 main-size;
+    flex: 1 1 auto;
 }
 
 #new-pref-container .pref-button.toggle {
     display: inline-block;
     opacity: 1;
-    flex: 0 1 main-size;
+    flex: 0 1 auto;
     float: right;
 }
 
 #new-pref-container .pref-button.cancel,
 #new-pref-container .pref-button.create {
     display: inline-block;
     opacity: 1;
-    flex: 1 1 main-size;
+    flex: 1 1 auto;
 }
 
 .pref-item-line {
     pointer-events: none;
 }
 
 #new-pref-container .pref-item-line,
 .pref-item.selected .pref-item-line,
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -85,17 +85,17 @@ class MochitestRunner(MozbuildObject):
     to hook up result parsing, etc.
     """
 
     def get_webapp_runtime_path(self):
         import mozinfo
         appname = 'webapprt-stub' + mozinfo.info.get('bin_suffix', '')
         if sys.platform.startswith('darwin'):
             appname = os.path.join(self.distdir, self.substs['MOZ_MACBUNDLE_NAME'],
-            'Contents', 'MacOS', appname)
+            'Contents', 'Resources', appname)
         else:
             appname = os.path.join(self.distdir, 'bin', appname)
         return appname
 
     def __init__(self, *args, **kwargs):
         MozbuildObject.__init__(self, *args, **kwargs)
 
         # TODO Bug 794506 remove once mach integrates with virtualenv.
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -164,17 +164,17 @@ ifeq (powerpc,$(TARGET_CPU))
 	$(RUN_MOCHITEST) --setpref=dom.ipc.plugins.enabled.ppc.test.plugin=false $(IPCPLUGINS_PATH_ARG)
 endif
 else
 	$(RUN_MOCHITEST) --setpref=dom.ipc.plugins.enabled=false --test-path=dom/plugins/test
 endif
 	$(CHECK_TEST_ERROR)
 
 ifeq ($(OS_ARCH),Darwin)
-webapprt_stub_path = $(TARGET_DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/webapprt-stub$(BIN_SUFFIX)
+webapprt_stub_path = $(TARGET_DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/webapprt-stub$(BIN_SUFFIX)
 endif
 ifeq ($(OS_ARCH),WINNT)
 webapprt_stub_path = $(TARGET_DIST)/bin/webapprt-stub$(BIN_SUFFIX)
 endif
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 webapprt_stub_path = $(TARGET_DIST)/bin/webapprt-stub$(BIN_SUFFIX)
 endif
 
--- a/toolkit/webapps/MacNativeApp.js
+++ b/toolkit/webapps/MacNativeApp.js
@@ -217,17 +217,18 @@ NativeApp.prototype = {
                           { unixMode: PERMS_DIRECTORY, ignoreExisting: true });
 
     yield OS.File.makeDir(OS.Path.join(aDir, this.resourcesDir),
                           { unixMode: PERMS_DIRECTORY, ignoreExisting: true });
   }),
 
   _copyPrebuiltFiles: function(aDir) {
     let destDir = getFile(aDir, this.macOSDir);
-    let stub = getFile(this.runtimeFolder, "webapprt-stub");
+    let stub = getFile(OS.Path.join(OS.Path.dirname(this.runtimeFolder),
+                                    "Resources"), "webapprt-stub");
     stub.copyTo(destDir, "webapprt");
   },
 
   _createConfigFiles: function(aDir) {
     // ${ProfileDir}/webapp.json
     yield writeToFile(OS.Path.join(aDir, this.configJson),
                       JSON.stringify(this.webappJson));
 
--- a/toolkit/webapps/tests/test_webapp_runtime_executable_update.xul
+++ b/toolkit/webapps/tests/test_webapp_runtime_executable_update.xul
@@ -89,17 +89,17 @@ let runTest = Task.async(function*() {
   yield nativeApp.install(app, manifest);
   while (!WebappOSUtils.isLaunchable(app)) {
     yield wait(1000);
   }
   ok(true, "App launchable");
 
   let fakeInstallDir;
   if (MAC) {
-    fakeInstallDir = getFile(testAppInfo.installPath, "Contents", "MacOS");
+    fakeInstallDir = getFile(testAppInfo.installPath, "Contents", "Resources");
   } else {
     fakeInstallDir = getFile(OS.Constants.Path.profileDir, "fakeInstallDir");
     fakeInstallDir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
   }
 
   let fakeAppIniFile = fakeInstallDir.clone();
   fakeAppIniFile.append("application.ini");
 
--- a/webapprt/mac/webapprt.mm
+++ b/webapprt/mac/webapprt.mm
@@ -161,17 +161,17 @@ main(int argc, char **argv)
       NSLog(@"### This Application has an old webrt. Updating it.");
       NSLog(@"### My webapprt path: %@", myWebRTPath);
 
       NSFileManager* fileClerk = [[NSFileManager alloc] init];
       NSError *errorDesc = nil;
 
       //we know the firefox path, so copy the new webapprt here
       NSString *newWebRTPath =
-        [NSString stringWithFormat: @"%@%s%s", firefoxPath, APP_MACOS_PATH,
+        [NSString stringWithFormat: @"%@%s%s", firefoxPath, APP_RESOURCES_PATH,
                                                WEBAPPRT_EXECUTABLE];
       NSLog(@"### Firefox webapprt path: %@", newWebRTPath);
       if (![fileClerk fileExistsAtPath:newWebRTPath]) {
         NSString* msg = [NSString stringWithFormat: @"This version of Firefox (%@) cannot run web applications, because it is not recent enough or damaged", firefoxVersion];
         @throw MakeException(@"Missing Web Runtime Files", msg);
       }
 
       [fileClerk removeItemAtPath: myWebRTPath error: &errorDesc];