Commit Graph

668 Commits

Author SHA1 Message Date
ager@google.com 28b43144e5 Update dart:io to convert strings between UTF8 and current code page
when interacting with the system.

What we get from and need to hand to the VM is utf8. What we
get from and need to hand to the system is in the current
code page.

R=sgjesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14851 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-13 15:03:23 +00:00
whesse@google.com 92045c8c64 Change gyp flag from in_dartium to dart_io_support.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14842 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-13 11:47:31 +00:00
ajohnsen@google.com 970cc5ba68 Move JSSyntaxRegExp to core as a private member. This removes the last refrences to dart:coreimpl.
After this cleanup, RegExp no longer have a const constructor. Use 'new
RegExp(...)' from now on.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14838 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-13 10:41:37 +00:00
floitsch@google.com 8e6f238f86 a === b -> identical(a, b)
Replace === null with == null.

BUG=http://dartbug.com/6380

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14794 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-12 17:19:58 +00:00
whesse@google.com d131fa7e72 Disable NSS build targets in a Dartium build.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14740 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-09 13:56:08 +00:00
whesse@google.com 35e84d80c4 Change names of all NSS gyp targets, so they don't conflict with the Chromium target names.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14731 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-09 10:57:42 +00:00
whesse@google.com 4cf65abfa2 Add gyp files to build NSS in Dart
The change builds static versions of the cross-platform secure networking libraries NSS and NSPR from Mozilla, on Linux, MacOS, and Windows.  These libraries are linked with the standalone Dart executable in a future changelist to support HTTPS and SSL networking in dart:io.

The built libraries will be tested by that future changelist.

Patchlist 19 was committed: https://code.google.com/p/dart/source/detail?r=14524

Reverted in r=14529

Pachlist 21 was committed: https://code.google.com/p/dart/source/detail?r=14684

Reverted in r=14688

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14730 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-09 10:37:45 +00:00
gram@google.com 96016f9034 Fix library syntax
Review URL: https://codereview.chromium.org//11368124

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14701 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-08 18:41:58 +00:00
whesse@google.com 677bbd7d29 "Reverting 14684" - Building NSS libraries. It is causing local compilation failures.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14688 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-08 16:00:02 +00:00
whesse@google.com 68456442b7 Add gyp files to build NSS in Dart
The change builds static versions of the cross-platform secure networking libraries NSS and NSPR from Mozilla, on Linux, MacOS, and Windows.  These libraries are linked with the standalone Dart executable in a future changelist to support HTTPS and SSL networking in dart:io.

The built libraries will be tested by that future changelist.

Patchlist 19 was committed: https://code.google.com/p/dart/source/detail?r=14524

Reverted in r=14529

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14684 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-08 15:07:27 +00:00
whesse@google.com 28cfcec742 Move Platform class to dartlib_io target.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14680 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-08 13:57:44 +00:00
whesse@google.com ad4681a661 When building standalone Dart executable, put implementation of dart:io natives in a separate library.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14679 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-08 13:19:26 +00:00
whesse@google.com 61caff8270 Change dart_no_snapshot to run native extensions.
BUG=standalone/test_extension_test

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14619 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-07 12:03:10 +00:00
iposva@google.com 9cb8c71871 Fix bug 4534:
- Only drop the leading "/" on Windows if a leading slash is in the path.
Review URL: https://codereview.chromium.org//11368114

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14609 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-07 01:05:09 +00:00
asiva@google.com ab2cf23a19 Fix length computation in Dart_StringToUTF8.
Review URL: https://codereview.chromium.org//11275107

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14588 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-06 19:07:43 +00:00
whesse@google.com c8841879eb Revert commit 14524, which builds NSS and NSPR libraries, for secure networking.
There are builders which build Windows 64-bit versions of the SDK, and the Dartium build builds the Dart runtime executable, both of which were not supported by the CL.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14527 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-05 13:53:42 +00:00
whesse@google.com fcd4c3da98 This change depends on changelist 11341038, which checks out third_party/nss and related libraries from the Chromium repository into third_party in the Dart repository, and on changelist 11343039, which adds platform-specific files for linux to the Chromium repository.
The change builds static versions of the cross-platform secure networking libraries NSS and NSPR from Mozilla, on Linux, MacOS, and Windows.  These libraries are linked with the standalone Dart executable in a future changelist to support HTTPS and SSL networking in dart:io.

The built libraries will be tested by that future changelist.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14524 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-05 13:22:31 +00:00
dgrove@google.com 7897a78551 Changes outside pkg/ and lib/ for directory refactoring
Review URL: https://codereview.chromium.org//11358024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14475 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-02 15:18:11 +00:00
lrn@google.com 7e6ae8ea09 Renaming IndexOutOfRangeException to RangeError.
It now extends ArgumentError.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14405 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-01 13:46:30 +00:00
whesse@google.com f438b1881f Fix error in debug printing from the Dart executable, introduced in r14357.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14399 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-01 12:20:07 +00:00
sgjesse@google.com f38fdd42c1 Send data in an external byte array directly from the backing store
R=ager@google.com, ajohnsen@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14384 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-01 08:48:07 +00:00
asiva@google.com ebbb7c4134 - Represent strings internally in UTF-16 format, this makes it
compatible with webkit and will allow for easy externalization of
  strings. One byte strings are retained for pure ASCII strings.
  (The language specification was changed recently to reflect this as
   follows "A string is a sequence of UTF-16 code units").
- Remove four byte string class and all references to it.
- Rename some of the string functions in Dart API to make them
  consistent and better describe the underlying functionality
  Dart_NewString => Dart_NewStringFromCString
  Dart_NewString8 => Dart_NewStringFromUTF8
  Dart_NewString16 => Dart_NewStringFromUTF16
  Dart_NewString32 => Dart_NewStringFromUTF32
  Dart_NewExternalString8 => Dart_NewExternalUTF8String
  Dart_NewExternalString16 => Dart_NewExternalUTF16String
  Dart_NewExternalString32 => Dart_NewExternalUTF32String
  Dart_StringGet8 => Dart_StringToUTF8
  Dart_StringGet16 => Dart_StringToUTF16
  Dart_StringToCString => Dart_StringToCString
  Dart_IsString8 => Removed
  Dart_IsString16 -> Removed
  Dart_StringToBytes -> Removed
  Dart_StringGet32 -> Removed
Review URL: https://codereview.chromium.org//11318018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14357 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-31 17:56:46 +00:00
ager@google.com 23d7b313e2 Remember to close the exitHandler when processes have received
their exit code.

R=sgjesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14337 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-31 13:14:21 +00:00
sgjesse@google.com 27adbdd138 Start reading data from sockets directly into external byte arrays
This adds a new read function to Dart sockets which delivers data in a
system allocated buffer. For now just use that for socket input
streams.

The IOBuffer class does not do much at the moment, but the idea of
adding it is to be able to centralize the management of the IO
buffers. One thing I am considering here is to keep a cache of free
buffers which can be reused without freeing and re-allocating.

R=ager@google.com, ajhonsen@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14321 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-31 09:56:50 +00:00
rnystrom@google.com 908b045578 Look up executable on PATH when given environment variables.
Fixes http://code.google.com/p/dart/issues/detail?id=4402

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14300 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 18:17:51 +00:00
ajohnsen@google.com dbbf15abd8 Move ListImplementation from coreimpl to core, as a private member.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14274 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 13:25:04 +00:00
ager@google.com 57d91e3cdc Use the encoding parameter for writeString on RandomAccessFile objects.
R=sgjesse@google.com
BUG=dartbug.com/6392

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14268 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 11:59:29 +00:00
ager@google.com aac030e777 Use patching for dart:io.
This allows the tools such as dartdoc to operate on dart:io
in the same way as it does with other code and allows the
implemenation of parts of dart:io for dart2js if we ever
want to do that.

The current patching is very VM specific. I have only moved
stuff to patch files when they actually need to be. For
Process and Socket everything has to be moved because they
use native fields. For the rest, only the individual native
calls have been put in patch files.

R=sgjesse@google.com,ajohnsen@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14259 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 10:32:30 +00:00
sgjesse@google.com b641a8d79a Add flush to HTTP output streams
The flush method was missing on the HTTP output streams and was
wrongly on the HTTP input streams. The call to flush is forwarded to
the socket output stream (on which is is actually a noop).

R=ager@google.com

BUG=dart:6384
TEST=tests/standalone/io/http_advanced_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14246 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 08:30:05 +00:00
jmesserly@google.com b25590b4e6 "Reverting 14243"
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14244 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 06:12:55 +00:00
jmesserly@google.com c79560e05b Fix type annotation in _FileBase._exceptionFromResponse
ArgumentError is not a subtype of Exception, which leads to confusing errors in checked mode:

  Expected future to complete successfully, but it failed with type 'ArgumentError' is not a subtype of type 'Exception' of 'function result'.
  Stack trace:
    #0      _FileBase._exceptionFromResponse (dart:io:1032:48)
    #1      _RandomAccessFile.writeString.<anonymous closure> (dart:io:1491:37)
    #2      _FutureImpl.transform.<anonymous closure> (bootstrap:855:37)

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14243 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 05:54:12 +00:00
sgjesse@google.com db3d6358f2 Remove public SocketInputStream and SocketOutputStream clases
The socket streams only implement the streams interfaces so no
explicit classes are needed for these.

R=ager@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14204 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-29 15:04:54 +00:00
sgjesse@google.com c42fe2ba7c Remove unused member
R=ager@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14197 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-29 13:20:22 +00:00
sgjesse@google.com c710ecda96 Fix spelling mistake in r14188
TBR=ager@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14190 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-29 12:23:38 +00:00
sgjesse@google.com 77edd718c2 Add support for authorization of HTTP client requests
This implements the infrastructure for authorization of HTTP client
requests. Currently only basic authentication is fully implemented,
but the infrastructure to support digest is there.

Please focus on the developer facing API with the authenticate callback and
addCredentials method.

R=ager@google.com,ajohnsen@google.com

BUG=dart:2788
TEST=tests/standalone/io/http_auth_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14189 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-29 12:13:07 +00:00
ager@google.com d166fef422 Remove file name from File C++ structure. It is not used.
Currently, the field is being assigned a string that we
immediately deallocate leaving the field invalid. Since
it is not used we should get rid of it.

R=aprelev@gmail.com,sgjesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14188 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-29 12:02:35 +00:00
ager@google.com 83f2cfa4c1 Get rid of 'close' on process. It is very easy to use incorrectly and cut off data from your streams.
When using an interactive process started with Process.start you have
to drain the stdout and stderr streams to make sure that all resources
are freed. If you do that the dart:io library will make sure to free
all system resources for you.

R=sgjesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14187 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-29 11:59:09 +00:00
sgjesse@google.com b40fd41222 Change the handling og the HTTP content length
This change should make the indicated HTTP message content length be
as described in RFC 2616.

For requests the content length is 0 if neither Content-Length nor
Transfer-Encoding headers are set. If the content length of a request
is set to 0 the Content-Length header is not sent with a value of
0. For GET and HEAD the content length is set to 0 by default.

For responses content length needs to be set to 0 to indicate an empty
response (unless it is a HEAD response where the content length
indicate the size of the body expected). Otherwise a body is assumed
and if no content length is set chunked transfer encoding is used.

For HTTP 1.0 chunked transfer encoding is not supported. So for HTTP
1.0 requests needs content length if they have a body and responses
without a content length will indicate end of body by closing the
connection.

R=ager@google.com

BUG=dart:6309

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14184 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-29 11:30:17 +00:00
floitsch@google.com 3300f91153 Make first and last getters.
Review URL: https://codereview.chromium.org//11273041

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14082 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-25 15:19:31 +00:00
floitsch@google.com e7c5e69beb Make String.charCodes a getter.
Review URL: https://codereview.chromium.org//11263040

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14078 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-25 14:25:43 +00:00
asiva@google.com 7557562b32 Fix error exit path so that it frees the buffer before exiting the program.
Review URL: https://codereview.chromium.org//11192065

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14055 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-25 00:43:17 +00:00
vsm@google.com 6ca42b35be Add crypto_android.cc
This fixes the android build of the command line embedder.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14045 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-24 22:20:34 +00:00
floitsch@google.com 09f6d09d88 Make isEmpty a getter.
Review URL: https://codereview.chromium.org//11238035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14022 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-24 15:04:32 +00:00
lrn@google.com a083c1a108 Removed IllegalAccessException and UnsupportedOperationException.
Both were converted to StateError.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14012 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-24 12:36:10 +00:00
sgjesse@google.com c304bb491e Use the thread safe gethostbyname function on Linux
On Mac OS and Windows gethostbyname is already thread safe (according
to the documentation).

R=ager@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14010 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-24 11:38:02 +00:00
ajohnsen@google.com 590413765a Moved RuntimeOptions from coreimpl to core, renamed to _OptionsImpl.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14004 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-24 10:34:42 +00:00
ager@google.com e18e79217d Do *not* make file handles inheritable on Windows.
This is the cause of the pub failures to unpack a file that has
just been created. The problem is that another 7-zip process has
inherited the file handle for a file that we are still writing.
When we are done writing the file, we cannot use it because the
other process still keeps the handle.

R=sgjesse@google.com,rnystrom@google.com
BUG=dartbug.com/5910

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13960 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-23 13:04:02 +00:00
ager@google.com 79a0089d38 Change Process.kill to return a boolean instead of throwing an exception when kill fails.
If the program wants to kill the process after a given time, it is
possible that the process is already dead but has not yet been
reaped. Therefore, there is no way for the programmer to test if the
process is already dead before killing it. Throwing an exception from
kill is not helpful as you will most often have to catch it and do
nothing because you cannot prevent the exception occasionally and
there is nothing you can do as a result of the exception since it
usually means that the process is already dead.

R=ahe@google.com,sgjesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13956 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-23 12:40:53 +00:00
sgjesse@google.com 507a102246 Fix bug in r13232
Discovered after commit by floitsch@.

R=floitsch@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13940 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-23 09:43:49 +00:00
sgjesse@google.com 9c707dff5f Fix bug in HTTP client request generation
If an HTTP request with an empty path was done using the HttpClient
(either for normal HTTP or for upgrading to web sockets) the generated
HTTP request line was invalid. The empty path was used in the request
line e.g.

GET  HTTP/1.1

instead of

GET / HTTP/1.1

This is now fixed by using / if no path is specified. This is
specified in RFC 2616 section 3.2.2.

BUG=6185

R=ager@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13939 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-23 09:39:17 +00:00