Auto merge of #20329 - gterzian:before_unload, r=cbrewster

Implement beforeunload event and infrastructure

<!-- Please describe your changes on the following line: -->

Implementation of:
1. https://html.spec.whatwg.org/multipage/#prompt-to-unload-a-document, and
2. https://html.spec.whatwg.org/multipage/#unload-a-document
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #10787 and fix #20485 and fix #20588 and fix #20496 (github issue number if applicable).

<!-- Either: -->
- [ ] 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/20329)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-05-07 13:22:23 -04:00 committed by GitHub
commit 1d8283e010
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 341 additions and 113 deletions

View file

@ -1,10 +1,7 @@
[url-in-tags-revoke.window.html]
expected: TIMEOUT
[Fetching a blob URL immediately before revoking it works in an iframe.]
expected: FAIL
[Fetching a blob URL immediately before revoking it works in <script> tags.]
expected: TIMEOUT
[Fetching a blob URL immediately before revoking it works in an iframe navigation.]
expected: TIMEOUT

View file

@ -1,6 +0,0 @@
[001.html]
type: testharness
expected: TIMEOUT
[pageshow event from traversal]
expected: TIMEOUT

View file

@ -1,3 +1,3 @@
[window-name-after-cross-origin-main-frame-navigation.sub.html]
type: testharness
expected: TIMEOUT
expected: ERROR

View file

@ -1,6 +0,0 @@
[window-name-after-cross-origin-sub-frame-navigation.sub.html]
type: testharness
expected: TIMEOUT
[Test that the window name is correct]
expected: NOTRUN

View file

@ -1,3 +1,3 @@
[window-name-after-same-origin-main-frame-navigation.sub.html]
type: testharness
expected: TIMEOUT
expected: ERROR

View file

@ -1,6 +0,0 @@
[window-name-after-same-origin-sub-frame-navigation.sub.html]
type: testharness
expected: TIMEOUT
[Test that the window name is correct]
expected: NOTRUN

View file

@ -1,3 +1,4 @@
[007.html]
type: testharness
expected: TIMEOUT
[Link with onclick javascript url and href navigation ]
expected: FAIL

View file

@ -1,6 +0,0 @@
[child_navigates_parent_location.html]
type: testharness
expected: TIMEOUT
[Child document navigating parent via location ]
expected: TIMEOUT

View file

@ -0,0 +1,4 @@
[001.html]
type: testharness
[document.open in unload]
expected: FAIL

View file

@ -0,0 +1,4 @@
[002.html]
type: testharness
[document.open in unload]
expected: FAIL

View file

@ -0,0 +1,4 @@
[003.html]
type: testharness
[document.open in beforeunload with link]
expected: FAIL

View file

@ -0,0 +1,4 @@
[004.html]
type: testharness
[document.open in beforeunload with button]
expected: FAIL

View file

@ -0,0 +1,4 @@
[005.html]
type: testharness
[document.open in pagehide in iframe]
expected: FAIL

View file

@ -0,0 +1,4 @@
[beforeunload-on-history-back.html]
type: testharness
[beforeunload event fires on history navigation back]
expected: FAIL

View file

@ -0,0 +1,6 @@
[beforeunload-on-navigation-of-parent.html]
type: testharness
[Triggering navigation from within beforeunload event]
expected: FAIL
[beforeunload in iframe on navigation of parent]
expected: FAIL

View file

@ -0,0 +1,4 @@
[navigation-within-beforeunload.html]
type: testharness
[Triggering navigation from within beforeunload event]
expected: FAIL

View file

@ -0,0 +1,4 @@
[003.html]
type: testharness
[unload event properties]
expected: FAIL

View file

@ -0,0 +1,5 @@
[006.html]
type: testharness
expected: TIMEOUT
[salvagable state of document after setting pagehide listener]
expected: TIMEOUT

View file

@ -1,6 +1,4 @@
[assign_after_load.html]
type: testharness
expected: TIMEOUT
[Assignment to location after document is completely loaded]
expected: TIMEOUT
expected: FAIL

View file

@ -1,6 +0,0 @@
[assign_before_load.html]
type: testharness
expected: TIMEOUT
[Assignment to location before document is completely loaded]
expected: TIMEOUT

View file

@ -17,19 +17,3 @@
[Set data URL frame location.protocol to http+x]
expected: FAIL
[Set HTTP URL frame location.protocol to x]
expected: FAIL
[Set HTTP URL frame location.protocol to data]
expected: FAIL
[Set HTTP URL frame location.protocol to ftp]
expected: FAIL
[Set HTTP URL frame location.protocol to gopher]
expected: FAIL
[Set HTTP URL frame location.protocol to http+x]
expected: FAIL

View file

@ -32,9 +32,6 @@
[Window attribute: onmousewheel]
expected: FAIL
[Window unforgeable attribute: location]
expected: FAIL
[Window replaceable attribute: locationbar]
expected: FAIL

View file

@ -44,9 +44,6 @@
[Document interface: attribute onsecuritypolicyviolation]
expected: FAIL
[Document interface: iframe.contentDocument must have own property "location"]
expected: FAIL
[Document interface: iframe.contentDocument must inherit property "dir" with the proper type]
expected: FAIL
@ -113,9 +110,6 @@
[Document interface: iframe.contentDocument must inherit property "onsecuritypolicyviolation" with the proper type]
expected: FAIL
[Document interface: new Document() must have own property "location"]
expected: FAIL
[Document interface: new Document() must inherit property "dir" with the proper type]
expected: FAIL
@ -179,9 +173,6 @@
[Document interface: new Document() must inherit property "onsecuritypolicyviolation" with the proper type]
expected: FAIL
[Document interface: document.implementation.createDocument(null, "", null) must have own property "location"]
expected: FAIL
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "dir" with the proper type]
expected: FAIL
@ -4991,9 +4982,6 @@
[Window interface: window must inherit property "self" with the proper type]
expected: FAIL
[Window interface: window must have own property "location"]
expected: FAIL
[Window interface: window must inherit property "locationbar" with the proper type]
expected: FAIL

View file

@ -1,5 +0,0 @@
[079.html]
type: testharness
[ setting location to javascript URL from event handler ]
expected: FAIL