https://bugs.webkit.org/show_bug.cgi?id=189375
<rdar://problem/
44282755>
Reviewed by Youenn Fablet.
LayoutTests/imported/w3c:
Rebaseline WPT test now that more checks are passing.
* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window-expected.txt:
Source/WebCore:
Update our document.open() to not propagate URLs to non-fully active documents, as per:
- https://html.spec.whatwg.org/#document-open-steps (Step 11)
A "fully active" document is defined by at:
- https://html.spec.whatwg.org/#fully-active
No new tests, rebaselined existing test.
* dom/Document.cpp:
(WebCore::Document::open):
(WebCore::Document::isFullyActive const):
* dom/Document.h:
* dom/Document.idl:
LayoutTests:
Update existing test to reflect behavior change. I have verified that this test was
failing in Firefox and is now passing in Firefox.
* fast/dom/resource-locations-in-created-html-document.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236550
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2018-09-27 Chris Dumez <cdumez@apple.com>
+ document.open() should not propagate URLs to non-fully active documents
+ https://bugs.webkit.org/show_bug.cgi?id=189375
+ <rdar://problem/44282755>
+
+ Reviewed by Youenn Fablet.
+
+ Update existing test to reflect behavior change. I have verified that this test was
+ failing in Firefox and is now passing in Firefox.
+
+ * fast/dom/resource-locations-in-created-html-document.html:
+
+2018-09-27 Chris Dumez <cdumez@apple.com>
+
The WebContent process should not process incoming IPC while waiting for a sync IPC reply
https://bugs.webkit.org/show_bug.cgi?id=184183
<rdar://problem/36800576>
var path = htmlDoc.getElementById('theImage').src;
- if (path == 'file:///test')
- document.getElementById('result').innerHTML = 'SUCCESS';
- else if (/^file:\/\/\/[C-Z]:\/test$/.test(path)) // MS Windows.
+ if (path === '/test')
document.getElementById('result').innerHTML = 'SUCCESS';
}
</script>
+2018-09-27 Chris Dumez <cdumez@apple.com>
+
+ document.open() should not propagate URLs to non-fully active documents
+ https://bugs.webkit.org/show_bug.cgi?id=189375
+ <rdar://problem/44282755>
+
+ Reviewed by Youenn Fablet.
+
+ Rebaseline WPT test now that more checks are passing.
+
+ * web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window-expected.txt:
+
2018-09-27 Antoine Quint <graouts@apple.com>
[Web Animations] Turn Web Animations with CSS integration on
PASS document.open() changes document's URL (fully active document)
-FAIL document.open() does not change document's URL (active but not fully active document) assert_equals: expected "http://localhost:8800/common/blank.html" but got "http://localhost:8800/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window.html"
-FAIL document.open() does not change document's URL (non-active document with an associated Window object; frame is removed) assert_equals: expected "about:blank" but got "http://localhost:8800/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window.html"
-FAIL document.open() does not change document's URL (non-active document with an associated Window object; navigated away) assert_equals: expected "about:blank" but got "http://localhost:8800/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window.html"
-FAIL document.open() does not change document's URL (non-active document without an associated Window object) assert_equals: expected "about:blank" but got "http://localhost:8800/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window.html"
+FAIL document.open() does not change document's URL (active but not fully active document) null is not an object (evaluating 'childWin.location.href')
+PASS document.open() does not change document's URL (non-active document with an associated Window object; frame is removed)
+PASS document.open() does not change document's URL (non-active document with an associated Window object; navigated away)
+PASS document.open() does not change document's URL (non-active document without an associated Window object)
+2018-09-27 Chris Dumez <cdumez@apple.com>
+
+ document.open() should not propagate URLs to non-fully active documents
+ https://bugs.webkit.org/show_bug.cgi?id=189375
+ <rdar://problem/44282755>
+
+ Reviewed by Youenn Fablet.
+
+ Update our document.open() to not propagate URLs to non-fully active documents, as per:
+ - https://html.spec.whatwg.org/#document-open-steps (Step 11)
+
+ A "fully active" document is defined by at:
+ - https://html.spec.whatwg.org/#fully-active
+
+ No new tests, rebaselined existing test.
+
+ * dom/Document.cpp:
+ (WebCore::Document::open):
+ (WebCore::Document::isFullyActive const):
+ * dom/Document.h:
+ * dom/Document.idl:
+
2018-09-27 Alicia Boya GarcĂa <aboya@igalia.com>
[MSE][GStreamer] Use sentinel buffer to detect end of append
return m_domWindow->open(activeWindow, firstWindow, url, name, features);
}
-// FIXME: Add support for the 'type' and 'replace' parameters.
ExceptionOr<Document&> Document::openForBindings(Document* responsibleDocument, const String&, const String&)
{
if (!isHTMLDocument() || m_throwOnDynamicMarkupInsertionCount)
removeAllEventListeners();
- if (responsibleDocument) {
+ if (responsibleDocument && isFullyActive()) {
setURL(responsibleDocument->url());
setCookieURL(responsibleDocument->cookieURL());
setSecurityOriginPolicy(responsibleDocument->securityOriginPolicy());
m_frame->loader().didExplicitOpen();
}
+// https://html.spec.whatwg.org/#fully-active
+bool Document::isFullyActive() const
+{
+ auto* frame = this->frame();
+ if (!frame || frame->document() != this)
+ return false;
+
+ if (frame->isMainFrame())
+ return true;
+
+ auto* parentFrame = frame->tree().parent();
+ return parentFrame && parentFrame->document() && parentFrame->document()->isFullyActive();
+}
+
void Document::detachParser()
{
if (!m_parser)
WEBCORE_EXPORT DocumentLoader* loader() const;
WEBCORE_EXPORT ExceptionOr<RefPtr<WindowProxy>> openForBindings(DOMWindow& activeWindow, DOMWindow& firstDOMWindow, const String& url, const AtomicString& name, const String& features);
- WEBCORE_EXPORT ExceptionOr<Document&> openForBindings(Document* responsibleDocument, const String& type, const String& replace);
+ WEBCORE_EXPORT ExceptionOr<Document&> openForBindings(Document* responsibleDocument, const String&, const String&);
// FIXME: We should rename this at some point and give back the name 'open' to the HTML specified ones.
WEBCORE_EXPORT void open(Document* responsibleDocument = nullptr);
const URL& firstPartyForCookies() const { return m_firstPartyForCookies; }
void setFirstPartyForCookies(const URL& url) { m_firstPartyForCookies = url; }
+ bool isFullyActive() const;
+
// The full URL corresponding to the "site for cookies" in the Same-Site Cookies spec.,
// <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>. It is either
// the URL of the top-level document or the null URL depending on whether the registrable
// FIXME: The HTML spec says this should consult the "responsible document". We should ensure
// that the caller document matches those semantics. It is possible we should replace it with
// the existing 'incumbent document' concept.
- [CEReactions, CallWith=ResponsibleDocument, ImplementedAs=openForBindings, MayThrowException] Document open(optional DOMString type = "text/html", optional DOMString replace = "");
+ [CEReactions, CallWith=ResponsibleDocument, ImplementedAs=openForBindings, MayThrowException] Document open(optional DOMString unused1, optional DOMString unused2); // both arguments are ignored.
[CallWith=ActiveWindow&FirstWindow, ImplementedAs=openForBindings, MayThrowException] WindowProxy open(USVString url, DOMString name, DOMString features);
[CEReactions, ImplementedAs=closeForBindings, MayThrowException] void close();
[CEReactions, CallWith=ResponsibleDocument, MayThrowException] void write(DOMString... text);