Bug 1211101 part 1: Fix existing style system mochitests to accomodate webkit-prefixed property aliases. r=heycam
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 06 Oct 2015 20:56:45 -0700
changeset 266434 798a47128b77bf682f5d67b13379f08c1a7d3dc1
parent 266433 e44fb274be902f321b12d899ac6a2717ea622f56
child 266435 a23e9cbf415d7dfe54ad6ad687a90492ac039796
push id66188
push userdholbert@mozilla.com
push dateWed, 07 Oct 2015 03:58:12 +0000
treeherdermozilla-inbound@a23e9cbf415d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1211101
milestone44.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 1211101 part 1: Fix existing style system mochitests to accomodate webkit-prefixed property aliases. r=heycam
layout/style/test/test_bug1112014.html
layout/style/test/test_property_database.html
layout/style/test/test_unprefixing_service.html
layout/style/test/test_unprefixing_service_prefs.html
layout/style/test/test_value_computation.html
layout/style/test/test_value_storage.html
--- a/layout/style/test/test_bug1112014.html
+++ b/layout/style/test/test_bug1112014.html
@@ -42,20 +42,28 @@ https://bugzilla.mozilla.org/show_bug.cg
     "border-image": {
       TYPE_LENGTH: "url(/somewhere) 30% / 30px stretch",
       TYPE_IMAGE_RECT: testValues.TYPE_IMAGE_RECT + " 30 30 stretch"
     },
     "-moz-border-image": {
       TYPE_LENGTH: "url(/somewhere) 30% / 30px stretch",
       TYPE_IMAGE_RECT: testValues.TYPE_IMAGE_RECT + " 30 30 stretch"
     },
+    "-webkit-border-image": {
+      TYPE_LENGTH: "url(/somewhere) 30% / 30px stretch",
+      TYPE_IMAGE_RECT: testValues.TYPE_IMAGE_RECT + " 30 30 stretch"
+    },
     "box-shadow": {
       TYPE_LENGTH: "2px 2px",
       TYPE_COLOR: testValues.TYPE_COLOR + " 2px 2px"
     },
+    "-webkit-box-shadow": {
+      TYPE_LENGTH: "2px 2px",
+      TYPE_COLOR: testValues.TYPE_COLOR + " 2px 2px"
+    },
     "text-shadow": {
       TYPE_LENGTH: "2px 2px",
       TYPE_COLOR: testValues.TYPE_COLOR + " 2px 2px"
     },
     "font-weight": {
       TYPE_NUMBER: "400"
     },
     "grid-template": {
--- a/layout/style/test/test_property_database.html
+++ b/layout/style/test/test_property_database.html
@@ -152,15 +152,19 @@ for (var prop in gCSSProperties) {
 for (var prop in gCSSProperties) {
   var entry = gCSSProperties[prop];
   var expectedDOMProp = prop.replace(/-([a-z])/g,
                                      function(m, p1, offset, str) {
                                        return p1.toUpperCase();
                                      });
   if (expectedDOMProp == "float") {
     expectedDOMProp = "cssFloat";
+  } else if (prop.startsWith("-webkit")) {
+    // Our DOM accessors for webkit-prefixed properties start with lowercase w,
+    // not uppercase like standard DOM accessors.
+    expectedDOMProp = expectedDOMProp.replace(/^W/, "w");
   }
   is(entry.domProp, expectedDOMProp, "DOM property for " + prop);
 }
 </script>
 </pre>
 </body>
 </html>
--- a/layout/style/test/test_unprefixing_service.html
+++ b/layout/style/test/test_unprefixing_service.html
@@ -71,17 +71,22 @@ function startNextTest()
 function begin()
 {
   // Before we start loading things in iframes, set up postMessage handler.
   registerPostMessageListener(startNextTest);
 
   // Turn on prefs & start the first test!
   SpecialPowers.pushPrefEnv(
     { set: [[PREF_UNPREFIXING_SERVICE, true],
-            [PREF_INCLUDE_TEST_DOMAINS, true]]},
+            [PREF_INCLUDE_TEST_DOMAINS, true],
+            // Make sure *native* -webkit prefix support is turned off. It's
+            // not whitelist-restricted, so if we left it enabled, it'd prevent
+            // us from being able to detect CSSUnprefixingService's domain
+            // whitelisting in this test.
+            ["layout.css.prefixes.webkit", false]]},
     startNextTest);
 }
 
 begin();
 
 </script>
 </pre>
 </body>
--- a/layout/style/test/test_unprefixing_service_prefs.html
+++ b/layout/style/test/test_unprefixing_service_prefs.html
@@ -115,14 +115,18 @@ function begin()
   // hence unprefixing should end up being disabled in our iframe). Subsequent
   // tests are kicked off via postMessage-triggered calls to startNextTest(),
   // which will tweak prefs and re-test.
   info("Verifying that CSS Unprefixing Service is inactive at test host, " +
        "with default pref configuration");
   testHost(WHITELISTED_TEST_HOST, false);
 }
 
-begin();
-
+// Before we start, make sure *native* -webkit prefix support is turned off.
+// It's not whitelist-restricted (and behaves slightly differently), so if we
+// left it enabled, it'd prevent us from being able to detect
+// CSSUnprefixingService's domain whitelisting in this test.
+SpecialPowers.pushPrefEnv({ set: [["layout.css.prefixes.webkit", false]]},
+                          begin);
 </script>
 </pre>
 </body>
 </html>
--- a/layout/style/test/test_value_computation.html
+++ b/layout/style/test/test_value_computation.html
@@ -57,16 +57,21 @@ var gBadComputed = {
 
 var gBadComputedNoFrame = {
   // These are probably bogus tests...
   "border-radius": [ "0%", "calc(-1%)", "calc(0px) calc(0pt) calc(0%) calc(0em)" ],
   "border-bottom-left-radius": [ "0%", "calc(-1%)" ],
   "border-bottom-right-radius": [ "0%", "calc(-1%)" ],
   "border-top-left-radius": [ "0%", "calc(-1%)" ],
   "border-top-right-radius": [ "0%", "calc(-1%)" ],
+  "-webkit-border-radius": [ "0%", "calc(-1%)", "calc(0px) calc(0pt) calc(0%) calc(0em)" ],
+  "-webkit-border-bottom-left-radius": [ "0%", "calc(-1%)" ],
+  "-webkit-border-bottom-right-radius": [ "0%", "calc(-1%)" ],
+  "-webkit-border-top-left-radius": [ "0%", "calc(-1%)" ],
+  "-webkit-border-top-right-radius": [ "0%", "calc(-1%)" ],
   "-moz-margin-end": [ "0%", "calc(0% + 0px)" ],
   "-moz-margin-start": [ "0%", "calc(0% + 0px)" ],
   "-moz-outline-radius": [ "0%", "calc(-1%)", "calc(0px) calc(0pt) calc(0%) calc(0em)" ],
   "-moz-outline-radius-bottomleft": [ "0%", "calc(-1%)" ],
   "-moz-outline-radius-bottomright": [ "0%", "calc(-1%)" ],
   "-moz-outline-radius-topleft": [ "0%", "calc(-1%)" ],
   "-moz-outline-radius-topright": [ "0%", "calc(-1%)" ],
   "-moz-padding-end": [ "0%", "calc(0% + 0px)", "calc(-1%)" ],
--- a/layout/style/test/test_value_storage.html
+++ b/layout/style/test/test_value_storage.html
@@ -86,16 +86,32 @@ var gPropertyShorthands = {};
 
 var gElement = document.getElementById("testnode");
 var gDeclaration = gElement.style;
 var gComputedStyle = window.getComputedStyle(gElement, "");
 
 var gPrereqDeclaration =
   document.getElementById("prereqsheet").sheet.cssRules[0].style;
 
+// Returns true if propA and propB are equivalent, considering aliasing.
+// (i.e. if one is an alias of the other, or if they're both aliases of
+// the same 3rd property)
+function are_properties_aliased(propA, propB)
+{
+  // If either property is an alias, replace it with the property it aliases.
+  if ("alias_for" in gCSSProperties[propA]) {
+    propA = gCSSProperties[propA].alias_for;
+  }
+  if ("alias_for" in gCSSProperties[propB]) {
+    propB = gCSSProperties[propB].alias_for;
+  }
+
+  return propA == propB;
+}
+
 function test_property(property)
 {
   var info = gCSSProperties[property];
 
   var test_computed = !("backend_only" in info);
 
   // can all properties be removed from the style?
   function test_remove_all_properties(property, value) {
@@ -107,17 +123,19 @@ function test_property(property)
     is(gDeclaration.cssText, "", "non-empty serialization after removing all properties " + errstr);
   }
 
   function test_other_shorthands_empty(value, subprop) {
     if (!(subprop in gPropertyShorthands)) return;
     var shorthands = gPropertyShorthands[subprop];
     for (idx in shorthands) {
       var sh = shorthands[idx];
-      if (sh.replace("-moz-","") == property.replace("-moz-","")) continue;
+      if (are_properties_aliased(sh, property)) {
+        continue;
+      }
       is(gDeclaration.getPropertyValue(sh), "",
          "setting '" + value + "' on '" + property + "' (for shorthand '" + sh + "')");
     }
   }
 
   function test_value(value, resolved_value) {
     var value_has_variable_reference = resolved_value != null;