Skip to content

Commit

Permalink
Upgrade to Chromium 109 (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
xvrh authored Dec 8, 2022
1 parent a0d4419 commit a9e594a
Show file tree
Hide file tree
Showing 18 changed files with 1,288 additions and 302 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.19.0
- Update to Chromium 109
- Adds a setter for the TargetInfo type

## 2.18.0
- Expose `Worker` class
- Update the default arguments used to launch the chromium process
Expand Down
6 changes: 4 additions & 2 deletions lib/protocol/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ enum PermissionType {
durableStorage('durableStorage'),
flash('flash'),
geolocation('geolocation'),
idleDetection('idleDetection'),
localFonts('localFonts'),
midi('midi'),
midiSysex('midiSysex'),
nfc('nfc'),
Expand All @@ -427,11 +429,12 @@ enum PermissionType {
periodicBackgroundSync('periodicBackgroundSync'),
protectedMediaIdentifier('protectedMediaIdentifier'),
sensors('sensors'),
storageAccess('storageAccess'),
videoCapture('videoCapture'),
videoCapturePanTiltZoom('videoCapturePanTiltZoom'),
idleDetection('idleDetection'),
wakeLockScreen('wakeLockScreen'),
wakeLockSystem('wakeLockSystem'),
windowManagement('windowManagement'),
;

final String value;
Expand All @@ -450,7 +453,6 @@ enum PermissionType {
enum PermissionSetting {
granted('granted'),
denied('denied'),
prompt('prompt'),
;

final String value;
Expand Down
21 changes: 20 additions & 1 deletion lib/protocol/css.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1375,8 +1375,19 @@ class CSSContainerQuery {
/// Optional name for the container.
final String? name;

/// Optional physical axes queried for the container.
final dom.PhysicalAxes? physicalAxes;

/// Optional logical axes queried for the container.
final dom.LogicalAxes? logicalAxes;

CSSContainerQuery(
{required this.text, this.range, this.styleSheetId, this.name});
{required this.text,
this.range,
this.styleSheetId,
this.name,
this.physicalAxes,
this.logicalAxes});

factory CSSContainerQuery.fromJson(Map<String, dynamic> json) {
return CSSContainerQuery(
Expand All @@ -1388,6 +1399,12 @@ class CSSContainerQuery {
? StyleSheetId.fromJson(json['styleSheetId'] as String)
: null,
name: json.containsKey('name') ? json['name'] as String : null,
physicalAxes: json.containsKey('physicalAxes')
? dom.PhysicalAxes.fromJson(json['physicalAxes'] as String)
: null,
logicalAxes: json.containsKey('logicalAxes')
? dom.LogicalAxes.fromJson(json['logicalAxes'] as String)
: null,
);
}

Expand All @@ -1397,6 +1414,8 @@ class CSSContainerQuery {
if (range != null) 'range': range!.toJson(),
if (styleSheetId != null) 'styleSheetId': styleSheetId!.toJson(),
if (name != null) 'name': name,
if (physicalAxes != null) 'physicalAxes': physicalAxes!.toJson(),
if (logicalAxes != null) 'logicalAxes': logicalAxes!.toJson(),
};
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/protocol/debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,12 @@ class DebuggerApi {
});
}

/// Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or
/// no exceptions. Initial pause on exceptions state is `none`.
/// Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions,
/// or caught exceptions, no exceptions. Initial pause on exceptions state is `none`.
/// [state] Pause on exceptions mode.
Future<void> setPauseOnExceptions(
@Enum(['none', 'uncaught', 'all']) String state) async {
assert(const ['none', 'uncaught', 'all'].contains(state));
@Enum(['none', 'caught', 'uncaught', 'all']) String state) async {
assert(const ['none', 'caught', 'uncaught', 'all'].contains(state));
await _client.send('Debugger.setPauseOnExceptions', {
'state': state,
});
Expand Down
63 changes: 54 additions & 9 deletions lib/protocol/dom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -685,15 +685,20 @@ class DOMApi {
return GetFrameOwnerResult.fromJson(result);
}

/// Returns the container of the given node based on container query conditions.
/// If containerName is given, it will find the nearest container with a matching name;
/// otherwise it will find the nearest container regardless of its container name.
/// Returns the query container of the given node based on container query
/// conditions: containerName, physical, and logical axes. If no axes are
/// provided, the style container is returned, which is the direct parent or the
/// closest element with a matching container-name.
/// Returns: The container node for the given node, or null if not found.
Future<NodeId> getContainerForNode(NodeId nodeId,
{String? containerName}) async {
{String? containerName,
PhysicalAxes? physicalAxes,
LogicalAxes? logicalAxes}) async {
var result = await _client.send('DOM.getContainerForNode', {
'nodeId': nodeId,
if (containerName != null) 'containerName': containerName,
if (physicalAxes != null) 'physicalAxes': physicalAxes,
if (logicalAxes != null) 'logicalAxes': logicalAxes,
});
return NodeId.fromJson(result['nodeId'] as int);
}
Expand Down Expand Up @@ -1095,11 +1100,11 @@ enum PseudoType {
scrollbarCorner('scrollbar-corner'),
resizer('resizer'),
inputListButton('input-list-button'),
pageTransition('page-transition'),
pageTransitionContainer('page-transition-container'),
pageTransitionImageWrapper('page-transition-image-wrapper'),
pageTransitionOutgoingImage('page-transition-outgoing-image'),
pageTransitionIncomingImage('page-transition-incoming-image'),
viewTransition('view-transition'),
viewTransitionGroup('view-transition-group'),
viewTransitionImagePair('view-transition-image-pair'),
viewTransitionOld('view-transition-old'),
viewTransitionNew('view-transition-new'),
;

final String value;
Expand Down Expand Up @@ -1155,6 +1160,46 @@ enum CompatibilityMode {
String toString() => value.toString();
}

/// ContainerSelector physical axes
enum PhysicalAxes {
horizontal('Horizontal'),
vertical('Vertical'),
both('Both'),
;

final String value;

const PhysicalAxes(this.value);

factory PhysicalAxes.fromJson(String value) =>
PhysicalAxes.values.firstWhere((e) => e.value == value);

String toJson() => value;

@override
String toString() => value.toString();
}

/// ContainerSelector logical axes
enum LogicalAxes {
inline('Inline'),
block('Block'),
both('Both'),
;

final String value;

const LogicalAxes(this.value);

factory LogicalAxes.fromJson(String value) =>
LogicalAxes.values.firstWhere((e) => e.value == value);

String toJson() => value;

@override
String toString() => value.toString();
}

/// DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes.
/// DOMNode is a base node mirror type.
class Node {
Expand Down
4 changes: 3 additions & 1 deletion lib/protocol/fetch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ class FetchApi {
/// [url] If set, the request url will be modified in a way that's not observable by page.
/// [method] If set, the request method is overridden.
/// [postData] If set, overrides the post data in the request.
/// [headers] If set, overrides the request headers.
/// [headers] If set, overrides the request headers. Note that the overrides do not
/// extend to subsequent redirect hops, if a redirect happens. Another override
/// may be applied to a different request produced by a redirect.
/// [interceptResponse] If set, overrides response interception behavior for this request.
Future<void> continueRequest(RequestId requestId,
{String? url,
Expand Down
20 changes: 11 additions & 9 deletions lib/protocol/headless_experimental.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ class HeadlessExperimentalApi {

HeadlessExperimentalApi(this._client);

/// Issued when the target starts or stops needing BeginFrames.
/// Deprecated. Issue beginFrame unconditionally instead and use result from
/// beginFrame to detect whether the frames were suppressed.
Stream<bool> get onNeedsBeginFramesChanged => _client.onEvent
.where((event) =>
event.name == 'HeadlessExperimental.needsBeginFramesChanged')
.map((event) => event.parameters['needsBeginFrames'] as bool);

/// Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a
/// screenshot from the resulting frame. Requires that the target was created with enabled
/// BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also
Expand Down Expand Up @@ -44,11 +36,13 @@ class HeadlessExperimentalApi {
}

/// Disables headless events for the target.
@Deprecated('This command is deprecated')
Future<void> disable() async {
await _client.send('HeadlessExperimental.disable');
}

/// Enables headless events for the target.
@Deprecated('This command is deprecated')
Future<void> enable() async {
await _client.send('HeadlessExperimental.enable');
}
Expand Down Expand Up @@ -82,28 +76,36 @@ class ScreenshotParams {
/// Compression quality from range [0..100] (jpeg only).
final int? quality;

ScreenshotParams({this.format, this.quality});
/// Optimize image encoding for speed, not for resulting size (defaults to false)
final bool? optimizeForSpeed;

ScreenshotParams({this.format, this.quality, this.optimizeForSpeed});

factory ScreenshotParams.fromJson(Map<String, dynamic> json) {
return ScreenshotParams(
format: json.containsKey('format')
? ScreenshotParamsFormat.fromJson(json['format'] as String)
: null,
quality: json.containsKey('quality') ? json['quality'] as int : null,
optimizeForSpeed: json.containsKey('optimizeForSpeed')
? json['optimizeForSpeed'] as bool
: null,
);
}

Map<String, dynamic> toJson() {
return {
if (format != null) 'format': format,
if (quality != null) 'quality': quality,
if (optimizeForSpeed != null) 'optimizeForSpeed': optimizeForSpeed,
};
}
}

enum ScreenshotParamsFormat {
jpeg('jpeg'),
png('png'),
webp('webp'),
;

final String value;
Expand Down
10 changes: 9 additions & 1 deletion lib/protocol/network.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1287,12 +1287,16 @@ class RequestWillBeSentExtraInfoEvent {
/// The client security state set for the request.
final ClientSecurityState? clientSecurityState;

/// Whether the site has partitioned cookies stored in a partition different than the current one.
final bool? siteHasCookieInOtherPartition;

RequestWillBeSentExtraInfoEvent(
{required this.requestId,
required this.associatedCookies,
required this.headers,
required this.connectTiming,
this.clientSecurityState});
this.clientSecurityState,
this.siteHasCookieInOtherPartition});

factory RequestWillBeSentExtraInfoEvent.fromJson(Map<String, dynamic> json) {
return RequestWillBeSentExtraInfoEvent(
Expand All @@ -1308,6 +1312,10 @@ class RequestWillBeSentExtraInfoEvent {
? ClientSecurityState.fromJson(
json['clientSecurityState'] as Map<String, dynamic>)
: null,
siteHasCookieInOtherPartition:
json.containsKey('siteHasCookieInOtherPartition')
? json['siteHasCookieInOtherPartition'] as bool
: null,
);
}
}
Expand Down
Loading

0 comments on commit a9e594a

Please sign in to comment.