Bug 1560055 part 6. Add a test for reflection of percentage values and fix our one failure there. r=mccr8
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 28 Jun 2019 21:01:35 +0000
changeset 543449 269942e95ea4a4be661b8e1893fd2debee51484f
parent 543448 513a8dfd574e23c66cceec4f9aa862efc42b148c
child 543450 735e85ed0b388cc420af77940dcac1289f7fe0df
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1560055
milestone69.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 1560055 part 6. Add a test for reflection of percentage values and fix our one failure there. r=mccr8 Our new behavior should align with the Blink/WebKit behavior and the current spec, though I also filed https://github.com/whatwg/html/issues/4737 on the spec for the fact that dimension attributes reflecting as integers is a bit weird Differential Revision: https://phabricator.services.mozilla.com/D36130
dom/html/HTMLVideoElement.h
dom/html/nsGenericHTMLElement.cpp
dom/html/nsGenericHTMLElement.h
testing/web-platform/meta/html/dom/reflection-embedded.html.ini
testing/web-platform/meta/html/dom/reflection-forms.html.ini
testing/web-platform/meta/html/dom/reflection-metadata.html.ini
testing/web-platform/meta/html/dom/reflection-misc.html.ini
testing/web-platform/meta/html/dom/reflection-obsolete.html.ini
testing/web-platform/tests/html/dom/reflection.js
--- a/dom/html/HTMLVideoElement.h
+++ b/dom/html/HTMLVideoElement.h
@@ -61,23 +61,27 @@ class HTMLVideoElement final : public HT
 
   virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel) override;
 
   // Element
   virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override;
 
   // WebIDL
 
-  uint32_t Width() const { return GetUnsignedIntAttr(nsGkAtoms::width, 0); }
+  uint32_t Width() const {
+    return GetDimensionAttrAsUnsignedInt(nsGkAtoms::width, 0);
+  }
 
   void SetWidth(uint32_t aValue, ErrorResult& aRv) {
     SetUnsignedIntAttr(nsGkAtoms::width, aValue, 0, aRv);
   }
 
-  uint32_t Height() const { return GetUnsignedIntAttr(nsGkAtoms::height, 0); }
+  uint32_t Height() const {
+    return GetDimensionAttrAsUnsignedInt(nsGkAtoms::height, 0);
+  }
 
   void SetHeight(uint32_t aValue, ErrorResult& aRv) {
     SetUnsignedIntAttr(nsGkAtoms::height, aValue, 0, aRv);
   }
 
   uint32_t VideoWidth() const {
     if (mMediaInfo.HasVideo()) {
       if (mMediaInfo.mVideo.mRotation == VideoInfo::Rotation::kDegree_90 ||
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -1393,16 +1393,39 @@ uint32_t nsGenericHTMLElement::GetUnsign
   const nsAttrValue* attrVal = mAttrs.GetAttr(aAttr);
   if (!attrVal || attrVal->Type() != nsAttrValue::eInteger) {
     return aDefault;
   }
 
   return attrVal->GetIntegerValue();
 }
 
+uint32_t nsGenericHTMLElement::GetDimensionAttrAsUnsignedInt(
+    nsAtom* aAttr, uint32_t aDefault) const {
+  const nsAttrValue* attrVal = mAttrs.GetAttr(aAttr);
+  if (!attrVal) {
+    return aDefault;
+  }
+
+  if (attrVal->Type() == nsAttrValue::eInteger) {
+    return attrVal->GetIntegerValue();
+  }
+
+  if (attrVal->Type() == nsAttrValue::ePercent) {
+    // This is a nasty hack.  When we parsed the value, we stored it as an
+    // ePercent, not eInteger, because there was a '%' after it in the string.
+    // But the spec says to basically re-parse the string as an integer.
+    // Luckily, we can just return the value we have stored.  But
+    // GetPercentValue() divides it by 100, so we need to multiply it back.
+    return uint32_t(attrVal->GetPercentValue() * 100.0f);
+  }
+
+  return aDefault;
+}
+
 void nsGenericHTMLElement::GetURIAttr(nsAtom* aAttr, nsAtom* aBaseAttr,
                                       nsAString& aResult) const {
   nsCOMPtr<nsIURI> uri;
   bool hadAttr = GetURIAttr(aAttr, aBaseAttr, getter_AddRefs(uri));
   if (!hadAttr) {
     aResult.Truncate();
     return;
   }
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -782,16 +782,28 @@ class nsGenericHTMLElement : public nsGe
     } else {
       value.AppendInt(aValue);
     }
 
     SetHTMLAttr(aName, value, aError);
   }
 
   /**
+   * Gets the unsigned integer-value of an attribute that is stored as a
+   * dimension (i.e. could be an integer or a percentage), returns specified
+   * default value if the attribute isn't set or isn't set to a dimension. Only
+   * works for attributes in null namespace.
+   *
+   * @param aAttr    name of attribute.
+   * @param aDefault default-value to return if attribute isn't set.
+   */
+  uint32_t GetDimensionAttrAsUnsignedInt(nsAtom* aAttr,
+                                         uint32_t aDefault) const;
+
+  /**
    * Sets value of attribute to specified double. Only works for attributes
    * in null namespace.
    *
    * @param aAttr    name of attribute.
    * @param aValue   Double value of attribute.
    */
   void SetDoubleAttr(nsAtom* aAttr, double aValue, mozilla::ErrorResult& aRv) {
     nsAutoString value;
--- a/testing/web-platform/meta/html/dom/reflection-embedded.html.ini
+++ b/testing/web-platform/meta/html/dom/reflection-embedded.html.ini
@@ -894,16 +894,22 @@
     expected: FAIL
 
   [iframe.allowUserMedia: setAttribute() to 7]
     expected: FAIL
 
   [iframe.allowUserMedia: setAttribute() to 1.5]
     expected: FAIL
 
+  [iframe.allowUserMedia: setAttribute() to 1.5]
+    expected: FAIL
+
+  [iframe.allowUserMedia: setAttribute() to "5%"]
+    expected: FAIL
+
   [iframe.allowUserMedia: setAttribute() to true]
     expected: FAIL
 
   [iframe.allowUserMedia: setAttribute() to false]
     expected: FAIL
 
   [iframe.allowUserMedia: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -942,16 +948,19 @@
     expected: FAIL
 
   [iframe.allowUserMedia: IDL set to 7]
     expected: FAIL
 
   [iframe.allowUserMedia: IDL set to 1.5]
     expected: FAIL
 
+  [iframe.allowUserMedia: IDL set to "5%"]
+    expected: FAIL
+
   [iframe.allowUserMedia: IDL set to false]
     expected: FAIL
 
   [iframe.allowUserMedia: IDL set to object "[object Object\]"]
     expected: FAIL
 
   [iframe.allowUserMedia: IDL set to NaN]
     expected: FAIL
@@ -996,16 +1005,19 @@
     expected: FAIL
 
   [iframe.delegateStickyUserActivation: IDL set to 7]
     expected: FAIL
 
   [iframe.delegateStickyUserActivation: IDL set to 1.5]
     expected: FAIL
 
+  [iframe.delegateStickyUserActivation: IDL set to "5%"]
+    expected: FAIL
+
   [iframe.delegateStickyUserActivation: IDL set to true]
     expected: FAIL
 
   [iframe.delegateStickyUserActivation: IDL set to false]
     expected: FAIL
 
   [iframe.delegateStickyUserActivation: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -1059,16 +1071,19 @@
     expected: FAIL
 
   [video.playsInline: IDL set to Infinity]
     expected: FAIL
 
   [video.playsInline: IDL set to 1.5]
     expected: FAIL
 
+  [video.playsInline: IDL set to "5%"]
+    expected: FAIL
+
   [video.playsInline: setAttribute() to object "test-valueOf"]
     expected: FAIL
 
   [video.playsInline: setAttribute() to true]
     expected: FAIL
 
   [video.playsInline: IDL set to 7]
     expected: FAIL
@@ -1089,16 +1104,19 @@
     expected: FAIL
 
   [video.playsInline: IDL set to object "[object Object\]"]
     expected: FAIL
 
   [video.playsInline: setAttribute() to 1.5]
     expected: FAIL
 
+  [video.playsInline: setAttribute() to "5%"]
+    expected: FAIL
+
   [video.playsInline: setAttribute() to object "[object Object\]"]
     expected: FAIL
 
   [video.playsInline: setAttribute() to NaN]
     expected: FAIL
 
   [video.playsInline: setAttribute() to "\\0"]
     expected: FAIL
--- a/testing/web-platform/meta/html/dom/reflection-forms.html.ini
+++ b/testing/web-platform/meta/html/dom/reflection-forms.html.ini
@@ -1958,16 +1958,19 @@
     expected: FAIL
 
   [input.dirName: setAttribute() to 7]
     expected: FAIL
 
   [input.dirName: setAttribute() to 1.5]
     expected: FAIL
 
+  [input.dirName: setAttribute() to "5%"]
+    expected: FAIL
+
   [input.dirName: setAttribute() to true]
     expected: FAIL
 
   [input.dirName: setAttribute() to false]
     expected: FAIL
 
   [input.dirName: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -2003,16 +2006,19 @@
     expected: FAIL
 
   [input.dirName: IDL set to 7]
     expected: FAIL
 
   [input.dirName: IDL set to 1.5]
     expected: FAIL
 
+  [input.dirName: IDL set to "5%"]
+    expected: FAIL
+
   [input.dirName: IDL set to true]
     expected: FAIL
 
   [input.dirName: IDL set to false]
     expected: FAIL
 
   [input.dirName: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -2480,16 +2486,19 @@
     expected: FAIL
 
   [textarea.dirName: setAttribute() to 7]
     expected: FAIL
 
   [textarea.dirName: setAttribute() to 1.5]
     expected: FAIL
 
+  [textarea.dirName: setAttribute() to "5%"]
+    expected: FAIL
+
   [textarea.dirName: setAttribute() to true]
     expected: FAIL
 
   [textarea.dirName: setAttribute() to false]
     expected: FAIL
 
   [textarea.dirName: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -2525,16 +2534,19 @@
     expected: FAIL
 
   [textarea.dirName: IDL set to 7]
     expected: FAIL
 
   [textarea.dirName: IDL set to 1.5]
     expected: FAIL
 
+  [textarea.dirName: IDL set to "5%"]
+    expected: FAIL
+
   [textarea.dirName: IDL set to true]
     expected: FAIL
 
   [textarea.dirName: IDL set to false]
     expected: FAIL
 
   [textarea.dirName: IDL set to object "[object Object\]"]
     expected: FAIL
--- a/testing/web-platform/meta/html/dom/reflection-metadata.html.ini
+++ b/testing/web-platform/meta/html/dom/reflection-metadata.html.ini
@@ -51,16 +51,19 @@
     expected: FAIL
 
   [link.nonce: setAttribute() to 7]
     expected: FAIL
 
   [link.nonce: setAttribute() to 1.5]
     expected: FAIL
 
+  [link.nonce: setAttribute() to "5%"]
+    expected: FAIL
+
   [link.nonce: setAttribute() to true]
     expected: FAIL
 
   [link.nonce: setAttribute() to false]
     expected: FAIL
 
   [link.nonce: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -96,16 +99,19 @@
     expected: FAIL
 
   [link.nonce: IDL set to 7]
     expected: FAIL
 
   [link.nonce: IDL set to 1.5]
     expected: FAIL
 
+  [link.nonce: IDL set to "5%"]
+    expected: FAIL
+
   [link.nonce: IDL set to true]
     expected: FAIL
 
   [link.nonce: IDL set to false]
     expected: FAIL
 
   [link.nonce: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -696,16 +702,19 @@
     expected: FAIL
 
   [style.nonce: setAttribute() to 7]
     expected: FAIL
 
   [style.nonce: setAttribute() to 1.5]
     expected: FAIL
 
+  [style.nonce: setAttribute() to "5%"]
+    expected: FAIL
+
   [style.nonce: setAttribute() to true]
     expected: FAIL
 
   [style.nonce: setAttribute() to false]
     expected: FAIL
 
   [style.nonce: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -741,16 +750,19 @@
     expected: FAIL
 
   [style.nonce: IDL set to 7]
     expected: FAIL
 
   [style.nonce: IDL set to 1.5]
     expected: FAIL
 
+  [style.nonce: IDL set to "5%"]
+    expected: FAIL
+
   [style.nonce: IDL set to true]
     expected: FAIL
 
   [style.nonce: IDL set to false]
     expected: FAIL
 
   [style.nonce: IDL set to object "[object Object\]"]
     expected: FAIL
--- a/testing/web-platform/meta/html/dom/reflection-misc.html.ini
+++ b/testing/web-platform/meta/html/dom/reflection-misc.html.ini
@@ -619,16 +619,19 @@
     expected: FAIL
 
   [script.nonce: setAttribute() to 7]
     expected: FAIL
 
   [script.nonce: setAttribute() to 1.5]
     expected: FAIL
 
+  [script.nonce: setAttribute() to "5%"]
+    expected: FAIL
+
   [script.nonce: setAttribute() to true]
     expected: FAIL
 
   [script.nonce: setAttribute() to false]
     expected: FAIL
 
   [script.nonce: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -664,16 +667,19 @@
     expected: FAIL
 
   [script.nonce: IDL set to 7]
     expected: FAIL
 
   [script.nonce: IDL set to 1.5]
     expected: FAIL
 
+  [script.nonce: IDL set to "5%"]
+    expected: FAIL
+
   [script.nonce: IDL set to true]
     expected: FAIL
 
   [script.nonce: IDL set to false]
     expected: FAIL
 
   [script.nonce: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -715,16 +721,19 @@
     expected: FAIL
 
   [undefinedelement.inputMode: setAttribute() to 7]
     expected: FAIL
 
   [undefinedelement.inputMode: setAttribute() to 1.5]
     expected: FAIL
 
+  [undefinedelement.inputMode: setAttribute() to "5%"]
+    expected: FAIL
+
   [undefinedelement.inputMode: setAttribute() to true]
     expected: FAIL
 
   [undefinedelement.inputMode: setAttribute() to false]
     expected: FAIL
 
   [undefinedelement.inputMode: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -880,16 +889,19 @@
     expected: FAIL
 
   [undefinedelement.inputMode: IDL set to 7]
     expected: FAIL
 
   [undefinedelement.inputMode: IDL set to 1.5]
     expected: FAIL
 
+  [undefinedelement.inputMode: IDL set to "5%"]
+    expected: FAIL
+
   [undefinedelement.inputMode: IDL set to true]
     expected: FAIL
 
   [undefinedelement.inputMode: IDL set to false]
     expected: FAIL
 
   [undefinedelement.inputMode: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -1237,19 +1249,25 @@
     expected: FAIL
 
   [undefinedelement.enterKeyHint: setAttribute() to "xprevious"]
     expected: FAIL
 
   [undefinedelement.enterKeyHint: IDL set to 1.5]
     expected: FAIL
 
+  [undefinedelement.enterKeyHint: IDL set to "5%"]
+    expected: FAIL
+
   [undefinedelement.enterKeyHint: setAttribute() to 1.5]
     expected: FAIL
 
+  [undefinedelement.enterKeyHint: setAttribute() to "5%"]
+    expected: FAIL
+
   [undefinedelement.enterKeyHint: setAttribute() to "next"]
     expected: FAIL
 
   [undefinedelement.enterKeyHint: setAttribute() to -Infinity]
     expected: FAIL
 
   [undefinedelement.enterKeyHint: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f  foo "]
     expected: FAIL
--- a/testing/web-platform/meta/html/dom/reflection-obsolete.html.ini
+++ b/testing/web-platform/meta/html/dom/reflection-obsolete.html.ini
@@ -21,16 +21,19 @@
     expected: FAIL
 
   [applet.align: setAttribute() to 7]
     expected: FAIL
 
   [applet.align: setAttribute() to 1.5]
     expected: FAIL
 
+  [applet.align: setAttribute() to "5%"]
+    expected: FAIL
+
   [applet.align: setAttribute() to true]
     expected: FAIL
 
   [applet.align: setAttribute() to false]
     expected: FAIL
 
   [applet.align: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -66,16 +69,19 @@
     expected: FAIL
 
   [applet.align: IDL set to 7]
     expected: FAIL
 
   [applet.align: IDL set to 1.5]
     expected: FAIL
 
+  [applet.align: IDL set to "5%"]
+    expected: FAIL
+
   [applet.align: IDL set to true]
     expected: FAIL
 
   [applet.align: IDL set to false]
     expected: FAIL
 
   [applet.align: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -117,16 +123,19 @@
     expected: FAIL
 
   [applet.alt: setAttribute() to 7]
     expected: FAIL
 
   [applet.alt: setAttribute() to 1.5]
     expected: FAIL
 
+  [applet.alt: setAttribute() to "5%"]
+    expected: FAIL
+
   [applet.alt: setAttribute() to true]
     expected: FAIL
 
   [applet.alt: setAttribute() to false]
     expected: FAIL
 
   [applet.alt: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -162,16 +171,19 @@
     expected: FAIL
 
   [applet.alt: IDL set to 7]
     expected: FAIL
 
   [applet.alt: IDL set to 1.5]
     expected: FAIL
 
+  [applet.alt: IDL set to "5%"]
+    expected: FAIL
+
   [applet.alt: IDL set to true]
     expected: FAIL
 
   [applet.alt: IDL set to false]
     expected: FAIL
 
   [applet.alt: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -213,16 +225,19 @@
     expected: FAIL
 
   [applet.archive: setAttribute() to 7]
     expected: FAIL
 
   [applet.archive: setAttribute() to 1.5]
     expected: FAIL
 
+  [applet.archive: setAttribute() to "5%"]
+    expected: FAIL
+
   [applet.archive: setAttribute() to true]
     expected: FAIL
 
   [applet.archive: setAttribute() to false]
     expected: FAIL
 
   [applet.archive: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -258,16 +273,19 @@
     expected: FAIL
 
   [applet.archive: IDL set to 7]
     expected: FAIL
 
   [applet.archive: IDL set to 1.5]
     expected: FAIL
 
+  [applet.archive: IDL set to "5%"]
+    expected: FAIL
+
   [applet.archive: IDL set to true]
     expected: FAIL
 
   [applet.archive: IDL set to false]
     expected: FAIL
 
   [applet.archive: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -309,16 +327,19 @@
     expected: FAIL
 
   [applet.code: setAttribute() to 7]
     expected: FAIL
 
   [applet.code: setAttribute() to 1.5]
     expected: FAIL
 
+  [applet.code: setAttribute() to "5%"]
+    expected: FAIL
+
   [applet.code: setAttribute() to true]
     expected: FAIL
 
   [applet.code: setAttribute() to false]
     expected: FAIL
 
   [applet.code: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -354,16 +375,19 @@
     expected: FAIL
 
   [applet.code: IDL set to 7]
     expected: FAIL
 
   [applet.code: IDL set to 1.5]
     expected: FAIL
 
+  [applet.code: IDL set to "5%"]
+    expected: FAIL
+
   [applet.code: IDL set to true]
     expected: FAIL
 
   [applet.code: IDL set to false]
     expected: FAIL
 
   [applet.code: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -414,16 +438,19 @@
     expected: FAIL
 
   [applet.codeBase: setAttribute() to 7]
     expected: FAIL
 
   [applet.codeBase: setAttribute() to 1.5]
     expected: FAIL
 
+  [applet.codeBase: setAttribute() to "5%"]
+    expected: FAIL
+
   [applet.codeBase: setAttribute() to true]
     expected: FAIL
 
   [applet.codeBase: setAttribute() to false]
     expected: FAIL
 
   [applet.codeBase: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -468,16 +495,19 @@
     expected: FAIL
 
   [applet.codeBase: IDL set to 7]
     expected: FAIL
 
   [applet.codeBase: IDL set to 1.5]
     expected: FAIL
 
+  [applet.codeBase: IDL set to "5%"]
+    expected: FAIL
+
   [applet.codeBase: IDL set to true]
     expected: FAIL
 
   [applet.codeBase: IDL set to false]
     expected: FAIL
 
   [applet.codeBase: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -519,16 +549,19 @@
     expected: FAIL
 
   [applet.height: setAttribute() to 7]
     expected: FAIL
 
   [applet.height: setAttribute() to 1.5]
     expected: FAIL
 
+  [applet.height: setAttribute() to "5%"]
+    expected: FAIL
+
   [applet.height: setAttribute() to true]
     expected: FAIL
 
   [applet.height: setAttribute() to false]
     expected: FAIL
 
   [applet.height: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -564,16 +597,19 @@
     expected: FAIL
 
   [applet.height: IDL set to 7]
     expected: FAIL
 
   [applet.height: IDL set to 1.5]
     expected: FAIL
 
+  [applet.height: IDL set to "5%"]
+    expected: FAIL
+
   [applet.height: IDL set to true]
     expected: FAIL
 
   [applet.height: IDL set to false]
     expected: FAIL
 
   [applet.height: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -732,16 +768,19 @@
     expected: FAIL
 
   [applet.hspace: setAttribute() to undefined]
     expected: FAIL
 
   [applet.hspace: setAttribute() to 1.5]
     expected: FAIL
 
+  [applet.hspace: setAttribute() to "5%"]
+    expected: FAIL
+
   [applet.hspace: setAttribute() to true]
     expected: FAIL
 
   [applet.hspace: setAttribute() to false]
     expected: FAIL
 
   [applet.hspace: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -801,16 +840,19 @@
     expected: FAIL
 
   [applet.name: setAttribute() to 7]
     expected: FAIL
 
   [applet.name: setAttribute() to 1.5]
     expected: FAIL
 
+  [applet.name: setAttribute() to "5%"]
+    expected: FAIL
+
   [applet.name: setAttribute() to true]
     expected: FAIL
 
   [applet.name: setAttribute() to false]
     expected: FAIL
 
   [applet.name: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -846,16 +888,19 @@
     expected: FAIL
 
   [applet.name: IDL set to 7]
     expected: FAIL
 
   [applet.name: IDL set to 1.5]
     expected: FAIL
 
+  [applet.name: IDL set to "5%"]
+    expected: FAIL
+
   [applet.name: IDL set to true]
     expected: FAIL
 
   [applet.name: IDL set to false]
     expected: FAIL
 
   [applet.name: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -906,16 +951,19 @@
     expected: FAIL
 
   [applet.object: setAttribute() to 7]
     expected: FAIL
 
   [applet.object: setAttribute() to 1.5]
     expected: FAIL
 
+  [applet.object: setAttribute() to "5%"]
+    expected: FAIL
+
   [applet.object: setAttribute() to true]
     expected: FAIL
 
   [applet.object: setAttribute() to false]
     expected: FAIL
 
   [applet.object: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -960,16 +1008,19 @@
     expected: FAIL
 
   [applet.object: IDL set to 7]
     expected: FAIL
 
   [applet.object: IDL set to 1.5]
     expected: FAIL
 
+  [applet.object: IDL set to "5%"]
+    expected: FAIL
+
   [applet.object: IDL set to true]
     expected: FAIL
 
   [applet.object: IDL set to false]
     expected: FAIL
 
   [applet.object: IDL set to object "[object Object\]"]
     expected: FAIL
@@ -1128,16 +1179,19 @@
     expected: FAIL
 
   [applet.vspace: setAttribute() to undefined]
     expected: FAIL
 
   [applet.vspace: setAttribute() to 1.5]
     expected: FAIL
 
+  [applet.vspace: setAttribute() to "5%"]
+    expected: FAIL
+
   [applet.vspace: setAttribute() to true]
     expected: FAIL
 
   [applet.vspace: setAttribute() to false]
     expected: FAIL
 
   [applet.vspace: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -1197,16 +1251,19 @@
     expected: FAIL
 
   [applet.width: setAttribute() to 7]
     expected: FAIL
 
   [applet.width: setAttribute() to 1.5]
     expected: FAIL
 
+  [applet.width: setAttribute() to "5%"]
+    expected: FAIL
+
   [applet.width: setAttribute() to true]
     expected: FAIL
 
   [applet.width: setAttribute() to false]
     expected: FAIL
 
   [applet.width: setAttribute() to object "[object Object\]"]
     expected: FAIL
@@ -1242,16 +1299,19 @@
     expected: FAIL
 
   [applet.width: IDL set to 7]
     expected: FAIL
 
   [applet.width: IDL set to 1.5]
     expected: FAIL
 
+  [applet.width: IDL set to "5%"]
+    expected: FAIL
+
   [applet.width: IDL set to true]
     expected: FAIL
 
   [applet.width: IDL set to false]
     expected: FAIL
 
   [applet.width: IDL set to object "[object Object\]"]
     expected: FAIL
--- a/testing/web-platform/tests/html/dom/reflection.js
+++ b/testing/web-platform/tests/html/dom/reflection.js
@@ -140,17 +140,17 @@ ReflectionTests.typeMap = {
      * The data object passed to reflects() can contain an optional key
      * treatNullAsEmptyString, whose value is ignored.  If it does contain the
      * key, null will be cast to "" instead of "null", per WebIDL
      * [TreatNullAs=EmptyString].
      */
     "string": {
         "jsType": "string",
         "defaultVal": "",
-        "domTests": ["", " " + binaryString + " foo ", undefined, 7, 1.5, true,
+        "domTests": ["", " " + binaryString + " foo ", undefined, 7, 1.5, "5%", true,
                      false, {"test": 6}, NaN, +Infinity, -Infinity, "\0", null,
                      {"toString":function(){return "test-toString";}},
                      {"valueOf":function(){return "test-valueOf";}, toString:null}
                 ]
     },
     /**
      * "If a reflecting IDL attribute is a USVString attribute whose content
      * attribute is defined to contain a URL, then on getting, if the content
@@ -163,17 +163,17 @@ ReflectionTests.typeMap = {
      * new value."
      *
      * Also HTMLHyperLinkElementUtils href, used by a.href and area.href
      */
     "url": {
         "jsType": "string",
         "defaultVal": "",
         "domTests": ["", " foo ", "http://site.example/",
-                     "//site.example/path???@#l", binaryString, undefined, 7, 1.5, true,
+                     "//site.example/path???@#l", binaryString, undefined, 7, 1.5, "5%", true,
                      false, {"test": 6}, NaN, +Infinity, -Infinity, "\0", null,
                      {"toString":function(){return "test-toString";}},
                      {"valueOf":function(){return "test-valueOf";}, toString:null}],
         "domExpected": ReflectionTests.resolveUrl,
         "idlIdlExpected": ReflectionTests.resolveUrl
     },
     /**
      * "If a reflecting IDL attribute is a DOMString whose content attribute is
@@ -228,33 +228,33 @@ ReflectionTests.typeMap = {
      *
      * Tests are mostly hardcoded into reflects(), since they depend on the
      * keywords.  All expected values are computed in reflects() using a helper
      * function.
      */
     "enum": {
         "jsType": "string",
         "defaultVal": "",
-        "domTests": ["", " " + binaryString + " foo ", undefined, 7, 1.5, true,
+        "domTests": ["", " " + binaryString + " foo ", undefined, 7, 1.5, "5%", true,
                  false, {"test": 6}, NaN, +Infinity, -Infinity, "\0", null,
                  {"toString":function(){return "test-toString";}},
                  {"valueOf":function(){return "test-valueOf";}, toString:null}]
     },
     /**
      * "If a reflecting IDL attribute is a boolean attribute, then on getting
      * the IDL attribute must return true if the content attribute is set, and
      * false if it is absent. On setting, the content attribute must be removed
      * if the IDL attribute is set to false, and must be set to the empty
      * string if the IDL attribute is set to true. (This corresponds to the
      * rules for boolean content attributes.)"
      */
     "boolean": {
         "jsType": "boolean",
         "defaultVal": false,
-        "domTests": ["", " foo ", undefined, null, 7, 1.5, true, false,
+        "domTests": ["", " foo ", undefined, null, 7, 1.5, "5%", true, false,
                      {"test": 6}, NaN, +Infinity, -Infinity, "\0",
                      {"toString":function(){return "test-toString";}},
                      {"valueOf":function(){return "test-valueOf";}, toString:null}],
         "domExpected": function(val) {
             return true;
         }
     },
     /**
@@ -277,17 +277,17 @@ ReflectionTests.typeMap = {
                      " " + binaryString + " foo ",
                      // Test various different whitespace. Only 20, 9, A, C,
                      // and D are whitespace.
                      "\u00097", "\u000B7", "\u000C7", "\u00207", "\u00A07", "\uFEFF7",
                      "\u000A7", "\u000D7", "\u20287", "\u20297", "\u16807", "\u180E7",
                      "\u20007", "\u20017", "\u20027", "\u20037", "\u20047", "\u20057",
                      "\u20067", "\u20077", "\u20087", "\u20097", "\u200A7", "\u202F7",
                      "\u30007",
-                     undefined, 1.5, true, false, {"test": 6}, NaN, +Infinity,
+                     undefined, 1.5, "5%", true, false, {"test": 6}, NaN, +Infinity,
                      -Infinity, "\0",
                      {toString:function() {return 2;}, valueOf: null},
                      {valueOf:function() {return 3;}}],
         "domExpected": function(val) {
             var parsed = ReflectionTests.parseInt(String(val));
             if (parsed === false || parsed > maxInt || parsed < minInt) {
                 return null;
             }
@@ -316,17 +316,17 @@ ReflectionTests.typeMap = {
         "domTests": [minInt - 1, minInt, -36, -1, -0, 0, 1, maxInt, maxInt + 1,
                      maxUnsigned, maxUnsigned + 1, "", "-1", "-0", "0", "1",
                      " " + binaryString + " foo ",
                      "\u00097", "\u000B7", "\u000C7", "\u00207", "\u00A07", "\uFEFF7",
                      "\u000A7", "\u000D7", "\u20287", "\u20297", "\u16807", "\u180E7",
                      "\u20007", "\u20017", "\u20027", "\u20037", "\u20047", "\u20057",
                      "\u20067", "\u20077", "\u20087", "\u20097", "\u200A7", "\u202F7",
                      "\u30007",
-                     undefined, 1.5, true, false, {"test": 6}, NaN, +Infinity,
+                     undefined, 1.5, "5%", true, false, {"test": 6}, NaN, +Infinity,
                      -Infinity, "\0",
                      {toString:function() {return 2;}, valueOf: null},
                      {valueOf:function() {return 3;}}],
         "domExpected": function(val) {
             var parsed = ReflectionTests.parseNonneg(String(val));
             if (parsed === false || parsed > maxInt || parsed < minInt) {
                 return null;
             }
@@ -352,17 +352,17 @@ ReflectionTests.typeMap = {
         "defaultVal": 0,
         "domTests": [minInt - 1, minInt, -36,  -1,   0, 1, 257, maxInt,
                      maxInt + 1, maxUnsigned, maxUnsigned + 1, "", "-1", "-0", "0", "1",
                      "\u00097", "\u000B7", "\u000C7", "\u00207", "\u00A07", "\uFEFF7",
                      "\u000A7", "\u000D7", "\u20287", "\u20297", "\u16807", "\u180E7",
                      "\u20007", "\u20017", "\u20027", "\u20037", "\u20047", "\u20057",
                      "\u20067", "\u20077", "\u20087", "\u20097", "\u200A7", "\u202F7",
                      "\u30007",
-                     " " + binaryString + " foo ", undefined, 1.5, true, false,
+                     " " + binaryString + " foo ", undefined, 1.5, "5%", true, false,
                      {"test": 6}, NaN, +Infinity, -Infinity, "\0",
                      {toString:function() {return 2;}, valueOf: null},
                      {valueOf:function() {return 3;}}],
         "domExpected": function(val) {
             var parsed = ReflectionTests.parseNonneg(String(val));
             // Note maxInt, not maxUnsigned.
             if (parsed === false || parsed < 0 || parsed > maxInt) {
                 return null;
@@ -394,17 +394,17 @@ ReflectionTests.typeMap = {
         "defaultVal": 1,
         "domTests": [minInt - 1, minInt, -36,  -1,   0,    1, maxInt,
                      maxInt + 1, maxUnsigned, maxUnsigned + 1, "", "-1", "-0", "0", "1",
                      "\u00097", "\u000B7", "\u000C7", "\u00207", "\u00A07", "\uFEFF7",
                      "\u000A7", "\u000D7", "\u20287", "\u20297", "\u16807", "\u180E7",
                      "\u20007", "\u20017", "\u20027", "\u20037", "\u20047", "\u20057",
                      "\u20067", "\u20077", "\u20087", "\u20097", "\u200A7", "\u202F7",
                      "\u30007",
-                     " " + binaryString + " foo ", undefined, 1.5, true, false,
+                     " " + binaryString + " foo ", undefined, 1.5, "5%", true, false,
                      {"test": 6}, NaN, +Infinity, -Infinity, "\0",
                      {toString:function() {return 2;}, valueOf: null},
                      {valueOf:function() {return 3;}}],
         "domExpected": function(val) {
             var parsed = ReflectionTests.parseNonneg(String(val));
             // Note maxInt, not maxUnsigned.
             if (parsed === false || parsed < 1 || parsed > maxInt) {
                 return null;
@@ -434,17 +434,17 @@ ReflectionTests.typeMap = {
         "jsType": "number",
             "domTests": [minInt - 1, minInt, -36,  -1,   0,    1, maxInt,
                          maxInt + 1, maxUnsigned, maxUnsigned + 1, "", "-1", "-0", "0", "1",
                          "\u00097", "\u000B7", "\u000C7", "\u00207", "\u00A07", "\uFEFF7",
                          "\u000A7", "\u000D7", "\u20287", "\u20297", "\u16807", "\u180E7",
                          "\u20007", "\u20017", "\u20027", "\u20037", "\u20047", "\u20057",
                          "\u20067", "\u20077", "\u20087", "\u20097", "\u200A7", "\u202F7",
                          "\u30007",
-                         " " + binaryString + " foo ", undefined, 1.5, true, false,
+                         " " + binaryString + " foo ", undefined, 1.5, "5%", true, false,
                          {"test": 6}, NaN, +Infinity, -Infinity, "\0",
                          {toString:function() {return 2;}, valueOf: null},
                          {valueOf:function() {return 3;}}],
             "domExpected": function(val) {
                 var parsed = ReflectionTests.parseNonneg(String(val));
                 // Note maxInt, not maxUnsigned.
                 if (parsed === false || parsed < 1 || parsed > maxInt) {
                     return null;
@@ -473,17 +473,17 @@ ReflectionTests.typeMap = {
         "jsType": "number",
         "domTests": [minInt - 1, minInt, -36,  -1,   0,    1, maxInt,
                      maxInt + 1, maxUnsigned, maxUnsigned + 1, "", "-1", "-0", "0", "1",
                      "\u00097", "\u000B7", "\u000C7", "\u00207", "\u00A07", "\uFEFF7",
                      "\u000A7", "\u000D7", "\u20287", "\u20297", "\u16807", "\u180E7",
                      "\u20007", "\u20017", "\u20027", "\u20037", "\u20047", "\u20057",
                      "\u20067", "\u20077", "\u20087", "\u20097", "\u200A7", "\u202F7",
                      "\u30007",
-                     " " + binaryString + " foo ", undefined, 1.5, true, false,
+                     " " + binaryString + " foo ", undefined, 1.5, "5%", true, false,
                      {"test": 6}, NaN, +Infinity, -Infinity, "\0",
                      {toString:function() {return 2;}, valueOf: null},
                      {valueOf:function() {return 3;}}],
         "idlTests": [0, 1, 257, maxInt, "-0", maxInt + 1, maxUnsigned],
         "idlDomExpected": [0, 1, 257, maxInt, 0, null, null],
     },
     /**
      * "If a reflecting IDL attribute is a floating point number type (double),
@@ -514,30 +514,30 @@ ReflectionTests.typeMap = {
         "defaultVal": 0.0,
         "domTests": [minInt - 1, minInt, -36, -1, 0, 1, maxInt,
             maxInt + 1, maxUnsigned, maxUnsigned + 1, "",
             "\u00097", "\u000B7", "\u000C7", "\u00207", "\u00A07", "\uFEFF7",
             "\u000A7", "\u000D7", "\u20287", "\u20297", "\u16807", "\u180E7",
             "\u20007", "\u20017", "\u20027", "\u20037", "\u20047", "\u20057",
             "\u20067", "\u20077", "\u20087", "\u20097", "\u200A7", "\u202F7",
             "\u30007",
-            " " + binaryString + " foo ", undefined, 1.5, true, false,
+            " " + binaryString + " foo ", undefined, 1.5, "5%", true, false,
             {"test": 6}, NaN, +Infinity, -Infinity, "\0",
             {toString:function() {return 2;}, valueOf: null},
             {valueOf:function() {return 3;}}],
         "domExpected": [minInt - 1, minInt, -36, -1, 0, 1, maxInt,
                         maxInt + 1, maxUnsigned, maxUnsigned + 1, null,
                         // Leading whitespace tests
                         7, null, 7, 7, null, null,
                         7, 7, null, null, null, null,
                         null, null, null, null, null, null,
                         null, null, null, null, null, null,
                         null,
                         // End leading whitespace tests
-                        null, null, 1.5, null, null,
+                        null, null, 1.5, 5, null, null,
                         null, null, null, null, null,
                         2, 3],
         // I checked that ES ToString is well-defined for all of these (I
         // think).  Yes, String(-0) == "0".
         "idlTests":       [ -10000000000,   -1,  -0,   0,   1,   10000000000],
         "idlDomExpected": ["-10000000000", "-1", "0", "0", "1", "10000000000"],
         "idlIdlExpected": [ -10000000000,   -1,  -0,   0,   1,   10000000000]
     }