Bug 1264816 - Drop background_color from Web manifest image object. r=mconley
authorMarcos Caceres <marcos@marcosc.com>
Mon, 18 Apr 2016 23:19:00 +0200
changeset 331724 177d9f1a0f9a0864e0cda80dcf5f03e964237a2c
parent 331723 1a343fc53ce5ccd35a5cd308c34ec142ee103ee6
child 331725 f58b6c6a39f92e4b6d415a4d84ed5ceac0407b73
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1264816
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264816 - Drop background_color from Web manifest image object. r=mconley
dom/manifest/ImageObjectProcessor.jsm
dom/manifest/test/mochitest.ini
dom/manifest/test/test_ImageObjectProcessor_background_color.html
--- a/dom/manifest/ImageObjectProcessor.jsm
+++ b/dom/manifest/ImageObjectProcessor.jsm
@@ -70,17 +70,16 @@ ImageObjectProcessor.prototype.process =
   }
   return images;
 
   function toImageObject(aImageSpec) {
     return {
       'src': processSrcMember(aImageSpec, aBaseURL),
       'type': processTypeMember(aImageSpec),
       'sizes': processSizesMember(aImageSpec),
-      'background_color': processBackgroundColorMember(aImageSpec)
     };
   }
 
   function processTypeMember(aImage) {
     const charset = {};
     const hadCharset = {};
     const spec = {
       objectName: 'image',
@@ -144,22 +143,11 @@ ImageObjectProcessor.prototype.process =
       const widthAndHeight = size.split('x');
       const w = widthAndHeight.shift();
       const h = widthAndHeight.join('x');
       const validStarts = !w.startsWith('0') && !h.startsWith('0');
       const validDecimals = ImageObjectProcessor.decimals.test(w + h);
       return (validStarts && validDecimals);
     }
   }
-
-  function processBackgroundColorMember(aImage) {
-    const spec = {
-      objectName: 'image',
-      object: aImage,
-      property: 'background_color',
-      expectedType: 'string',
-      trim: true
-    };
-    return extractor.extractColorValue(spec);
-  }
 };
 this.ImageObjectProcessor = ImageObjectProcessor; // jshint ignore:line
 this.EXPORTED_SYMBOLS = ['ImageObjectProcessor']; // jshint ignore:line
--- a/dom/manifest/test/mochitest.ini
+++ b/dom/manifest/test/mochitest.ini
@@ -1,14 +1,13 @@
 [DEFAULT]
 support-files =
 	common.js
 	resource.sjs
 	manifestLoader.html
-[test_ImageObjectProcessor_background_color.html]
 [test_ImageObjectProcessor_sizes.html]
 [test_ImageObjectProcessor_src.html]
 [test_ImageObjectProcessor_type.html]
 [test_ManifestProcessor_background_color.html]
 [test_ManifestProcessor_dir.html]
 [test_ManifestProcessor_display.html]
 [test_ManifestProcessor_icons.html]
 [test_ManifestProcessor_JSON.html]
deleted file mode 100644
--- a/dom/manifest/test/test_ImageObjectProcessor_background_color.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1162808
--->
-
-<head>
-    <meta charset="utf-8">
-    <title>Test for Bug 1162808</title>
-    <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-    <script src="common.js"></script>
-    <script type="application/javascript">
-/**
- * Image object's type member
- * https://w3c.github.io/manifest/#type-member
- *
- * Checks that invalid and valid colors are processed correctly.
- **/
- /*globals data, processor, is*/
-'use strict';
-var testIcon = {
-  icons: [{
-    src: 'test',
-    'background_color': undefined
-  }]
-};
-
-// Test invalid colors.
-var invalidColors = [
-  'marooon',
-  'f000000',
-  '#ff00000',
-  'rgb(255 0 0)',
-  'rgb(100, 0%, 0%)',
-  'rgb(255,0)',
-  'rgb(300 0 0)',
-  'rbg(255,-10,0)',
-  'rgb(110, 0%, 0%)',
-  '(255,0,0) }',
-  'rgba(255)',
-  ' rgb(100%,0%,0%) }',
-  'hsl 120, 100%, 50%',
-  'hsla{120, 100%, 50%, 1}'
-];
-invalidColors.forEach((invalidColor) => {
-  var expected = `Treat invalid color (${invalidColor}) as undefined.`;
-  testIcon.icons[0].background_color = invalidColor;
-  data.jsonText = JSON.stringify(testIcon);
-  var result = processor.process(data);
-  is(result.icons[0].background_color, undefined, expected);
-});
-
-// Test valid colors.
-var validColors = [
-  'maroon',
-  '#f00',
-  '#ff0000',
-  'rgb(255,0,0)',
-  'rgb(100%, 0%, 0%)',
-  'rgb(255,0,0)',
-  'rgb(300,0,0)',
-  'rgb(255,-10,0)',
-  'rgb(110%, 0%, 0%)',
-  'rgb(255,0,0)',
-  'rgba(255,0,0,1)',
-  'rgb(100%,0%,0%)',
-  'rgba(100%,0%,0%,1)',
-  'rgba(0,0,255,0.5)',
-  'rgba(100%, 50%, 0%, 0.1)',
-  'hsl(120, 100%, 50%)',
-  'hsla(120, 100%, 50%, 1)'
-];
-
-validColors.forEach((color) => {
-  var expected = `Treat valid CSS color (${color}) as valid input.`;
-  testIcon.icons[0].background_color = color;
-  data.jsonText = JSON.stringify(testIcon);
-  var result = processor.process(data);
-  is(result.icons[0].background_color, color, expected);
-});
-</script>
-</head>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1162808">Mozilla Bug 1162808</a>