haikuwebkit/Source/WebCore/xml
Chris Dumez 60bdcd698a Document.baseURI is inaccurate for iframe srcdoc documents
https://bugs.webkit.org/show_bug.cgi?id=228933

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline WPT tests now that more checks are passing.

* web-platform-tests/html/infrastructure/urls/terminology-0/document-base-url-expected.txt:
* web-platform-tests/html/semantics/document-metadata/the-base-element/base_about_blank-expected.txt:
* web-platform-tests/html/semantics/document-metadata/the-base-element/base_href_invalid-expected.txt:
* web-platform-tests/html/semantics/document-metadata/the-base-element/base_srcdoc-expected.txt:

Source/WebCore:

Document.baseURI is inaccurate for iframe srcdoc documents:
- https://html.spec.whatwg.org/#fallback-base-url

This aligns our behavior with both Chrome and Firefox.

No new tests, rebaselined existing tests.

* dom/Document.cpp:
(WebCore::Document::fallbackBaseURL const):
(WebCore::Document::updateBaseURL):
Extract "fallback base URL" logic out of updateBaseURL() and into its own function so that
it can be called from other places. Add logic to deal with iframe srcdoc documents to
our "fallback base URL" logic, as per:
- https://html.spec.whatwg.org/#fallback-base-url

(WebCore::Document::processBaseElement):
As per https://html.spec.whatwg.org/#set-the-frozen-base-url, we should use the document's fallback base URL
as base URL when parsing the base element's href attribute.

* dom/Document.h:

* html/HTMLBaseElement.cpp:
(WebCore::HTMLBaseElement::href const):
Per https://html.spec.whatwg.org/#dom-base-href, we should use the document's fallback base URL when
parsing the base element's href attribute. Also we should return the attribute value if the URL fails
parsing, not a null URL.

* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::openFunc):
Keep in sync with HTMLBaseElement::href(), as per comment.

Source/WebKitLegacy/mac:

* DOM/DOMHTMLBaseElement.mm:
(-[DOMHTMLBaseElement href]):

LayoutTests:

Update existing layout test to reflect behavior change.

* fast/dom/HTMLBaseElement/href-attribute-resolves-with-respect-to-document.html: Removed.
* http/tests/misc/href-attribute-resolves-with-respect-to-document-expected.txt: Renamed from LayoutTests/fast/dom/HTMLBaseElement/href-attribute-resolves-with-respect-to-document-expected.txt.
* http/tests/misc/href-attribute-resolves-with-respect-to-document.html: Added.


Canonical link: https://commits.webkit.org/240398@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280855 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-10 17:51:30 +00:00
..
parser Document.baseURI is inaccurate for iframe srcdoc documents 2021-08-10 17:51:30 +00:00
CustomXPathNSResolver.cpp
CustomXPathNSResolver.h
CustomXPathNSResolver.idl
DOMParser.cpp
DOMParser.h
DOMParser.idl
NativeXPathNSResolver.cpp
NativeXPathNSResolver.h
SoftLinkLibxslt.cpp WTF SoftLinking macros can cause collisions with their target functions 2021-04-09 20:31:51 +00:00
SoftLinkLibxslt.h WTF SoftLinking macros can cause collisions with their target functions 2021-04-09 20:31:51 +00:00
XMLErrors.cpp Remove StringBuilder::appendNumber 2021-05-13 16:18:32 +00:00
XMLErrors.h Remove WTF::Optional synonym for std::optional, using that class template directly instead 2021-05-30 16:11:40 +00:00
XMLHttpRequest.cpp Blob URL changes after loading it 2021-08-10 03:33:03 +00:00
XMLHttpRequest.h Blob URL changes after loading it 2021-08-10 03:33:03 +00:00
XMLHttpRequest.idl xhr.send(URLSearchParams) should align default Content-Type header field with Chrome and Firefox 2021-06-29 19:07:43 +00:00
XMLHttpRequestEventTarget.h
XMLHttpRequestEventTarget.idl
XMLHttpRequestProgressEvent.cpp
XMLHttpRequestProgressEvent.h
XMLHttpRequestProgressEvent.idl
XMLHttpRequestProgressEventThrottle.cpp Sync XHR 'load' event is always has total/loaded=0 2021-07-15 22:52:51 +00:00
XMLHttpRequestProgressEventThrottle.h Sync XHR 'load' event is always has total/loaded=0 2021-07-15 22:52:51 +00:00
XMLHttpRequestUpload.cpp Fix unsafe access to m_upload in XMLHttpRequest::virtualHasPendingActivity() 2021-06-01 22:03:35 +00:00
XMLHttpRequestUpload.h Fix unsafe access to m_upload in XMLHttpRequest::virtualHasPendingActivity() 2021-06-01 22:03:35 +00:00
XMLHttpRequestUpload.idl
XMLSerializer.cpp
XMLSerializer.h
XMLSerializer.idl
XMLTreeViewer.cpp XML documents end up with a unique origin in WebKit only 2021-07-26 18:42:22 +00:00
XMLTreeViewer.h
XMLViewer.css
XMLViewer.js
XPathEvaluator.cpp
XPathEvaluator.h
XPathEvaluator.idl
XPathEvaluatorBase.idl
XPathExpression.cpp
XPathExpression.h
XPathExpression.idl
XPathExpressionNode.cpp
XPathExpressionNode.h
XPathFunctions.cpp Use HashSet<RefPtr<Node>> instead of HashSet<Node*> 2021-05-12 18:40:38 +00:00
XPathFunctions.h
XPathGrammar.cpp
XPathGrammar.h
XPathGrammar.y
XPathNSResolver.cpp
XPathNSResolver.h
XPathNSResolver.idl
XPathNodeSet.cpp Use HashSet<RefPtr<Node>> instead of HashSet<Node*> 2021-05-12 18:40:38 +00:00
XPathNodeSet.h
XPathParser.cpp [WTF] Introduce RobinHoodHashTable 2021-04-02 08:33:32 +00:00
XPathParser.h
XPathPath.cpp Use HashSet<RefPtr<Node>> instead of HashSet<Node*> 2021-05-12 18:40:38 +00:00
XPathPath.h
XPathPredicate.cpp Use HashSet<RefPtr<Node>> instead of HashSet<Node*> 2021-05-12 18:40:38 +00:00
XPathPredicate.h
XPathResult.cpp
XPathResult.h
XPathResult.idl
XPathStep.cpp
XPathStep.h
XPathUtil.cpp
XPathUtil.h
XPathValue.cpp
XPathValue.h
XPathVariableReference.cpp
XPathVariableReference.h
XSLImportRule.cpp
XSLImportRule.h
XSLStyleSheet.h Add a StyleSheets log channel and some logging 2021-07-12 20:45:20 +00:00
XSLStyleSheetLibxslt.cpp Add a StyleSheets log channel and some logging 2021-07-12 20:45:20 +00:00
XSLTExtensions.cpp
XSLTExtensions.h
XSLTProcessor.cpp
XSLTProcessor.h
XSLTProcessor.idl
XSLTProcessorLibxslt.cpp Use Vector<uint8_t> instead of Vector<char> to store bytes in SharedBuffer 2021-06-05 01:16:43 +00:00
XSLTUnicodeSort.cpp
XSLTUnicodeSort.h
xmlattrs.in
xmlnsattrs.in