Version 1.6.3

svn merge -c 40430 https://dart.googlecode.com/svn/branches/bleeding_edge 1.6

R=ricow@google.com

Review URL: https://codereview.chromium.org//596563004

git-svn-id: http://dart.googlecode.com/svn/branches/1.6@40585 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/runtime/bin/net/nss.gyp b/runtime/bin/net/nss.gyp
index cbd86a8..4867584 100644
--- a/runtime/bin/net/nss.gyp
+++ b/runtime/bin/net/nss.gyp
@@ -7,7 +7,7 @@
 # BSD-style license that can be found in the LICENSE file.
 
 # This file is a modified copy of Chromium's deps/third_party/nss/nss.gyp.
-# Revision 257452 (this should agree with "nss_rev" in DEPS).
+# Revision 291806 (this should agree with "nss_rev" in DEPS).
 {
   # Added by Dart. All Dart comments refer to the following block or line.
   'includes': [
@@ -325,6 +325,14 @@
       },
       # TODO(wtc): suppress C4244 and C4554 in prdtoa.c.
       'msvs_disabled_warnings': [4018, 4244, 4554, 4267,],
+      'variables': {
+        'clang_warning_flags': [
+          # nspr passes "const char*" through "void*".
+          '-Wno-incompatible-pointer-types',
+          # nspr passes "int*" through "unsigned int*".
+          '-Wno-pointer-sign',
+        ],
+      },
       'conditions': [
         ['OS=="mac" or OS=="ios"', {
           'defines': [
@@ -472,16 +480,8 @@
               # nspr uses a bunch of deprecated functions (NSLinkModule etc) in
               # prlink.c on mac.
               '-Wno-deprecated-declarations',
-              # nspr passes "const char*" through "void*".
-              '-Wno-incompatible-pointer-types',
-              # nspr passes "int*" through "unsigned int*".
-              '-Wno-pointer-sign',
             ],
           },
-          'cflags': [
-            '-Wno-incompatible-pointer-types',
-            '-Wno-pointer-sign',
-          ],
         }],
       ],
     },
@@ -601,6 +601,9 @@
         ],
       },
     },
+    # Removed by Dart: the target nss_static_avx_dart.
+    # This is an optimization of AES on 32 bit Windows using new
+    # Intel assembly instructions.  Not enabling it on Dart.
     {
       'target_name': 'nss_static_dart',  # Added by Dart (the _dart postfix)
       'type': 'static_library',
@@ -708,6 +711,7 @@
         '<(nss_directory)/nss/lib/freebl/dsa.c',
         '<(nss_directory)/nss/lib/freebl/ec.c',
         '<(nss_directory)/nss/lib/freebl/ec.h',
+        '<(nss_directory)/nss/lib/freebl/ecdecode.c',
         '<(nss_directory)/nss/lib/freebl/ecl/ec2.h',
         '<(nss_directory)/nss/lib/freebl/ecl/ecl-curve.h',
         '<(nss_directory)/nss/lib/freebl/ecl/ecl-exp.h',
@@ -729,6 +733,7 @@
         '<(nss_directory)/nss/lib/freebl/ecl/ec_naf.c',
         '<(nss_directory)/nss/lib/freebl/gcm.c',
         '<(nss_directory)/nss/lib/freebl/gcm.h',
+        # Changed by Dart: intel-aes assembly language files dropped.
         '<(nss_directory)/nss/lib/freebl/hmacct.c',
         '<(nss_directory)/nss/lib/freebl/hmacct.h',
         '<(nss_directory)/nss/lib/freebl/jpake.c',
@@ -751,6 +756,7 @@
         '<(nss_directory)/nss/lib/freebl/mpi/mp_gf2m.c',
         '<(nss_directory)/nss/lib/freebl/mpi/mp_gf2m.h',
         '<(nss_directory)/nss/lib/freebl/mpi/primes.c',
+        '<(nss_directory)/nss/lib/freebl/nss_build_config_mac.h',
         '<(nss_directory)/nss/lib/freebl/poly1305/poly1305-donna-x64-sse2-incremental-source.c',
         '<(nss_directory)/nss/lib/freebl/poly1305/poly1305.c',
         '<(nss_directory)/nss/lib/freebl/poly1305/poly1305.h',
@@ -1013,7 +1019,6 @@
         '<(nss_directory)/nss/lib/smime/cmsreclist.h',
         '<(nss_directory)/nss/lib/smime/cmst.h',
         '<(nss_directory)/nss/lib/smime/smime.h',
-        '<(nss_directory)/nss/lib/softoken/ecdecode.c',
         '<(nss_directory)/nss/lib/softoken/fipsaudt.c',
         '<(nss_directory)/nss/lib/softoken/fipstest.c',
         '<(nss_directory)/nss/lib/softoken/fipstokn.c',
@@ -1123,6 +1128,7 @@
       ],
       'dependencies': [
         'nspr_dart',  # Added by Dart (the _dart postfix)
+        # Removed by Dart: nss_static_avx target dependency.
         'sqlite.gyp:sqlite_dart',  # Changed by Dart prefix ../sqllite removed _dart postfix added.
       ],
       'export_dependent_settings': [
@@ -1195,6 +1201,20 @@
         ],
       },
       'msvs_disabled_warnings': [4018, 4101, 4267, ],
+      'variables': {
+        'clang_warning_flags': [
+          # nss doesn't explicitly cast between different enum types.
+          '-Wno-conversion',
+          # nss passes "const char*" through "void*".
+          '-Wno-incompatible-pointer-types',
+          # nss prefers `a && b || c` over `(a && b) || c`.
+          '-Wno-logical-op-parentheses',
+          # nss doesn't use exhaustive switches on enums
+          '-Wno-switch',
+          # nss has some `unsigned < 0` checks.
+          '-Wno-tautological-compare',
+        ],
+      },
       'conditions': [
         ['exclude_nss_root_certs==1', {
           'defines': [
@@ -1286,7 +1306,7 @@
             '<(nss_directory)/nss/lib/freebl/mpi/mpi_x86_asm.c',
           ],
           'variables': {
-            'forced_include_file': '<(DEPTH)/third_party/nss/nss/lib/freebl/build_config_mac.h',
+            'forced_include_file': 'nss_build_config_mac.h',
           },
           'xcode_settings': {
             'conditions': [
@@ -1338,8 +1358,16 @@
           #       'MP_ASSEMBLY_DIV_2DX1D',
           #       'MP_USE_UINT_DIGIT',
           #       'MP_NO_MP_WORD',
+          # Changed by Dart: 'USE_HW_AES' and 'INTEL_GCM' are not enabled.
+          #       'USE_HW_AES',
+          #       'INTEL_GCM',
           #     ],
           #   }],
+          #   'msvs_settings': {
+          #     'MASM': {
+          #       'UseSafeExceptionHandlers': 'true',
+          #     },
+          #   },
           #   ['target_arch=="x64"', {
           #     'defines': [
           #       'NSS_USE_64',
@@ -1363,29 +1391,6 @@
             '<(nss_directory)/nss/lib/freebl/mpi/mpi_x86_asm.c',
           ],
         }],
-        ['clang==1', {
-          'xcode_settings': {
-            'WARNING_CFLAGS': [
-              # nss doesn't explicitly cast between different enum types.
-              '-Wno-conversion',
-              # nss passes "const char*" through "void*".
-              '-Wno-incompatible-pointer-types',
-              # nss prefers `a && b || c` over `(a && b) || c`.
-              '-Wno-logical-op-parentheses',
-              # nss doesn't use exhaustive switches on enums
-              '-Wno-switch',
-              # nss has some `unsigned < 0` checks.
-              '-Wno-tautological-compare',
-            ],
-          },
-          'cflags': [
-            '-Wno-conversion',
-            '-Wno-incompatible-pointer-types',
-            '-Wno-logical-op-parentheses',
-            '-Wno-switch',
-            '-Wno-tautological-compare',
-          ],
-        }],
       ],
     },
   ],
diff --git a/runtime/bin/net/nss_memio.cc b/runtime/bin/net/nss_memio.cc
index 1b24252..f8f4f82 100644
--- a/runtime/bin/net/nss_memio.cc
+++ b/runtime/bin/net/nss_memio.cc
@@ -9,7 +9,7 @@
 
 // This file is a modified copy of Chromium's src/net/base/nss_memio.c.
 // char* has been changed to uint8_t* everywhere, and C++ casts are used.
-// Revision 257452 (this should agree with "nss_rev" in DEPS).
+// Revision 291806 (this should agree with "nss_rev" in DEPS).
 
 
 /* memio is a simple NSPR I/O layer that lets you decouple NSS from
@@ -442,17 +442,21 @@
   }
 }
 
-void memio_GetWriteParams(memio_Private *secret,
+int memio_GetWriteParams(memio_Private *secret,
                           const uint8_t** buf1, unsigned int *len1,
                           const uint8_t** buf2, unsigned int *len2) {
   struct memio_buffer* mb =
       &(reinterpret_cast<PRFilePrivate*>(secret)->writebuf);
   PR_ASSERT(mb->bufsize);
 
+  if (mb->last_err)
+    return mb->last_err;
+
   *buf1 = &mb->buf[mb->head];
   *len1 = memio_buffer_used_contiguous(mb);
   *buf2 = mb->buf;
   *len2 = memio_buffer_wrapped_bytes(mb);
+  return 0;
 }
 
 void memio_PutWriteResult(memio_Private *secret, int bytes_written) {
diff --git a/runtime/bin/net/nss_memio.h b/runtime/bin/net/nss_memio.h
index 0d5f20a..acfd467 100644
--- a/runtime/bin/net/nss_memio.h
+++ b/runtime/bin/net/nss_memio.h
@@ -9,7 +9,7 @@
 
 // This file is a modified copy of Chromium's src/net/base/nss_memio.h.
 // char* has been changed to uint8_t* everywhere, and C++ casts are used.
-// Revision 257452 (this should agree with "nss_rev" in DEPS).
+// Revision 291806 (this should agree with "nss_rev" in DEPS).
 
 #ifndef BIN_NET_NSS_MEMIO_H_
 #define BIN_NET_NSS_MEMIO_H_
@@ -88,12 +88,13 @@
 void memio_PutReadResult(memio_Private *secret, int bytes_read);
 
 /* Ask memio what data it has to send to the network.
- * Returns up to two buffers of data by writing the positions and lengths into
- * |buf1|, |len1| and |buf2|, |len2|.
+ * If there was previous a write error, the NSPR error code is returned.
+ * Otherwise, it returns 0 and provides up to two buffers of data by
+ * writing the positions and lengths into |buf1|, |len1| and |buf2|, |len2|.
  */
-void memio_GetWriteParams(memio_Private *secret,
-                          const uint8_t **buf1, unsigned int *len1,
-                          const uint8_t **buf2, unsigned int *len2);
+int memio_GetWriteParams(memio_Private *secret,
+                         const uint8_t **buf1, unsigned int *len1,
+                         const uint8_t **buf2, unsigned int *len2);
 
 /* Tell memio how many bytes were sent to the network.
  * If bytes_written is < 0, it is treated as an NSPR error code.
diff --git a/runtime/bin/net/sqlite.gyp b/runtime/bin/net/sqlite.gyp
index 082fa8d..bcfc0c7 100644
--- a/runtime/bin/net/sqlite.gyp
+++ b/runtime/bin/net/sqlite.gyp
@@ -7,7 +7,7 @@
 # BSD-style license that can be found in the LICENSE file.
 
 # This file is a modified copy of Chromium's src/third_party/sqlite/sqlite.gyp.
-# Revision 257452 (this should agree with "nss_rev" in DEPS).
+# Revision 291806 (this should agree with "nss_rev" in DEPS).
 {
   # Added by Dart. All Dart comments refer to the following block or line.
   'includes': [
@@ -139,6 +139,14 @@
           'msvs_disabled_warnings': [
             4018, 4244, 4267,
           ],
+          'variables': {
+            'clang_warning_flags': [
+              # sqlite does `if (*a++ && *b++);` in a non-buggy way.
+              '-Wno-empty-body',
+              # sqlite has some `unsigned < 0` checks.
+              '-Wno-tautological-compare',
+            ],
+          },
           'conditions': [
             ['OS=="linux"', {
               'link_settings': {
@@ -173,20 +181,6 @@
                 '-Wno-pointer-to-int-cast',
               ],
             }],
-            ['clang==1', {
-              'xcode_settings': {
-                'WARNING_CFLAGS': [
-                  # sqlite does `if (*a++ && *b++);` in a non-buggy way.
-                  '-Wno-empty-body',
-                  # sqlite has some `unsigned < 0` checks.
-                  '-Wno-tautological-compare',
-                ],
-              },
-              'cflags': [
-                '-Wno-empty-body',
-                '-Wno-tautological-compare',
-              ],
-            }],
           ],
         }],
       ],
diff --git a/runtime/bin/net/ssl.gyp b/runtime/bin/net/ssl.gyp
index 2a1cfb7..cb15c0e4 100644
--- a/runtime/bin/net/ssl.gyp
+++ b/runtime/bin/net/ssl.gyp
@@ -7,7 +7,7 @@
 # BSD-style license that can be found in the LICENSE file.
 
 # This file is a modified copy of Chromium's src/net/third_party/nss/ssl.gyp.
-# Revision 257452 (this should agree with "nss_rev" in DEPS).
+# Revision 291806 (this should agree with "nss_rev" in DEPS).
 
 # The following modification was made to make sure we have the same
 # xcode_settings on all configurations (otherwise we can't build with ninja):
diff --git a/runtime/bin/net/zlib.gyp b/runtime/bin/net/zlib.gyp
index 1fffcb2..8aa920d 100644
--- a/runtime/bin/net/zlib.gyp
+++ b/runtime/bin/net/zlib.gyp
@@ -7,7 +7,7 @@
 # BSD-style license that can be found in the LICENSE file.
 
 # This file is a modified copy of src/third_party/zlib/zlib.gyp from Chromium.
-# Revision 257452 (this should agree with "nss_rev" in DEPS).
+# Revision 291806 (this should agree with "nss_rev" in DEPS).
 {
   # Added by Dart. All Dart comments refer to the following block or line.
   'includes': [
diff --git a/runtime/bin/secure_socket.cc b/runtime/bin/secure_socket.cc
index e20d9d0..0ca22be 100644
--- a/runtime/bin/secure_socket.cc
+++ b/runtime/bin/secure_socket.cc
@@ -942,7 +942,10 @@
     unsigned int len1;
     unsigned int len2;
     memio_Private* secret = memio_GetSecret(filter_);
-    memio_GetWriteParams(secret, &buf1, &len1, &buf2, &len2);
+    int status = memio_GetWriteParams(secret, &buf1, &len1, &buf2, &len2);
+    if (status != 0) {
+      return -1;
+    }
     int bytes_to_send =
         dart::Utils::Minimum(len1, static_cast<unsigned>(length));
     if (bytes_to_send > 0) {
diff --git a/tools/VERSION b/tools/VERSION
index e28b058..30b08e8 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -26,6 +26,6 @@
 CHANNEL stable
 MAJOR 1
 MINOR 6
-PATCH 2
+PATCH 3
 PRERELEASE 0
 PRERELEASE_PATCH 0