We should not return undefined for most properties of a detached Window
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Jan 2018 03:31:28 +0000 (03:31 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Jan 2018 03:31:28 +0000 (03:31 +0000)
commit2f2688aa15fcb253a9b9e7a69c31da7a2c98ac53
tree261a1525db125d56e5bde4c97787c00edb4434c6
parent8325d193119641dcc25a98defcab7a001bc25d31
We should not return undefined for most properties of a detached Window
https://bugs.webkit.org/show_bug.cgi?id=181416
<rdar://problem/36162489>

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline several WPT tests now that more checks are passing.

* web-platform-tests/custom-elements/custom-element-registry/per-global-expected.txt:
* web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-append-to-child-document-expected.txt:
* web-platform-tests/service-workers/service-worker/detached-context.https-expected.txt:

Source/WebCore:

We should not return undefined for most properties on a detached Window. WebKit previously only exposed "closed"
and "close" properties on detached / frameless windows. However, this does not match the HTML specification [1]
or the behavior of Firefox and Chrome.

Note that Chrome does not seem to fully follow the HTML specification either, it seems to treat detached windows
the same way as cross-origin ones. As a result, it only exposed properties that are visible cross-origin when
a window is detached / frameless.

[1] https://html.spec.whatwg.org/#windowproxy-get

No new tests, updated existingt tests.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::getOwnPropertySlotByIndex):

LayoutTests:

Update existing tests to reflect behavior change.

* fast/dom/Window/orphaned-frame-access-expected.txt:
* fast/dom/Window/orphaned-frame-access.html:
* fast/frames/detached-frame-property-expected.txt:
* fast/frames/detached-frame-property.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226676 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/orphaned-frame-access-expected.txt
LayoutTests/fast/dom/Window/orphaned-frame-access.html
LayoutTests/fast/frames/detached-frame-property-expected.txt
LayoutTests/fast/frames/detached-frame-property.html
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-registry/per-global-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-append-to-child-document-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/detached-context.https-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp