Bug 1311246 - Remove support for the -moz-samplesize media fragment; r=jrmuizel
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 18 Oct 2016 20:05:29 -0400
changeset 322859 3cbb93f5768e0e5ac470d3bb29cea58fe2f45df3
parent 322858 df748be239499d9a8f88df38988d89acab774f7a
child 322860 f296d03423848da45f1839b946b103047834b459
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersjrmuizel
bugs1311246, 854795
milestone53.0a1
Bug 1311246 - Remove support for the -moz-samplesize media fragment; r=jrmuizel This removes the feature added in bug 854795 for Tarako b2g devices.
gfx/thebes/gfxPrefs.h
image/Decoder.h
image/DecoderFactory.cpp
image/DecoderFactory.h
image/ImageCacheKey.cpp
image/ImageFactory.cpp
image/RasterImage.cpp
image/RasterImage.h
image/decoders/nsJPEGDecoder.cpp
image/decoders/nsJPEGDecoder.h
image/test/reftest/blob/blob-uri-with-ref-param-notref.html
image/test/reftest/blob/blob-uri-with-ref-param.html
image/test/reftest/blob/image.png
image/test/reftest/blob/reftest-stylo.list
image/test/reftest/blob/reftest.list
image/test/reftest/jpeg/reftest-stylo.list
image/test/reftest/jpeg/reftest.list
image/test/reftest/reftest-stylo.list
image/test/reftest/reftest.list
modules/libpref/init/all.js
netwerk/base/nsMediaFragmentURIParser.cpp
netwerk/base/nsMediaFragmentURIParser.h
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -434,17 +434,16 @@ private:
   DECL_GFX_PREF(Live, "image.downscale-during-decode.enabled", ImageDownscaleDuringDecodeEnabled, bool, true);
   DECL_GFX_PREF(Live, "image.infer-src-animation.threshold-ms", ImageInferSrcAnimationThresholdMS, uint32_t, 2000);
   DECL_GFX_PREF(Once, "image.mem.decode_bytes_at_a_time",      ImageMemDecodeBytesAtATime, uint32_t, 200000);
   DECL_GFX_PREF(Live, "image.mem.discardable",                 ImageMemDiscardable, bool, false);
   DECL_GFX_PREF(Once, "image.mem.surfacecache.discard_factor", ImageMemSurfaceCacheDiscardFactor, uint32_t, 1);
   DECL_GFX_PREF(Once, "image.mem.surfacecache.max_size_kb",    ImageMemSurfaceCacheMaxSizeKB, uint32_t, 100 * 1024);
   DECL_GFX_PREF(Once, "image.mem.surfacecache.min_expiration_ms", ImageMemSurfaceCacheMinExpirationMS, uint32_t, 60*1000);
   DECL_GFX_PREF(Once, "image.mem.surfacecache.size_factor",    ImageMemSurfaceCacheSizeFactor, uint32_t, 64);
-  DECL_GFX_PREF(Live, "image.mozsamplesize.enabled",           ImageMozSampleSizeEnabled, bool, false);
   DECL_GFX_PREF(Once, "image.multithreaded_decoding.limit",    ImageMTDecodingLimit, int32_t, -1);
 
   DECL_GFX_PREF(Once, "layers.acceleration.disabled",          LayersAccelerationDisabledDoNotUseDirectly, bool, false);
   DECL_GFX_PREF(Live, "layers.acceleration.draw-fps",          LayersDrawFPS, bool, false);
   DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram",  FPSPrintHistogram, bool, false);
   DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false);
   DECL_GFX_PREF(Once, "layers.acceleration.force-enabled",     LayersAccelerationForceEnabledDoNotUseDirectly, bool, false);
   DECL_GFX_PREF(Once, "layers.allow-d3d9-fallback",            LayersAllowD3D9Fallback, bool, false);
--- a/image/Decoder.h
+++ b/image/Decoder.h
@@ -211,24 +211,16 @@ public:
 
   /**
    * @return either the size passed to SetOutputSize() or Nothing(), indicating
    * that SetOutputSize() was not explicitly called.
    */
   Maybe<gfx::IntSize> ExplicitOutputSize() const;
 
   /**
-   * Set the requested sample size for this decoder. Used to implement the
-   * -moz-sample-size media fragment.
-   *
-   *  XXX(seth): Support for -moz-sample-size will be removed in bug 1120056.
-   */
-  virtual void SetSampleSize(int aSampleSize) { }
-
-  /**
    * Set an iterator to the SourceBuffer which will feed data to this decoder.
    * This must always be called before calling Init(). (And only before Init().)
    *
    * XXX(seth): We should eliminate this method and pass a SourceBufferIterator
    * to the various decoder constructors instead.
    */
   void SetIterator(SourceBufferIterator&& aIterator)
   {
--- a/image/DecoderFactory.cpp
+++ b/image/DecoderFactory.cpp
@@ -109,18 +109,17 @@ DecoderFactory::GetDecoder(DecoderType a
 
 /* static */ already_AddRefed<IDecodingTask>
 DecoderFactory::CreateDecoder(DecoderType aType,
                               NotNull<RasterImage*> aImage,
                               NotNull<SourceBuffer*> aSourceBuffer,
                               const IntSize& aIntrinsicSize,
                               const IntSize& aOutputSize,
                               DecoderFlags aDecoderFlags,
-                              SurfaceFlags aSurfaceFlags,
-                              int aSampleSize)
+                              SurfaceFlags aSurfaceFlags)
 {
   if (aType == DecoderType::UNKNOWN) {
     return nullptr;
   }
 
   // Create an anonymous decoder. Interaction with the SurfaceCache and the
   // owning RasterImage will be mediated by DecodedSurfaceProvider.
   RefPtr<Decoder> decoder =
@@ -128,17 +127,16 @@ DecoderFactory::CreateDecoder(DecoderTyp
   MOZ_ASSERT(decoder, "Should have a decoder now");
 
   // Initialize the decoder.
   decoder->SetMetadataDecode(false);
   decoder->SetIterator(aSourceBuffer->Iterator());
   decoder->SetOutputSize(aOutputSize);
   decoder->SetDecoderFlags(aDecoderFlags | DecoderFlags::FIRST_FRAME_ONLY);
   decoder->SetSurfaceFlags(aSurfaceFlags);
-  decoder->SetSampleSize(aSampleSize);
 
   if (NS_FAILED(decoder->Init())) {
     return nullptr;
   }
 
   // Create a DecodedSurfaceProvider which will manage the decoding process and
   // make this decoder's output available in the surface cache.
   SurfaceKey surfaceKey =
@@ -207,31 +205,29 @@ DecoderFactory::CreateAnimationDecoder(D
   // Return the surface provider in its IDecodingTask guise.
   RefPtr<IDecodingTask> task = provider.get();
   return task.forget();
 }
 
 /* static */ already_AddRefed<IDecodingTask>
 DecoderFactory::CreateMetadataDecoder(DecoderType aType,
                                       NotNull<RasterImage*> aImage,
-                                      NotNull<SourceBuffer*> aSourceBuffer,
-                                      int aSampleSize)
+                                      NotNull<SourceBuffer*> aSourceBuffer)
 {
   if (aType == DecoderType::UNKNOWN) {
     return nullptr;
   }
 
   RefPtr<Decoder> decoder =
     GetDecoder(aType, aImage, /* aIsRedecode = */ false);
   MOZ_ASSERT(decoder, "Should have a decoder now");
 
   // Initialize the decoder.
   decoder->SetMetadataDecode(true);
   decoder->SetIterator(aSourceBuffer->Iterator());
-  decoder->SetSampleSize(aSampleSize);
 
   if (NS_FAILED(decoder->Init())) {
     return nullptr;
   }
 
   RefPtr<IDecodingTask> task = new MetadataDecodingTask(WrapNotNull(decoder));
   return task.forget();
 }
--- a/image/DecoderFactory.h
+++ b/image/DecoderFactory.h
@@ -58,28 +58,25 @@ public:
    * @param aIntrinsicSize The intrinsic size of the image, normally obtained
    *                       during the metadata decode.
    * @param aOutputSize The output size for the decoder. If this is smaller than
    *                    the intrinsic size, the decoder will downscale the
    *                    image.
    * @param aDecoderFlags Flags specifying the behavior of this decoder.
    * @param aSurfaceFlags Flags specifying the type of output this decoder
    *                      should produce.
-   * @param aSampleSize The sample size requested using #-moz-samplesize (or 0
-   *                    if none).
    */
   static already_AddRefed<IDecodingTask>
   CreateDecoder(DecoderType aType,
                 NotNull<RasterImage*> aImage,
                 NotNull<SourceBuffer*> aSourceBuffer,
                 const gfx::IntSize& aIntrinsicSize,
                 const gfx::IntSize& aOutputSize,
                 DecoderFlags aDecoderFlags,
-                SurfaceFlags aSurfaceFlags,
-                int aSampleSize);
+                SurfaceFlags aSurfaceFlags);
 
   /**
    * Creates and initializes a decoder for animated images of type @aType.
    * The decoder will send notifications to @aImage.
    *
    * @param aType Which type of decoder to create - JPEG, PNG, etc.
    * @param aImage The image will own the decoder and which should receive
    *               notifications as decoding progresses.
@@ -105,24 +102,21 @@ public:
    * the image. No actual image data will be decoded and no surfaces will be
    * allocated. The decoder will send notifications to @aImage.
    *
    * @param aType Which type of decoder to create - JPEG, PNG, etc.
    * @param aImage The image will own the decoder and which should receive
    *               notifications as decoding progresses.
    * @param aSourceBuffer The SourceBuffer which the decoder will read its data
    *                      from.
-   * @param aSampleSize The sample size requested using #-moz-samplesize (or 0
-   *                    if none).
    */
   static already_AddRefed<IDecodingTask>
   CreateMetadataDecoder(DecoderType aType,
                         NotNull<RasterImage*> aImage,
-                        NotNull<SourceBuffer*> aSourceBuffer,
-                        int aSampleSize);
+                        NotNull<SourceBuffer*> aSourceBuffer);
 
   /**
    * Creates and initializes a decoder for an ICO resource, which may be either
    * a BMP or PNG image.
    *
    * @param aType Which type of decoder to create. This must be either BMP or
    *              PNG.
    * @param aSourceBuffer The SourceBuffer which the decoder will read its data
--- a/image/ImageCacheKey.cpp
+++ b/image/ImageCacheKey.cpp
@@ -139,17 +139,17 @@ ImageCacheKey::ComputeHash(ImageURL* aUR
 
   nsPrintfCString ptr("%p", aControlledDocument);
   nsAutoCString suffix;
   aAttrs.CreateSuffix(suffix);
 
   if (aBlobSerial) {
     // For blob URIs, we hash the serial number of the underlying blob, so that
     // different blob URIs which point to the same blob share a cache entry. We
-    // also include the ref portion of the URI to support -moz-samplesize, which
+    // also include the ref portion of the URI to support media fragments which
     // requires us to create different Image objects even if the source data is
     // the same.
     nsAutoCString ref;
     aURI->GetRef(ref);
     return HashGeneric(*aBlobSerial, HashString(ref + suffix + ptr));
   }
 
   // For non-blob URIs, we hash the URI spec.
--- a/image/ImageFactory.cpp
+++ b/image/ImageFactory.cpp
@@ -200,35 +200,16 @@ ImageFactory::CreateRasterImage(nsIReque
   MOZ_ASSERT(aProgressTracker);
 
   nsresult rv;
 
   RefPtr<RasterImage> newImage = new RasterImage(aURI);
   aProgressTracker->SetImage(newImage);
   newImage->SetProgressTracker(aProgressTracker);
 
-  nsAutoCString ref;
-  aURI->GetRef(ref);
-  net::nsMediaFragmentURIParser parser(ref);
-  if (parser.HasSampleSize()) {
-      /* Get our principal */
-      nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
-      nsCOMPtr<nsIPrincipal> principal;
-      if (chan) {
-        nsContentUtils::GetSecurityManager()
-          ->GetChannelResultPrincipal(chan, getter_AddRefs(principal));
-      }
-
-      if ((principal &&
-           principal->GetAppStatus() == nsIPrincipal::APP_STATUS_CERTIFIED) ||
-          gfxPrefs::ImageMozSampleSizeEnabled()) {
-        newImage->SetRequestedSampleSize(parser.GetSampleSize());
-      }
-  }
-
   rv = newImage->Init(aMimeType.get(), aImageFlags);
   if (NS_FAILED(rv)) {
     return BadImage("RasterImage::Init failed", newImage);
   }
 
   newImage->SetInnerWindowID(aInnerWindowId);
 
   uint32_t len = GetContentSize(aRequest);
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -68,17 +68,16 @@ NS_IMPL_ISUPPORTS(RasterImage, imgIConta
 #endif
 
 //******************************************************************************
 RasterImage::RasterImage(ImageURL* aURI /* = nullptr */) :
   ImageResource(aURI), // invoke superclass's constructor
   mSize(0,0),
   mLockCount(0),
   mDecodeCount(0),
-  mRequestedSampleSize(0),
   mImageProducerID(ImageContainer::AllocateProducerID()),
   mLastFrameID(0),
   mLastImageContainerDrawResult(DrawResult::NOT_READY),
 #ifdef DEBUG
   mFramesNotified(0),
 #endif
   mSourceBuffer(WrapNotNull(new SourceBuffer())),
   mHasSize(false),
@@ -1159,18 +1158,17 @@ RasterImage::Decode(const IntSize& aSize
   RefPtr<IDecodingTask> task;
   if (mAnimationState && aPlaybackType == PlaybackType::eAnimated) {
     task = DecoderFactory::CreateAnimationDecoder(mDecoderType, WrapNotNull(this),
                                                   mSourceBuffer, mSize,
                                                   decoderFlags, surfaceFlags);
   } else {
     task = DecoderFactory::CreateDecoder(mDecoderType, WrapNotNull(this),
                                          mSourceBuffer, mSize, aSize,
-                                         decoderFlags, surfaceFlags,
-                                         mRequestedSampleSize);
+                                         decoderFlags, surfaceFlags);
   }
 
   // Make sure DecoderFactory was able to create a decoder successfully.
   if (!task) {
     return NS_ERROR_FAILURE;
   }
 
   mDecodeCount++;
@@ -1187,17 +1185,17 @@ RasterImage::DecodeMetadata(uint32_t aFl
     return NS_ERROR_FAILURE;
   }
 
   MOZ_ASSERT(!mHasSize, "Should not do unnecessary metadata decodes");
 
   // Create a decoder.
   RefPtr<IDecodingTask> task =
     DecoderFactory::CreateMetadataDecoder(mDecoderType, WrapNotNull(this),
-                                          mSourceBuffer, mRequestedSampleSize);
+                                          mSourceBuffer);
 
   // Make sure DecoderFactory was able to create a decoder successfully.
   if (!task) {
     return NS_ERROR_FAILURE;
   }
 
   // We're ready to decode; start the decoder.
   LaunchDecodingTask(task, this, aFlags, mHasSourceData);
--- a/image/RasterImage.h
+++ b/image/RasterImage.h
@@ -259,21 +259,16 @@ public:
    * We take this approach rather than having the source data management code do
    * something more complicated (like chunklisting) because HTTP is by far the
    * dominant source of images, and the Content-Length header is quite reliable.
    * Thus, pre-allocation simplifies code and reduces the total number of
    * allocations.
    */
   nsresult SetSourceSizeHint(uint32_t aSizeHint);
 
-  /* Provide a hint for the requested dimension of the resulting image. */
-  void SetRequestedSampleSize(int requestedSampleSize) {
-    mRequestedSampleSize = requestedSampleSize;
-  }
-
  nsCString GetURIString() {
     nsCString spec;
     if (GetURI()) {
       GetURI()->GetSpec(spec);
     }
     return spec;
   }
 
@@ -401,19 +396,16 @@ private: // data
 
   // The type of decoder this image needs. Computed from the MIME type in Init().
   DecoderType                mDecoderType;
 
   // How many times we've decoded this image.
   // This is currently only used for statistics
   int32_t                        mDecodeCount;
 
-  // A hint for image decoder that directly scale the image to smaller buffer
-  int                        mRequestedSampleSize;
-
   // A weak pointer to our ImageContainer, which stays alive only as long as
   // the layer system needs it.
   WeakPtr<layers::ImageContainer> mImageContainer;
 
   layers::ImageContainer::ProducerID mImageProducerID;
   layers::ImageContainer::FrameID mLastFrameID;
 
   // If mImageContainer is non-null, this contains the DrawResult we obtained
--- a/image/decoders/nsJPEGDecoder.cpp
+++ b/image/decoders/nsJPEGDecoder.cpp
@@ -72,17 +72,16 @@ METHODDEF(void) my_error_exit (j_common_
 nsJPEGDecoder::nsJPEGDecoder(RasterImage* aImage,
                              Decoder::DecodeStyle aDecodeStyle)
  : Decoder(aImage)
  , mLexer(Transition::ToUnbuffered(State::FINISHED_JPEG_DATA,
                                    State::JPEG_DATA,
                                    SIZE_MAX),
           Transition::TerminateSuccess())
  , mDecodeStyle(aDecodeStyle)
- , mSampleSize(0)
 {
   mState = JPEG_HEADER;
   mReading = true;
   mImageData = nullptr;
 
   mBytesToSkip = 0;
   memset(&mInfo, 0, sizeof(jpeg_decompress_struct));
   memset(&mSourceMgr, 0, sizeof(mSourceMgr));
@@ -237,27 +236,18 @@ nsJPEGDecoder::ReadJPEGData(const char* 
 
       // Step 3: read file parameters with jpeg_read_header()
       if (jpeg_read_header(&mInfo, TRUE) == JPEG_SUSPENDED) {
         MOZ_LOG(sJPEGDecoderAccountingLog, LogLevel::Debug,
                ("} (JPEG_SUSPENDED)"));
         return Transition::ContinueUnbuffered(State::JPEG_DATA); // I/O suspension
       }
 
-      // If we have a sample size specified for -moz-sample-size, use it.
-      if (mSampleSize > 0) {
-        mInfo.scale_num = 1;
-        mInfo.scale_denom = mSampleSize;
-      }
-
-      // Used to set up image size so arrays can be allocated
-      jpeg_calc_output_dimensions(&mInfo);
-
       // Post our size to the superclass
-      PostSize(mInfo.output_width, mInfo.output_height,
+      PostSize(mInfo.image_width, mInfo.image_height,
                ReadOrientationFromEXIF());
       if (HasError()) {
         // Setting the size led to an error.
         mState = JPEG_ERROR;
         return Transition::TerminateFailure();
       }
 
       // If we're doing a metadata decode, we're done.
@@ -382,16 +372,19 @@ nsJPEGDecoder::ReadJPEGData(const char* 
       }
     }
 
     // Don't allocate a giant and superfluous memory buffer
     // when not doing a progressive decode.
     mInfo.buffered_image = mDecodeStyle == PROGRESSIVE &&
                            jpeg_has_multiple_scans(&mInfo);
 
+    /* Used to set up image size so arrays can be allocated */
+    jpeg_calc_output_dimensions(&mInfo);
+
     MOZ_ASSERT(!mImageData, "Already have a buffer allocated?");
     nsresult rv = AllocateFrame(/* aFrameNum = */ 0, OutputSize(),
                                 FullOutputFrame(), SurfaceFormat::B8G8R8X8);
     if (NS_FAILED(rv)) {
       mState = JPEG_ERROR;
       MOZ_LOG(sJPEGDecoderAccountingLog, LogLevel::Debug,
              ("} (could not initialize image frame)"));
       return Transition::TerminateFailure();
@@ -407,17 +400,17 @@ nsJPEGDecoder::ReadJPEGData(const char* 
         mState = JPEG_ERROR;
         return Transition::TerminateFailure();
       }
     }
 
     MOZ_LOG(sJPEGDecoderAccountingLog, LogLevel::Debug,
            ("        JPEGDecoderAccounting: nsJPEGDecoder::"
             "Write -- created image frame with %ux%u pixels",
-            mInfo.output_width, mInfo.output_height));
+            mInfo.image_width, mInfo.image_height));
 
     mState = JPEG_START_DECOMPRESS;
     MOZ_FALLTHROUGH; // to start decompressing.
   }
 
   case JPEG_START_DECOMPRESS: {
     LOG_SCOPE((mozilla::LogModule*)sJPEGLog, "nsJPEGDecoder::Write -- entering"
                             " JPEG_START_DECOMPRESS case");
--- a/image/decoders/nsJPEGDecoder.h
+++ b/image/decoders/nsJPEGDecoder.h
@@ -47,21 +47,16 @@ typedef enum {
 class RasterImage;
 struct Orientation;
 
 class nsJPEGDecoder : public Decoder
 {
 public:
   virtual ~nsJPEGDecoder();
 
-  virtual void SetSampleSize(int aSampleSize) override
-  {
-    mSampleSize = aSampleSize;
-  }
-
   void NotifyDone();
 
 protected:
   nsresult InitInternal() override;
   LexerResult DoDecode(SourceBufferIterator& aIterator,
                        IResumable* aOnResume) override;
   nsresult FinishInternal() override;
 
@@ -110,16 +105,14 @@ public:
   qcms_profile* mInProfile;
   qcms_transform* mTransform;
 
   bool mReading;
 
   const Decoder::DecodeStyle mDecodeStyle;
 
   uint32_t mCMSMode;
-
-  int mSampleSize;
 };
 
 } // namespace image
 } // namespace mozilla
 
 #endif // mozilla_image_decoders_nsJPEGDecoder_h
deleted file mode 100644
--- a/image/test/reftest/blob/blob-uri-with-ref-param-notref.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-
-<html class="reftest-wait">
-
-<body>
-  <img id="test">
-</body>
-
-<script>
-  var image = new Image;
-
-  image.onload = function() {
-    // Create a canvas.
-    var canvas = document.createElement('canvas');
-    canvas.width = 100;
-    canvas.height = 100;
-
-    // Draw the image into the canvas.
-    var ctx = canvas.getContext('2d');
-    ctx.drawImage(image, 0, 0);
-
-    // Convert the image into a blob URI and use it as #test's src.
-    canvas.toBlob(function(blob) {
-      var uri = window.URL.createObjectURL(blob);
-      uri += '#-moz-samplesize=8';
-      var testImage = document.getElementById('test');
-
-      testImage.onload = testImage.onerror = function() {
-        // Take the snapshot.
-        document.documentElement.removeAttribute('class');
-      };
-
-      testImage.src = uri;
-    }, 'image/jpeg', 0.99);
-  }
-
-  // Start loading the image.
-  image.src = 'image.png';
-</script>
-
-</html>
deleted file mode 100644
--- a/image/test/reftest/blob/blob-uri-with-ref-param.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-
-<html class="reftest-wait">
-
-<body>
-  <img id="test">
-</body>
-
-<script>
-  var image = new Image;
-
-  image.onload = function() {
-    // Create a canvas.
-    var canvas = document.createElement('canvas');
-    canvas.width = 100;
-    canvas.height = 100;
-
-    // Draw the image into the canvas.
-    var ctx = canvas.getContext('2d');
-    ctx.drawImage(image, 0, 0);
-
-    // Convert the image into a blob URI and use it as #test's src.
-    canvas.toBlob(function(blob) {
-      var uri = window.URL.createObjectURL(blob);
-      var testImage = document.getElementById('test');
-      
-      testImage.onload = testImage.onerror = function() {
-        // Take the snapshot.
-        document.documentElement.removeAttribute('class');
-      };
-
-      testImage.src = uri;
-    }, 'image/jpeg', 0.99);
-  }
-
-  // Start loading the image.
-  image.src = 'image.png';
-</script>
-
-</html>
deleted file mode 100644
index d7d87adce09ac7655ab4de9ebbb4bc7791bdd739..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/image/test/reftest/blob/reftest-stylo.list
+++ /dev/null
@@ -1,8 +0,0 @@
-# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
-# Blob URI tests 
-
-# Test that blob URIs don't get merged if they have different ref params.
-# (We run the test twice to check both cached and non-cached cases.)
-default-preferences pref(image.mozsamplesize.enabled,true)
-== blob-uri-with-ref-param.html blob-uri-with-ref-param.html
-== blob-uri-with-ref-param.html blob-uri-with-ref-param.html
deleted file mode 100644
--- a/image/test/reftest/blob/reftest.list
+++ /dev/null
@@ -1,7 +0,0 @@
-# Blob URI tests 
-
-# Test that blob URIs don't get merged if they have different ref params.
-# (We run the test twice to check both cached and non-cached cases.)
-default-preferences pref(image.mozsamplesize.enabled,true)
-!= blob-uri-with-ref-param.html blob-uri-with-ref-param-notref.html
-!= blob-uri-with-ref-param.html blob-uri-with-ref-param-notref.html
--- a/image/test/reftest/jpeg/reftest-stylo.list
+++ b/image/test/reftest/jpeg/reftest-stylo.list
@@ -48,10 +48,8 @@ fails random-if(Android) == jpg-srgb-icc
 # <contents of blue.jpg> (no newline)
 # --BOUNDARYOMG--\r\n
 # 
 # (The boundary is arbitrary, and just has to be defined as something that
 # won't be in the text of the contents themselves. --$(boundary)\r\n means
 # "Here is the beginning of a boundary," and --$(boundary)-- means "All done
 # sending you parts.")
 skip HTTP == webcam-simulacrum.mjpg webcam-simulacrum.mjpg
-skip pref(image.mozsamplesize.enabled,true) == jpg-size-32x32.jpg#-moz-samplesize=2 jpg-size-32x32.jpg#-moz-samplesize=2
-skip pref(image.mozsamplesize.enabled,true) == jpg-size-32x32.jpg#-moz-samplesize=8 jpg-size-32x32.jpg#-moz-samplesize=8
--- a/image/test/reftest/jpeg/reftest.list
+++ b/image/test/reftest/jpeg/reftest.list
@@ -47,10 +47,8 @@ random-if(Android) == jpg-srgb-icc.jpg j
 # <contents of blue.jpg> (no newline)
 # --BOUNDARYOMG--\r\n
 # 
 # (The boundary is arbitrary, and just has to be defined as something that
 # won't be in the text of the contents themselves. --$(boundary)\r\n means
 # "Here is the beginning of a boundary," and --$(boundary)-- means "All done
 # sending you parts.")
 HTTP == webcam-simulacrum.mjpg blue.jpg
-pref(image.mozsamplesize.enabled,true) fuzzy(21,256) == jpg-size-32x32.jpg#-moz-samplesize=2 jpg-size-16x16.png
-pref(image.mozsamplesize.enabled,true) fuzzy(92,16) == jpg-size-32x32.jpg#-moz-samplesize=8 jpg-size-4x4.png
--- a/image/test/reftest/reftest-stylo.list
+++ b/image/test/reftest/reftest-stylo.list
@@ -52,14 +52,11 @@ include apng/reftest-stylo.list
 include generic/reftest-stylo.list
 
 # Color management test
 include color-management/reftest-stylo.list
 
 # Downscaling tests
 # include downscaling/reftest-stylo.list
 
-# Blob URI tests
-include blob/reftest-stylo.list
-
 # Lossless encoders
 # skip-if(Android||B2G) include encoders-lossless/reftest-stylo.list
 # bug 783621
--- a/image/test/reftest/reftest.list
+++ b/image/test/reftest/reftest.list
@@ -38,13 +38,10 @@ include apng/reftest.list
 include generic/reftest.list
 
 # Color management test
 include color-management/reftest.list
 
 # Downscaling tests
 include downscaling/reftest.list
 
-# Blob URI tests
-include blob/reftest.list
-
 # Lossless encoders
 skip-if(Android) include encoders-lossless/reftest.list
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5209,19 +5209,16 @@ pref("layout.accessiblecaret.extend_sele
 pref("layout.accessiblecaret.hide_carets_for_mouse_input", true);
 
 // Wakelock is disabled by default.
 pref("dom.wakelock.enabled", false);
 
 // The URL of the Firefox Accounts auth server backend
 pref("identity.fxaccounts.auth.uri", "https://api.accounts.firefox.com/v1");
 
-// disable mozsample size for now
-pref("image.mozsamplesize.enabled", false);
-
 pref("beacon.enabled", true);
 
 // Camera prefs
 pref("camera.control.face_detection.enabled", true);
 
 
 // SW Cache API
 pref("dom.caches.enabled", true);
--- a/netwerk/base/nsMediaFragmentURIParser.cpp
+++ b/netwerk/base/nsMediaFragmentURIParser.cpp
@@ -330,29 +330,16 @@ bool nsMediaFragmentURIParser::ParseXYWH
     mClip.emplace(x, y, w, h);
     mClipUnit = clipUnit;
     return true;
   }
 
   return false;
 }
 
-bool nsMediaFragmentURIParser::ParseMozSampleSize(nsDependentSubstring aString)
-{
-  int32_t sampleSize;
-
-  // Read and validate coordinates.
-  if (ParseInteger(aString, sampleSize) && sampleSize > 0) {
-    mSampleSize.emplace(sampleSize);
-    return true;
-  }
-
-  return false;
-}
-
 void nsMediaFragmentURIParser::Parse(nsACString& aRef)
 {
   // Create an array of possibly-invalid media fragments.
   nsTArray< std::pair<nsCString, nsCString> > fragments;
   nsCCharSeparatedTokenizer tokenizer(aRef, '&');
 
   while (tokenizer.hasMoreTokens()) {
     const nsCSubstring& nv = tokenizer.nextToken();
@@ -363,28 +350,25 @@ void nsMediaFragmentURIParser::Parse(nsA
       NS_UnescapeURL(StringHead(nv, index), esc_Ref | esc_AlwaysCopy, name);
       NS_UnescapeURL(Substring(nv, index + 1, nv.Length()),
                      esc_Ref | esc_AlwaysCopy, value);
       fragments.AppendElement(make_pair(name, value));
     }
   }
 
   // Parse the media fragment values.
-  bool gotTemporal = false, gotSpatial = false, gotSampleSize = false;
+  bool gotTemporal = false, gotSpatial = false;
   for (int i = fragments.Length() - 1 ; i >= 0 ; --i) {
-    if (gotTemporal && gotSpatial && gotSampleSize) {
+    if (gotTemporal && gotSpatial) {
       // We've got one of each possible type. No need to look at the rest.
       break;
     } else if (!gotTemporal && fragments[i].first.EqualsLiteral("t")) {
       nsAutoString value = NS_ConvertUTF8toUTF16(fragments[i].second);
       gotTemporal = ParseNPT(nsDependentSubstring(value, 0));
     } else if (!gotSpatial && fragments[i].first.EqualsLiteral("xywh")) {
       nsAutoString value = NS_ConvertUTF8toUTF16(fragments[i].second);
       gotSpatial = ParseXYWH(nsDependentSubstring(value, 0));
-    } else if (!gotSampleSize && fragments[i].first.EqualsLiteral("-moz-samplesize")) {
-      nsAutoString value = NS_ConvertUTF8toUTF16(fragments[i].second);
-      gotSampleSize = ParseMozSampleSize(nsDependentSubstring(value, 0));
     }
   }
 }
 
 } // namespace net
 } // namespace mozilla
--- a/netwerk/base/nsMediaFragmentURIParser.h
+++ b/netwerk/base/nsMediaFragmentURIParser.h
@@ -59,20 +59,16 @@ public:
   // returns the region. If not, returns an empty region. The unit
   // used depends on the value returned by GetClipUnit().
   nsIntRect GetClip() const { return *mClip; }
 
   // If a valid spatial media fragment indicated a clipping region,
   // returns the unit used.
   ClipUnit GetClipUnit() const { return mClipUnit; }
 
-  bool HasSampleSize() const { return mSampleSize.isSome(); }
-
-  int GetSampleSize() const { return *mSampleSize; }
-
 private:
   // Parse the URI ref provided, looking for media fragments. This is
   // the top-level parser the invokes the others below.
   void Parse(nsACString& aRef);
 
   // The following methods parse the fragment as per the media
   // fragments specification. 'aString' contains the remaining
   // fragment data to be parsed. The method returns true
@@ -85,22 +81,20 @@ private:
   bool ParseNPTFraction(nsDependentSubstring& aString, double& aFraction);
   bool ParseNPTMMSS(nsDependentSubstring& aString, double& aTime);
   bool ParseNPTHHMMSS(nsDependentSubstring& aString, double& aTime);
   bool ParseNPTHH(nsDependentSubstring& aString, uint32_t& aHour);
   bool ParseNPTMM(nsDependentSubstring& aString, uint32_t& aMinute);
   bool ParseNPTSS(nsDependentSubstring& aString, uint32_t& aSecond);
   bool ParseXYWH(nsDependentSubstring aString);
   bool ParseMozResolution(nsDependentSubstring aString);
-  bool ParseMozSampleSize(nsDependentSubstring aString);
 
   // Media fragment information.
   Maybe<double>    mStart;
   Maybe<double>    mEnd;
   Maybe<nsIntRect> mClip;
   ClipUnit         mClipUnit;
-  Maybe<int>       mSampleSize;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif