Skip to content

Commit

Permalink
Update to chromium 85
Browse files Browse the repository at this point in the history
  • Loading branch information
xvrh committed Jul 21, 2020
1 parent 8e795a4 commit f4feecf
Show file tree
Hide file tree
Showing 16 changed files with 616 additions and 26 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog

# 1.19.0 (2020-07-21)
- Update Chromium to version 85

# 1.18.0 (2020-07-16)
- Update Chromium to version 84
- Add `Mouse.wheel`
Expand Down
191 changes: 190 additions & 1 deletion lib/protocol/audits.dart
Expand Up @@ -488,16 +488,185 @@ class MixedContentIssueDetails {
}
}

/// Enum indicating the reason a response has been blocked. These reasons are
/// refinements of the net error BLOCKED_BY_RESPONSE.
class BlockedByResponseReason {
static const coepFrameResourceNeedsCoepHeader =
BlockedByResponseReason._('CoepFrameResourceNeedsCoepHeader');
static const coopSandboxedIFrameCannotNavigateToCoopPage =
BlockedByResponseReason._('CoopSandboxedIFrameCannotNavigateToCoopPage');
static const corpNotSameOrigin =
BlockedByResponseReason._('CorpNotSameOrigin');
static const corpNotSameOriginAfterDefaultedToSameOriginByCoep =
BlockedByResponseReason._(
'CorpNotSameOriginAfterDefaultedToSameOriginByCoep');
static const corpNotSameSite = BlockedByResponseReason._('CorpNotSameSite');
static const values = {
'CoepFrameResourceNeedsCoepHeader': coepFrameResourceNeedsCoepHeader,
'CoopSandboxedIFrameCannotNavigateToCoopPage':
coopSandboxedIFrameCannotNavigateToCoopPage,
'CorpNotSameOrigin': corpNotSameOrigin,
'CorpNotSameOriginAfterDefaultedToSameOriginByCoep':
corpNotSameOriginAfterDefaultedToSameOriginByCoep,
'CorpNotSameSite': corpNotSameSite,
};

final String value;

const BlockedByResponseReason._(this.value);

factory BlockedByResponseReason.fromJson(String value) => values[value];

String toJson() => value;

@override
bool operator ==(other) =>
(other is BlockedByResponseReason && other.value == value) ||
value == other;

@override
int get hashCode => value.hashCode;

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

/// Details for a request that has been blocked with the BLOCKED_BY_RESPONSE
/// code. Currently only used for COEP/COOP, but may be extended to include
/// some CSP errors in the future.
class BlockedByResponseIssueDetails {
final AffectedRequest request;

final AffectedFrame frame;

final BlockedByResponseReason reason;

BlockedByResponseIssueDetails(
{@required this.request, this.frame, @required this.reason});

factory BlockedByResponseIssueDetails.fromJson(Map<String, dynamic> json) {
return BlockedByResponseIssueDetails(
request:
AffectedRequest.fromJson(json['request'] as Map<String, dynamic>),
frame: json.containsKey('frame')
? AffectedFrame.fromJson(json['frame'] as Map<String, dynamic>)
: null,
reason: BlockedByResponseReason.fromJson(json['reason'] as String),
);
}

Map<String, dynamic> toJson() {
return {
'request': request.toJson(),
'reason': reason.toJson(),
if (frame != null) 'frame': frame.toJson(),
};
}
}

class HeavyAdResolutionStatus {
static const heavyAdBlocked = HeavyAdResolutionStatus._('HeavyAdBlocked');
static const heavyAdWarning = HeavyAdResolutionStatus._('HeavyAdWarning');
static const values = {
'HeavyAdBlocked': heavyAdBlocked,
'HeavyAdWarning': heavyAdWarning,
};

final String value;

const HeavyAdResolutionStatus._(this.value);

factory HeavyAdResolutionStatus.fromJson(String value) => values[value];

String toJson() => value;

@override
bool operator ==(other) =>
(other is HeavyAdResolutionStatus && other.value == value) ||
value == other;

@override
int get hashCode => value.hashCode;

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

class HeavyAdReason {
static const networkTotalLimit = HeavyAdReason._('NetworkTotalLimit');
static const cpuTotalLimit = HeavyAdReason._('CpuTotalLimit');
static const cpuPeakLimit = HeavyAdReason._('CpuPeakLimit');
static const values = {
'NetworkTotalLimit': networkTotalLimit,
'CpuTotalLimit': cpuTotalLimit,
'CpuPeakLimit': cpuPeakLimit,
};

final String value;

const HeavyAdReason._(this.value);

factory HeavyAdReason.fromJson(String value) => values[value];

String toJson() => value;

@override
bool operator ==(other) =>
(other is HeavyAdReason && other.value == value) || value == other;

@override
int get hashCode => value.hashCode;

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

class HeavyAdIssueDetails {
/// The resolution status, either blocking the content or warning.
final HeavyAdResolutionStatus resolution;

/// The reason the ad was blocked, total network or cpu or peak cpu.
final HeavyAdReason reason;

/// The frame that was blocked.
final AffectedFrame frame;

HeavyAdIssueDetails(
{@required this.resolution, @required this.reason, @required this.frame});

factory HeavyAdIssueDetails.fromJson(Map<String, dynamic> json) {
return HeavyAdIssueDetails(
resolution:
HeavyAdResolutionStatus.fromJson(json['resolution'] as String),
reason: HeavyAdReason.fromJson(json['reason'] as String),
frame: AffectedFrame.fromJson(json['frame'] as Map<String, dynamic>),
);
}

Map<String, dynamic> toJson() {
return {
'resolution': resolution.toJson(),
'reason': reason.toJson(),
'frame': frame.toJson(),
};
}
}

/// A unique identifier for the type of issue. Each type may use one of the
/// optional fields in InspectorIssueDetails to convey more specific
/// information about the kind of issue.
class InspectorIssueCode {
static const sameSiteCookieIssue =
InspectorIssueCode._('SameSiteCookieIssue');
static const mixedContentIssue = InspectorIssueCode._('MixedContentIssue');
static const blockedByResponseIssue =
InspectorIssueCode._('BlockedByResponseIssue');
static const heavyAdIssue = InspectorIssueCode._('HeavyAdIssue');
static const values = {
'SameSiteCookieIssue': sameSiteCookieIssue,
'MixedContentIssue': mixedContentIssue,
'BlockedByResponseIssue': blockedByResponseIssue,
'HeavyAdIssue': heavyAdIssue,
};

final String value;
Expand Down Expand Up @@ -527,8 +696,15 @@ class InspectorIssueDetails {

final MixedContentIssueDetails mixedContentIssueDetails;

final BlockedByResponseIssueDetails blockedByResponseIssueDetails;

final HeavyAdIssueDetails heavyAdIssueDetails;

InspectorIssueDetails(
{this.sameSiteCookieIssueDetails, this.mixedContentIssueDetails});
{this.sameSiteCookieIssueDetails,
this.mixedContentIssueDetails,
this.blockedByResponseIssueDetails,
this.heavyAdIssueDetails});

factory InspectorIssueDetails.fromJson(Map<String, dynamic> json) {
return InspectorIssueDetails(
Expand All @@ -540,6 +716,15 @@ class InspectorIssueDetails {
? MixedContentIssueDetails.fromJson(
json['mixedContentIssueDetails'] as Map<String, dynamic>)
: null,
blockedByResponseIssueDetails:
json.containsKey('blockedByResponseIssueDetails')
? BlockedByResponseIssueDetails.fromJson(
json['blockedByResponseIssueDetails'] as Map<String, dynamic>)
: null,
heavyAdIssueDetails: json.containsKey('heavyAdIssueDetails')
? HeavyAdIssueDetails.fromJson(
json['heavyAdIssueDetails'] as Map<String, dynamic>)
: null,
);
}

Expand All @@ -549,6 +734,10 @@ class InspectorIssueDetails {
'sameSiteCookieIssueDetails': sameSiteCookieIssueDetails.toJson(),
if (mixedContentIssueDetails != null)
'mixedContentIssueDetails': mixedContentIssueDetails.toJson(),
if (blockedByResponseIssueDetails != null)
'blockedByResponseIssueDetails': blockedByResponseIssueDetails.toJson(),
if (heavyAdIssueDetails != null)
'heavyAdIssueDetails': heavyAdIssueDetails.toJson(),
};
}
}
Expand Down
9 changes: 9 additions & 0 deletions lib/protocol/css.dart
Expand Up @@ -623,6 +623,12 @@ class CSSStyleSheetHeader {
/// document.written STYLE tags.
final bool isInline;

/// Whether this stylesheet is mutable. Inline stylesheets become mutable
/// after they have been modified via CSSOM API.
/// <link> element's stylesheets are never mutable. Constructed stylesheets
/// (new CSSStyleSheet()) are mutable immediately after creation.
final bool isMutable;

/// Line offset of the stylesheet within the resource (zero based).
final num startLine;

Expand All @@ -649,6 +655,7 @@ class CSSStyleSheetHeader {
@required this.disabled,
this.hasSourceURL,
@required this.isInline,
@required this.isMutable,
@required this.startLine,
@required this.startColumn,
@required this.length,
Expand All @@ -673,6 +680,7 @@ class CSSStyleSheetHeader {
? json['hasSourceURL'] as bool
: null,
isInline: json['isInline'] as bool,
isMutable: json['isMutable'] as bool,
startLine: json['startLine'] as num,
startColumn: json['startColumn'] as num,
length: json['length'] as num,
Expand All @@ -690,6 +698,7 @@ class CSSStyleSheetHeader {
'title': title,
'disabled': disabled,
'isInline': isInline,
'isMutable': isMutable,
'startLine': startLine,
'startColumn': startColumn,
'length': length,
Expand Down
7 changes: 6 additions & 1 deletion lib/protocol/input.dart
Expand Up @@ -27,6 +27,9 @@ class InputApi {
/// [isSystemKey] Whether the event was a system key event (default: false).
/// [location] Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:
/// 0).
/// [commands] Editing commands to send with the key event (e.g., 'selectAll') (default: []).
/// These are related to but not equal the command names used in `document.execCommand` and NSStandardKeyBindingResponding.
/// See https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/editing/commands/editor_command_names.h for valid command names.
Future<void> dispatchKeyEvent(
@Enum(['keyDown', 'keyUp', 'rawKeyDown', 'char']) String type,
{int modifiers,
Expand All @@ -41,7 +44,8 @@ class InputApi {
bool autoRepeat,
bool isKeypad,
bool isSystemKey,
int location}) async {
int location,
List<String> commands}) async {
assert(const ['keyDown', 'keyUp', 'rawKeyDown', 'char'].contains(type));
await _client.send('Input.dispatchKeyEvent', {
'type': type,
Expand All @@ -60,6 +64,7 @@ class InputApi {
if (isKeypad != null) 'isKeypad': isKeypad,
if (isSystemKey != null) 'isSystemKey': isSystemKey,
if (location != null) 'location': location,
if (commands != null) 'commands': [...commands],
});
}

Expand Down

0 comments on commit f4feecf

Please sign in to comment.