[dart:html] Make browser-incompatible attributes nullable

Bug: https://github.com/dart-lang/sdk/issues/41905

Addresses browser incompatibilities for attributes that are
blocking dart2js tests.

Change-Id: I2c7af57e236ba6122cce4c0e98efc04d5e11b525
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148320
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Srujan Gaddam 2020-05-16 03:47:12 +00:00 committed by commit-bot@chromium.org
parent 3b6ca27b41
commit 34bf6742d4
4 changed files with 32 additions and 12 deletions

View file

@ -115,8 +115,8 @@ class HtmlElement extends Element implements NoncedElement {
HtmlElement.created() : super.created();
// From NoncedElement
String get nonce native;
set nonce(String value) native;
String? get nonce native;
set nonce(String? value) native;
}
/**
@ -22629,7 +22629,7 @@ class Navigator extends NavigatorConcurrentHardware
_Clipboard get clipboard native;
NetworkInformation get connection native;
NetworkInformation? get connection native;
CredentialsContainer get credentials native;
@ -22908,7 +22908,7 @@ class NetworkInformation extends EventTarget {
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
num get downlink native;
num? get downlink native;
num get downlinkMax native;
@ -23619,9 +23619,9 @@ class NoncedElement extends Interceptor {
throw new UnsupportedError("Not supported");
}
String get nonce native;
String? get nonce native;
set nonce(String value) native;
set nonce(String? value) native;
}
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@ -25059,7 +25059,7 @@ class Performance extends EventTarget {
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.performance)');
MemoryInfo get memory native;
MemoryInfo? get memory native;
PerformanceNavigation get navigation native;

View file

@ -3304,9 +3304,9 @@ class SvgElement extends Element implements GlobalEventHandlers, NoncedElement {
// From NoncedElement
String get nonce native;
String? get nonce native;
set nonce(String value) native;
set nonce(String? value) native;
ElementStream<Event> get onAbort => abortEvent.forElement(this);

View file

@ -320,11 +320,15 @@ interface Navigator {
[DartSuppress] void getUserMedia(MediaStreamConstraints constraints,
NavigatorUserMediaSuccessCallback successCallback,
NavigatorUserMediaErrorCallback errorCallback);
// deviceMemory is only available on some browsers so it is nullable.
// Marked as nullable to address browser compatibility. See 41905.
[DartSuppress, MeasureAs=NavigatorDeviceMemory,RuntimeEnabled=NavigatorDeviceMemory,SecureContext]
readonly attribute float deviceMemory;
[MeasureAs=NavigatorDeviceMemory,RuntimeEnabled=NavigatorDeviceMemory,SecureContext]
readonly attribute float? deviceMemory;
// Defined as part of NavigatorNetworkInformation. Marked as nullable to
// address browser compatibility. See 41905.
[DartSuppress, MeasureAs=NetInfo] readonly attribute NetworkInformation connection;
[MeasureAs=NetInfo] readonly attribute NetworkInformation? connection;
};
[DartSupplemental,
@ -576,6 +580,9 @@ interface Performance {
[DartSuppress] void webkitClearResourceTimings();
[DartSuppress] void webkitSetResourceTimingBufferSize(unsigned long maxSize);
[DartSuppress] attribute EventHandler onwebkitresourcetimingbufferfull;
// Marked as nullable to address browser compatibility. See 41905.
[DartSuppress, Measure] readonly attribute MemoryInfo memory;
[Measure] readonly attribute MemoryInfo? memory;
};
[DartSupplemental]
@ -628,3 +635,16 @@ interface EventTarget {
[Custom] void addEventListener(DOMString type, EventListener? listener, optional boolean options);
[Custom] void removeEventListener(DOMString type, EventListener? listener, optional boolean options);
};
[DartSupplemental]
interface NetworkInformation : EventTarget {
// Marked as nullable to address browser compatibility. See 41905.
[DartSuppress, RuntimeEnabled=NetInfoDownlink, MeasureAs=NetInfoDownlink] readonly attribute unrestricted double downlink;
[RuntimeEnabled=NetInfoDownlink, MeasureAs=NetInfoDownlink] readonly attribute unrestricted double? downlink;
};
interface NoncedElement {
// Marked as nullable to address browser compatibility. See 41905.
[DartSuppress, CEReactions] attribute DOMString nonce;
[CEReactions] attribute DOMString? nonce;
};

View file

@ -132,8 +132,8 @@ class HtmlElement extends Element implements NoncedElement {
HtmlElement.created() : super.created();
// From NoncedElement
String get nonce native;
set nonce(String value) native;
String$NULLABLE get nonce native;
set nonce(String$NULLABLE value) native;
}
/**