summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html/browsers
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/html/browsers')
-rw-r--r--testing/web-platform/tests/html/browsers/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/aborting-a-document-load/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001-1.html11
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001-2.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001.html30
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/MANIFEST16
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/PopStateEvent.html31
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-0.html35
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-1.html6
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-2.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-3.html6
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-4.html6
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name.html13
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin.html41
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin_2.html47
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin_3.html47
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/contains.json6
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/events.html151
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/hashchange_event.html43
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/blank1.html8
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/blank2.html8
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/page-with-fragment.html20
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/post_name_on_load.html7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resume-timer-on-history-back.html145
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-basic.html34
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html67
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-samedoc.html54
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-cross-origin.html71
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-samedoc.html81
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/popstate_event.html40
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name.html7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-2.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-3.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001.html20
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-1.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-2.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002.html23
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-2.html9
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-3.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003.html22
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-2.html9
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-3.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004.html22
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/005.html16
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/006.html17
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/007.html16
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/008.html17
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/009.html22
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/010.html17
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/011.html21
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/012.html20
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/013.html20
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/014.html21
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/015.html20
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/MANIFEST42
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/blank.html1
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-1.html3
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-2.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-3.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location.html17
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-1.html3
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-2.html6
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-3.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit.html18
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/click.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment.html20
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment_iframe.html11
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/href.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-query-fragment-components.html28
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-return-value-handling.html36
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url.html20
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin.html20
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent.html17
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-src.html17
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function.html18
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html17
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/dummy.html3
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/location-set.html8
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/set-parent-src.html8
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/read-html/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/read-media/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/read-media/pageload-image.html30
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/read-media/pageload-video.html30
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/read-multipart-x-mixed-replace/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/read-plugin/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/read-text/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/read-text/load-text-plain.html40
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/read-ua-inline/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/read-xml/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/001.html16
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/002.html21
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/003.html25
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/004.html23
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/005.html23
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/006.html34
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/007.html37
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/MANIFEST7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-percent-encoded.html59
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name.html53
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-id-top.html51
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-top.html60
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/001.html15
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/002.html15
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/003.html15
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/004.html15
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/005.html15
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/MANIFEST33
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/base.html14
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back-1.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back.html31
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-1.html2
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-2.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent.html31
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/contains.json6
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-1.html10
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-2.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload.html26
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward-1.html2
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward.html19
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-1.html10
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-2.html1
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001.html14
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002.html20
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/003.html20
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/MANIFEST14
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-001.html9
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-002.html9
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-003.html11
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-004.html11
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-005.html22
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-006.html9
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/next.html2
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001-1.html23
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001a.html7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001b.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002-1.html28
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002a.html7
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002b.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003-1.html23
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003a.html8
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003b.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004-1.html25
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004a.html8
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004b.html18
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005-1.html13
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005a.html8
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005b.html17
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-1.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-2.html2
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001.html25
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002-1.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002.html33
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003-1.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003.html33
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004-1.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004.html28
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-1.html20
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-2.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006.html18
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-1.html21
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-2.html5
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007.html28
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008-1.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008.html16
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009-1.html4
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009.html16
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/MANIFEST21
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001-1.html2
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001.html5
-rw-r--r--testing/web-platform/tests/html/browsers/history/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/history/history-notes/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-child1.html18
-rw-r--r--testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-child2.html5
-rw-r--r--testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-grandchild1.html8
-rw-r--r--testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-grandchild2.html5
-rw-r--r--testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-only-fully-active.html30
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/001.html333
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/002.html308
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/004.html62
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/005.html47
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/006.html53
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/007.html56
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/008.html40
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/008.js11
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/009-1.html20
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/009-3.html28
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/009-5.html23
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/009.html22
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/010-1.html16
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/010-3.html24
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/010-5.html23
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/010.html22
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/011.html32
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/012.html32
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/blank.html8
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/blank2.html13
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/blank3.html11
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_001.html20
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_002.html22
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_003.html26
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_004.html29
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_005.html34
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_006.html30
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_007.html32
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history.js35
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_back-1.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_back.html27
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_back_1.html28
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_entry.html12
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward-1.html15
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward-2.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward.html32
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward_1.html28
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_minus.html27
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_no_argument-1.html18
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_no_argument.html29
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_plus.html33
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_undefined-1.html15
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_undefined.html28
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_zero-1.html18
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_zero.html29
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate.html19
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate_err.html18
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate_nooptionalparam.html20
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate.html20
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate_err.html18
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate_nooptionalparam.html20
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history_state.html24
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/001-1.html72
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/001.html18
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/002-1.html35
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/002.html18
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/filler.html5
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/history.js35
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/history_entry.html12
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_1-1.html18
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_1-manual.html31
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_2-1.html18
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_2-manual.html31
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_session_history_unload_prompt_1-1.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_session_history_unload_prompt_1-manual.html30
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_1-1.html18
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_1.html28
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_2-1.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_2.html28
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_3-1.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_3.html28
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_4-1.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_4.html28
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_5-1.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_5.html28
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_unload_1-1.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_unload_1.html30
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1-1.html15
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html30
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_2-1.html12
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_2.html28
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_1-1.html12
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_1.html29
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_2-1.html12
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_2.html29
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/allow_prototype_cycle_through_location.sub.html197
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-1.html9
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-2.html7
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load.html23
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-2.html7
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load.html23
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/contains.json6
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/cross_origin_joined_frame.sub.html15
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/document_location.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location-prototype-setting.html18
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html11
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign.html26
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank-1.html2
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank.html24
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_hash.html33
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_host.html28
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_hostname.html33
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_href.html19
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_origin.html14
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_pathname.html22
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_port.html31
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_protocol.html25
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload-iframe.html4
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload.html41
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_replace.html20
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/location_search.html20
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-2.html7
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-manual.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-1.html10
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-2.html7
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-manual.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_replace_during_load-manual.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-1.html9
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-2.html7
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-manual.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-1.html15
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-manual.html26
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html14
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html26
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write-1.html4
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write.html21
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload-1.html9
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload.html26
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1-1.html10
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1.html27
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/same_origin_frame.html12
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-1.html10
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-2.html7
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-1.html13
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-2.html7
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load.html16
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html12
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html7
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html17
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/security_location_0.sub.htm27
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/offline/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/offline/appcache/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/offline/application-cache-api/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_checking-manual.html23
-rw-r--r--testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_downloading-manual.html24
-rw-r--r--testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_idle.html22
-rw-r--r--testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_obsolete-manual.html24
-rw-r--r--testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_uncached.html19
-rw-r--r--testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_updateready-manual.html25
-rw-r--r--testing/web-platform/tests/html/browsers/offline/application-cache-api/api_swapcache-manual.html30
-rw-r--r--testing/web-platform/tests/html/browsers/offline/application-cache-api/api_swapcache_error.html19
-rw-r--r--testing/web-platform/tests/html/browsers/offline/application-cache-api/api_update.html24
-rw-r--r--testing/web-platform/tests/html/browsers/offline/application-cache-api/api_update_error.html24
-rw-r--r--testing/web-platform/tests/html/browsers/offline/browser-state/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/offline/browser-state/navigator_online_event-manual.html40
-rw-r--r--testing/web-platform/tests/html/browsers/offline/browser-state/navigator_online_online.html17
-rw-r--r--testing/web-platform/tests/html/browsers/offline/changestonetworkingmodel/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/offline/changestonetworkingmodel/original-id.json1
-rw-r--r--testing/web-platform/tests/html/browsers/offline/disk-space/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/offline/downloading-or-updating-an-application-cache/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/offline/expiring-application-caches/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/offline/introduction-4/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/offline/introduction-4/contains.json10
-rw-r--r--testing/web-platform/tests/html/browsers/offline/introduction-4/event_cached.html18
-rw-r--r--testing/web-platform/tests/html/browsers/offline/introduction-4/event_checking.html18
-rw-r--r--testing/web-platform/tests/html/browsers/offline/introduction-4/event_downloading-manual.html23
-rw-r--r--testing/web-platform/tests/html/browsers/offline/introduction-4/event_error-manual.html23
-rw-r--r--testing/web-platform/tests/html/browsers/offline/introduction-4/event_noupdate.html19
-rw-r--r--testing/web-platform/tests/html/browsers/offline/introduction-4/event_obsolete-manual.html23
-rw-r--r--testing/web-platform/tests/html/browsers/offline/introduction-4/event_progress.html18
-rw-r--r--testing/web-platform/tests/html/browsers/offline/introduction-4/event_updateready-manual.html22
-rw-r--r--testing/web-platform/tests/html/browsers/offline/introduction-4/event_updateready_swapcache-manual.html30
-rw-r--r--testing/web-platform/tests/html/browsers/offline/manifest_main_empty-manual.html14
-rw-r--r--testing/web-platform/tests/html/browsers/offline/manifest_notchanged_online-manual.html19
-rw-r--r--testing/web-platform/tests/html/browsers/offline/manifest_section_empty-manual.html19
-rw-r--r--testing/web-platform/tests/html/browsers/offline/manifest_section_many-manual.html19
-rw-r--r--testing/web-platform/tests/html/browsers/offline/manifest_url_check.html18
-rw-r--r--testing/web-platform/tests/html/browsers/offline/manifests/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/offline/manifests/contains.json14
-rw-r--r--testing/web-platform/tests/html/browsers/offline/resources/css/clock.css1
-rw-r--r--testing/web-platform/tests/html/browsers/offline/resources/css/offline.css5
-rw-r--r--testing/web-platform/tests/html/browsers/offline/resources/css/online.css5
-rw-r--r--testing/web-platform/tests/html/browsers/offline/resources/css/result.css11
-rw-r--r--testing/web-platform/tests/html/browsers/offline/resources/html/clock.html12
-rw-r--r--testing/web-platform/tests/html/browsers/offline/resources/js/clock.js3
-rw-r--r--testing/web-platform/tests/html/browsers/offline/resources/manifest/clock.manifest17
-rw-r--r--testing/web-platform/tests/html/browsers/offline/resources/manifest/section_empty.manifest10
-rw-r--r--testing/web-platform/tests/html/browsers/offline/resources/manifest/section_many.manifest19
-rw-r--r--testing/web-platform/tests/html/browsers/offline/resources/manifest/url_check.manifest17
-rw-r--r--testing/web-platform/tests/html/browsers/offline/section_network_offline-manual.html17
-rw-r--r--testing/web-platform/tests/html/browsers/offline/section_network_online-manual.html16
-rw-r--r--testing/web-platform/tests/html/browsers/offline/the-application-cache-selection-algorithm/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/origin/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-on-new-window.html25
-rw-r--r--testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html373
-rw-r--r--testing/web-platform/tests/html/browsers/origin/cross-origin-objects/frame.html39
-rw-r--r--testing/web-platform/tests/html/browsers/origin/cross-origin-objects/win-documentdomain.sub.html63
-rw-r--r--testing/web-platform/tests/html/browsers/origin/origin-of-data-document.html28
-rw-r--r--testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain.html25
-rw-r--r--testing/web-platform/tests/html/browsers/sandboxing/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/Document-defaultView.html38
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/Window-document.html25
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-01.html47
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-02.html62
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-03.html30
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/iterator.html11
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test1.html12
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test2.html6
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test3.html8
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/window_length.html51
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/callback.js1
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_beforeunload-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_beforeunload.html16
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_script_defer-1.html1
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_script_defer.html18
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_unload-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_unload.html16
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/creating_browsing_context_test_01.html38
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001-1.html2
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001-2.html16
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001.html3
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002-1.html8
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002-2.html16
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002.html3
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/browser-interface-elements/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/closing-browsing-contexts/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1-1.html20
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1-2.html2
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1.html10
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_2-1.html22
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_2.html10
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-1.html21
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-2.html4
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-3.html4
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3.html9
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-1.html21
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-2.html4
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-3.html4
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4.html9
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-1.html27
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-2.html2
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-manual.html10
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-1.html19
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-2.html1
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-3.html1
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-manual.html10
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/named-objects.html78
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/test.html7
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/window-null-names.html20
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/security-window/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/security-window/window-security.sub.html203
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/support/noopener-target.html8
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-locationbar-manual.html29
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-menubar-manual.html29
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-personalbar-manual.html29
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-scrollbars-manual.html29
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-statusbar-manual.html29
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-toolbar-manual.html29
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/window-aliases.html28
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/window-indexed-properties-strict.html43
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/window-indexed-properties.html35
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/window-named-properties.html77
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/window-open-noopener.html105
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/window-properties.html322
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/window-prototype-chain.html35
-rw-r--r--testing/web-platform/tests/html/browsers/windows/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/contains.json6
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-first-created.xhtml54
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/001-1.html8
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/001.html22
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/002-1.html8
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/002.html25
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/MANIFEST4
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-existing.html25
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html20
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-1.html20
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-2.html20
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-default-name.html26
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/existing.html11
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/message.html9
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent1.html5
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent2.html9
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/self1.html11
-rw-r--r--testing/web-platform/tests/html/browsers/windows/browsing-context-names/self2.html11
-rw-r--r--testing/web-platform/tests/html/browsers/windows/groupings-of-browsing-contexts/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/MANIFEST1
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/contains.json6
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html74
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/test.html7
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/testcase3.html14
-rw-r--r--testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top-001.html63
-rw-r--r--testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-close-manual.sub.html3
-rw-r--r--testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-manual.html10
-rw-r--r--testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-window-name.sub.html3
-rw-r--r--testing/web-platform/tests/html/browsers/windows/noreferrer-window-name.html85
-rw-r--r--testing/web-platform/tests/html/browsers/windows/noreferrer.html25
-rw-r--r--testing/web-platform/tests/html/browsers/windows/secondary-browsing-contexts/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/windows/security-nav/.gitkeep0
-rw-r--r--testing/web-platform/tests/html/browsers/windows/support-close.html1
-rw-r--r--testing/web-platform/tests/html/browsers/windows/support-named-null-opener.html8
-rw-r--r--testing/web-platform/tests/html/browsers/windows/support-nested-browsing-contexts.html12
-rw-r--r--testing/web-platform/tests/html/browsers/windows/support-opener-null.html4
-rw-r--r--testing/web-platform/tests/html/browsers/windows/support-post-to-opener.html8
-rw-r--r--testing/web-platform/tests/html/browsers/windows/support-window-name-echo.html1
-rw-r--r--testing/web-platform/tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.sub.html39
509 files changed, 10810 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/.gitkeep b/testing/web-platform/tests/html/browsers/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/aborting-a-document-load/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/aborting-a-document-load/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/aborting-a-document-load/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001-1.html
new file mode 100644
index 000000000..cadcf126f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001-1.html
@@ -0,0 +1,11 @@
+<!doctype html>
+001-1
+<script>
+addEventListener("pageshow",
+ function(e) {
+ parent.events.push(e);
+ if (parent.events.length == 2) {
+ parent.do_test();
+ }
+ }, false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001-2.html
new file mode 100644
index 000000000..6387bc89c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001-2.html
@@ -0,0 +1,5 @@
+<!doctype html>
+001-2
+<script>
+onload = function() {setTimeout(function() {history.go(-1)}, 500)}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001.html
new file mode 100644
index 000000000..26a66304a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/001.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<title>pageshow event from traversal</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="001-1.html"></iframe>
+<script>
+var t = async_test();
+var events = [];
+var iframe = document.getElementsByTagName("iframe")[0];
+
+onload = t.step_func(function() {
+ setTimeout(t.step_func(
+ function() {
+ assert_equals(iframe.contentDocument.readyState, "complete")
+ iframe.src = "001-2.html";
+ }), 500);
+ onload = null;
+})
+
+do_test = t.step_func(function() {
+ assert_equals(events.length, 2);
+ events.forEach(function(e, i) {
+ phase = i ? "after" : "before";
+ assert_equals(e.type, "pageshow", "type " + phase + " navigation");
+ assert_equals(e.persisted, i == 0 ? false : true, "persisted " + phase + " navigation");
+ t.done();
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/MANIFEST b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/MANIFEST
new file mode 100644
index 000000000..b3b6014f6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/MANIFEST
@@ -0,0 +1,16 @@
+support 001-1.html
+support 001-2.html
+001.html
+support browsing_context_name-1.html
+support browsing_context_name-2.html
+support browsing_context_name-3.html
+support browsing_context_name-4.html
+browsing_context_name_cross_origin_2.html
+browsing_context_name_cross_origin_3.html
+browsing_context_name_cross_origin.html
+browsing_context_name.html
+events.html
+hashchange_event.html
+popstate_event.html
+support unset_context_name-1.html
+unset_context_name.html
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/PopStateEvent.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/PopStateEvent.html
new file mode 100644
index 000000000..ace09e574
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/PopStateEvent.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Synthetic popstate events</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function () {
+ var e = document.createEvent('PopStateEvent');
+ var eProto = Object.getPrototypeOf(e);
+ assert_equals(eProto, PopStateEvent.prototype);
+}, 'document.createEvent');
+
+test(function () {
+ assert_false('initPopStateEvent' in PopStateEvent.prototype,
+ 'There should be no PopStateEvent#initPopStateEvent');
+}, 'initPopStateEvent');
+
+test(function () {
+ var state = history.state;
+ var data;
+ window.addEventListener('popstate', function (e) {
+ data = e.state;
+ });
+ window.dispatchEvent(new PopStateEvent('popstate', {
+ 'state': {testdata:true}
+ }));
+ assert_true(data.testdata,'state data was corrupted');
+ assert_equals(history.state, state, "history.state was NOT set by dispatching the event");
+}, 'Dispatching a synthetic PopStateEvent');
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-0.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-0.html
new file mode 100644
index 000000000..5cbab71a5
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-0.html
@@ -0,0 +1,35 @@
+<iframe id="test"></iframe>
+<script>
+var opener = window.opener;
+var t = opener.t;
+var f = document.getElementById("test");
+var l = opener.document.getElementById("step_log");
+
+log = function(t) {l.textContent += ("\n" + t)}
+var navigated = false;
+var steps = [
+ () => f.src = "browsing_context_name-1.html",
+ () => {
+ navigated = true;
+ opener.assert_equals(f.contentWindow.name, "test", "Initial load");
+ f.src = "browsing_context_name-2.html"
+ },
+ () => {
+ opener.assert_equals(f.contentWindow.name, "test1");
+ opener.assert_equals(history.length, 2);
+ history.back()
+ },
+ () => {
+ opener.assert_equals(f.contentWindow.name, "test1", "After navigation");
+ t.done();
+ }
+].map((x, i) => t.step_func(() => {log("Step " + (i+1)); x()}));
+
+next = () => steps.shift()();
+
+onload = () => {
+ log("page load");
+ f.onload = () => {log("iframe onload"); next()};
+ setTimeout(next, 0);
+};
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-1.html
new file mode 100644
index 000000000..85748a2eb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-1.html
@@ -0,0 +1,6 @@
+document 1
+<script>
+if (!parent.navigated) {
+ window.name = "test";
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-2.html
new file mode 100644
index 000000000..b0c869046
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-2.html
@@ -0,0 +1,4 @@
+document 2
+<script>
+window.name = "test1";
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-3.html
new file mode 100644
index 000000000..e0c239744
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-3.html
@@ -0,0 +1,6 @@
+document 3
+<script>
+if (!parent.navigated) {
+ window.name = "test3";
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-4.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-4.html
new file mode 100644
index 000000000..5d2dfa6bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name-4.html
@@ -0,0 +1,6 @@
+document 4
+<script>
+if (!parent.navigated) {
+ window.name = "test4";
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name.html
new file mode 100644
index 000000000..60a8acb09
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<title>Retaining window.name on history traversal</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<pre id="step_log"></pre>
+
+<script>
+var t = async_test();
+t.step(() => {
+ win = window.open("browsing_context_name-0.html");
+ t.add_cleanup(() => win.close());
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin.html
new file mode 100644
index 000000000..b04eee66e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin.html
@@ -0,0 +1,41 @@
+<!doctype html>
+<title>Restoring window.name on cross-origin history traversal</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<pre id="step_log"></pre>
+<iframe id="test"></iframe>
+<script>
+
+var t = async_test(undefined, {timeout:10000});
+var f = document.getElementById("test");
+var l = document.getElementById("step_log");
+var navigated = false;
+
+log = function(t) {l.textContent += ("\n" + t)}
+
+var steps = [
+ function() {f.src = "browsing_context_name-1.html"},
+ function() {
+ var navigated = true;
+ assert_equals(f.contentWindow.name, "test", "Initial load");
+ setTimeout(next, 0);
+ },
+ function() {f.src = f.src.replace("http://", "http://www.").replace("browsing_context_name-1", "browsing_context_name-2");},
+ function() {
+ setTimeout(next, 0);
+ },
+ function() {history.back(); setTimeout(next, 500)},
+ function() {
+ assert_equals(f.contentWindow.name, "test", "After navigation");
+ t.done();
+ }
+].map(function(x) {return t.step_func(function() {log("Step " + step); x()})});
+
+var step = 0;
+next = t.step_func(function() {steps[step++]()});
+
+f.onload=next;
+
+onload = setTimeout(next, 0);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin_2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin_2.html
new file mode 100644
index 000000000..1a57e838c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin_2.html
@@ -0,0 +1,47 @@
+<!doctype html>
+<title>Restoring window.name on cross-origin history traversal</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<pre id="step_log"></pre>
+<iframe id="test"></iframe>
+<script>
+
+var t = async_test(undefined, {timeout:10000});
+var f = document.getElementById("test");
+var l = document.getElementById("step_log");
+var navigated = false;
+
+log = function(t) {l.textContent += ("\n" + t)}
+
+var steps = [
+ function() {f.src = "browsing_context_name-1.html"},
+ function() {
+ var navigated = true;
+ assert_equals(f.contentWindow.name, "test", "Initial load");
+ setTimeout(next, 0);
+ },
+ function() {f.src = "browsing_context_name-3.html"},
+ function() {
+ var navigated = true;
+ assert_equals(f.contentWindow.name, "test3", "Initial load");
+ setTimeout(next, 0);
+ },
+ function() {f.src = f.src.replace("http://", "http://www.").replace("browsing_context_name-3", "browsing_context_name-2");},
+ function() {
+ setTimeout(next, 0);
+ },
+ function() {history.go(-2); setTimeout(next, 500)},
+ function() {
+ assert_equals(f.contentWindow.name, "test3", "After navigation");
+ t.done();
+ }
+].map(function(x) {return t.step_func(function() {log("Step " + step); x()})});
+
+var step = 0;
+next = t.step_func(function() {steps[step++]()});
+
+f.onload=next;
+
+onload = setTimeout(next, 0);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin_3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin_3.html
new file mode 100644
index 000000000..0f0702732
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin_3.html
@@ -0,0 +1,47 @@
+<!doctype html>
+<title>Restoring window.name on cross-origin history traversal</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<pre id="step_log"></pre>
+<iframe id="test"></iframe>
+<script>
+var t = async_test(undefined, {timeout:10000});
+var f = document.getElementById("test");
+var l = document.getElementById("step_log");
+var navigated = false;
+
+log = function(t) {l.textContent += ("\n" + t)}
+
+var steps = [
+ function() {f.src = "browsing_context_name-1.html"},
+ function() {
+ var navigated = true;
+ assert_equals(f.contentWindow.name, "test", "Initial load");
+ setTimeout(next, 0);
+ },
+ function() {f.src = "browsing_context_name-3.html"},
+ function() {
+ var navigated = true;
+ assert_equals(f.contentWindow.name, "test3", "Initial load");
+ setTimeout(next, 0);
+ },
+ function() {f.src = f.src.replace("http://", "http://www.").replace("browsing_context_name-1", "browsing_context_name-2");},
+ function() {f.src = f.src.replace("http://www.", "http://").replace("browsing_context_name-2", "browsing_context_name-4");},
+ function() {
+ assert_equals(f.contentWindow.name, "test3", "After navigation");
+ history.go(-3); setTimeout(next, 500)
+ },
+ function() {
+ assert_equals(f.contentWindow.name, "test3", "After navigation");
+ t.done();
+ }
+].map(function(x) {return t.step_func(function() {log("Step " + step + " " + f.contentWindow.location); x()})});
+
+var step = 0;
+next = t.step_func(function() {steps[step++]()});
+
+f.onload=next;
+
+onload = setTimeout(next, 0);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/contains.json b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/contains.json
new file mode 100644
index 000000000..90b346668
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/contains.json
@@ -0,0 +1,6 @@
+[
+ {
+ "id": "event-definitions-0",
+ "original_id": "event-definitions-0"
+ }
+] \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/events.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/events.html
new file mode 100644
index 000000000..d5ff83fac
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/events.html
@@ -0,0 +1,151 @@
+<!doctype html>
+<title> PageTransitionEffect Event </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ var e = new PageTransitionEvent("pageshow", {persisted:false, cancelable:false, bubbles:false});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pageshow");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+ assert_false(e.persisted, "persisted");
+}, "Constructing pageshow event");
+
+test(function() {
+ var e = new PageTransitionEvent("pagehide", {persisted:false, cancelable:false, bubbles:false});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pagehide");
+ assert_false(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pagehide event");
+
+test(function() {
+ var e = new PageTransitionEvent("pageshow", {persisted:true});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pageshow");
+ assert_true(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pageshow event, persisted true");
+
+test(function() {
+ var e = new PageTransitionEvent("pagehide", {persisted:true});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pagehide");
+ assert_true(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pagehide event, persisted true");
+
+test(function() {
+ var e = new PageTransitionEvent("pageshow", {});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pageshow");
+ assert_false(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pageshow event, empty options");
+
+test(function() {
+ var e = new PageTransitionEvent("pagehide", {});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pagehide");
+ assert_false(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pagehide event, empty options");
+
+test(function() {
+ var e = new PageTransitionEvent("pageshow");
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pageshow");
+ assert_false(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pageshow event, missing options");
+
+test(function() {
+ var e = new PageTransitionEvent("pagehide");
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pagehide");
+ assert_false(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pagehide event, missing options");
+
+test(function() {
+ var e = new PageTransitionEvent("pageshow", {persisted:null});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pageshow");
+ assert_false(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pageshow event, persisted:null");
+
+test(function() {
+ var e = new PageTransitionEvent("pagehide", {persisted:null});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pagehide");
+ assert_false(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pagehide event, persisted:null");
+
+test(function() {
+ var e = new PageTransitionEvent("pageshow", {persisted:undefined});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pageshow");
+ assert_false(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pageshow event, persisted:undefined");
+
+test(function() {
+ var e = new PageTransitionEvent("pagehide", {persisted:undefined});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pagehide");
+ assert_false(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pagehide event, persisted:undefined");
+
+test(function() {
+ var e = new PageTransitionEvent("pageshow", {bubbles:true});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pageshow");
+ assert_false(e.persisted, "persisted");
+ assert_true(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pageshow event, bubbles:true");
+
+test(function() {
+ var e = new PageTransitionEvent("pagehide", {bubbles:true});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pagehide");
+ assert_false(e.persisted, "persisted");
+ assert_true(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+}, "Constructing pagehide event, bubbles:true");
+
+test(function() {
+ var e = new PageTransitionEvent("pageshow", {cancelable:true});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pageshow");
+ assert_false(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_true(e.cancelable, "cancelable");
+}, "Constructing pageshow event, cancelable:true");
+
+test(function() {
+ var e = new PageTransitionEvent("pagehide", {cancelable:true});
+ assert_true(e instanceof PageTransitionEvent);
+ assert_equals(e.type, "pagehide");
+ assert_false(e.persisted, "persisted");
+ assert_false(e.bubbles, "bubbles");
+ assert_true(e.cancelable, "cancelable");
+}, "Constructing pagehide event, cancelable:true");
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/hashchange_event.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/hashchange_event.html
new file mode 100644
index 000000000..4b701ad04
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/hashchange_event.html
@@ -0,0 +1,43 @@
+<!doctype html>
+<title>Queue a task to fire hashchange event</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+t = async_test();
+window.onload = t.step_func(function () {
+ if (location.href.toString().indexOf("#") > -1) {
+ location.href = location.href.replace(/#.*$/,'');
+ return;
+ }
+ var root = location.href;
+ var oldURLs = [];
+ var newURLs = [];
+
+ var timer = null;
+
+ location.hash = 'foo';
+ window.onhashchange = t.step_func(function (e) {
+ oldURLs.push(e.oldURL);
+ newURLs.push(e.newURL);
+ if (newURLs.length === 2) {
+ check_result();
+ } else if (timer === null) {
+ timer = setTimeout(function() {check_result()}, 500);
+ }
+ })
+
+ check_result = t.step_func(function() {
+ clearTimeout(timer);
+ try {
+ assert_array_equals([root, root+"#foo"], oldURLs, "e.newURL");
+ assert_array_equals([root+"#foo", root+"#bar"], newURLs, "e.newURL");
+ t.done();
+ } finally {
+ location.hash = "";
+ }
+ });
+
+ location.hash = 'bar';
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/blank1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/blank1.html
new file mode 100644
index 000000000..6b4df1ef2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/blank1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<style>
+body {
+ height: 2000px;
+ width: 2000px;
+}
+</style>
+<body> Blank 1 </body> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/blank2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/blank2.html
new file mode 100644
index 000000000..def213966
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/blank2.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<style>
+body {
+ height: 2000px;
+ width: 2000px;
+}
+</style>
+<body> Blank 2 </body>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/page-with-fragment.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/page-with-fragment.html
new file mode 100644
index 000000000..11737661d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/page-with-fragment.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<style>
+body {
+ height: 2000px;
+ width: 2000px;
+}
+#fragment {
+ position: absolute;
+ top: 800px;
+ background-color: #faa;
+ display: block;
+ height: 100px;
+ width: 100px;
+}
+
+</style>
+<body>
+Page with fragment
+ <a id="fragment" name="fragment" class='box'></a>
+</body> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/post_name_on_load.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/post_name_on_load.html
new file mode 100644
index 000000000..1e9b10d1e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resources/post_name_on_load.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<script>
+addEventListener('load', _ => {
+ let params = new URLSearchParams(window.location.search);
+ window.opener.postMessage(params.get('name'), '*');
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resume-timer-on-history-back.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resume-timer-on-history-back.html
new file mode 100644
index 000000000..fb7365bd3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/resume-timer-on-history-back.html
@@ -0,0 +1,145 @@
+<!doctype html>
+<title>Verify history.back() on a persisted page resumes timers</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script type="text/javascript">
+
+function make_post_back_url(name) {
+ return new URL('resources/post_name_on_load.html?name=' + name,
+ window.location).href;
+}
+
+function wait_for_message(name) {
+ return new Promise(resolve => {
+ addEventListener('message', function onMsg(evt) {
+ if (evt.data !== name) {
+ return;
+ }
+ removeEventListener('message', onMsg);
+ resolve();
+ });
+ });
+}
+
+function with_window_by_name(name) {
+ let win = window.open(make_post_back_url(name));
+ return wait_for_message(name).then(_ => {
+ return win;
+ });
+}
+
+function with_nested_frame(win, url) {
+ return new Promise(resolve => {
+ let frame = win.document.createElement('iframe');
+ frame.addEventListener('load', function onLoad(evt) {
+ removeEventListener('load', onLoad);
+ resolve(frame);
+ });
+ frame.src = url;
+ win.document.body.appendChild(frame);
+ });
+}
+
+function delay(win, delay) {
+ return new Promise(resolve => {
+ win.setTimeout(_ => {
+ resolve(win);
+ }, delay);
+ });
+}
+
+function navigate_by_name(win, name) {
+ win.location = make_post_back_url(name);
+ return wait_for_message(name).then(_ => {
+ return win;
+ });
+}
+
+function go_back(win) {
+ return new Promise(resolve => {
+ win.onpagehide = e => resolve(win);
+ win.history.back();
+ });
+}
+
+let DELAY = 500;
+
+promise_test(t => {
+ // Create a new window so we can navigate it later.
+ return with_window_by_name('foo').then(win => {
+ // Schedule a timer within the new window. Our intent is
+ // to navigate the window before the timer fires.
+ let delayFired = false;
+ let innerDelay = delay(win, DELAY);
+ innerDelay.then(_ => {
+ delayFired = true;
+ });
+
+ return navigate_by_name(win, 'bar').then(_ => {
+ // Since the window has navigated the timer should not
+ // fire. We set a timer on our current test window
+ // to verify the other timer is not received.
+ assert_false(delayFired);
+ return delay(window, DELAY * 2);
+ }).then(_ => {
+ // The navigated window's timer should not have fired.
+ assert_false(delayFired);
+ // Now go back to the document that set the timer.
+ return go_back(win);
+ }).then(_ => {
+ // We wait for one of two conditions here. For browsers
+ // with a bfcache the original suspended timer will fire.
+ // Alternatively, if the browser reloads the page the original
+ // message will be sent again. Wait for either of these
+ // two events.
+ return Promise.race([wait_for_message('foo'), innerDelay]);
+ }).then(_ => {
+ win.close();
+ });
+ });
+}, 'history.back() handles top level page timer correctly');
+
+promise_test(t => {
+ let win;
+ // Create a new window so we can navigate it later.
+ return with_window_by_name('foo').then(w => {
+ win = w;
+
+ // Create a nested frame so we check if navigation and history.back()
+ // properly handle child window state.
+ return with_nested_frame(win, 'about:blank');
+
+ }).then(frame => {
+ // Schedule a timer within the nested frame contained by the new window.
+ // Our intent is to navigate the window before the timer fires.
+ let delayFired = false;
+ let innerDelay = delay(frame.contentWindow, DELAY);
+ innerDelay.then(_ => {
+ delayFired = true;
+ });
+
+ return navigate_by_name(win, 'bar').then(_ => {
+ // Since the window has navigated the timer should not
+ // fire. We set a timer on our current test window
+ // to verify the other timer is not received.
+ assert_false(delayFired);
+ return delay(window, DELAY * 2);
+ }).then(_ => {
+ // The navigated window's timer should not have fired.
+ assert_false(delayFired);
+ // Now go back to the document containing the frame that set the timer.
+ return go_back(win);
+ }).then(_ => {
+ // We wait for one of two conditions here. For browsers
+ // with a bfcache the original suspended timer will fire.
+ // Alternatively, if the browser reloads the page the original
+ // message will be sent again. Wait for either of these
+ // two events.
+ return Promise.race([wait_for_message('foo'), innerDelay]);
+ }).then(_ => {
+ win.close();
+ });
+ });
+}, 'history.back() handles nested iframe timer correctly');
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-basic.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-basic.html
new file mode 100644
index 000000000..e47cd9c38
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-basic.html
@@ -0,0 +1,34 @@
+<!doctype html>
+<title>Verify existence and basic read/write function of history.scrollRestoration</title>
+
+<style>
+ body {
+ height: 2000px;
+ width: 2000px;
+ }
+</style>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script type="text/javascript">
+ 'use strict';
+
+ test(function() {
+ assert_equals(history.scrollRestoration, 'auto');
+ }, 'Default value is "auto"');
+
+ test(function() {
+ history.scrollRestoration = 'manual';
+ assert_equals(history.scrollRestoration, 'manual', 'should be able to set "manual"');
+ history.scrollRestoration = 'auto';
+ assert_equals(history.scrollRestoration, 'auto', 'should be able to set "auto"');
+ }, 'It is writable');
+
+ test(function() {
+ history.scrollRestoration = 'auto';
+ for (var v of [3.1415, {}, 'bogus']) {
+ history.scrollRestoration = v;
+ assert_equals(history.scrollRestoration, 'auto', `setting to invalid value (${v}) should be ignored`);
+ }
+ }, 'Invalid values are ignored');
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html
new file mode 100644
index 000000000..e3da59e39
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<meta name=timeout content=long>
+<title>Precedence of scroll restoration mode over fragment scrolling in cross-origin history traversal</title>
+<style>
+ iframe {
+ height: 300px;
+ width: 300px;
+ }
+</style>
+
+<body>
+ <iframe></iframe>
+</body>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script type="text/javascript">
+ 'use strict';
+
+ // The test does the following navigation steps for iframe
+ // 1. load page-with-fragment.html#fragment
+ // 2. load blank1
+ // 3. go back to page-with-fragment.html
+ async_test(function(t) {
+ var iframe = document.querySelector('iframe');
+ var baseURL = location.href.substring(0, location.href.lastIndexOf('/'));
+
+ var steps = [
+ function() {
+ iframe.src = 'resources/page-with-fragment.html#fragment';
+ }, function() {
+ assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/page-with-fragment.html#fragment', 'should be on page-with-fragment page');
+ // wait one animation frame to ensure layout is run and fragment scrolling is complete
+ iframe.contentWindow.requestAnimationFrame(function() {
+ assert_equals(iframe.contentWindow.scrollY, 800, 'should scroll to fragment');
+
+ iframe.contentWindow.history.scrollRestoration = 'manual';
+ assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual');
+ setTimeout(next, 0);
+ });
+ }, function() {
+ // navigate to a new page from a different origin
+ iframe.src = iframe.src.replace("http://", "http://www.").replace("page-with-fragment.html#fragment", "blank1.html");
+ }, function() {
+ // going back causes the iframe to traverse back
+ history.back();
+ }, function() {
+ // coming back from history, scrollRestoration should be set to manual and respected
+ assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/page-with-fragment.html#fragment', 'should be back on page-with-fragment page');
+ iframe.contentWindow.requestAnimationFrame(function() {
+ assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual', 'navigating back should retain scrollRestoration value');
+ assert_equals(iframe.contentWindow.scrollX, 0, 'should not scroll to fragment');
+ assert_equals(iframe.contentWindow.scrollY, 0, 'should not scroll to fragment');
+ t.done();
+ });
+ }
+ ];
+
+ var stepCount = 0;
+ var next = t.step_func(function() {
+ steps[stepCount++]();
+ });
+
+ iframe.onload = next;
+ next();
+ }, 'Manual scroll restoration should take precedent over scrolling to fragment in cross origin navigation');
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-samedoc.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-samedoc.html
new file mode 100644
index 000000000..d837b8f63
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-samedoc.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<style>
+ body {
+ height: 2000px;
+ width: 2000px;
+ }
+
+ #fragment {
+ position: absolute;
+ top: 800px;
+ background-color: #faa;
+ display: block;
+ height: 100px;
+ width: 100px;
+ }
+</style>
+
+<body>
+ <a id="fragment" name="fragment" class='box'></a>
+</body>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script type="text/javascript">
+ 'use strict';
+
+ async_test(function(t) {
+ history.scrollRestoration = 'manual';
+ assert_equals(history.scrollRestoration, 'manual');
+
+ location.hash = '#fragment';
+ assert_equals(window.scrollY, 800, 'new navigations should scroll to fragment');
+
+ // create a new entry and reset the scroll before verification
+ history.pushState(null, null, '#done');
+ window.scrollTo(0, 0);
+ assert_equals(window.scrollY, 0, 'should reset scroll before verification');
+
+ setTimeout(function() {
+ // setup verification
+ window.addEventListener('hashchange', t.step_func(function() {
+ assert_equals(location.hash, '#fragment');
+ assert_equals(history.scrollRestoration, 'manual');
+ // navigating back should give precedent to history restoration which is 'manual'
+ assert_equals(window.scrollX, 0, 'should not scroll to fragment');
+ assert_equals(window.scrollY, 0, 'should not scroll to fragment');
+ t.done();
+ }));
+ // kick off verification
+ window.history.back();
+ }, 0);
+
+ }, 'Manual scroll restoration should take precedent over scrolling to fragment in cross doc navigation');
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-cross-origin.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-cross-origin.html
new file mode 100644
index 000000000..87a337b2d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-cross-origin.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<meta name=timeout content=long>
+<title>Correct behaviour of scroll restoration mode is cross origin history traversal</title>
+
+<style>
+ iframe {
+ height: 300px;
+ width: 300px;
+ }
+</style>
+
+<body>
+ <iframe></iframe>
+</body>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script type="text/javascript">
+ 'use strict';
+
+ // The test does the following navigation steps for iframe
+ // 1. load blank1
+ // 2. load blank2
+ // 3. go back to blank1
+ async_test(function(t) {
+ var iframe = document.querySelector('iframe');
+ var baseURL = location.href.substring(0, location.href.lastIndexOf('/'));
+
+ var steps = [
+ function() {
+ iframe.src = 'resources/blank1.html';
+ },
+ function() {
+ assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/blank1.html', 'should be on first blank page');
+ iframe.contentWindow.history.scrollRestoration = 'manual';
+ assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual');
+ iframe.contentWindow.scrollTo(500, 500);
+ assert_equals(iframe.contentWindow.scrollX, 500, 'scripted scrolling should take effect');
+ assert_equals(iframe.contentWindow.scrollY, 500, 'scripted scrolling should take effect');
+ setTimeout(next, 0);
+ },
+ function() {
+ // navigate to new page
+ iframe.src = 'resources/blank2.html';
+ },
+ function() {
+ assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/blank2.html', 'should be on second blank page');
+ assert_equals(iframe.contentWindow.history.scrollRestoration, 'auto', 'new page loads should set scrollRestoration to "auto"');
+ setTimeout(next, 0);
+ }, function() {
+ iframe.contentWindow.history.back();
+ }, function() {
+ // coming back scrollRestoration should be restored to 'manual' and respected
+ assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/blank1.html', 'should be back on first blank page');
+ assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual', 'navigating back should retain scrollRestoration value');
+ assert_equals(iframe.contentWindow.scrollX, 0, 'horizontal scroll offset should not be restored');
+ assert_equals(iframe.contentWindow.scrollY, 0, 'vertical scroll offset should not be restored');
+ t.done();
+ }
+ ];
+
+ var stepCount = 0;
+ var next = t.step_func(function() {
+ steps[stepCount++]();
+ });
+
+ iframe.onload = next;
+ next();
+ }, 'Navigating to new page should reset to "auto" and navigating back should restore and respect scroll restoration mode');
+
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-samedoc.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-samedoc.html
new file mode 100644
index 000000000..46d40eedc
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-samedoc.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<title>Correct behaviour of scroll restoration mode in same document history traversals</title>
+
+<style>
+ body {
+ height: 10000px;
+ width: 10000px;
+ }
+</style>
+
+<body></body>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script type="text/javascript">
+ 'use strict';
+
+ async_test(function(t) {
+ history.scrollRestoration = 'auto';
+ window.scrollTo(0, 0);
+
+ // create history entries and then verify the impact of scrollRestoration
+ // when they are popped
+ var entries = {
+ /* For scroll restoration mode 'auto', the spec does not require scroll
+ position to be restored at any particular value. */
+ '#1': {type: 'push', expectedScroll: null, scrollRestoration: 'auto'},
+ '#2': {type: 'replace', expectedScroll: null, scrollRestoration: 'auto'},
+ /* For scroll restoration mode 'manual', the spec requires scroll position
+ not to be restored. So we expect [555,555] which is the latest position
+ before navigation. */
+ '#3': {type: 'push', expectedScroll: [555, 555], scrollRestoration: 'manual'},
+ '#4': {type: 'replace', expectedScroll: [555, 555], scrollRestoration: 'manual'}
+ };
+
+ // setup entries
+ for (var key in entries) {
+ var entry = entries[key],
+ beforeValue = history.scrollRestoration,
+ newValue = entry.scrollRestoration;
+
+ var args = [{key: key}, '', key];
+ if (entry.type == 'push') {
+ history.pushState.apply(history, args);
+ } else {
+ history.pushState(null, '', key);
+ history.replaceState.apply(history, args);
+ }
+ assert_equals(history.scrollRestoration, beforeValue, `history.scrollRestoration value is retained after pushing new state`);
+ history.scrollRestoration = newValue;
+ assert_equals(history.scrollRestoration, newValue, `Setting scrollRestoration to ${newValue} works as expected`);
+ window.scrollBy(50, 100);
+ }
+
+ // setup verification
+ window.addEventListener('hashchange', t.step_func(function() {
+ var key = location.hash,
+ entry = entries[key];
+
+ if (key === '') {
+ t.done();
+ return;
+ }
+ assert_equals(history.state.key, key, `state should have key: ${key}`);
+ assert_equals(history.scrollRestoration, entry.scrollRestoration, 'scrollRestoration is updated correctly');
+ if (entry.expectedScroll) {
+ assert_equals(window.scrollX, entry.expectedScroll[0], `scrollX is correct for ${key}`);
+ assert_equals(window.scrollY, entry.expectedScroll[1], `scrollY is correct for ${key}`);
+ }
+
+ window.history.back();
+ }));
+
+ // reset the scroll and kick off the verification
+ setTimeout(function() {
+ history.pushState(null, null, '#done');
+ window.scrollTo(555, 555);
+ window.history.back();
+ }, 0);
+
+ }, 'history.{push,replace}State retain scroll restoration mode and navigation in the same document respects it');
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/popstate_event.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/popstate_event.html
new file mode 100644
index 000000000..7630b9918
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/popstate_event.html
@@ -0,0 +1,40 @@
+<!doctype html>
+<title>Queue a task to fire popstate event</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+t = async_test();
+window.onload = t.step_func(function () {
+ var states = [];
+
+ var timer = null;
+
+ history.pushState("a", "State a", "/a");
+ history.pushState("b", "State b", "/b");
+
+ history.back();
+ window.onpopstate = t.step_func(function (e) {
+ states.push(e.state);
+
+ if (states.length === 2) {
+ check_result();
+ } else if (timer === null) {
+ timer = setTimeout(function() {check_result()}, 500);
+ }
+ })
+
+ check_result = t.step_func(function() {
+ clearTimeout(timer);
+ try {
+ assert_array_equals(states, ["a", null]);
+ t.done();
+ } finally {
+ location.hash = "";
+ }
+ });
+
+ setTimeout(function() {history.back()}, 0);
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name-1.html
new file mode 100644
index 000000000..d3d67d0f8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<title>window.name after navigating to a different origin</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+test(function() {assert_equals(window.name, "")})
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name.html
new file mode 100644
index 000000000..6814ed50e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<!-- test must be run in a top level browsing context -->
+<title>window.name after navigating to a different origin</title>
+<script>
+window.name = "test_window";
+location.href = location.href.replace("http://", "http://www.").replace("unset_context_name", "unset_context_name-1");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-1.html
new file mode 100644
index 000000000..df8d884e8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+001-1
+<script>
+addEventListener("unload", function() {
+ location = location.href.replace("http://", "http://www.").replace(/\d{3}-\d\.html/, "001-3.html");
+}, false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-2.html
new file mode 100644
index 000000000..1cffc59b2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-2.html
@@ -0,0 +1,5 @@
+<!doctype html>
+001-2
+<script>
+parent.postMessage("001-2", "*");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-3.html
new file mode 100644
index 000000000..5f1310e07
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-3.html
@@ -0,0 +1,5 @@
+<!doctype html>
+001-3.html
+<script>
+parent.postMessage("001-3", "*");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001.html
new file mode 100644
index 000000000..7d99f6beb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<title>Cross-origin navigation started from unload handler</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="001-1.html"></iframe>
+<script>
+var t = async_test();
+onload = t.step_func(function() {
+ var iframe = document.getElementsByTagName("iframe")[0];
+ var new_src = iframe.src.replace(/\d{3}-\d\.html/, "001-2.html");
+ iframe.src = new_src;
+});
+
+onmessage = t.step_func(function(e) {
+ assert_equals(e.data, "001-2");
+ t.done();
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-1.html
new file mode 100644
index 000000000..716e182ad
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-1.html
@@ -0,0 +1,5 @@
+<!doctype html>
+002-1
+<script>
+parent.postMessage("002-1", "*");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-2.html
new file mode 100644
index 000000000..a29a6bbcd
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-2.html
@@ -0,0 +1,5 @@
+<!doctype html>
+002-2
+<script>
+parent.postMessage("002-2", "*");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002.html
new file mode 100644
index 000000000..0efc7016f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<title>Multiple simultaneous navigations</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="about:blank"></iframe>
+<script>
+var t = async_test();
+onload = t.step_func(function() {
+ var iframe = document.getElementsByTagName("iframe")[0];
+
+ setTimeout(t.step_func(function() {
+ iframe.src = "002-1.html?pipe=trickle(d1)";
+ setTimeout(t.step_func(function(){iframe.src = "002-2.html"}), 500);
+ }), 100);
+});
+
+onmessage = t.step_func(function(e) {
+ assert_equals(e.data, "002-2");
+ t.done();
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-1.html
new file mode 100644
index 000000000..4d2229eb5
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<script>
+onload = function() {
+ parent.postMessage("003-1", "*");
+ setTimeout(function() {location = "003-2.html";}, 100);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-2.html
new file mode 100644
index 000000000..827a06947
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-2.html
@@ -0,0 +1,9 @@
+<!doctype html>
+003-2
+<script>
+onload = function() {
+ parent.postMessage("003-2", "*")
+ setTimeout(function() {history.go(-1)})
+}
+onunload = function() {location = "003-3.html"}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-3.html
new file mode 100644
index 000000000..8b26c896f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-3.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+parent.postMessage("003-3", "*");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003.html
new file mode 100644
index 000000000..f43715096
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<title>Navigation from unload whilst traversing history</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="003-1.html"></iframe>
+<script>
+var t = async_test();
+
+var pages = [];
+var iframe = document.getElementsByTagName("iframe")[0];
+
+
+onmessage = t.step_func(function(e) {
+ pages.push(e.data);
+ if(pages.length == 3) {
+ assert_array_equals(pages, ["003-1", "003-2", "003-1"]);
+ t.done();
+ iframe.parentNode.removeChild(iframe);
+ }
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-1.html
new file mode 100644
index 000000000..02f916fd9
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<script>
+onload = function() {
+ parent.postMessage("004-1", "*");
+ setTimeout(function() {location = location.href.replace("http://", "http://www.").replace("004-1.html", "004-2.html");}, 100);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-2.html
new file mode 100644
index 000000000..f2ef83ee1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-2.html
@@ -0,0 +1,9 @@
+<!doctype html>
+003-2
+<script>
+onload = function() {
+ parent.postMessage("004-2", "*")
+ setTimeout(function() {history.go(-1)})
+}
+onunload = function() {location = "004-3.html"}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-3.html
new file mode 100644
index 000000000..c98711ae9
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-3.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+parent.postMessage("004-3", "*");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004.html
new file mode 100644
index 000000000..dddde4918
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<title>Navigation from unload whilst traversing cross-origin history</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="004-1.html"></iframe>
+<script>
+var t = async_test();
+
+var pages = [];
+var iframe = document.getElementsByTagName("iframe")[0];
+
+
+onmessage = t.step_func(function(e) {
+ pages.push(e.data);
+ if(pages.length == 3) {
+ assert_array_equals(pages, ["004-1", "004-2", "004-1"]);
+ t.done();
+ iframe.parentNode.removeChild(iframe);
+ }
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/005.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/005.html
new file mode 100644
index 000000000..4a044bb25
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/005.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>Link with onclick navigation and href navigation </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe id="test" name="test"></iframe>
+<a target="test" onclick="document.getElementById('test').contentWindow.location='click.html'" href="href.html">Test</a>
+<script>
+var t = async_test();
+t.step(function() {document.links[0].click()});
+onmessage = t.step_func(
+ function(e) {
+ assert_equals(e.data, "href");
+ t.done();
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/006.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/006.html
new file mode 100644
index 000000000..1e7aa2020
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/006.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>Link with onclick form submit and href navigation </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe name="test"></iframe>
+<form target="test" action="click.html"></form>
+<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a>
+<script>
+var t = async_test();
+t.step(function() {document.links[0].click()});
+onmessage = t.step_func(
+ function(e) {
+ assert_equals(e.data, "href");
+ t.done();
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/007.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/007.html
new file mode 100644
index 000000000..d4bcfc290
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/007.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>Link with onclick javascript url and href navigation </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe id="test" name="test"></iframe>
+<a target="test" onclick="document.getElementById('test').contentWindow.location = 'javascript:\'abc<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>\'';" href="href.html">Test</a>
+<script>
+var t = async_test();
+t.step(function() {document.getElementsByTagName("a")[0].click()});
+onmessage = t.step_func(
+ function(e) {
+ assert_equals(e.data, "href");
+ t.done();
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/008.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/008.html
new file mode 100644
index 000000000..7d1495a08
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/008.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>Link with onclick form submit to javascript url and href navigation </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe id="test" name="test"></iframe>
+<form target="test" action="javascript:'<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>'"></form>
+<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a>
+<script>
+var t = async_test();
+t.step(function() {document.getElementsByTagName("a")[0].click()});
+onmessage = t.step_func(
+ function(e) {
+ assert_equals(e.data, "href");
+ t.done();
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/009.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/009.html
new file mode 100644
index 000000000..0fcd1d37f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/009.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<title>Link with onclick form submit to javascript url with document.write and href navigation </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe id="test" name="test"></iframe>
+<form target="test" action="javascript:(function() {document.write('<script>parent.postMessage(&quot;write&quot;, &quot;*&quot;)</script>'); return '<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>'})()"></form>
+<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a>
+<script>
+var t = async_test();
+var events = [];
+t.step(function() {
+ document.getElementsByTagName("a")[0].click()});
+onmessage = t.step_func(
+ function(e) {
+ events.push(e.data);
+ if (events.length === 2) {
+ assert_array_equals(events, ["write", "href"]);
+ t.done();
+ }
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/010.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/010.html
new file mode 100644
index 000000000..3917cd16e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/010.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>Link with onclick form submit to javascript url with delayed document.write and href navigation </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe id="test" name="test"></iframe>
+<form target="test" action="javascript:(function() {var x = new XMLHttpRequest(); x.open('GET', 'blank.html?pipe=trickle(d2)', false); x.send(); document.write('<script>parent.postMessage(&quot;write&quot;, &quot;*&quot;)</script>'); return '<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>'})()"></form>
+<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a>
+<script>
+var t = async_test(undefined, {timeout:4000});
+t.step(function() {document.getElementsByTagName("a")[0].click()});
+onmessage = t.step_func(
+ function(e) {
+ assert_equals(e.data, "href");
+ t.done();
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/011.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/011.html
new file mode 100644
index 000000000..fe6b8dbc3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/011.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<title>Link with onclick navigation to javascript url with document.write and href navigation </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe id="test" name="test"></iframe>
+<a target="test" onclick="javascript:(function() {document.write('<script>parent.postMessage(&quot;write&quot;, &quot;*&quot;)</script>'); return '<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>'})()" href="href.html">Test</a>
+<script>
+var t = async_test();
+var events = [];
+t.step(function() {
+ document.getElementsByTagName("a")[0].click()});
+onmessage = t.step_func(
+ function(e) {
+ events.push(e.data);
+ if (events.length === 2) {
+ assert_array_equals(events, ["write", "href"]);
+ t.done();
+ }
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/012.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/012.html
new file mode 100644
index 000000000..be8f2feba
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/012.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<title>Link with onclick navigation to javascript url with delayed document.write and href navigation </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe id="test" name="test"></iframe>
+<!-- XXX: What is this test trying to do? It's navigating the subframe, but
+ doing a write() to _this_ document, and the "javascript:" in there is
+ completely a red herring: it's a label, not a protocol. There is no
+ javascript url involved here, unlike what the title claims! -->
+<a target="test" onclick="javascript:(function() {var x = new XMLHttpRequest(); x.open('GET', 'blank.html?pipe=trickle(d2)', false); x.send(); document.write('write<script>parent.postMessage(&quot;write&quot;, &quot;*&quot;)</script>'); return '<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>'})()" href="href.html">Test</a>
+<script>
+var t = async_test(undefined, {timeout:4000});
+t.step(function() {document.getElementsByTagName("a")[0].click()});
+onmessage = t.step_func(
+ function(e) {
+ assert_equals(e.data, "href");
+ t.done();
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/013.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/013.html
new file mode 100644
index 000000000..69ce7bc61
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/013.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<title>Link with onclick navigation to javascript url with delayed document.write and href navigation </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe id="test" name="test"></iframe>
+<a target="test" href="javascript:parent.events.push('javascript');">Test</a>
+<script>
+var t = async_test(undefined, {timeout:4000});
+var events = [];
+t.step(function() {
+ document.getElementsByTagName("a")[0].click();
+ events.push('after script');
+});
+onload = t.step_func(function() {
+ // javascript: executions are async.
+ assert_array_equals(events, ['after script', 'javascript']);
+ t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/014.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/014.html
new file mode 100644
index 000000000..605e18185
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/014.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<title> Link with javascript onclick form submission script order </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe id="test" name="test"></iframe>
+<form target="test" action="javascript:parent.events.push('submit');"></form>
+<a target="test" onclick="document.forms[0].submit()">Test</a>
+<script>
+var t = async_test(undefined, {timeout:4000});
+var events = [];
+t.step(function() {
+ document.getElementsByTagName("a")[0].click();
+ events.push('after script');
+});
+onload = t.step_func(function() {
+ // javascript: executions are async.
+ assert_array_equals(events, ['after script', 'submit']);
+ t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/015.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/015.html
new file mode 100644
index 000000000..eb54622b7
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/015.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<title> Link with javascript onclick and href script order </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe id="test" name="test"></iframe>
+<a target="test" onclick="parent.events.push('click');" href="javascript:parent.events.push('href')">Test</a>
+<script>
+var t = async_test(undefined, {timeout:4000});
+var events = [];
+t.step(function() {
+ document.getElementsByTagName("a")[0].click();
+ events.push('after script');
+});
+onload = t.step_func(function() {
+ // javascript: executions are async.
+ assert_array_equals(events, ['click', 'after script', 'href']);
+ t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/MANIFEST b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/MANIFEST
new file mode 100644
index 000000000..0467aa3b4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/MANIFEST
@@ -0,0 +1,42 @@
+support 001-1.html
+support 001-2.html
+support 001-3.html
+http 001.html
+support 002-1.html
+support 002-2.html
+002.html
+support 003-1.html
+support 003-2.html
+support 003-3.html
+003.html
+support 004-1.html
+support 004-2.html
+support 004-3.html
+004.html
+005.html
+006.html
+007.html
+008.html
+009.html
+010.html
+011.html
+012.html
+013.html
+014.html
+015.html
+support blank.html
+support child_navigates_parent_location-1.html
+support child_navigates_parent_location-2.html
+support child_navigates_parent_location-3.html
+child_navigates_parent_location.html
+support child_navigates_parent_submit-1.html
+support child_navigates_parent_submit-2.html
+support child_navigates_parent_submit-3.html
+child_navigates_parent_submit.html
+support click.html
+support href.html
+support navigation_unload_data_url-1.html
+navigation_unload_data_url.html
+support navigation_unload_same_origin-1.html
+navigation_unload_same_origin.html
+support slice-and-dice.php
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/blank.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/blank.html
new file mode 100644
index 000000000..c50eddd41
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/blank.html
@@ -0,0 +1 @@
+<!doctype html>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-1.html
new file mode 100644
index 000000000..66afcff22
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-1.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<script>parent.postMessage("initial", "*")</script>
+<iframe src="child_navigates_parent_location-2.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-2.html
new file mode 100644
index 000000000..746cf4b0f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-2.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<script>
+parent.parent.postMessage("inner", "*");
+parent.location = "child_navigates_parent_location-3.html"
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-3.html
new file mode 100644
index 000000000..bb8ba4e69
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-3.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+parent.postMessage("destination", "*");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location.html
new file mode 100644
index 000000000..9111232e2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>Child document navigating parent via location </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var events = [];
+onmessage = t.step_func(function(e) {
+ events.push(e.data);
+ if (events.length == 3) {
+ assert_array_equals(events, ["initial", "inner", "destination"]);
+ t.done();
+ }
+});
+</script>
+<iframe src="child_navigates_parent_location-1.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-1.html
new file mode 100644
index 000000000..cc8616670
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-1.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<script>parent.postMessage("initial", "*")</script>
+<iframe src="child_navigates_parent_submit-2.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-2.html
new file mode 100644
index 000000000..34e513de9
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-2.html
@@ -0,0 +1,6 @@
+<!doctype html>
+<form action="child_navigates_parent_submit-3.html" target="_parent"></form>
+<script>
+parent.parent.postMessage("inner", "*");
+document.forms[0].submit()
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-3.html
new file mode 100644
index 000000000..bb8ba4e69
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-3.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+parent.postMessage("destination", "*");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit.html
new file mode 100644
index 000000000..d491a26c1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<title>Child document navigating parent via submit </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var events = [];
+onmessage = t.step_func(function(e) {
+ events.push(e.data);
+ if (events.length == 3) {
+ assert_array_equals(events, ["initial", "inner", "destination"]);
+
+ t.done();
+ }
+});
+</script>
+<iframe src="child_navigates_parent_submit-1.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/click.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/click.html
new file mode 100644
index 000000000..8cb03b74d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/click.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+parent.postMessage("click", "*");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment.html
new file mode 100644
index 000000000..18a6f84c9
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>Navigating to the same URL with an empty fragment aborts the navigation</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<iframe src="empty_fragment_iframe.html"></iframe>
+<script>
+// If the navigation were not aborted, we would expect multiple load events
+// as the page continually reloads itself.
+async_test(function(t) {
+ var count = 0;
+ var iframe = document.querySelector('iframe');
+ iframe.onload = t.step_func(function() {
+ count++;
+ });
+ window.child_succeeded = t.step_func_done(function() {
+ assert_equals(count, 1);
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment_iframe.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment_iframe.html
new file mode 100644
index 000000000..26b28a0d7
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment_iframe.html
@@ -0,0 +1,11 @@
+<script>
+var timeout;
+onload = function() {
+ location.hash = "";
+ timeout = setTimeout(function() { parent.child_succeeded() }, 2000);
+};
+
+onbeforeunload = function() {
+ clearTimeout(timeout);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/href.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/href.html
new file mode 100644
index 000000000..eccadadf4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/href.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<script>
+parent.postMessage("href", "*");
+</script>
+href
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-query-fragment-components.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-query-fragment-components.html
new file mode 100644
index 000000000..9c18f109c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-query-fragment-components.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title> javascript url with query and fragment components </title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+var a = null;
+var b = null;
+var c = null;
+</script>
+
+<iframe id="a" src='javascript:"nope" ? "yep" : "what";'></iframe>
+<iframe id="b" src='javascript:"wrong"; // # %0a "ok";'></iframe>
+<iframe id="c" src='javascript:"%252525 ? %252525 # %252525"'></iframe>
+
+<script>
+var t = async_test("iframes with javascript src", {timeout:1000});
+function check(id, expected) {
+ assert_equals(
+ document.getElementById(id).contentDocument.body.textContent,
+ expected);
+}
+onload = t.step_func(function() {
+ check("a", "yep");
+ check("b", "ok");
+ check("c", "%2525 ? %2525 # %2525");
+ t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-return-value-handling.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-return-value-handling.html
new file mode 100644
index 000000000..621a8cbae
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-return-value-handling.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Test that javascript: evaluation only performs a navigation to the
+ result when the result is a string value.</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<iframe src="javascript:'1'"></iframe>
+<iframe src="javascript:1"></iframe>
+<iframe src="javascript:({ toString: function() { return '1'; } })"></iframe>
+<iframe src="javascript:undefined"></iframe>
+<iframe src="javascript:null"></iframe>
+<iframe src="javascript:true"></iframe>
+<iframe src="javascript:new String('1')"></iframe>
+<script>
+ var t = async_test();
+ onload = t.step_func_done(function() {
+ assert_equals(frames[0].document.documentElement.textContent,
+ "1", "string return should cause navigation");
+ // The rest of the test is disabled for now, until
+ // https://github.com/whatwg/html/issues/1895 gets sorted out
+/*
+ assert_equals(frames[1].document.documentElement.textContent,
+ "", "number return should not cause navigation");
+ assert_equals(frames[2].document.documentElement.textContent,
+ "", "object return should not cause navigation");
+ assert_equals(frames[3].document.documentElement.textContent,
+ "", "undefined return should not cause navigation");
+ assert_equals(frames[4].document.documentElement.textContent,
+ "", "null return should not cause navigation");
+ assert_equals(frames[5].document.documentElement.textContent,
+ "", "null return should not cause navigation");
+ assert_equals(frames[6].document.documentElement.textContent,
+ "", "String object return should not cause navigation");
+*/
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url-1.html
new file mode 100644
index 000000000..8c412e657
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+001-1
+<script>
+addEventListener("unload", function() {
+ location = "data:text/html,unload<script>parent.postMessage('fail', '*');<\/script>";
+}, false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url.html
new file mode 100644
index 000000000..7a8be3e91
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<title>Same-origin navigation started from unload handler</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="navigation_unload_data_url-1.html"></iframe>
+<script>
+var t = async_test();
+onload = t.step_func(function() {
+ var iframe = document.getElementsByTagName("iframe")[0];
+ var new_src = "data:text/html,load<script>parent.postMessage('pass', '*')<\/script>";
+ iframe.src = new_src;
+});
+
+onmessage = t.step_func(function(e) {
+ assert_equals(e.data, "pass");
+ t.done();
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin-1.html
new file mode 100644
index 000000000..4b52fe3cf
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+001-1
+<script>
+addEventListener("unload", function() {
+ location = location.href.replace(/[^\/\.]*\.html/, "001-3.html");
+}, false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin.html
new file mode 100644
index 000000000..b75409cc8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<title>Same-origin navigation started from unload handler</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="navigation_unload_same_origin-1.html"></iframe>
+<script>
+var t = async_test();
+onload = t.step_func(function() {
+ var iframe = document.getElementsByTagName("iframe")[0];
+ var new_src = iframe.src.replace(/[^\/\.]*\.html/, "001-2.html");
+ iframe.src = new_src;
+});
+
+onmessage = t.step_func(function(e) {
+ assert_equals(e.data, "001-3");
+ t.done();
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent.html
new file mode 100644
index 000000000..bd2d9dfdb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Set location from a parent</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<iframe></iframe>
+<script>
+ onload = function() {
+ var fr = document.querySelector("iframe")
+ fr.contentWindow.location = "support/dummy.html"
+ fr.onload = function() {
+ assert_equals(fr.contentDocument.referrer, document.URL)
+ done()
+ }
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-src.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-src.html
new file mode 100644
index 000000000..4a15b3f08
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-src.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Set src from a function called from a parent</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<iframe src="support/set-parent-src.html"></iframe>
+<script>
+ onload = function() {
+ var fr = document.querySelector("iframe")
+ fr.contentWindow.go()
+ fr.onload = function() {
+ assert_equals(fr.contentDocument.referrer, document.URL)
+ done()
+ }
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function.html
new file mode 100644
index 000000000..b75062b8d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Set location from a function called from a parent</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<iframe src="support/location-set.html"></iframe>
+<script>
+ onload = function() {
+ var fr = document.querySelector("iframe")
+ var url = fr.contentDocument.URL
+ fr.contentWindow.go()
+ fr.onload = function() {
+ assert_equals(fr.contentDocument.referrer, url)
+ done()
+ }
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html
new file mode 100644
index 000000000..dce6ab2f6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Set the src attribute to about:blank and check referrer</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<iframe></iframe>
+<script>
+ onload = function() {
+ var fr = document.querySelector("iframe")
+ fr.src = "about:blank"
+ fr.onload = function() {
+ assert_equals(fr.contentDocument.referrer, document.URL)
+ done()
+ }
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/dummy.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/dummy.html
new file mode 100644
index 000000000..063865709
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/dummy.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<meta charset=utf-8>
+<p>Hello. \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/location-set.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/location-set.html
new file mode 100644
index 000000000..ad733afac
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/location-set.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<meta charset=utf-8>
+<script>
+ function go() {
+ location.href = "support/dummy.html"
+ }
+</script>
+<p>Hello. Go. \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/set-parent-src.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/set-parent-src.html
new file mode 100644
index 000000000..9d45be8c8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/set-parent-src.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<meta charset=utf-8>
+<script>
+ function go() {
+ frameElement.src = "support/dummy.html"
+ }
+</script>
+<p>Hello. Go. \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/read-html/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/read-html/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/read-html/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/pageload-image.html b/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/pageload-image.html
new file mode 100644
index 000000000..52151b8de
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/pageload-image.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Media documents: image</title>
+ <link rel="author" title="Michael Ventnor" href="mailto:mventnor@mozilla.com">
+ <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
+ <link rel="help" href="https://html.spec.whatwg.org/multipage/#read-media">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+
+<script>
+ var t = async_test("The document for a standalone media file should have one child in the body.");
+
+ function frameLoaded() {
+ var testframe = document.getElementById('testframe');
+ var testframeChildren = testframe.contentDocument.body.childNodes;
+ assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
+ assert_equals(testframeChildren[0].nodeName, "IMG", "Only child of body must be an <img> element");
+ assert_equals(testframeChildren[0].namespaceURI, "http://www.w3.org/1999/xhtml",
+ "Only child of body must be an HTML element");
+ t.done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <iframe id="testframe" onload="t.step(frameLoaded)"
+ src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oMFgQGMyFwHucAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC"></iframe>
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/pageload-video.html b/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/pageload-video.html
new file mode 100644
index 000000000..13bc5db4a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/pageload-video.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Media documents: video</title>
+ <link rel="author" title="Michael Ventnor" href="mailto:mventnor@mozilla.com">
+ <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
+ <link rel="help" href="https://html.spec.whatwg.org/multipage/#read-media">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+
+<script>
+ var t = async_test("The document for a standalone media file should have one child in the body.");
+
+ function frameLoaded() {
+ var testframe = document.getElementById('testframe');
+ var testframeChildren = testframe.contentDocument.body.childNodes;
+ assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
+ assert_equals(testframeChildren[0].nodeName, "VIDEO", "Only child of body must be an <video> element");
+ assert_equals(testframeChildren[0].namespaceURI, "http://www.w3.org/1999/xhtml",
+ "Only child of body must be an HTML element");
+ t.done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <iframe id="testframe" onload="t.step(frameLoaded)"
+ src="data:video/webm,"></iframe>
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/read-multipart-x-mixed-replace/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/read-multipart-x-mixed-replace/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/read-multipart-x-mixed-replace/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/read-plugin/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/read-plugin/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/read-plugin/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/read-text/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/read-text/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/read-text/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/read-text/load-text-plain.html b/testing/web-platform/tests/html/browsers/browsing-the-web/read-text/load-text-plain.html
new file mode 100644
index 000000000..bd4fd7859
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/read-text/load-text-plain.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<title>Page load processing model for text files</title>
+<link rel="author" title="Ms2ger" href="ms2ger@gmail.com">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#read-text">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test("Checking document metadata for text file");
+var tD = async_test("Checking DOM for text file");
+var tC = async_test("Checking contents for text file");
+var iframe = document.body.appendChild(document.createElement("iframe"));
+iframe.onload = function(e) {
+ var doc = iframe.contentDocument;
+ t.step(function() {
+ assert_equals(doc.compatMode, "BackCompat");
+ assert_equals(doc.contentType, "text/plain");
+ assert_equals(doc.doctype, null);
+ t.done();
+ })
+ tD.step(function() {
+ assert_equals(doc.childNodes.length, 1, "Document should have 1 child")
+ assert_equals(doc.documentElement.tagName, "HTML");
+ assert_equals(doc.documentElement.childNodes.length, 2,
+ "Root element should have 2 children")
+ assert_equals(doc.documentElement.firstChild.tagName, "HEAD");
+ assert_equals(doc.documentElement.lastChild.tagName, "BODY");
+ assert_equals(doc.documentElement.lastChild.childNodes.length, 1,
+ "Body element should have 1 child")
+ assert_equals(doc.documentElement.lastChild.firstChild.tagName, "PRE");
+ tD.done();
+ })
+ tC.step(function() {
+ assert_equals(doc.documentElement.lastChild.firstChild.firstChild.data,
+ "This is a sample text/plain document.\n\nThis is not an HTML document.\n\n");
+ tC.done();
+ })
+};
+iframe.src = "../../../../common/text-plain.txt";
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/read-ua-inline/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/read-ua-inline/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/read-ua-inline/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/read-xml/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/read-xml/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/read-xml/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/001.html
new file mode 100644
index 000000000..32599bbc5
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/001.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
+<title>Fragment Navigation: Updating document address</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ assert_equals(location.hash, "", "Page must be loaded with no hash")
+ var original_location = location.href;
+ location.hash = "test";
+ assert_equals(location.hash, "#test");
+ assert_equals(location.href, original_location + "#test");
+ location.hash = ""
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/002.html b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/002.html
new file mode 100644
index 000000000..92bfd6341
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/002.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
+<title>Fragment Navigation: Updating document address twice</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ assert_equals(location.hash, "", "Page must be loaded with no hash")
+ var original_location = location.href;
+ location.hash = "test";
+ assert_equals(location.hash, "#test");
+ assert_equals(location.href, original_location + "#test");
+
+ location.hash = "test1";
+ assert_equals(location.hash, "#test1");
+ assert_equals(location.href, original_location + "#test1");
+
+ location.hash = "";
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/003.html b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/003.html
new file mode 100644
index 000000000..200a6dc34
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/003.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
+<title>Fragment Navigation: Updating scroll position</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<div id="log"></div>
+<div id="test">scroll 1</div>
+<div style="height:10000px">Filler</div>
+<div id="test1">scroll 2</div>
+<script>
+test(function() {
+ assert_equals(document.body.scrollTop, 0);
+ location.hash = "test";
+
+ var scroll1 = document.body.scrollTop;
+ assert_true(scroll1 > 0);
+
+ location.hash = "test1";
+ var scroll2 = document.body.scrollTop;
+ assert_true(scroll2 > scroll1);
+
+ location.hash = ""
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/004.html b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/004.html
new file mode 100644
index 000000000..950172d7b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/004.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
+<title>Fragment Navigation: hashchange event</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<div id="log"></div>
+<script>
+var t = async_test();
+t.step(function() {
+ assert_equals(location.hash, "", "Page must be loaded with no hash");
+ location.hash = "test";
+
+ addEventListener("hashchange",
+ t.step_func(function(e) {
+ assert_equals(e.target, window);
+ assert_equals(e.type, "hashchange");
+ assert_true(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+ t.done();
+ }), true)
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/005.html b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/005.html
new file mode 100644
index 000000000..f0761a64f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/005.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
+<title>Fragment Navigation: hashchange event</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<div id="log"></div>
+<script>
+var t = async_test();
+t.step(function() {
+ var original_url = location.href;
+ assert_equals(location.hash, "", "Page must be loaded with no hash");
+ location.hash = "test";
+
+ addEventListener("hashchange",
+ t.step_func(function(e) {
+ assert_equals(e.oldURL, original_url, "oldURL property");
+ assert_equals(e.newURL, location.href, "newURL property");
+ location.hash = "";
+ t.done();
+ }), true);
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/006.html b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/006.html
new file mode 100644
index 000000000..a65b9eb4a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/006.html
@@ -0,0 +1,34 @@
+<!doctype html>
+<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
+<title>Fragment Navigation: hashchange event multiple changes old/newURL</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<div id="log"></div>
+<script>
+var t = async_test();
+t.step(function() {
+ var original_url = location.href;
+ assert_equals(location.hash, "", "Page must be loaded with no hash");
+ location.hash = "test";
+
+ var count = 0;
+ var mid_url = location.href;
+
+ addEventListener("hashchange",
+ t.step_func(function(e) {
+ if (count === 0) {
+ assert_equals(e.oldURL, original_url, "oldURL property first update");
+ assert_equals(e.newURL, mid_url, "newURL property first update");
+ count = 1;
+ } else if (count === 1) {
+ assert_equals(e.oldURL, mid_url, "oldURL property second update");
+ assert_equals(e.newURL, location.href, "newURL property second update");
+ location.hash = "";
+ t.done();
+ }
+ }), true);
+
+ location.hash = "test1";
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/007.html b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/007.html
new file mode 100644
index 000000000..0b6fe813b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/007.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
+<title>Fragment Navigation: hashchange event multiple changes old/newURL</title>
+<meta name=timeout content=long>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<div id="log"></div>
+<script>
+var t = async_test();
+t.step(function() {
+ var original_url = location.href;
+ assert_equals(location.hash, "", "Page must be loaded with no hash");
+
+ var count = 0;
+
+ location.hash = "test";
+
+ hashes = [];
+
+ addEventListener("hashchange",
+ t.step_func(function(e) {
+ if (count < 100) {
+ location.hash = "test" + count++;
+ hashes.push(location.hash);
+ } else if (count === 100) {
+ expected = [];
+ for (var i=0; i<100; i++) {
+ expected.push("#test" + i);
+ }
+ assert_array_equals(hashes, expected);
+ location.hash = "";
+ t.done();
+ }
+ }), true);
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/MANIFEST b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/MANIFEST
new file mode 100644
index 000000000..eaa8e6d61
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/MANIFEST
@@ -0,0 +1,7 @@
+001.html
+002.html
+003.html
+004.html
+005.html
+006.html
+007.html
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-percent-encoded.html b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-percent-encoded.html
new file mode 100644
index 000000000..3196d8be8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-percent-encoded.html
@@ -0,0 +1,59 @@
+<!doctype html>
+<title>Fragment Navigation: fragment id should be percent-decoded</title>
+<meta name=timeout content=long>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<div></div>
+<div id="has two spaces" style="position:absolute; top:200px;"></div>
+<div id="escape%20collision" style="position:absolute; top:300px;"></div>
+<div id="escape collision" style="position:absolute; top:400px;"></div>
+<div id="do%20not%20go%20here" style="position:absolute; top:400px;"></div>
+<div style="height:200em;"></div>
+<script>
+var steps = [{
+ fragid:'has%20two%20spaces',
+ handler: function(){
+ assert_equals( scrollPosition(), 200 );
+ }
+ },{
+ fragid:'escape%20collision',
+ handler: function(){
+ assert_equals( scrollPosition(), 400 );
+ }
+ },{
+ fragid:'do%20not%20go%20here',
+ handler: function(){
+ // don't move
+ assert_equals( scrollPosition(), 400 );
+ }
+ }];
+
+function scrollPosition(){
+ return document.documentElement.scrollTop || document.body.scrollTop;
+}
+
+function runNextStep(){
+ if( steps.length > 0 ) {
+ var step = steps.shift();
+ var listener = t.step_func( function(){
+ step.handler();
+ runNextStep();
+ });
+ scrollToFragmentThenDo( step.fragid, listener );
+ } else {
+ t.done();
+ }
+}
+
+function scrollToFragmentThenDo( fragid, then ){
+ location.hash = fragid;
+ setTimeout( then, 1 );
+}
+
+var t = async_test();
+t.step( function(){
+ assert_equals(location.hash, "", "Page must be loaded with no hash");
+ runNextStep();
+})
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name.html b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name.html
new file mode 100644
index 000000000..43dbaf9e2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name.html
@@ -0,0 +1,53 @@
+<!doctype html>
+<title>Fragment Navigation: scroll to anchor name is lower priority than equal id</title>
+<meta name=timeout content=long>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<div></div>
+<a name="anchor1" style="position:absolute; top:200px;"></a>
+<div id="id-equals-anchor" style="position:absolute; top:300px;"></div>
+<a name="id-equals-anchor" style="position:absolute; top:400px;"></a>
+<div style="height:200em;"></div>
+<script>
+var steps = [{
+ fragid:'anchor1',
+ handler: function(){
+ assert_equals( scrollPosition(), 200 );
+ }
+ },{
+ fragid:'id-equals-anchor',
+ handler: function(){
+ // id still takes precedence over anchor name
+ assert_equals( scrollPosition(), 300 );
+ }
+ }];
+
+function scrollPosition(){
+ return document.documentElement.scrollTop || document.body.scrollTop;
+}
+
+function runNextStep(){
+ if( steps.length > 0 ) {
+ var step = steps.shift();
+ var listener = t.step_func( function(){
+ step.handler();
+ runNextStep();
+ });
+ scrollToFragmentThenDo( step.fragid, listener );
+ } else {
+ t.done();
+ }
+}
+
+function scrollToFragmentThenDo( fragid, then ){
+ location.hash = fragid;
+ setTimeout( then, 1 );
+}
+
+var t = async_test();
+t.step( function(){
+ assert_equals(location.hash, "", "Page must be loaded with no hash");
+ runNextStep();
+})
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-id-top.html b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-id-top.html
new file mode 100644
index 000000000..601d40a2a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-id-top.html
@@ -0,0 +1,51 @@
+<!doctype html>
+<title>Fragment Navigation: TOP is a valid element id, which overrides navigating to top of the document</title>
+<meta name=timeout content=long>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<div></div>
+<div id="Top" style="position:absolute; top:200px;"></div>
+<div style="height:200em; position:relative;"></div>
+<script>
+var steps = [{
+ fragid:'Top',
+ handler: function(){
+ assert_equals( scrollPosition(), 200 );
+ }
+ },{
+ // scroling to top should work when fragid differs from id by case.
+ fragid:'top',
+ handler: function(){
+ assert_equals( scrollPosition(), 0 );
+ }
+ }];
+
+function scrollPosition(){
+ return document.documentElement.scrollTop || document.body.scrollTop;
+}
+
+function runNextStep(){
+ if( steps.length > 0 ) {
+ var step = steps.shift();
+ var listener = t.step_func( function(){
+ step.handler();
+ runNextStep();
+ });
+ scrollToFragmentThenDo( step.fragid, listener );
+ } else {
+ t.done();
+ }
+}
+
+function scrollToFragmentThenDo( fragid, then ){
+ location.hash = fragid;
+ setTimeout( then, 1 );
+}
+
+var t = async_test();
+t.step( function(){
+ assert_equals(location.hash, "", "Page must be loaded with no hash");
+ runNextStep();
+})
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-top.html b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-top.html
new file mode 100644
index 000000000..3265a71bf
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-top.html
@@ -0,0 +1,60 @@
+<!doctype html>
+<title>Fragment Navigation: When fragid is TOP scroll to the top of the document</title>
+<meta name=timeout content=long>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<div></div>
+<div id="not-the-top"></div>
+<div style="height:200em"></div>
+<script>
+var steps = [{
+ fragid:'not-the-top',
+ handler: function(){
+ assert_not_equals( scrollPosition(), 0 );
+ }
+ },{
+ fragid:'top',
+ handler: function(){
+ assert_equals( scrollPosition(), 0 );
+ }
+ },{
+ fragid:'not-the-top',
+ handler: function(){
+ assert_not_equals( scrollPosition(), 0 );
+ }
+ },{
+ fragid:'TOP',
+ handler: function(){
+ assert_equals( scrollPosition(), 0 );
+ }
+ }];
+
+function scrollPosition(){
+ return document.documentElement.scrollTop || document.body.scrollTop;
+}
+
+function runNextStep(){
+ if( steps.length > 0 ) {
+ var step = steps.shift();
+ var listener = t.step_func( function(){
+ step.handler();
+ runNextStep();
+ });
+ scrollToFragmentThenDo( step.fragid, listener );
+ } else {
+ t.done();
+ }
+}
+
+function scrollToFragmentThenDo( fragid, then ){
+ location.hash = fragid;
+ setTimeout( then, 1 );
+}
+
+var t = async_test();
+t.step( function(){
+ assert_equals(location.hash, "", "Page must be loaded with no hash");
+ runNextStep();
+})
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/001.html
new file mode 100644
index 000000000..1ef88d3cc
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/001.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<title>document.open in unload</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var win;
+
+t.step(function() {
+ win = window.open("support/001-1.html");
+});
+
+add_completion_callback(function() {win.close()});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/002.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/002.html
new file mode 100644
index 000000000..a4e0b243e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/002.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<title>document.open in unload</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var win;
+
+t.step(function() {
+ win = window.open("support/002-1.html");
+});
+
+add_completion_callback(function() {win.close()});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/003.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/003.html
new file mode 100644
index 000000000..d0a19e0dd
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/003.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<title>document.open in beforeunload with link</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var win;
+
+t.step(function() {
+ win = window.open("support/003-1.html");
+});
+
+add_completion_callback(function() {win.close()});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/004.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/004.html
new file mode 100644
index 000000000..fca926f65
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/004.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<title>document.open in beforeunload with button</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var win;
+
+t.step(function() {
+ win = window.open("support/004-1.html");
+});
+
+add_completion_callback(function() {win.close()});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/005.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/005.html
new file mode 100644
index 000000000..c215fb88e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/005.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<title>document.open in pagehide in iframe</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var win;
+
+t.step(function() {
+ win = window.open("support/005-1.html");
+});
+
+add_completion_callback(function() {win.close()});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/MANIFEST b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/MANIFEST
new file mode 100644
index 000000000..f77806795
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/MANIFEST
@@ -0,0 +1,33 @@
+support 001-1.html
+support 001a.html
+support 001b.html
+001.html
+support 002-1.html
+support 002a.html
+support 002b.html
+002.html
+support 003-1.html
+support 003a.html
+support 003b.html
+003.html
+support 004-1.html
+support 004a.html
+support 004b.html
+004.html
+support 005-1.html
+support 005a.html
+support 005b.html
+005.html
+base.html
+support beforeunload-on-history-back-1.html
+beforeunload-on-history-back.html
+support beforeunload-on-navigation-of-parent-1.html
+support beforeunload-on-navigation-of-parent-2.html
+beforeunload-on-navigation-of-parent.html
+support navigation-within-beforeunload-1.html
+support navigation-within-beforeunload-2.html
+navigation-within-beforeunload.html
+support pagehide-on-history-forward-1.html
+pagehide-on-history-forward.html
+dir prompt
+dir unload
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/base.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/base.html
new file mode 100644
index 000000000..70c07cba4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/base.html
@@ -0,0 +1,14 @@
+<!doctype html>
+Base
+<script>
+onpagehide = function() {
+ if(top.base_hide) {
+ top.base_hide();
+ }
+}
+onpageshow = function() {
+if (top.base_show) {
+ top.base_show();
+}
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back-1.html
new file mode 100644
index 000000000..4403cfa8e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back-1.html
@@ -0,0 +1,5 @@
+<!doctype html>
+001-1
+<script>
+addEventListener("beforeunload", function() {top.t.step(function() {top.beforeunload_fired = true})}, false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back.html
new file mode 100644
index 000000000..5b0415c42
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<title>beforeunload event fires on history navigation back</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+beforeunload_fired = false;
+var t = async_test();
+
+var base_count = 0;
+
+onload = function() {setTimeout(t.step_func(function() {
+ var iframe = document.getElementsByTagName("iframe")[0]
+ iframe.onload = t.step_func(function() {
+ iframe.onload = null;
+ history.go(-1);
+ });
+
+ iframe.src = "beforeunload-on-history-back-1.html";
+}), 100)};
+
+base_show = t.step_func(function() {
+ base_count++;
+ if (base_count > 1) {
+ assert_true(beforeunload_fired);
+ t.done();
+ }
+});
+
+</script>
+<iframe src="base.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-1.html
new file mode 100644
index 000000000..4f239dad1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-1.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<iframe src="beforeunload-on-navigation-of-parent-2.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-2.html
new file mode 100644
index 000000000..a34b182e7
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-2.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+addEventListener("beforeunload", function() {parent.parent.beforeunload_fired=true}, false)
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent.html
new file mode 100644
index 000000000..96d49567f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<title>beforeunload in iframe on navigation of parent</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+beforeunload_fired = false;
+var t = async_test();
+
+var base_count = 0;
+
+onload = function() {setTimeout(t.step_func(function() {
+ var iframe = document.getElementsByTagName("iframe")[0]
+ iframe.onload = t.step_func(function() {
+ iframe.onload = null;
+ history.go(-1);
+ });
+
+ iframe.src = "beforeunload-on-navigation-of-parent-1.html";
+}), 100)};
+
+base_show = t.step_func(function() {
+ base_count++;
+ if (base_count > 1) {
+ assert_true(beforeunload_fired);
+ t.done();
+ }
+});
+
+</script>
+<iframe src="base.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/contains.json b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/contains.json
new file mode 100644
index 000000000..4ebca09bf
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/contains.json
@@ -0,0 +1,6 @@
+[
+ {
+ "id": "event-definition",
+ "original_id": "event-definition"
+ }
+] \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-1.html
new file mode 100644
index 000000000..b96234fba
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-1.html
@@ -0,0 +1,10 @@
+<!doctype html>
+004-1
+<script>
+addEventListener("beforeunload",
+function() {
+if (top.counter++ < 999) {
+ location = "navigation-within-beforeunload-2.html?" + top.counter;
+}
+}, false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-2.html
new file mode 100644
index 000000000..2dceaa6d6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-2.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+document.write(location)
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload.html
new file mode 100644
index 000000000..d7131b00d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<title>Triggering navigation from within beforeunload event</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+beforeunload_fired = false;
+var t = async_test();
+
+var base_count = 0;
+var counter = 0;
+
+onload = function() {setTimeout(function() {
+ var iframe = document.getElementsByTagName("iframe")[0]
+
+ iframe.onload = function() {
+ setTimeout(function() {iframe.contentWindow.location="navigation-within-beforeunload-2.html";}, 100);
+ iframe.onload = t.step_func(function() {assert_equals(counter, 1000); t.done()});
+ };
+
+ iframe.src = "navigation-within-beforeunload-1.html?" + Math.random();
+
+}, 100)};
+
+</script>
+<iframe src="base.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward-1.html
new file mode 100644
index 000000000..a60c20ed8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward-1.html
@@ -0,0 +1,2 @@
+<!doctype html>
+filler text
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward.html
new file mode 100644
index 000000000..5e64b5ec6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward.html
@@ -0,0 +1,19 @@
+<!doctype html>
+<title>pagehide event fires on history navigation forward</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+
+onload = function() {setTimeout(t.step_func(function() {
+ var iframe = document.getElementsByTagName("iframe")[0]
+
+ iframe.src = "pagehide-on-history-forward-1.html";
+}), 100)};
+
+base_hide = t.step_func(function() {
+ t.done()
+});
+</script>
+<iframe src="base.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-1.html
new file mode 100644
index 000000000..b68afc49e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-1.html
@@ -0,0 +1,10 @@
+<script>
+addEventListener("beforeunload",
+function() {
+ parent.events.push("beforeunload");
+}, false);
+parent.events.push("before src change");
+
+location.href = "001-2.html&pipe=trickle(d2)";
+parent.events.push("after src change");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-2.html
new file mode 100644
index 000000000..9da0f9395
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-2.html
@@ -0,0 +1 @@
+001-2
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001.html
new file mode 100644
index 000000000..109dcc139
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<title>beforeunload event order</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+events = [];
+onload = t.step_func(function() {
+ assert_array_equals(events, ["before src change", "beforeunload", "after src change"]);
+ t.done();
+})
+</script>
+<iframe src="001-1.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002-1.html
new file mode 100644
index 000000000..c5f57375d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002-1.html
@@ -0,0 +1,7 @@
+<script>
+addEventListsner("beforeunload", parent.t.step_func(
+function(e) {
+ parent.do_test(e);
+}, false);
+location.href = "001-2.html&pipe=trickle(d2)";
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002.html
new file mode 100644
index 000000000..d8f4fc60a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<title>beforeunload event properties</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+
+function do_test(e) {
+ assert_equals(e.type, "beforeunload");
+ assert_false(e.bubbles, "bubbles");
+ assert_true(e.cancelable, "bubbles");
+ assert_equals(e.returnValue, "");
+}
+
+onload = t.step_func(function() {
+ t.done();
+})
+</script>
+<iframe src="001-1.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/003.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/003.html
new file mode 100644
index 000000000..5683f1b12
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/003.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<title>beforeunload event in child frame for parent navigation</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+
+function do_test(e) {
+ assert_equals(e.type, "beforeunload");
+ assert_false(e.bubbles, "bubbles");
+ assert_true(e.cancelable, "bubbles");
+ assert_equals(e.returnValue, "");
+}
+
+onload = t.step_func(function() {
+ t.done();
+})
+</script>
+<iframe src="001-1.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/MANIFEST b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/MANIFEST
new file mode 100644
index 000000000..8d93279a4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/MANIFEST
@@ -0,0 +1,14 @@
+support 001-1.html
+support 001-2.html
+001.html
+support 002-1.html
+002.html
+003.html
+manual manual-001.html
+manual manual-002.html
+manual manual-003.html
+manual manual-004.html
+manual manual-005.html
+manual manual-006.html
+support next.html
+support slice-and-dice.php
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-001.html
new file mode 100644
index 000000000..3b7ef74b7
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-001.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<title>Prompt when beforeunload is canceled</title>
+<script>
+addEventListener("beforeunload",
+function(e) {e.preventDefault()},
+false);
+</script>
+<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p>
+<a href="next.html">Click here</a>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-002.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-002.html
new file mode 100644
index 000000000..7be8a3301
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-002.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<title>Prompt when beforeunload has returnValue set</title>
+<script>
+addEventListener("beforeunload",
+function(e) {e.returnValue = "PASS if you see this"},
+false);
+</script>
+<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p>
+<a href="next.html">Click here</a>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-003.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-003.html
new file mode 100644
index 000000000..ff72b6705
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-003.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<title>Prompt when beforeunload is canceled</title>
+<script>
+addEventListener("beforeunload",
+function(e) {e.preventDefault()},
+false);
+</script>
+<p>When clicking the button below, you should get a prompt asking if you want to unload the document</p>
+<form method="get" action="next.html">
+<input type="submit" value="Click here">
+</form>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-004.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-004.html
new file mode 100644
index 000000000..a4d296892
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-004.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<title>Prompt on form submit</title>
+<script>
+addEventListener("beforeunload",
+function(e) {e.preventDefault()},
+false);
+</script>
+<p>When clicking the button below, you should get a prompt asking if you want to unload the document</p>
+<form method="get" action="next.html">
+<input type="submit" value="Click here">
+</form>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-005.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-005.html
new file mode 100644
index 000000000..71ff0a241
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-005.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<title>Event loop pause for beforeunload</title>
+<script>
+var counter = 0;
+
+onload = function count() {
+ document.getElementById("log").textContent = counter++
+ setTimeout(count, 200);
+}
+
+addEventListener("beforeunload",
+function(e) {
+ e.preventDefault()
+},
+false);
+</script>
+<ul>
+<li>Click on the link below. When the prompt appears the counter at the bottom must stop incrementing.
+<li>Opt not to leave the page. The counter must start incrementing again
+</ul>
+<p><a href="">Click here</a>
+<div id="log"></div>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-006.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-006.html
new file mode 100644
index 000000000..dae0340ad
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-006.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<title>Prompt when beforeunload returns string value</title>
+<script>
+addEventListener("beforeunload",
+function(e) {return "PASS if you see this"},
+false);
+</script>
+<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p>
+<a href="next.html">Click here</a>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/next.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/next.html
new file mode 100644
index 000000000..38e7cdd5e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/next.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<p>You should have seen a prompt asking you to unload the previous document
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001-1.html
new file mode 100644
index 000000000..72f41ae3e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001-1.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<script>
+ t = opener.t;
+ do_test = t.step(function () {
+ localStorage.test6564729 += '4';
+ var d = document;
+ var e = document.open(); // has no effect (ignore-opens-during-unload > 0)
+ localStorage.test6564729 += (e == d) ? '5' : 'A [' + e + '] ';
+ document.write('FAIL - document.write executed and blocked navigation!'); // has no effect (ignore-opens-during-unload > 0)
+ localStorage.test6564729 += document.body.textContent.match('FAIL') ? 'B' : '6';
+ document.close(); // has no effect (no script-created parser)
+ localStorage.test6564729 += '7';
+ })
+onload = t.step_func(function() {
+ localStorage.test6564729 = '0';
+ setTimeout(t.step_func(function() {document.links[0].click()}));
+});
+</script>
+<body onbeforeunload="localStorage.test6564729 += '1'"
+ onpagehide="localStorage.test6564729 += '3'"
+ onunload="do_test()">
+<p><a href="001a.html">Follow this link to run the test.</a>
+<p><iframe src="001b.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001a.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001a.html
new file mode 100644
index 000000000..36d4188b9
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001a.html
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML>
+<script>
+opener.t.step(function() {
+ opener.assert_equals(localStorage.test6564729, '0123456789');
+ opener.t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001b.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001b.html
new file mode 100644
index 000000000..eaafc371a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001b.html
@@ -0,0 +1,5 @@
+<!DOCTYPE HTML>
+<body onbeforeunload="localStorage.test6564729 += '2'"
+ onpagehide="localStorage.test6564729 += '8'"
+ onunload="localStorage.test6564729 += '9'">
+<p>Inner frame \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002-1.html
new file mode 100644
index 000000000..0e6f7d967
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002-1.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<script>
+ var t = opener.t;
+
+ var do_test = t.step_func(function() {
+ localStorage.test6564729 += '1';
+ var d = document;
+ var e = document.open(); // unload triggered here - beforeunload 2, 3 in 002b; pagehide 4, unload 5, pagehide 6 in 002b, unload 7 in 002b
+ localStorage.test6564729 += (e == d) ? '8' : 'X';
+ var s = 'FAIL if you see this | ' + localStorage.test6564729;
+ document.write(s);
+ localStorage.test6564729 += document.body.textContent == s ? '9' : 'x';
+ document.close();
+ localStorage.test6564729 += 'Z';
+ document.body.textContent += ' // ' + localStorage.test6564729;
+ location = '002a.html'; // unload triggers again here, but they're not registered event listeners any more
+ });
+
+onload = t.step_func(function() {
+ localStorage.test6564729 = '0';
+ setTimeout(function() {document.getElementsByTagName("input")[0].click()}, 100);
+});
+</script>
+<body onbeforeunload="localStorage.test6564729 += '2'"
+ onpagehide="localStorage.test6564729 += '4'"
+ onunload="localStorage.test6564729 += '5'">
+<input type=button value="Activate this button to run the test" onclick="do_test()">
+<p><iframe src="002b.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002a.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002a.html
new file mode 100644
index 000000000..d11f67086
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002a.html
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML>
+<script>
+ opener.t.step(function() {
+ opener.assert_equals(localStorage.test6564729, '0123456789Z');
+ opener.t.done();
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002b.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002b.html
new file mode 100644
index 000000000..d08a7a8ad
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002b.html
@@ -0,0 +1,5 @@
+<!DOCTYPE HTML>
+<body onbeforeunload="localStorage.test6564729 += '3'"
+ onpagehide="localStorage.test6564729 += '6'"
+ onunload="localStorage.test6564729 += '7'">
+<p>Inner frame \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003-1.html
new file mode 100644
index 000000000..b3a4754b8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003-1.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<script>
+ var t = opener.t;
+ var do_test = t.step_func(function() {
+ localStorage.test6564729 += '1';
+ var d = document;
+ var e = document.open(); // has no effect (ignore-opens-during-unload > 0 because we're in beforeunload)
+ localStorage.test6564729 += (e == d) ? '2' : 'A [' + e + '] ';
+ document.write('FAIL - document.write executed and blocked navigation!'); // has no effect (ignore-opens-during-unload > 0)
+ localStorage.test6564729 += document.body.textContent.match('FAIL') ? 'B' : '3';
+ document.close(); // has no effect (no script-created parser)
+ localStorage.test6564729 += '4';
+ })
+
+ onload=t.step_func(function() {localStorage.test6564729 = '0'; setTimeout(t.step_func(function() {document.links[0].click()}), 100)})
+
+</script>
+<body
+ onbeforeunload="do_test()"
+ onpagehide="localStorage.test6564729 += '6'"
+ onunload="localStorage.test6564729 += '7'">
+<p><a href="003a.html">Follow this link to run the test.</a>
+<p><iframe src="003b.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003a.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003a.html
new file mode 100644
index 000000000..5393fa221
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003a.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<p>FAIL</p>
+<script>
+opener.t.step(function() {
+ opener.assert_equals(localStorage.test6564729, '0123456789')
+ opener.t.done();
+})
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003b.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003b.html
new file mode 100644
index 000000000..c8f1917b8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003b.html
@@ -0,0 +1,5 @@
+<!DOCTYPE HTML>
+<body onbeforeunload="localStorage.test6564729 += '5'"
+ onpagehide="localStorage.test6564729 += '8'"
+ onunload="localStorage.test6564729 += '9'">
+<p>Inner frame \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004-1.html
new file mode 100644
index 000000000..06aba08af
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004-1.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<script>
+ var t = opener.t;
+ var do_test = t.step_func(function() {
+ localStorage.test6564729 += 'B';
+ var d = document;
+ var e = document.open(); // unload triggered here - beforeunload C, D in 004b; pagehide E, unload F, pagehide G in 004b, unload HIJK in 004b
+ localStorage.test6564729 += (e == d) ? 'L' : 'Y';
+ var s = 'FAIL if you see this | ' + localStorage.test6564729;
+ document.write(s);
+ localStorage.test6564729 += document.body.textContent == s ? 'M' : 'y';
+ document.close();
+ localStorage.test6564729 += 'N';
+ location = '004a.html'; // unload triggers again here, but they're not registered event listeners any more
+ })
+onload = t.step_func(function() {
+ localStorage.test6564729 = 'A';
+ setTimeout(t.step_func(function() {document.getElementsByTagName("input")[0].click()}), 100);
+})
+</script>
+<body onbeforeunload="localStorage.test6564729 += 'C'"
+ onpagehide="localStorage.test6564729 += 'E'"
+ onunload="localStorage.test6564729 += 'F'">
+<input type=button value="Activate this button to run the test" onclick="do_test()">
+<p><iframe src="004b.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004a.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004a.html
new file mode 100644
index 000000000..117e2b94a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004a.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<p>FAIL</p>
+<script>
+opener.t.step(function() {
+ opener.assert_equals(localStorage.test6564729, 'ABCDEFGHIJKLMN');
+ opener.t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004b.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004b.html
new file mode 100644
index 000000000..788937a0b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004b.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<script>
+ function testRun() {
+ localStorage.test6564729 += 'H';
+ var d = parent.document;
+ var e = parent.document.open(); // no effect, since that document is already in unload
+ localStorage.test6564729 += (e == d) ? 'I' : 'X';
+ var s = 'FAIL';
+ document.write(s);
+ localStorage.test6564729 += document.body.textContent == s ? 'x' : 'J';
+ document.close();
+ localStorage.test6564729 += 'K';
+ }
+</script>
+<body onbeforeunload="localStorage.test6564729 += 'D'"
+ onpagehide="localStorage.test6564729 += 'G'"
+ onunload="testRun()">
+<p>Inner frame \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005-1.html
new file mode 100644
index 000000000..7b81a9f11
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005-1.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<script>
+onload = opener.t.step_func(function() {
+ localStorage.test6564729 = '0'
+ setTimeout(opener.t.step_func(function() {document.links[0].click()}), 100);
+});
+</script>
+<body
+ onbeforeunload="localStorage.test6564729 += '1'"
+ onpagehide="localStorage.test6564729 += '3'"
+ onunload="localStorage.test6564729 += '4'">
+<p><a href="005a.html">Follow this link to run the test.</a>
+<p><iframe src="005b.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005a.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005a.html
new file mode 100644
index 000000000..5185d3b92
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005a.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+<p>FAIL</p>
+<script>
+opener.t.step(function() {
+ opener.assert_equals(localStorage.test6564729, '012345678')
+ opener.t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005b.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005b.html
new file mode 100644
index 000000000..476e8e38c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005b.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<script>
+ var t = parent.opener.t;
+ var do_test = t.step_func(function () {
+ localStorage.test6564729 += '5';
+ var s = 'FAIL: document.open() has canceled the navigation (' + localStorage.test6564729 + ')';
+ parent.document.open();
+ parent.document.write(s);
+ parent.document.close();
+ localStorage.test6564729 += parent.document.body.textContent.match('FAIL') == s ? 'X' : '6';
+ localStorage.test6564729 += '7';
+ });
+</script>
+<body onbeforeunload="localStorage.test6564729 += '2'"
+ onpagehide="do_test()"
+ onunload="localStorage.test6564729 += '8'">
+<p>Inner frame
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-1.html
new file mode 100644
index 000000000..74ba43954
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-1.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+addEventListener("pagehide", parent.t.step_func(function() {parent.pagehide_fired = true}), false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-2.html
new file mode 100644
index 000000000..90e28ab7f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-2.html
@@ -0,0 +1,2 @@
+<!doctype html>
+Filler
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001.html
new file mode 100644
index 000000000..444a2770c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<title>pagehide event on unload</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+pagehide_fired = false;
+var t = async_test();
+
+onload = function() {setTimeout(function() {
+ var iframe = document.getElementsByTagName("iframe")[0]
+
+ iframe.onload = function() {
+ setTimeout(function() {
+ iframe.contentWindow.location="001-2.html";
+ }, 100);
+ iframe.onload = t.step_func(function() {assert_true(pagehide_fired); t.done()});
+ };
+
+ iframe.src = "001-1.html?" + Math.random();
+
+}, 100)};
+
+</script>
+<iframe></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002-1.html
new file mode 100644
index 000000000..fd8e2b726
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002-1.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+addEventListener("pagehide", parent.t.step_func(parent.do_test()), false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002.html
new file mode 100644
index 000000000..3fb07e484
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<title>pagehide event properties</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+
+onload = function() {setTimeout(function() {
+ var iframe = document.getElementsByTagName("iframe")[0]
+
+ iframe.onload = function() {
+ setTimeout(function() {
+ iframe.contentWindow.location="001-2.html";
+ }, 100);
+ iframe.onload = t.step_func(function() {t.done()});
+ };
+
+ function do_test(e) {
+ assert_equals(e.type, "pagehide");
+ assert_equals(e.target, iframe.contentDocument);
+ assert_equals(e.currentTarget, iframe.contentWindow);
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+ assert_true(e.persisted, "persisted");
+ }
+
+ iframe.src = "002-1.html?" + Math.random();
+
+}, 100)};
+
+</script>
+<iframe></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003-1.html
new file mode 100644
index 000000000..9838c7945
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003-1.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+addEventListener("unload", parent.t.step_func(function(e) {parent.do_test(e)}), false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003.html
new file mode 100644
index 000000000..97821be48
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<title>unload event properties</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var do_test;
+
+onload = function() {setTimeout(function() {
+ var iframe = document.getElementsByTagName("iframe")[0]
+
+ iframe.onload = function() {
+ setTimeout(function() {
+ iframe.contentWindow.location="002-2.html";
+ }, 100);
+ iframe.onload = t.step_func(function() {t.done()});
+ };
+
+ do_test = function(e) {
+ assert_equals(e.type, "unload");
+ assert_equals(e.target, iframe.contentDocument);
+ assert_equals(e.currentTarget, iframe.contentWindow);
+ assert_false(e.bubbles, "bubbles");
+ assert_false(e.cancelable, "cancelable");
+ }
+
+ iframe.src = "003-1.html?" + Math.random();
+
+}, 100)};
+
+</script>
+<iframe></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004-1.html
new file mode 100644
index 000000000..5d0497556
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004-1.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<script>
+addEventListener("pagehide", function() {parent.events.push("pagehide"); setTimeout(function() {parent.events.push("timeout")}, 0)}, false);
+addEventListener("unload", function() {parent.events.push("unload")}, false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004.html
new file mode 100644
index 000000000..301baa3b8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title>pagehide / unload event order</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+
+var events = [];
+
+onload = function() {setTimeout(function() {
+ var iframe = document.getElementsByTagName("iframe")[0]
+
+ iframe.onload = function() {
+ setTimeout(function() {
+ iframe.contentWindow.location="001-2.html";
+ }, 100);
+ iframe.onload = t.step_func(function() {
+ assert_array_equals(events, ["pagehide", "unload"])
+ t.done()});
+ };
+
+ iframe.src = "004-1.html?" + Math.random();
+
+}, 100)};
+
+</script>
+<iframe></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-1.html
new file mode 100644
index 000000000..8d2659623
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-1.html
@@ -0,0 +1,20 @@
+<!doctype html>
+006-1
+<script>
+onpagehide = function() {
+ onpagehide = null;
+ setTimeout(function() {
+ parent.t.done()
+ }, 1000);
+}
+onload = function() {
+ if (!parent.loaded) {
+ parent.loaded = true;
+ setTimeout(parent.t.step_func(
+ function() {
+ location="006-2.html?" + Math.random();
+ }
+ ), 100);
+ }
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-2.html
new file mode 100644
index 000000000..52365e55d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-2.html
@@ -0,0 +1,5 @@
+<!doctype html>
+006-2
+<script>
+onload = function() {setTimeout(parent.t.step_func(function() {history.go(-1)}), 100)}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006.html
new file mode 100644
index 000000000..c9e4d68a1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<title>salvagable state of document after setting pagehide listener</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+
+var loaded = false;
+
+onload = function() {setTimeout(function() {
+ var iframe = document.getElementsByTagName("iframe")[0]
+ onload = null;
+ iframe.src="006-1.html?" + Math.random();
+}, 100)};
+
+</script>
+<iframe></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-1.html
new file mode 100644
index 000000000..ed19f4498
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-1.html
@@ -0,0 +1,21 @@
+<!doctype html>
+007-1
+<script>
+onunload = function() {
+ onunload = null;
+ parent.unload_fired = true;
+ setTimeout(function() {
+ parent.timeout_fired = true;
+ }, 100);
+}
+onload = function() {
+ if (!parent.loaded) {
+ parent.loaded = true;
+ setTimeout(parent.t.step_func(
+ function() {
+ location="007-2.html?" + Math.random();
+ }
+ ), 100);
+ }
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-2.html
new file mode 100644
index 000000000..f74cd1e67
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-2.html
@@ -0,0 +1,5 @@
+<!doctype html>
+007-2
+<script>
+onload = function() {setTimeout(parent.t.step_func(function() {parent.start_test(); history.go(-1)}), 100)}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007.html
new file mode 100644
index 000000000..0d5b72e0f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title>salvagable state of document after setting unload listener</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test(undefined, {timeout:2000});
+
+var loaded = false;
+var unload_fired = false;
+var timeout_fired = false;
+
+function start_test() {
+ setTimeout(t.step_func(function() {
+ assert_true(unload_fired);
+ assert_false(timeout_fired);
+ t.done()
+ }), 1000);
+}
+
+onload = function() {setTimeout(function() {
+ var iframe = document.getElementsByTagName("iframe")[0]
+ onload = null;
+ iframe.src="007-1.html?" + Math.random();
+}, 100)};
+
+</script>
+<iframe></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008-1.html
new file mode 100644
index 000000000..29de29c91
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008-1.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+onpagehide = parent.t.step_func(function() {parent.t.done()});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008.html
new file mode 100644
index 000000000..015507d81
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>pagehide IDL attribute</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var iframe;
+var t = async_test();
+onload = function() {
+ setTimeout(function() {
+ var iframe = document.getElementsByTagName("iframe")[0];
+ iframe.src="about:blank";
+ }, 100)
+};
+</script>
+<iframe src="008-1.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009-1.html
new file mode 100644
index 000000000..d69a05914
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009-1.html
@@ -0,0 +1,4 @@
+<!doctype html>
+<script>
+onunload = parent.t.step_func(function() {parent.t.done()});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009.html
new file mode 100644
index 000000000..0e93e0470
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>unload IDL attribute</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var iframe;
+var t = async_test();
+onload = function() {
+ setTimeout(function() {
+ var iframe = document.getElementsByTagName("iframe")[0];
+ iframe.src="about:blank";
+ }, 100)
+}
+</script>
+<iframe src="009-1.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/MANIFEST b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/MANIFEST
new file mode 100644
index 000000000..637d35cf3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/MANIFEST
@@ -0,0 +1,21 @@
+support 001-1.html
+support 001-2.html
+001.html
+support 002-1.html
+002.html
+support 003-1.html
+003.html
+support 004-1.html
+004.html
+support 006-1.html
+support 006-2.html
+006.html
+support 007-1.html
+support 007-2.html
+007.html
+support 008-1.html
+008.html
+support 009-1.html
+009.html
+manual manual-001-1.html
+manual manual-001.html
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001-1.html
new file mode 100644
index 000000000..3da0a0de3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001-1.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<p>Now go back. PASS should be displayed after a short pause
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001.html
new file mode 100644
index 000000000..6d817a111
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<title>Document salvagable state after setting pagehide handler</title>
+<script>onpagehide = function() {setTimeout(function(){document.body.innerHTML = "PASS"}, 100)}</script>
+<p>Click the link below then navigate back to this page. Shortly after returning you should see the text "PASS"</p>
+<p><A href="manual-001-1.html">Click here</a>
diff --git a/testing/web-platform/tests/html/browsers/history/.gitkeep b/testing/web-platform/tests/html/browsers/history/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/history/history-notes/.gitkeep b/testing/web-platform/tests/html/browsers/history/history-notes/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/history-notes/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-child1.html b/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-child1.html
new file mode 100644
index 000000000..22bb0b298
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-child1.html
@@ -0,0 +1,18 @@
+<body>
+ <a id="link" href="joint-session-history-child2.html">Child1</a>.
+ <iframe id="grandchild"></iframe>
+</body>
+<script>
+ window.onload = function() {
+ var link = document.getElementById("link");
+ var grandchild = document.getElementById("grandchild");
+ var timer = window.setInterval(poll, 100);
+ function poll() {
+ if (grandchild.getAttribute("data-grandchild-loaded")) {
+ window.clearInterval(timer);
+ link.click();
+ }
+ }
+ grandchild.src="joint-session-history-grandchild1.html";
+ };
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-child2.html b/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-child2.html
new file mode 100644
index 000000000..24b469516
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-child2.html
@@ -0,0 +1,5 @@
+<body>Child 2.</body>
+<script>
+ // Servo doesn't support postMessage yet, so we poll on attributes.
+ window.frameElement.setAttribute("data-child-loaded", true);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-grandchild1.html b/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-grandchild1.html
new file mode 100644
index 000000000..d05e15242
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-grandchild1.html
@@ -0,0 +1,8 @@
+<body>
+ <a id="link" href="joint-session-history-grandchild2.html">Grandchild1</a>.
+</body>
+<script>
+ window.onload = function() {
+ document.getElementById("link").click();
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-grandchild2.html b/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-grandchild2.html
new file mode 100644
index 000000000..b5c81e1fc
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-grandchild2.html
@@ -0,0 +1,5 @@
+<body>Grandchild2.</body>
+<script>
+ // Servo doesn't support postMessage yet, so we poll on attributes.
+ window.frameElement.setAttribute("data-grandchild-loaded", true);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-only-fully-active.html b/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-only-fully-active.html
new file mode 100644
index 000000000..c42d160a2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/joint-session-history/joint-session-history-only-fully-active.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>Do only fully active documents count for session history?</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+ <iframe id="child"></iframe>
+</body>
+<script>
+ async_test(function(t) {
+ var old_history_len = window.history.length;
+ var child = document.getElementById("child");
+ var timer = window.setInterval(t.step_func(poll), 100);
+ function poll() {
+ if (child.getAttribute("data-child-loaded")) {
+ // Check to see how many entries have been added to the session history.
+ // The spec https://html.spec.whatwg.org/multipage/#joint-session-history
+ // says that only fully active documents are included in the joint session history.
+ // If only fully active documents count, then the only fully active document
+ // is the child, with session length 1, so the joint session length change will be 1.
+ // If all documents count, then the grandchild is reachable via the session history,
+ // and it has session length 1, so the joint session length change will be 2.
+ assert_equals(2, window.history.length - old_history_len);
+ window.clearInterval(timer);
+ t.done();
+ }
+ }
+ child.src = "joint-session-history-child1.html";
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/.gitkeep b/testing/web-platform/tests/html/browsers/history/the-history-interface/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/001.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/001.html
new file mode 100644
index 000000000..0e5632bbc
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/001.html
@@ -0,0 +1,333 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.pushState tests</title>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+ <script type="text/javascript">
+//does not test for firing of popstate onload, because this was dropped from the specification on 25 March 2011
+//covers history.state after load, in accordance with the specification draft from 25 March 2011
+//history.state before load is tested in 006 and 007
+//does not test for structured cloning of FileList, File or Blob interfaces, as these require manual file selection
+
+//**This test assumes that assignments to location.hash will be synchronous - this is how all browsers implement it.
+//The spec (as of 25 March 2011) disagrees.**//
+
+var histlength, atstep = 0, lasttimer;
+setup({explicit_done:true}); //tests should take under 6 seconds + execution time
+
+window.onload = function () {
+ if( location.protocol == 'file:' ) {
+ document.getElementsByTagName('p')[0].innerHTML = 'ERROR: This test cannot be run from file: (URL resolving will not work). It must be loaded over HTTP.';
+ return;
+ } else if( location.protocol == 'https:' ) {
+ document.getElementsByTagName('p')[0].innerHTML += '<br>WARNING: Browsers may intentionally fail to update history.length when pages are loaded over HTTPS, as a privacy restriction. If possible, load this page over HTTP.';
+ }
+ //use a timeout, because some browsers intentionally do not add history entries for URL changes in the onload thread
+ setTimeout(testinit,100);
+};
+function testinit() {
+ atstep = 1;
+ histlength = history.length;
+ iframe = document.getElementsByTagName('iframe')[0].src = 'blank2.html';
+ //reportload will now be called by the onload handler for the iframe
+}
+function reportload() {
+ var iframe = document.getElementsByTagName('iframe')[0], hashchng = false;
+ var canvassup = false, cloneobj;
+
+ function tests1() {
+ //Firefox may fail when reloading, because it recovers iframe state, and therefore does not see the need to alter history length
+ test(function () { assert_equals( history.length, histlength + 1, 'make sure that you loaded the test in a new tab/window' ); }, 'history.length should update when loading pages in an iframe');
+ histlength = history.length;
+ iframe.contentWindow.location.hash = 'test'; //should be synchronous **SEE COMMENT AT TOP OF FILE
+ test(function () {
+ assert_equals( history.length, histlength + 1, 'make sure that you loaded the test in a new tab/window' );
+ }, 'history.length should update when setting location.hash');
+ test(function () { assert_true( !!history.pushState, 'critical test; ignore any failures after this' ); }, 'history.pushState must exist'); //assert_exists does not allow prototype inheritance
+ test(function () { assert_true( !!iframe.contentWindow.history.pushState, 'critical test; ignore any failures after this' ); }, 'history.pushState must exist within iframes');
+ test(function () {
+ assert_equals( iframe.contentWindow.history.state, null );
+ }, 'initial history.state should be null');
+ test(function () {
+ histlength = history.length;
+ iframe.contentWindow.history.pushState('','');
+ assert_equals( history.length, histlength + 1 );
+ }, 'history.length should update when pushing a state');
+ test(function () {
+ assert_equals( iframe.contentWindow.history.state, '' );
+ }, 'history.state should update after a state is pushed');
+ histlength = history.length;
+ history.back();
+ setTimeout(tests2,50); //.back is queued to end of thread
+ }
+ function tests2() {
+ test(function () {
+ assert_equals( history.length, histlength );
+ }, 'history.length should not decrease after going back');
+ test(function () {
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test' );
+ }, 'traversing history must traverse pushed states');
+ history.go(-1);
+ setTimeout(tests3,50); //.go is queued to end of thread
+ }
+ function tests3() {
+ test(function () {
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), '', '(this could cause other failures later on)' );
+ }, 'traversing history must also traverse hash changes');
+ //Safari 5.0.3 fails here - it navigates *this* document to the *iframe's* location, instead of just navigating the iframe
+ history.go(2);
+ setTimeout(tests4,50); //.go is queued to end of thread
+ }
+ function tests4() {
+ test(function () {
+ //Firefox 4 beta 11 has a messed up error object, which does not have the right error type or .SECURITY_ERR property
+ assert_throws('SECURITY_ERR',function () { history.pushState('','','//exa mple'); });
+ }, 'pushState must not be allowed to create invalid URLs');
+ test(function () {
+ assert_throws('SECURITY_ERR',function () { history.pushState('','','http://www.example.com/'); });
+ }, 'pushState must not be allowed to create cross-origin URLs');
+ test(function () {
+ assert_throws('SECURITY_ERR',function () { history.pushState('','','about:blank'); });
+ }, 'pushState must not be allowed to create cross-origin URLs (about:blank)');
+ test(function () {
+ assert_throws('SECURITY_ERR',function () { history.pushState('','','data:text/html,'); });
+ }, 'pushState must not be allowed to create cross-origin URLs (data:URI)');
+ test(function () {
+ assert_throws('SECURITY_ERR',function () { iframe.contentWindow.history.pushState('','','http://www.example.com/'); },iframe.contentWindow);
+ }, 'security errors are expected to be thrown in the context of the document that owns the history object');
+ test(function () {
+ iframe.contentWindow.location.hash = 'test2';
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test2', 'location.hash did not change when told to' );
+ }, 'location.hash must be allowed to change (part 1)');
+ history.go(-1);
+ setTimeout(tests5,50); //.go is queued to end of thread
+ }
+ function tests5() {
+ test(function () {
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test', 'location.hash did not change when going back' );
+ }, 'location.hash must be allowed to change (part 2)');
+ test(function () {
+ iframe.contentWindow.history.pushState('','');
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test', 'location.hash changed when an unrelated state was pushed' );
+ }, 'pushState must not alter location.hash when no URL is provided');
+ history.go(1); //should do nothing, since the pushState should have removed the forward history
+ setTimeout(tests6,50); //.go is queued to end of thread
+ }
+ function tests6() {
+ test(function () {
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test' );
+ }, 'pushState must remove all history after the current state');
+ test(function () {
+ iframe.contentWindow.history.pushState('','','#test3');
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test3' );
+ }, 'pushState must be able to set location.hash');
+ //begin setup for "remove any tasks queued by the history traversal task source"
+ iframe.contentWindow.location.hash = '#test4';
+ iframe.contentWindow.history.go(-1); //must be queued
+ try {
+ //must remove the queued navigation in the same browsing context
+ iframe.contentWindow.history.pushState('','');
+ } catch(unsuperr) {}
+ //allow the browser to mistakenly run the .go if it is going to
+ //do not put two .go commands in the same thread, in case the browser mistakenly calculates the history position when
+ //calling .go instead of when executing the traversal task - that could give a false PASS in the next test otherwise
+ setTimeout(tests7,50);
+ }
+ function tests7() {
+ iframe.contentWindow.history.go(-1); //must be queued, but should not be removed this time
+ setTimeout(tests8,50); //.go is queued to end of thread
+ }
+ function tests8() {
+ test(function () {
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test4' );
+ }, 'pushState must remove any tasks queued by the history traversal task source');
+ //end "remove any tasks queued by the history traversal task source"
+ window.addEventListener('hashchange',function () { hashchng = true; },false);
+ try {
+ //push a state that changes the hash
+ iframe.contentWindow.history.pushState('','',iframe.contentWindow.location.pathname+'#test5');
+ } catch(unsuperr) {}
+ setTimeout(tests9,50); //allow the hashchange event to process, if the browser has mistakenly fired it
+ }
+ function tests9() {
+ test(function () {
+ assert_false( hashchng );
+ }, 'pushState must not fire hashchange events');
+ test(function () {
+ iframe.contentWindow.history.pushState('','','/testing_ignore_me_404');
+ assert_equals( iframe.contentWindow.location.pathname, '/testing_ignore_me_404' );
+ }, 'pushState must be able to set location.pathname');
+ test(function () {
+ var newURL = location.href.replace(/\/[^\/]*$/)+'/testing_ignore_me_404/';
+ iframe.contentWindow.history.pushState('','',newURL);
+ assert_equals( iframe.contentWindow.location.href, newURL );
+ }, 'pushState must be able to set absolute URLs to the same host');
+ test(function () {
+ assert_throws( 'DATA_CLONE_ERR', function () {
+ history.pushState({dummy:function () {}},'');
+ } );
+ }, 'pushState must not be able to use a function as data');
+ test(function () {
+ assert_throws( 'DATA_CLONE_ERR', function () {
+ history.pushState({dummy:window},'');
+ } );
+ }, 'pushState must not be able to use a DOM node as data');
+ test(function () {
+ try { a.b = c; } catch(errdata) {
+ assert_throws( 'DATA_CLONE_ERR', function () {
+ history.pushState({dummy:errdata},'');
+ } );
+ }
+ }, 'pushState must not be able to use an error object as data');
+ test(function () {
+ assert_throws( 'DATA_CLONE_ERR', function () {
+ iframe.contentWindow.history.pushState(document,'');
+ }, iframe.contentWindow );
+ }, 'security errors are expected to be thrown in the context of the document that owns the history object (2)');
+ cloneobj = {
+ nulldata: null,
+ udefdata: window.undefined,
+ booldata: true,
+ numdata: 1,
+ strdata: 'string data',
+ boolobj: new Boolean(true),
+ numobj: new Number(1),
+ strobj: new String('string data'),
+ datedata: new Date(),
+ regdata: /a/g,
+ arrdata: [1]
+ };
+ cloneobj.regdata.lastIndex = 1;
+ cloneobj.looped = cloneobj;
+ //test the ImageData type, if the browser supports it
+ var canvas = document.createElement('canvas');
+ if( canvas.getContext && ( canvas = canvas.getContext('2d') ) && canvas.createImageData ) {
+ canvassup = true;
+ cloneobj.imgdata = canvas.createImageData(1,1);
+ }
+ test(function () {
+ try {
+ iframe.contentWindow.history.pushState(cloneobj,'new title');
+ } catch(e) {
+ cloneobj.looped = null;
+ //try again because this object is needed for future tests
+ iframe.contentWindow.history.pushState(cloneobj,'new title');
+ //rethrow so the browser gets a FAIL for not coping with the circular reference; "internal structured cloning algorithm" step 1
+ throw(e);
+ }
+ }, 'pushState must be able to make structured clones of complex objects');
+ test(function () {
+ assert_equals( iframe.contentWindow.history.state && iframe.contentWindow.history.state.strdata, 'string data' );
+ }, 'history.state should also reference a clone of the original object');
+ test(function () {
+ assert_false( cloneobj === iframe.contentWindow.history.state );
+ }, 'history.state should be a clone of the original object, not a reference to it');
+ /*
+ behaviour is not defined per spec, and no known implementations do this
+ test(function () {
+ assert_equals( iframe.contentDocument.title, 'new title', 'not required for specification conformance' );
+ }, 'pushState MIGHT set the document title');
+ */
+ history.go(-1);
+ setTimeout(tests10,50); //.go is queued to end of thread
+ }
+ function tests10() {
+ var eventtime = setTimeout(function () { tests11(false); },500); //should be cleared by the event handler long before it has a chance to fire
+ iframe.contentWindow.addEventListener('popstate',function (e) { clearTimeout(eventtime); tests11(true,e); },false);
+ history.forward();
+ }
+ function tests11(hasFired,ev) {
+ test(function () {
+ assert_true( hasFired );
+ }, 'popstate event should fire when navigation occurs');
+ test(function () {
+ assert_true( !!ev && typeof(ev.state) != 'undefined', 'state information was not passed' );
+ assert_true( !!ev.state, 'state information does not contain the expected value - browser is probably stuck in the wrong history position' );
+ assert_equals( ev.state.nulldata, null, 'state null data was not correct' );
+ assert_equals( ev.state.udefdata, window.undefined, 'state undefined data was not correct' );
+ assert_true( ev.state.booldata, 'state boolean data was not correct' );
+ assert_equals( ev.state.numdata, 1, 'state numeric data was not correct' );
+ assert_equals( ev.state.strdata, 'string data', 'state string data was not correct' );
+ assert_true( !!ev.state.datedata.getTime, 'state date data was not correct' );
+ assert_exists( ev.state, 'regdata', 'state regex data was not correct' );
+ assert_equals( ev.state.regdata.source, 'a', 'state regex pattern data was not correct' );
+ assert_true( ev.state.regdata.global, 'state regex flag data was not correct' );
+ assert_equals( ev.state.regdata.lastIndex, 0, 'state regex lastIndex data was not correct' );
+ assert_equals( ev.state.arrdata.length, 1, 'state array data was not correct' );
+ assert_true( ev.state.boolobj.valueOf(), 'state boolean data was not correct' );
+ assert_equals( ev.state.numobj.valueOf(), 1, 'state numeric data was not correct' );
+ assert_equals( ev.state.strobj.valueOf(), 'string data', 'state string data was not correct' );
+ if( canvassup ) {
+ assert_equals( ev.state.imgdata.width, 1, 'state ImageData was not correct' );
+ }
+ }, 'popstate event should pass the state data');
+ test(function () {
+ assert_equals( ev.state.looped, ev.state );
+ }, 'state data should cope with circular object references');
+ test(function () {
+ assert_false( cloneobj === ev.state );
+ }, 'state data should be a clone of the original object, not a reference to it');
+ test(function () {
+ assert_equals( iframe.contentWindow.history.state && iframe.contentWindow.history.state.strdata, 'string data' );
+ }, 'history.state should also reference a clone of the original object (2)');
+ test(function () {
+ assert_false( cloneobj === iframe.contentWindow.history.state );
+ }, 'history.state should be a clone of the original object, not a reference to it (2)');
+ test(function () {
+ assert_false( iframe.contentWindow.history.state === ev.state );
+ }, 'history.state should be a separate clone of the object, not a reference to the object passed to the event handler');
+ try {
+ iframe.contentWindow.persistval = true;
+ iframe.contentWindow.history.pushState('','', location.href.replace(/\/[^\/]*$/,'/blank3.html') );
+ } catch(unsuperr) {}
+ //it's already cached, so this should be very fast if the browser mistakenly loads it
+ //it should not need to load at all, since it's just a pushed state
+ setTimeout(tests12,1000);
+ }
+ function tests12() {
+ test(function () {
+ assert_true( iframe.contentWindow.persistval && !iframe.contentWindow.forreal );
+ }, 'pushState should not actually load the new URL');
+ atstep = 3;
+ iframe.contentWindow.location.reload(); //load the real URL
+ lasttimer = setTimeout(function () { tests13(false); },3000); //should be cleared by the onload handler long before it has a chance to fire
+ }
+ function tests13(passed) {
+ test(function () {
+ assert_true( passed, 'expected a load event to fire when reloading the URL from cache, gave up waiting after 3 seconds' );
+ }, 'reloading a pushed state should actually load the new URL');
+ //try to make browsers behave when reloading so that the correct URL is recovered - does not always work
+ iframe.contentWindow.location.href = location.href.replace(/\/[^\/]*$/,'/blank.html');
+ done();
+ }
+
+ if( atstep == 1 ) {
+ //blank2 has loaded
+ atstep = 2;
+ //use a timeout, because some browsers intentionally do not add history entries for URL changes in an onload thread
+ setTimeout(tests1,100);
+ } else if( atstep == 3 ) {
+ //blank3 should now have loaded after the .reload() command
+ atstep = 4;
+ clearTimeout(lasttimer);
+ tests13(true);
+ }
+}
+
+
+
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>WARNING: This test should always be loaded in a new tab/window, to avoid browsers attempting to recover the state of frames, and history length. Do not reload the test.</p>
+ <div id="log">Running test...</div>
+ <p><iframe onload="reportload();" src="blank.html"></iframe></p>
+ <p><iframe src="blank.html"></iframe></p>
+ <p><iframe src="blank2.html"></iframe></p>
+ <p><iframe src="blank3.html"></iframe></p>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/002.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/002.html
new file mode 100644
index 000000000..eb0c15aab
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/002.html
@@ -0,0 +1,308 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.replaceState tests</title>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+ <script type="text/javascript">
+//does not test for firing of popstate onload, because this was dropped from the specification on 25 March 2011
+//covers history.state after load, in accordance with the specification draft from 25 March 2011
+//history.state before load is tested in 006 and 007
+//does not test for structured cloning of FileList, File or Blob interfaces, as these require manual file selection
+
+//**This test assumes that assignments to location.hash will be synchronous - this is how all browsers implement it.
+//The spec (as of 25 March 2011) disagrees.
+
+var histlength, atstep = 0, lasttimer;
+setup({explicit_done:true}); //tests should take under 6 seconds + execution time
+
+window.onload = function () {
+ if( location.protocol == 'file:' ) {
+ document.getElementsByTagName('p')[0].innerHTML = 'ERROR: This test cannot be run from file: (URL resolving will not work). It must be loaded over HTTP.';
+ return;
+ } else if( location.protocol == 'https:' ) {
+ document.getElementsByTagName('p')[0].innerHTML += '<br>WARNING: Browsers may intentionally fail to update history.length when pages are loaded over HTTPS, as a privacy restriction. If possible, load this page over HTTP.';
+ }
+ //use a timeout, because some browsers intentionally do not add history entries for URL changes in the onload thread
+ setTimeout(testinit,100);
+};
+function testinit() {
+ atstep = 1;
+ histlength = history.length;
+ iframe = document.getElementsByTagName('iframe')[0].src = 'blank2.html';
+ //reportload will now be called by the onload handler for the iframe
+}
+function reportload() {
+ var iframe = document.getElementsByTagName('iframe')[0], hashchng = false;
+ var canvassup = false, cloneobj;
+
+ function tests1() {
+ test(function () { assert_equals( history.length, histlength + 1, 'make sure that you loaded the test in a new tab/window' ); }, 'history.length should update when loading pages in an iframe');
+ histlength = history.length;
+ iframe.contentWindow.location.hash = 'test'; //should be synchronous **SEE COMMENT AT TOP OF FILE
+ test(function () {
+ assert_equals( history.length, histlength + 1, 'make sure that you loaded the test in a new tab/window' );
+ }, 'history.length should update when setting location.hash');
+ test(function () { assert_true( !!history.replaceState, 'critical test; ignore any failures after this' ); }, 'history.replaceState must exist'); //assert_exists does not allow prototype inheritance
+ test(function () { assert_true( !!iframe.contentWindow.history.replaceState, 'critical test; ignore any failures after this' ); }, 'history.replaceState must exist within iframes');
+ test(function () {
+ assert_equals( iframe.contentWindow.history.state, null );
+ }, 'initial history.state should be null');
+ iframe.contentWindow.location.hash = 'test2';
+ history.back();
+ setTimeout(tests2,50); //.go is queued to end of thread
+ }
+ function tests2() {
+ test(function () {
+ histlength = history.length;
+ iframe.contentWindow.history.replaceState('','');
+ assert_equals( history.length, histlength );
+ }, 'history.length should not update when replacing a state with no URL');
+ test(function () {
+ assert_equals( iframe.contentWindow.history.state, '' );
+ }, 'history.state should update after a state is pushed');
+ test(function () {
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test' );
+ }, 'hash should not change when replaceState is called without a URL');
+ test(function () {
+ histlength = history.length;
+ iframe.contentWindow.history.replaceState('','','#test3');
+ assert_equals( history.length, histlength );
+ }, 'history.length should not update when replacing a state with a URL');
+ test(function () {
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test3' );
+ }, 'hash should change when replaceState is called with a URL');
+ history.go(-1);
+ setTimeout(tests3,50); //.go is queued to end of thread
+ }
+ function tests3() {
+ test(function () {
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), '' );
+ }, 'replaceState must replace the existing state and not add an extra one');
+ history.go(2);
+ setTimeout(tests4,50); //.go is queued to end of thread
+ }
+ function tests4() {
+ test(function () {
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test2' );
+ }, 'replaceState must replace the existing state without altering the forward history');
+ test(function () {
+ assert_throws('SECURITY_ERR',function () { history.replaceState('','','//exa mple'); });
+ }, 'replaceState must not be allowed to create invalid URLs');
+ test(function () {
+ assert_throws('SECURITY_ERR',function () { history.replaceState('','','http://www.example.com/'); });
+ }, 'replaceState must not be allowed to create cross-origin URLs');
+ test(function () {
+ assert_throws('SECURITY_ERR',function () { history.replaceState('','','about:blank'); });
+ }, 'replaceState must not be allowed to create cross-origin URLs (about:blank)');
+ test(function () {
+ assert_throws('SECURITY_ERR',function () { history.replaceState('','','data:text/html,'); });
+ }, 'replaceState must not be allowed to create cross-origin URLs (data:URI)');
+ test(function () {
+ assert_throws('SECURITY_ERR',function () { iframe.contentWindow.history.replaceState('','','http://www.example.com/'); },iframe.contentWindow);
+ }, 'security errors are expected to be thrown in the context of the document that owns the history object');
+ test(function () {
+ //avoids browsers running .go synchronously when only a hash change is involved
+ iframe.contentWindow.history.replaceState('','','/testing_ignore_me_404#test4');
+ assert_equals( iframe.contentWindow.location.pathname, '/testing_ignore_me_404' );
+ }, 'replaceState must be able to set location.pathname');
+ test(function () {
+ var newURL = location.href.replace(/\/[^\/]*$/)+'/testing_ignore_me_404/';
+ iframe.contentWindow.history.replaceState('','',newURL);
+ assert_equals( iframe.contentWindow.location.href, newURL );
+ }, 'replaceState must be able to set absolute URLs to the same host');
+ //begin setup for "[must not] remove any tasks queued by the history traversal task source"
+ iframe.contentWindow.history.go(-1); //must be queued so the next command takes place *beforehand*
+ try {
+ //must not remove the queued navigation in the same browsing context
+ iframe.contentWindow.history.replaceState('','',iframe.contentWindow.location.pathname+'#test5');
+ } catch(unsuperr2) {}
+ //allow the browser to run the .go
+ setTimeout(tests5,50);
+ }
+ function tests5() {
+ test(function () {
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test3' );
+ }, 'replaceState must not remove any tasks queued by the history traversal task source');
+ //Safari 5.0.3 fails here - it navigates *this* document to the *iframe's* location, instead of just navigating the iframe
+ history.go(1);
+ setTimeout(tests6,50); //.go is queued to end of thread
+ }
+ function tests6() {
+ test(function () {
+ assert_equals( iframe.contentWindow.location.hash.replace(/^#/,''), 'test5' );
+ }, '.go must queue a task with the history traversal task source (run asynchronously)');
+ //end "[must not] remove any tasks queued by the history traversal task source"
+ window.addEventListener('hashchange',function () { hashchng = true; },false);
+ try {
+ //push a state that changes the hash
+ iframe.contentWindow.history.replaceState('','',iframe.contentWindow.location.pathname+'#test6');
+ } catch(unsuperr) {}
+ setTimeout(tests7,50); //allow the hashchange event to process, if the browser has mistakenly fired it
+ }
+ function tests7() {
+ test(function () {
+ assert_false( hashchng );
+ }, 'replaceState must not fire hashchange events');
+ test(function () {
+ assert_throws( 'DATA_CLONE_ERR', function () {
+ history.replaceState({dummy:function () {}},'');
+ } );
+ }, 'replaceState must not be able to use a function as data');
+ test(function () {
+ assert_throws( 'DATA_CLONE_ERR', function () {
+ history.replaceState({dummy:window},'');
+ } );
+ }, 'replaceState must not be able to use a DOM node as data');
+ test(function () {
+ try { a.b = c; } catch(errdata) {
+ assert_throws( 'DATA_CLONE_ERR', function () {
+ history.replaceState({dummy:errdata},'');
+ } );
+ }
+ }, 'replaceState must not be able to use an error object as data');
+ test(function () {
+ assert_throws( 'DATA_CLONE_ERR', function () {
+ iframe.contentWindow.history.replaceState(document,'');
+ }, iframe.contentWindow );
+ }, 'security errors are expected to be thrown in the context of the document that owns the history object (2)');
+ cloneobj = {
+ nulldata: null,
+ udefdata: window.undefined,
+ booldata: true,
+ numdata: 1,
+ strdata: 'string data',
+ boolobj: new Boolean(true),
+ numobj: new Number(1),
+ strobj: new String('string data'),
+ datedata: new Date(),
+ regdata: /a/g,
+ arrdata: [1]
+ };
+ cloneobj.regdata.lastIndex = 1;
+ cloneobj.looped = cloneobj;
+ //test the ImageData type, if the browser supports it
+ var canvas = document.createElement('canvas');
+ if( canvas.getContext && ( canvas = canvas.getContext('2d') ) && canvas.createImageData ) {
+ canvassup = true;
+ cloneobj.imgdata = canvas.createImageData(1,1);
+ }
+ test(function () {
+ try {
+ iframe.contentWindow.history.replaceState(cloneobj,'new title');
+ } catch(e) {
+ cloneobj.looped = null;
+ //try again because this object is needed for future tests
+ iframe.contentWindow.history.replaceState(cloneobj,'new title');
+ //rethrow so the browser gets a FAIL for not coping with the circular reference; "internal structured cloning algorithm" step 1
+ throw(e);
+ }
+ }, 'replaceState must be able to make structured clones of complex objects');
+ test(function () {
+ assert_equals( iframe.contentWindow.history.state && iframe.contentWindow.history.state.strdata, 'string data' );
+ }, 'history.state should also reference a clone of the original object');
+ test(function () {
+ assert_false( cloneobj === iframe.contentWindow.history.state );
+ }, 'history.state should be a clone of the original object, not a reference to it');
+ history.go(-1);
+ setTimeout(tests8,50); //.go is queued to end of thread
+ }
+ function tests8() {
+ var eventtime = setTimeout(function () { tests9(false); },500); //should be cleared by the event handler long before it has a chance to fire
+ iframe.contentWindow.addEventListener('popstate',function (e) { clearTimeout(eventtime); tests9(true,e); },false);
+ history.forward();
+ }
+ function tests9(hasFired,ev) {
+ test(function () {
+ assert_true( hasFired );
+ }, 'popstate event should fire when navigation occurs');
+ test(function () {
+ assert_true( !!ev && typeof(ev.state) != 'undefined', 'state information was not passed' );
+ assert_true( !!ev.state, 'state information does not contain the expected value - browser is probably stuck in the wrong history position' );
+ assert_equals( ev.state.nulldata, null, 'state null data was not correct' );
+ assert_equals( ev.state.udefdata, window.undefined, 'state undefined data was not correct' );
+ assert_true( ev.state.booldata, 'state boolean data was not correct' );
+ assert_equals( ev.state.numdata, 1, 'state numeric data was not correct' );
+ assert_equals( ev.state.strdata, 'string data', 'state string data was not correct' );
+ assert_true( !!ev.state.datedata.getTime, 'state date data was not correct' );
+ assert_exists( ev.state, 'regdata', 'state regex data was not correct' );
+ assert_equals( ev.state.regdata.source, 'a', 'state regex pattern data was not correct' );
+ assert_true( ev.state.regdata.global, 'state regex flag data was not correct' );
+ assert_equals( ev.state.regdata.lastIndex, 0, 'state regex lastIndex data was not correct' );
+ assert_equals( ev.state.arrdata.length, 1, 'state array data was not correct' );
+ assert_true( ev.state.boolobj.valueOf(), 'state boolean data was not correct' );
+ assert_equals( ev.state.numobj.valueOf(), 1, 'state numeric data was not correct' );
+ assert_equals( ev.state.strobj.valueOf(), 'string data', 'state string data was not correct' );
+ if( canvassup ) {
+ assert_equals( ev.state.imgdata.width, 1, 'state ImageData was not correct' );
+ }
+ }, 'popstate event should pass the state data');
+ test(function () {
+ assert_equals( ev.state.looped, ev.state );
+ }, 'state data should cope with circular object references');
+ test(function () {
+ assert_false( cloneobj === ev.state );
+ }, 'state data should be a clone of the original object, not a reference to it');
+ test(function () {
+ assert_equals( iframe.contentWindow.history.state && iframe.contentWindow.history.state.strdata, 'string data' );
+ }, 'history.state should also reference a clone of the original object (2)');
+ test(function () {
+ assert_false( cloneobj === iframe.contentWindow.history.state );
+ }, 'history.state should be a clone of the original object, not a reference to it (2)');
+ test(function () {
+ assert_false( iframe.contentWindow.history.state === ev.state );
+ }, 'history.state should be a separate clone of the object, not a reference to the object passed to the event handler');
+ try {
+ iframe.contentWindow.persistval = true;
+ iframe.contentWindow.history.replaceState('','', location.href.replace(/\/[^\/]*$/,'/blank3.html') );
+ } catch(unsuperr) {}
+ //it's already cached, so this should be very fast if the browser mistakenly loads it
+ //it should not need to load at all, since it's just a pushed state
+ setTimeout(tests10,1000);
+ }
+ function tests10() {
+ test(function () {
+ assert_true( iframe.contentWindow.persistval && !iframe.contentWindow.forreal );
+ }, 'replaceState should not actually load the new URL');
+ atstep = 3;
+ iframe.contentWindow.location.reload(); //load the real URL
+ lasttimer = setTimeout(function () { tests11(false); },3000); //should be cleared by the onload handler long before it has a chance to fire
+ }
+ function tests11(passed) {
+ test(function () {
+ assert_true( passed, 'expected a load event to fire when reloading the URL from cache, gave up waiting after 3 seconds' );
+ }, 'reloading a replaced state should actually load the new URL');
+ //try to make browsers behave when reloading so that the correct URL is recovered - does not always work
+ iframe.contentWindow.location.href = location.href.replace(/\/[^\/]*$/,'/blank.html');
+ done();
+ }
+
+ if( atstep == 1 ) {
+ //blank2 has loaded
+ atstep = 2;
+ //use a timeout, because some browsers intentionally do not add history entries for URL changes in an onload thread
+ setTimeout(tests1,100);
+ } else if( atstep == 3 ) {
+ //blank3 should now have loaded after the .reload() command
+ atstep = 4;
+ clearTimeout(lasttimer);
+ tests11(true);
+ }
+}
+
+
+
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <p>WARNING: This test should always be loaded in a new tab/window, to avoid browsers attempting to recover the state of frames, and history length. Do not reload the test.</p>
+ <div id="log">Running test...</div>
+ <p><iframe onload="reportload();" src="blank.html"></iframe></p>
+ <p><iframe src="blank.html"></iframe></p>
+ <p><iframe src="blank2.html"></iframe></p>
+ <p><iframe src="blank3.html"></iframe></p>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/004.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/004.html
new file mode 100644
index 000000000..e69889724
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/004.html
@@ -0,0 +1,62 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Final history position for history.go should be calculated when executing the task</title>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+ <script type="text/javascript">
+setup({explicit_done:true});
+window.onload = function () {
+ var hashcount = 0;
+ if( location.hash && location.hash != '#' ) {
+ location.href = location.href.replace(/#.*$/,'');
+ return;
+ }
+ setTimeout(add1,100);
+ function add1() {
+ location.hash = '#foo';
+ setTimeout(add2,100);
+ }
+ function add2() {
+ location.hash = '#bar';
+ setTimeout(add3,100);
+ }
+ function add3() {
+ location.hash = '#baz';
+ setTimeout(dojumps,100);
+ }
+ function dojumps() {
+ window.onhashchange = function () {
+ hashcount++;
+ };
+ history.go(-2);
+ test(function () {
+ //many browsers special-case jumps that only imply hash changes and will do them synchronously - the spec does allow this
+ assert_equals( hashcount, 0, 'hashchange fired even though the location should not have changed' );
+ assert_equals( location.hash.replace(/^#/,''), 'baz', 'the browser navigated synchronously' );
+ }, '.go commands should be queued until the thread has ended');
+ history.go(-1);
+ setTimeout(checkjumps,100);
+ }
+ function checkjumps() {
+ test(function () {
+ assert_true( !!hashcount, 'this testcase requires haschange support; the test cannot be used in this browser' );
+ }, 'browser needs to support hashchange events for this testcase');
+ test(function () {
+ assert_equals( hashcount, 2, 'the wrong number of queued commands were executed' );
+ }, 'queued .go commands should all be executed when the queue is processed');
+ test(function () {
+ assert_equals( location.hash.replace(/^#/,''), '' );
+ }, 'history position should be calculated when executing, not when calling the .go command');
+ done();
+ }
+};
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/005.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/005.html
new file mode 100644
index 000000000..2152e85a3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/005.html
@@ -0,0 +1,47 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Popstate event listener registration</title>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+ <script type="text/javascript">
+
+//this test checks that onpopstate works on the body element
+
+var readyForPop = false, bodypop = false, inlinepop = false;
+setup({explicit_done:true});
+
+//use a timeout to avoid "popstate fires onload" from setting the variables too early
+setTimeout(step1,1000);
+function step1() {
+ readyForPop = true;
+ test(function () {
+ history.pushState('','');
+ history.pushState('','');
+ }, 'history.pushState support is needed for this testcase');
+ history.go(-1);
+ setTimeout(step2,50); //.go is queued to end of thread
+}
+function step2() {
+ test(function () {
+ assert_true( bodypop );
+ }, '<body onpopstate="..."> should register a listener for the popstate event');
+ window.onpopstate = function () { inlinepop = true; };
+ history.go(-1);
+ setTimeout(step3,50); //.go is queued to end of thread
+}
+function step3() {
+ test(function () {
+ assert_true( inlinepop );
+ }, 'window.onpopstate should register a listener for the popstate event');
+ done();
+}
+ </script>
+ </head>
+ <body onpopstate="if( readyForPop ) { bodypop = true; }">
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/006.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/006.html
new file mode 100644
index 000000000..442b6f8f1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/006.html
@@ -0,0 +1,53 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Firing popstate after onload, even if there is no pushed/replaced state</title>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+ <script type="text/javascript">
+
+//spec (25 March 2011 draft) states that popstate must not fire after onload unless there is a pushed/replaced state that is navigated
+var popfired = false;
+setup({explicit_done:true});
+window.addEventListener('popstate',function (e) { popfired = true; },false);
+test(function () {
+ assert_equals( history.state, null );
+}, 'history.state should initially be null');
+window.onload = function () {
+ test(function () {
+ assert_false( popfired );
+ }, 'popstate event should not fire before onload fires');
+ test(function () {
+ assert_equals( history.state, null );
+ }, 'history.state should still be null onload');
+ popfired = false;
+ setTimeout(function () {
+ test(function () {
+ assert_false( popfired );
+ }, 'popstate event should not fire after onload fires');
+ test(function () {
+ assert_equals( history.state, null );
+ }, 'history.state should still be null after onload');
+ test(function () {
+ var failed = false, realstate = history.state;
+ try {
+ history.state = '';
+ } catch(e) {
+ failed = e;
+ }
+ assert_equals(history.state,realstate,'property was read/write');
+ assert_false(failed);
+ }, 'writing to history.state should be silently ignored and not throw an error');
+ done();
+ },100);
+};
+
+ </script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/007.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/007.html
new file mode 100644
index 000000000..29ed8bf0e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/007.html
@@ -0,0 +1,56 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Firing popstate after onload with pushed state</title>
+ <meta name=timeout content=long>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log">It looks like the browser stopped loading the page when encountering a .go(-1) command pointing to a pushed state. This will break the tests.</div>
+ <script type="text/javascript">
+
+//spec (25 March 2011 draft) states that popstate must fire before onload if there is a pushed/replaced state that is navigated
+var popfired = false;
+setup({explicit_done:true});
+test(function () {
+ assert_equals( history.state, null );
+}, 'history.state should initially be null');
+window.addEventListener('popstate',function (e) { popfired = e.state; },false);
+test(function () {
+ history.pushState('state1','');
+ history.pushState('state2','');
+}, 'history.pushState support is needed for this testcase');
+test(function () {
+ assert_equals( history.state, 'state2' );
+}, 'history.state should reflect pushed state');
+if( history.pushState ) { history.go(-1); }
+window.onload = function () {
+ test(function () {
+ assert_true( !!popfired );
+ }, 'popstate event should fire before onload fires');
+ test(function () {
+ assert_equals( popfired, 'state1' );
+ }, 'the correct state should be restored when navigating during initial load');
+ test(function () {
+ assert_equals( history.state, 'state1' );
+ }, 'history.state should reflect the navigated state onload');
+ popfired = false;
+ setTimeout(function () {
+ test(function () {
+ assert_false( !!popfired );
+ }, 'popstate event should not fire after onload fires');
+ test(function () {
+ assert_equals( history.state, 'state1' );
+ }, 'history.state should reflect the navigated state after onload');
+ done();
+ if( history.pushState ) { history.go(-1); } //go back to the start to avoid state recovery when reloading
+ },100);
+};
+
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/008.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/008.html
new file mode 100644
index 000000000..c8071e315
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/008.html
@@ -0,0 +1,40 @@
+<!doctype html>
+<html>
+
+<!-- configure this test below to point to the script -->
+
+ <head>
+ <title>history.pushState/replaceState resolving</title>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+
+ <p></p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+ <script type="text/javascript">
+
+/*
+Location of the script (which must be hosted on a separate domain from this test) containing the test code:
+var beforehref = location.href;
+test(function () {
+ history.pushState('','','/testing_ignore_me_404');
+ assert_equals(location.href,beforehref.replace(/^(\w*:\/\/[^\/]*\/)[\w\W]*$/,'$1testing_ignore_me_404'));
+}, 'history.pushState URL resolving should be done relative to the document, not the script');
+test(function () {
+ history.replaceState('','','/testing_ignore_me_404_2');
+ assert_equals(location.href,beforehref.replace(/^(\w*:\/\/[^\/]*\/)[\w\W]*$/,'$1testing_ignore_me_404_2'));
+}, 'history.replaceState URL resolving should be done relative to the document, not the script');
+*/
+var scriptlocation = 'http://www.' + location.host + location.pathname.split("/").slice(0,-1).join("/") + "/008.js";
+
+if( location.protocol == 'file:' ) {
+ document.getElementsByTagName('p')[0].innerHTML = 'ERROR: This test cannot be run from file: (URL resolving will not work). It must be loaded over HTTP.';
+} else {
+ document.write('<script type="text\/javascript" src="'+scriptlocation+'"><\/script>');
+}
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/008.js b/testing/web-platform/tests/html/browsers/history/the-history-interface/008.js
new file mode 100644
index 000000000..96a1fe5d4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/008.js
@@ -0,0 +1,11 @@
+var beforehref = location.href;
+
+test(function () {
+ history.pushState('','','/testing_ignore_me_404');
+ assert_equals(location.href,beforehref.replace(/^(\w*:\/\/[^\/]*\/)[\w\W]*$/,'$1testing_ignore_me_404'));
+}, 'history.pushState URL resolving should be done relative to the document, not the script');
+
+test(function () {
+ history.replaceState('','','/testing_ignore_me_404_2');
+ assert_equals(location.href,beforehref.replace(/^(\w*:\/\/[^\/]*\/)[\w\W]*$/,'$1testing_ignore_me_404_2'));
+}, 'history.replaceState URL resolving should be done relative to the document, not the script');
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/009-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/009-1.html
new file mode 100644
index 000000000..00b72e8ec
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/009-1.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.pushState/replaceState and referer headers</title>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+ <script type="text/javascript">
+window.onload = function () {
+ setTimeout(function () {
+ try { history.pushState('','','009-2.html?1234'); } catch(e) {}
+ location.href = '009-3.html?pipe=sub';
+ },10);
+};
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/009-3.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/009-3.html
new file mode 100644
index 000000000..e58b8fa5e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/009-3.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.pushState/replaceState and referer headers</title>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+ <script type="text/javascript">
+var httpReferer = "{{headers[referer]}}";
+var lastUrl = location.href.replace(/\/[^\/]*$/,'\/009-2.html?1234');
+parent.test(function () {
+ parent.assert_equals( httpReferer, lastUrl );
+}, 'HTTP Referer should use the pushed state');
+parent.test(function () {
+ parent.assert_equals( document.referrer, lastUrl );
+}, 'document.referrer should use the pushed state');
+window.onload = function () {
+ setTimeout(function () {
+ try { history.pushState('','','009-4.html?2345'); } catch(e) {}
+ location.href = '009-5.html?pipe=sub';
+ },10);
+};
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/009-5.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/009-5.html
new file mode 100644
index 000000000..068a089af
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/009-5.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.pushState/replaceState and referer headers</title>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+ <script type="text/javascript">
+var httpReferer = unescape("{{headers[referer]}}");
+var lastUrl = location.href.replace(/\/[^\/]*$/,'\/009-4.html?2345');
+parent.test(function () {
+ parent.assert_equals( httpReferer, lastUrl );
+}, 'HTTP Referer should use the replaced state');
+parent.test(function () {
+ parent.assert_equals( document.referrer, lastUrl );
+}, 'document.referrer should use the replaced state');
+parent.done();
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/009.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/009.html
new file mode 100644
index 000000000..c1ae0bbe0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/009.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.pushState/replaceState and referer headers</title>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+ <script type="text/javascript">
+setup({explicit_done:true});
+var iframe = document.createElement('iframe');
+window.onload = function () {
+ iframe.setAttribute('src','009-1.html');
+ document.body.appendChild(iframe)
+};
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/010-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/010-1.html
new file mode 100644
index 000000000..683397745
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/010-1.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.pushState/replaceState and referer headers (before onload)</title>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+ <script type="text/javascript">
+try { history.pushState('','','010-2.html?1234'); } catch(e) {}
+location.href = '010-3.html?pipe=sub';
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/010-3.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/010-3.html
new file mode 100644
index 000000000..b80f56c3d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/010-3.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.pushState/replaceState and referer headers (before onload)</title>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+ <script type="text/javascript">
+ var httpReferer = "{{headers[referer]}}";
+var lastUrl = location.href.replace(/\/[^\/]*$/,'\/010-2.html?1234');
+parent.test(function () {
+ parent.assert_equals( httpReferer, lastUrl );
+}, 'HTTP Referer should use the pushed state (before onload)');
+parent.test(function () {
+ parent.assert_equals( document.referrer, lastUrl );
+}, 'document.referrer should use the pushed state (before onload)');
+try { history.pushState('','','010-4.html?2345'); } catch(e) {}
+location.href = '010-5.html?pipe=sub';
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/010-5.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/010-5.html
new file mode 100644
index 000000000..d150449eb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/010-5.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.pushState/replaceState and referer headers (before onload)</title>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+ <script type="text/javascript">
+var httpReferer = "{{headers[referer]}}";
+var lastUrl = location.href.replace(/\/[^\/]*$/,'\/010-4.html?2345');
+parent.test(function () {
+ parent.assert_equals( httpReferer, lastUrl );
+}, 'HTTP Referer should use the replaced state (before onload)');
+parent.test(function () {
+ parent.assert_equals( document.referrer, lastUrl );
+}, 'document.referrer should use the replaced state (before onload)');
+parent.done();
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/010.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/010.html
new file mode 100644
index 000000000..ca109a744
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/010.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.pushState/replaceState and referer headers (before onload)</title>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+ <script type="text/javascript">
+setup({explicit_done:true});
+var iframe = document.createElement('iframe');
+window.onload = function () {
+ iframe.setAttribute('src','010-1.html');
+ document.body.appendChild(iframe)
+};
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/011.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/011.html
new file mode 100644
index 000000000..4043aff7f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/011.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.pushState before onload</title>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+ <script type="text/javascript">
+var newUrl = location.href.replace(/\/[^\/]*$/,'\/011-1.html');
+setup({explicit_done:true});
+test(function () {
+ history.pushState('','','011-1.html');
+}, 'pushState should be able to set the location state');
+test(function () {
+ assert_equals( location.href, newUrl );
+}, 'pushed location should be reflected immediately');
+window.onload = function () {
+ setTimeout(function () {
+ test(function () {
+ assert_equals( location.href, newUrl );
+ }, 'pushed location should be retained after the page has loaded');
+ done();
+ },10);
+};
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/012.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/012.html
new file mode 100644
index 000000000..f5e625167
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/012.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <title>history.replaceState before onload</title>
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+ <div id="log"></div>
+ <script type="text/javascript">
+var newUrl = location.href.replace(/\/[^\/]*$/,'\/011-1.html');
+setup({explicit_done:true});
+test(function () {
+ history.replaceState('','','011-1.html');
+}, 'replaceState should be able to set the location state');
+test(function () {
+ assert_equals( location.href, newUrl );
+}, 'replaced location should be reflected immediately');
+window.onload = function () {
+ setTimeout(function () {
+ test(function () {
+ assert_equals( location.href, newUrl );
+ }, 'replaced location should be retained after the page has loaded');
+ done();
+ },10);
+};
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/blank.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/blank.html
new file mode 100644
index 000000000..89c8724c0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/blank.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Dummy page 1</title>
+ </head>
+ <body>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/blank2.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/blank2.html
new file mode 100644
index 000000000..f79982e32
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/blank2.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Dummy page 2</title>
+ </head>
+ <body>
+ <script type="text/javascript">
+if( self == top || !parent.reportload ) {
+ document.write("<p>FAIL. Browser got confused when navigating forwards, and navigated the whole window to the iframe's location, instead of just navigating the iframe. It is not possible to run the testsuite.<\/p>");
+}
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/blank3.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/blank3.html
new file mode 100644
index 000000000..2a8989f27
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/blank3.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Dummy page 3</title>
+ <script type="text/javascript">
+var forreal = true;
+ </script>
+ </head>
+ <body>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_001.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_001.html
new file mode 100644
index 000000000..21ba22f6f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_001.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>combination_history_001(Combine pushState and replaceSate methods.)</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ window.history.pushState(1, document.title, '?x=1');
+ assert_equals(history.state, 1, "first");
+
+ window.history.replaceState(2, document.title, '?x=1');
+ assert_equals(history.state, 2, "second")
+ }, "Combine pushState and replaceSate methods");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_002.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_002.html
new file mode 100644
index 000000000..29e82f51b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_002.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>combination_history_002(After calling of pushState method, check length.)</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ var first;
+ var second;
+ first = window.history.length;
+ window.history.pushState(1, document.title, '?x=1');
+ second = window.history.length;
+
+ assert_equals(second - first, 1, "second - first");
+ }, "After calling of pushState method, check length");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_003.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_003.html
new file mode 100644
index 000000000..7467d9b29
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_003.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>combination_history_003(After calling of pushState and replaceState methods, check length.)</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ var first;
+ var second;
+ var third;
+ first = window.history.length;
+ window.history.pushState(1, document.title, '?x=1');
+ second = window.history.length;
+ window.history.replaceState(2, document.title, '?x=2');
+ third = window.history.length;
+
+ assert_equals(second - first, 1, "second - first");
+ assert_equals(third, second, "third");
+ }, "After calling of pushState and replaceState methods, check length");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_004.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_004.html
new file mode 100644
index 000000000..4e38b5620
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_004.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>combination_history_004(After calling of back method, check length.)</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var t = async_test("After calling of back method, check length");
+
+ var last;
+ t.step(function () {
+ window.history.pushState(1, document.title, '?x=1');
+ window.history.pushState(2, document.title, '?x=2');
+ last = window.history.length;
+
+ window.history.back();
+ });
+
+ window.addEventListener('popstate', t.step_func(function(e) {
+ assert_equals(e.state, 1, "state");
+ assert_equals(window.history.length, last, "last");
+ t.done();
+ }), false);
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_005.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_005.html
new file mode 100644
index 000000000..448767801
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_005.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>combination_history_005(After calling of forward method, check length.)</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var t = async_test("After calling of forward method, check length");
+
+ var last;
+ var fired = false;
+ t.step(function () {
+ window.history.pushState(1, document.title, '?x=1');
+ window.history.pushState(2, document.title, '?x=2');
+ last = window.history.length;
+
+ window.history.back();
+ });
+
+ window.addEventListener('popstate', t.step_func(function(e) {
+ if(fired) {
+ assert_equals(e.state, 2, "state");
+ assert_equals(window.history.length, last, "last");
+ t.done();
+ }
+ fired = true;
+ window.history.forward();
+ }), false);
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_006.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_006.html
new file mode 100644
index 000000000..305f593c0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_006.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>combination_history_006(After calling of go method, check length.)</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var t = async_test("After calling of go method, check length");
+
+ var last;
+ t.step(function () {
+ window.history.pushState(1, document.title, '?x=1');
+ window.history.pushState(2, document.title, '?x=2');
+
+ last = window.history.length;
+
+ window.history.go(-1);
+ });
+
+ window.addEventListener('popstate', t.step_func(function(e) {
+ assert_equals(e.state, 1, "state");
+ assert_equals(window.history.length, last, "last");
+ t.done();
+ }), false);
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_007.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_007.html
new file mode 100644
index 000000000..cec9ea098
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/combination_history_007.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>combination_history_007(After calling of back and pushState method, check length.)</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var t = async_test("After calling of back and pushState method, check length");
+
+ var last;
+ t.step(function () {
+ window.history.pushState(1, document.title, '?x=1');
+ window.history.pushState(2, document.title, '?x=2');
+
+ last = window.history.length;
+
+ window.history.back();
+ });
+
+ window.addEventListener('popstate', t.step_func(function(e) {
+ assert_equals(e.state, 1, "state");
+ assert_equals(window.history.length, last, "last");
+ window.history.pushState(3, document.title, '?x=3');
+ assert_equals(window.history.length, last, "last");
+ t.done();
+ }), false);
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history.js b/testing/web-platform/tests/html/browsers/history/the-history-interface/history.js
new file mode 100644
index 000000000..bb5ee6dde
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history.js
@@ -0,0 +1,35 @@
+function parse_query() {
+ var query = location.search.slice(1);
+ var vars = query.split("&");
+ var fields = {};
+ vars.forEach(
+ function (x) {
+ var split = x.split("=");
+ return fields[split[0]] = split.slice(1).join("=");
+ });
+ return fields;
+}
+
+var query_parts = parse_query();
+var id = "id" in query_parts ? parseInt(query_parts.id) : 1;
+var urls_to_load = query_parts.urls.split(",");
+
+document.write(id);
+
+onunload = function() {};
+
+function queue_next() {
+ t = opener.t;
+ setTimeout(t.step_func(
+ function() {
+// opener.assert_equals(history.length, id);
+ if (urls_to_load[0]) {
+ var next_page = urls_to_load[0];
+ (next_page.indexOf("?") > -1) ? (next_page += "&") : (next_page += "?");
+ next_page += "urls=" + urls_to_load.slice(1).join(",");
+ next_page += "&id=" + ++id;
+ location = next_page;
+ }
+ }
+ ), 100);
+}
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_back-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_back-1.html
new file mode 100644
index 000000000..78547019f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_back-1.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onunload = function() {}
+
+ opener.pages.push(id);
+ if (!opener.started) {
+ onload = function() {
+ setTimeout(function() {
+ opener.started = true;
+ history.back();
+ }, 100);
+ }
+ } else {
+ opener.start_test_wait();
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_back.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_back.html
new file mode 100644
index 000000000..042da4e61
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_back.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>history_back</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var t = async_test("history back");
+
+ t.step(function () {
+ window.history.pushState(1, document.title, '?x=1');
+ window.history.pushState(2, document.title, '?x=2');
+
+ window.history.back();
+ });
+
+ window.addEventListener('popstate', t.step_func(function(e) {
+ assert_equals(e.state, 1, "history state");
+
+ t.done();
+ }), false);
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_back_1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_back_1.html
new file mode 100644
index 000000000..cc37ddd35
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_back_1.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title>history.back() with session history</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test(undefined, {timeout:5000});
+ started = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [2, 1], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=history_back-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_entry.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_entry.html
new file mode 100644
index 000000000..e5929ddbe
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_entry.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onload = function() {
+ if (!opener.started) {
+ queue_next();
+ } else {
+ opener.pages.push(id);
+ opener.start_test_wait();
+ }
+};
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward-1.html
new file mode 100644
index 000000000..5880eacf0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward-1.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onunload = function() {}
+
+ onload = function() {
+ if (!opener.started) {
+ queue_next();
+ } else {
+ opener.pages.push(id);
+ opener.start_test_wait();
+ history.forward();
+ }
+ };
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward-2.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward-2.html
new file mode 100644
index 000000000..c7a9a1068
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward-2.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onunload = function() {}
+
+ opener.pages.push(id);
+ if (!opener.started) {
+ onload = function() {
+ setTimeout(function() {
+ opener.started = true;
+ history.go(-1);
+ }, 100);
+ }
+ } else {
+ opener.start_test_wait();
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward.html
new file mode 100644
index 000000000..6c37f2521
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>history_forward</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var t = async_test("history forward");
+
+ var fired = false;
+ t.step(function () {
+ window.history.pushState(1, document.title, '?x=1');
+ window.history.pushState(2, document.title, '?x=2');
+
+ window.history.back();
+ });
+
+ window.addEventListener('popstate', t.step_func(function(e) {
+ if(fired) {
+ assert_equals(e.state, 2, "history state");
+
+ t.done();
+ }
+ fired = true;
+ window.history.forward();
+ }), false);
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward_1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward_1.html
new file mode 100644
index 000000000..3d119482c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_forward_1.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title>history.forward() with session history</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test(undefined, {timeout:5000});
+ started = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [3, 2, 3], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=history_forward-1.html,history_forward-2.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_minus.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_minus.html
new file mode 100644
index 000000000..b8fe75573
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_minus.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>history_go_minus</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var t = async_test("history go minus");
+
+ t.step(function () {
+ window.history.pushState(1, document.title, '?x=1');
+ window.history.pushState(2, document.title, '?x=2');
+
+ window.history.go(-1);
+ });
+
+ window.addEventListener('popstate', t.step_func(function(e) {
+ assert_equals(e.state, 1, "history state");
+
+ t.done();
+ }), false);
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_no_argument-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_no_argument-1.html
new file mode 100644
index 000000000..acd9bda31
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_no_argument-1.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onunload = function() {}
+
+ onload = function() {
+ if (!opener.started) {
+ queue_next();
+ } else {
+ opener.pages.push(id);
+ opener.start_test_wait();
+ if (!opener.gone) {
+ history.go();
+ opener.gone = true;
+ }
+ }
+ };
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_no_argument.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_no_argument.html
new file mode 100644
index 000000000..278cf86c2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_no_argument.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<title>history.go()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test(undefined, {timeout:5000});
+ started = false;
+ gone = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [3, 2, 2], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=history_go_no_argument-1.html,history_forward-2.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_plus.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_plus.html
new file mode 100644
index 000000000..74d4c588c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_plus.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>history_go_plus</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var t = async_test("history go plus");
+
+ var fired = false;
+ t.step(function () {
+ window.history.pushState(1, document.title, '?x=1');
+ window.history.pushState(2, document.title, '?x=2');
+
+ window.history.back();
+ });
+
+ window.addEventListener('popstate', t.step_func(function(e) {
+ if(fired) {
+ assert_equals(e.state, 2, "history state");
+
+ t.done();
+ }
+ fired = true;
+ window.history.go(1);
+
+ }), false);
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_undefined-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_undefined-1.html
new file mode 100644
index 000000000..5880eacf0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_undefined-1.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onunload = function() {}
+
+ onload = function() {
+ if (!opener.started) {
+ queue_next();
+ } else {
+ opener.pages.push(id);
+ opener.start_test_wait();
+ history.forward();
+ }
+ };
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_undefined.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_undefined.html
new file mode 100644
index 000000000..e2a40275e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_undefined.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title>history.forward() with session history</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test(undefined, {timeout:5000});
+ started = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [3, 2, 2], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=history_go_undefined-1.html,history_forward-2.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_zero-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_zero-1.html
new file mode 100644
index 000000000..d9d4f330b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_zero-1.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onunload = function() {}
+
+ onload = function() {
+ if (!opener.started) {
+ queue_next();
+ } else {
+ opener.pages.push(id);
+ opener.start_test_wait();
+ if (!opener.gone) {
+ history.go(0);
+ opener.gone = true;
+ }
+ }
+ };
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_zero.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_zero.html
new file mode 100644
index 000000000..685878383
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_go_zero.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<title>history.go(0)</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test(undefined, {timeout:5000});
+ started = false;
+ gone = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [3, 2, 2], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=history_go_zero-1.html,history_forward-2.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate.html
new file mode 100644
index 000000000..5180a3f6e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>history_pushState</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ window.history.pushState(1, document.title, '?x=1');
+ var state;
+ state = window.history.state;
+ assert_equals(state, 1, "history state");
+ }, "history pushState");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate_err.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate_err.html
new file mode 100644
index 000000000..82afc04f2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate_err.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>history_pushState SECURITY_ERR</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ assert_throws("SecurityError", function () {
+ window.history.pushState(1, document.title, 'http://www.microsoft.com/test.html');
+ });
+ }, "history pushState SECURITY_ERR");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate_nooptionalparam.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate_nooptionalparam.html
new file mode 100644
index 000000000..8e4b049a1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_pushstate_nooptionalparam.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>history_pushState_NoOptionalParam</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ window.history.pushState(1, document.title);
+
+ var state;
+ state = window.history.state;
+ assert_equals(state, 1, "history state");
+ }, "history pushState NoOptionalParam");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate.html
new file mode 100644
index 000000000..794c2f371
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>history_replaceState</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ window.history.replaceState(1, document.title, '?x=1');
+
+ var second;
+ second = window.history.state;
+ assert_equals(second, 1, "history state");
+ }, "history replaceState");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate_err.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate_err.html
new file mode 100644
index 000000000..3060cf1f1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate_err.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>history_replaceState SECURITY_ERR</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ assert_throws("SecurityError", function () {
+ window.history.replaceState(1, document.title, 'http://www.microsoft.com/test.html');
+ });
+ }, "history replaceState SECURITY_ERR");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate_nooptionalparam.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate_nooptionalparam.html
new file mode 100644
index 000000000..838467d78
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_replacestate_nooptionalparam.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>history_replaceStateNoOptionalParam</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ window.history.replaceState(1, document.title);
+
+ var second;
+ second = window.history.state;
+ assert_equals(second, 1, "history state");
+ }, "history replaceStateNoOptionalParam");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_state.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_state.html
new file mode 100644
index 000000000..2ee2356b1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_state.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>history_state</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ var first;
+ var second;
+
+ first = window.history.state;
+ window.history.pushState(1, document.title, '?x=1');
+
+ second = window.history.state;
+ assert_equals(first, null, "first");
+ assert_equals(second, 1, "second");
+ }, "history state");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/001-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/001-1.html
new file mode 100644
index 000000000..9aa5d30d1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/001-1.html
@@ -0,0 +1,72 @@
+<!doctype html>
+<script>
+var o = opener;
+
+var frameloaded = null;
+
+o.t.step(function() {o.assert_equals(history.length, 1)});
+
+onload = function () {
+ o.t.step(function() {
+ o.assert_equals(history.length, 1);
+ o.t.done();
+ });
+
+ o.t1.step(function() {
+ var iframe = document.createElement("iframe");
+ iframe.src = "filler.html?id=2";
+ document.body.appendChild(iframe);
+ frameloaded = o.t1.step_func(function () {
+ o.assert_equals(history.length, 1);
+ setTimeout(o.t1.step_func(function () {
+ o.assert_equals(history.length, 1);
+ iframe.src = "filler.html?id=3";
+ frameloaded = o.t2.step_func(function() {
+ o.assert_equals(history.length, 2);
+ history.go(-1);
+ frameloaded = o.t3.step_func(function() {
+ o.assert_equals(history.length, 2);
+ var parts = iframe.contentWindow.location.href.split("/")
+ o.assert_equals(parts[parts.length - 1], "filler.html?id=2");
+ o.t3.done();
+ o.t4.step(function() {
+ var iframe0 = document.getElementsByTagName("iframe")[0];
+ iframe0.src = "filler.html?id=4"
+ frameloaded = o.t4.step_func(function() {
+ o.assert_equals(history.length, 2);
+ var parts = iframe0.contentWindow.location.href.split("/")
+ o.assert_equals(parts[parts.length - 1], "filler.html?id=4");
+ //This is the point at which gecko and webkit stop running tests
+ history.go(-1);
+ frameloaded = o.t5.step_func(function() {
+ o.assert_equals(history.length, 2);
+ var parts = iframe0.contentWindow.location.href.split("/")
+ o.assert_equals(parts[parts.length - 1], "filler.html?id=1");
+ var parts = iframe.contentWindow.location.href.split("/")
+ o.assert_equals(parts[parts.length - 1], "filler.html?id=2");
+ history.go(1);
+ frameloaded = o.t6.step_func(function() {
+ o.assert_equals(history.length, 2);
+ var parts = iframe0.contentWindow.location.href.split("/")
+ o.assert_equals(parts[parts.length - 1], "filler.html?id=4");
+ var parts = iframe.contentWindow.location.href.split("/")
+ o.assert_equals(parts[parts.length - 1], "filler.html?id=2");
+ o.t6.done();
+ });
+ o.t5.done();
+ });
+ o.t4.done();
+ });
+ });
+ });
+ o.t2.done();
+ });
+ o.t1.done();
+ }, 500))
+ });
+ });
+
+}
+</script>
+
+<iframe src="filler.html?id=1"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/001.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/001.html
new file mode 100644
index 000000000..c9d1c6416
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/001.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<title>Joint session history with single iframe</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+setup({timeout:10000});
+var t = async_test("Session history length on initial load");
+var t1 = async_test("Session history length on adding new iframe");
+var t2 = async_test("Navigating second iframe");
+var t3 = async_test("Traversing history back (1)");
+var t4 = async_test("Navigating first iframe");
+var t5 = async_test("Traversing history back (2)");
+var t6 = async_test("Traversing history forward");
+var w = window.open("001-1.html");
+//add_completion_callback(function() {w.close()});
+</script>
+
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/002-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/002-1.html
new file mode 100644
index 000000000..ed69d679d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/002-1.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<script>
+var o = opener;
+
+var frameloaded = null;
+
+o.t.step(function() {o.assert_equals(history.length, 1)});
+
+onload = function () {
+ o.t.step(function() {
+ o.assert_equals(history.length, 1);
+ o.t.done();
+ });
+
+ o.t1.step(function() {
+ var iframe = document.createElement("iframe");
+ iframe.src = "filler.html?id=2";
+ document.body.appendChild(iframe);
+ o.assert_equals(history.length, 1);
+ frameloaded = o.t2.step_func(function() {
+ iframe.contentDocument.open();
+ iframe.contentDocument.write("3<script>onpageshow = function() {alert('pageshow'); parent.frameloaded()}<\/script>");
+ iframe.contentDocument.close();
+ frameloaded = o.t2.step_func(function () {
+ o.assert_equals(history.length, 2);
+ o.t2.done();
+ });
+ });
+ o.t1.done();
+ });
+
+}
+</script>
+
+<iframe src="filler.html?id=1"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/002.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/002.html
new file mode 100644
index 000000000..b08c19e52
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/002.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<title>Joint session history with single iframe</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+setup({timeout:10000});
+var t = async_test("Session history length on initial load");
+var t1 = async_test("Session history length on adding new iframe");
+var t2 = async_test("Navigating second iframe");
+<!-- var t3 = async_test("Traversing history back (1)"); -->
+<!-- var t4 = async_test("Navigating first iframe"); -->
+<!-- var t5 = async_test("Traversing history back (2)"); -->
+<!-- var t6 = async_test("Traversing history forward"); -->
+var w = window.open("002-1.html");
+//add_completion_callback(function() {w.close()});
+</script>
+
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/filler.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/filler.html
new file mode 100644
index 000000000..93e3c7ccf
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/filler.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<script>
+document.write(location.search)
+onpageshow = function() {if (parent.frameloaded) {parent.frameloaded()}}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/history.js b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/history.js
new file mode 100644
index 000000000..bb5ee6dde
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/history.js
@@ -0,0 +1,35 @@
+function parse_query() {
+ var query = location.search.slice(1);
+ var vars = query.split("&");
+ var fields = {};
+ vars.forEach(
+ function (x) {
+ var split = x.split("=");
+ return fields[split[0]] = split.slice(1).join("=");
+ });
+ return fields;
+}
+
+var query_parts = parse_query();
+var id = "id" in query_parts ? parseInt(query_parts.id) : 1;
+var urls_to_load = query_parts.urls.split(",");
+
+document.write(id);
+
+onunload = function() {};
+
+function queue_next() {
+ t = opener.t;
+ setTimeout(t.step_func(
+ function() {
+// opener.assert_equals(history.length, id);
+ if (urls_to_load[0]) {
+ var next_page = urls_to_load[0];
+ (next_page.indexOf("?") > -1) ? (next_page += "&") : (next_page += "?");
+ next_page += "urls=" + urls_to_load.slice(1).join(",");
+ next_page += "&id=" + ++id;
+ location = next_page;
+ }
+ }
+ ), 100);
+}
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/history_entry.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/history_entry.html
new file mode 100644
index 000000000..e5929ddbe
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/history_entry.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onload = function() {
+ if (!opener.started) {
+ queue_next();
+ } else {
+ opener.pages.push(id);
+ opener.start_test_wait();
+ }
+};
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_1-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_1-1.html
new file mode 100644
index 000000000..8c4401836
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_1-1.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onbeforeunload = function() {opener.beforeunload_ran = true; return "Opt to stay on the page"};
+
+ opener.pages.push(id);
+ if (!opener.started) {
+ onload = function() {
+ setTimeout(function() {
+ opener.started = true;
+ history.back();
+ }, 100);
+ }
+ }
+</script>
+<p>You should see/have seen a prompt asking if you want to leave the page.</p>
+<p>Opt to stay on the page</p>
+<button onclick="onbeforeunload = null; opener.start_test_wait(); document.getElementsByTagName('button')[0].disabled = true;">Click here</button>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_1-manual.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_1-manual.html
new file mode 100644
index 000000000..b1d0aed52
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_1-manual.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<title>Traversing the history, prompt in before unload, navigation denied</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ setup({timeout:3600000});
+ var t = async_test(undefined, {timeout:3600000});
+ started = false;
+ pages = []
+ timer = null;
+ beforeunload_ran = false;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_true(beforeunload_ran, "beforeunload event handler ran");
+ assert_array_equals(pages, [2], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=traverse_the_history_unload_prompt_1-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_2-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_2-1.html
new file mode 100644
index 000000000..608a579e6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_2-1.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onbeforeunload = function() {opener.beforeunload_ran = true; return "Opt to leave the page"};
+
+ opener.pages.push(id);
+ if (!opener.started) {
+ onload = function() {
+ setTimeout(function() {
+ opener.started = true;
+ history.back();
+ }, 100);
+ }
+ }
+</script>
+<p>You should see/have seen a prompt asking if you want to leave the page.</p>
+<p>Opt to leave the page</p>
+<p>If you weren't navigated away after opting to leave the page, that's a FAIL</p>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_2-manual.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_2-manual.html
new file mode 100644
index 000000000..d45a2afb1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_history_unload_prompt_2-manual.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<title>Traversing the history, prompt in before unload, navigation allowed</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ setup({timeout:3600000});
+ var t = async_test(undefined, {timeout:3600000});
+ started = false;
+ pages = []
+ timer = null;
+ beforeunload_ran = false;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_true(beforeunload_ran, "beforeunload event handler ran");
+ assert_array_equals(pages, [2,1], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=traverse_the_history_unload_prompt_2-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_session_history_unload_prompt_1-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_session_history_unload_prompt_1-1.html
new file mode 100644
index 000000000..c0079b6be
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_session_history_unload_prompt_1-1.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onunload = function(e) {opener.unload_ran = true; return "Now refuse to leave the current page"}
+
+ opener.pages.push(id);
+ if (!opener.started) {
+ onload = function() {
+ setTimeout(function() {
+ opener.started = true;
+ history.back();
+ }, 100);
+ }
+ } else {
+ opener.start_test_wait();
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_session_history_unload_prompt_1-manual.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_session_history_unload_prompt_1-manual.html
new file mode 100644
index 000000000..8154e8e47
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/non-automated/traverse_the_session_history_unload_prompt_1-manual.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<title>Traversing the history, unload event is fired on doucment</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test(undefined, {timeout:5000});
+ started = false;
+ pages = []
+ timer = null;
+ unload_ran = false;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [2], "Pages opened during history navigation");
+ assert_true(unload_ran, "Unload event handler ran");
+ t.done();
+ } finally {
+ // win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=traverse_the_history_unload_prompt_1-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_1-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_1-1.html
new file mode 100644
index 000000000..a11fcf2d2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_1-1.html
@@ -0,0 +1,18 @@
+<!doctype html>
+4
+<script>
+ onunload = function() {}
+
+ opener.pages.push(4);
+ if (!opener.started) {
+ onload = function() {
+ setTimeout(function() {
+ opener.started = true;
+ history.go(-2);
+ history.go(-1);
+ }, 100);
+ }
+ } else {
+ opener.start_test_wait();
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_1.html
new file mode 100644
index 000000000..11715583d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_1.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title>Multiple history traversals from the same task</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test();
+ started = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [4, 2], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ // win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html&urls=history_entry.html,history_entry.html,traverse_the_history_1-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_2-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_2-1.html
new file mode 100644
index 000000000..64920b4f4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_2-1.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ opener.pages.push(id);
+ if (!opener.started) {
+ onload = function() {
+ setTimeout(function() {
+ opener.started = true;
+ history.go(-3);
+ history.go(-2);
+ history.go(1);
+ }, 100);
+ }
+ } else {
+ opener.start_test_wait();
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_2.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_2.html
new file mode 100644
index 000000000..1d1003380
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_2.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title>Multiple history traversals, last would be aborted</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test();
+ started = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [6, 3], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ // win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=history_entry.html,history_entry.html,history_entry.html,history_entry.html,traverse_the_history_2-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_3-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_3-1.html
new file mode 100644
index 000000000..c49bfd384
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_3-1.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ opener.pages.push(id);
+ if (!opener.started) {
+ onload = function() {
+ setTimeout(function() {
+ opener.started = true;
+ history.go(-2);
+ history.go(-1);
+ history.go(3);
+ }, 100);
+ }
+ } else {
+ opener.start_test_wait();
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_3.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_3.html
new file mode 100644
index 000000000..51ed4eb39
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_3.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title>Multiple history traversals, last would be aborted</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test(undefined, {timeout:5000});
+ started = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [6, 3], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ // win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=history_entry.html,history_entry.html,history_entry.html,history_entry.html,traverse_the_history_2-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_4-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_4-1.html
new file mode 100644
index 000000000..cf7f72379
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_4-1.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ opener.pages.push(id);
+ if (!opener.started) {
+ onload = function() {
+ setTimeout(function() {
+ opener.started = true;
+ history.go(-10); //Outside the range
+ history.go(-1);
+ history.go(-2);
+ }, 100);
+ }
+ } else {
+ opener.start_test_wait();
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_4.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_4.html
new file mode 100644
index 000000000..651693011
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_4.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title>Multiple history traversals, last would be aborted</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test(undefined, {timeout:5000});
+ started = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [6, 5], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ // win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=history_entry.html,history_entry.html,history_entry.html,history_entry.html,traverse_the_history_4-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_5-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_5-1.html
new file mode 100644
index 000000000..a3f2553fa
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_5-1.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ opener.pages.push(id);
+ if (!opener.started) {
+ onload = function() {
+ setTimeout(function() {
+ opener.started = true;
+ history.go(10); //Outside the range
+ history.go(-1);
+ history.go(-2);
+ }, 100);
+ }
+ } else {
+ opener.start_test_wait();
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_5.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_5.html
new file mode 100644
index 000000000..837f265b5
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_5.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title>Multiple history traversals, last would be aborted</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test(undefined, {timeout:5000});
+ started = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [6, 5], "Pages opened during history navigation");
+ t.done();
+ } finally {
+ // win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=history_entry.html,history_entry.html,history_entry.html,history_entry.html,traverse_the_history_5-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_unload_1-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_unload_1-1.html
new file mode 100644
index 000000000..d3f3f6d5d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_unload_1-1.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<script src="history.js"></script>
+<script>
+ onunload = function() {opener.unload_ran = true;}
+
+ opener.pages.push(id);
+ if (!opener.started) {
+ onload = function() {
+ setTimeout(function() {
+ opener.started = true;
+ history.back();
+ }, 100);
+ }
+ } else {
+ opener.start_test_wait();
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_unload_1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_unload_1.html
new file mode 100644
index 000000000..5a72dd635
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_unload_1.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<title>Traversing the history, unload event is fired on doucment</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test(undefined, {timeout:5000});
+ started = false;
+ pages = []
+ timer = null;
+ unload_ran = false;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ assert_array_equals(pages, [2, 1], "Pages opened during history navigation");
+ assert_true(unload_ran, "Unload event handler ran");
+ t.done();
+ } finally {
+ // win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=traverse_the_history_unload_1-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1-1.html
new file mode 100644
index 000000000..af0118a01
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1-1.html
@@ -0,0 +1,15 @@
+<!doctype html>
+2
+<script>
+ onunload = function() {}
+ opener.pages.push(2);
+ onload = function() {
+ setTimeout(function() {
+ document.write("<!doctype html>3<script>opener.pages.push(3); if(!opener.started) {opener.started = true; history.go(-1);} opener.start_test_wait();<\/script>");
+ document.close();
+ if (opener.started) {
+ opener.start_test_wait();
+ }
+ }, 100);
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html
new file mode 100644
index 000000000..c2c31e76f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<title>Traverse the history after document.write after the load event</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test();
+ started = false;
+ pages = []
+ start_test_wait = t.step_func(
+ function() {
+ check_result = t.step_func(
+ function() {
+ if (pages.length < 4) {
+ setTimeout(check_result, 500);
+ return
+ }
+ //The pass condition here is based on the idea that the spec is wrong and browsers are right
+ assert_array_equals(pages, [2, 3, 2, 3], "Pages opened during history navigation");
+ t.done();
+ }
+ )
+ setTimeout(check_result, 500);
+ }
+ );
+ t.step(function() {
+ win = window.open("history_entry.html?urls=traverse_the_history_write_after_load_1-1.html");
+ t.add_cleanup(function() {win.close()});
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_2-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_2-1.html
new file mode 100644
index 000000000..0e58cf573
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_2-1.html
@@ -0,0 +1,12 @@
+<!doctype html>
+3
+<script>
+ onunload = function() {}
+ opener.pages.push(3);
+ onload = function() {
+ document.write("<!doctype html>4<script>opener.pages.push(4); if(!opener.started) {opener.started = true; history.go(-2);} opener.start_test_wait();<\/script>");
+ if (opener.started) {
+ opener.start_test_wait();
+ }
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_2.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_2.html
new file mode 100644
index 000000000..28e363f91
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_2.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<title>Traverse the history back and forward when a history entry is written after the load event</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test();
+ started = false;
+ pages = []
+ start_test_wait = t.step_func(
+ function() {
+ var check_result = t.step_func(function() {
+ if (pages.length < 5) {
+ setTimeout(check_result, 500);
+ return
+ }
+ //The pass condition here is based on the idea that the spec is wrong and browsers are right
+ assert_array_equals(pages, [3, 4, 2, 3, 4], "Pages opened during history navigation");
+ t.done();
+ });
+ setTimeout(check_result, 500);
+ }
+ );
+ t.step(function() {
+ win = window.open("history_entry.html?urls=history_forward-1.html,traverse_the_history_write_onload_2-1.html");
+ t.add_cleanup(function() {win.close()});
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_1-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_1-1.html
new file mode 100644
index 000000000..261955533
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_1-1.html
@@ -0,0 +1,12 @@
+<!doctype html>
+2
+<script>
+ onunload = function() {}
+ opener.pages.push(2);
+ onload = function() {
+ document.write("<!doctype html>3<script>opener.pages.push(3); if(!opener.started) {opener.started = true; history.go(-1);} opener.start_test_wait();<\/script>");
+ if (opener.started) {
+ opener.start_test_wait();
+ }
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_1.html
new file mode 100644
index 000000000..ff2729c3c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_1.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<title>Traverse the history when a history entry is written in the load event</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test();
+ started = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ //The pass condition here is based on the idea that the spec is wrong and browsers are right
+ assert_array_equals(pages, [2, 3, 1], "Pages opened durning history navigation");
+ t.done();
+ } finally {
+ // win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=traverse_the_history_write_onload_1-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_2-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_2-1.html
new file mode 100644
index 000000000..f32bee5e1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_2-1.html
@@ -0,0 +1,12 @@
+<!doctype html>
+3
+<script>
+ onunload = function() {}
+ opener.pages.push(3);
+ onload = function() {
+ document.write("<!doctype html>4<script>opener.pages.push(4); if(!opener.started) {opener.started = true; history.go(-1);} opener.start_test_wait();<\/script>");
+ if (opener.started) {
+ opener.start_test_wait();
+ }
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_2.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_2.html
new file mode 100644
index 000000000..bc29174b0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_onload_2.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<title>Traverse the history back and forward when a history entry is written in the load event</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var t = async_test();
+ started = false;
+ pages = []
+ timer = null;
+ start_test_wait = t.step_func(
+ function() {
+ clearTimeout(timer);
+ timer = setTimeout(t.step_func(
+ function() {
+ try {
+ //The pass condition here is based on the idea that the spec is wrong and browsers are right
+ assert_array_equals(pages, [3, 4, 2, 3, 4], "Pages opened durning history navigation");
+ t.done();
+ } finally {
+ win.close();
+ }
+ }
+ ), 500);
+ }
+ );
+ t.step(function() {win = window.open("history_entry.html?urls=history_forward-1.html,traverse_the_history_write_onload_2-1.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/.gitkeep b/testing/web-platform/tests/html/browsers/history/the-location-interface/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/allow_prototype_cycle_through_location.sub.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/allow_prototype_cycle_through_location.sub.html
new file mode 100644
index 000000000..f72ed1eaf
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/allow_prototype_cycle_through_location.sub.html
@@ -0,0 +1,197 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+
+ <title>Location objects' custom [[GetPrototypeOf]] trap permit [[Prototype]] chain cycles to be created through them</title>
+
+ <link rel="author" title="Jeff Walden" href="http://whereswalden.com/" />
+ <link rel="help" href="https://tc39.github.io/ecma262/#sec-ordinarysetprototypeof" />
+ <link rel="help" href="https://html.spec.whatwg.org/multipage/browsers.html#location-getprototypeof" />
+
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+
+<hr />
+
+<iframe id="same-origin-different-window"></iframe>
+<iframe id="cross-origin-joined-via-document-domain"></iframe>
+
+<script>
+"use strict";
+
+// Handle same-origin, same-window testing first, before any async-requiring
+// testing.
+test(function() {
+ var LocationPrototype = Location.prototype;
+ var ObjectPrototype = Object.prototype;
+
+ var loc = window.location;
+
+ var locProto = Object.getPrototypeOf(loc);
+ assert_equals(locProto, LocationPrototype,
+ "loc's initial [[Prototype]]");
+
+ var originalLocProtoProto = Object.getPrototypeOf(locProto);
+ assert_equals(originalLocProtoProto, ObjectPrototype,
+ "Location.prototype's initial [[Prototype]]");
+
+ Object.setPrototypeOf(locProto, loc);
+
+ assert_equals(Object.getPrototypeOf(locProto), loc,
+ "LocationPrototype's new [[Prototype]]");
+ assert_equals(Object.getPrototypeOf(loc), locProto,
+ "loc's new [[Prototype]]");
+
+ // Reset so as not to muck with testharness.js expectations.
+ Object.setPrototypeOf(locProto, originalLocProtoProto);
+}, "same-origin, same-window location cycle");
+
+var pathdir =
+ location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
+
+var triggerCrossOriginTest = (function() {
+ var crossOrigin =
+ document.getElementById("cross-origin-joined-via-document-domain");
+
+ var t = async_test("cross-origin location has null prototype");
+
+ return new Promise(function(resolve, reject) {
+ crossOrigin.onload = t.step_func_done(function(e) {
+ try {
+ var win = crossOrigin.contentWindow;
+
+ var loc = win.location;
+
+ // Between un-opted-in windows, location objects appear to have null
+ // [[Prototype]].
+ assert_equals(Object.getPrototypeOf(loc), null,
+ "cross-origin unjoined location's [[Prototype]");
+
+ resolve();
+ } catch (e) {
+ reject(e);
+ throw e;
+ }
+ });
+
+ crossOrigin.src =
+ "//{{domains[www]}}:" + location.port + pathdir + "cross_origin_joined_frame.sub.html";
+ })
+ .catch(t.unreached_func("crossOrigin onload/src setting"));
+})();
+
+var triggerSameOriginTest = (function() {
+ var sameOriginDifferentWindow =
+ document.getElementById("same-origin-different-window");
+
+ var t = async_test("same-origin, different-window location cycle");
+
+ return new Promise(function(resolve, reject) {
+ sameOriginDifferentWindow.onload = t.step_func_done(function() {
+ try {
+ var win = sameOriginDifferentWindow.contentWindow;
+
+ var loc = win.location;
+ var LocationPrototype = win.Location.prototype;
+ var ObjectPrototype = win.Object.prototype;
+
+ var locProto = Object.getPrototypeOf(loc);
+ assert_equals(locProto, LocationPrototype,
+ "loc's initial [[Prototype]]");
+
+ var originalLocProtoProto = Object.getPrototypeOf(locProto);
+ assert_equals(originalLocProtoProto, ObjectPrototype,
+ "Location.prototype's initial [[Prototype]]");
+
+ Object.setPrototypeOf(locProto, loc);
+
+ assert_equals(Object.getPrototypeOf(locProto), loc,
+ "LocationPrototype's new [[Prototype]]");
+ assert_equals(Object.getPrototypeOf(loc), locProto,
+ "loc's new [[Prototype]]");
+
+ // Reset so as not to muck with testharness.js expectations.
+ Object.setPrototypeOf(locProto, originalLocProtoProto);
+
+ resolve();
+ } catch (e) {
+ reject(e);
+ throw e;
+ }
+ });
+
+ sameOriginDifferentWindow.src = "same_origin_frame.html";
+ })
+ .catch(t.unreached_func("sameOriginDifferentWindow onload/src setting"));
+})();
+
+function crossOriginJoinTest() {
+ var win =
+ document.getElementById("cross-origin-joined-via-document-domain")
+ .contentWindow;
+
+ assert_equals(document.domain, "{{host}}");
+
+ var loc = win.location;
+
+ var threw = false;
+ try {
+ // Still cross-origin until the document.domain set below.
+ win.Location;
+ } catch (e) {
+ threw = true;
+ }
+
+ assert_equals(threw, true,
+ "accessing win.Location before joining win's origin");
+
+ // Join with other frames that have set |document.domain| to this same
+ // value -- namely, this cross-origin frame. Now access between the two
+ // windows should be permitted.
+ assert_equals(document.domain, "{{host}}",
+ "initial document.domain sanity check");
+ document.domain = "{{host}}";
+
+ var LocationPrototype = win.Location.prototype;
+ var ObjectPrototype = win.Object.prototype;
+
+ var locProto = Object.getPrototypeOf(loc);
+ assert_equals(locProto, LocationPrototype,
+ "loc's initial [[Prototype]]");
+
+ var originalLocProtoProto = Object.getPrototypeOf(locProto);
+ assert_equals(originalLocProtoProto, ObjectPrototype,
+ "Location.prototype's initial [[Prototype]]");
+
+ Object.setPrototypeOf(locProto, loc);
+
+ assert_equals(Object.getPrototypeOf(locProto), loc,
+ "LocationPrototype's new [[Prototype]]");
+ assert_equals(Object.getPrototypeOf(loc), locProto,
+ "loc's new [[Prototype]]");
+
+ // Reset so as not to muck with testharness.js expectations.
+ Object.setPrototypeOf(locProto, originalLocProtoProto);
+}
+
+function run() {
+ var t =
+ async_test("cross-origin, but joined via document.domain, location cycle");
+
+ // The cross-origin/joined case must be tested after both unjoined same-origin
+ // and unjoined cross-origin tests: by mucking with document.domain, the
+ // cross-origin/joined case makes it impossible to perform those tests.
+ t.step(function() {
+ Promise.all([triggerCrossOriginTest, triggerSameOriginTest])
+ .then(t.step_func_done(crossOriginJoinTest),
+ t.unreached_func("cross-origin joined error case"));
+ });
+}
+run();
+</script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-1.html
new file mode 100644
index 000000000..3d2b89722
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-1.html
@@ -0,0 +1,9 @@
+<!doctype html>
+1
+<script>
+onload = parent.t.step_func(function() {
+ setTimeout(function() {
+ location = location.toString().replace("assign_after_load-1.html", "assign_after_load-2.html");
+ }, 100);
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-2.html
new file mode 100644
index 000000000..94679571b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-2.html
@@ -0,0 +1,7 @@
+<!doctype html>
+2
+<script>
+onload = parent.t.step_func(function() {
+ setTimeout(function() {parent.do_test()}, 100);
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load.html
new file mode 100644
index 000000000..00dc931d4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<title>Assignment to location after document is completely loaded</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe></iframe>
+<script>
+var t = async_test();
+var history_length;
+
+onload = t.step_func(function() {
+ setTimeout(function() {
+ history_length = history.length;
+ document.getElementsByTagName("iframe")[0].src = "assign_after_load-1.html";
+ }, 100);
+});
+
+do_test = t.step_func(function() {
+ assert_equals(history.length, history_length + 2);
+ t.done();
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-1.html
new file mode 100644
index 000000000..2549867c8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+1
+<script>
+onload = parent.t.step_func(function() {
+ location = location.toString().replace("assign_before_load-1.html", "assign_before_load-2.html");
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-2.html
new file mode 100644
index 000000000..94679571b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-2.html
@@ -0,0 +1,7 @@
+<!doctype html>
+2
+<script>
+onload = parent.t.step_func(function() {
+ setTimeout(function() {parent.do_test()}, 100);
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load.html
new file mode 100644
index 000000000..62a2aa7c6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<title>Assignment to location before document is completely loaded</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe></iframe>
+<script>
+var t = async_test();
+var history_length;
+
+onload = t.step_func(function() {
+ setTimeout(function() {
+ history_length = history.length;
+ document.getElementsByTagName("iframe")[0].src = "assign_before_load-1.html";
+ }, 100);
+});
+
+do_test = t.step_func(function() {
+ assert_equals(history.length, history_length + 1);
+ t.done();
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/contains.json b/testing/web-platform/tests/html/browsers/history/the-location-interface/contains.json
new file mode 100644
index 000000000..d311dbb31
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/contains.json
@@ -0,0 +1,6 @@
+[
+ {
+ "id": "security-location",
+ "original_id": "security-location"
+ }
+] \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/cross_origin_joined_frame.sub.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/cross_origin_joined_frame.sub.html
new file mode 100644
index 000000000..a3ffdd005
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/cross_origin_joined_frame.sub.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Cross-origin subframe for Location cyclic [[Prototype]] test</title>
+ <link rel="author" title="Jeff Walden" href="http://whereswalden.com/" />
+</head>
+<body>
+<script>
+document.domain = "{{host}}";
+</script>
+<!-- this should be accessible to the parent once it sets document.domain -->
+<p>Cross-origin iframe with joined <code>document.domain</code></p>
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/document_location.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/document_location.html
new file mode 100644
index 000000000..5ccc9c76b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/document_location.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>document.location</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ var doc = document.implementation.createHTMLDocument("");
+ assert_equals(doc.location, null);
+}, "document not in a browsing context");
+
+test(function() {
+ assert_equals(document.location, location);
+}, "document.location equals window.location");
+
+</script>
+
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location-prototype-setting.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-prototype-setting.html
new file mode 100644
index 000000000..726aaea23
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-prototype-setting.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>[[SetPrototypeOf]] on a location object should return false</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ test(function() {
+ var origProto = Object.getPrototypeOf(location);
+ assert_throws(new TypeError, function() {
+ Object.setPrototypeOf(location, {});
+ });
+ assert_throws(new TypeError, function() {
+ location.__proto__ = {};
+ });
+ assert_false(Reflect.setPrototypeOf(location, {}));
+ assert_equals(Object.getPrototypeOf(location), origProto);
+ });
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html
new file mode 100644
index 000000000..d23323b37
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<title>Location stringifier</title>
+<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
+<link rel="help" href="https://heycam.github.io/webidl/#es-stringifier">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=/common/stringifiers.js></script>
+<div id=log></div>
+<script>
+test_stringifier_attribute(location, "href", true);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign.html
new file mode 100644
index 000000000..7e18804c2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>location_assign</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ var href = location.href;
+ location.assign('#x');
+
+ assert_equals((href + "#x"), location.href, "location href");
+
+ }, "location assign");
+
+ test(function () {
+ var href = location.href;
+ assert_throws('SYNTAX_ERR', function() { location.assign("http://:"); });
+ assert_equals(location.href, href);
+ }, "URL that fails to parse");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank-1.html
new file mode 100644
index 000000000..b43598f2c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank-1.html
@@ -0,0 +1,2 @@
+<!doctype html>
+Filler text
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank.html
new file mode 100644
index 000000000..f3f7cf26b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<title>location.assign with initial about:blank browsing context</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe></iframe>
+<script>
+var t = async_test();
+var history_length;
+onload = t.step_func(function() {
+ setTimeout(t.step_func(function() {
+ var iframe = document.getElementsByTagName("iframe")[0];
+ iframe.onload = t.step_func(function() {
+ setTimeout(t.step_func(function() {
+ assert_equals(history.length, history_length);
+ t.done();
+ }), 100);
+ });
+ history_length = history.length;
+ iframe.src = "location_assign_about_blank-1.html"
+ }), 100);
+});
+</script>
+
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hash.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hash.html
new file mode 100644
index 000000000..74d2d0154
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hash.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>location_hash</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <iframe id="srcdoc-iframe"
+ srcdoc="<div style='height: 200vh'></div><div id='test'></div>"></iframe>
+ <script>
+ test(function () {
+ window.history.pushState(1, document.title, '#x=1');
+ var hash = location.hash;
+
+ assert_equals(hash, "#x=1", "hash");
+
+ }, "location hash");
+
+ var t = async_test("Setting location.hash on srcdoc iframe");
+ addEventListener("load", t.step_func_done(function() {
+ var frameWin = document.getElementById("srcdoc-iframe").contentWindow;
+ assert_equals(frameWin.location.href, "about:srcdoc");
+ assert_equals(frameWin.scrollY, 0, "Should not have scrolled yet");
+ frameWin.location.hash = "test";
+ assert_equals(frameWin.location.href, "about:srcdoc#test");
+ assert_true(frameWin.scrollY > frameWin.innerHeight,
+ "Should have scrolled by more than one viewport height");
+ }));
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_host.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_host.html
new file mode 100644
index 000000000..d93bf47e5
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_host.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>location_host</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ var host = location.host;
+ var url = location.href;
+
+ var pos = url.indexOf("//");
+ if (pos != -1) {
+ url = url.substr(pos+2, url.length-pos-2);
+ pos = url.indexOf("/");
+ if (pos != -1)
+ url = url.substr(0, pos);
+ }
+
+ assert_equals(host, url, "host");
+
+ }, "location host");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hostname.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hostname.html
new file mode 100644
index 000000000..2ffa0e5fc
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hostname.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>location_hostname</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ var hostname = location.hostname;
+ var url = location.href;
+
+ var pos = url.indexOf("//");
+ if (pos != -1) {
+ url = url.substr(pos+2, url.length-pos-2);
+ pos = url.indexOf(":");
+ if (pos != -1) {
+ url = url.substr(0, pos);
+ } else {
+ pos = url.indexOf("/");
+ if (pos != -1)
+ url = url.substr(0, pos);
+ }
+ }
+
+ assert_equals(hostname, url, "hostname");
+
+ }, "location hostname");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_href.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_href.html
new file mode 100644
index 000000000..1aa85dcdc
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_href.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>location_href</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ var href = location.href;
+
+ assert_equals(href, document.URL, "href");
+
+ }, "location href");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_origin.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_origin.html
new file mode 100644
index 000000000..2325f4018
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_origin.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<meta charset="utf-8">
+<title></title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ test(function () {
+ assert_equals(
+ location.origin,
+ location.protocol + '//' + location.host,
+ "origin"
+ );
+ }, "location origin");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_pathname.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_pathname.html
new file mode 100644
index 000000000..dea05d2f3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_pathname.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>location_pathname</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ var pathname = location.pathname;
+ var url = location.href
+
+ url = url.replace(location.protocol + "//" + location.host, "");
+
+ assert_equals(pathname, url, "pathname");
+
+ }, "location pathname");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_port.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_port.html
new file mode 100644
index 000000000..fa1308ca5
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_port.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>location_port</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ var port = location.port;
+ var url = location.href;
+
+ var pos = url.indexOf("//");
+ if (pos != -1) {
+ url = url.substr(pos+2, url.length-pos-2);
+ pos = url.indexOf("/");
+ if (pos != -1)
+ url = url.substr(0, pos);
+ pos = url.indexOf(":");
+ if (pos != -1)
+ url = url.substr(pos+1, url.length-pos-1);
+ }
+
+ assert_equals(port, url, "port");
+
+ }, "location port");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_protocol.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_protocol.html
new file mode 100644
index 000000000..d28bd5639
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_protocol.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>location_protocol</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ var protocol = location.protocol;
+ var url = location.href;
+
+ var pos = url.indexOf("//");
+ if (pos != -1) {
+ url = url.substr(0, pos);
+ }
+
+ assert_equals(protocol, url, "protocol");
+
+ }, "location protocol");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload-iframe.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload-iframe.html
new file mode 100644
index 000000000..95b63d9f5
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload-iframe.html
@@ -0,0 +1,4 @@
+<script>
+ parent._ping(window.location.href)
+ location.reload();
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload.html
new file mode 100644
index 000000000..78b3cc35e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>location_reload</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+
+ <iframe></iframe>
+
+ <script>
+ var history_length;
+ async_test(function(t) {
+
+ var url = new URL("./location_reload-iframe.html", window.location).href;
+ var pingCount = 0;
+
+ window._ping = t.step_func(function(innerURL) {
+ // Some browsers keep 'about:blank' in the session history
+ if (pingCount == 0) {
+ history_length = history.length;
+ }
+ assert_equals(url, innerURL, "iframe url (" + pingCount + ")");
+ assert_equals(history_length, history.length, "history length (" + pingCount + ")");
+ pingCount++;
+ if (pingCount == 5) {
+ iframe.src = 'about:blank';
+ t.done();
+ }
+ });
+
+ var iframe = document.querySelector("iframe");
+ iframe.src = url;
+ history_length = history.length;
+ });
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_replace.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_replace.html
new file mode 100644
index 000000000..2f2d57308
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_replace.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>location_replace</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ var href = location.href;
+ location.replace('#x');
+
+ assert_equals((href + "#x"), location.href, "location href");
+
+ }, "location replace");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_search.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_search.html
new file mode 100644
index 000000000..f9db75784
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_search.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>location_search</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function () {
+ window.history.pushState(1, document.title, '?x=1');
+ var search = location.search;
+
+ assert_equals(search, "?x=1", "search");
+
+ }, "location search");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-1.html
new file mode 100644
index 000000000..c762ece3b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<script>
+opener.history_length = history.length;
+</script>
+<a onclick="location = 'manual_click_assign_during_load-2.html'; return false;" href>Click Here</a>
+<p>Filler image to keep the page loading:</p>
+<img src="/images/smiley.png?pipe=trickle(20:d1:r2)">
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-2.html
new file mode 100644
index 000000000..1bf7f41e0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-2.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<p>This window should close itself and the test result appear in the original window
+<script>
+onload = function() {
+ setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-manual.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-manual.html
new file mode 100644
index 000000000..4f2555c5e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-manual.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>Assignment to location with click during load</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<p>The popup blocker must be disabled for this test</p>
+<div id="log"></div>
+<script>
+setup({timeout:3600000});
+var t = async_test(undefined, {timeout:3600000});
+var win = window.open("manual_click_assign_during_load-1.html");
+
+var history_length;
+do_test = t.step_func(function(new_length) {
+ assert_equals(new_length, history_length + 1);
+ t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-1.html
new file mode 100644
index 000000000..e9d03e936
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-1.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<script>
+opener.history_length = history.length;
+</script>
+<a onclick="location.replace('manual_click_location_replace_during_load-2.html'); return false;" href>Click Here</a>
+<p>Filler image to keep the page loading:</p>
+<img>
+<script>
+document.images[0].src = "/images/smiley.png?pipe=trickle(20:d1:r2)&random=" + Math.random();
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-2.html
new file mode 100644
index 000000000..1bf7f41e0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-2.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<p>This window should close itself and the test result appear in the original window
+<script>
+onload = function() {
+ setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-manual.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-manual.html
new file mode 100644
index 000000000..43af1b1d3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-manual.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>location.replace with click during load</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<p>The popup blocker must be disabled for this test</p>
+<div id="log"></div>
+<script>
+setup({timeout:3600000});
+var t = async_test(undefined, {timeout:3600000});
+var win = window.open("manual_click_location_replace_during_load-1.html");
+
+var history_length;
+do_test = t.step_func(function(new_length) {
+ assert_equals(new_length, history_length);
+ t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_replace_during_load-manual.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_replace_during_load-manual.html
new file mode 100644
index 000000000..3507222ca
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_replace_during_load-manual.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>Assignment to location with click during load</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<p>The popup blocker must be disabled for this test</p>
+<div id="log"></div>
+<script>
+setup({timeout:3600000});
+var t = async_test(undefined, {timeout:3600000});
+var win = window.open("manual_click_replace_during_load-1.html");
+
+var history_length;
+do_test = t.step_func(function(new_length) {
+ assert_equals(new_length, history_length);
+ t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-1.html
new file mode 100644
index 000000000..08f7e2dd6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-1.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<script>
+opener.history_length = history.length;
+</script>
+<form onsubmit="location = 'manual_form_submit_assign_during_load-2.html'; return false;">
+<input type=submit value="Click Me">
+</form>
+<p>Filler image to keep the page loading:</p>
+<img src="/images/smiley.png?pipe=trickle(20:d1:r2)">
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-2.html
new file mode 100644
index 000000000..1bf7f41e0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-2.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<p>This window should close itself and the test result appear in the original window
+<script>
+onload = function() {
+ setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-manual.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-manual.html
new file mode 100644
index 000000000..df6487407
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-manual.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>Assignment to location with form submit during load</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<p>The popup blocker must be disabled for this test</p>
+<div id="log"></div>
+<script>
+setup({timeout:3600000});
+var t = async_test(undefined, {timeout:3600000});
+var win = window.open("manual_form_submit_assign_during_load-1.html");
+
+var history_length;
+do_test = t.step_func(function(new_length) {
+ assert_equals(new_length, history_length + 1);
+ t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-1.html
new file mode 100644
index 000000000..05b44f4c4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-1.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<p>Resize this window. FAIL if the window doesn't close shortly afterwards.</p>
+<script>
+onload = opener.t.step_func(function() {
+ opener.load_count++;
+ if (opener.load_count > 1) {
+ opener.do_test();
+ }
+})
+
+onresize = opener.t.step_func(function() {
+ opener.flag_resized();
+ location.reload();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-manual.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-manual.html
new file mode 100644
index 000000000..1991cee8a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-manual.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<title>Reload called from resize event</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<p>Resize the popup window. That window should then close and the result be presented here. If that window doesn't close after resize that's a FAIL.</p>
+<div id="log"></div>
+<script>
+setup({timeout:3600000})
+var t = async_test(undefined, {timeout:3600000});
+var load_count = 0;
+var resized = false;
+var win = window.open("reload_in_resize-1.html")
+
+flag_resized = t.step_func(function() {
+ resized = true;
+ setTimeout(do_test, 1000);
+});
+
+do_test = t.step_func(function() {
+ win.close();
+ assert_true(resized, "Resize event happened");
+ assert_equals(load_count, 1, "Number of load events");
+ t.done();
+});
+</script>
+
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html
new file mode 100644
index 000000000..1c5a1db8f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html
@@ -0,0 +1,14 @@
+<!doctype html>
+1
+<script>
+function f() {
+ opener.postMessage("original", "*");
+ setTimeout(function () {
+ document.open();
+ document.write("<!doctype html>2<script>opener.postMessage('written', '*');<\/script>");
+ document.close();
+ }), 100;
+}
+
+window.onload = f
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html
new file mode 100644
index 000000000..0fc2a2c3d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<title>Reload document with document.open and document.written content</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var win = window.open("reload_document_open_write-1.html");
+var t = async_test();
+
+var data = [];
+
+window.onmessage = t.step_func(function(e) {
+ data.push(e.data);
+ if (data.length < 3) {
+ win.location.reload();
+ } else {
+ setTimeout(t.step_func(function() {
+ assert_array_equals(data, ["original", "written", "written"]);
+ t.done();
+ }), 500);
+ }
+});
+
+add_completion_callback(function() {win.close()});
+</script>
+
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write-1.html
new file mode 100644
index 000000000..9a0843392
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write-1.html
@@ -0,0 +1,4 @@
+<script>
+document.write(Math.random());
+opener.postMessage(document.body.innerHTML, "*");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write.html
new file mode 100644
index 000000000..dfbd436a4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<title>Reload document with document.written content</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var win = window.open("reload_document_write-1.html");
+var t = async_test();
+
+window.onmessage = t.step_func(function(e) {
+ var initial_value = e.data;
+ win.location.reload();
+ window.onmessage = t.step_func(function(e) {
+ assert_true(e.data !== initial_value);
+ t.done();
+ });
+});
+
+add_completion_callback(function() {win.close()});
+</script>
+
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload-1.html
new file mode 100644
index 000000000..36445af3c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload-1.html
@@ -0,0 +1,9 @@
+<script>
+function f() {
+ opener.postMessage("original", "*");
+ document.write("<!doctype html>2<script>opener.postMessage('written', '*');<\/script>");
+ document.close();
+}
+
+window.onload = f
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload.html
new file mode 100644
index 000000000..b2cf31147
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<title>Reload document with document.written content written in load event</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var win = window.open("reload_document_write_onload-1.html");
+var t = async_test();
+
+var data = [];
+
+window.onmessage = t.step_func(function(e) {
+ data.push(e.data);
+ if (data.length < 3) {
+ win.location.reload();
+ } else {
+ setTimeout(t.step_func(function() {
+ assert_array_equals(data, ["original", "written", "written"]);
+ t.done();
+ }), 500);
+ }
+});
+
+add_completion_callback(function() {win.close()});
+</script>
+
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1-1.html
new file mode 100644
index 000000000..69e48f77c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1-1.html
@@ -0,0 +1,10 @@
+<script>
+onload = function() {opener.next()}
+document.write(Math.random());
+</script>
+
+<form method="POST" action="">
+<input type=hidden name=test value=test>
+<input type=submit>
+</form>
+<button onclick="location.reload()">Reload</button>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1.html
new file mode 100644
index 000000000..080545e23
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<title>Reload document with POST</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var win = window.open("reload_post_1-1.html");
+var t = async_test();
+var posted = false;
+var reloaded = false;
+
+next = t.step_func(function() {
+
+if (posted && !reloaded) {
+ reloaded = true;
+ win.location.reload();
+} else if (posted && reloaded) {
+ t.done();
+} else {
+ posted = true;
+ win.document.forms[0].submit();
+}
+
+});
+
+add_completion_callback(function() {win.close()});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/same_origin_frame.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/same_origin_frame.html
new file mode 100644
index 000000000..953e696b2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/same_origin_frame.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Same-origin subframe for Location cyclic [[Prototype]] test</title>
+ <link rel="author" title="Jeff Walden" href="http://whereswalden.com/" />
+</head>
+<body>
+<!-- nothing to do, this window should be accessible to the parent frame -->
+<p>Same-origin iframe</p>
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-1.html
new file mode 100644
index 000000000..9561cabdd
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-1.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<script>
+opener.history_length = history.length;
+</script>
+<a onclick="location = 'scripted_click_assign_during_load-2.html'; return false;" href>Click Here</a>
+<script>
+document.links[0].click()
+</script>
+<p>Filler image to keep the page loading:</p>
+<img src="/images/smiley.png?pipe=trickle(20:d1:r2)">
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-2.html
new file mode 100644
index 000000000..1bf7f41e0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-2.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<p>This window should close itself and the test result appear in the original window
+<script>
+onload = function() {
+ setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load.html
new file mode 100644
index 000000000..4d7352f4c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>Assignment to location with click during load</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<p>The popup blocker must be disabled for this test</p>
+<div id="log"></div>
+<script>
+setup({timeout:3600000});
+var t = async_test(undefined, {timeout:3600000});
+var win = window.open("scripted_click_assign_during_load-1.html");
+
+var history_length;
+do_test = t.step_func(function(new_length) {
+ assert_equals(new_length, history_length);
+ t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-1.html
new file mode 100644
index 000000000..05bb42f96
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-1.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<script>
+opener.history_length = history.length;
+</script>
+<a onclick="location.assign('scripted_click_location_assign_during_load-2.html'); return false;" href>Click Here</a>
+<script>
+document.links[0].click()
+</script>
+<p>Filler image to keep the page loading:</p>
+<img>
+<script>
+document.images[0].src = "/images/smiley.png?pipe=trickle(20:d1:r2)&random=" + Math.random()
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-2.html
new file mode 100644
index 000000000..1bf7f41e0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-2.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<p>This window should close itself and the test result appear in the original window
+<script>
+onload = function() {
+ setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load.html
new file mode 100644
index 000000000..64f3ff942
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>location.assign with click during load</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<p>The popup blocker must be disabled for this test</p>
+<div id="log"></div>
+<script>
+var t = async_test();
+var win = window.open("scripted_click_location_assign_during_load-1.html");
+
+var history_length;
+do_test = t.step_func(function(new_length) {
+ assert_equals(new_length, history_length + 1);
+ t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html
new file mode 100644
index 000000000..ae07ac5cf
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<script>
+opener.history_length = history.length;
+</script>
+<form onsubmit="location = 'scripted_form_submit_assign_during_load-2.html'; return false;">
+<input type=submit value="Click Me">
+</form>
+<script>
+document.forms[0].elements[0].click()
+</script>
+<p>Filler image to keep the page loading:</p>
+<img src="/images/smiley.png?pipe=trickle(20:d1:r2)">
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html
new file mode 100644
index 000000000..1bf7f41e0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<p>This window should close itself and the test result appear in the original window
+<script>
+onload = function() {
+ setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html
new file mode 100644
index 000000000..981b9c9a3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>Assignment to location with form submit during load</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<p>The popup blocker must be disabled for this test</p>
+<div id="log"></div>
+<script>
+setup({timeout:3600000});
+var t = async_test(undefined, {timeout:3600000});
+var win = window.open("scripted_form_submit_assign_during_load-1.html");
+
+var history_length;
+do_test = t.step_func(function(new_length) {
+ assert_equals(new_length, history_length);
+ t.done();
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/security_location_0.sub.htm b/testing/web-platform/tests/html/browsers/history/the-location-interface/security_location_0.sub.htm
new file mode 100644
index 000000000..f509c23b1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/security_location_0.sub.htm
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Location interface Security</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
+ <link rel="help" href="https://html.spec.whatwg.org/multipage/#security-location" />
+ <meta name="assert" content="access location object from different origins doesn't raise SECURITY_ERR exception" />
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <p>Access location object from different origins doesn't raise SECURITY_ERR exception</p>
+ <div id=log></div>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script>
+ var runTest = async_test("Accessing location object from different origins doesn't raise SECURITY_ERR exception").step_func_done(function() {
+ var frame = document.getElementById('testframe');
+ frame.setAttribute('onload', '');
+ frame.contentWindow.location = get_host_info().HTTP_REMOTE_ORIGIN + "/";
+ });
+ </script>
+ <iframe id='testframe' onload="runTest()">Test Frame</iframe>
+ <script>
+ document.getElementById('testframe').setAttribute('src', get_host_info().HTTP_REMOTE_ORIGIN + '/');
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/offline/.gitkeep b/testing/web-platform/tests/html/browsers/offline/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/offline/appcache/.gitkeep b/testing/web-platform/tests/html/browsers/offline/appcache/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/appcache/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/offline/application-cache-api/.gitkeep b/testing/web-platform/tests/html/browsers/offline/application-cache-api/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/application-cache-api/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_checking-manual.html b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_checking-manual.html
new file mode 100644
index 000000000..a4a3b41a7
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_checking-manual.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - API_status_CHECKING</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <ol>
+ <li>Refresh the page.</li>
+ </ol>
+
+ <div id="log"></div>
+ <script>
+ var t = async_test("checking status test"),
+ cache = window.applicationCache;
+
+ cache.onchecking = t.step_func_done(function() {
+ assert_equals(cache.status, cache.CHECKING, "cache.status should equals cache.CHECKING");
+ });
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_downloading-manual.html b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_downloading-manual.html
new file mode 100644
index 000000000..c09d11d78
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_downloading-manual.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - API_status_DOWNLOADING</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <ol>
+ <li>Modify the commented part in the manifest file (manifest/clock.manifest) on the server.</li>
+ <li>Refresh the page.</li>
+ </ol>
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("downloading status test"),
+ cache = window.applicationCache;
+
+ cache.ondownloading = t.step_func_done(function() {
+ assert_equals(cache.status, cache.DOWNLOADING, "cache.status should equals cache.DOWNLOADING");
+ });
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_idle.html b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_idle.html
new file mode 100644
index 000000000..21725bb00
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_idle.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - API_status_IDLE</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var t = async_test("idle status test"),
+ cache = window.applicationCache;
+
+ setTimeout(function(){
+ t.step(function() {
+ assert_equals(cache.status, cache.IDLE, "cache.status should equals cache.IDLE");
+ });
+ t.done();
+ }, 3000);
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_obsolete-manual.html b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_obsolete-manual.html
new file mode 100644
index 000000000..77005644a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_obsolete-manual.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - API_status_OBSOLETE</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <ol>
+ <li>Remove the manifest file (manifest/clock.manifest) from the server.</li>
+ <li>Refresh the page.</li>
+ </ol>
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("obsolete status test"),
+ cache = window.applicationCache;
+
+ cache.onobsolete = t.step_func_done(function() {
+ assert_equals(cache.status, cache.OBSOLETE, "cache.status should equals cache.OBSOLETE");
+ });
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_uncached.html b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_uncached.html
new file mode 100644
index 000000000..300c4a1b1
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_uncached.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>Offline Application Cache - API_status_UNCACHED</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+
+ <script>
+ var cache = window.applicationCache;
+
+ test(function(){
+ assert_equals(cache.status, cache.UNCACHED, "uncached status test");
+ });
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_updateready-manual.html b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_updateready-manual.html
new file mode 100644
index 000000000..7e1533374
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_status_updateready-manual.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - API_status_UPDATEREADY</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <ol>
+ <li>Modify the commented part in the manifest file (manifest/clock.manifest) on the server.</li>
+ <li>Refresh the page.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("updateready status test"),
+ cache = window.applicationCache;
+
+ cache.onupdateready = t.step_func_done(function() {
+ assert_equals(cache.status, cache.UPDATEREADY, "cache.status should equals cache.UPDATEREADY");
+ });
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_swapcache-manual.html b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_swapcache-manual.html
new file mode 100644
index 000000000..6649d980f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_swapcache-manual.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - API_swapCache</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <ol>
+ <li>Modify the part of comment in manifest file of server.</li>
+ <li>Refresh the page.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("swapCache method test");
+ var cache = window.applicationCache;
+
+ cache.onupdateready = t.step_func(function() {
+ try {
+ cache.swapCache();
+ t.done();
+ } catch (e) {
+ assert_unreached("swapCache method failed.");
+ }
+ });
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_swapcache_error.html b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_swapcache_error.html
new file mode 100644
index 000000000..02e7b3cd8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_swapcache_error.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - API_swapCache_error</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+
+ <script>
+ var cache = window.applicationCache;
+
+ test(function() {
+ assert_throws("INVALID_STATE_ERR", function(){cache.swapCache();});
+ }, "INVALID_STATE_ERR error test")
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_update.html b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_update.html
new file mode 100644
index 000000000..452daa711
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_update.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - API_update</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+
+ <script>
+ var cache = window.applicationCache;
+
+ test(function() {
+ try {
+ cache.update()
+ assert_true(true, "update method test")
+ } catch (e) {
+ assert_unreached("update method failed.");
+ }
+ });
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_update_error.html b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_update_error.html
new file mode 100644
index 000000000..ef88158cd
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/application-cache-api/api_update_error.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - API_update_error</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <ol>
+ <li>Remove the manifest file (manifest/clock.manifest) from the server.</li>
+ <li>Refresh the page, then calling update() will throw InvalidStateError exception.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script>
+ var cache = window.applicationCache;
+ test(function() {
+ assert_throws("INVALID_STATE_ERR", function(){cache.update();});
+ }, "INVALID_STATE_ERR error test")
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/browser-state/.gitkeep b/testing/web-platform/tests/html/browsers/offline/browser-state/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/browser-state/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/offline/browser-state/navigator_online_event-manual.html b/testing/web-platform/tests/html/browsers/offline/browser-state/navigator_online_event-manual.html
new file mode 100644
index 000000000..b100f177e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/browser-state/navigator_online_event-manual.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>Offline Application Cache</title>
+ <link rel="stylesheet" href="../resources/css/result.css">
+ </head>
+ <body>
+ <h1>navigator_online_event</h1>
+
+ <ol>
+ <li>Change the 'work offline' mode.</li>
+ <li>If actual result and expected result are same, then test is <span class="manualpass">Pass</span>, otherwise <span class="manualfail">Fail</span>.</li>
+ </ol>
+
+ <hr>
+
+ <h2>Actual Result</h2>
+ <div id="actualResult">
+ <span id="actualMsg"></span>
+ </div>
+
+ <h2>Expected Result</h2>
+ <div id="expectedResult">
+ <span id="expectedMsg">apply 'work offline': offline event is raised.<p>release 'work offline': online event is raised.</span>
+ </div>
+ <script>
+
+ function showOnline() {
+ document.getElementById('actualMsg').innerHTML = 'online event is raised.';
+ }
+
+ function showOffline() {
+ document.getElementById('actualMsg').innerHTML = 'offline event is raised.';
+ }
+
+ window.addEventListener("online", showOnline, false);
+ window.addEventListener("offline", showOffline, false);
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/browser-state/navigator_online_online.html b/testing/web-platform/tests/html/browsers/offline/browser-state/navigator_online_online.html
new file mode 100644
index 000000000..81547c3fb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/browser-state/navigator_online_online.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>Offline Application Cache - navigator_online_online</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+
+ <script>
+ test(function() {
+ assert_true(navigator.onLine, "onLine test");
+ });
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/changestonetworkingmodel/.gitkeep b/testing/web-platform/tests/html/browsers/offline/changestonetworkingmodel/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/changestonetworkingmodel/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/offline/changestonetworkingmodel/original-id.json b/testing/web-platform/tests/html/browsers/offline/changestonetworkingmodel/original-id.json
new file mode 100644
index 000000000..2f77367c8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/changestonetworkingmodel/original-id.json
@@ -0,0 +1 @@
+{"original_id":"changesToNetworkingModel"} \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/disk-space/.gitkeep b/testing/web-platform/tests/html/browsers/offline/disk-space/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/disk-space/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/offline/downloading-or-updating-an-application-cache/.gitkeep b/testing/web-platform/tests/html/browsers/offline/downloading-or-updating-an-application-cache/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/downloading-or-updating-an-application-cache/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/offline/expiring-application-caches/.gitkeep b/testing/web-platform/tests/html/browsers/offline/expiring-application-caches/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/expiring-application-caches/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/offline/introduction-4/.gitkeep b/testing/web-platform/tests/html/browsers/offline/introduction-4/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/introduction-4/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/offline/introduction-4/contains.json b/testing/web-platform/tests/html/browsers/offline/introduction-4/contains.json
new file mode 100644
index 000000000..799caa23a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/introduction-4/contains.json
@@ -0,0 +1,10 @@
+[
+ {
+ "id": "supporting-offline-caching-for-legacy-applications",
+ "original_id": "supporting-offline-caching-for-legacy-applications"
+ },
+ {
+ "id": "appcacheevents",
+ "original_id": "appcacheevents"
+ }
+] \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/introduction-4/event_cached.html b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_cached.html
new file mode 100644
index 000000000..24f57769f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_cached.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - Event_cached</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("cached event test");
+ var cache = window.applicationCache;
+
+ cache.oncached = t.done();
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/introduction-4/event_checking.html b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_checking.html
new file mode 100644
index 000000000..c180eca9d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_checking.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - Event_checking</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("checking event test");
+ var cache = window.applicationCache;
+
+ cache.onchecking = t.done();
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/introduction-4/event_downloading-manual.html b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_downloading-manual.html
new file mode 100644
index 000000000..26b003f06
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_downloading-manual.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - Event_downloading</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <ol>
+ <li>Modify the commented part of the manifest file (manifest/clock.manifest) on the server.</li>
+ <li>Refresh the page.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("downloading event test");
+ var cache = window.applicationCache;
+
+ cache.ondownloading = t.done();
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/introduction-4/event_error-manual.html b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_error-manual.html
new file mode 100644
index 000000000..19abb3d6b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_error-manual.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - Event_error</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <ol>
+ <li>Add a dummy file in the manifest file (manifest/clock.manifest).</li>
+ <li>Refresh the page.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("error event test");
+ var cache = window.applicationCache;
+
+ cache.onerror = t.done();
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/introduction-4/event_noupdate.html b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_noupdate.html
new file mode 100644
index 000000000..1e4dd89cf
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_noupdate.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - Event_noupdate</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("noupdate event test");
+ var cache = window.applicationCache;
+
+ cache.onnoupdate = t.done();
+ </script>
+
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/introduction-4/event_obsolete-manual.html b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_obsolete-manual.html
new file mode 100644
index 000000000..cab5e01cc
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_obsolete-manual.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - Event_obsolete</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <ol>
+ <li>Remove the manifest file (manifest/clock.manifest) from the server.</li>
+ <li>Refresh the page.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("obsolete event test");
+ var cache = window.applicationCache;
+
+ cache.onobsolete = t.done();
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/introduction-4/event_progress.html b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_progress.html
new file mode 100644
index 000000000..a808db757
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_progress.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - Event_progress</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("progress event test");
+ var cache = window.applicationCache;
+
+ cache.onprogress = t.done();
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/introduction-4/event_updateready-manual.html b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_updateready-manual.html
new file mode 100644
index 000000000..4de435144
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_updateready-manual.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - Event_updateready</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <ol>
+ <li>Modify the commented part in the manifest file (manifest/clock.manifest) on the server.</li>
+ <li>Refresh the page.</li>
+ </ol>
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("updateready event test");
+ var cache = window.applicationCache;
+
+ cache.onupdateready = t.done();
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/introduction-4/event_updateready_swapcache-manual.html b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_updateready_swapcache-manual.html
new file mode 100644
index 000000000..da6cead02
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/introduction-4/event_updateready_swapcache-manual.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html manifest="../resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - Event_updateready_swapCache</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <ol>
+ <li>Modify the commented part in manifest file (manifest/clock.manifest) on the server.</li>
+ <li>Refresh the page.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("swapCache method test after updateready event is raised");
+ var cache = window.applicationCache;
+
+ cache.onupdateready = t.step_func(function() {
+ try {
+ cache.swapCache();
+ t.done();
+ } catch (e) {
+ assert_unreached("swapCache method failed.");
+ }
+ })
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/manifest_main_empty-manual.html b/testing/web-platform/tests/html/browsers/offline/manifest_main_empty-manual.html
new file mode 100644
index 000000000..317aaa113
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/manifest_main_empty-manual.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML>
+<html manifest="resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - manifest_main_empty</title>
+ <link rel="stylesheet" href="resources/css/result.css">
+ </head>
+ <body>
+ <ol>
+ <li>Disable the network connection.</li>
+ <li>Refresh the page.</li>
+ <li>If the page is normally displayed, then test is <span class="manualpass"><b>PASS</b></span>, otherwise <span class="manualfail"><b>FAIL</b></span>.</li>
+ </ol>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/manifest_notchanged_online-manual.html b/testing/web-platform/tests/html/browsers/offline/manifest_notchanged_online-manual.html
new file mode 100644
index 000000000..a464b426a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/manifest_notchanged_online-manual.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html manifest="resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - manifest_notchanged_online</title>
+ <script src="resources/js/clock.js"></script>
+ <link rel="stylesheet" href="resources/css/result.css">
+ <link rel="stylesheet" href="resources/css/clock.css">
+ <link rel="stylesheet" href="resources/css/online.css" type="text/css" media="screen">
+ </head>
+ <body>
+ <ol>
+ <li>Remove time element of this html document and not change manifest file.</li>
+ <li>Refresh the page.</li>
+ <li>If the page is normally displayed, then test is <span class="manualpass"><b>PASS</b></span>, otherwise <span class="manualfail"><b>FAIL</b></span>.</li>
+ </ol>
+
+ <p class="connectivity" width="600">The time is: <output id="clock"></output></p>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/manifest_section_empty-manual.html b/testing/web-platform/tests/html/browsers/offline/manifest_section_empty-manual.html
new file mode 100644
index 000000000..eea2dbba3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/manifest_section_empty-manual.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html manifest="resources/manifest/section_empty.manifest">
+ <head>
+ <title>Offline Application Cache - manifest_section_empty</title>
+ <script src="resources/js/clock.js"></script>
+ <link rel="stylesheet" href="resources/css/result.css">
+ <link rel="stylesheet" href="resources/css/clock.css">
+ <link rel="stylesheet" href="resources/css/online.css" type="text/css" media="screen">
+ </head>
+ <body>
+ <ol>
+ <li>Disable the network connection.</li>
+ <li>Refresh the page.</li>
+ <li>If the time element and colors of result elements are normally displayed, then test is <span class="manualpass"><b>PASS</b></span>, otherwise <span class="manualfail"><b>FAIL</b></span>.</li>
+ </ol>
+
+ <p class="connectivity" width="600">The time is: <output id="clock"></output></p>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/manifest_section_many-manual.html b/testing/web-platform/tests/html/browsers/offline/manifest_section_many-manual.html
new file mode 100644
index 000000000..9378df1b4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/manifest_section_many-manual.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html manifest="resources/manifest/section_many.manifest">
+ <head>
+ <title>Offline Application Cache - manifest_section_many</title>
+ <script src="resources/js/clock.js"></script>
+ <link rel="stylesheet" href="resources/css/result.css">
+ <link rel="stylesheet" href="resources/css/clock.css">
+ <link rel="stylesheet" href="resources/css/online.css" type="text/css" media="screen">
+ </head>
+ <body>
+ <ol type="1">
+ <li>Disable the network connection.</li>
+ <li>Refresh the page.</li>
+ <li>If the time element and colors of result elements are normally displayed, then test is <span class="manualpass"><b>PASS</b></span>, otherwise <span class="manualfail"><b>FAIL</b></span>.</li>
+ </ol>
+
+ <p class="connectivity" width="600">The time is: <output id="clock"></output></p>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/manifest_url_check.html b/testing/web-platform/tests/html/browsers/offline/manifest_url_check.html
new file mode 100644
index 000000000..02bf70b16
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/manifest_url_check.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html manifest="resources/manifest/url_check.manifest">
+ <head>
+ <title>Offline Application Cache - URL_#</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+
+ <script>
+ var t = async_test("url check test");
+ var cache = window.applicationCache;
+
+ cache.onerror = t.done();
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/manifests/.gitkeep b/testing/web-platform/tests/html/browsers/offline/manifests/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/manifests/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/offline/manifests/contains.json b/testing/web-platform/tests/html/browsers/offline/manifests/contains.json
new file mode 100644
index 000000000..3fe509a78
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/manifests/contains.json
@@ -0,0 +1,14 @@
+[
+ {
+ "id": "some-sample-manifests",
+ "original_id": "some-sample-manifests"
+ },
+ {
+ "id": "writing-cache-manifests",
+ "original_id": "writing-cache-manifests"
+ },
+ {
+ "id": "parsing-cache-manifests",
+ "original_id": "parsing-cache-manifests"
+ }
+] \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/resources/css/clock.css b/testing/web-platform/tests/html/browsers/offline/resources/css/clock.css
new file mode 100644
index 000000000..fa406d0fb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/resources/css/clock.css
@@ -0,0 +1 @@
+output { font: 1em sans-serif; } \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/resources/css/offline.css b/testing/web-platform/tests/html/browsers/offline/resources/css/offline.css
new file mode 100644
index 000000000..76b7f3985
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/resources/css/offline.css
@@ -0,0 +1,5 @@
+.connectivity {
+ color: #fff;
+ background: red;
+ padding: 20px;
+} \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/resources/css/online.css b/testing/web-platform/tests/html/browsers/offline/resources/css/online.css
new file mode 100644
index 000000000..39efcb2ab
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/resources/css/online.css
@@ -0,0 +1,5 @@
+.connectivity {
+ color: #fff;
+ background: blue;
+ padding: 20px;
+} \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/resources/css/result.css b/testing/web-platform/tests/html/browsers/offline/resources/css/result.css
new file mode 100644
index 000000000..7d784b8ab
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/resources/css/result.css
@@ -0,0 +1,11 @@
+.manualpass {
+ color: green;
+}
+.manualfail {
+ color: red;
+}.pass {
+ color: green;
+}
+.fail {
+ color: red;
+}
diff --git a/testing/web-platform/tests/html/browsers/offline/resources/html/clock.html b/testing/web-platform/tests/html/browsers/offline/resources/html/clock.html
new file mode 100644
index 000000000..6b8949a6b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/resources/html/clock.html
@@ -0,0 +1,12 @@
+<!-- clock.html -->
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>Clock</title>
+ <script src="../js/clock.js"></script>
+ <link rel="stylesheet" href="../css/clock.css">
+ </head>
+ <body>
+ <p>The time is: <output id="clock"></output></p>
+ </body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/resources/js/clock.js b/testing/web-platform/tests/html/browsers/offline/resources/js/clock.js
new file mode 100644
index 000000000..1ac0dca53
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/resources/js/clock.js
@@ -0,0 +1,3 @@
+setTimeout(function () {
+ document.getElementById('clock').value = new Date();
+}, 1000); \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/resources/manifest/clock.manifest b/testing/web-platform/tests/html/browsers/offline/resources/manifest/clock.manifest
new file mode 100644
index 000000000..a61aae6c6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/resources/manifest/clock.manifest
@@ -0,0 +1,17 @@
+CACHE MANIFEST
+
+# Version 1
+
+CACHE:
+../css/clock.css
+../js/clock.js
+../css/result.css
+../css/offline.css
+/resources/testharness.js
+/resources/testharnessreport.js
+
+NETWORK:
+../html/clock.html
+
+FALLBACK:
+../css/online.css ../css/offline.css \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/resources/manifest/section_empty.manifest b/testing/web-platform/tests/html/browsers/offline/resources/manifest/section_empty.manifest
new file mode 100644
index 000000000..a23b9013b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/resources/manifest/section_empty.manifest
@@ -0,0 +1,10 @@
+CACHE MANIFEST
+
+# Version 1
+
+../css/clock.css
+../js/clock.js
+../css/result.css
+../css/online.css
+/resources/testharness.js
+/resources/testharnessreport.js \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/resources/manifest/section_many.manifest b/testing/web-platform/tests/html/browsers/offline/resources/manifest/section_many.manifest
new file mode 100644
index 000000000..7e5e5e999
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/resources/manifest/section_many.manifest
@@ -0,0 +1,19 @@
+CACHE MANIFEST
+
+# Version 1
+
+CACHE:
+../css/clock.css
+../js/clock.js
+
+CACHE:
+../css/result.css
+../css/offline.css
+/resources/testharness.js
+/resources/testharnessreport.js
+
+NETWORK:
+../html/clock.html
+
+FALLBACK:
+../css/online.css ../css/offline.css \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/resources/manifest/url_check.manifest b/testing/web-platform/tests/html/browsers/offline/resources/manifest/url_check.manifest
new file mode 100644
index 000000000..041df5e55
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/resources/manifest/url_check.manifest
@@ -0,0 +1,17 @@
+CACHE MANIFEST
+
+# Version 1
+
+CACHE:
+../css/cl#ock.css
+../js/clock.js
+../css/result.css
+../css/offline.css
+/resources/testharness.js
+/resources/testharnessreport.js
+
+NETWORK:
+../html/clock.html
+
+FALLBACK:
+../css/online.css ../css/offline.css \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/offline/section_network_offline-manual.html b/testing/web-platform/tests/html/browsers/offline/section_network_offline-manual.html
new file mode 100644
index 000000000..c4121f5bc
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/section_network_offline-manual.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html manifest="resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - Section_network_offline</title>
+ <link rel="stylesheet" href="resources/css/result.css">
+ </head>
+ <body>
+ <ol>
+ <li>Disable the network connection.</li>
+ <li>Refresh the page.</li>
+ <li>If only the frame element can't be loaded, then test is <span class="manualpass"><b>PASS</b></span>, otherwise <span class="manualfail"><b>FAIL</b></span>.</li>
+ </ol>
+
+ <IFRAME id="TestFrame" name="TestWindow" src="html/clock.html" width="600" height="50" scrolling="auto" frameborder="1">
+ </IFRAME>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/section_network_online-manual.html b/testing/web-platform/tests/html/browsers/offline/section_network_online-manual.html
new file mode 100644
index 000000000..a5d8e5940
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/section_network_online-manual.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html manifest="resources/manifest/clock.manifest">
+ <head>
+ <title>Offline Application Cache - Section_network_online</title>
+ <link rel="stylesheet" href="resources/css/result.css">
+ </head>
+ <body>
+ <ol>
+ <li>Refresh the page.</li>
+ <li>If the frame element is loaded, then test is <span class="manualpass"><b>PASS</b></span>, otherwise <span class="manualfail"><b>FAIL</b></span>.</li>
+ </ol>
+
+ <IFRAME id="TestFrame" name="TestWindow" src="html/clock.html" width="600" height="50" scrolling="auto" frameborder="1">
+ </IFRAME>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/offline/the-application-cache-selection-algorithm/.gitkeep b/testing/web-platform/tests/html/browsers/offline/the-application-cache-selection-algorithm/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/offline/the-application-cache-selection-algorithm/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/origin/.gitkeep b/testing/web-platform/tests/html/browsers/origin/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/origin/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-on-new-window.html b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-on-new-window.html
new file mode 100644
index 000000000..3ad0de6a3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-on-new-window.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Cross-origin behavior of Window and Location on new Window</title>
+<link rel="author" title="Bobby Holley (:bholley)" href="bobbyholley@gmail.com">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#security-window">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#security-location">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+setup({explicit_done: true});
+
+window.addEventListener('message', function onmessage(evt) {
+ window.removeEventListener('message', onmessage);
+ test(function() {
+ var results = evt.data;
+ assert_true(results.length > 0, 'Need results');
+ results.forEach(function(r) { assert_true(r.pass, r.message); });
+ }, "Cross-origin object identity preserved across document.domain");
+ win.close();
+ done();
+});
+var win = window.open('win-documentdomain.sub.html');
+</script>
diff --git a/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html
new file mode 100644
index 000000000..090510de6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html
@@ -0,0 +1,373 @@
+<!doctype html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Cross-origin behavior of Window and Location</title>
+<link rel="author" title="Bobby Holley (:bholley)" href="bobbyholley@gmail.com">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#security-window">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#security-location">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<div id=log></div>
+<iframe id="B"></iframe>
+<iframe id="C"></iframe>
+<script>
+
+/*
+ * Setup boilerplate. This gives us a same-origin window "B" and a cross-origin
+ * window "C".
+ */
+var host_info = get_host_info();
+
+setup({explicit_done: true});
+path = location.pathname.substring(0, location.pathname.lastIndexOf('/')) + '/frame.html';
+var B = document.getElementById('B').contentWindow;
+var C = document.getElementById('C').contentWindow;
+B.frameElement.uriToLoad = path;
+C.frameElement.uriToLoad = get_host_info().HTTP_REMOTE_ORIGIN + path;
+
+function reloadSubframes(cb) {
+ var iframes = document.getElementsByTagName('iframe');
+ iframes.forEach = Array.prototype.forEach;
+ var count = 0;
+ function frameLoaded() {
+ this.onload = null;
+ if (++count == iframes.length)
+ cb();
+ }
+ iframes.forEach(function(ifr) { ifr.onload = frameLoaded; ifr.setAttribute('src', ifr.uriToLoad); });
+}
+function isObject(x) { return Object(x) === x; }
+
+/*
+ * Note: we eschew assert_equals in a lot of these tests, since the harness ends
+ * up throwing when it tries to format a message involving a cross-origin object.
+ */
+
+var testList = [];
+function addTest(fun, desc) { testList.push([fun, desc]); }
+
+
+/*
+ * Basic sanity testing.
+ */
+
+addTest(function() {
+ // Note: we do not check location.host as its default port semantics are hard to reflect statically
+ assert_equals(location.hostname, host_info.ORIGINAL_HOST, 'Need to run the top-level test from domain ' + host_info.ORIGINAL_HOST);
+ assert_equals(get_port(location), host_info.HTTP_PORT, 'Need to run the top-level test from port ' + host_info.HTTP_PORT);
+ assert_equals(B.parent, window, "window.parent works same-origin");
+ assert_equals(C.parent, window, "window.parent works cross-origin");
+ assert_equals(B.location.pathname, path, "location.href works same-origin");
+ assert_throws(null, function() { C.location.pathname; }, "location.pathname throws cross-origin");
+ assert_equals(B.frames, 'override', "Overrides visible in the same-origin case");
+ assert_equals(C.frames, C, "Overrides invisible in the cross-origin case");
+}, "Basic sanity-checking");
+
+/*
+ * Whitelist behavior.
+ *
+ * Also tests for [[GetOwnProperty]] and [[HasOwnProperty]] behavior.
+ */
+
+var whitelistedWindowPropNames = ['location', 'postMessage', 'window', 'frames', 'self', 'top', 'parent',
+ 'opener', 'closed', 'close', 'blur', 'focus', 'length'];
+var whitelistedSymbols = [Symbol.isConcatSpreadable, Symbol.toStringTag,
+ Symbol.hasInstance];
+var whitelistedWindowProps = whitelistedWindowPropNames.concat(whitelistedSymbols);
+
+addTest(function() {
+ for (var prop in window) {
+ if (whitelistedWindowProps.indexOf(prop) != -1) {
+ C[prop]; // Shouldn't throw.
+ Object.getOwnPropertyDescriptor(C, prop); // Shouldn't throw.
+ assert_true(Object.prototype.hasOwnProperty.call(C, prop), "hasOwnProperty for " + String(prop));
+ } else {
+ assert_throws(null, function() { C[prop]; }, "Should throw when accessing " + String(prop) + " on Window");
+ assert_throws(null, function() { Object.getOwnPropertyDescriptor(C, prop); },
+ "Should throw when accessing property descriptor for " + prop + " on Window");
+ assert_throws(null, function() { Object.prototype.hasOwnProperty.call(C, prop); },
+ "Should throw when invoking hasOwnProperty for " + prop + " on Window");
+ }
+ if (prop != 'location')
+ assert_throws(null, function() { C[prop] = undefined; }, "Should throw when writing to " + prop + " on Window");
+ }
+ for (var prop in location) {
+ if (prop == 'replace') {
+ C.location[prop]; // Shouldn't throw.
+ Object.getOwnPropertyDescriptor(C.location, prop); // Shouldn't throw.
+ assert_true(Object.prototype.hasOwnProperty.call(C.location, prop), "hasOwnProperty for " + prop);
+ }
+ else {
+ assert_throws(null, function() { C[prop]; }, "Should throw when accessing " + prop + " on Location");
+ assert_throws(null, function() { Object.getOwnPropertyDescriptor(C, prop); },
+ "Should throw when accessing property descriptor for " + prop + " on Location");
+ assert_throws(null, function() { Object.prototype.hasOwnProperty.call(C, prop); },
+ "Should throw when invoking hasOwnProperty for " + prop + " on Location");
+ }
+ if (prop != 'href')
+ assert_throws(null, function() { C[prop] = undefined; }, "Should throw when writing to " + prop + " on Location");
+ }
+}, "Only whitelisted properties are accessible cross-origin");
+
+/*
+ * ES Internal Methods.
+ */
+
+/*
+ * [[GetPrototypeOf]]
+ */
+addTest(function() {
+ assert_true(Object.getPrototypeOf(C) === null, "cross-origin Window proto is null");
+ assert_true(Object.getPrototypeOf(C.location) === null, "cross-origin Location proto is null (__proto__)");
+ var protoGetter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').get;
+ assert_true(protoGetter.call(C) === null, "cross-origin Window proto is null");
+ assert_true(protoGetter.call(C.location) === null, "cross-origin Location proto is null (__proto__)");
+ assert_throws(null, function() { C.__proto__; }, "__proto__ property not available cross-origin");
+ assert_throws(null, function() { C.location.__proto__; }, "__proto__ property not available cross-origin");
+
+}, "[[GetPrototypeOf]] should return null");
+
+/*
+ * [[SetPrototypeOf]]
+ */
+addTest(function() {
+ assert_throws(null, function() { C.__proto__ = new Object(); }, "proto set on cross-origin Window");
+ assert_throws(null, function() { C.location.__proto__ = new Object(); }, "proto set on cross-origin Location");
+ var setters = [Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set];
+ if (Object.setPrototypeOf)
+ setters.push(function(p) { Object.setPrototypeOf(this, p); });
+ setters.forEach(function(protoSetter) {
+ assert_throws(null, function() { protoSetter.call(C, new Object()); }, "proto setter |call| on cross-origin Window");
+ assert_throws(null, function() { protoSetter.call(C.location, new Object()); }, "proto setter |call| on cross-origin Location");
+ });
+}, "[[SetPrototypeOf]] should throw");
+
+/*
+ * [[IsExtensible]]
+ */
+addTest(function() {
+ assert_true(Object.isExtensible(C), "cross-origin Window should be extensible");
+ assert_true(Object.isExtensible(C.location), "cross-origin Location should be extensible");
+}, "[[IsExtensible]] should return true for cross-origin objects");
+
+/*
+ * [[PreventExtensions]]
+ */
+addTest(function() {
+ assert_throws(null, function() { Object.preventExtensions(C) },
+ "preventExtensions on cross-origin Window should throw");
+ assert_throws(null, function() { Object.preventExtensions(C.location) },
+ "preventExtensions on cross-origin Location should throw");
+}, "[[PreventExtensions]] should throw for cross-origin objects");
+
+/*
+ * [[GetOwnProperty]]
+ */
+
+addTest(function() {
+ assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'close')), "C.close is |own|");
+ assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'top')), "C.top is |own|");
+ assert_true(isObject(Object.getOwnPropertyDescriptor(C.location, 'href')), "C.location.href is |own|");
+ assert_true(isObject(Object.getOwnPropertyDescriptor(C.location, 'replace')), "C.location.replace is |own|");
+}, "[[GetOwnProperty]] - Properties on cross-origin objects should be reported |own|");
+
+function checkPropertyDescriptor(desc, propName, expectWritable) {
+ var isSymbol = (typeof(propName) == "symbol");
+ propName = String(propName);
+ assert_true(isObject(desc), "property descriptor for " + propName + " should exist");
+ assert_equals(desc.enumerable, false, "property descriptor for " + propName + " should be non-enumerable");
+ assert_equals(desc.configurable, true, "property descriptor for " + propName + " should be configurable");
+ if (isSymbol) {
+ assert_true("value" in desc,
+ "property descriptor for " + propName + " should be a value descriptor");
+ assert_equals(desc.value, undefined,
+ "symbol-named cross-origin visible prop " + propName +
+ " should come back as undefined");
+ }
+ if ('value' in desc)
+ assert_equals(desc.writable, expectWritable, "property descriptor for " + propName + " should have writable: " + expectWritable);
+ else
+ assert_equals(typeof desc.set != 'undefined', expectWritable,
+ "property descriptor for " + propName + " should " + (expectWritable ? "" : "not ") + "have setter");
+}
+
+addTest(function() {
+ whitelistedWindowProps.forEach(function(prop) {
+ var desc = Object.getOwnPropertyDescriptor(C, prop);
+ checkPropertyDescriptor(desc, prop, prop == 'location');
+ });
+ checkPropertyDescriptor(Object.getOwnPropertyDescriptor(C.location, 'replace'), 'replace', false);
+ checkPropertyDescriptor(Object.getOwnPropertyDescriptor(C.location, 'href'), 'href', true);
+ assert_equals(typeof Object.getOwnPropertyDescriptor(C.location, 'href').get, 'undefined', "Cross-origin location should have no href getter");
+ whitelistedSymbols.forEach(function(prop) {
+ var desc = Object.getOwnPropertyDescriptor(C.location, prop);
+ checkPropertyDescriptor(desc, prop, false);
+ });
+}, "[[GetOwnProperty]] - Property descriptors for cross-origin properties should be set up correctly");
+
+/*
+ * [[Delete]]
+ */
+addTest(function() {
+ assert_throws(null, function() { delete C[0]; }, "Can't delete cross-origin indexed property");
+ assert_throws(null, function() { delete C[100]; }, "Can't delete cross-origin indexed property");
+ assert_throws(null, function() { delete C.location; }, "Can't delete cross-origin property");
+ assert_throws(null, function() { delete C.parent; }, "Can't delete cross-origin property");
+ assert_throws(null, function() { delete C.length; }, "Can't delete cross-origin property");
+ assert_throws(null, function() { delete C.document; }, "Can't delete cross-origin property");
+ assert_throws(null, function() { delete C.foopy; }, "Can't delete cross-origin property");
+ assert_throws(null, function() { delete C.location.href; }, "Can't delete cross-origin property");
+ assert_throws(null, function() { delete C.location.replace; }, "Can't delete cross-origin property");
+ assert_throws(null, function() { delete C.location.port; }, "Can't delete cross-origin property");
+ assert_throws(null, function() { delete C.location.foopy; }, "Can't delete cross-origin property");
+}, "[[Delete]] Should throw on cross-origin objects");
+
+/*
+ * [[DefineOwnProperty]]
+ */
+function checkDefine(obj, prop) {
+ var valueDesc = { configurable: true, enumerable: false, writable: false, value: 2 };
+ var accessorDesc = { configurable: true, enumerable: false, get: function() {} };
+ assert_throws(null, function() { Object.defineProperty(obj, prop, valueDesc); }, "Can't define cross-origin value property " + prop);
+ assert_throws(null, function() { Object.defineProperty(obj, prop, accessorDesc); }, "Can't define cross-origin accessor property " + prop);
+}
+addTest(function() {
+ checkDefine(C, 'length');
+ checkDefine(C, 'parent');
+ checkDefine(C, 'location');
+ checkDefine(C, 'document');
+ checkDefine(C, 'foopy');
+ checkDefine(C.location, 'href');
+ checkDefine(C.location, 'replace');
+ checkDefine(C.location, 'port');
+ checkDefine(C.location, 'foopy');
+}, "[[DefineOwnProperty]] Should throw for cross-origin objects");
+
+/*
+ * [[Enumerate]]
+ */
+
+addTest(function() {
+ for (var prop in C)
+ assert_unreached("Shouldn't have been able to enumerate " + prop + " on cross-origin Window");
+ for (var prop in C.location)
+ assert_unreached("Shouldn't have been able to enumerate " + prop + " on cross-origin Location");
+}, "[[Enumerate]] should return an empty iterator");
+
+/*
+ * [[OwnPropertyKeys]]
+ */
+
+addTest(function() {
+ assert_array_equals(whitelistedWindowPropNames.sort(),
+ Object.getOwnPropertyNames(C).sort(),
+ "Object.getOwnPropertyNames() gives the right answer for cross-origin Window");
+ assert_array_equals(Object.getOwnPropertyNames(C.location).sort(), ['href', 'replace'],
+ "Object.getOwnPropertyNames() gives the right answer for cross-origin Location");
+}, "[[OwnPropertyKeys]] should return all properties from cross-origin objects");
+
+// Compare two arrays that need to have the same elements but may be in
+// different orders. The problem is that there's no good way to sort arrays
+// containing Symbols.
+function assert_arrays_equal_up_to_order(arr1, arr2, desc) {
+ for (let item of arr1) {
+ assert_in_array(item, arr2, desc);
+ }
+
+ for (let item of arr2) {
+ assert_in_array(item, arr1, desc);
+ }
+}
+
+addTest(function() {
+ assert_arrays_equal_up_to_order(Object.getOwnPropertySymbols(C),
+ whitelistedSymbols,
+ "Object.getOwnPropertySymbols() should return the three symbol-named properties that are exposed on a cross-origin Window");
+ assert_arrays_equal_up_to_order(Object.getOwnPropertySymbols(C.location),
+ whitelistedSymbols,
+ "Object.getOwnPropertySymbols() should return the three symbol-named properties that are exposed on a cross-origin Location");
+}, "[[OwnPropertyKeys]] should return the right symbol-named properties for cross-origin objects");
+
+addTest(function() {
+ assert_true(B.eval('parent.C') === C, "A and B observe the same identity for C's Window");
+ assert_true(B.eval('parent.C.location') === C.location, "A and B observe the same identity for C's Location");
+}, "A and B jointly observe the same identity for cross-origin Window and Location");
+
+function checkFunction(f, proto) {
+ var name = f.name || '<missing name>';
+ assert_equals(typeof f, 'function', name + " is a function");
+ assert_equals(Object.getPrototypeOf(f), proto, f.name + " has the right prototype");
+}
+
+addTest(function() {
+ checkFunction(C.close, Function.prototype);
+ checkFunction(C.location.replace, Function.prototype);
+}, "Cross-origin functions get local Function.prototype");
+
+addTest(function() {
+ assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'parent')),
+ "Need to be able to use Object.getOwnPropertyDescriptor do this test");
+ checkFunction(Object.getOwnPropertyDescriptor(C, 'parent').get, Function.prototype);
+ checkFunction(Object.getOwnPropertyDescriptor(C.location, 'href').set, Function.prototype);
+}, "Cross-origin Window accessors get local Function.prototype");
+
+addTest(function() {
+ checkFunction(close, Function.prototype);
+ assert_true(close != B.close, 'same-origin Window functions get their own object');
+ assert_true(close != C.close, 'cross-origin Window functions get their own object');
+ var close_B = B.eval('parent.C.close');
+ assert_true(close != close_B, 'close_B is unique when viewed by the parent');
+ assert_true(close_B != C.close, 'different Window functions per-incumbent script settings object');
+ checkFunction(close_B, B.Function.prototype);
+
+ checkFunction(location.replace, Function.prototype);
+ assert_true(location.replace != C.location.replace, "cross-origin Location functions get their own object");
+ var replace_B = B.eval('parent.C.location.replace');
+ assert_true(replace_B != C.location.replace, 'different Location functions per-incumbent script settings object');
+ checkFunction(replace_B, B.Function.prototype);
+}, "Same-origin observers get different functions for cross-origin objects");
+
+addTest(function() {
+ assert_true(isObject(Object.getOwnPropertyDescriptor(C, 'parent')),
+ "Need to be able to use Object.getOwnPropertyDescriptor do this test");
+ var get_self_parent = Object.getOwnPropertyDescriptor(window, 'parent').get;
+ var get_parent_A = Object.getOwnPropertyDescriptor(C, 'parent').get;
+ var get_parent_B = B.eval('Object.getOwnPropertyDescriptor(parent.C, "parent").get');
+ assert_true(get_self_parent != get_parent_A, 'different Window accessors per-incumbent script settings object');
+ assert_true(get_parent_A != get_parent_B, 'different Window accessors per-incumbent script settings object');
+ checkFunction(get_self_parent, Function.prototype);
+ checkFunction(get_parent_A, Function.prototype);
+ checkFunction(get_parent_B, B.Function.prototype);
+}, "Same-origin observers get different accessors for cross-origin Window");
+
+addTest(function() {
+ var set_self_href = Object.getOwnPropertyDescriptor(window.location, 'href').set;
+ var set_href_A = Object.getOwnPropertyDescriptor(C.location, 'href').set;
+ var set_href_B = B.eval('Object.getOwnPropertyDescriptor(parent.C.location, "href").set');
+ assert_true(set_self_href != set_href_A, 'different Location accessors per-incumbent script settings object');
+ assert_true(set_href_A != set_href_B, 'different Location accessors per-incumbent script settings object');
+ checkFunction(set_self_href, Function.prototype);
+ checkFunction(set_href_A, Function.prototype);
+ checkFunction(set_href_B, B.Function.prototype);
+}, "Same-origin observers get different accessors for cross-origin Location");
+
+addTest(function() {
+ assert_equals({}.toString.call(C), "[object Object]");
+ assert_equals({}.toString.call(C.location), "[object Object]");
+}, "{}.toString.call() does the right thing on cross-origin objects");
+
+// We do a fresh load of the subframes for each test to minimize side-effects.
+// It would be nice to reload ourselves as well, but we can't do that without
+// disrupting the test harness.
+function runNextTest() {
+ var entry = testList.shift();
+ test(entry[0], entry[1]);
+ if (testList.length != 0)
+ reloadSubframes(runNextTest);
+ else
+ done();
+}
+reloadSubframes(runNextTest);
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/frame.html b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/frame.html
new file mode 100644
index 000000000..046e49da7
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/frame.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+<head>
+<script>
+ // Override the |frames| property to test that such overrides are
+ // properly ignored cross-origin.
+ window.frames = "override";
+
+ // If we get a postMessage, we grab references to everything and set
+ // document.domain to trim off our topmost subdomain.
+ window.onmessage = function(evt) {
+ window.windowReferences = [];
+ window.locationReferences = [];
+ for (var i = 0; i < parent.length; ++i) {
+ windowReferences.push(parent[i]);
+ locationReferences.push(parent[i].location);
+ }
+ try {
+ document.domain = document.domain.substring(document.domain.indexOf('.') + 1);
+ evt.source.postMessage('PASS', '*');
+ } catch (e) {
+ evt.source.postMessage('FAIL: cannot trim off document.domain: ' + e, '*');
+ }
+ }
+
+ function checkWindowReferences() {
+ for (var i = 0; i < parent.length; ++i) {
+ if (windowReferences[i] != parent[i])
+ throw new Error("Window references don't match for " + i + " after document.domain");
+ if (locationReferences[i] != parent[i].location)
+ throw new Error("Location references don't match for " + i + " after document.domain");
+ }
+ return true;
+ }
+</script>
+</head>
+<body>
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/win-documentdomain.sub.html b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/win-documentdomain.sub.html
new file mode 100644
index 000000000..a315e2120
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/win-documentdomain.sub.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script>
+ function loadFrames() {
+ window.A = document.getElementById('A').contentWindow;
+ window.B = document.getElementById('B').contentWindow;
+ window.C = document.getElementById('C').contentWindow;
+ window.D = document.getElementById('D').contentWindow;
+
+ var path = location.pathname.substring(0, location.pathname.lastIndexOf('/')) + '/frame.html';
+ A.location = 'frame.html';
+ B.location = '//{{domains[www2]}}:' + get_port(location) + path;
+ C.location = '//{{domains[www2]}}:' + get_port(location) + path;
+ D.location = '//{{domains[www1]}}:' + get_port(location) + path;
+
+ var loadCount = 0;
+ function frameLoaded() {
+ if (++loadCount == 4)
+ go();
+ }
+ var iframes = document.getElementsByTagName('iframe');
+ for (var i = 0; i < iframes.length; i++) {
+ iframes[i].onload = frameLoaded;
+ }
+ }
+
+ var results = [];
+ function assert(cond, msg) {
+ results.push({pass: !!cond, message: msg});
+ }
+
+ function go() {
+ window.onmessage = function(evt) {
+ try {
+ assert(evt.data == "PASS", "frame.html processing should be PASS but got " + evt.data);
+ assert(B.checkWindowReferences(), "B's Window references are still self-consistent after document.domain");
+ for (var i = 0; i < window.length; ++i) {
+ assert(window[i] === B.windowReferences[i],
+ "Window reference " + i + " consistent between globals after document.domain");
+ assert(window[i].location === B.locationReferences[i],
+ "Location reference " + i + " consistent between globals after document.domain");
+ }
+ } catch(e) {
+ assert(false, "Should not receive exception: " + e);
+ }
+ opener.postMessage(results, '*');
+ };
+ A.document.domain = A.document.domain;
+ document.domain = document.domain;
+ B.postMessage('', '*');
+ }
+
+ </script>
+</head>
+<body onload="loadFrames()">
+ <iframe id="A"></iframe>
+ <iframe id="B"></iframe>
+ <iframe id="C"></iframe>
+ <iframe id="D"></iframe>
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/origin/origin-of-data-document.html b/testing/web-platform/tests/html/browsers/origin/origin-of-data-document.html
new file mode 100644
index 000000000..cedb2513f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/origin/origin-of-data-document.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset=utf-8>
+ <title>Origin of document produced from a 'data:' URL</title>
+ <link rel="help" href="https://html.spec.whatwg.org/multipage/browsers.html#origin">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ async_test(function (t) {
+ window.addEventListener("message", t.step_func_done(function (e) {
+ assert_equals(e.origin, "null", "Messages sent from a 'data:' URL should have an opaque origin (which serializes to 'null').");
+ assert_throws("SecurityError", function () {
+ var couldAccessCrossOriginProperty = e.source.location.href;
+ }, "The 'data:' frame should be cross-origin.")
+ }));
+
+ var i = document.createElement('iframe');
+ i.src = "data:text/html,<script>" +
+ " window.parent.postMessage('Hello!', '*');" +
+ "</scr" + "ipt>";
+ document.body.appendChild(i);
+ }, "The origin of a 'data:' document in a frame is opaque.");
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/.gitkeep b/testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain.html b/testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain.html
new file mode 100644
index 000000000..af9332173
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+ <head>
+ <title></title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script>
+ test(function() {
+ assert_equals(typeof document.domain, "string", "document.domain is a string");
+ assert_not_equals(document.domain, "", "document.domain is not empty");
+ }, "sanity checks");
+
+ test(function() {
+ assert_equals(document.domain, window.location.hostname, "equals location.hostname");
+ }, "current document");
+
+ test(function() {
+ var doc = new Document();
+ assert_equals(doc.domain, "", "new document has empty domain");
+ }, "new document");
+ </script>
+ </head>
+ <body>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/sandboxing/.gitkeep b/testing/web-platform/tests/html/browsers/sandboxing/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/sandboxing/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/.gitkeep b/testing/web-platform/tests/html/browsers/the-window-object/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/Document-defaultView.html b/testing/web-platform/tests/html/browsers/the-window-object/Document-defaultView.html
new file mode 100644
index 000000000..dbc75d30b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/Document-defaultView.html
@@ -0,0 +1,38 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Document#defaultView</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(function() {
+ assert_equals(document.defaultView, window);
+}, "Document in a browsing context");
+
+test(function() {
+ var d = new Document();
+ assert_equals(d.defaultView, null);
+}, "Document created with the Document constructor");
+
+test(function() {
+ var d = document.implementation.createDocument(null, null);
+ assert_equals(d.defaultView, null);
+}, "Document created with createDocument");
+
+test(function() {
+ var d = document.implementation.createHTMLDocument();
+ assert_equals(d.defaultView, null);
+}, "Document created with createHTMLDocument");
+
+test(function() {
+ var parser = new DOMParser();
+ var d = parser.parseFromString("<foo\/\>", "application/xml");
+ assert_equals(d.defaultView, null);
+}, "Document created with XML DOMParser");
+
+test(function() {
+ var parser = new DOMParser();
+ var d = parser.parseFromString("bar", "text/html");
+ assert_equals(d.defaultView, null);
+}, "Document created with HTML DOMParser");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/Window-document.html b/testing/web-platform/tests/html/browsers/the-window-object/Window-document.html
new file mode 100644
index 000000000..9b27f5f7c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/Window-document.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Window#document</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+async_test(function() {
+ var URL = "/common/blank.html";
+
+ var iframe = document.createElement("iframe");
+ document.body.appendChild(iframe);
+ var initialWindow = iframe.contentWindow;
+ var initialDocument = initialWindow.document;
+ assert_equals(initialDocument.URL, "about:blank");
+ iframe.src = URL;
+ iframe.onload = this.step_func_done(function() {
+ assert_equals(iframe.contentWindow, initialWindow);
+ assert_equals(initialDocument.URL, "about:blank");
+ var loadedDocument = initialWindow.document;
+ assert_equals(loadedDocument.URL, location.href.replace(location.pathname, URL));
+ assert_not_equals(initialDocument, loadedDocument);
+ });
+}, "Document in a browsing context");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-01.html b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-01.html
new file mode 100644
index 000000000..9710d15fb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-01.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: the browsing contexts must be sorted in the order that their containers were inserted into the Document</title>
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/browsers.html#accessing-other-browsing-contexts" />
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+
+var t1 = async_test("The window's length must return the number of child browsing contexts(in iframe)");
+function on_load1(fr) {
+ t1.step(function () {
+ var doc = fr.contentDocument;
+ var fr3 = doc.createElement("iframe");
+ fr3.setAttribute("id", "fr3");
+ doc.body.insertBefore(fr3, doc.getElementById("tbl"));
+
+ assert_equals(fr.contentWindow.length, 3, "The window.length should be 3.");
+ assert_array_equals([fr.contentWindow[0].frameElement, fr.contentWindow[1].frameElement, fr.contentWindow[2].frameElement],
+ [fr.contentDocument.getElementById("fr4"), fr.contentDocument.getElementById("fr5"), fr.contentDocument.getElementById("fr3")],
+ "The child browsing contexts must be sorted in the order that their containers were inserted into the Document.");
+ });
+ t1.done();
+}
+
+var t2 = async_test("The window's length must return zero if it has no child browsing context");
+function on_load2(fr) {
+ t2.step(function () {
+ assert_equals(fr.contentWindow.length, 0, "The window.length should be 0.");
+ });
+ t2.done();
+}
+
+</script>
+<iframe id="fr1" src="test1.html" style="display:none" onload="on_load1(this)"></iframe>
+<iframe id="fr2" src="test2.html" style="display:none" onload="on_load2(this)"></iframe>
+<script>
+
+test(function () {
+ assert_equals(window.length, 2, "The window.length should be 2.");
+ assert_array_equals([window[0].frameElement, window[1].frameElement],
+ [document.getElementById("fr1"), document.getElementById("fr2")],
+ "The child browsing contexts must be sorted in the tree order.");
+}, "The window's length must return the number of child browsing contexts");
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-02.html b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-02.html
new file mode 100644
index 000000000..d09c944fd
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-02.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<head>
+ <meta charset="utf-8">
+ <title>HTML Test: the browsing contexts created by various container elements</title>
+ <link rel="author" title="Intel" href="http://www.intel.com/" />
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script>
+
+ var t1 = async_test("Accessing child browsing contexts 1");
+ var t2 = async_test("Accessing child browsing contexts 2");
+ var t3 = async_test("Accessing child browsing contexts 3");
+ function on_load() {
+ //Child browsing contexts created by iframe, object and embed elements.
+ t1.step(function () {
+ assert_equals(window.length, 3, "The top browsing context should have 3 child browsing contexts.");
+ });
+ t1.step(function () {
+ assert_equals(window[0].name, "win1", "The browsing context name should be 'win1'.");
+ assert_equals(window[1].name, "win2", "The browsing context name should be 'win2'.");
+ assert_equals(window[2].name, "win3", "The browsing context name should be 'win3'.");
+ });
+ t1.done();
+
+ //Child browsing contexts created by frame elements.
+ t2.step(function () {
+ assert_equals(document.getElementById("fr").contentWindow.length, 2,
+ "The child browsing context created by the iframe element should have 2 child browsing contexts.");
+ });
+ t2.step(function () {
+ assert_equals(document.getElementById("fr").contentWindow[0].name, "win4",
+ "The browsing context name should be 'win4'.");
+ assert_equals(document.getElementById("fr").contentWindow[1].name, "win5",
+ "The browsing context name should be 'win5'.");
+ });
+ t2.done();
+
+ //The child browsing context will be removed if the data attribute of the associated object element is removed.
+ t3.step(function () {
+ document.getElementById("obj").removeAttribute("type");
+ assert_equals(window.length, 3, "The top browsing context should have 3 child browsing contexts.");
+ document.getElementById("obj").removeAttribute("data");
+ assert_equals(window.length, 3, "The top browsing context should have 3 child browsing contexts.");
+
+ setTimeout(function () {
+ assert_equals(window.length, 2, "The top browsing context should have 2 child browsing contexts.");
+ }, 1);
+ });
+ t3.done();
+ }
+
+ </script>
+</head>
+<body onload="on_load()">
+ <div id="log"></div>
+ <div style="display:none">
+ <iframe id="fr" name="win1" src="test3.html"></iframe>
+ <object id="obj" name="win2" type="text/html" data="about:blank"></object>
+ <object type="image/png" src="/images/green.png"></object>
+ <embed id="emb" name="win3" type="image/svg+xml" src="/images/green.svg"></embed>
+ </div>
+</body>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-03.html b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-03.html
new file mode 100644
index 000000000..154889117
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-03.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<head>
+ <meta charset="utf-8">
+ <title>HTML Test: indexed property of a Window object</title>
+ <link rel="author" title="Intel" href="http://www.intel.com/" />
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script>
+
+ var t1 = async_test("Indexed child browsing contexts");
+ function on_load() {
+ t1.step(function () {
+ assert_equals(window[0], document.getElementsByTagName("object")[0].contentWindow,
+ "The first child browsing context's container should be the object element.");
+ assert_equals(window[1], document.getElementsByTagName("iframe")[0].contentWindow,
+ "The second child browsing context's container should be the iframe element.");
+ });
+ t1.done();
+ }
+
+ </script>
+</head>
+<body onload="on_load()">
+ <div id="log"></div>
+ <div style="display:none">
+ <div id="0"></div>
+ <object name="0" type="text/html" data="test2.html"></object>
+ <iframe name="0" src="about:blank"></iframe>
+ </div>
+</body>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/iterator.html b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/iterator.html
new file mode 100644
index 000000000..76dc7dbae
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/iterator.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>window[@@iterator]</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ assert_false(Symbol.iterator in window);
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test1.html b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test1.html
new file mode 100644
index 000000000..f85f90f7c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test1.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: child browsing contexts created by iframe elements</title>
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<table id="tbl">
+ <tr>
+ <td>
+ <iframe id="fr4" src=""></iframe>
+ </td>
+ </tr>
+ <iframe id="fr5" src="about:blank"></iframe>
+</table>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test2.html b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test2.html
new file mode 100644
index 000000000..d6a16647f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test2.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: child browsing contexts created by object and embed elements</title>
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<object type="image/png" src="/images/green.png"></object>
+<embed type="image/png" src="/images/green.png"></embed>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test3.html b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test3.html
new file mode 100644
index 000000000..a62fdbaae
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/test3.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: child browsing contexts created by frame elements</title>
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<frameset>
+ <frame name="win4"></frame>
+ <frame name="win5"></frame>
+</frameset>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/window_length.html b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/window_length.html
new file mode 100644
index 000000000..c9559b531
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/accessing-other-browsing-contexts/window_length.html
@@ -0,0 +1,51 @@
+<!doctype html>
+<title>window.length</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+var iframe;
+var subframe;
+var other_window;
+test(function() {assert_equals(window.length, 0)}, "No child browsing contexts");
+test(function() {
+ iframe = document.createElement("iframe");
+ assert_equals(window.length, 0)
+}, "iframe not inserted into the document");
+
+test(function() {
+ document.body.appendChild(iframe);
+ assert_equals(window.length, 1)
+}, "One iframe inserted into the document");
+
+test(function() {
+ subframe = document.createElement("iframe");
+ iframe.contentDocument.body.appendChild(subframe);
+ assert_equals(window.length, 1);
+}, "Child browsing context has a child browsing context");
+
+test(function() {
+ try {
+ assert_equals(iframe.contentWindow.length, 1);
+ } finally {
+ subframe.parentNode.removeChild(subframe);
+ }
+}, "window.length in child frame");
+
+test(function() {
+ iframe.parentNode.removeChild(iframe);
+ other_window = window.open();
+ assert_equals(window.length, 0);
+ assert_equals(other_window.length, 0);
+}, "Opened window")
+
+test(function() {
+ other_window.document.body.appendChild(iframe);
+ try {
+ assert_equals(other_window.length, 1);
+ } finally {
+ other_window.close();
+ }
+}, "Iframe in opened window")
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/.gitkeep b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/callback.js b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/callback.js
new file mode 100644
index 000000000..ae51265a2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/callback.js
@@ -0,0 +1 @@
+opener.callback() \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_beforeunload-1.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_beforeunload-1.html
new file mode 100644
index 000000000..6f44d8a83
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_beforeunload-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<script>
+onload = function() {opener.postMessage("loaded", "*")};
+onbeforeunload = function() {
+ opener.callback();
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_beforeunload.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_beforeunload.html
new file mode 100644
index 000000000..dcb8830ab
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_beforeunload.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>Running beforeunload handler in window.close()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var w = window.open("close_beforeunload-1.html");
+onmessage = t.step_func(function(event) {
+ if (event.data != "loaded") {
+ return;
+ }
+ w.close();
+});
+callback = function() {t.done()}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_script_defer-1.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_script_defer-1.html
new file mode 100644
index 000000000..c50eddd41
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_script_defer-1.html
@@ -0,0 +1 @@
+<!doctype html>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_script_defer.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_script_defer.html
new file mode 100644
index 000000000..874f5be9d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_script_defer.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<title>Running defer script in window.close()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test(undefined, {timeout:4000});
+t.step(function() {
+ var w = window.open("close_script_defer-1.html");
+ w.document.open()
+ w.document.write("<script defer src='callback.js'><\/script>")
+ setTimeout(function() {
+ w.close();
+ }, 1000);
+})
+setTimeout(function() {t.done();}, 1000)
+callback = t.step(function() {assert_unreached()})
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_unload-1.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_unload-1.html
new file mode 100644
index 000000000..9a9e304e8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_unload-1.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<script>
+onload = function() {opener.postMessage("loaded", "*")};
+onunload = function() {
+ opener.callback();
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_unload.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_unload.html
new file mode 100644
index 000000000..e4d231b28
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/close_unload.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>Running unload handler in window.close()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var w = window.open("close_unload-1.html");
+onmessage = t.step_func(function(event) {
+ if (event.data != "loaded") {
+ return;
+ }
+ w.close();
+});
+callback = function() {t.done()}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/creating_browsing_context_test_01.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/creating_browsing_context_test_01.html
new file mode 100644
index 000000000..75c8729cf
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/creating_browsing_context_test_01.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>[Browsing Context] : [APIs for creating browsing_contexts by name]</title>
+<link rel="author" title="Duhyeong Kim" href="mailto:dduskim@gmail.com">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name">
+<meta name=timeout content=long>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+async_test(function() {
+ var currentUrl = 'http://' + window.location.host + '/common/blank.html';
+ var win = window.open(currentUrl, '', 'height=1,width=1');
+ this.add_cleanup(function() { win.close(); });
+ win.onload = this.step_func_done(function () {
+ assert_equals(win.location.href, currentUrl, 'should be equal to result url');
+ });
+}, 'first argument: absolute url');
+
+test(function() {
+ var win = window.open('', '', 'height=1,width=1');
+ this.add_cleanup(function() { win.close(); });
+ assert_equals(win.location.href, 'about:blank', 'win.location.href');
+}, 'first argument: empty url');
+
+test(function () {
+ var win = window.open('', 'testWindow', 'height=1,width=1');
+ win.close();
+ assert_equals(win.name, 'testWindow', 'should have a browsing context name');
+}, 'second argument: passing a non-empty name');
+
+test(function () {
+ var win = window.open('', '', 'height=1,width=1');
+ this.add_cleanup(function() { win.close(); });
+ assert_equals(win.name, '', 'window should not have a name');
+ win.name = 'testWindow';
+ assert_equals(win.name, 'testWindow', 'window should have a name');
+}, 'second argument: setting name after opening');
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001-1.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001-1.html
new file mode 100644
index 000000000..7dd48b41c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001-1.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<p>Now open a new tab and navigate to <a href="001-2.html">001-2</a></p>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001-2.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001-2.html
new file mode 100644
index 000000000..b1413861a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001-2.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<script>
+var result = "FAIL";
+if (opener != null) {
+ result = "FAIL (did you open this page in a new tab?)";
+} else {
+ var w = window.open("", "test_name");
+ if (w.location.href !== "about:blank") {
+ result = "FAIL (didn't open an about:blank browsing context)";
+ } else {
+ w.close();
+ result = "PASS";
+ }
+ document.write(result);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001.html
new file mode 100644
index 000000000..7b0f21ec0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/001.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<title>Accessing named windows from outside the unit of related browsing contexts</title>
+<a href="001-1.html" target="test_name">Click here</a>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002-1.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002-1.html
new file mode 100644
index 000000000..0e210f351
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002-1.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<p>Now open a new tab and navigate to <a></a></p>
+<script>
+href = window.location.href.replace("http://", "http://www.").replace("002-1.html", "002-2.html");
+var a = document.getElementsByTagName("a")[0];
+a.href = href;
+a.textContent = href;
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002-2.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002-2.html
new file mode 100644
index 000000000..b1413861a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002-2.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<script>
+var result = "FAIL";
+if (opener != null) {
+ result = "FAIL (did you open this page in a new tab?)";
+} else {
+ var w = window.open("", "test_name");
+ if (w.location.href !== "about:blank") {
+ result = "FAIL (didn't open an about:blank browsing context)";
+ } else {
+ w.close();
+ result = "PASS";
+ }
+ document.write(result);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002.html
new file mode 100644
index 000000000..b568ae8d4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/non_automated/002.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<title>Accessing different-origin named windows from outside the unit of related browsing contexts</title>
+<a href="002-1.html" target="test_name">Click here</a>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/browser-interface-elements/.gitkeep b/testing/web-platform/tests/html/browsers/the-window-object/browser-interface-elements/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/browser-interface-elements/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/closing-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/the-window-object/closing-browsing-contexts/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/closing-browsing-contexts/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1-1.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1-1.html
new file mode 100644
index 000000000..217608e46
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1-1.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<iframe></iframe>
+<script>
+var t = opener.t;
+
+onload = t.step_func(function() {
+ setTimeout(t.step_func(function() {
+ var history_length = history.length;
+ var iframe = document.getElementsByTagName("iframe")[0];
+ iframe.onload = t.step_func(function() {
+ opener.assert_equals(history.length, history_length + 1);
+ iframe.parentNode.removeChild(iframe);
+ opener.assert_equals(history.length, history_length);
+ t.done();
+ window.close();
+ });
+ iframe.src = "discard_iframe_history_1-2.html;";
+ }), 100);
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1-2.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1-2.html
new file mode 100644
index 000000000..b43598f2c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1-2.html
@@ -0,0 +1,2 @@
+<!doctype html>
+Filler text
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1.html
new file mode 100644
index 000000000..4d1e473fc
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<title>Removing iframe from document removes it from history</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var w = window.open("discard_iframe_history_1-1.html");
+</script>
+
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_2-1.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_2-1.html
new file mode 100644
index 000000000..61e5891eb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_2-1.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<iframe></iframe>
+<script>
+var t = opener.t;
+
+onload = t.step_func(function() {
+ setTimeout(t.step_func(function() {
+ var history_length = history.length;
+ var iframe = document.getElementsByTagName("iframe")[0];
+ iframe.onload = t.step_func(function() {
+ setTimeout(t.step_func(function() {
+ opener.assert_equals(history.length, history_length + 1, "History length before iframe removal");
+ document.body.innerHTML = "";
+ opener.assert_equals(history.length, history_length, "History length after iframe removal");
+ t.done();
+ window.close();
+ }), 100);
+ });
+ iframe.src = "discard_iframe_history_1-2.html";
+ }), 100);
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_2.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_2.html
new file mode 100644
index 000000000..89d0fb4c6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_2.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<title>Removing iframe from document via innerHTML removes it from history</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var w = window.open("discard_iframe_history_2-1.html");
+</script>
+
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-1.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-1.html
new file mode 100644
index 000000000..de3f075d6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-1.html
@@ -0,0 +1,21 @@
+<script>
+history_lengths = [];
+
+var t = opener.t;
+
+push_length = t.step_func(function () {
+ history_lengths.push(history.length)
+});
+
+do_test = t.step_func(function () {
+ try {
+ var start_length = history_lengths[0];
+ expected = [start_length, start_length + 1, start_length];
+ opener.assert_array_equals(history_lengths, expected);
+ t.done();
+ } finally {
+ window.close();
+ }
+});
+</script>
+<iframe src="discard_iframe_history_3-2.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-2.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-2.html
new file mode 100644
index 000000000..95f9fce5d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-2.html
@@ -0,0 +1,4 @@
+<a href="discard_iframe_history_3-3.html" onclick="parent.push_length()">Click me</a>
+<script>
+onload = function() {setTimeout(parent.t.step_func(function() {document.links[0].click()}), 100)}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-3.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-3.html
new file mode 100644
index 000000000..4672b0ec3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3-3.html
@@ -0,0 +1,4 @@
+<button onclick="var p = parent; p.push_length(); frameElement.parentNode.removeChild(frameElement); p.push_length(); p.do_test();">Click me</button>
+<script>
+onload = function() {setTimeout(parent.t.step_func(function() {document.getElementsByTagName("button")[0].click()}), 100)}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3.html
new file mode 100644
index 000000000..3046f854f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_3.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<title>Removing iframe from document removes it from history</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test(undefined);
+var w = window.open("discard_iframe_history_3-1.html");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-1.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-1.html
new file mode 100644
index 000000000..1b5726cdc
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-1.html
@@ -0,0 +1,21 @@
+<script>
+history_lengths = [];
+
+var t = opener.t;
+
+push_length = t.step_func(function () {
+ history_lengths.push(history.length)
+});
+
+do_test = t.step_func(function () {
+ try {
+ var start_length = history_lengths[0];
+ expected = [start_length, start_length + 1, start_length];
+ opener.assert_array_equals(history_lengths, expected);
+ t.done();
+ } finally {
+ window.close();
+ }
+});
+</script>
+<iframe src="discard_iframe_history_4-2.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-2.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-2.html
new file mode 100644
index 000000000..979b2b28e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-2.html
@@ -0,0 +1,4 @@
+<a href="discard_iframe_history_4-3.html" onclick="parent.push_length()">Click me</a>
+<script>
+onload = function() {setTimeout(parent.t.step_func(function() {document.links[0].click()}), 100)}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-3.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-3.html
new file mode 100644
index 000000000..b4308f439
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4-3.html
@@ -0,0 +1,4 @@
+<button onclick="var p = parent; p.push_length(); frameElement.parentNode.innerHTML = ''; p.push_length(); p.do_test();">Click me</button>
+<script>
+onload = function() {setTimeout(parent.t.step_func(function() {document.getElementsByTagName("button")[0].click()}), 100)}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4.html
new file mode 100644
index 000000000..ffd444e3b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_4.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<title>Removing iframe from document removes it from history</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test();
+var w = window.open("discard_iframe_history_4-1.html");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-1.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-1.html
new file mode 100644
index 000000000..996942798
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-1.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<iframe></iframe>
+<script>
+var t = opener.t;
+var iframe = document.getElementsByTagName("iframe")[0];
+var history_length;
+
+function load_frame(src) {
+ history_length = history.length;
+ iframe.src = src;
+ var button = document.getElementsByTagName("button")[0];
+ button.parentNode.removeChild(button);
+}
+
+remove_frame = t.step_func(function() {
+ try {
+ opener.assert_equals(history.length, history_length + 1, "History length after loading page in iframe");
+ iframe.parentNode.removeChild(iframe);
+ opener.assert_equals(history.length, history_length, "History length after removing iframe");
+ t.done();
+ } finally {
+ window.close();
+ }
+});
+
+</script>
+<button onclick="load_frame('discard_iframe_history_1-2.html')">Click here</button>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-2.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-2.html
new file mode 100644
index 000000000..8c3d1a9da
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-2.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<button onclick="parent.remove_frame()">Click here</button>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-manual.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-manual.html
new file mode 100644
index 000000000..d69d7d7a8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_1-manual.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<title>Removing iframe from document removes it from history</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+setup({timeout:3600000})
+var t = async_test(undefined, {timeout:3600000});
+var w = window.open("discard_iframe_history_1-1.html");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-1.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-1.html
new file mode 100644
index 000000000..bc01cae88
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-1.html
@@ -0,0 +1,19 @@
+<script>
+history_lengths = [];
+
+function push_length() {
+ history_lengths.push(history.length)
+}
+
+do_test = opener.t.step_func(function () {
+ try {
+ var start_length = history_lengths[0];
+ expected = [start_length, start_length + 1, start_length];
+ opener.assert_array_equals(history_lengths, expected);
+ opener.t.done();
+ } finally {
+ window.close();
+ }
+});
+</script>
+<iframe src="discard_iframe_history_2-2.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-2.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-2.html
new file mode 100644
index 000000000..b25bf5f00
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-2.html
@@ -0,0 +1 @@
+<a href="discard_iframe_history_2-3.html" onclick="parent.push_length()">Click me</a>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-3.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-3.html
new file mode 100644
index 000000000..68847e9a7
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-3.html
@@ -0,0 +1 @@
+<button onclick="var p = parent; p.push_length(); frameElement.parentNode.removeChild(frameElement); p.push_length(); p.do_test();">Click me</button>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-manual.html b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-manual.html
new file mode 100644
index 000000000..27d395d22
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/non-automated/discard_iframe_history_2-manual.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<title>Removing iframe from document removes it from history</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+setup({timeout:3600000})
+var t = async_test(undefined, {timeout:3600000});
+var w = window.open("discard_iframe_history_2-1.html");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/.gitkeep b/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/named-objects.html b/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/named-objects.html
new file mode 100644
index 000000000..f020e0ecb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/named-objects.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: Named access on the Window object</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/browsers.html#named-access-on-the-window-object">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<div style="display:none">
+ <p name="a" id="p1"></p>
+ <a name="a" id="a1" href="#"></a>
+ <applet name="a" id="app1"></applet>
+ <area name="a" id="area1"></area>
+ <embed name="a" id="embed1"></embed>
+ <form name="a" id="form1"></form>
+ <img name="a" id="img1">
+ <object name="a" id="obj1"></object>
+ <span name="a" id="span1"></span>
+
+ <b id="b" name="c"></b>
+ <a name="c"></a>
+ <iframe name="c" id="fm1"></iframe>
+ <iframe name="c" id="fm2" src="test.html" onload="on_load()"></iframe>
+ <input id="b"></input>
+ <span id="d"></span>
+ <a name=""></a>
+ <b id=""></b>
+</div>
+<script>
+
+test(function() {
+ assert_equals(window['c'], document.getElementById("fm1").contentWindow, "The first iframe's window should be returned.");
+}, "Check if the first nested browsing context is returned by window['c']");
+
+test(function() {
+ assert_equals(window['a'].length, 5, "The length should be 5.");
+ assert_true(window['a'] instanceof HTMLCollection);
+ assert_array_equals(window['a'],
+ [ document.getElementById('app1'), document.getElementById('embed1'),
+ document.getElementById('form1'), document.getElementById('img1'),
+ document.getElementById('obj1') ],
+ "The elements are not in tree order.");
+
+ document.getElementById('form1').setAttribute("name", "");
+ document.getElementById('embed1').setAttribute("name", "");
+ assert_array_equals(window['a'],
+ [ document.getElementById('app1'), document.getElementById('img1'),
+ document.getElementById('obj1') ],
+ "Window['a'] should not contain the elements with empty name attribute.");
+}, "Check if window['a'] contains all applet, embed, form, img, and object elements, and their order");
+
+var t = async_test("Check that window['fs'] does not return the frameset element with name='fs' (historical)");
+function on_load () {
+ t.step(function () {
+ assert_equals(document.getElementById('fm2').contentWindow['fs'],
+ undefined,
+ "The frameset element should not be returned.");
+ });
+ t.done();
+}
+
+test(function() {
+ assert_true(window['b'] instanceof HTMLCollection);
+ assert_array_equals(window['b'], [document.getElementsByTagName('b')[0], document.getElementsByTagName('input')[0]]);
+
+ document.getElementsByTagName('b')[0].setAttribute("id", "");
+ assert_equals(window['b'], document.getElementsByTagName('input')[0],
+ "The window['b'] should not contain the elements with empty id attribute.");
+}, "Check if window['b'] returns the elements with the id='b'");
+
+test(function() {
+ assert_equals(window['d'], document.getElementById('d'));
+}, "Check if window['d'] returns the element with id='d'");
+
+test(function() {
+ assert_equals(window[''], undefined, "The window[''] should be undefined");
+}, "Check widow[''] when there are some elements with empty id or name attribute");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/test.html b/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/test.html
new file mode 100644
index 000000000..c3b3cc185
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/test.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: Named Object</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<frameset name="fs" id="fs1">
+ <frame></frame>
+</frameset>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/window-null-names.html b/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/window-null-names.html
new file mode 100644
index 000000000..760bd418d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/named-access-on-the-window-object/window-null-names.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Named access with null characters</title>
+<link rel="author" title="Ms2ger" href="ms2ger@gmail.com">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#window">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-window-nameditem">
+<link rel="help" href="https://heycam.github.io/webidl/#named-properties-object">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+test(function() {
+ var iframe = document.createElement("iframe")
+ iframe.name = "a\0b"
+ document.body.appendChild(iframe)
+ assert_equals(window["a\0b"], iframe.contentWindow)
+ assert_equals(window["ab"], undefined)
+ assert_equals(window["a"], undefined)
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/security-window/.gitkeep b/testing/web-platform/tests/html/browsers/the-window-object/security-window/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/security-window/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/security-window/window-security.sub.html b/testing/web-platform/tests/html/browsers/the-window-object/security-window/window-security.sub.html
new file mode 100644
index 000000000..9a9ef358e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/security-window/window-security.sub.html
@@ -0,0 +1,203 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: Window Security</title>
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/browsers.html#the-window-object" />
+<link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/timers.html#timers" />
+<link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/webappapis.html#atob" />
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#windowsessionstorage" />
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#windowlocalstorage" />
+<link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/browsers.html#window" />
+<link rel="help" href="http://dev.w3.org/csswg/cssom/#extensions-to-the-window-interface" />
+<link rel="help" href="http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface" />
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<div id="log"></div>
+<script>
+var t = async_test("Window Security testing");
+
+function fr_load() {
+ fr = document.getElementById("fr");
+
+ t.step(function () {
+ //SecurityError should be thrown
+ [
+ //attributes
+ {name: "applicationCache"},
+ {name: "devicePixelRatio"},
+ {name: "document"},
+ {name: "external"},
+ {name: "frameElement"},
+ {name: "history"},
+ {name: "innerWidth"},
+ {name: "innerHeight"},
+ {name: "locationbar"},
+ {name: "localStorage"},
+ {name: "menubar"},
+ {name: "name"},
+ {name: "navigator"},
+ {name: "onabort"},
+ {name: "onafterprint"},
+ {name: "onbeforeprint"},
+ {name: "onbeforeunload"},
+ {name: "onblur"},
+ {name: "oncancel"},
+ {name: "oncanplay"},
+ {name: "oncanplaythrough"},
+ {name: "onchange"},
+ {name: "onclick"},
+ {name: "onclose"},
+ {name: "oncontextmenu"},
+ {name: "oncuechange"},
+ {name: "ondblclick"},
+ {name: "ondrag"},
+ {name: "ondragend"},
+ {name: "ondragenter"},
+ {name: "ondragleave"},
+ {name: "ondragover"},
+ {name: "ondragstart"},
+ {name: "ondrop"},
+ {name: "ondurationchange"},
+ {name: "onemptied"},
+ {name: "onended"},
+ {name: "onerror"},
+ {name: "onfocus"},
+ {name: "onhashchange"},
+ {name: "oninput"},
+ {name: "oninvalid"},
+ {name: "onkeydown"},
+ {name: "onkeypress"},
+ {name: "onkeyup"},
+ {name: "onload"},
+ {name: "onloadeddata"},
+ {name: "onloadedmetadata"},
+ {name: "onloadstart"},
+ {name: "onmessage"},
+ {name: "onmousedown"},
+ {name: "onmousemove"},
+ {name: "onmouseout"},
+ {name: "onmouseover"},
+ {name: "onmouseup"},
+ {name: "onmousewheel"},
+ {name: "onoffline"},
+ {name: "ononline"},
+ {name: "onpause"},
+ {name: "onplay"},
+ {name: "onplaying"},
+ {name: "onpagehide"},
+ {name: "onpageshow"},
+ {name: "onpopstate"},
+ {name: "onprogress"},
+ {name: "onratechange"},
+ {name: "onreset"},
+ {name: "onresize"},
+ {name: "onscroll"},
+ {name: "onseeked"},
+ {name: "onseeking"},
+ {name: "onselect"},
+ {name: "onshow"},
+ {name: "onstalled"},
+ {name: "onstorage"},
+ {name: "onsubmit"},
+ {name: "onsuspend"},
+ {name: "ontimeupdate"},
+ {name: "onunload"},
+ {name: "onvolumechange"},
+ {name: "onwaiting"},
+ {name: "pageXOffset"},
+ {name: "pageYOffset"},
+ {name: "personalbar"},
+ {name: "screen"},
+ {name: "scrollbars"},
+ {name: "statusbar"},
+ {name: "status"},
+ {name: "screenX"},
+ {name: "screenY"},
+ {name: "sessionStorage"},
+ {name: "toolbar"},
+ //methods
+ {name: "alert", isMethod: true},
+ {name: "clearInterval", isMethod: true, args:[1]},
+ {name: "clearTimeout", isMethod: true, args:[function () {}, 1]},
+ {name: "confirm", isMethod: true},
+ {name: "getComputedStyle", isMethod: true, args:[document.body, null]},
+ {name: "getSelection", isMethod: true},
+ {name: "matchMedia", isMethod: true, args:["(min-width:50px)"]},
+ {name: "moveBy", isMethod: true, args:[10, 10]},
+ {name: "moveTo", isMethod: true, args:[10, 10]},
+ {name: "open", isMethod: true},
+ {name: "print", isMethod: true},
+ {name: "prompt", isMethod: true},
+ {name: "resizeTo", isMethod: true, args:[10, 10]},
+ {name: "resizeBy", isMethod: true, args:[10, 10]},
+ {name: "scroll", isMethod: true, args:[10, 10]},
+ {name: "scrollTo", isMethod: true, args:[10, 10]},
+ {name: "scrollBy", isMethod: true, args:[10, 10]},
+ {name: "setInterval", isMethod: true, args:[function () {}, 1]},
+ {name: "setTimeout", isMethod: true, args:[function () {}, 1]},
+ {name: "showModalDialog", isMethod: true, args:["auto:blank", "dialog"]},
+ {name: "stop", isMethod: true},
+ ].forEach(function (item) {
+ test(function () {
+ assert_true(item.name in window, "window." + item.name + " should exist.");
+ assert_throws("SecurityError", function () {
+ if (item.isMethod)
+ if (item.args)
+ fr.contentWindow[item.name](item.args[0], item.args[1]);
+ else
+ fr.contentWindow[item.name]();
+ else
+ fr.contentWindow[item.name];
+ }, "A SecurityError exception should be thrown.");
+ }, "A SecurityError exception must be thrown when window." + item.name + " is accessed from a different origin.");
+ });
+
+ //SecurityError should not be thrown
+ [
+ //attributes
+ {name: "closed"},
+ {name: "frames"},
+ {name: "length"},
+ {name: "location"},
+ {name: "opener"},
+ {name: "parent"},
+ {name: "self"},
+ {name: "top"},
+ {name: "window"},
+ //methods
+ {name: "blur", isMethod: true},
+ {name: "close", isMethod: true},
+ {name: "focus", isMethod: true},
+ {name: "postMessage", isMethod: true, args: [{msg: 'foo'}, "*"]}
+ ].forEach(function (item) {
+ test(function () {
+ assert_true(item.name in window, "window." + item.name + " should exist.");
+ try {
+ if (item.isMethod)
+ if (item.args)
+ fr.contentWindow[item.name](item.args[0], item.args[1]);
+ else
+ fr.contentWindow[item.name]();
+ else
+ fr.contentWindow[item.name];
+ } catch (e) {
+ assert_unreached("An unexpected exception was thrown.");
+ }
+ }, "A SecurityError exception should not be thrown when window." + item.name + " is accessed from a different origin.");
+ });
+ });
+ t.done();
+}
+
+</script>
+<script>
+onload = function() {
+ var frame = document.createElement('iframe');
+ frame.id = "fr";
+ frame.setAttribute("style", "display:none");
+ frame.setAttribute('src', get_host_info().HTTP_REMOTE_ORIGIN + "/");
+ frame.setAttribute("onload", "fr_load()");
+ document.body.appendChild(frame);
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/support/noopener-target.html b/testing/web-platform/tests/html/browsers/the-window-object/support/noopener-target.html
new file mode 100644
index 000000000..d0d036026
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/support/noopener-target.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script>
+ var channelName = location.search.substr(1);
+ var channel = new BroadcastChannel(channelName);
+ channel.postMessage({ name: window.name,
+ haveOpener: window.opener !== null });
+ window.close();
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/.gitkeep b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-locationbar-manual.html b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-locationbar-manual.html
new file mode 100644
index 000000000..4331b3b66
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-locationbar-manual.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Window Proxy locationbar visible flag Test</title>
+ <link rel="author" title='JuneyoungOh' href="juneyoung85@gmail.com">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+ <h1>Description</h1>
+ <p>WindowProxy.locationbar Test</p>
+
+ <h1>Manual Test Steps:</h1>
+ <ol>
+ <li>Make the locationbar visible in the user agent before executing this test.</li>
+ <li>You may need to manually reload afterwards.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script>
+ test(function() {
+ assert_not_equals(typeof window.locationbar, undefined, 'window.locationbar is undefined');
+ assert_true(window.locationbar.visible)
+ }, "window.locationbar.visible");
+ </script>
+</body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-menubar-manual.html b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-menubar-manual.html
new file mode 100644
index 000000000..43345934a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-menubar-manual.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Window Proxy menubar visible flag Test</title>
+ <link rel="author" title='JuneyoungOh' href="juneyoung85@gmail.com">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+ <h1>Description</h1>
+ <p>WindowProxy.menubar Test</p>
+
+ <h1>Manual Test Steps:</h1>
+ <ol>
+ <li>Make the menubar visible in the user agent before executing this test.</li>
+ <li>You may need to manually reload afterwards.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script>
+ test(function() {
+ assert_not_equals(typeof window.menubar, undefined, 'window.menubar is undefined');
+ assert_true(window.menubar.visible);
+ }, "window.menubar.visible");
+ </script>
+</body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-personalbar-manual.html b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-personalbar-manual.html
new file mode 100644
index 000000000..d7f109840
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-personalbar-manual.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <title>Window Proxy personalbar visible flag Test</title>
+ <link rel="author" title="vanessa" href="mailto:vanessaohsy@gmail.com">
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+ <h1>Description</h1>
+ <p>WindowProxy.personalbar Test</p>
+
+ <h1>Manual Test Steps:</h1>
+ <ol>
+ <li>Make the personalbar visible in the user agent before executing this test.</li>
+ <li>You may need to manually reload afterwards.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script type="text/javascript" >
+ test(function () {
+ assert_not_equals(window.personalbar, undefined, "window.personalbar is undefined");
+ assert_true(window.personalbar.visible, "window.personalbar.visible");
+ });
+ </script>
+</body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-scrollbars-manual.html b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-scrollbars-manual.html
new file mode 100644
index 000000000..c412bdbe5
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-scrollbars-manual.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <title>Window Proxy scrollbars visible flag Test</title>
+ <link rel="author" title="vanessa" href="vanessaohsy@gmail.com">
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+ <h1>Description</h1>
+ <p>WindowProxy.scrollbars Test</p>
+
+ <h1>Manual Test Steps:</h1>
+ <ol>
+ <li>Make the scrollbars visible in the user agent before executing this test.</li>
+ <li>You may need to manually reload afterwards.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script type="text/javascript" >
+ test(function () {
+ assert_not_equals(window.scrollbars, undefined, "window.scrollbars is undefined");
+ assert_true(window.scrollbars.visible, "window.scrollbars.visible");
+ });
+ </script>
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-statusbar-manual.html b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-statusbar-manual.html
new file mode 100644
index 000000000..b09fcc017
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-statusbar-manual.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8" />
+ <title>WindowProxy statusbar visible flag Test</title>
+ <link rel="author" title="dokenzy" href="dokenzy@gmail.com">
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+ <h1>Description</h1>
+ <p>WindowProxy.statusbar Test</p>
+
+ <h1>Manual Test Steps:</h1>
+ <ol>
+ <li>Make the statusbar visible in the user agent before executing this test.</li>
+ <li>You may need to manually reload afterwards.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script type="text/javascript" >
+ test(function () {
+ assert_not_equals(typeof window.statusbar.visible, undefined, 'window.statusbar.visible');
+ assert_true(window.statusbar.visible, 'window.statusbar.visible');
+ }, "BarProp attribute: window.statusbar.visible");
+ </script>
+</body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-toolbar-manual.html b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-toolbar-manual.html
new file mode 100644
index 000000000..ba4654431
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/the-windowproxy-object/test-window-proxy-toolbar-manual.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8" />
+ <title>WindowProxy toolbar visible flag Test</title>
+ <link rel="author" title="dokenzy" href="dokenzy@gmail.com">
+ <script type="text/javascript" src="/resources/testharness.js"></script>
+ <script type="text/javascript" src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+ <h1>Description</h1>
+ <p>WindowProxy.toolbar Test</p>
+
+ <h1>Manual Test Steps:</h1>
+ <ol>
+ <li>Make the toolbar visible in the user agent before executing this test.</li>
+ <li>You may need to manually reload afterwards.</li>
+ </ol>
+
+ <div id="log"></div>
+
+ <script type="text/javascript" >
+ test(function () {
+ assert_not_equals(typeof window.toolbar.visible, undefined, 'window.toolbar.visible');
+ assert_true(window.toolbar.visible, 'window.toolbar.visible');
+ }, "BarProp attribute: window.toolbar.visible");
+ </script>
+</body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/window-aliases.html b/testing/web-platform/tests/html/browsers/the-window-object/window-aliases.html
new file mode 100644
index 000000000..135be02a3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/window-aliases.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Aliases of the window object</title>
+<link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-window">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-frames">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-self">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+var global = this;
+
+test(function() {
+ assert_equals(window, global);
+ assert_equals(window.window, global);
+}, "window should be the global object");
+
+test(function() {
+ assert_equals(frames, global);
+ assert_equals(window.frames, global);
+}, "frames should be the global object");
+
+test(function() {
+ assert_equals(self, global);
+ assert_equals(window.self, global);
+}, "self should be the global object");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/window-indexed-properties-strict.html b/testing/web-platform/tests/html/browsers/the-window-object/window-indexed-properties-strict.html
new file mode 100644
index 000000000..610941fc8
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/window-indexed-properties-strict.html
@@ -0,0 +1,43 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Indexed properties of the window object (strict mode)</title>
+<link rel="author" title="Ms2ger" href="ms2ger@gmail.com">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#window">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-window-item">
+<link rel="help" href="https://heycam.github.io/webidl/#getownproperty">
+<link rel="help" href="https://heycam.github.io/webidl/#defineownproperty">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<iframe></iframe>
+<script>
+test(function() {
+ "use strict";
+ assert_false("-1" in window, "-1 not in window");
+ assert_equals(window[-1], undefined);
+ window[-1] = "foo";
+ assert_equals(window[-1], "foo");
+});
+test(function() {
+ "use strict";
+ assert_throws(new TypeError(), function() {
+ window[0] = "foo";
+ });
+ assert_equals(window[0],
+ document.getElementsByTagName("iframe")[0].contentWindow);
+});
+test(function() {
+ "use strict";
+ assert_throws(new TypeError(), function() {
+ window[1] = "foo";
+ });
+ assert_equals(window[1], undefined);
+});
+test(function() {
+ "use strict";
+ var proto = Window.prototype;
+ [-1, 0, 1].forEach(function(idx) {
+ assert_false(idx in proto, idx + " in proto");
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/window-indexed-properties.html b/testing/web-platform/tests/html/browsers/the-window-object/window-indexed-properties.html
new file mode 100644
index 000000000..9577ab8fb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/window-indexed-properties.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Indexed properties of the window object (non-strict mode)</title>
+<link rel="author" title="Ms2ger" href="ms2ger@gmail.com">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#window">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-window-item">
+<link rel="help" href="https://heycam.github.io/webidl/#getownproperty">
+<link rel="help" href="https://heycam.github.io/webidl/#defineownproperty">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<iframe></iframe>
+<script>
+test(function() {
+ assert_false("-1" in window, "-1 not in window");
+ assert_equals(window[-1], undefined);
+ window[-1] = "foo";
+ assert_equals(window[-1], "foo");
+});
+test(function() {
+ window[0] = "foo";
+ assert_equals(window[0],
+ document.getElementsByTagName("iframe")[0].contentWindow);
+});
+test(function() {
+ window[1] = "foo";
+ assert_equals(window[1], undefined);
+});
+test(function() {
+ var proto = Window.prototype;
+ [-1, 0, 1].forEach(function(idx) {
+ assert_false(idx in proto, idx + " in proto");
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/window-named-properties.html b/testing/web-platform/tests/html/browsers/the-window-object/window-named-properties.html
new file mode 100644
index 000000000..54f37bbdc
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/window-named-properties.html
@@ -0,0 +1,77 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Changes to named properties of the window object</title>
+<link rel="author" title="Ms2ger" href="ms2ger@gmail.com">
+<link rel="author" title="Boris Zbarsky" href="bzbarsky@mit.edu">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#window">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-window-nameditem">
+<link rel="help" href="https://heycam.github.io/webidl/#named-properties-object">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<iframe name="bar"></iframe>
+<iframe name="baz"></iframe>
+<iframe name="baz"></iframe>
+<iframe name="constructor"></iframe>
+<script>
+function assert_data_propdesc(pd, Writable, Enumerable, Configurable) {
+ assert_equals(typeof pd, "object");
+ assert_equals(pd.writable, Writable);
+ assert_equals(pd.enumerable, Enumerable);
+ assert_equals(pd.configurable, Configurable);
+}
+test(function() {
+ assert_true("bar" in window, "bar not in window");
+ assert_equals(window["bar"],
+ document.getElementsByTagName("iframe")[0].contentWindow);
+}, "Static name");
+test(function() {
+ assert_true("bar" in Window.prototype, "bar in Window.prototype");
+ assert_false(Window.prototype.hasOwnProperty("bar"), "Window.prototype.hasOwnProperty(\"bar\")");
+
+ var gsp = Object.getPrototypeOf(Object.getPrototypeOf(window));
+ assert_true("bar" in gsp, "bar in gsp");
+ assert_true(gsp.hasOwnProperty("bar"), "gsp.hasOwnProperty(\"bar\")");
+ assert_data_propdesc(Object.getOwnPropertyDescriptor(gsp, "bar"),
+ true, false, true);
+}, "Static name on the prototype");
+test(function() {
+ assert_equals(window.constructor, Window);
+ assert_false(window.hasOwnProperty("constructor"), "window.constructor should not be an own property.");
+
+ var proto = Object.getPrototypeOf(window);
+ assert_equals(proto.constructor, Window);
+ assert_true("constructor" in proto, "constructor in proto");
+ assert_data_propdesc(Object.getOwnPropertyDescriptor(proto, "constructor"),
+ true, false, true);
+
+ var gsp = Object.getPrototypeOf(proto);
+ assert_true("constructor" in gsp, "constructor in gsp");
+ assert_false(gsp.hasOwnProperty("constructor"), "gsp.hasOwnProperty(\"constructor\")");
+ assert_equals(Object.getOwnPropertyDescriptor(gsp, "constructor"), undefined);
+}, "constructor");
+test(function() {
+ var gsp = Object.getPrototypeOf(Object.getPrototypeOf(window));
+ var names = Object.getOwnPropertyNames(gsp);
+ assert_equals(names.filter((name) => name == "baz").length, 1);
+
+}, "duplicate property names")
+var t = async_test("Dynamic name")
+var t2 = async_test("Ghost name")
+t.step(function() {
+ var iframe = document.getElementsByTagName("iframe")[0];
+ iframe.setAttribute("src", "data:text/html,<script>window.name='foo'<\/script>");
+ iframe.onload = function() {
+ t.step(function() {
+ assert_true("foo" in window, "foo not in window");
+ assert_equals(window["foo"], iframe.contentWindow);
+ });
+ t.done();
+ t2.step(function() {
+ assert_false("bar" in window, "bar still in window");
+ assert_equals(window["bar"], undefined);
+ });
+ t2.done();
+ };
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/window-open-noopener.html b/testing/web-platform/tests/html/browsers/the-window-object/window-open-noopener.html
new file mode 100644
index 000000000..808f55e23
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/window-open-noopener.html
@@ -0,0 +1,105 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>window.open() with "noopener" tests</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+var testData = [
+ { testDescription: "window.open() with 'noopener' should not reuse existing target",
+ secondWindowFeatureString: "noopener",
+ shouldReuse: false },
+ { testDescription: "noopener needs to be present as a token on its own",
+ secondWindowFeatureString: "noopener=1",
+ shouldReuse: true },
+ { testDescription: "noopener needs to be present as a token on its own again",
+ secondWindowFeatureString: "noopener=0",
+ shouldReuse: true },
+ { testDescription: "noopener needs to be present as a token on its own yet again",
+ secondWindowFeatureString: "make me noopener",
+ shouldReuse: true },
+ { testDescription: "Trailing noopener should work",
+ secondWindowFeatureString: "abc def, \n\r noopener",
+ shouldReuse: false },
+ { testDescription: "Leading noopener should work",
+ secondWindowFeatureString: "noopener \f\t , hey, there",
+ shouldReuse: false },
+ { testDescription: "Interior noopener should work",
+ secondWindowFeatureString: "and now, noopener , hey, there",
+ shouldReuse: false },
+];
+
+var tests = [];
+/**
+ * Loop over our testData array and kick off an async test for each entry. Each
+ * async test opens a window using window.open() with some per-test unique name,
+ * then tries to do a second window.open() call with the same name and the
+ * test-specific feature string. It then checks whether that second
+ * window.open() call reuses the existing window, whether the return value of
+ * the second window.open() call is correct (it should be null in the noopener
+ * cases and non-null in the cases when the existing window gets reused) and so
+ * forth.
+ */
+for (var i = 0; i < testData.length; ++i) {
+ var test = testData[i];
+ var t = async_test(test.testDescription);
+ tests.push(t);
+ t.secondWindowFeatureString = test.secondWindowFeatureString;
+ t.windowName = "someuniquename" + i;
+
+ if (test.shouldReuse) {
+ t.step(function() {
+ var windowName = this.windowName;
+
+ var w1 = window.open("", windowName);
+ this.add_cleanup(function() { w1.close(); });
+
+ assert_equals(w1.opener, window);
+
+ var w2 = window.open("", windowName, this.secondWindowFeatureString);
+ assert_equals(w2, w1);
+ assert_equals(w2.opener, w1.opener);
+ assert_equals(w2.opener, window);
+ this.done();
+ });
+ } else {
+ t.step(function() {
+ var w1;
+ this.add_cleanup(function() { w1.close(); });
+
+ var windowName = this.windowName;
+ var channel = new BroadcastChannel(windowName);
+
+ channel.onmessage = this.step_func_done(function(e) {
+ var data = e.data;
+ assert_equals(data.name, windowName, "Should have the right name");
+ assert_equals(data.haveOpener, false, "Should not have opener");
+ assert_equals(w1.opener, window);
+ assert_equals(w1.location.href, "about:blank");
+ });
+
+ w1 = window.open("", windowName);
+ assert_equals(w1.opener, window);
+
+ var w2 = window.open("support/noopener-target.html?" + windowName,
+ windowName, this.secondWindowFeatureString);
+ assert_equals(w2, null);
+
+ assert_equals(w1.opener, window);
+ });
+ }
+}
+
+/**
+ * Loop over the special targets that ignore noopener and check that doing a
+ * window.open() with those targets correctly reuses the existing window.
+ */
+for (var target of ["_self", "_parent", "_top"]) {
+ var t = async_test("noopener window.open targeting " + target);
+ tests.push(t);
+ t.openedWindow = window.open(`javascript:var w2 = window.open("", "${target}", "noopener"); this.checkValues(w2); this.close(); void(0);`);
+ assert_equals(t.openedWindow.opener, window);
+ t.openedWindow.checkValues = t.step_func_done(function(win) {
+ assert_equals(win, this.openedWindow);
+ });
+}
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/window-properties.html b/testing/web-platform/tests/html/browsers/the-window-object/window-properties.html
new file mode 100644
index 000000000..3316bf531
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/window-properties.html
@@ -0,0 +1,322 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Properties of the window object</title>
+<link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com">
+<link rel="help" href="http://ecma-international.org/ecma-262/5.1/#sec-15.1">
+<link rel="help" href="https://heycam.github.io/webidl/#interface-prototype-object">
+<link rel="help" href="https://heycam.github.io/webidl/#es-attributes">
+<link rel="help" href="https://heycam.github.io/webidl/#es-operations">
+<link rel="help" href="https://dom.spec.whatwg.org/#eventtarget">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#window">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#windowtimers">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#windowbase64">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#windowsessionstorage">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#windowlocalstorage">
+<link rel="help" href="https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#dom-window-getselection">
+<link rel="help" href="http://dev.w3.org/csswg/cssom/#widl-def-Window">
+<link rel="help" href="http://dev.w3.org/csswg/cssom-view/#widl-def-Window">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+function assert_data_propdesc(pd, Writable, Enumerable, Configurable) {
+ assert_equals(typeof pd, "object");
+ assert_equals(pd.writable, Writable);
+ assert_equals(pd.enumerable, Enumerable);
+ assert_equals(pd.configurable, Configurable);
+}
+function assert_accessor_propdesc(pd, hasSetter, Enumerable, Configurable) {
+ assert_equals(typeof pd, "object");
+ assert_equals(typeof pd.get, "function");
+ assert_true("set" in pd,
+ "Should always have a setter property on the property descriptor");
+ assert_equals(typeof pd.set, hasSetter ? "function" : "undefined");
+ assert_equals(pd.enumerable, Enumerable);
+ assert_equals(pd.configurable, Configurable);
+}
+
+var unforgeableAttributes = [
+ "window",
+ "document",
+ "location",
+ "top"
+];
+
+var replaceableAttributes = [
+ "self",
+ "locationbar",
+ "menubar",
+ "personalbar",
+ "scrollbars",
+ "statusbar",
+ "toolbar",
+ "frames",
+ "parent",
+ "external",
+ "length",
+
+ // CSSOM-View
+ "screen",
+ "scrollX",
+ "scrollY",
+ "pageXOffset",
+ "pageYOffset",
+ "innerWidth",
+ "innerHeight",
+ "screenX",
+ "screenY",
+ "outerWidth",
+ "outerHeight",
+ "devicePixelRatio",
+];
+
+var methods = [
+ "close",
+ "stop",
+ "focus",
+ "blur",
+ "open",
+ "alert",
+ "confirm",
+ "prompt",
+ "print",
+ // See below: "showModalDialog",
+ "postMessage",
+
+ // WindowBase64
+ "btoa",
+ "atob",
+
+ // WindowTimers
+ "setTimeout",
+ "clearTimeout",
+ "setInterval",
+ "clearInterval",
+
+ // HTML Editing APIs
+ "getSelection",
+
+ // CSSOM
+ "getComputedStyle",
+
+ // CSSOM-View
+ "matchMedia",
+ "scroll",
+ "scrollTo",
+ "scrollBy"
+];
+
+// We would like to remove showModalDialog from the platform,
+// see <https://www.w3.org/Bugs/Public/show_bug.cgi?id=26437>.
+if ("showModalDialog" in window) {
+ methods.push("showModalDialog");
+}
+
+var readonlyAttributes = [
+ "history",
+ "frameElement",
+ "navigator",
+ "applicationCache",
+
+ // WindowSessionStorage
+ "sessionStorage",
+
+ // WindowLocalStorage
+ "localStorage",
+];
+
+var writableAttributes = [
+ "name",
+ "status",
+ "opener",
+ "onabort",
+ "onafterprint",
+ "onbeforeprint",
+ "onbeforeunload",
+ "onblur",
+ "oncancel",
+ "oncanplay",
+ "oncanplaythrough",
+ "onchange",
+ "onclick",
+ "onclose",
+ "oncontextmenu",
+ "oncuechange",
+ "ondblclick",
+ "ondrag",
+ "ondragend",
+ "ondragenter",
+ "ondragleave",
+ "ondragover",
+ "ondragstart",
+ "ondrop",
+ "ondurationchange",
+ "onemptied",
+ "onended",
+ "onerror",
+ "onfocus",
+ "onhashchange",
+ "oninput",
+ "oninvalid",
+ "onkeydown",
+ "onkeypress",
+ "onkeyup",
+ "onload",
+ "onloadeddata",
+ "onloadedmetadata",
+ "onloadstart",
+ "onmessage",
+ "onmousedown",
+ "onmousemove",
+ "onmouseout",
+ "onmouseover",
+ "onmouseup",
+ "onmousewheel",
+ "onoffline",
+ "ononline",
+ "onpause",
+ "onplay",
+ "onplaying",
+ "onpagehide",
+ "onpageshow",
+ "onpopstate",
+ "onprogress",
+ "onratechange",
+ "onreset",
+ "onresize",
+ "onscroll",
+ "onseeked",
+ "onseeking",
+ "onselect",
+ "onshow",
+ "onstalled",
+ "onstorage",
+ "onsubmit",
+ "onsuspend",
+ "ontimeupdate",
+ "onunload",
+ "onvolumechange",
+ "onwaiting"
+];
+
+test(function() {
+ // 15.1.1 Value Properties of the Global Object
+ ["NaN", "Infinity", "undefined"].forEach(function(id) {
+ test(function() {
+ assert_true(id in window, id + " in window");
+ assert_data_propdesc(Object.getOwnPropertyDescriptor(window, id),
+ false, false, false);
+ }, "Value Property: " + id);
+ });
+}, "Value Properties of the Global Object");
+test(function() {
+ // 15.1.2 Function Properties of the Global Object
+ ["eval", "parseInt", "parseFloat", "isNaN", "isFinite"].forEach(function(id) {
+ test(function() {
+ assert_true(id in window, id + " in window");
+ assert_data_propdesc(Object.getOwnPropertyDescriptor(window, id),
+ true, false, true);
+ }, "Function Property: " + id);
+ });
+}, "Function Properties of the Global Object");
+test(function() {
+ // 15.1.3 URI Handling Function Properties
+ ["decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent"].forEach(function(id) {
+ test(function() {
+ assert_true(id in window, id + " in window");
+ assert_data_propdesc(Object.getOwnPropertyDescriptor(window, id),
+ true, false, true);
+ }, "URI Handling Function Property: " + id);
+ });
+}, "URI Handling Function Properties");
+test(function() {
+ // 15.1.4 Constructor Properties of the Global Object
+ ["Object", "Function", "Array", "String", "Boolean", "Number", "Date",
+ "RegExp", "Error", "EvalError", "RangeError", "ReferenceError",
+ "SyntaxError", "TypeError", "URIError"].forEach(function(id) {
+ test(function() {
+ assert_true(id in window, id + " in window");
+ assert_data_propdesc(Object.getOwnPropertyDescriptor(window, id),
+ true, false, true);
+ }, "Constructor Property: " + id);
+ });
+}, "Constructor Properties of the Global Object");
+test(function() {
+ // 15.1.5 Other Properties of the Global Object
+ ["Math", "JSON"].forEach(function(id) {
+ test(function() {
+ assert_true(id in window, id + " in window");
+ assert_data_propdesc(Object.getOwnPropertyDescriptor(window, id),
+ true, false, true);
+ }, "Other Property: " + id);
+ });
+}, "Other Properties of the Global Object");
+test(function() {
+ // EventTarget interface
+ ["addEventListener", "removeEventListener", "dispatchEvent"].forEach(function(id) {
+ test(function() {
+ var EventTargetProto = EventTarget.prototype;
+ assert_true(id in window, id + " in window");
+ assert_equals(window[id], EventTargetProto[id]);
+ assert_data_propdesc(Object.getOwnPropertyDescriptor(EventTargetProto, id),
+ true, true, true);
+ assert_equals(Object.getOwnPropertyDescriptor(window, id), undefined);
+ }, "EventTarget method: " + id);
+ });
+}, "EventTarget interface");
+test(function() {
+ // Window interface
+ methods.forEach(function(id) {
+ test(function() {
+ var WindowProto = Window.prototype;
+ assert_true(id in window, id + " in window");
+ assert_false(id in WindowProto, id + " in Window.prototype");
+ assert_data_propdesc(Object.getOwnPropertyDescriptor(window, id),
+ true, true, true);
+ }, "Window method: " + id);
+ });
+ readonlyAttributes.forEach(function(id) {
+ test(function() {
+ var WindowProto = Window.prototype;
+ assert_true(id in window, id + " in window");
+ assert_false(id in WindowProto, id + " in Window.prototype");
+ assert_accessor_propdesc(Object.getOwnPropertyDescriptor(window, id),
+ false, true, true);
+ }, "Window readonly attribute: " + id);
+ });
+ writableAttributes.forEach(function(id) {
+ test(function() {
+ var WindowProto = Window.prototype;
+ assert_true(id in window, id + " in window");
+ assert_false(id in WindowProto, id + " in Window.prototype");
+ assert_accessor_propdesc(Object.getOwnPropertyDescriptor(window, id),
+ true, true, true);
+ }, "Window attribute: " + id);
+ });
+ unforgeableAttributes.forEach(function(id) {
+ test(function() {
+ var WindowProto = Window.prototype;
+ assert_true(id in window, id + " in window");
+ assert_false(id in WindowProto, id + " in Window.prototype");
+ // location has a [PutForwards] extended attribute.
+ assert_accessor_propdesc(Object.getOwnPropertyDescriptor(window, id),
+ id === "location", true, false);
+ }, "Window unforgeable attribute: " + id);
+ });
+ replaceableAttributes.forEach(function(id) {
+ test(function() {
+ var WindowProto = Window.prototype;
+ assert_true(id in window, id + " in window");
+ assert_false(id in WindowProto, id + " in Window.prototype");
+ assert_accessor_propdesc(Object.getOwnPropertyDescriptor(window, id),
+ true, true, true);
+ }, "Window replaceable attribute: " + id);
+ });
+}, "Window interface");
+test(function() {
+ assert_equals(window.constructor, Window);
+ assert_false(window.hasOwnProperty("constructor"), "window.constructor should not be an own property.");
+ assert_data_propdesc(Object.getOwnPropertyDescriptor(Window.prototype, "constructor"),
+ true, false, true);
+}, "constructor");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/window-prototype-chain.html b/testing/web-platform/tests/html/browsers/the-window-object/window-prototype-chain.html
new file mode 100644
index 000000000..d29a8e11f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/window-prototype-chain.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Prototype chain of the window object</title>
+<link rel="author" title="Ms2ger" href="ms2ger@gmail.com">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#window">
+<link rel="help" href="https://dom.spec.whatwg.org/#eventtarget">
+<link rel="help" href="https://heycam.github.io/webidl/#interface-prototype-object">
+<link rel="help" href="https://heycam.github.io/webidl/#named-properties-object">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+test(function() {
+ assert_class_string(window, "Window");
+}, "window object");
+test(function() {
+ var proto = Object.getPrototypeOf(window);
+ assert_class_string(proto, "WindowPrototype");
+ assert_equals(proto, Window.prototype);
+}, "Window.prototype");
+test(function() {
+ var gsp = Object.getPrototypeOf(Object.getPrototypeOf(window));
+ assert_class_string(gsp, "WindowProperties");
+}, "Global scope polluter");
+test(function() {
+ var protoproto = Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(window)));
+ assert_class_string(protoproto, "EventTargetPrototype");
+ assert_equals(protoproto, EventTarget.prototype);
+}, "EventTarget.prototype");
+test(function() {
+ var protoprotoproto = Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(window))));
+ assert_class_string(protoprotoproto, "Object");
+ assert_equals(protoprotoproto, Object.prototype);
+}, "Object.prototype");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/.gitkeep b/testing/web-platform/tests/html/browsers/windows/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/contains.json b/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/contains.json
new file mode 100644
index 000000000..9f2ca3b6f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/contains.json
@@ -0,0 +1,6 @@
+[
+ {
+ "id": "navigating-auxiliary-browsing-contexts-in-the-dom",
+ "original_id": "navigating-auxiliary-browsing-contexts-in-the-dom"
+ }
+] \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-first-created.xhtml b/testing/web-platform/tests/html/browsers/windows/browsing-context-first-created.xhtml
new file mode 100644
index 000000000..a059eec4c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-first-created.xhtml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>HTML Test: Browsing context is first created</title>
+ <link rel="author" title="Intel" href="http://www.intel.com/" />
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ <![CDATA[
+
+ var doc, iframe;
+
+ setup(function () {
+ iframe = document.createElement("iframe");
+ document.body.appendChild(iframe);
+ doc = iframe.contentDocument;
+ });
+
+ test(function () {
+ assert_equals(iframe.contentWindow.history.length, 1, "The history.length should be 1.");
+ }, "Check the history.length of the first created browsing context");
+
+ test(function () {
+ assert_equals(doc.documentURI, "about:blank", "The document's address should be 'about:blank'.");
+ assert_equals(doc.URL, "about:blank", "The document's address should be 'about:blank'.");
+ assert_equals(doc.contentType, "text/html", "The document should be an HTML document.");
+ assert_equals(doc.doctype, null, "The docType of a document without a document type declaration should be null.");
+ assert_equals(doc.compatMode, "BackCompat", "The compatMode of a document without a document type declaration should be 'BackCompat'.");
+ assert_equals(doc.characterSet, "UTF-8", "The document's encoding should be 'UTF-8'.");
+ assert_equals(iframe.contentWindow.parent.document, document);
+ assert_equals(doc.referrer, document.URL, "The document's referrer should be its creator document's address.");
+ }, "Check the document's meta data");
+
+ test(function () {
+ assert_equals(doc.readyState, "complete", "The readyState attribute should be 'complete'.");
+ }, "Check the document's status");
+
+ test(function () {
+ assert_equals(doc.childNodes.length, 1, "The document must have only one child.");
+ assert_equals(doc.documentElement.tagName, "HTML");
+ assert_equals(doc.documentElement.childNodes.length, 2, "The HTML element should have 2 children.");
+ assert_equals(doc.documentElement.childNodes[0].tagName, "HEAD", "The first child of HTML element should be a HEAD element.");
+ assert_false(doc.documentElement.childNodes[0].hasChildNodes(), "The HEAD element should not have children.");
+ assert_equals(doc.documentElement.childNodes[1].tagName, "BODY", "The second child of HTML element should be a BODY element.");
+ assert_false(doc.documentElement.childNodes[1].hasChildNodes(), "The BODY element should not have children.");
+ }, "Check the document's content");
+
+ ]]>
+ </script>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/.gitkeep b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001-1.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001-1.html
new file mode 100644
index 000000000..d413c3019
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001-1.html
@@ -0,0 +1,8 @@
+<!doctype html>
+001-1
+<script>
+if (window.opener !== null) {
+ window.opener.postMessage("FAIL", "*");
+}
+window.close();
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001.html
new file mode 100644
index 000000000..2478cdc8f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<title>Link with target=_blank, rel=noreferrer</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<a href="001-1.html" rel="noreferrer" target="_blank">Link</a>
+<script>
+var t = async_test();
+var a;
+t.step(function() {
+ a = document.getElementsByTagName("a")[0];
+ a.click();
+ //This is a bit hacky; if the test passes there isn't a link back to the parent
+ //window so we have to pass on a timeout. But opening the link could be slow in
+ //some cases, so there is some possibility of false passes
+ setTimeout(t.step_func(function() {
+ t.done();
+ }), 1000);
+});
+
+onmessage = t.step_func(function() {assert_unreached("Opened window had a reference to opener")});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002-1.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002-1.html
new file mode 100644
index 000000000..ca8a485de
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002-1.html
@@ -0,0 +1,8 @@
+<!doctype html>
+002-1
+<script>
+if (window.opener !== null) {
+ window.opener.postMessage("PASS", "*");
+}
+window.close();
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002.html
new file mode 100644
index 000000000..4a1df8e4d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<title>Link with target=_blank, no rel</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<a href="002-1.html" target="_blank">Link</a>
+<script>
+var a;
+async_test(function(t) {
+ a = document.getElementsByTagName("a")[0];
+ a.click();
+
+ // This is a bit hacky; if the test fails there isn't a link back to the parent
+ // window so we have to pass on a timeout. But opening the link could be slow in
+ // some cases, so there is some possibility of false fails
+ step_timeout(t.step_func(function() {
+ assert_unreached("Failed to get callback from opened window");
+ }), 5000);
+
+ onmessage = t.step_func(function(e) {
+ assert_equals(e.data, "PASS");
+ t.done()
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/MANIFEST b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/MANIFEST
new file mode 100644
index 000000000..efecf51e3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/MANIFEST
@@ -0,0 +1,4 @@
+001.html
+support 001-1.html
+002.html
+support 002-1.html
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-existing.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-existing.html
new file mode 100644
index 000000000..2eaba22f6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-existing.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: Choose browsing context - the given name is same as an existing browsing context's name</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="existing.html" style="display:none"></iframe>
+<iframe name="existWin" style="display:none"></iframe>
+<script>
+
+var t = async_test("The browsing context must be chosen if the given name is same as its name");
+
+window.addEventListener("message", function (e) {
+ t.step(function() {
+ assert_equals(e.data.name, "existWin", "The browsing context name should be 'existWin'.");
+ });
+ t.done();
+}, false);
+
+frames[0].onload = t.step_func(function(e) {
+ frames[0].do_test();
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html
new file mode 100644
index 000000000..c771a8fd7
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: Choose browsing context - the given name is '_parent'</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="parent1.html" name="parentWin" style="display:none"></iframe>
+<script>
+
+var t = async_test("The parent browsing context must be chosen if the given name is '_parent'");
+
+window.addEventListener("message", function (e) {
+ t.step(function() {
+ assert_equals(e.data.name, "parentWin", "The browsing context name should be 'parentWin'.");
+ });
+ t.done();
+}, false);
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-1.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-1.html
new file mode 100644
index 000000000..99d7fe7d3
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: Choose browsing context - the given name is '_self'</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="self1.html" style="display:none"></iframe>
+<script>
+
+var t = async_test("The current browsing context must be chosen if the given name is '_self'");
+
+window.addEventListener("message", function (e) {
+ t.step(function () {
+ assert_equals(e.data.name, "selfWin1", "The browsing context name should be 'selfWin1'.");
+ });
+ t.done();
+}, false);
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-2.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-2.html
new file mode 100644
index 000000000..e25a5b442
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-2.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: Choose browsing context - the given name is empty string</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="self2.html" style="display:none"></iframe>
+<script>
+
+var t = async_test("The current browsing context must be chosen if the given name is empty string");
+
+window.addEventListener("message", function (e) {
+ t.step(function () {
+ assert_equals(e.data.name, "selfWin2", "The browsing context name should be 'selfWin2'.");
+ });
+ t.done();
+}, false);
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-default-name.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-default-name.html
new file mode 100644
index 000000000..0bad8e606
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-default-name.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: Browsing context - Default name</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe src="message.html" style="display:none"></iframe>
+<script>
+
+test(function () {
+ assert_equals(window.frames[0].name, "", "The browsing context should not have a default name.");
+}, "A embedded browsing context has no default name");
+
+test(function () {
+ var win = window.open("about:blank", "_blank");
+ assert_equals(win.name, "", "The browsing context should not have a name.");
+ win.close();
+}, "A browsing context which is opened by window.open() method with '_blank' parameter has no default name");
+
+//This test must be run when the current browsing context's name is not set
+test(function () {
+ assert_equals(window.name, "", "The browsing context should not have a name.");
+}, "A browsing context has no default name");
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/existing.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/existing.html
new file mode 100644
index 000000000..13d2c6ab4
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/existing.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>This is a test page</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<script>
+
+function do_test() {
+ window.open("message.html", "existWin");
+}
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/message.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/message.html
new file mode 100644
index 000000000..90720d46a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/message.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: post window's name to top browsing context</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<script>
+
+top.postMessage({name: window.name}, "*");
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent1.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent1.html
new file mode 100644
index 000000000..fb34b2fe7
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent1.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: browsing context name - parent</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<iframe src="parent2.html"></iframe>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent2.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent2.html
new file mode 100644
index 000000000..34eb1c76b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent2.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: browsing context name - parent</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<script>
+
+window.open("message.html", "_parent");
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self1.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self1.html
new file mode 100644
index 000000000..2c8e3a414
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: browsing context name - self</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<script>
+
+window.name = "selfWin1";
+var win = window.open("message.html", "_self");
+win.close();
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self2.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self2.html
new file mode 100644
index 000000000..57276fada
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self2.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Test: browsing context name - self</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<script>
+
+window.name = "selfWin2";
+var win = window.open("message.html", "");
+win.close();
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/groupings-of-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/windows/groupings-of-browsing-contexts/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/groupings-of-browsing-contexts/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/MANIFEST b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/MANIFEST
new file mode 100644
index 000000000..3bc8c0f3f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/MANIFEST
@@ -0,0 +1 @@
+window-top-001.html
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/contains.json b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/contains.json
new file mode 100644
index 000000000..121284dca
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/contains.json
@@ -0,0 +1,6 @@
+[
+ {
+ "id": "navigating-nested-browsing-contexts-in-the-dom",
+ "original_id": "navigating-nested-browsing-contexts-in-the-dom"
+ }
+] \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html
new file mode 100644
index 000000000..f1d5581f6
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>HTML Test: window.frameElement</title>
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<script>
+
+var t1 = async_test("The window's frameElement attribute must return its container element if it is a nested browsing context");
+var t2 = async_test("The SecurityError must be thrown if the window accesses to frameElement attribute of a Window which does not have the same effective script origin");
+var t3 = async_test("The window's frameElement attribute must return null if the container's document does not have the same effective script origin");
+
+function on_load() {
+ t1.step(function () {
+ assert_equals(frames[0].frameElement, document.getElementById("fr1"),
+ "The frameElement attribute should be the first iframe element.");
+ assert_equals(window["win2"].frameElement, document.getElementById("obj"),
+ "The frameElement attribute should be the object element.");
+ assert_equals(window["win3"].frameElement, document.getElementById("emb"),
+ "The frameElement attribute should be the embed element.");
+ assert_equals(document.getElementById("fr4").contentWindow[0].frameElement,
+ document.getElementById("fr4").contentDocument.getElementById("f1"),
+ "The frameElement attribute should be the frame element in 'test.html'.");
+ });
+ t1.done();
+
+ t2.step(function () {
+ assert_throws("SecurityError", function () { frames[1].frameElement; },
+ "The SecurityError exception should be thrown.");
+ });
+ t2.done();
+
+ t3.step(function () {
+ document.getElementById("fr5").contentWindow.postMessage(null, "*");
+ });
+ window.addEventListener("message", function (event) {
+ var data = JSON.parse(event.data);
+ if (data.name == "testcase3") {
+ t3.step(function () {
+ assert_equals(data.result, "window.frameElement = null",
+ "The frameElement attribute should be null.");
+ });
+ t3.done();
+ }
+ }, false);
+}
+
+</script>
+<body onload="on_load()">
+ <div id="log"></div>
+ <iframe id="fr1"></iframe>
+ <iframe id="fr2" src="test.html"></iframe> <!-- cross origin -->
+ <iframe id="fr3" src="" style="display:none"></iframe>
+ <object id="obj" name="win2" type="text/html" data="about:blank"></object>
+ <embed id="emb" name="win3" type="image/svg+xml" src="/images/green.svg" />
+ <iframe id="fr4" src="test.html"></iframe> <!-- same origin -->
+ <iframe id="fr5" src="testcase3.html"></iframe> <!-- cross origin -->
+ <script>
+
+ setup(function () {
+ var src_base = get_host_info().HTTP_REMOTE_ORIGIN;
+ src_base += document.location.pathname.substring(0, document.location.pathname.lastIndexOf("/") + 1);
+ document.getElementById("fr2").src = src_base + "test.html";
+ document.getElementById("fr5").src = src_base + "testcase3.html";
+ });
+
+ test(function () {
+ assert_equals(window.frameElement, null,
+ "The frameElement attribute should be null.");
+ }, "The window's frameElement attribute must return null if it is not a nested browsing context");
+
+ </script>
+</body>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/test.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/test.html
new file mode 100644
index 000000000..d066b8d4c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/test.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>HTML Test: child browsing context created by the frame element</title>
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<frameset>
+ <frame id="f1" name="frame">
+</frameset>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/testcase3.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/testcase3.html
new file mode 100644
index 000000000..d67bde26f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/testcase3.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>Testcase 3: frameElement attribute must return null if the container\'s document does not have the same effective script origin</title>
+<script>
+window.addEventListener("message", function (event) {
+ try {
+ var result = "window.frameElement = " + window.frameElement;
+ } catch (e) {
+ result = e.message;
+ }
+ event.source.postMessage(JSON.stringify({name: "testcase3", result: result}),
+ "*");
+}, false);
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top-001.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top-001.html
new file mode 100644
index 000000000..9dbccfc7c
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top-001.html
@@ -0,0 +1,63 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>window.top</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ assert_equals(window, top)
+}, "Top level browsing context");
+
+function step_func(test) {
+ return function (top_pointer) {
+ test.step(function() {assert_equals(top_pointer, window);})
+ test.done();
+ }
+}
+
+var t1 = async_test("One nested iframe");
+t1.step(function() {
+ var iframe = document.createElement("iframe");
+ //iframe.src = "data:text/html,"
+
+ iframe.onload = t1.step_func(
+ function() {
+ var doc = iframe.contentDocument;
+ iframe.contentWindow.test_func = step_func(t1);
+
+ var script = doc.createElement("script")
+ script.textContent = "test_func(top);"
+ doc.body.appendChild(script);
+ });
+ document.body.appendChild(iframe);
+});
+
+var t2 = async_test("Two nested iframes");
+t2.step(function() {
+ var iframe = document.createElement("iframe");
+ //iframe.src = "data:text/html,"
+
+ iframe.onload = t2.step_func(
+ function() {
+ var doc = iframe.contentDocument;
+ iframe2 = document.createElement("iframe");
+ //iframe2.src = "data:text/html,"
+
+ iframe2.onload = t2.step_func(
+ function() {
+ var doc2 = iframe2.contentDocument;
+
+ iframe2.contentWindow.test_func = step_func(t2);
+
+ var script = doc2.createElement("script")
+ script.textContent = "test_func(top);"
+ doc2.body.appendChild(script);
+ });
+ doc.body.appendChild(iframe2);
+ });
+
+ document.body.appendChild(iframe);
+});
+
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-close-manual.sub.html b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-close-manual.sub.html
new file mode 100644
index 000000000..0191fa61e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-close-manual.sub.html
@@ -0,0 +1,3 @@
+<meta charset=utf-8>
+<p>Follow this link to open a new browsing context and then confirm it can be closed:
+<a rel=noreferrer target=reallydoesnotmatter href="//天気の良い日.{{location[host]}}/html/browsers/windows/support-close.html">link</a>.
diff --git a/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-manual.html b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-manual.html
new file mode 100644
index 000000000..f5879ee6d
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-manual.html
@@ -0,0 +1,10 @@
+<ol>
+ <li><p>After clicking these two links in order a single browsing context should be open showing
+ <code>example.org</code>:
+ <a target=doesnotmatter href="http://example.com/">one</a>,
+ <a target=doesnotmatter href="http://example.org/">two</a>.
+
+ <li><p>After clicking these two links two browsing contexts should have been opened:
+ <a rel=noreferrer target=reallydoesnotmatter href="http://example.com/">one</a>,
+ <a rel=noreferrer target=reallydoesnotmatter href="http://example.com/">two</a>.
+</ol>
diff --git a/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-window-name.sub.html b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-window-name.sub.html
new file mode 100644
index 000000000..790c22157
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-window-name.sub.html
@@ -0,0 +1,3 @@
+<meta charset=utf-8>
+<p>Follow this link to open a new browsing context and then confirm it says "idonteven":
+<a rel=noreferrer target=idonteven href="//天気の良い日.{{location[host]}}/html/browsers/windows/support-window-name-echo.html">link</a>.
diff --git a/testing/web-platform/tests/html/browsers/windows/noreferrer-window-name.html b/testing/web-platform/tests/html/browsers/windows/noreferrer-window-name.html
new file mode 100644
index 000000000..ecd2e7658
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/noreferrer-window-name.html
@@ -0,0 +1,85 @@
+<!doctype html>
+<title>rel=noreferrer and reuse of names</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ async_test(function(t) {
+ localStorage.clear()
+
+ function makeHyperlink(n) {
+ var hyperlink = document.body.appendChild(document.createElement("a"))
+ hyperlink.rel = "noreferrer"
+ hyperlink.target = "sufficientlyrandomwindownameamiright"
+ hyperlink.href = "support-named-null-opener.html#" + n
+ return hyperlink
+ }
+
+ var hyperlink1 = makeHyperlink(1),
+ hyperlink2 = makeHyperlink(2)
+
+ t.add_cleanup(function() {
+ localStorage.setItem("x", "close")
+ localStorage.clear()
+ document.body.removeChild(hyperlink1)
+ document.body.removeChild(hyperlink2)
+ })
+
+ addEventListener("storage", function(e) {
+ t.step(function() {
+ if(localStorage.getItem("window1") && localStorage.getItem("window2")) {
+ localStorage.setItem("x", "close")
+ t.done()
+ }
+ })
+ })
+
+ hyperlink1.click()
+ hyperlink2.click()
+ }, "Following a noreferrer link with a named target should not cause creation of a window that can be targeted by another noreferrer link with the same named target");
+
+ async_test(function(t) {
+ var ifr = document.createElement("iframe");
+ ifr.name = "sufficientlyrandomwindownameamiright2";
+ ifr.onload = t.step_func(function() {
+ var hyperlink = document.body.appendChild(document.createElement("a"));
+ t.add_cleanup(function() {
+ hyperlink.remove();
+ });
+ hyperlink.rel = "noreferrer";
+ hyperlink.href = URL.createObjectURL(new Blob(["hello subframe"],
+ { type: "text/html"}));
+ hyperlink.target = "sufficientlyrandomwindownameamiright2";
+ ifr.onload = t.step_func_done(function() {
+ assert_equals(ifr.contentDocument.documentElement.textContent,
+ "hello subframe");
+ });
+ hyperlink.click();
+ });
+ document.body.appendChild(ifr);
+ t.add_cleanup(function() {
+ ifr.remove();
+ });
+ }, "Targeting a rel=noreferrer link at an existing named subframe should work");
+
+ async_test(function(t) {
+ var win = window.open("", "sufficientlyrandomwindownameamiright3");
+ t.add_cleanup(function() {
+ win.close();
+ });
+
+ var hyperlink = document.body.appendChild(document.createElement("a"));
+ t.add_cleanup(function() {
+ hyperlink.remove();
+ });
+ hyperlink.rel = "noreferrer";
+ hyperlink.href = URL.createObjectURL(new Blob(["hello window"],
+ { type: "text/html"}));
+ hyperlink.target = "sufficientlyrandomwindownameamiright3";
+ win.onload = t.step_func_done(function() {
+ assert_equals(win.document.documentElement.textContent,
+ "hello window");
+ });
+ hyperlink.click();
+ }, "Targeting a rel=noreferrer link at an existing named window should work");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/noreferrer.html b/testing/web-platform/tests/html/browsers/windows/noreferrer.html
new file mode 100644
index 000000000..c072486b0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/noreferrer.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<title>rel=noreferrer nullifies window.opener</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ async_test(function(t) {
+ localStorage.clear()
+
+ var hyperlink = document.body.appendChild(document.createElement("a"))
+ hyperlink.rel = "noreferrer"
+ hyperlink.target = "_blank"
+ hyperlink.href = "support-opener-null.html"
+ hyperlink.click()
+ document.body.removeChild(hyperlink)
+
+ addEventListener("storage", function(e) {
+ t.step(function() {
+ assert_equals(e.newValue, "null")
+ localStorage.clear()
+ t.done()
+ })
+ })
+ })
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/secondary-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/windows/secondary-browsing-contexts/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/secondary-browsing-contexts/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/windows/security-nav/.gitkeep b/testing/web-platform/tests/html/browsers/windows/security-nav/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/security-nav/.gitkeep
diff --git a/testing/web-platform/tests/html/browsers/windows/support-close.html b/testing/web-platform/tests/html/browsers/windows/support-close.html
new file mode 100644
index 000000000..38ec2aef5
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/support-close.html
@@ -0,0 +1 @@
+<p>Clicking this button should close this browsing context: <button onclick=window.close()>button</button>
diff --git a/testing/web-platform/tests/html/browsers/windows/support-named-null-opener.html b/testing/web-platform/tests/html/browsers/windows/support-named-null-opener.html
new file mode 100644
index 000000000..8c106ca88
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/support-named-null-opener.html
@@ -0,0 +1,8 @@
+<script>
+ addEventListener("storage", function(e) {
+ if(e.newValue === "close") {
+ close()
+ }
+ })
+ localStorage.setItem("window" + location.hash.slice(1), "tralala")
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/support-nested-browsing-contexts.html b/testing/web-platform/tests/html/browsers/windows/support-nested-browsing-contexts.html
new file mode 100644
index 000000000..e92b69d7e
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/support-nested-browsing-contexts.html
@@ -0,0 +1,12 @@
+<body>
+<script>
+ var i = document.createElement("iframe");
+ i.name = "nested1";
+ document.body.appendChild(i);
+
+ window.opener.postMessage({
+ "name": window.name,
+ "isTop": window.top === window
+ }, "*");
+</script>
+</body>
diff --git a/testing/web-platform/tests/html/browsers/windows/support-opener-null.html b/testing/web-platform/tests/html/browsers/windows/support-opener-null.html
new file mode 100644
index 000000000..c734eb305
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/support-opener-null.html
@@ -0,0 +1,4 @@
+<script>
+ localStorage.setItem("opener", window.opener)
+ window.close()
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/support-post-to-opener.html b/testing/web-platform/tests/html/browsers/windows/support-post-to-opener.html
new file mode 100644
index 000000000..453fec97a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/support-post-to-opener.html
@@ -0,0 +1,8 @@
+<script>
+ if (window.opener) {
+ window.opener.postMessage({
+ "name": window.name,
+ "isTop": window.top === window
+ }, "*");
+ }
+</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/support-window-name-echo.html b/testing/web-platform/tests/html/browsers/windows/support-window-name-echo.html
new file mode 100644
index 000000000..a437fecb2
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/support-window-name-echo.html
@@ -0,0 +1 @@
+<script>document.write(name)</script>
diff --git a/testing/web-platform/tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.sub.html b/testing/web-platform/tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.sub.html
new file mode 100644
index 000000000..e37a595f7
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.sub.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Targeting nested browsing contexts</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script>
+ async_test(function (t) {
+ var windowsToClose = [];
+ window.onmessage = t.step_func(function (e) {
+ if (e.data.name == "openee") {
+ var a = document.body.appendChild(document.createElement('a'));
+ a.target = "nested1";
+ a.href = "support-post-to-opener.html";
+ a.click();
+ windowsToClose.push(e.source);
+ } else {
+ assert_equals(e.data.name, "nested1");
+ assert_equals(e.data.isTop, true);
+ windowsToClose.push(e.source);
+ windowsToClose.forEach(function (w) {
+ w.close();
+ });
+ t.done();
+ }
+ });
+
+ var a = document.body.appendChild(document.createElement('a'));
+ a.target = "openee";
+ a.href = get_host_info().HTTP_REMOTE_ORIGIN + "/html/browsers/windows/support-nested-browsing-contexts.html";
+ a.click();
+ });
+ </script>
+</body>
+</html>