[webkit-changes] [WebKit/WebKit] 94fe30: Correct dynamic handling of <base> elements

Anne van Kesteren noreply at github.com
Thu Aug 31 08:04:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 94fe30e306b57acc3a62e6bd75351fee3a393972
      https://github.com/WebKit/WebKit/commit/94fe30e306b57acc3a62e6bd75351fee3a393972
  Author: Anne van Kesteren <annevk at annevk.nl>
  Date:   2023-08-31 (Thu, 31 Aug 2023)

  Changed paths:
    M LayoutTests/fetch/fetch-url-serialization-expected.txt
    M LayoutTests/fetch/fetch-urls.json
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-base-element/base-data-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-base-element/base-data.html
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-base-element/base-javascript-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-base-element/base-javascript.html
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-base-element/w3c-import.log
    M LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-xhtml-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml_exclude=(file_javascript_mailto)-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/url/a-element_exclude=(file_javascript_mailto)-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/url/resources/a-element-origin.js
    M LayoutTests/imported/w3c/web-platform-tests/url/resources/a-element.js
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/html/HTMLBaseElement.cpp

  Log Message:
  -----------
  Correct dynamic handling of <base> elements
https://bugs.webkit.org/show_bug.cgi?id=260959
rdar://114756660

Reviewed by Chris Dumez.

Document::processBaseElement did not call Document::updateBaseURL when
there was something wrong with the new base URL. However, that meant
that a newly inserted "blocked" <base> would not impact the document
base URL and instead whatever was the prior document base URL would
continue to be used.

This goes against the HTML standard which requires the first <base>
element to be used at all times and if that is "blocked" the fallback
base URL would have to be used (typically the document's URL).

Tests are upstreamed via
https://github.com/web-platform-tests/wpt/pull/41731. Chromium matches
our failure, but given that it's an edge case I don't foresee any
issues.

While we're in the general area, stop invoking
Document::processBaseElement for <base> elements not connected to a
document as that results in a no-op tree traversal.

* LayoutTests/fetch/fetch-url-serialization-expected.txt:
* LayoutTests/fetch/fetch-urls.json:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-base-element/base-data-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-base-element/base-data.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-base-element/base-javascript-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-base-element/base-javascript.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-base-element/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-xhtml-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml_exclude=(file_javascript_mailto)-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/a-element_exclude=(file_javascript_mailto)-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/resources/a-element-origin.js:
(runURLTests):
* LayoutTests/imported/w3c/web-platform-tests/url/resources/a-element.js:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::processBaseElement):
* Source/WebCore/html/HTMLBaseElement.cpp:
(WebCore::HTMLBaseElement::attributeChanged):

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




More information about the webkit-changes mailing list