Bug 1278192 - Implement the value sanitizing algorithm for <input type=week>. r=smaug
authorJessica Jong <jjong@mozilla.com>
Thu, 08 Sep 2016 15:39:01 -0700
changeset 313357 c526dd176ca348e632559715bad25ae0380df04e
parent 313356 ec584a62ec2689226457b1679c3a5802637dcd3c
child 313358 93cf1a5af6a0384c4dc08869af8c5e14312aed7a
push id30679
push usercbook@mozilla.com
push dateFri, 09 Sep 2016 10:03:06 +0000
treeherdermozilla-central@feff79e5b137 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1278192
milestone51.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 1278192 - Implement the value sanitizing algorithm for <input type=week>. r=smaug
dom/html/HTMLInputElement.cpp
dom/html/HTMLInputElement.h
dom/html/test/forms/test_input_sanitization.html
dom/html/test/forms/test_input_typing_sanitization.html
dom/html/test/test_bug590363.html
testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valueMissing.html.ini
testing/web-platform/meta/html/semantics/forms/the-input-element/type-change-state.html.ini
testing/web-platform/meta/html/semantics/forms/the-input-element/valueMode.html.ini
testing/web-platform/meta/html/semantics/forms/the-input-element/week.html.ini
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -212,16 +212,17 @@ const Decimal HTMLInputElement::kStepSca
 const Decimal HTMLInputElement::kStepScaleFactorMonth = Decimal(1);
 const Decimal HTMLInputElement::kDefaultStepBase = Decimal(0);
 const Decimal HTMLInputElement::kDefaultStep = Decimal(1);
 const Decimal HTMLInputElement::kDefaultStepTime = Decimal(60);
 const Decimal HTMLInputElement::kStepAny = Decimal(0);
 
 const double HTMLInputElement::kMaximumYear = 275760;
 const double HTMLInputElement::kMinimumYear = 1;
+const double HTMLInputElement::kMaximumWeekInYear = 53;
 
 #define NS_INPUT_ELEMENT_STATE_IID                 \
 { /* dc3b3d14-23e2-4479-b513-7b369343e3a0 */       \
   0xdc3b3d14,                                      \
   0x23e2,                                          \
   0x4479,                                          \
   {0xb5, 0x13, 0x7b, 0x36, 0x93, 0x43, 0xe3, 0xa0} \
 }
@@ -5042,16 +5043,23 @@ HTMLInputElement::SanitizeValue(nsAStrin
       break;
     case NS_FORM_INPUT_MONTH:
       {
         if (!aValue.IsEmpty() && !IsValidMonth(aValue)) {
           aValue.Truncate();
         }
       }
       break;
+    case NS_FORM_INPUT_WEEK:
+      {
+        if (!aValue.IsEmpty() && !IsValidWeek(aValue)) {
+          aValue.Truncate();
+        }
+      }
+      break;
     case NS_FORM_INPUT_COLOR:
       {
         if (IsValidSimpleColor(aValue)) {
           ToLowerCase(aValue);
         } else {
           // Set default (black) color, if aValue wasn't parsed correctly.
           aValue.AssignLiteral("#000000");
         }
@@ -5072,16 +5080,53 @@ bool HTMLInputElement::IsValidSimpleColo
         !(aValue[i] >= 'A' && aValue[i] <= 'F')) {
       return false;
     }
   }
   return true;
 }
 
 bool
+HTMLInputElement::IsLeapYear(uint32_t aYear) const
+{
+  if ((aYear % 4 == 0 && aYear % 100 != 0) || ( aYear % 400 == 0)) {
+    return true;
+  }
+  return false;
+}
+
+uint32_t
+HTMLInputElement::DayOfWeek(uint32_t aYear, uint32_t aMonth, uint32_t aDay) const
+{
+  // Tomohiko Sakamoto algorithm.
+  int monthTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
+  aYear -= aMonth < 3;
+
+  return (aYear + aYear / 4 - aYear / 100 + aYear / 400 +
+          monthTable[aMonth - 1] + aDay) % 7;
+}
+
+uint32_t
+HTMLInputElement::MaximumWeekInYear(uint32_t aYear) const
+{
+  int day = DayOfWeek(aYear, 1, 1); // January 1.
+  // A year starting on Thursday or a leap year starting on Wednesday has 53
+  // weeks. All other years have 52 weeks.
+  return day == 4 || (day == 3 && IsLeapYear(aYear)) ? kMaximumWeekInYear
+                                                     : kMaximumWeekInYear - 1;
+}
+
+bool
+HTMLInputElement::IsValidWeek(const nsAString& aValue) const
+{
+  uint32_t year, week;
+  return ParseWeek(aValue, &year, &week);
+}
+
+bool
 HTMLInputElement::IsValidMonth(const nsAString& aValue) const
 {
   uint32_t year, month;
   return ParseMonth(aValue, &year, &month);
 }
 
 bool
 HTMLInputElement::IsValidDate(const nsAString& aValue) const
@@ -5118,16 +5163,44 @@ bool HTMLInputElement::ParseMonth(const 
   if (!ParseYear(yearStr, aYear)) {
     return false;
   }
 
   return DigitSubStringToNumber(aValue, endOfYearOffset + 1, 2, aMonth) &&
          *aMonth > 0 && *aMonth <= 12;
 }
 
+bool HTMLInputElement::ParseWeek(const nsAString& aValue,
+                                 uint32_t* aYear,
+                                 uint32_t* aWeek) const
+{
+  // Parse the year, month values out a string formatted as 'yyyy-Www'.
+  if (aValue.Length() < 8) {
+    return false;
+  }
+
+  uint32_t endOfYearOffset = aValue.Length() - 4;
+  if (aValue[endOfYearOffset] != '-') {
+    return false;
+  }
+
+  if (aValue[endOfYearOffset + 1] != 'W') {
+    return false;
+  }
+
+  const nsAString& yearStr = Substring(aValue, 0, endOfYearOffset);
+  if (!ParseYear(yearStr, aYear)) {
+    return false;
+  }
+
+  return DigitSubStringToNumber(aValue, endOfYearOffset + 2, 2, aWeek) &&
+         *aWeek > 0 && *aWeek <= MaximumWeekInYear(*aYear);
+
+}
+
 bool HTMLInputElement::ParseDate(const nsAString& aValue,
                                  uint32_t* aYear,
                                  uint32_t* aMonth,
                                  uint32_t* aDay) const
 {
 /*
  * Parse the year, month, day values out a date string formatted as 'yyyy-mm-dd'.
  * -The year must be 4 or more digits long, and year > 0
--- a/dom/html/HTMLInputElement.h
+++ b/dom/html/HTMLInputElement.h
@@ -1160,17 +1160,25 @@ protected:
    * Parse a color string of the form #XXXXXX where X should be hexa characters
    * @param the string to be parsed.
    * @return whether the string is a valid simple color.
    * Note : this function does not consider the empty string as valid.
    */
   bool IsValidSimpleColor(const nsAString& aValue) const;
 
   /**
-   * Parse a date string of the form yyyy-mm
+   * Parse a week string of the form yyyy-Www
+   * @param the string to be parsed.
+   * @return whether the string is a valid week.
+   * Note : this function does not consider the empty string as valid.
+   */
+  bool IsValidWeek(const nsAString& aValue) const;
+
+  /**
+   * Parse a month string of the form yyyy-mm
    * @param the string to be parsed.
    * @return whether the string is a valid month.
    * Note : this function does not consider the empty string as valid.
    */
   bool IsValidMonth(const nsAString& aValue) const;
 
   /**
    * Parse a date string of the form yyyy-mm-dd
@@ -1197,16 +1205,26 @@ protected:
    * @return the year and month in aYear and aMonth.
    * @return whether the parsing was successful.
    */
   bool ParseMonth(const nsAString& aValue,
                   uint32_t* aYear,
                   uint32_t* aMonth) const;
 
   /**
+   * Parse a week string of the form yyyy-Www
+   *
+   * @param the string to be parsed.
+   * @return the year and week in aYear and aWeek.
+   * @return whether the parsing was successful.
+   */
+  bool ParseWeek(const nsAString& aValue,
+                 uint32_t* aYear,
+                 uint32_t* aWeek) const;
+  /**
    * Parse a date string of the form yyyy-mm-dd
    *
    * @param the string to be parsed.
    * @return the date in aYear, aMonth, aDay.
    * @return whether the parsing was successful.
    */
   bool ParseDate(const nsAString& aValue,
                  uint32_t* aYear,
@@ -1220,16 +1238,32 @@ protected:
 
   /**
    * This methods returns the number of months between January 1970 and the
    * given year and month.
    */
   int32_t MonthsSinceJan1970(uint32_t aYear, uint32_t aMonth) const;
 
   /**
+   * This methods returns the day of the week given a date, note that 0 = Sunday.
+   */
+  uint32_t DayOfWeek(uint32_t aYear, uint32_t aMonth, uint32_t aDay) const;
+
+  /**
+   * This methods returns the maximum number of week in a given year, the
+   * result is either 52 or 53.
+   */
+  uint32_t MaximumWeekInYear(uint32_t aYear) const;
+
+  /**
+   * This methods returns true if it's a leap year.
+   */
+  bool IsLeapYear(uint32_t aYear) const;
+
+  /**
    * Returns whether aValue is a valid time as described by HTML specifications:
    * http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-time-string
    *
    * @param aValue the string to be tested.
    * @return Whether the string is a valid time per HTML specifications.
    */
   bool IsValidTime(const nsAString& aValue) const;
 
@@ -1455,16 +1489,18 @@ protected:
 
   // Float value returned by GetStep() when the step attribute is set to 'any'.
   static const Decimal kStepAny;
 
   // Maximum year limited by ECMAScript date object range, year <= 275760.
   static const double kMaximumYear;
   // Minimum year limited by HTML standard, year >= 1.
   static const double kMinimumYear;
+  // Long years in a ISO calendar have 53 weeks in them.
+  static const double kMaximumWeekInYear;
 
   /**
    * The type of this input (<input type=...>) as an integer.
    * @see nsIFormControl.h (specifically NS_FORM_INPUT_*)
    */
   uint8_t                  mType;
   nsContentUtils::AutocompleteAttrState mAutocompleteAttrState;
   bool                     mDisabledChanged     : 1;
--- a/dom/html/test/forms/test_input_sanitization.html
+++ b/dom/html/test/forms/test_input_sanitization.html
@@ -69,17 +69,17 @@ function flushDelayedTests(description)
 }
 
 // We are excluding "file" because it's too different from the other types.
 // And it has no sanitizing algorithm.
 var inputTypes =
 [
   "text", "password", "search", "tel", "hidden", "checkbox", "radio",
   "submit", "image", "reset", "button", "email", "url", "number", "date",
-  "time", "range", "color", "month"
+  "time", "range", "color", "month", "week"
 ];
 
 var todoTypes =
 [
   "datetime", "datetime-local",
 ];
 
 var valueModeValue =
@@ -186,16 +186,46 @@ function sanitizeValue(aType, aValue)
         return "";
       }
       var month = Number(match[2]);
       if (month > 12 || month < 1) {
         return "";
       }
       return aValue;
     case "week":
+      // https://html.spec.whatwg.org/multipage/infrastructure.html#valid-week-string
+      function isLeapYear(aYear) {
+        return ((aYear % 4 == 0) && (aYear % 100 != 0)) || (aYear % 400 == 0);
+      }
+      function getDayofWeek(aYear, aMonth, aDay) { /* 0 = Sunday */
+        // Tomohiko Sakamoto algorithm.
+        var monthTable = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4];
+        aYear -= Number(aMonth < 3);
+
+        return (aYear + parseInt(aYear / 4) - parseInt(aYear / 100) +
+                parseInt(aYear / 400) + monthTable[aMonth - 1] + aDay) % 7;
+      }
+      function getMaximumWeekInYear(aYear) {
+        var day = getDayofWeek(aYear, 1, 1);
+        return day == 4 || (day == 3 && isLeapYear(aYear)) ? 53 : 52;
+      }
+
+      var match = /^([0-9]{4,})-W([0-9]{2})$/.exec(aValue);
+      if (!match) {
+        return "";
+      }
+      var year = Number(match[1]);
+      if (year === 0) {
+        return "";
+      }
+      var week = Number(match[2]);
+      if (week > 53 || month < 1) {
+        return "";
+      }
+      return 1 <= week && week <= getMaximumWeekInYear(year) ? aValue : "";
     case "datetime":
     case "datetime-local":
       // TODO: write the sanitize algorithm.
       ok(false);
       return "";
     case "color":
       return /^#[0-9A-Fa-f]{6}$/.exec(aValue) ? aValue.toLowerCase() : "#000000";
     default:
@@ -360,16 +390,37 @@ function checkSanitizing(element, inputT
     "2013-03-13",
     "december",
     "abcdef",
     "12",
     "  2013-03",
     "2013 - 03",
     "2013 03",
     "2013/03",
+    // For week
+    "1970-W01",
+    "1970-W53",
+    "1964-W53",
+    "1900-W10",
+    "2004-W53",
+    "2065-W53",
+    "2099-W53",
+    "2010-W53",
+    "2016-W30",
+    "1900-W3",
+    "2016-w30",
+    "2016-30",
+    "16-W30",
+    "2016-Week30",
+    "2000-100",
+    "0000-W01",
+    "00-W01",
+    "123456-W05",
+    "1985-W100",
+    "week",
   ];
 
   for (value of testData) {
     element.setAttribute('value', value);
     delayed_is(element.value, sanitizeValue(type, value),
        "The value has not been correctly sanitized for type=" + type);
     delayed_is(element.getAttribute('value'), value,
        "The content value should not have been sanitized");
--- a/dom/html/test/forms/test_input_typing_sanitization.html
+++ b/dom/html/test/forms/test_input_typing_sanitization.html
@@ -193,16 +193,34 @@ function runTest()
         '-',
         'december',
         '2012-dec',
         '2012/12',
         '2012-99',
         '2012-1',
       ]
     },
+    {
+      type: 'week',
+      validData: [
+        '0001-W01',
+        '1970-W53',
+        '100000-W52',
+        '2016-W30',
+      ],
+      invalidData: [
+        '1-W01',
+        'week',
+        '2016-30',
+        '2010-W80',
+        '2000/W30',
+        '1985-W00',
+        '1000-W'
+      ]
+    },
     { type: 'datetime', todo: true },
     { type: 'datetime-local', todo: true },
   ];
 
   for (test of data) {
     gCurrentTest = test;
 
     if (test.todo) {
--- a/dom/html/test/test_bug590363.html
+++ b/dom/html/test/test_bug590363.html
@@ -43,55 +43,58 @@ var testData = [
   [ 'week',     true ]
   // 'file' is treated separatly.
 ];
 
 var todoTypes = [
   "datetime", "datetime-local"
 ];
 
-var nonTrivialSanitizing = [ 'number', 'date', 'time', 'color', 'month' ];
+var nonTrivialSanitizing = [ 'number', 'date', 'time', 'color', 'month', 'week' ];
 
 var length = testData.length;
 for (var i=0; i<length; ++i) {
   for (var j=0; j<length; ++j) {
     var e = document.createElement('input');
     e.type = testData[i][0];
 
     var expectedValue;
 
     // range will sanitize its value to 50 (the default) if it isn't a valid
     // number. We need to handle that specially.
     if (testData[j][0] == 'range' || testData[i][0] == 'range') {
       if (testData[j][0] == 'date' || testData[j][0] == 'time' ||
-          testData[j][0] == 'month') {
+          testData[j][0] == 'month' || testData[j][0] == 'week') {
         expectedValue = '';
       } else if (testData[j][0] == 'color') {
         expectedValue = '#000000';
       } else {
         expectedValue = '50';
       }
     } else if (testData[i][0] == 'color' || testData[j][0] == 'color') {
         if (testData[j][0] == 'number' || testData[j][0] == 'date' ||
-            testData[j][0] == 'time' || testData[j][0] == 'month') {
+            testData[j][0] == 'time' || testData[j][0] == 'month' ||
+            testData[j][0] == 'week') {
           expectedValue = ''
         } else {
           expectedValue = '#000000';
         }
     } else if (nonTrivialSanitizing.indexOf(testData[i][0]) != -1 &&
                nonTrivialSanitizing.indexOf(testData[j][0]) != -1) {
       expectedValue = '';
     } else if (testData[i][0] == 'number' || testData[j][0] == 'number') {
       expectedValue = '42';
     } else if (testData[i][0] == 'date' || testData[j][0] == 'date') {
       expectedValue = '2012-12-21';
     } else if (testData[i][0] == 'time' || testData[j][0] == 'time') {
       expectedValue = '21:21';
     } else if (testData[i][0] == 'month' || testData[j][0] == 'month') {
       expectedValue = '2013-03';
+    } else if (testData[i][0] == 'week' || testData[j][0] == 'week') {
+      expectedValue = '2016-W35';
     } else {
       expectedValue = "foo";
     }
     e.value = expectedValue;
 
     e.type = testData[j][0];
     is(e.value, expectedValue, ".value should still return the same value after " +
        "changing type from " + testData[i][0] + " to " + testData[j][0]);
--- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valueMissing.html.ini
+++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valueMissing.html.ini
@@ -1,20 +1,4 @@
 [form-validation-validity-valueMissing.html]
   type: testharness
   [[INPUT in DATETIME status\] The datetime type must be supported.]
     expected: FAIL
-
-  [[INPUT in WEEK status\] The value attribute is a number(1234567)]
-    expected: FAIL
-
-  [[INPUT in WEEK status\] The value attribute is a Date object]
-    expected: FAIL
-
-  [[INPUT in WEEK status\] Invalid week string(2000-W99)]
-    expected: FAIL
-
-  [[INPUT in WEEK status\] invalid week string(2000-W00)]
-    expected: FAIL
-
-  [[INPUT in WEEK status\] invalid week string(2000-w01)]
-    expected: FAIL
-
--- a/testing/web-platform/meta/html/semantics/forms/the-input-element/type-change-state.html.ini
+++ b/testing/web-platform/meta/html/semantics/forms/the-input-element/type-change-state.html.ini
@@ -1,25 +1,19 @@
 [type-change-state.html]
   type: testharness
   [change state from hidden to datetime]
     expected: FAIL
 
-  [change state from hidden to week]
-    expected: FAIL
-
   [change state from text to hidden]
     expected: FAIL
 
   [change state from text to datetime]
     expected: FAIL
 
-  [change state from text to week]
-    expected: FAIL
-
   [change state from text to checkbox]
     expected: FAIL
 
   [change state from text to radio]
     expected: FAIL
 
   [change state from text to submit]
     expected: FAIL
@@ -34,19 +28,16 @@
     expected: FAIL
 
   [change state from search to hidden]
     expected: FAIL
 
   [change state from search to datetime]
     expected: FAIL
 
-  [change state from search to week]
-    expected: FAIL
-
   [change state from search to checkbox]
     expected: FAIL
 
   [change state from search to radio]
     expected: FAIL
 
   [change state from search to submit]
     expected: FAIL
@@ -61,19 +52,16 @@
     expected: FAIL
 
   [change state from tel to hidden]
     expected: FAIL
 
   [change state from tel to datetime]
     expected: FAIL
 
-  [change state from tel to week]
-    expected: FAIL
-
   [change state from tel to checkbox]
     expected: FAIL
 
   [change state from tel to radio]
     expected: FAIL
 
   [change state from tel to submit]
     expected: FAIL
@@ -100,19 +88,16 @@
     expected: FAIL
 
   [change state from url to password]
     expected: FAIL
 
   [change state from url to datetime]
     expected: FAIL
 
-  [change state from url to week]
-    expected: FAIL
-
   [change state from url to checkbox]
     expected: FAIL
 
   [change state from url to radio]
     expected: FAIL
 
   [change state from url to submit]
     expected: FAIL
@@ -139,19 +124,16 @@
     expected: FAIL
 
   [change state from email to password]
     expected: FAIL
 
   [change state from email to datetime]
     expected: FAIL
 
-  [change state from email to week]
-    expected: FAIL
-
   [change state from email to checkbox]
     expected: FAIL
 
   [change state from email to radio]
     expected: FAIL
 
   [change state from email to submit]
     expected: FAIL
@@ -166,19 +148,16 @@
     expected: FAIL
 
   [change state from password to hidden]
     expected: FAIL
 
   [change state from password to datetime]
     expected: FAIL
 
-  [change state from password to week]
-    expected: FAIL
-
   [change state from password to checkbox]
     expected: FAIL
 
   [change state from password to radio]
     expected: FAIL
 
   [change state from password to submit]
     expected: FAIL
@@ -190,19 +169,16 @@
     expected: FAIL
 
   [change state from password to button]
     expected: FAIL
 
   [change state from datetime to hidden]
     expected: FAIL
 
-  [change state from datetime to week]
-    expected: FAIL
-
   [change state from datetime to checkbox]
     expected: FAIL
 
   [change state from datetime to radio]
     expected: FAIL
 
   [change state from datetime to submit]
     expected: FAIL
@@ -292,17 +268,32 @@
     expected: FAIL
 
   [change state from month to button]
     expected: FAIL
 
   [change state from week to hidden]
     expected: FAIL
 
-  [change state from week to datetime]
+  [change state from week to text]
+    expected: FAIL
+
+  [change state from week to search]
+    expected: FAIL
+
+  [change state from week to tel]
+    expected: FAIL
+
+  [change state from week to url]
+    expected: FAIL
+
+  [change state from week to email]
+    expected: FAIL
+
+  [change state from week to password]
     expected: FAIL
 
   [change state from week to checkbox]
     expected: FAIL
 
   [change state from week to radio]
     expected: FAIL
 
@@ -415,19 +406,16 @@
     expected: FAIL
 
   [change state from range to password]
     expected: FAIL
 
   [change state from range to datetime]
     expected: FAIL
 
-  [change state from range to week]
-    expected: FAIL
-
   [change state from range to number]
     expected: FAIL
 
   [change state from range to checkbox]
     expected: FAIL
 
   [change state from range to radio]
     expected: FAIL
@@ -463,19 +451,16 @@
     expected: FAIL
 
   [change state from color to password]
     expected: FAIL
 
   [change state from color to datetime]
     expected: FAIL
 
-  [change state from color to week]
-    expected: FAIL
-
   [change state from color to checkbox]
     expected: FAIL
 
   [change state from color to radio]
     expected: FAIL
 
   [change state from color to submit]
     expected: FAIL
@@ -487,25 +472,19 @@
     expected: FAIL
 
   [change state from color to button]
     expected: FAIL
 
   [change state from checkbox to datetime]
     expected: FAIL
 
-  [change state from checkbox to week]
-    expected: FAIL
-
   [change state from radio to datetime]
     expected: FAIL
 
-  [change state from radio to week]
-    expected: FAIL
-
   [change state from file to hidden]
     expected: FAIL
 
   [change state from file to text]
     expected: FAIL
 
   [change state from file to search]
     expected: FAIL
@@ -562,29 +541,16 @@
     expected: FAIL
 
   [change state from file to button]
     expected: FAIL
 
   [change state from submit to datetime]
     expected: FAIL
 
-  [change state from submit to week]
-    expected: FAIL
-
   [change state from image to datetime]
     expected: FAIL
 
-  [change state from image to week]
-    expected: FAIL
-
   [change state from reset to datetime]
     expected: FAIL
 
-  [change state from reset to week]
-    expected: FAIL
-
   [change state from button to datetime]
     expected: FAIL
-
-  [change state from button to week]
-    expected: FAIL
-
--- a/testing/web-platform/meta/html/semantics/forms/the-input-element/valueMode.html.ini
+++ b/testing/web-platform/meta/html/semantics/forms/the-input-element/valueMode.html.ini
@@ -7,22 +7,16 @@
     expected: FAIL
 
   [value IDL attribute of input type datetime without value attribute]
     expected: FAIL
 
   [value IDL attribute of input type datetime with value attribute]
     expected: FAIL
 
-  [value IDL attribute of input type week without value attribute]
-    expected: FAIL
-
-  [value IDL attribute of input type week with value attribute]
-    expected: FAIL
-
   [value IDL attribute of input type checkbox without value attribute]
     expected: FAIL
 
   [value IDL attribute of input type checkbox with value attribute]
     expected: FAIL
 
   [value IDL attribute of input type radio without value attribute]
     expected: FAIL
--- a/testing/web-platform/meta/html/semantics/forms/the-input-element/week.html.ini
+++ b/testing/web-platform/meta/html/semantics/forms/the-input-element/week.html.ini
@@ -1,26 +1,8 @@
 [week.html]
   type: testharness
-  [2014 has 52 weeks: Value should be empty]
-    expected: FAIL
-
-  [Invalid value: year only]
-    expected: FAIL
-
-  [Invalid value: no week number]
-    expected: FAIL
-
-  [Invalid value: no '-' (U+002D)]
-    expected: FAIL
-
-  [Invalid value: yearless week]
-    expected: FAIL
-
-  [Invalid value: yearless week and no '-' (U+002D)]
-    expected: FAIL
-
   [Value < min attribute]
     expected: FAIL
 
   [Value > max attribute]
     expected: FAIL