mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Auto merge of #16920 - synlestidae:servo-16705, r=asajeffrey
Implement window.closed <!-- Please describe your changes on the following line: --> Implements #16705. window.closed should evaluate to true if BrowsingContext is discarded --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #16705 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16920) <!-- Reviewable:end -->
This commit is contained in:
commit
8747ccc9e8
6 changed files with 10 additions and 11 deletions
|
@ -23,7 +23,7 @@
|
||||||
//[Replaceable] readonly attribute BarProp toolbar;
|
//[Replaceable] readonly attribute BarProp toolbar;
|
||||||
attribute DOMString status;
|
attribute DOMString status;
|
||||||
void close();
|
void close();
|
||||||
//readonly attribute boolean closed;
|
readonly attribute boolean closed;
|
||||||
//void stop();
|
//void stop();
|
||||||
//void focus();
|
//void focus();
|
||||||
//void blur();
|
//void blur();
|
||||||
|
|
|
@ -509,6 +509,13 @@ impl WindowMethods for Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-window-closed
|
||||||
|
fn Closed(&self) -> bool {
|
||||||
|
self.window_proxy.get()
|
||||||
|
.map(|ref proxy| proxy.is_browsing_context_discarded())
|
||||||
|
.unwrap_or(true)
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-window-close
|
// https://html.spec.whatwg.org/multipage/#dom-window-close
|
||||||
fn Close(&self) {
|
fn Close(&self) {
|
||||||
self.main_thread_script_chan()
|
self.main_thread_script_chan()
|
||||||
|
|
|
@ -339,9 +339,6 @@
|
||||||
[A SecurityError exception must be thrown when window.stop is accessed from a different origin.]
|
[A SecurityError exception must be thrown when window.stop is accessed from a different origin.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[A SecurityError exception should not be thrown when window.closed is accessed from a different origin.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[A SecurityError exception should not be thrown when window.length is accessed from a different origin.]
|
[A SecurityError exception should not be thrown when window.length is accessed from a different origin.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -4341,9 +4341,6 @@
|
||||||
[Window interface: attribute toolbar]
|
[Window interface: attribute toolbar]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Window interface: attribute closed]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Window interface: operation stop()]
|
[Window interface: operation stop()]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -4422,9 +4419,6 @@
|
||||||
[Window interface: window must inherit property "toolbar" with the proper type (11)]
|
[Window interface: window must inherit property "toolbar" with the proper type (11)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Window interface: window must inherit property "closed" with the proper type (14)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Window interface: window must inherit property "stop" with the proper type (15)]
|
[Window interface: window must inherit property "stop" with the proper type (15)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -31734,7 +31734,7 @@
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"mozilla/window.html": [
|
"mozilla/window.html": [
|
||||||
"8cfb22096cf713709d6206945ad1bb98a52c4136",
|
"455b488925ce1798c89c2944d4f13dee0cfa32b1",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"mozilla/window_performance.html": [
|
"mozilla/window_performance.html": [
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
test(function() {
|
test(function() {
|
||||||
assert_equals(window, window.self);
|
assert_equals(window, window.self);
|
||||||
assert_true(window.self instanceof Window, "Should be Window");
|
assert_true(window.self instanceof Window, "Should be Window");
|
||||||
|
assert_true(window.closed === false);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue