Commit Graph

201 Commits

Author SHA1 Message Date
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
lrn@google.com 30683bdc79 Fix typo in failure-branch of stream iterator test.
Also increment pkg/async version to fix broken first upload.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31322 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-20 07:58:49 +00:00
lrn@google.com d4be6ccd68 Update stream iterator doc and add test.
BUG= http://dartbug.com/15449
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31317 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-20 07:14:37 +00:00
lrn@google.com 70f6617532 Revert "Fix VM timer firing too early."
Committed: https://code.google.com/p/dart/source/detail?r=30987

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31009 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-10 08:40:56 +00:00
lrn@google.com dd6ee012d1 Revert "Fix VM timer firing too early."
Review URL: https://codereview.chromium.org//101293006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30987 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-09 13:43:52 +00:00
lrn@google.com 2aa9f026f2 Change Future.timeout callback to a named parameter.
R=floitsch@google.com

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30985 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-09 12:06:12 +00:00
lrn@google.com c5a3337ae3 Change the zone that late-added stream subscription callbacks are registered in.
They are always called in the subscription's zone, but they were
registered in the current zone.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30896 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-05 14:45:46 +00:00
lrn@google.com 6af11cac37 Add Stream.timeout method.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30895 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-05 13:32:31 +00:00
lrn@google.com 8744794212 Change other futures to also have timeout take a named parameter.
Review URL: https://codereview.chromium.org//98683002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30792 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-02 09:13:49 +00:00
lrn@google.com 3d819ee9cb Change Future.timeout callback to a named parameter.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30790 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-02 08:48:00 +00:00
lrn@google.com e0314a6117 Add Future.timeout.
R=floitsch@google.com, nweiz@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30745 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-28 08:16:01 +00:00
lrn@google.com 726b72771e Make the root zone's schduleMicrotask and create[Periodic]Timer bind the callback.
BUG= http://dartbug.com/15232
R=floitsch@google.com

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30711 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-27 11:55:35 +00:00
lrn@google.com 1d9e1d5b93 Make the root zone's schduleMicrotask and create[Periodic]Timer bind the callback.
BUG= http://dartbug.com/15232
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30708 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-27 11:42:04 +00:00
lrn@google.com f3a501e7c6 Make Future.wait have an eagerError option that defaults to false.
This means that Future.wait will, by default, wait for all futures to
complete, even if there is an error.
All but the first error are dropped, and the future completes with the
first error.

If eagerError is set to true, the returned future completes immediately
on the first error.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30443 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-20 09:28:48 +00:00
floitsch@google.com 91b5e131ee Make catch_errors13_test non-flaky.
Was flaky on buildbot:
http://build.chromium.org/p/client.dart/builders/dartium-mac-debug-be/builds/410/steps/drt_core_checked_tests/logs/stdio

R=sra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30087 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-08 00:19:57 +00:00
floitsch@google.com 6bdd901604 Add test that makes sure print deals with broken toStrings.
R=ahe@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29994 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-06 20:40:03 +00:00
floitsch@google.com 8fdee3bb18 Propagate stack trace when using Future.wait.
BUG= http://dartbug.com/14755
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29923 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-05 18:42:48 +00:00
floitsch@google.com 1532e6db73 Add safety margin to timer_isolate_test.dart
Should make the test less flaky.

R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29921 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-05 18:20:34 +00:00
floitsch@google.com 35e9ae50d9 Fix warnings in library-tests.
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29756 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-01 17:01:11 +00:00