[webkit-changes] [WebKit/WebKit] 194c42: Implement window.location for site-isolated iframes

Alex Christensen noreply at github.com
Thu Oct 5 09:12:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 194c42fd694410278bc8a19d998239cfe043667f
      https://github.com/WebKit/WebKit/commit/194c42fd694410278bc8a19d998239cfe043667f
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2023-10-05 (Thu, 05 Oct 2023)

  Changed paths:
    A LayoutTests/http/tests/site-isolation/resources/window-properties-child-2.html
    M LayoutTests/http/tests/site-isolation/resources/window-properties-grandchild.html
    M LayoutTests/http/tests/site-isolation/window-properties-expected.txt
    M LayoutTests/http/tests/site-isolation/window-properties.html
    M Source/WebCore/bindings/js/JSDOMBindingSecurity.cpp
    M Source/WebCore/bindings/js/JSDOMBindingSecurity.h
    M Source/WebCore/page/DOMWindow.cpp
    M Source/WebCore/page/DOMWindow.h
    M Source/WebCore/page/DOMWindow.idl
    M Source/WebCore/page/LocalDOMWindow.cpp
    M Source/WebCore/page/LocalDOMWindow.h
    M Source/WebCore/page/LocalDOMWindow.idl
    M Source/WebCore/page/Location.cpp
    M Source/WebCore/page/Location.h
    M Source/WebCore/page/RemoteDOMWindow.cpp
    M Source/WebCore/page/RemoteDOMWindow.h
    M Source/WebCore/page/RemoteDOMWindow.idl

  Log Message:
  -----------
  Implement window.location for site-isolated iframes
https://bugs.webkit.org/show_bug.cgi?id=262634
rdar://116203895

Reviewed by Pascoe.

window.location needs to be accessible on a RemoteDOMWindow, but its accessors need to throw security exceptions.
However, setting the location should navigate the frame.  I added tests that verify this is the case.
I moved the Location getter and setter from LocalDOMWindow to DOMWindow to share code when possible.

* LayoutTests/http/tests/site-isolation/resources/window-properties-child-2.html: Added.
* LayoutTests/http/tests/site-isolation/resources/window-properties-grandchild.html:
* LayoutTests/http/tests/site-isolation/window-properties-expected.txt:
* LayoutTests/http/tests/site-isolation/window-properties.html:
* Source/WebCore/bindings/js/JSDOMBindingSecurity.cpp:
(WebCore::BindingSecurity::shouldAllowAccessToDOMWindow):
* Source/WebCore/bindings/js/JSDOMBindingSecurity.h:
* Source/WebCore/page/DOMWindow.cpp:
(WebCore::DOMWindow::location):
(WebCore::root):
* Source/WebCore/page/DOMWindow.h:
* Source/WebCore/page/DOMWindow.idl:
* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::location): Deleted.
* Source/WebCore/page/LocalDOMWindow.h:
* Source/WebCore/page/LocalDOMWindow.idl:
* Source/WebCore/page/Location.cpp:
(WebCore::Location::Location):
(WebCore::Location::frame):
(WebCore::Location::frame const):
(WebCore::Location::url const):
(WebCore::Location::setProtocol):
(WebCore::Location::setHost):
(WebCore::Location::setHostname):
(WebCore::Location::setPort):
(WebCore::Location::setPathname):
(WebCore::Location::setSearch):
(WebCore::Location::setHash):
(WebCore::Location::replace):
(WebCore::Location::reload):
(WebCore::Location::setLocation):
* Source/WebCore/page/Location.h:
* Source/WebCore/page/RemoteDOMWindow.cpp:
(WebCore::RemoteDOMWindow::location const): Deleted.
* Source/WebCore/page/RemoteDOMWindow.h:
* Source/WebCore/page/RemoteDOMWindow.idl:

Canonical link: https://commits.webkit.org/268918@main




More information about the webkit-changes mailing list