Commit Graph

45 Commits

Author SHA1 Message Date
Lasse R.H. Nielsen 222b894d62 Change resolve for package:URIs to not remove package name.
A "package URI" is defined as one with a `package` scheme,
no authority, a first path segment terminated by `/` which
contains no escapes and is not all `.` characters.
This is the definition of package names accepted by .packages
as well: Valid path characters and not all dots.

Change-Id: I9a161d47732e8bf873d278774315c72a4a928823
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117542
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-02-05 18:31:48 +00:00
Robert Nystrom d9bb487ca8 Treat the expect and async_helper packages as opted in to NNBD.
This should enable strong mode tests to be fully NNBD opted in. At the
same time, legacy tests when run with the experiment off should
hopefully be able to still consume these libraries because they don't
actually use any NNBD features.

To do this, I changed the script that generates the SDK repo's package
config to not put in a language version for any package whose pubspec
has no SDK version. According to language versioning, that means the
package should be considered to be at the "current" version of the SDK
running the code.

In NNBD, that's opted in. With the experiment off, that is (presumably)
"opted out" in the sense that NNBD doesn't exist.

In order to *not* opt in some of the other packages that currently
lack SDK constraints, I put those in and pinned them to "^2.7.0" which
was what the package config script used to implicitly fill in for them.

I see a bunch of other changes in the generated package config too. The
update script probably hasn't been run in a while.

Change-Id: I55193d42eac0696a6b0105546551efa45a1f3252
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144305
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2020-04-27 21:04:56 +00:00
Mark Zhou 2228b6d337 [tests] Cleaning up migrated corelib tests.
Change-Id: I7ac31a6bf66c777202a6c642bae584af8e3288ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140380
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2020-03-24 17:34:25 +00:00
Robert Nystrom b998b10f3e Migrate remaining corelib_2/ tests to NNBD.
Change-Id: I3a31632ce28fb87a410b759d092c7ebc9393574d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128306
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-12-17 23:06:24 +00:00
Bob Nystrom f6ca2c1d8f Remove the Dart 1 tests.
This deletes:

tests/co19
tests/corelib
tests/html
tests/isolate
tests/language
tests/lib

It does not delete tests/standalone because apparently there are tests
in there that are not in standalone_2. (I assume they were added after
the test migration. I don't know why they were added there.)

I have tried to remove references to the old tests from various scripts
and tools but may have missed some. (As you can imagine, grepping for
"lib" does not have the best signal-to-noise ratio.)

"It was a pleasure to burn. It was a special pleasure to see things
eaten, to see things blackened and changed. With the brass nozzle in his
fists, with this great python spitting its venomous kerosene upon the
world, the blood pounded in his head, and his hands were the hands of
some amazing conductor playing all the symphonies of blazing and burning
to bring down the tatters and charcoal ruins of history."

- Ray Bradbury, Fahrenheit 451

Change-Id: If3db4a50e7a5ee25aff8058b1483e2ce8e68424e
Reviewed-on: https://dart-review.googlesource.com/c/75420
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Terry Lucas <terry@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-10-11 23:45:18 +00:00
Bob Nystrom edee53f93d Bring back the deleted 1.0 corelib tests.
What is dead may never die.

Change-Id: I80ef766b8ce2b6e1416df8e1f9b91fb74169dc79
Reviewed-on: https://dart-review.googlesource.com/7483
Reviewed-by: William Hesse <whesse@google.com>
2017-09-21 18:29:40 +00:00
Ben Konyi 4d64b9ee37 Migrate test block 30 + corelib portion of block 31 to Dart 2.0.
Minor changes to uri_path_test and uri_query_test, and status file
updates.

BUG=
R=rnystrom@google.com

Review-Url: https://codereview.chromium.org/2983123002 .
2017-07-20 08:07:37 -07:00
Erik Corry 2fb5d08102 Spelling a
R=ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2841543002 .
2017-04-24 14:53:51 +02:00
Jacob Richman 2dcd56ef43 Format all tests.
There are far too many files here to review everyone carefully.
Spot checking most of the diffs look good as test code is generally written
with less care than application code so lots of ugly formatting get through.
If people notice files where the automated formatting bothers them feel free
to comment indicating file names and I'll move spaces within comments to make
the formatting cleaner and use comments to force block formatting as I have
done for other case where formatting looked bad.

BUG=
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2771453003 .
2017-04-17 14:53:02 -07:00
Jacob Richman 6a7d6c385e Add comments
Add spaces to make sure dartfmt doesn't destroy bespoke indentation

BUG=
R=sra@google.com

Review-Url: https://codereview.chromium.org/2763823002 .
2017-03-20 21:03:12 -07:00
Lasse R.H. Nielsen dd561d513b Add Uri.isScheme test function.
Allows checking the scheme of a URI against a known value.
Example: `uri.isScheme("http")`.
Has two advantages over `uri.scheme == "http"`:
* It's case insensitive, so you can do `uri.isScheme("HTTP")` as well, and
* for simple URIs, it doesn't need to allocate a new string.

R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2664453003 .
2017-01-30 13:26:39 +01:00
Lasse R.H. Nielsen dab2d0efb8 Fix invalid URIs generated using Uri constructor with clever paths.
Fixes issue #28359
BUG= http://dartbug.com/28359
R=floitsch@google.com

Committed: https://github.com/dart-lang/sdk/commit/d3a839fb84c744fb77bfff67d0d39df99cfa6404
Review-Url: https://codereview.chromium.org/2626013004 .
2017-01-16 09:16:06 +01:00
Lasse R.H. Nielsen d3a839fb84 Fix invalid URIs generated using Uri constructor with clever paths.
Fixes issue #28359
BUG= http://dartbug.com/28359
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2626013004 .
2017-01-13 09:38:07 +01:00
Lasse R.H. Nielsen 9bd4406d4b Fix bug in _SimpleUri.resolve.
In some cases it didn't follow our non-RFC behavior for resolving a relative
path on top of another relative path.

Fixes issue #27447
BUG= http://dartbug.com/27447
R=eernst@google.com

Review URL: https://codereview.chromium.org/2374253004 .
2016-09-29 15:00:42 +02:00
Lasse R.H. Nielsen afbbbb97cf Reapply fast-URI patch.
Review URL: https://codereview.chromium.org/2245533004 .
2016-08-17 10:54:24 +02:00
Lasse R.H. Nielsen 3502fd5fd7 Revert "Reapply fast-URI patch."
Seems to trigger VM bug.

Review URL: https://codereview.chromium.org/2225243003 .
2016-08-09 12:51:58 +02:00
Lasse R.H. Nielsen 99e94db85b Reapply fast-URI patch.
R=whesse@google.com

Review URL: https://codereview.chromium.org/2220373002 .
2016-08-09 09:38:47 +02:00
William Hesse ca49303576 Revert "Add fast-mode Uri class."
This reverts commit 00090a0c72.

Revert "Add fast-mode Uri class."

This reverts commit 323ca7e410.

Revert "Fix regression for the one case where we deliberately don't follow the RFC."

This reverts commit b39e048c4b.

Revert "Cache hashCode in Uri implementations to improve performance when used as, e.g., Map key."

This reverts commit a11ad27723.

BUG=https://github.com/dart-lang/sdk/issues/26917
TBR=keertip@google.com

Review URL: https://codereview.chromium.org/2167663002 .
2016-07-20 14:32:52 +02:00
Keerti Parthasarathy 69a8b11f67 Fix for uri replace whene uri has fragment. Was adding a second '#'.
BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/2158933003 .
2016-07-18 16:31:43 -07:00
Lasse R.H. Nielsen b39e048c4b Fix regression for the one case where we deliberately don't follow the RFC.
The new code didn't have that exception.

Also optimize some string operations when it's possible.

R=eernst@google.com

Review URL: https://codereview.chromium.org/2117453002 .
2016-06-30 14:52:23 +02:00
Lasse R.H. Nielsen 323ca7e410 Add fast-mode Uri class.
Optimize parser and make it recognize a class of URIs that don't need extra
handling: no escapes, no funny characters, already (nearly or completely)
normalized.
Have a class specifically for those URIs which retains the original
input string without having allocate any further strings.

R=floitsch@google.com

Committed: https://github.com/dart-lang/sdk/commit/00090a0c7237b636a73f048e53966879e74ec55a

Review URL: https://codereview.chromium.org/2086613003 .
2016-06-30 13:25:36 +02:00
Lasse R.H. Nielsen 00090a0c72 Add fast-mode Uri class.
Optimize parser and make it recognize a class of URIs that don't need extra
handling: no escapes, no funny characters, already (nearly or completely)
normalized.
Have a class specifically for those URIs which retains the original
input string without having allocate any further strings.

R=floitsch@google.com

Review URL: https://codereview.chromium.org/2086613003.
2016-06-30 12:20:15 +02:00
Todd Turnidge a7d46eb5a6 Canonicalize uris in C++ instead of Dart for the standalone embedder.
Adds Dart_DefaultCanonicalizeUrl() to the dart embedding api.

Motivation:

As we try to get source reloading working for the standalone embedder, things get simpler if an isolate doesn't run Dart code while it is loading Dart code.  We intend to solve this by moving the embedder tag handler calls to the service isolate.  But making a blocking rpc into the service isolate whenever a url needs to be canonicalized during parsing seems like it would slow things down and make things complicated.  By moving canonicalization into C++, we avoid this.

R=ahe@google.com, fschneider@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2011543002 .
2016-06-02 12:29:57 -07:00
Florian Loitsch 84ec63e9fc Make dart:core strong-mode clean.
R=leafp@google.com, lrn@google.com

Review URL: https://codereview.chromium.org/1895473004 .
2016-04-21 14:01:48 +02:00
Lasse R.H. Nielsen a8e3eb4e10 Fix bug in Uri.removeFragment.
It used the external getters for the existing port and query, which
are non-null even when the port or query are absent. This introduced
a new default-valued/empty part.

Also reordered declarations to have fields > constructors > rest.

Fixes issue #24593
BUG= http://dartbug.com/24593
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1396973004.
2015-10-15 12:42:36 +02:00
Lasse R.H. Nielsen 848f6c978c Do "path normalization" when creating a URI.
Path normaliztion removes '.' and '..' segments from a URI. Such relative references are only intended for URI References, and Uri References are only intended for resolving against a full URI.

We do path normalization on all URIs that have a scheme, authority or an absolute path, and partial normalization on what are really just relative paths. The partial normalization can leave ".." at the start of the path.

The URI reference resolution algorithm doesn't work as expected for a URI ending in "..". Resolving "./foo" wrt. a base of "/a/.." results in  "/a/foo" - this is avoided when the base is path normalized before it's used.

This also fixes the "normalizePath" function which currently removes leading '..' segments, contrary to its documentation. It also makes the function redundant since all URI paths are normalized automatically.

See discussion on http://dartbug.com/23688

Also fix bug in the removeDotSegments function.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//1224263009.
2015-07-17 17:08:36 +02:00
lrn@google.com 7716b93374 Fix Uri.replace adding an empty authority by mistake.
BUG= http://dartbug.com/20814
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40020 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-09 10:50:36 +00:00
lrn@google.com 7b98aaaf67 Add Uri.replace which creates a new Uri with the same fields as the original, but with some fields replaced by the user.
BUG= http://dartbug.com/18950
R=ajohnsen@google.com

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38897 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-05 12:23:14 +00:00
lrn@google.com 5acd01a03f Revert "Add Uri.replace which creates a new Uri with the same fields as the original, but with some fields replaced by the user."
Code has gone stale since first uploaded.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38895 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-05 11:13:23 +00:00
lrn@google.com ea63070360 Add Uri.replace which creates a new Uri with the same fields as the original, but with some fields replaced by the user.
BUG= http://dartbug.com/18950
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38894 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-05 10:32:22 +00:00
lrn@google.com 2d92f787d0 Ensure that a file: URI does not have an empty path.
BUG= http://dartbug.com/19608
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38893 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-05 09:31:24 +00:00
lrn@google.com 9e765a713c Also fix uri_query_test.
Review URL: https://codereview.chromium.org//354003002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37733 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 11:49:11 +00:00
lrn@google.com b9d3d5bbae Try to retain original structure of URI.
This changes URI.parse to retain empty autorities, queries and fragments.
That is: `Uri.parse("foo:///x?#")` will give a Uri with toString "foo:///x?#",
as opposed to the previous "foo:/".

It also makes a difference between passing "" and null to the Uri constructor.

We still omit empty user-info and default port values from the toString.

R=ajohnsen@google.com

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37728 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 09:41:30 +00:00
lrn@google.com f2afbd9a62 Revert "Try to retain original structure of URI."
Breaks dart2js.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37692 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-25 11:59:13 +00:00
lrn@google.com 0200cfcc67 Try to retain original structure of URI.
This changes URI.parse to retain empty autorities, queries and fragments.
That is: `Uri.parse("foo:///x?#")` will give a Uri with toString "foo:///x?#",
as opposed to the previous "foo:/".

It also makes a difference between passing "" and null to the Uri constructor.

We still omit empty user-info and default port values from the toString.

R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37690 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-25 11:16:32 +00:00
lrn@google.com d4c2b57209 Fix bugs in Uri: Allow empty port, handle path starting with "//" in toString.
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37590 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-23 09:44:05 +00:00
lrn@google.com 306b3af9f0 Fix bug in gen-delims table.
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37482 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-19 09:32:28 +00:00
lrn@google.com 736db44293 New Uri.parse and validation.
Ensures that the resulting URI is valid.
Escapes invalid characters except the gen-delim group of delimites, where
escapes are allowed.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37479 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-19 09:05:07 +00:00
lrn@google.com 9bdecb9d58 Fix missing + in URI encodeFullTable.
Add tests.

BUG= http://dartbug.com/19463
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37477 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-19 07:44:23 +00:00
lrn@google.com 31eeb6caf2 Revert "New, more validating, parser for URI." and follow-up patches.
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37359 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-16 12:32:35 +00:00
lrn@google.com c7d98e335b New, more validating, parser for URI.
BUG= https://code.google.com/p/dart/issues/detail?id=16081
R=ajohnsen@google.com, fschneider@google.com, sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37346 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-16 07:00:22 +00:00
ajohnsen@google.com 65f653a7cb Write custom URI-parser, to avoid using regexp.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32966 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-24 14:36:31 +00:00
sgjesse@google.com 3d2b5c4bd4 Add encodimg argument to Uri.encodeQueryString
R=lrn@google.com
BUG=http://dartbug.com/12780

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30791 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-02 09:01:22 +00:00
floitsch@google.com 1887b5ca49 Some more removals of dart:utf.
R=jmesserly@google.com, lrn@google.com, nweiz@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26712 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-27 13:18:34 +00:00
sgjesse@google.com 9d6a64e81b Merge the dart:uri library into dart:core and update the Uri class
This merges the dart:uri library into dart:core removing the dart:uri library. Besides moving the library the Url class has been changed.

* Removed existing Uri constructor as it was equivalent with Uri.parse
* Remamed constructor Uri.fromComponents to Uri
* Moved toplevel function encodeUriComponent to static method Uri.encodeComponent
* Moved toplevel function decodeUriComponent to static method Uri.decodeComponent
* Moved toplevel function encodeUri to static method Uri.encodeFull
* Moved toplevel function decodeUri to static method Uri.decodeFull
* Rename domain to host
* Added static methods Uri.encodeQueryComponent and Uri.decodeQueryComponent
* Added support for path generation and splitting
* Added support for query generation and splitting
* Added some level of normalization

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23266 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-28 13:35:01 +00:00