Commit graph

1687 commits

Author SHA1 Message Date
Nate Bosch 33e174084a Replace Uri.scheme == with Uri.isScheme
Use `hasScheme` in place of comparing against the empty string, and
`isScheme` to compare against all other schemes.

TEST=No behavior changes.

Change-Id: Ifc9fd13c6cf37933ebd4a754c4b500dedbcb291b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231185
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2022-02-08 21:38:57 +00:00
Srujan Gaddam 0ec4c3a1b5 [dart:html] Expose scrollIntoViewIfNeeded
`scrollIntoViewIfNeeded` is nested within `scrollIntoView`. The latter
method is outdated and the way to access the different ways to call
`scrollIntoViewIfNeeded`. Instead of using that method, this CL
directly exposes `scrollIntoViewIfNeeded`.

Change-Id: I38d7876a7923768ae165c29a98e514e90182b77e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231047
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-02-02 20:46:59 +00:00
Srujan Gaddam b979f797f3 [dart:html] Add firefox to requestFullscreen's SupportedBrowsers
Change-Id: I13f9db6a8d4a8d8ae1e17604db075120e0470dd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229941
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-01-25 20:12:30 +00:00
Srujan Gaddam 4c64181d73 [dart:html] Fix requestFullscreen bindings and type
Closes https://github.com/dart-lang/sdk/issues/25324

requestFullscreen returns a Promise and takes in an options parameter.
It also can be accessed either via `requestFullscreen` or
`webkitFullscreen` (only necessary for Safari). The bindings should be
updated to reflect this behavior.

Change-Id: I9401b6a1c8b3f9ac370aad8caac8295e0ee358b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229381
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-01-25 00:24:57 +00:00
Kevin Moore 26f5c2ae84 dart:indexed_db: deprecate IdbFactory.supportsDatabaseNames
This has been removed from modern browsers - always returns false

See https://chromestatus.com/features/5725741740195840

Fixes https://github.com/dart-lang/sdk/issues/48047

Change-Id: Ie93757f664d892ba365a99c524a8ae79466e5002
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226180
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2022-01-03 23:45:15 +00:00
Srujan Gaddam 01642c2122 [dart:html] Add different bindings for FileSystem APIs
Closes https://github.com/dart-lang/sdk/issues/45036

The FileSystem API has different bindings for different browsers,
and the values are all taken directly from the MDN:
https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API
Along with this, some APIs that need to expose these bindings are modified to
expose all possible bindings.

Change-Id: I18ce6d1208349eb9d5bd9d802d17dda1ddae2dec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225323
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-12-23 00:11:03 +00:00
Riley Porter 8e0d5f98a3 [dart:html] Remove deprecated gridRowGap and gridColumnGap
After chatting offline, we decided we don't actually need
gridRowGap and gridColumnGap since the rowGap and columnGap
properties are the preferred names. Removing the deprecated
grid versions before it becomes a breaking change to do so,
and to keep dart:html bloat minimal.

Change-Id: I75a7de40a4bb1a5479723600987d19e7e42bf69c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224700
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-12-20 18:21:03 +00:00
Riley Porter fc8a65d4c8 [dart:html] Add gap, rowGap, gridRowGap, and gridColumnGap properties.
Adds gap, rowGap, gridRowGap, and gridColumnGap CSS style properties.
The columnGap property was already included through WebKit.

Relevant bugs:
https://github.com/dart-lang/sdk/issues/46077
https://github.com/dart-lang/sdk/issues/45789


Verified properties are accessible with this `foo.dart` file:
https://paste.googleplex.com/6379738705690624
Loaded with ddb in Chrome:
https://screenshot.googleplex.com/9hN4MTCFxY5EYQn.png

Change-Id: Ia62807a6588cd0fd21b204a2a98a120fa4c4b07b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224500
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-12-16 18:47:11 +00:00
Srujan Gaddam 6f4f2f5f12 [dart:html] Make Native web classes extend JavaScriptObject
Now that JavaScriptObject is the new parent class of the old
JavaScriptObject (now called LegacyJavaScriptObject), web classes
should extend it instead.

Change-Id: I94613177bd073e131bff70d8e00e4e6ae8e8949f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216275
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-12-10 18:36:00 +00:00
Riley Porter d7a0cb74b1 [dart:html] Remove old scripts to generate docs.json
The scripts in tools/dom/docs were using Mirrors to
scrape the dart:html related libraries and generate
the docs.json file, which is also used for docs in
generating dart:html. With these scripts being out
of date and our general migration plans for dart:html,
we don't need these scripts anymore. We may still
generate our dart:html documentation in the future,
but it will involve a difference process.

No change to dart:html when running `go.sh`

Change-Id: Ie10af41b5dcff192be8961aa20c1ed493efa4593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221027
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-11-29 20:13:54 +00:00
Riley Porter 11dc2f4ff6 [dart:html] Update Element.dataset documentation
Updates which characters are allowed in the dataset name based on
external documentation, and removes restriction on not allowing the
name to start with `xml`. These restrictions are not enforced in the
name parsing in `_DataAttributeMap`. Note, there is an additional
restriction in our docs which is inconsistent with external behavior
disallowing capital letters.

Change-Id: I4143503b17673be2e038df8647fef7c9ac09e9ba
Bug: https://github.com/dart-lang/sdk/issues/43295
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219180
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-11-12 01:00:41 +00:00
Riley Porter 2d67574d61 [dart:html] Clean up docs for Node insertBefore and insertAllBefore
Changes `refChild` to `child` to match parameter name and makes
`insertAllBefore` consistent with `insertBefore`. Also adds a
description of behavior given a null `child`.

Fixes: https://github.com/dart-lang/sdk/issues/46603
Change-Id: I280306018ee16fa9088d55110ef502f49ed1d66a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219122
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-11-05 20:58:23 +00:00
Ahmed Ashour c47cf76baf Fix typos
Fixes https://github.com/dart-lang/sdk/issues/47505

Change-Id: Ic2e25800263e96b2b4282f89ec0be017c86d4adb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217361
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-10-20 10:51:53 +00:00
Ahmed Ashour d041cf0478 Remove extra the, be and of
Fixes #https://github.com/dart-lang/sdk/issues/47504

TEST=No tests needed, only comments affected.

Change-Id: Ie096307b5ce314d328fea6780f396aaa226ad3b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216182
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-10-20 09:29:01 +00:00
Sigmund Cherem 38b5a841de [dart-web] Remove dart:web_sql library.
The WebSQL standard was abandoned more than 10 years ago and is not
supported by many browsers.

The `dart:web_sql` library was marked as deprecated in Dart 2.14. This
CL makes the library inaccesible, removes support for `dart:web_sql` imports,
and removes the `Window.openDatabase` API. The old code for `dart:web_sql` is
still generated by the html generators. Removing that will be handled by a
separate change.

Closes https://github.com/dart-lang/sdk/issues/46316

Change-Id: I892107396b3b227b4f33344377585aa5e5328288
Bug: https://github.com/dart-lang/sdk/issues/46316
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216080
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2021-10-19 01:00:08 +00:00
Srujan Gaddam 017850fe5b [dart:html] setAttribute value should be Object
Bug: b/195948110

`setAttribute` stringifies any non-string value. `setAttributeNS` is
also similarly modified for consistency.

Change-Id: I883516f5ed2c977cdc591b697594817378607e53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215621
Reviewed-by: Gary Roumanis <grouma@google.com>
Commit-Queue: Gary Roumanis <grouma@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-10-05 20:08:41 +00:00
Kevin Moore 4d82adb91f dart:html: use Object.hash
Drop custom hash class

Related to https://github.com/dart-lang/sdk/issues/27698

Change-Id: I7f5fb3a642e5ae461a00ed1b5d307adb4ef448df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214181
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-09-22 20:47:17 +00:00
Srujan Gaddam d87a545a6a [dart:html] Update changes in idl_parser location
Simply adds the new location to the sys.path so it can be found
and filters idl files within idl_parser so it doesn't affect
codegen. Also removes a stale comment to finalize the python3
migration.

Change-Id: I31d93fd8de22e38a0e968587149546565f86e3ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212630
Reviewed-by: Riley Porter <rileyporter@google.com>
2021-09-08 22:18:37 +00:00
Srujan Gaddam f34eef5b91 [dart:html] Migrate python scripts to python 3
Migrates syntax and semantics from python 2.7.

Major changes include:

- filters
- sorting
- print statements
- higher-order functions
- hashing and comparison

and other misc changes. go.sh consistently gives the libraries
in this and the previous commits with these changes.

Change-Id: I66365739887158d8f321015d36e556447da1bcd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211542
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
2021-09-08 22:10:53 +00:00
Srujan Gaddam 8100b4de02 [dart:html] Fix implements order for classes
Using a set does not guarantee a consistent order from python 3
onwards, so use a OrderedDict to get a consistent order while
removing any duplicates.

Change-Id: I02d9aae2a82fd119f22b3a5e353b9445ffca963b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211541
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
2021-09-08 18:45:02 +00:00
Emmanuel Pellereau 0933086397 Revert "[dart:html] Update Trusted Types APIs"
This reverts commit bda31c2c13.

Reason for revert: Breaks google3 (See b/195948578).

Original change's description:
> [dart:html] Update Trusted Types APIs
>
> Closes b/195948578
>
> Modifies Trusted Types APIs to be compliant with the spec in
> https://w3c.github.io/webappsec-trusted-types/dist/spec/.
>
> Change-Id: I65d52ace12342ce777ab596a9dd2e9a3f74b2f05
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212270
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
> Reviewed-by: Riley Porter <rileyporter@google.com>

TBR=sra@google.com,srujzs@google.com,rileyporter@google.com

Change-Id: I6c74fe5bfb1ecb39e01304b882ec306d5cf34442
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212741
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Michal Terepeta <michalt@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
2021-09-08 08:35:45 +00:00
Srujan Gaddam bda31c2c13 [dart:html] Update Trusted Types APIs
Closes b/195948578

Modifies Trusted Types APIs to be compliant with the spec in
https://w3c.github.io/webappsec-trusted-types/dist/spec/.

Change-Id: I65d52ace12342ce777ab596a9dd2e9a3f74b2f05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212270
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
2021-09-07 18:03:18 +00:00
Alexander Thomas d2bd43f43e [python3] Migrate PRESUBMIT.py files
* Force depot_tools to use python3 results (USE_PYTHON3=True).
* Fixes the dart format presubmit check.
* Remove broken DOM tools presubmit check.

TEST=Manually provoked errors and ran git cl presubmit -v -f.

Cq-Include-Trybots: luci.dart.try.shared:presubmit-try
Change-Id: I8ba46e2ae1640f1b2f82e18bc8024e0aa4838b2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210123
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2021-08-16 08:29:54 +00:00
Gabriel Castro fc4d4144fb Added js_util import to html_dart2js
Change-Id: Ic643e3bbf521fa116984a27f504a2642f2052f36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210100
Commit-Queue: Gabriel Castro <gabrielmcastro@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2021-08-13 23:13:31 +00:00
Gabriel Castro 799b39ad42 dart:html static extension members generation
Initial changes to add functionality to the dart:html generation
script to generate classes with the JSInterop static extension pattern

Change-Id: I9dca21db7500ab25ac96b16eda11fe605f915abe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208461
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Gabriel Castro <gabrielmcastro@google.com>
2021-08-10 18:15:30 +00:00
Stephen Adams 5ff2459d88 Remove obsolete internal dart2js annotations
These annotations have all been replaced with @pragma('dart2js:xxx')
versions:

@ForceInline, @NoInline, @NoThrows, @NoSideEffects, @AssumeDynamic.

Change-Id: Ia4730670c6864ccbe0fa4120108c3c16ab887c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208863
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-08-04 23:27:18 +00:00
Srujan Gaddam 2628eaa88c Modify go.sh to use dart format
`dartfmt` is deprecated in favor of `dart format`.

Change-Id: I4154ff9d863213d3925aacce892ffde06dee40f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207801
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-07-22 20:49:25 +00:00
Srujan Gaddam 6085e065e9 [dart:html] Add doc changes to templates and source files
https://dart-review.googlesource.com/c/sdk/+/205068 and
https://dart-review.googlesource.com/c/sdk/+/205300 were added
to fix doc issues in dart:html. This CL adds those changes to
the source and template files and fixes some grammar.

Change-Id: I59ab35c5076fba5d67e4e99cff503bb98eb55549
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207800
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-07-22 19:59:54 +00:00
Clement Skau 67f097a161 [tools] Update all iteritems -> items
This migrates old python2 dict.iteritems() to python3 dict.items().
iteritems was removed in python3 meaning these script will otherwise not
run.
Note that this remains backwards compatible since dict.items() also
existed in python2, though the implementation was more memory intensive
for large dicts (which these likely aren't).

This is similar to https://dart-review.googlesource.com/c/sdk/+/200184

Change-Id: I4fe5c90d21de97d0ecceb27fa6efa7d7deb14098
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200864
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-05-20 11:36:52 +00:00
Srujan Gaddam 7abaa95492 [dart:html] Fix Geoposition bindings and callbacks
Closes https://github.com/dart-lang/sdk/issues/45562
Closes https://github.com/dart-lang/sdk/issues/44324

Geoposition should be bound to GeolocationPosition as well since
Position is deprecated since Chrome 79.

Similarly, success callbacks used in the Geolocation API can accept
a Firefox-specific implementation, so the callback should accept a
dynamic instead. Doing this requires adding annotations to the APIs
so liveness of Geolocation types is maintained.

Change-Id: Id38f68d10c9cdcb7d711ef83a70df87b30be405d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194325
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-04-29 21:32:15 +00:00
Srujan Gaddam f08e228238 [dart:html] Use python2.7 for go.sh
Due to third_party dependencies, this script can't use python3 yet.
Note that this means if we can't use python2.7 in the future, we
either need to update our copy of the IDL scripts to use python3,
update the dependency so that we use the latest IDL scripts, or
we stop using these scripts to generate dart:html.

Change-Id: I42eb7d1fc769644e358dbf26344b6c66265ce10c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196582
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-04-23 19:06:01 +00:00
Sigmund Cherem d52475c166 [web] deprecate dart:web_sql
The WebSql was dropped 5+ years ago and this library is unsupported.

This change adds the `@deprecated` annotation on the library and APIs in
dart:html that expose it (`window.openDatabase`). It also indicates to dartdoc
to skip it for the api.dart.dev site.

I run a `pub_crawl` process to verify that this is not in use. I checked 15K
packages, and only found 2 occurrances of an import to this library:
  * One in a package marked as discontinued (used for migrating constants back
  in Dart 2)
  * Another in an example mock test (generated by mockito for mocking dart:html)
Also no library uses `window.openDatabase` either.

We will send a breaking change announcement soon and plan to delete this in a
future Dart release (possibly 2.15).

Fixes https://github.com/dart-lang/sdk/issues/45687
Fixes https://github.com/dart-lang/sdk/issues/45688

Change-Id: I8cd2bfa0ce64892c3f108bd6e24b8a0a3ec7c6ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196461
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2021-04-23 19:04:42 +00:00
Alexander Thomas b5c63ce757 [infra] Migrate scripts to python3
* Migrate to python3; drop python support.
* Update Windows toolchain support.
* Remove some unused methods.
* Python 2.7 is still needed on Windows.
* Update gsutil to a version that supports python3.

Fixes: https://github.com/dart-lang/sdk/issues/28793

TEST=Manually tested common user journeys.

Change-Id: I663a22b237a548bb82dc2e601e399e3bc3649211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192182
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-04-15 10:10:20 +00:00
Srujan Gaddam 3d52fcd250 [dart:html] Type FontFaceSet.add result as nullable
Closes https://github.com/dart-lang/sdk/issues/45676

`FontFaceSet.add` can return null on Firefox, which leads to a crash
due to native null assertions. The scripts are modified to treat
the `add` return type as nullable.

Change-Id: I8fcff8ef716e8620f04c44f5fb8b3a5884b3d1db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195167
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-04-14 00:00:08 +00:00
Srujan Gaddam ce5a1c2392 [dart:html] Fix sanitization for HTML templates
Bug: b/143778164

Resolves an issue where sanitization wasn't properly handled
when templates were involved.

Change-Id: Ic8f6f28036e18981eb934c2b39c2c0cd4e6f1a96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195056
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-04-13 23:29:08 +00:00
Srujan Gaddam bd58cea90b [dart:html] Fix getContext3d nullability
Closes https://github.com/dart-lang/sdk/issues/45572

getContext3d should return a nullable value since getContext can
return a nullable.

Change-Id: Iaefff781976656db3765d526ec95305f2acfeecf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194503
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-04-09 19:03:43 +00:00
Nicholas Shahan 4c2edfd5b9 [html] Make cancel() always return synchronously
Before Null Safety, `_EventStreamSubscription.cancel()` used a trick
to run with synchronous timing even though it was typed to return a
`Future`. During the migration of the SDK to support Null Safety it
kept the synchronous timing in weak mode, but was changed to
asynchronous in sound mode so that the behavior matched the method
signature. In hindsight, changing the timing when opting into Null
Safety is problematic:

* A shared package has no control over what mode it runs in. Libraries
  may be opted in and run their tests with sound null safety but the
  apps they are used in could still be running in weak mode. This
  results in library unit tests that behave differently than the
  production app that deploys the code.

* This codepath can be triggered by EventTarget.dispatchEvent() from
  dart:html which should have synchronous timings for the event
  listeners before returning to the calling code. The asynchronous
  timing when running with sound null safety is inconsistent with the
  browser API.

This change reverses that migration decision and keeps the synchronous
timing in both modes. To support this in sound mode it returns a
special future value that is internal to the SDK and known to be used
for synchronous timing.

This change also removes the workaround introduced in DDC to avoid
warning/failing when `_EventStreamSubscription.cancel()` returned
null and the extra warnings/errors features were enabled in weak
null safety mode.

Change-Id: I6b08a2ada5b10120bea787ad59d1d58e6e181de5
Fixes: https://github.com/dart-lang/sdk/issues/44157
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175323
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-12-09 01:44:38 +00:00
Sigmund Cherem af0e54cc21 [html] mark a local variable as nullable
See issue https://github.com/dart-lang/sdk/issues/43293

This doesn't fix the underlying issue with custom elements, but fixes the
null-safety problem in strong mode.

Change-Id: Ie6613db7ae472b066bdf6c21751aea57a163c47d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164641
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-09-25 21:34:54 +00:00
Sigmund Cherem c41b69ed77 [html] update templates for code accidentally changed in the generated code
These were updated in the dart:html output code in
https://dart-review.googlesource.com/c/sdk/+/163681

We may want to look into adding a presubmit that let us notify developers when a
change was made in one place but not the other (similar to how we used to check
for sdk and sdk_nnbd in the past).

Change-Id: I280315a5bb07971d0c0077498eb3c59944db0650
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164640
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2020-09-25 21:34:54 +00:00
Srujan Gaddam bb2f0793b8 [dart:html] Remove added types from promise dict
Along with 'creates' types, types were added to promiseToFuture
calls. This is a breaking change for code that does not type the
resulting Future with the same type.

Change-Id: I3d107bb538545fc8f8ce3a58ed98292f415efe2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161629
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-09-14 23:23:47 +00:00
Srujan Gaddam 53a4a57da7 Revert "Revert "[dart:html] Add 'creates' type description to JS calls""
This reverts commit 1f92293fd5.

Reason for revert: Attempt to reland original CL with fixes.

Change-Id: I0d70f22595bd7e1fd6ae72ad4046b949c1035539
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161628
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2020-09-14 23:23:47 +00:00
Ivan Inozemtsev 1f92293fd5 Revert "[dart:html] Add 'creates' type description to JS calls"
This reverts commit 1a6420b883.

Reason for revert: This changes signatures of public methods to return
private types (e.g. `Future<_Cache> open` in `CacheStorage` and
`Future<_Response> fetch` in `Window`), which is a breaking change
without any workaround and it breaks some mocks in customer code.

Original change's description:
> [dart:html] Add 'creates' type description to JS calls
>
> Closes https://github.com/dart-lang/sdk/issues/43225
>
> JS calls on promises need to include a type description for types
> that may be newly live after the call. Since type parameters in a
> promise are not parsed, type dictionary for these APIs is updated
> to include any possible types created and code gen is changed to
> include them in the JS foreign function call.
>
> Change-Id: I8c977e4b33b383093e4091f1be94199b342521b6
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160781
> Reviewed-by: Stephen Adams <sra@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

TBR=sra@google.com,sigmund@google.com,srujzs@google.com

Change-Id: I345053f599457eccfed0efdf68cdea4179693362
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161484
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
2020-09-02 10:03:25 +00:00
Ivan Inozemtsev e44cf969c6 Fix creates value for getStats
It looks like it must match to Dart type, which has a different case
than JS type.

Change-Id: I485ef41d200fb689dd987edc757f3fcb7138ab90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161481
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
Reviewed-by: David Morgan <davidmorgan@google.com>
2020-09-02 09:29:32 +00:00
Srujan Gaddam 1a6420b883 [dart:html] Add 'creates' type description to JS calls
Closes https://github.com/dart-lang/sdk/issues/43225

JS calls on promises need to include a type description for types
that may be newly live after the call. Since type parameters in a
promise are not parsed, type dictionary for these APIs is updated
to include any possible types created and code gen is changed to
include them in the JS foreign function call.

Change-Id: I8c977e4b33b383093e4091f1be94199b342521b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160781
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-09-01 19:11:39 +00:00
Kevin Moore a81213f4e6 Update and/or remove outdated links in dart: web libraries
Change-Id: I13019a09b5c29044a086ed8ca4eff97c67bd9c4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160681
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
2020-08-28 17:27:59 +00:00
zhesha f08c0e36c6 removed corrupted links from doc comments of HttpRequest
As "Forms" tutorial doesn't mentions `HttpRequest ` the link was removed from a doc. And Link to "Fetch Data Dynamically" was updated, so description and URL become correct.
Issue from "site-www" repo [](https://github.com/dart-lang/site-www/issues/2518)

Closes https://github.com/dart-lang/sdk/pull/42696
https://github.com/dart-lang/sdk/pull/42696

GitOrigin-RevId: 34d006aa994446103d4e2a744c60fcd63af2a5d6
Change-Id: If3d55af29ae89594b45544dd308b60ac670f2032
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154401
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2020-08-26 20:11:25 +00:00
Srujan Gaddam 28b8cb34d3 [dart:html] Unify shared attribute metadata from MDN
browser-compat-data includes info on elements as both part of the
Web API and the individual tagged elements. The scripts would default
to whatever was processed last instead of trying to unify any conflicts
that may come up with the different sources of truth. This CL addresses
that issue by choosing the "stricter" of the two versions.

Change-Id: Id3437c14276faf8af3fe41d7a6eb83defc9bd0b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155844
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-08-25 23:48:43 +00:00
Srujan Gaddam 63a57a76ce [dart:html] Revert "[dart:html] Revert commits using MDN compatibility info"
This reverts commit f8ff12008e.

This CL is a revert of the initial revert and should be landed once
Flutter changes have been merged to handle the changes here.

Change-Id: I300a5efd776bf2a596743971f4e15ad62da77f5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153368
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-07-14 23:18:43 +00:00
Stephen Adams f997d62a6d [html] Better code for Element / _ChildrenElementList method
Two tricks let us compile this more efficiently:

    e.children.addAll(cs);

Normally, get$children is inlined, returning a _ChildrenElementList
wrapper, generating:

     new W._ChildrenElementList(e, e.children).addAll$1(0, cs);

The two tricks:

1. Split _ChildElementList.addAll into an 'unwrap' that then calls the
   logic in '_addAll'

2. Add information about the properties of e.children that allow it to
   be removed.

With these tricks, dart2js can optimize the code to this version that
avoids allocating a wrapper or accessing the 'children' property:

     W._ChildrenElementList__addAll(e, cs);

Change-Id: Ifdf533ac4f9790f09f87302e67304b5696097266
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153904
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-07-13 20:33:19 +00:00
Srujan Gaddam f8ff12008e [dart:html] Revert commits using MDN compatibility info
This reverts commits aff77e7e..e24f205d.

Due to a breakage in a Flutter roll, this CL stack needs to be
reverted. It should be reintroduced with changes to Flutter code to
compile with the changes in dart:html.

Breakage: https://github.com/flutter/engine/runs/828631927

Change-Id: I9c93c4eab823337d09d2e347015ad9ec402f2038
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152910
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2020-07-02 01:33:18 +00:00