Commit Graph

319 Commits

Author SHA1 Message Date
Florian Loitsch f2d08149fd Don't delay values and errors from async/await functions.
Fixes issue 23497.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1287673002 .
2015-08-13 13:00:11 +02:00
Florian Loitsch ad38b75bb2 Forward cancel subscription in stream pipes.
R=lrn@google.com

Review URL: https://codereview.chromium.org//1284223005 .
2015-08-13 12:57:35 +02:00
Lasse R.H. Nielsen e9f48a37e8 Add getters for callbacks on StreamController.
R=floitsch@google.com, sgjesse@google.com

Review URL: https://codereview.chromium.org//1278873008 .
2015-08-11 10:55:48 +02:00
Lasse R.H. Nielsen 0a35f7be3b Update Changelog.
Fix various typos and style nits.

BUG=23961
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1272593002 .
2015-08-05 12:58:30 +02:00
Lasse R.H. Nielsen ac33dfe194 Fix missing generic type parameters on streams.
Add test.

BUG= 23859
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1250373007 .
2015-08-03 14:21:17 +02:00
Lasse R.H. Nielsen 4a8a844c34 Add setters for callbacks on StreamController.
This allows you to create a stream controller at one point and
add or change the callbacks later. This can be useful if you
want to store a stream controller in a final instance field and
also want the controller to call instance methods as callbacks.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//1242023007.
2015-07-17 12:03:00 +02:00
Lasse R.H. Nielsen f529055c1b Update documentation of StreamIterator, improve tests.
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1216123004.
2015-07-03 13:23:39 +02:00
Lasse R.H. Nielsen 80960767e9 Fix timing issue in stream_empty_test, and make analyzer expect it to pass.
Review URL: https://codereview.chromium.org//1188613008.
2015-06-16 13:33:53 +02:00
Lasse R.H. Nielsen fbedc2b86f Also iprove Future.value(null) and documentation of some Stream related classes.
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1177343004.
2015-06-16 11:38:07 +02:00
floitsch@google.com f4a1b28077 Move isolate tests to lib/isolate.
Moves most tests that require dart:isolate to the isolate-directory in the tests section.

Also enables the string_from_environment_default_value_test which didn't have "_test" in its name.

R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45701 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 17:59:51 +00:00
lrn@google.com 312a21cc1a Make Completer.complete handle a Future with a misbehaving "then" call.
Instead of throwing and getting into an invalid state (isChained but won't ever
complete), the synchronous error from trying to call "then" is used to complete
the future.

This should never happen in practice - it requires a "then" implementation that
is missing or throwing even when given valid arguments.

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44629 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-23 09:09:32 +00:00
floitsch@google.com 7d6fa5fa38 Give test more time.
If a program is really slow, there might be some time before the next line is executed.
Apparently 1s is not enough.

In theory setTimeouts are supposed to be executed in the right order:
https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowtimers-settimeout

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44372 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-10 14:48:31 +00:00
iposva@google.com 4b1ba9eb69 - Make sure we schedule another wakeup when handling a timeout
from the event handler.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44191 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 19:14:30 +00:00
lrn@google.com 1f6d0e4f86 Make synchronous broadcast StreamController throw if adding event while adding event.
It already throws if there is more than one listener, but this change
also makes it throw if there is only one listener, for consistency.

Also add SynchronousStreamController abstract class.
It only contains documentation for synchronous stream controllers.

BUG= http://dartbug.com/22240
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43946 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-23 10:36:58 +00:00
lrn@google.com 34cc8411a3 Fix behavior when listening multiple times to a broadcast take/skip stream.
Turns out the existing behavior was badly broken.
A broadcastStream.take(10) would only produce ten events total, no matter how
many listeners were attached, beacuse the counter was on the stream, not the
subscription.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43755 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-13 13:59:41 +00:00
sigurdm@google.com a636a3c5a2 Change timer delay to 0 to make jsshell happy.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43464 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 12:11:40 +00:00
sigurdm@google.com 0187b8144a Avoid crashing when a closed StreamIterator is cancelled
BUG=
R=floitsch@google.com, lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43460 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 11:23:27 +00:00
lrn@google.com 3a66c29a6d Add cleanUp function to Future.wait.
The cleanUp function is called on the values of successful futures,
so it can release any resources that were successfully allocated.

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42730 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-09 10:52:15 +00:00
lrn@google.com 181efd76ee Add missing null-tests to async error functions.
Also treat null errors comming out of Zone.errorCallback as
NullThrownError.

This should prevent, as was always the intention, any async error
from having a null value.
This is important for async/await syntax, where the distinction
between sync and async errors is removed.

(For Dart 2.0, we could just make null throwable).

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40673 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-25 11:00:49 +00:00
lrn@google.com 602f73b4a2 Add error-intercept for Completer.completeError and StreamController.addError.
BUG= http://dartbug.com/15105
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40308 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-16 10:51:01 +00:00
sigurdm@google.com 457c8c33c7 Remove support for the DeferredLibrary annotation and remove tests of it
BUG= 18562
R=floitsch@google.com, hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39797 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-03 08:34:34 +00:00
floitsch@google.com 7de52b638e Don't consider controller.addError to be a zone-crossing.
BUG= http://dartbug.com/18776
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38120 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-10 13:51:03 +00:00
lrn@google.com 2b8981c436 Fix listeners being added to subscription after onListen was called.
BUG= http://dartbug.com/19722
R=floitsch@google.com, sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37847 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 07:14:19 +00:00
lrn@google.com f9b8b18ab8 Rewrite Zone implementation to avoid recursively looking up stuff in the parent chain.
Reuses as much as possible of the parent zone's implementation representation.

Increases performance of primitive tests of only async operations by ~10% (but with a lot of variability and a spurious regression).

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37807 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-30 07:26:01 +00:00
nweiz@google.com b71b5adb62 Add Future.doWhile to dart:async.
This makes both Future.doWhile and Future.forEach interact more
intuitively with zones. It also explicitly allows the callback to
Future.forEach to return a non-Future value.

BUG=http://dartbug.com/19645, http://dartbug.com/19646
RELNOTE=Add Future.doWhile and allow Future.forEach's callback to return a non-Future.
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37750 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 19:53:38 +00:00
lrn@google.com f3dd052a54 Fix typo in _DoneStreamSubscription.asFuture.
Add usage to test.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36865 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-02 11:15:34 +00:00
lrn@google.com 5cbd1e05e2 Update documentation for "close" and fix subscription returned by closed broadcast streams.
The close method on StreamConsumer, StreamSink and StreamController do not explain
the returned future or say when it is completed.

Listening on a closed broadcast stream should not throw, but just give a subscription that sends a done asap.

BUG= http://dartbug.com/19095
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36862 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-02 11:03:24 +00:00
lrn@google.com de280d96af Make Stream.where, etc., be documented as inheriting broadcast state.
Very few changes were necessary because it was already the behavior in most
cases.

BUG= http://dartbug.com/18586
R=ajohnsen@google.com

Committed: https://code.google.com/p/dart/source/detail?r=36344

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36475 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-22 08:44:21 +00:00
lrn@google.com 55d24213f6 Revert "Make Stream.where, etc., be documented as inheriting broadcast state."
There were ... complications.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36347 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-20 08:30:34 +00:00
lrn@google.com 33bcf9755c Make Stream.where, etc., be documented as inheriting broadcast state.
Very few changes were necessary because it was already the behavior in most
cases.

BUG= http://dartbug.com/18586
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36344 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-20 07:28:12 +00:00
lrn@google.com 35466f1e8b Fix typo in test.
Throwing the wrong exception - which was being overruled by a later
exception anyway.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36022 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-12 10:18:37 +00:00
lrn@google.com f4fc2fc632 Make errors from StreamController onCancel calls end up in the returned future.
This changes errors happening in an onCancel callback from being uncaught
async errors (captured by zone.runGuarded) to being put into the result
future every time.
It already happens if the onCancel returns a future containing an error,
but if onCancel throws itself, it was different. This makes onCancel
act the same whether it fails immediately or asynchronously.

It should not change the behavior of current working programs:
an uncaught error would likely terminate the program, and the returned
futures are not checked for errors.
After the change, the error will reach the future and become uncaught there
instead, still terminating the program in the same way.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36021 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-12 09:48:31 +00:00
lrn@google.com 2ab1f1238f Trying to make preamble for d8.
Preamble handles timers and task queue.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34967 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-11 10:29:06 +00:00
sigurdm@google.com dc92146b57 Load deferred chunks in the right order.
A chunk can depend on classes in shared chunks. Therefore sort they are
sorted, and loaded sequentially.

BUG= dartbug.com/17890
R=floitsch@google.com

Committed: https://code.google.com/p/dart/source/detail?r=34698

Reverted: r34702

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34915 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-10 08:48:11 +00:00
sigurdm@google.com 9150d1ce0c Revert "Load deferred chunks in the right order."
This reverts commit 34698.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34702 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-03 12:47:20 +00:00
sigurdm@google.com 22d8c97cd2 Load deferred chunks in the right order.
A chunk can depend on classes in shared chunks. Therefore sort they are
sorted, and loaded sequentially.

BUG= dartbug.com/17890
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34698 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-03 12:15:18 +00:00
kevmoo@google.com 0726458e52 tests: import unittest via package: url
R=ricow@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34602 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-01 16:12:39 +00:00
kevmoo@google.com 5952d7a067 Upgrading tests with unittest deprecations
R=ricow@google.com, sigmund@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34569 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-31 18:33:18 +00:00
ajohnsen@google.com 9da7487c36 Revert accidental parts of "Speed up toLowerCase, by manually inlining the upper-case part."
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34425 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-26 12:32:58 +00:00
ajohnsen@google.com a9f357b4b6 Speed up toLowerCase, by manually inlining the upper-case part.
Some benchmarks show up to 25% faster toLowerCase.

BUG=
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34423 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-26 12:19:55 +00:00
lrn@google.com dc091c476c Make zone variables accept any value as key.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34248 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-21 13:30:19 +00:00
floitsch@google.com 7b49ffc729 Make stream_timeout_test less likely to flake.
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33214 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-03 13:18:29 +00:00
sigurdm@google.com d807878bbd Add prefix constraints for deferred imports.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32881 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 09:39:50 +00:00
sigurdm@google.com 5c95691ada Let deferred load work from worker isolates.
If we try to load a deferred library from a worker-isolate we cannot
inject a script tag because we do not have access to the dom. Instead we
make an XMLHttpRequest object and load the code with that.

I tried to take some care of error handling introducing a new exception.

R=floitsch@google.com

Committed: https://code.google.com/p/dart/source/detail?r=32693

Committed: https://code.google.com/p/dart/source/detail?r=32695

Committed: https://code.google.com/p/dart/source/detail?r=32698

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32700 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-14 14:04:22 +00:00
sigurdm@google.com 0b1fee8131 Let deferred load work from worker isolates.
If we try to load a deferred library from a worker-isolate we cannot
inject a script tag because we do not have access to the dom. Instead we
make an XMLHttpRequest object and load the code with that.

I tried to take some care of error handling introducing a new exception.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32693 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-14 12:12:58 +00:00
kevmoo@google.com b565b6296f pkg/unittest: Run tests in zones
Added a changelog to unittest
Deprecated a number of methods made extraneous by zone change
Fixed related issues in html and html tests

BUG= https://code.google.com/p/dart/issues/detail?id=13277
BUG= https://code.google.com/p/dart/issues/detail?id=16541
R=sigmund@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32400 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-07 01:34:20 +00:00
kevmoo@google.com 9b5165c2f8 Reverting 32284 - unittest using zones - investigating breaks in html
R=blois@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32288 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-04 20:51:44 +00:00
kevmoo@google.com 245640e3d9 pkg/unittest: Run each test in a Zone
added a change log
Deprecate methods with behavior subsumed by runZoned
removed rerunTests
updated async/future_timeout_test to not assume Zone.ROOT during test run

BUG= https://code.google.com/p/dart/issues/detail?id=13277
R=nweiz@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32284 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-04 17:52:44 +00:00
ajohnsen@google.com 10c04ad443 Introduce and use Zone:_enter and Zone:_leave, in Future.
This is the first step toward clearer zone specification usage, and
potential ZoneSpecification.onEnter/onLeave callbacks.

BUG=
R=floitsch@google.com, lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32123 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-29 15:31:12 +00:00
lrn@google.com e31e81144d Attempt to make stream-timeout test less flaky.
If the periodic timer gets starved long enough, the timeout might
happen. If the 5ms periodic timer hasn't triggered in 250ms, discard
the test (i.e., don't fail anyway).

R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32054 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-28 08:58:21 +00:00