Skip to content

Commit

Permalink
fix failing casts when talking to minified apps from the host (#2075)
Browse files Browse the repository at this point in the history
* fix failing casts when talking to minified apps from the host by marking them as trusted

* update pubspec/changelog, prep for release
  • Loading branch information
jakemac53 authored Aug 8, 2023
1 parent 5d571d6 commit 2e9bba2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
4 changes: 3 additions & 1 deletion pkgs/test/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 1.24.6-wip
## 1.24.6

* Fix communication failures between minified test apps and the non-minified
host app.
* Add support for discontinuing after the first failing test with `--fail-fast`.

## 1.24.5
Expand Down
7 changes: 5 additions & 2 deletions pkgs/test/lib/src/runner/browser/dom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import 'package:js/js.dart';
class Window extends EventTarget {}

extension WindowExtension on Window {
external Window get parent;
@pragma('dart2js:as:trust')
Window get parent => js_util.getProperty<dynamic>(this, 'parent') as Window;
external Location get location;
CSSStyleDeclaration? getComputedStyle(Element elt, [String? pseudoElt]) =>
js_util.callMethod(this, 'getComputedStyle', <Object>[
Expand Down Expand Up @@ -141,7 +142,9 @@ extension MessageEventExtension on MessageEvent {
///
/// When a message is sent from an iframe through `window.parent.postMessage`
/// the source will be a `WindowProxy` which has the same methods as [Window].
external MessageEventSource source;
@pragma('dart2js:as:trust')
MessageEventSource get source =>
js_util.getProperty<dynamic>(this, 'source') as MessageEventSource;
}

@JS()
Expand Down
Loading

0 comments on commit 2e9bba2

Please sign in to comment.