mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
b859e00908
"[dart:html] Move NullWindowException to implementation" This is a revert ofbd3e6fa1a3
and2b250992f9
. This adds some small code change to avoid a null-assertion being emitted that would lead to a browser SecurityError. CoreLibraryReviewExempt: Reland. Change-Id: Iab52bb728b14fd0b2378b8923b0e1ea8ea930b12 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311922 Reviewed-by: Sigmund Cherem <sigmund@google.com> Commit-Queue: Srujan Gaddam <srujzs@google.com>
26 lines
822 B
Dart
26 lines
822 B
Dart
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:html';
|
|
|
|
import 'package:expect/minitest.dart';
|
|
|
|
main() {
|
|
test('scrollXY', () {
|
|
expect(window.scrollX, 0);
|
|
expect(window.scrollY, 0);
|
|
});
|
|
test('open', () {
|
|
final valid = window.open('', 'blank');
|
|
valid.closed;
|
|
// A blank page with no access to the original window (noopener) should
|
|
// result in null.
|
|
final invalid = window.open('', 'invalid', 'noopener=true');
|
|
try {
|
|
// Should result in an exception since the underlying window is null.
|
|
invalid.closed;
|
|
fail('Expected invalid.closed to throw.');
|
|
} on NullWindowException {}
|
|
});
|
|
}
|