haikuwebkit/Source/WebKitLegacy/mac/DOM
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
..
DOM.h
DOM.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMAbstractView.h
DOMAbstractView.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMAbstractViewFrame.h
DOMAbstractViewInternal.h
DOMAttr.h
DOMAttr.mm
DOMAttrInternal.h
DOMBlob.h
DOMBlob.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMBlobInternal.h
DOMCDATASection.h
DOMCDATASection.mm
DOMCDATASectionInternal.h
DOMCSS.h
DOMCSS.mm Add CSSConditionRule and CSSGroupingRule 2020-09-25 17:19:48 +00:00
DOMCSSCharsetRule.h
DOMCSSCharsetRule.mm
DOMCSSFontFaceRule.h
DOMCSSFontFaceRule.mm
DOMCSSImportRule.h
DOMCSSImportRule.mm
DOMCSSMediaRule.h
DOMCSSMediaRule.mm
DOMCSSPageRule.h
DOMCSSPageRule.mm
DOMCSSPrimitiveValue.h
DOMCSSPrimitiveValue.mm
DOMCSSPrimitiveValueInternal.h
DOMCSSRule.h
DOMCSSRule.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMCSSRuleInternal.h
DOMCSSRuleList.h
DOMCSSRuleList.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMCSSRuleListInternal.h
DOMCSSStyleDeclaration.h
DOMCSSStyleDeclaration.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMCSSStyleDeclarationInternal.h
DOMCSSStyleRule.h
DOMCSSStyleRule.mm
DOMCSSStyleSheet.h
DOMCSSStyleSheet.mm Consider making CSSStyleSheet::rules() just an alias of CSSStyleSheet::cssRules(). 2021-04-17 22:38:29 +00:00
DOMCSSStyleSheetInternal.h
DOMCSSUnknownRule.h
DOMCSSUnknownRule.mm
DOMCSSValue.h
DOMCSSValue.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMCSSValueInternal.h
DOMCSSValueList.h
DOMCSSValueList.mm
DOMCharacterData.h
DOMCharacterData.mm
DOMComment.h
DOMComment.mm
DOMCommentInternal.h
DOMCore.h
DOMCounter.h
DOMCounter.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMCounterInternal.h
DOMCustomXPathNSResolver.h
DOMCustomXPathNSResolver.mm BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS should not have trailing semicolons 2020-07-07 02:57:06 +00:00
DOMDocument.h
DOMDocument.mm Document's execCommand() / queryCommand*() should throw an exception on non-HTML/XHTML documents 2021-06-17 05:39:51 +00:00
DOMDocumentFragment.h
DOMDocumentFragment.mm
DOMDocumentFragmentInternal.h
DOMDocumentFragmentPrivate.h
DOMDocumentInternal.h
DOMDocumentPrivate.h
DOMDocumentType.h
DOMDocumentType.mm
DOMDocumentTypeInternal.h
DOMElement.h
DOMElement.mm
DOMElementInternal.h
DOMEntity.h
DOMEntity.mm
DOMEntityReference.h
DOMEntityReference.mm
DOMEvent.h
DOMEvent.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMEventException.h
DOMEventInternal.h
DOMEventListener.h
DOMEventTarget.h
DOMEvents.h
DOMEvents.mm
DOMException.h
DOMExtensions.h
DOMFile.h
DOMFile.mm
DOMFileInternal.h
DOMFileList.h
DOMFileList.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMFileListInternal.h
DOMHTML.h
DOMHTML.mm Rename hasOverflowClip() to prepare for the real overflow:clip 2021-07-14 20:40:50 +00:00
DOMHTMLAnchorElement.h
DOMHTMLAnchorElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLAppletElement.h
DOMHTMLAppletElement.mm Unexpose obsolete HTMLAppletElement interface 2020-11-10 00:29:04 +00:00
DOMHTMLAreaElement.h
DOMHTMLAreaElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLAreaElementInternal.h
DOMHTMLBRElement.h
DOMHTMLBRElement.mm
DOMHTMLBaseElement.h
DOMHTMLBaseElement.mm Document.baseURI is inaccurate for iframe srcdoc documents 2021-08-10 17:51:30 +00:00
DOMHTMLBaseFontElement.h
DOMHTMLBaseFontElement.mm
DOMHTMLBodyElement.h
DOMHTMLBodyElement.mm
DOMHTMLButtonElement.h
DOMHTMLButtonElement.mm
DOMHTMLCanvasElement.h
DOMHTMLCanvasElement.mm
DOMHTMLCollection.h
DOMHTMLCollection.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMHTMLCollectionInternal.h
DOMHTMLDListElement.h
DOMHTMLDListElement.mm
DOMHTMLDirectoryElement.h
DOMHTMLDirectoryElement.mm
DOMHTMLDivElement.h
DOMHTMLDivElement.mm
DOMHTMLDocument.h
DOMHTMLDocument.mm
DOMHTMLDocumentInternal.h
DOMHTMLElement.h
DOMHTMLElement.mm
DOMHTMLElementInternal.h
DOMHTMLElementPrivate.h
DOMHTMLEmbedElement.h
DOMHTMLEmbedElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLFieldSetElement.h
DOMHTMLFieldSetElement.mm
DOMHTMLFontElement.h
DOMHTMLFontElement.mm
DOMHTMLFormElement.h
DOMHTMLFormElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLFormElementInternal.h
DOMHTMLFrameElement.h
DOMHTMLFrameElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLFrameSetElement.h
DOMHTMLFrameSetElement.mm
DOMHTMLHRElement.h
DOMHTMLHRElement.mm
DOMHTMLHeadElement.h
DOMHTMLHeadElement.mm
DOMHTMLHeadElementInternal.h
DOMHTMLHeadingElement.h
DOMHTMLHeadingElement.mm
DOMHTMLHtmlElement.h
DOMHTMLHtmlElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLIFrameElement.h
DOMHTMLIFrameElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLImageElement.h
DOMHTMLImageElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLImageElementInternal.h
DOMHTMLInputElement.h
DOMHTMLInputElement.mm [Cocoa] Remove the one use of String::toInt from WebKitLegacy 2021-05-09 01:26:37 +00:00
DOMHTMLInputElementInternal.h
DOMHTMLInputElementPrivate.h
DOMHTMLLIElement.h
DOMHTMLLIElement.mm
DOMHTMLLabelElement.h
DOMHTMLLabelElement.mm
DOMHTMLLegendElement.h
DOMHTMLLegendElement.mm
DOMHTMLLinkElement.h
DOMHTMLLinkElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLLinkElementInternal.h
DOMHTMLMapElement.h
DOMHTMLMapElement.mm
DOMHTMLMarqueeElement.h
DOMHTMLMarqueeElement.mm
DOMHTMLMediaElement.h
DOMHTMLMediaElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLMenuElement.h
DOMHTMLMenuElement.mm
DOMHTMLMetaElement.h
DOMHTMLMetaElement.mm
DOMHTMLModElement.h
DOMHTMLModElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLOListElement.h
DOMHTMLOListElement.mm
DOMHTMLObjectElement.h
DOMHTMLObjectElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLOptGroupElement.h
DOMHTMLOptGroupElement.mm
DOMHTMLOptionElement.h
DOMHTMLOptionElement.mm
DOMHTMLOptionElementInternal.h
DOMHTMLOptionsCollection.h
DOMHTMLOptionsCollection.mm Remove WTF::Optional synonym for std::optional, using that class template directly instead 2021-05-30 16:11:40 +00:00
DOMHTMLOptionsCollectionInternal.h
DOMHTMLParagraphElement.h
DOMHTMLParagraphElement.mm
DOMHTMLParamElement.h
DOMHTMLParamElement.mm
DOMHTMLPreElement.h
DOMHTMLPreElement.mm
DOMHTMLQuoteElement.h
DOMHTMLQuoteElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLScriptElement.h
DOMHTMLScriptElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMHTMLScriptElementInternal.h
DOMHTMLSelectElement.h
DOMHTMLSelectElement.mm
DOMHTMLSelectElementInternal.h
DOMHTMLStyleElement.h
DOMHTMLStyleElement.mm
DOMHTMLStyleElementInternal.h
DOMHTMLTableCaptionElement.h
DOMHTMLTableCaptionElement.mm
DOMHTMLTableCaptionElementInternal.h
DOMHTMLTableCellElement.h
DOMHTMLTableCellElement.mm
DOMHTMLTableCellElementInternal.h
DOMHTMLTableColElement.h
DOMHTMLTableColElement.mm
DOMHTMLTableColElementInternal.h
DOMHTMLTableElement.h
DOMHTMLTableElement.mm
DOMHTMLTableRowElement.h
DOMHTMLTableRowElement.mm
DOMHTMLTableSectionElement.h
DOMHTMLTableSectionElement.mm
DOMHTMLTableSectionElementInternal.h
DOMHTMLTextAreaElement.h
DOMHTMLTextAreaElement.mm
DOMHTMLTextAreaElementInternal.h
DOMHTMLTextAreaElementPrivate.h
DOMHTMLTitleElement.h
DOMHTMLTitleElement.mm
DOMHTMLUListElement.h
DOMHTMLUListElement.mm
DOMHTMLVideoElement.h
DOMHTMLVideoElement.mm Prepare to remove automatic URL->String conversion operators 2020-04-25 21:28:45 +00:00
DOMImplementation.h
DOMImplementation.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMImplementationInternal.h
DOMInternal.h
DOMInternal.mm Drop CheckedLock / CheckedCondition aliases 2021-05-24 18:29:01 +00:00
DOMKeyboardEvent.h
DOMKeyboardEvent.mm
DOMMediaError.h
DOMMediaError.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMMediaErrorInternal.h
DOMMediaList.h
DOMMediaList.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMMediaListInternal.h
DOMMouseEvent.h
DOMMouseEvent.mm
DOMMutationEvent.h
DOMMutationEvent.mm
DOMNamedNodeMap.h
DOMNamedNodeMap.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMNamedNodeMapInternal.h
DOMNode.h
DOMNode.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMNodeFilter.h
DOMNodeInternal.h
DOMNodeIterator.h
DOMNodeIterator.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMNodeIteratorInternal.h
DOMNodeList.h
DOMNodeList.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMNodeListInternal.h
DOMNodePrivate.h
DOMObject.h
DOMObject.mm
DOMOverflowEvent.h
DOMOverflowEvent.mm
DOMPrivate.h
DOMProcessingInstruction.h
DOMProcessingInstruction.mm
DOMProcessingInstructionInternal.h
DOMProgressEvent.h
DOMProgressEvent.mm
DOMRGBColor.h
DOMRGBColor.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMRGBColorInternal.h
DOMRange.h
DOMRange.mm Remove WTF::Optional synonym for std::optional, using that class template directly instead 2021-05-30 16:11:40 +00:00
DOMRangeException.h
DOMRangeInternal.h Remove <wtf/Optional.h> 2021-06-02 06:45:51 +00:00
DOMRanges.h
DOMRect.h
DOMRect.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMRectInternal.h
DOMStyleSheet.h
DOMStyleSheet.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMStyleSheetInternal.h
DOMStyleSheetList.h
DOMStyleSheetList.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMStyleSheetListInternal.h
DOMStylesheets.h
DOMText.h
DOMText.mm
DOMTextEvent.h
DOMTextEvent.mm
DOMTextInternal.h
DOMTimeRanges.h
DOMTimeRanges.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMTimeRangesInternal.h
DOMTokenList.h
DOMTokenList.mm Fix some issues hidden by unified build 2021-04-13 02:06:28 +00:00
DOMTokenListInternal.h
DOMTraversal.h
DOMTreeWalker.h
DOMTreeWalker.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMTreeWalkerInternal.h
DOMUIEvent.h
DOMUIEvent.mm
DOMUIKitExtensions.h
DOMUIKitExtensions.mm Rename InlineBox to LegacyInlineBox 2021-06-01 17:22:45 +00:00
DOMUtility.mm Remove some member functions of Range and many calls to createLiveRange 2020-08-03 00:47:52 +00:00
DOMViews.h
DOMWheelEvent.h
DOMWheelEvent.mm
DOMWheelEventInternal.h
DOMXPath.h
DOMXPath.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMXPathException.h
DOMXPathExpression.h
DOMXPathExpression.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMXPathExpressionInternal.h
DOMXPathNSResolver.h
DOMXPathResult.h
DOMXPathResult.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
DOMXPathResultInternal.h
ExceptionHandlers.h
ExceptionHandlers.mm Reduce explicit usage of [objC release] in WebKit 2021-02-13 02:16:44 +00:00
ObjCEventListener.h
ObjCEventListener.mm
ObjCNodeFilterCondition.h
ObjCNodeFilterCondition.mm
WebAutocapitalizeTypes.h
WebDOMOperations.h
WebDOMOperations.mm Reduce explicit usage of [objC autorelease] in WebKit even further 2021-02-18 05:06:15 +00:00
WebDOMOperationsInternal.h
WebDOMOperationsPrivate.h