Version 1.6.1

svn merge -c 39577 https://dart.googlecode.com/svn/branches/bleeding_edge 1.6
svn merge -c 39641 https://dart.googlecode.com/svn/branches/bleeding_edge 1.6
svn merge -c 40020 https://dart.googlecode.com/svn/branches/bleeding_edge 1.6
Apply:
https://codereview.chromium.org/515953004
https://codereview.chromium.org/552783002/

R=kasperl@google.com

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

git-svn-id: http://dart.googlecode.com/svn/branches/1.6@40022 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/sdk/lib/_blink/dartium/_blink_dartium.dart b/sdk/lib/_blink/dartium/_blink_dartium.dart
index af5493e..e9758ae 100644
--- a/sdk/lib/_blink/dartium/_blink_dartium.dart
+++ b/sdk/lib/_blink/dartium/_blink_dartium.dart
@@ -7285,9 +7285,9 @@
 class BlinkURL {
   static $_createObjectURL_1_Callback(blob_OR_source_OR_stream) native "URL_createObjectURL_Callback_RESOLVER_STRING_1_Blob";
 
-  static $_createObjectURL_2_Callback(blob_OR_source_OR_stream) native "URL_createObjectURL_Callback_RESOLVER_STRING_1_MediaStream";
+  static $_createObjectURL_2_Callback(blob_OR_source_OR_stream) native "URL_createObjectURL_Callback_RESOLVER_STRING_1_MediaSource";
 
-  static $_createObjectURL_3_Callback(blob_OR_source_OR_stream) native "URL_createObjectURL_Callback_RESOLVER_STRING_1_MediaSource";
+  static $_createObjectURL_3_Callback(blob_OR_source_OR_stream) native "URL_createObjectURL_Callback_RESOLVER_STRING_1_MediaStream";
 
   static $createObjectUrlFromBlob_Callback(blob) native "URL_createObjectURL_Callback_RESOLVER_STRING_1_Blob";
 
diff --git a/sdk/lib/async/deferred_load.dart b/sdk/lib/async/deferred_load.dart
index a770071..42db0ee 100644
--- a/sdk/lib/async/deferred_load.dart
+++ b/sdk/lib/async/deferred_load.dart
@@ -7,23 +7,11 @@
 /**
  * Indicates that loading of [libraryName] is deferred.
  *
- * Applies to library imports, when used as metadata.
+ * This class is deprecated. Instead use the syntax:
+ * `import "library.dart" deferred as prefix;`
  *
- * Example usage:
- *
- *     @lazy
- *     import 'foo.dart' as foo;
- *
- *     const lazy = const DeferredLibrary('com.example.foo');
- *
- *     void main() {
- *       foo.method(); // Throws a NoSuchMethodError, foo is not loaded yet.
- *       lazy.load().then(onFooLoaded);
- *     }
- *
- *     void onFooLoaded(_) {
- *       foo.method();
- *     }
+ * Read more about the new syntax
+ * [here](https://www.dartlang.org/docs/spec/deferred-loading.html).
  */
 class DeferredLibrary {
   final String libraryName;
diff --git a/sdk/lib/core/uri.dart b/sdk/lib/core/uri.dart
index 4b601a7..6d1f7ad 100644
--- a/sdk/lib/core/uri.dart
+++ b/sdk/lib/core/uri.dart
@@ -886,7 +886,7 @@
     if (port != null) {
       port = _makePort(port, scheme);
     } else {
-      port = this.port;
+      port = this._port;
       if (schemeChanged) {
         // The default port might have changed.
         port = _makePort(port, scheme);
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index b8ea186..b6e8915 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -28752,10 +28752,10 @@
     if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
       return _blink.BlinkURL.$_createObjectURL_1_Callback(blob_OR_source_OR_stream);
     }
-    if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) {
+    if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) {
       return _blink.BlinkURL.$_createObjectURL_2_Callback(blob_OR_source_OR_stream);
     }
-    if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) {
+    if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) {
       return _blink.BlinkURL.$_createObjectURL_3_Callback(blob_OR_source_OR_stream);
     }
     throw new ArgumentError("Incorrect number or type of arguments");
@@ -39021,3 +39021,7 @@
 void _initializeCustomElement(Element e) {
   _Utils.initializeCustomElement(e);
 }
+
+// Class for unsupported native browser 'DOM' objects.
+class _UnsupportedBrowserObject extends NativeFieldWrapperClass2 {
+}
diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart
index 708af8a..872cd32 100644
--- a/sdk/lib/io/websocket_impl.dart
+++ b/sdk/lib/io/websocket_impl.dart
@@ -372,6 +372,8 @@
         _upgrade(request, _protocolSelector)
             .then((WebSocket webSocket) => _controller.add(webSocket))
             .catchError(_controller.addError);
+    }, onDone: () {
+      _controller.close();
     });
 
     return _controller.stream;
diff --git a/tests/corelib/uri_test.dart b/tests/corelib/uri_test.dart
index c2c8286..7971256 100644
--- a/tests/corelib/uri_test.dart
+++ b/tests/corelib/uri_test.dart
@@ -425,6 +425,11 @@
       }
     }
   }
+
+  // Regression test, http://dartbug.com/20814
+  var uri = Uri.parse("/no-authorty/");
+  uri = uri.replace(fragment: "fragment");
+  Expect.isFalse(uri.hasAuthority);
 }
 
 main() {
diff --git a/tests/standalone/io/web_socket_test.dart b/tests/standalone/io/web_socket_test.dart
index 564f412..b04e02f 100644
--- a/tests/standalone/io/web_socket_test.dart
+++ b/tests/standalone/io/web_socket_test.dart
@@ -43,9 +43,14 @@
 
   void testRequestResponseClientCloses(int totalConnections,
                                        int closeStatus,
-                                       String closeReason) {
+                                       String closeReason,
+                                       int numberOfMessages) {
+    assert (numberOfMessages >= 1);
+
+    asyncStart();
     createServer().then((server) {
       server.transform(new WebSocketTransformer()).listen((webSocket) {
+        asyncStart();
         webSocket.listen(
             webSocket.add,
             onDone: () {
@@ -55,20 +60,24 @@
               Expect.equals(
                   closeReason == null ? ""
                                       : closeReason, webSocket.closeReason);
+              asyncEnd();
             });
+        }, onDone: () {
+          asyncEnd();
         });
 
       int closeCount = 0;
       String messageText = "Hello, world!";
       for (int i = 0; i < totalConnections; i++) {
-        int messageCount = 0;
+        asyncStart();
         createClient(server.port).then((webSocket) {
           webSocket.add(messageText);
           webSocket.listen(
               (message) {
-                messageCount++;
-                if (messageCount < 1 ) {
-                  Expect.equals(messageText, message);
+                numberOfMessages--;
+                Expect.equals(messageText, message);
+
+                if (numberOfMessages > 0) {
                   webSocket.add(message);
                 } else {
                   webSocket.close(closeStatus, closeReason);
@@ -83,6 +92,7 @@
                 if (closeCount == totalConnections) {
                   server.close();
                 }
+                asyncEnd();
               });
           });
       }
@@ -423,9 +433,9 @@
   }
 
   void runTests() {
-    testRequestResponseClientCloses(2, null, null);
-    testRequestResponseClientCloses(2, 3001, null);
-    testRequestResponseClientCloses(2, 3002, "Got tired");
+    testRequestResponseClientCloses(2, null, null, 1);
+    testRequestResponseClientCloses(2, 3001, null, 2);
+    testRequestResponseClientCloses(2, 3002, "Got tired", 3);
     testRequestResponseServerCloses(2, null, null);
     testRequestResponseServerCloses(2, 3001, null);
     testRequestResponseServerCloses(2, 3002, "Got tired");
@@ -455,9 +465,7 @@
 
 
 main() {
-  asyncStart();
   new SecurityConfiguration(secure: false).runTests();
   initializeSSL();
   new SecurityConfiguration(secure: true).runTests();
-  asyncEnd();
 }
diff --git a/tools/VERSION b/tools/VERSION
index e0d9f59..61efb2e 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -26,6 +26,6 @@
 CHANNEL stable
 MAJOR 1
 MINOR 6
-PATCH 0
+PATCH 1
 PRERELEASE 0
 PRERELEASE_PATCH 0
diff --git a/tools/dom/src/html_native_DOMImplementation.dart b/tools/dom/src/html_native_DOMImplementation.dart
index 57f75da..6fee3f5 100644
--- a/tools/dom/src/html_native_DOMImplementation.dart
+++ b/tools/dom/src/html_native_DOMImplementation.dart
@@ -990,3 +990,7 @@
 void _initializeCustomElement(Element e) {
   _Utils.initializeCustomElement(e);
 }
+
+// Class for unsupported native browser 'DOM' objects.
+class _UnsupportedBrowserObject extends NativeFieldWrapperClass2 {
+}