Merge inbound to mozilla-central. a=merge
authorNoemi Erli <nerli@mozilla.com>
Mon, 24 Sep 2018 00:30:56 +0300
changeset 493568 b42bb6bb0be8
parent 493564 5e43b977f631 (current diff)
parent 493567 e04091914475 (diff)
child 493570 c970761f4617
child 493576 1ee87961e237
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone64.0a1
first release with
nightly linux32
b42bb6bb0be8 / 64.0a1 / 20180923220427 / files
nightly linux64
b42bb6bb0be8 / 64.0a1 / 20180923220427 / files
nightly mac
b42bb6bb0be8 / 64.0a1 / 20180923220427 / files
nightly win32
b42bb6bb0be8 / 64.0a1 / 20180923220427 / files
nightly win64
b42bb6bb0be8 / 64.0a1 / 20180923220427 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
--- a/layout/style/res/forms.css
+++ b/layout/style/res/forms.css
@@ -269,17 +269,17 @@ select[size][multiple] {
 }
 
 select[size="0"],
 select[size="1"] {
   /* Except this is not a listbox */
   background-color: -moz-Combobox;
   color: -moz-ComboboxText;
   vertical-align: baseline;
-  padding: 0;
+  padding: unset;
   -moz-appearance: menulist;
 }
 
 select > button {
   inline-size: 12px;
   white-space: nowrap;
   position: static !important;
   background-image: url("arrow.gif") !important;
@@ -326,19 +326,19 @@ select:empty {
 *|*::-moz-display-comboboxcontrol-frame {
   overflow: -moz-hidden-unscrollable;
   /* This block-start/end padding plus the combobox block-start/end border need to
      add up to the block-start/end borderpadding of text inputs and buttons */
   padding-block-start: 1px;
   padding-block-end: 1px;
   padding-inline-start: 4px;
   padding-inline-end: 0;
-  color: inherit;
+  color: unset;
   white-space: nowrap;
-  text-align: inherit;
+  text-align: unset;
   -moz-user-select: none;
   /* Make sure to size correctly if the combobox has a non-auto block-size. */
   block-size: 100% ! important;
   box-sizing: border-box ! important;
   line-height: -moz-block-height;
 }
 
 option {
@@ -375,17 +375,17 @@ select:focus > optgroup > option:checked
 optgroup {
   display: block;
   float: none !important;
   position: static !important;
   font: -moz-list;
   line-height: normal !important;
   font-style: italic;
   font-weight: bold;
-  font-size: inherit;
+  font-size: unset;
   -moz-user-select: none;
   text-indent: 0;
   white-space: nowrap !important;
   word-wrap: normal !important;
 }
 
 optgroup > option {
   padding-inline-start: 20px;
@@ -427,101 +427,101 @@ input:disabled,
 textarea:disabled,
 option:disabled,
 optgroup:disabled,
 select:disabled:disabled /* Need the pseudo-class twice to have the specificity
                             be at least the same as select[size][multiple] above */
 {
   color: GrayText;
   background-color: ThreeDLightShadow;
-  cursor: inherit;
+  cursor: unset;
 }
 
 input:disabled,
 textarea:disabled {
   cursor: default;
 }
 
 option:disabled,
 optgroup:disabled {
   background-color: transparent;
 }
 
 /* hidden inputs */
 input[type="hidden"] {
   -moz-appearance: none;
   display: none !important;
-  padding: 0;
+  padding: unset;
   border: 0;
   cursor: auto;
   -moz-user-focus: ignore;
   -moz-binding: none;
 }
 
 /* image buttons */
 input[type="image"] {
   -moz-appearance: none;
-  padding: 0;
+  padding: unset;
   border: none;
   background-color: transparent;
   font-family: sans-serif;
   font-size: small;
   cursor: pointer;
   -moz-binding: none;
 }
 
 input[type="image"]:disabled {
-  cursor: inherit;
+  cursor: unset;
 }
 
 input[type="image"]:-moz-focusring {
   /* Don't specify the outline-color, we should always use initial value. */
   outline: 1px dotted;
 }
 
 /* file selector */
 input[type="file"] {
   display: inline-block;
   white-space: nowrap;
   overflow: hidden;
   overflow-clip-box: padding-box;
-  color: inherit;
+  color: unset;
 
   /* Revert rules which apply on all inputs. */
   -moz-appearance: none;
   -moz-binding: none;
   cursor: default;
 
   border: none;
   background-color: transparent;
-  padding: 0;
+  padding: unset;
 }
 
 input[type="file"] > xul|label {
   min-inline-size: 12em;
   padding-inline-start: 5px;
   text-align: match-parent;
 
-  color: inherit;
-  font-size: inherit;
-  letter-spacing: inherit;
+  color: unset;
+  font-size: unset;
+  letter-spacing: unset;
 
   /*
    * Force the text to have LTR directionality. Otherwise filenames containing
    * RTL characters will be reordered with chaotic results.
    */
   direction: ltr !important;
 }
 
 /* button part of file selector */
 input[type="file"] > button[type="button"] {
   block-size: inherit;
-  font-size: inherit;
-  letter-spacing: inherit;
-  cursor: inherit;
+  font-size: unset;
+  letter-spacing: unset;
+  cursor: unset;
 }
 
 /* colored part of the color selector button */
 input[type="color"]::-moz-color-swatch {
   width: 100%;
   height: 100%;
   min-width: 3px;
   min-height: 3px;
@@ -577,17 +577,17 @@ input[type="checkbox"] {
 input[type="radio"]:disabled,
 input[type="radio"]:disabled:active,
 input[type="radio"]:disabled:hover,
 input[type="radio"]:disabled:hover:active,
 input[type="checkbox"]:disabled,
 input[type="checkbox"]:disabled:active,
 input[type="checkbox"]:disabled:hover,
 input[type="checkbox"]:disabled:hover:active {
-  cursor: inherit;
+  cursor: unset;
 }
 
 % On Mac, the native theme takes care of this.
 % See nsNativeThemeCocoa::ThemeDrawsFocusForWidget.
 %ifndef XP_MACOSX
 input[type="checkbox"]:-moz-focusring,
 input[type="radio"]:-moz-focusring {
   /* Don't specify the outline-color, we should always use initial value. */
@@ -644,17 +644,17 @@ input[type="submit"] {
 
 input[type="color"] {
   inline-size: 64px;
   block-size: 23px;
 }
 
 button {
   /* Buttons should lay out like "normal" html, mostly */
-  white-space: inherit;
+  white-space: unset;
   text-indent: 0;
   /* But no text-decoration reaching inside, by default */
   display: inline-block;
 }
 
 *|*::-moz-button-content {
   display: block;
   /* Please keep the Multicol/Flex/Grid/Align sections below in sync with
@@ -762,17 +762,17 @@ input[type="submit"]:disabled:active,
 input[type="submit"]:disabled {
   /* The sum of border and padding on block-start and block-end
      must be the same here and for text inputs */
   padding-block-start: 0px;
   padding-inline-end: 8px;
   padding-block-end: 0px;
   padding-inline-start: 8px;
   border: 2px outset ThreeDLightShadow;
-  cursor: inherit;
+  cursor: unset;
 }
 
 button:disabled:active, button:disabled,
 input[type="reset"]:disabled:active,
 input[type="reset"]:disabled,
 input[type="button"]:disabled:active,
 input[type="button"]:disabled,
 select:disabled > button,
@@ -1053,22 +1053,22 @@ input[type=number]::-moz-number-text {
   /* work around autofocus bug 939248 on initial load */
   -moz-user-modify: read-write;
   /* This pseudo-element is also an 'input' element (nested inside and
    * distinct from the <input type=number> element) so we need to prevent the
    * explicit setting of 'text-align' by the general CSS rule for 'input'
    * above. We want to inherit its value from its <input type=number>
    * ancestor, not have that general CSS rule reset it.
    */
-  text-align: inherit;
+  text-align: unset;
   text-decoration: inherit;
   ime-mode: inherit;
   flex: 1;
   min-inline-size: 0;
-  padding: 0;
+  padding: unset;
   border: 0;
   margin: 0;
 }
 
 input[type=number]::-moz-number-spin-box {
   writing-mode: horizontal-tb;
   display: flex;
   flex-direction: column;
--- a/layout/style/res/html.css
+++ b/layout/style/res/html.css
@@ -467,17 +467,17 @@ tfoot {
 /* for XHTML tables without tbody */
 table > tr {
   vertical-align: middle;
 }
 
 td { 
   display: table-cell;
   vertical-align: inherit;
-  text-align: inherit; 
+  text-align: unset; 
   padding: 1px;
 }
 
 th {
   display: table-cell;
   vertical-align: inherit;
   font-weight: bold;
   padding: 1px;
@@ -724,17 +724,17 @@ noembed, param, template {
 area {
   /* Don't give it frames other than its imageframe */
   display: none ! important;
 }
 
 iframe:fullscreen {
   /* iframes in full-screen mode don't show a border. */
   border: none !important;
-  padding: 0 !important;
+  padding: unset !important;
 }
 
 /* media elements */
 video > xul|videocontrols, audio > xul|videocontrols {
   display: -moz-box;
   -moz-box-orient: vertical;
   -moz-binding: url("chrome://global/content/bindings/videocontrols.xml#videoControls");
 }
@@ -894,17 +894,17 @@ rtc, rt {
 rtc:lang(zh), rt:lang(zh) {
   ruby-align: center;
 }
 rtc:lang(zh-TW), rt:lang(zh-TW) {
   font-size: 30%; /* bopomofo */
   -moz-min-font-size-ratio: 30%;
 }
 rtc > rt {
-  font-size: inherit;
+  font-size: unset;
 }
 ruby, rb, rt, rtc {
   unicode-bidi: isolate;
 }
 
 /* Shadow DOM v1
  * https://drafts.csswg.org/css-scoping/#slots-in-shadow-tree */
 slot {
--- a/layout/style/res/quirk.css
+++ b/layout/style/res/quirk.css
@@ -17,17 +17,17 @@ li ul, li ol, li dir, li menu {
   list-style-position: outside;
 }
 
 /* undo previous two rules for properly nested lists */
   ul ul,   ul ol,   ul dir,   ul menu,   ul li,
   ol ul,   ol ol,   ol dir,   ol menu,   ol li,
  dir ul,  dir ol,  dir dir,  dir menu,  dir li,
 menu ul, menu ol, menu dir, menu menu, menu li {
-  list-style-position: inherit;
+  list-style-position: unset;
 }
 
 
 /* Quirk: ensure that we get proper padding if the very first
  * node in an LI is another UL or OL. This is an ugly way to
  * fix the problem, because it extends the LI up into what
  * would otherwise appear to be the ULs space. (b=38832) */
 
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -5219,21 +5219,24 @@ SVGTextFrame::DoGlyphPositioning()
     return;
   }
 
   // If the textLength="" attribute was specified, then we need ResolvePositions
   // to record that a new run starts with each glyph.
   SVGTextContentElement* element = static_cast<SVGTextContentElement*>(GetContent());
   nsSVGLength2* textLengthAttr =
     element->GetAnimatedLength(nsGkAtoms::textLength);
+  uint16_t lengthAdjust =
+    element->EnumAttributes()[SVGTextContentElement::LENGTHADJUST].GetAnimValue();
   bool adjustingTextLength = textLengthAttr->IsExplicitlySet();
   float expectedTextLength = textLengthAttr->GetAnimValue(element);
 
-  if (adjustingTextLength && expectedTextLength < 0.0f) {
-    // If textLength="" is less than zero, ignore it.
+  if (adjustingTextLength &&
+      (expectedTextLength < 0.0f || lengthAdjust == LENGTHADJUST_UNKNOWN)) {
+    // If textLength="" is less than zero or lengthAdjust is unknown, ignore it.
     adjustingTextLength = false;
   }
 
   // Get the x, y, dx, dy, rotate values for the subtree.
   nsTArray<gfxPoint> deltas;
   if (!ResolvePositions(deltas, adjustingTextLength)) {
     // If ResolvePositions returned false, it means either there were some
     // characters in the DOM but none of them are displayed, or there was
@@ -5272,18 +5275,16 @@ SVGTextFrame::DoGlyphPositioning()
   double adjustment = 0.0;
   mLengthAdjustScaleFactor = 1.0f;
   if (adjustingTextLength) {
     nscoord frameLength = vertical ? PrincipalChildList().FirstChild()->GetRect().height
                                    : PrincipalChildList().FirstChild()->GetRect().width;
     float actualTextLength =
       static_cast<float>(presContext->AppUnitsToGfxUnits(frameLength) * factor);
 
-    uint16_t lengthAdjust =
-      element->EnumAttributes()[SVGTextContentElement::LENGTHADJUST].GetAnimValue();
     switch (lengthAdjust) {
       case LENGTHADJUST_SPACINGANDGLYPHS:
         // Scale the glyphs and their positions.
         if (actualTextLength > 0) {
           mLengthAdjustScaleFactor = expectedTextLength / actualTextLength;
         }
         break;
 
new file mode 100644
--- /dev/null
+++ b/layout/svg/crashtests/1474982.html
@@ -0,0 +1,2 @@
+<svg>
+<text lengthAdjust="" textLength="0">A</text>
--- a/layout/svg/crashtests/crashtests.list
+++ b/layout/svg/crashtests/crashtests.list
@@ -204,15 +204,16 @@ load 1348564.svg
 load 1402109.html
 load 1402124.html
 load 1402486.html
 load 1421807-1.html
 pref(dom.webcomponents.shadowdom.enabled,true) load 1421807-2.html
 load 1422226.html
 load 1443092.html
 load 1467552-1.html
+load 1474982.html
 load conditional-outer-svg-nondirty-reflow-assert.xhtml
 load extref-test-1.xhtml
 load blob-merging-and-retained-display-list.html
 load empty-blob-merging.html
 load grouping-empty-bounds.html
 load 1480275.html
 load 1480224.html
--- a/security/nss/TAG-INFO
+++ b/security/nss/TAG-INFO
@@ -1,1 +1,1 @@
-fe738aae0bcc
+2c85f81f9b5e
--- a/security/nss/coreconf/coreconf.dep
+++ b/security/nss/coreconf/coreconf.dep
@@ -5,8 +5,9 @@
 
 /*
  * A dummy header file that is a dependency for all the object files.
  * Used to force a full recompilation of NSS in Mozilla's Tinderbox
  * depend builds.  See comments in rules.mk.
  */
 
 #error "Do not include this header file."
+
new file mode 100644
--- /dev/null
+++ b/security/nss/gtests/pk11_gtest/pk11_cipherop_unittest.cc
@@ -0,0 +1,79 @@
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this file,
+// You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include "gtest/gtest.h"
+
+#include <assert.h>
+#include <limits.h>
+#include <prinit.h>
+#include <nss.h>
+#include <pk11pub.h>
+
+static const size_t kKeyLen = 128/8;
+
+namespace nss_test {
+
+//
+// The ciper tests using the bltest command cover a great deal of testing.
+// However, Bug 1489691 revealed a corner case which is covered here.
+// This test will make multiple calls to PK11_CipherOp using the same
+// cipher context with data that is not cipher block aligned.
+//
+
+static SECStatus GetBytes(PK11Context *ctx, uint8_t *bytes, size_t len)
+{
+  std::vector<uint8_t> in(len, 0);
+
+  int outlen;
+  SECStatus rv = PK11_CipherOp(ctx, bytes, &outlen, len, &in[0], len);
+  if (static_cast<size_t>(outlen) != len) {
+    return SECFailure;
+  }
+  return rv;
+}
+
+TEST(Pkcs11CipherOp, SingleCtxMultipleUnalignedCipherOps) {
+  PK11SlotInfo* slot;
+  PK11SymKey* key;
+  PK11Context* ctx;
+
+  NSSInitContext* globalctx = NSS_InitContext("", "", "", "", NULL,
+                    NSS_INIT_READONLY | NSS_INIT_NOCERTDB | NSS_INIT_NOMODDB |
+                      NSS_INIT_FORCEOPEN | NSS_INIT_NOROOTINIT);
+
+  const CK_MECHANISM_TYPE cipher = CKM_AES_CTR;
+
+  slot = PK11_GetInternalSlot();
+  ASSERT_TRUE(slot);
+
+  // Use arbitrary bytes for the AES key
+  uint8_t key_bytes[kKeyLen];
+  for (size_t i = 0; i < kKeyLen; i++) {
+    key_bytes[i] = i;
+  }
+
+  SECItem keyItem = { siBuffer, key_bytes, kKeyLen };
+
+  // The IV can be all zeros since we only encrypt once with
+  // each AES key.
+  CK_AES_CTR_PARAMS param = { 128, {} };
+  SECItem paramItem = { siBuffer, reinterpret_cast<unsigned char*>(&param), sizeof(CK_AES_CTR_PARAMS) };
+
+  key = PK11_ImportSymKey(slot, cipher, PK11_OriginUnwrap,
+                                        CKA_ENCRYPT, &keyItem, NULL);
+  ctx = PK11_CreateContextBySymKey(cipher, CKA_ENCRYPT, key, &paramItem);
+  ASSERT_TRUE(key);
+  ASSERT_TRUE(ctx);
+
+  uint8_t outbuf[128];
+  ASSERT_EQ(GetBytes(ctx, outbuf, 7), SECSuccess);
+  ASSERT_EQ(GetBytes(ctx, outbuf, 17), SECSuccess);
+
+  PK11_FreeSymKey(key);
+  PK11_FreeSlot(slot);
+  PK11_DestroyContext(ctx, PR_TRUE);
+  NSS_ShutdownContext(globalctx);
+}
+
+}  // namespace nss_test
--- a/security/nss/gtests/pk11_gtest/pk11_gtest.gyp
+++ b/security/nss/gtests/pk11_gtest/pk11_gtest.gyp
@@ -9,16 +9,17 @@
   'targets': [
     {
       'target_name': 'pk11_gtest',
       'type': 'executable',
       'sources': [
         'pk11_aeskeywrap_unittest.cc',
         'pk11_aes_gcm_unittest.cc',
         'pk11_chacha20poly1305_unittest.cc',
+        'pk11_cipherop_unittest.cc',
         'pk11_curve25519_unittest.cc',
         'pk11_ecdsa_unittest.cc',
         'pk11_encrypt_derive_unittest.cc',
         'pk11_pbkdf2_unittest.cc',
         'pk11_prf_unittest.cc',
         'pk11_prng_unittest.cc',
         'pk11_rsapkcs1_unittest.cc',
         'pk11_rsapss_unittest.cc',
--- a/security/nss/lib/freebl/ctr.c
+++ b/security/nss/lib/freebl/ctr.c
@@ -214,25 +214,28 @@ CTR_Update_HW_AES(CTRContext *ctr, unsig
         *outlen += needed;
         inlen -= needed;
         if (inlen == 0) {
             return SECSuccess;
         }
         PORT_Assert(ctr->bufPtr == blocksize);
     }
 
-    intel_aes_ctr_worker(((AESContext *)(ctr->context))->Nr)(
-        ctr, outbuf, outlen, maxout, inbuf, inlen, blocksize);
-    /* XXX intel_aes_ctr_worker should set *outlen. */
-    PORT_Assert(*outlen == 0);
-    fullblocks = (inlen / blocksize) * blocksize;
-    *outlen += fullblocks;
-    outbuf += fullblocks;
-    inbuf += fullblocks;
-    inlen -= fullblocks;
+    if (inlen >= blocksize) {
+        rv = intel_aes_ctr_worker(((AESContext *)(ctr->context))->Nr)(
+                 ctr, outbuf, outlen, maxout, inbuf, inlen, blocksize);
+        if (rv != SECSuccess) {
+            return SECFailure;
+        }
+        fullblocks = (inlen / blocksize) * blocksize;
+        *outlen += fullblocks;
+        outbuf += fullblocks;
+        inbuf += fullblocks;
+        inlen -= fullblocks;
+    }
 
     if (inlen == 0) {
         return SECSuccess;
     }
     rv = (*ctr->cipher)(ctr->context, ctr->buffer, &tmp, blocksize,
                         ctr->counter, blocksize, blocksize);
     ctr_GetNextCtr(ctr->counter, ctr->counterBits, blocksize);
     if (rv != SECSuccess) {