Diff
Modified: trunk/Source/WebCore/ChangeLog (248727 => 248728)
--- trunk/Source/WebCore/ChangeLog 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/ChangeLog 2019-08-15 17:44:07 UTC (rev 248728)
@@ -1,3 +1,84 @@
+2019-08-15 Youenn Fablet <[email protected]>
+
+ Always create a Document with a valid SessionID
+ https://bugs.webkit.org/show_bug.cgi?id=200727
+
+ Reviewed by Alex Christensen.
+
+ Pass a valid SessionID to the Document constructor.
+ This allows getting us closer to use SessionID like ObjectIdentifier.
+ Add a SessionID getter from Frame and use it when constructing a Document.
+ Otherwise, retrieve the SessionID from the corresponding context.
+ No change of behavior.
+
+ * dom/DOMImplementation.cpp:
+ (WebCore::createXMLDocument):
+ (WebCore::DOMImplementation::createDocument):
+ (WebCore::DOMImplementation::createHTMLDocument):
+ * dom/DOMImplementation.h:
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+ (WebCore::m_undoManager):
+ (WebCore::Document::create):
+ (WebCore::Document::createNonRenderedPlaceholder):
+ (WebCore::Document::cloneDocumentWithoutChildren const):
+ (WebCore::Document::ensureTemplateDocument):
+ * dom/Document.h:
+ (WebCore::Document::create):
+ (WebCore::Document::createNonRenderedPlaceholder): Deleted.
+ * dom/XMLDocument.h:
+ (WebCore::XMLDocument::create):
+ (WebCore::XMLDocument::createXHTML):
+ (WebCore::XMLDocument::XMLDocument):
+ * html/FTPDirectoryDocument.cpp:
+ (WebCore::FTPDirectoryDocument::FTPDirectoryDocument):
+ * html/FTPDirectoryDocument.h:
+ * html/HTMLDocument.cpp:
+ (WebCore::HTMLDocument::createSynthesizedDocument):
+ (WebCore::HTMLDocument::HTMLDocument):
+ (WebCore::HTMLDocument::cloneDocumentWithoutChildren const):
+ * html/HTMLDocument.h:
+ (WebCore::HTMLDocument::create):
+ (WebCore::HTMLDocument::createSynthesizedDocument): Deleted.
+ * html/ImageDocument.cpp:
+ (WebCore::ImageDocument::ImageDocument):
+ * html/MediaDocument.cpp:
+ (WebCore::MediaDocument::MediaDocument):
+ * html/MediaDocument.h:
+ * html/PluginDocument.cpp:
+ (WebCore::PluginDocument::PluginDocument):
+ * html/PluginDocument.h:
+ * html/TextDocument.cpp:
+ (WebCore::TextDocument::TextDocument):
+ * html/TextDocument.h:
+ * inspector/DOMPatchSupport.cpp:
+ (WebCore::DOMPatchSupport::patchDocument):
+ * loader/DocumentWriter.cpp:
+ (WebCore::DocumentWriter::createDocument):
+ (WebCore::DocumentWriter::begin):
+ * loader/SinkDocument.cpp:
+ (WebCore::SinkDocument::SinkDocument):
+ * loader/SinkDocument.h:
+ * loader/cache/CachedSVGDocument.cpp:
+ (WebCore::CachedSVGDocument::finishLoading):
+ * loader/cache/CachedSVGFont.cpp:
+ (WebCore::CachedSVGFont::ensureCustomFontData):
+ * page/Frame.cpp:
+ (WebCore::Frame::sessionID const):
+ * page/Frame.h:
+ * svg/SVGDocument.cpp:
+ (WebCore::SVGDocument::SVGDocument):
+ (WebCore::SVGDocument::cloneDocumentWithoutChildren const):
+ * svg/SVGDocument.h:
+ (WebCore::SVGDocument::create):
+ * xml/DOMParser.cpp:
+ (WebCore::DOMParser::parseFromString):
+ * xml/DOMParser.h:
+ * xml/DOMParser.idl:
+ * xml/XMLHttpRequest.cpp:
+ * xml/XSLTProcessor.cpp:
+ (WebCore::XSLTProcessor::createDocumentFromSource):
+
2019-08-15 Antti Koivisto <[email protected]>
Negative size box with border radius causes hang under WebCore::approximateAsRegion
Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (248727 => 248728)
--- trunk/Source/WebCore/dom/DOMImplementation.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -77,18 +77,18 @@
return DocumentType::create(m_document, qualifiedName, publicId, systemId);
}
-static inline Ref<XMLDocument> createXMLDocument(const String& namespaceURI)
+static inline Ref<XMLDocument> createXMLDocument(PAL::SessionID sessionID, const String& namespaceURI)
{
if (namespaceURI == SVGNames::svgNamespaceURI)
- return SVGDocument::create(nullptr, URL());
+ return SVGDocument::create(sessionID, nullptr, URL());
if (namespaceURI == HTMLNames::xhtmlNamespaceURI)
- return XMLDocument::createXHTML(nullptr, URL());
- return XMLDocument::create(nullptr, URL());
+ return XMLDocument::createXHTML(sessionID, nullptr, URL());
+ return XMLDocument::create(sessionID, nullptr, URL());
}
ExceptionOr<Ref<XMLDocument>> DOMImplementation::createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType* documentType)
{
- auto document = createXMLDocument(namespaceURI);
+ auto document = createXMLDocument(m_document.sessionID(), namespaceURI);
document->setContextDocument(m_document.contextDocument());
document->setSecurityOriginPolicy(m_document.securityOriginPolicy());
@@ -120,7 +120,7 @@
Ref<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title)
{
- auto document = HTMLDocument::create(nullptr, URL());
+ auto document = HTMLDocument::create(m_document.sessionID(), nullptr, URL());
document->open();
document->write(nullptr, { "<!doctype html><html><head></head><body></body></html>"_s });
if (!title.isNull()) {
@@ -134,7 +134,7 @@
return document;
}
-Ref<Document> DOMImplementation::createDocument(const String& type, Frame* frame, const URL& url)
+Ref<Document> DOMImplementation::createDocument(PAL::SessionID sessionID, const String& type, Frame* frame, const URL& url)
{
// FIXME: Inelegant to have this here just because this is the home of DOM APIs for creating documents.
// This is internal, not a DOM API. Maybe we should put it in a new class called DocumentFactory,
@@ -142,11 +142,11 @@
// Plug-ins cannot take over for HTML, XHTML, plain text, or non-PDF images.
if (equalLettersIgnoringASCIICase(type, "text/html"))
- return HTMLDocument::create(frame, url);
+ return HTMLDocument::create(sessionID, frame, url);
if (equalLettersIgnoringASCIICase(type, "application/xhtml+xml"))
- return XMLDocument::createXHTML(frame, url);
+ return XMLDocument::createXHTML(sessionID, frame, url);
if (equalLettersIgnoringASCIICase(type, "text/plain"))
- return TextDocument::create(frame, url);
+ return TextDocument::create(sessionID, frame, url);
bool isImage = MIMETypeRegistry::isSupportedImageMIMEType(type);
if (frame && isImage && !MIMETypeRegistry::isPDFOrPostScriptMIMEType(type))
return ImageDocument::create(*frame, url);
@@ -160,16 +160,16 @@
parameters.type = ContentType { type };
parameters.url = ""
if (MediaPlayer::supportsType(parameters))
- return MediaDocument::create(frame, url);
+ return MediaDocument::create(sessionID, frame, url);
#endif
#if ENABLE(FTPDIR)
if (equalLettersIgnoringASCIICase(type, "application/x-ftp-directory"))
- return FTPDirectoryDocument::create(frame, url);
+ return FTPDirectoryDocument::create(sessionID, frame, url);
#endif
if (frame && frame->loader().client().shouldAlwaysUsePluginDocument(type))
- return PluginDocument::create(frame, url);
+ return PluginDocument::create(*frame, url);
// The following is the relatively costly lookup that requires initializing the plug-in database.
if (frame && frame->page()) {
@@ -176,7 +176,7 @@
auto allowedPluginTypes = frame->loader().subframeLoader().allowPlugins()
? PluginData::AllPlugins : PluginData::OnlyApplicationPlugins;
if (frame->page()->pluginData().supportsWebVisibleMimeType(type, allowedPluginTypes))
- return PluginDocument::create(frame, url);
+ return PluginDocument::create(*frame, url);
}
// Items listed here, after the plug-in checks, can be overridden by plug-ins.
@@ -184,12 +184,12 @@
if (frame && isImage)
return ImageDocument::create(*frame, url);
if (MIMETypeRegistry::isTextMIMEType(type))
- return TextDocument::create(frame, url);
+ return TextDocument::create(sessionID, frame, url);
if (equalLettersIgnoringASCIICase(type, "image/svg+xml"))
- return SVGDocument::create(frame, url);
+ return SVGDocument::create(sessionID, frame, url);
if (MIMETypeRegistry::isXMLMIMEType(type))
- return XMLDocument::create(frame, url);
- return HTMLDocument::create(frame, url);
+ return XMLDocument::create(sessionID, frame, url);
+ return HTMLDocument::create(sessionID, frame, url);
}
}
Modified: trunk/Source/WebCore/dom/DOMImplementation.h (248727 => 248728)
--- trunk/Source/WebCore/dom/DOMImplementation.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/dom/DOMImplementation.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -43,7 +43,7 @@
static bool hasFeature() { return true; }
WEBCORE_EXPORT static Ref<CSSStyleSheet> createCSSStyleSheet(const String& title, const String& media);
- static Ref<Document> createDocument(const String& MIMEType, Frame*, const URL&);
+ static Ref<Document> createDocument(PAL::SessionID, const String& MIMEType, Frame*, const URL&);
private:
Document& m_document;
Modified: trunk/Source/WebCore/dom/Document.cpp (248727 => 248728)
--- trunk/Source/WebCore/dom/Document.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/dom/Document.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -510,7 +510,7 @@
return 0;
}
-Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsigned constructionFlags)
+Document::Document(PAL::SessionID sessionID, Frame* frame, const URL& url, unsigned documentClasses, unsigned constructionFlags)
: ContainerNode(*this, CreateDocument)
, TreeScope(*this)
, FrameDestructionObserver(frame)
@@ -560,10 +560,12 @@
, m_isSynthesized(constructionFlags & Synthesized)
, m_isNonRenderedPlaceholder(constructionFlags & NonRenderedPlaceholder)
, m_orientationNotifier(currentOrientation(frame))
- , m_sessionID(PAL::SessionID::emptySessionID())
+ , m_sessionID(sessionID)
, m_identifier(DocumentIdentifier::generate())
, m_undoManager(UndoManager::create(*this))
{
+ ASSERT(!frame || frame->sessionID() == m_sessionID);
+
auto addResult = allDocumentsMap().add(m_identifier, this);
ASSERT_UNUSED(addResult, addResult.isNewEntry);
@@ -594,12 +596,17 @@
Ref<Document> Document::create(Document& contextDocument)
{
- auto document = adoptRef(*new Document(nullptr, URL()));
+ auto document = adoptRef(*new Document(contextDocument.sessionID(), nullptr, URL()));
document->setContextDocument(contextDocument);
document->setSecurityOriginPolicy(contextDocument.securityOriginPolicy());
return document;
}
+Ref<Document> Document::createNonRenderedPlaceholder(Frame& frame, const URL& url)
+{
+ return adoptRef(*new Document(frame.sessionID(), &frame, url, DefaultDocumentClass, NonRenderedPlaceholder));
+}
+
Document::~Document()
{
if (m_logger)
@@ -3870,10 +3877,10 @@
{
if (isXMLDocument()) {
if (isXHTMLDocument())
- return XMLDocument::createXHTML(nullptr, url());
- return XMLDocument::create(nullptr, url());
+ return XMLDocument::createXHTML(sessionID(), nullptr, url());
+ return XMLDocument::create(sessionID(), nullptr, url());
}
- return create(url());
+ return create(sessionID(), url());
}
void Document::cloneDataFromDocument(const Document& other)
@@ -6884,9 +6891,9 @@
return const_cast<Document&>(*document);
if (isHTMLDocument())
- m_templateDocument = HTMLDocument::create(nullptr, WTF::blankURL());
+ m_templateDocument = HTMLDocument::create(sessionID(), nullptr, WTF::blankURL());
else
- m_templateDocument = create(WTF::blankURL());
+ m_templateDocument = create(sessionID(), WTF::blankURL());
m_templateDocument->setContextDocument(contextDocument());
m_templateDocument->setTemplateDocumentHost(this); // balanced in dtor.
Modified: trunk/Source/WebCore/dom/Document.h (248727 => 248728)
--- trunk/Source/WebCore/dom/Document.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/dom/Document.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -350,7 +350,7 @@
, public Logger::Observer {
WTF_MAKE_ISO_ALLOCATED(Document);
public:
- static Ref<Document> create(const URL&);
+ static Ref<Document> create(PAL::SessionID, const URL&);
static Ref<Document> createNonRenderedPlaceholder(Frame&, const URL&);
static Ref<Document> create(Document&);
@@ -1531,7 +1531,7 @@
protected:
enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
- Document(Frame*, const URL&, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0);
+ Document(PAL::SessionID, Frame*, const URL&, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0);
void clearXMLVersion() { m_xmlVersion = String(); }
@@ -2075,16 +2075,11 @@
return existingAXObjectCacheSlow();
}
-inline Ref<Document> Document::create(const URL& url)
+inline Ref<Document> Document::create(PAL::SessionID sessionID, const URL& url)
{
- return adoptRef(*new Document(nullptr, url));
+ return adoptRef(*new Document(sessionID, nullptr, url));
}
-inline Ref<Document> Document::createNonRenderedPlaceholder(Frame& frame, const URL& url)
-{
- return adoptRef(*new Document(&frame, url, DefaultDocumentClass, NonRenderedPlaceholder));
-}
-
inline void Document::invalidateAccessKeyCache()
{
if (UNLIKELY(m_accessKeyCache))
Modified: trunk/Source/WebCore/dom/XMLDocument.h (248727 => 248728)
--- trunk/Source/WebCore/dom/XMLDocument.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/dom/XMLDocument.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -32,19 +32,19 @@
class XMLDocument : public Document {
WTF_MAKE_ISO_ALLOCATED(XMLDocument);
public:
- static Ref<XMLDocument> create(Frame* frame, const URL& url)
+ static Ref<XMLDocument> create(PAL::SessionID sessionID, Frame* frame, const URL& url)
{
- return adoptRef(*new XMLDocument(frame, url));
+ return adoptRef(*new XMLDocument(sessionID, frame, url));
}
- static Ref<XMLDocument> createXHTML(Frame* frame, const URL& url)
+ static Ref<XMLDocument> createXHTML(PAL::SessionID sessionID, Frame* frame, const URL& url)
{
- return adoptRef(*new XMLDocument(frame, url, XHTMLDocumentClass));
+ return adoptRef(*new XMLDocument(sessionID, frame, url, XHTMLDocumentClass));
}
protected:
- XMLDocument(Frame* frame, const URL& url, unsigned documentClasses = DefaultDocumentClass)
- : Document(frame, url, XMLDocumentClass | documentClasses)
+ XMLDocument(PAL::SessionID sessionID, Frame* frame, const URL& url, unsigned documentClasses = DefaultDocumentClass)
+ : Document(sessionID, frame, url, XMLDocumentClass | documentClasses)
{ }
};
Modified: trunk/Source/WebCore/html/FTPDirectoryDocument.cpp (248727 => 248728)
--- trunk/Source/WebCore/html/FTPDirectoryDocument.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/html/FTPDirectoryDocument.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -421,8 +421,8 @@
HTMLDocumentParser::finish();
}
-FTPDirectoryDocument::FTPDirectoryDocument(Frame* frame, const URL& url)
- : HTMLDocument(frame, url)
+FTPDirectoryDocument::FTPDirectoryDocument(PAL::SessionID sessionID, Frame* frame, const URL& url)
+ : HTMLDocument(sessionID, frame, url)
{
#if !LOG_DISABLED
LogFTP.state = WTFLogChannelState::On;
Modified: trunk/Source/WebCore/html/FTPDirectoryDocument.h (248727 => 248728)
--- trunk/Source/WebCore/html/FTPDirectoryDocument.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/html/FTPDirectoryDocument.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -31,13 +31,13 @@
class FTPDirectoryDocument final : public HTMLDocument {
WTF_MAKE_ISO_ALLOCATED(FTPDirectoryDocument);
public:
- static Ref<FTPDirectoryDocument> create(Frame* frame, const URL& url)
+ static Ref<FTPDirectoryDocument> create(PAL::SessionID sessionID, Frame* frame, const URL& url)
{
- return adoptRef(*new FTPDirectoryDocument(frame, url));
+ return adoptRef(*new FTPDirectoryDocument(sessionID, frame, url));
}
private:
- FTPDirectoryDocument(Frame*, const URL&);
+ FTPDirectoryDocument(PAL::SessionID, Frame*, const URL&);
Ref<DocumentParser> createParser() override;
};
Modified: trunk/Source/WebCore/html/HTMLDocument.cpp (248727 => 248728)
--- trunk/Source/WebCore/html/HTMLDocument.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/html/HTMLDocument.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -87,9 +87,14 @@
using namespace HTMLNames;
-HTMLDocument::HTMLDocument(Frame* frame, const URL& url, DocumentClassFlags documentClasses, unsigned constructionFlags)
- : Document(frame, url, documentClasses | HTMLDocumentClass, constructionFlags)
+Ref<HTMLDocument> HTMLDocument::createSynthesizedDocument(Frame& frame, const URL& url)
{
+ return adoptRef(*new HTMLDocument(frame.sessionID(), &frame, url, HTMLDocumentClass, Synthesized));
+}
+
+HTMLDocument::HTMLDocument(PAL::SessionID sessionID, Frame* frame, const URL& url, DocumentClassFlags documentClasses, unsigned constructionFlags)
+ : Document(sessionID, frame, url, documentClasses | HTMLDocumentClass, constructionFlags)
+{
clearXMLVersion();
}
@@ -247,7 +252,7 @@
Ref<Document> HTMLDocument::cloneDocumentWithoutChildren() const
{
- return create(nullptr, url());
+ return create(sessionID(), nullptr, url());
}
}
Modified: trunk/Source/WebCore/html/HTMLDocument.h (248727 => 248728)
--- trunk/Source/WebCore/html/HTMLDocument.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/html/HTMLDocument.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -29,7 +29,7 @@
class HTMLDocument : public Document {
WTF_MAKE_ISO_ALLOCATED(HTMLDocument);
public:
- static Ref<HTMLDocument> create(Frame*, const URL&);
+ static Ref<HTMLDocument> create(PAL::SessionID, Frame*, const URL&);
static Ref<HTMLDocument> createSynthesizedDocument(Frame&, const URL&);
virtual ~HTMLDocument();
@@ -54,7 +54,7 @@
static bool isCaseSensitiveAttribute(const QualifiedName&);
protected:
- HTMLDocument(Frame*, const URL&, DocumentClassFlags = 0, unsigned constructionFlags = 0);
+ HTMLDocument(PAL::SessionID, Frame*, const URL&, DocumentClassFlags = 0, unsigned constructionFlags = 0);
private:
bool isFrameSet() const final;
@@ -65,16 +65,11 @@
TreeScopeOrderedMap m_windowNamedItem;
};
-inline Ref<HTMLDocument> HTMLDocument::create(Frame* frame, const URL& url)
+inline Ref<HTMLDocument> HTMLDocument::create(PAL::SessionID sessionID, Frame* frame, const URL& url)
{
- return adoptRef(*new HTMLDocument(frame, url, HTMLDocumentClass));
+ return adoptRef(*new HTMLDocument(sessionID, frame, url, HTMLDocumentClass));
}
-inline Ref<HTMLDocument> HTMLDocument::createSynthesizedDocument(Frame& frame, const URL& url)
-{
- return adoptRef(*new HTMLDocument(&frame, url, HTMLDocumentClass, Synthesized));
-}
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLDocument)
Modified: trunk/Source/WebCore/html/ImageDocument.cpp (248727 => 248728)
--- trunk/Source/WebCore/html/ImageDocument.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/html/ImageDocument.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -198,7 +198,7 @@
}
ImageDocument::ImageDocument(Frame& frame, const URL& url)
- : HTMLDocument(&frame, url, ImageDocumentClass)
+ : HTMLDocument(frame.sessionID(), &frame, url, ImageDocumentClass)
, m_imageElement(nullptr)
, m_imageSizeIsKnown(false)
#if !PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebCore/html/MediaDocument.cpp (248727 => 248728)
--- trunk/Source/WebCore/html/MediaDocument.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/html/MediaDocument.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -144,8 +144,8 @@
finish();
}
-MediaDocument::MediaDocument(Frame* frame, const URL& url)
- : HTMLDocument(frame, url, MediaDocumentClass)
+MediaDocument::MediaDocument(PAL::SessionID sessionID, Frame* frame, const URL& url)
+ : HTMLDocument(sessionID, frame, url, MediaDocumentClass)
, m_replaceMediaElementTimer(*this, &MediaDocument::replaceMediaElementTimerFired)
{
setCompatibilityMode(DocumentCompatibilityMode::QuirksMode);
Modified: trunk/Source/WebCore/html/MediaDocument.h (248727 => 248728)
--- trunk/Source/WebCore/html/MediaDocument.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/html/MediaDocument.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -34,9 +34,9 @@
class MediaDocument final : public HTMLDocument {
WTF_MAKE_ISO_ALLOCATED(MediaDocument);
public:
- static Ref<MediaDocument> create(Frame* frame, const URL& url)
+ static Ref<MediaDocument> create(PAL::SessionID sessionID, Frame* frame, const URL& url)
{
- return adoptRef(*new MediaDocument(frame, url));
+ return adoptRef(*new MediaDocument(sessionID, frame, url));
}
virtual ~MediaDocument();
@@ -45,7 +45,7 @@
String outgoingReferrer() const { return m_outgoingReferrer; }
private:
- MediaDocument(Frame*, const URL&);
+ MediaDocument(PAL::SessionID, Frame*, const URL&);
Ref<DocumentParser> createParser() override;
Modified: trunk/Source/WebCore/html/PluginDocument.cpp (248727 => 248728)
--- trunk/Source/WebCore/html/PluginDocument.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/html/PluginDocument.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -141,8 +141,8 @@
}
}
-PluginDocument::PluginDocument(Frame* frame, const URL& url)
- : HTMLDocument(frame, url, PluginDocumentClass)
+PluginDocument::PluginDocument(Frame& frame, const URL& url)
+ : HTMLDocument(frame.sessionID(), &frame, url, PluginDocumentClass)
{
setCompatibilityMode(DocumentCompatibilityMode::QuirksMode);
lockCompatibilityMode();
Modified: trunk/Source/WebCore/html/PluginDocument.h (248727 => 248728)
--- trunk/Source/WebCore/html/PluginDocument.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/html/PluginDocument.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -34,7 +34,7 @@
class PluginDocument final : public HTMLDocument {
WTF_MAKE_ISO_ALLOCATED(PluginDocument);
public:
- static Ref<PluginDocument> create(Frame* frame, const URL& url)
+ static Ref<PluginDocument> create(Frame& frame, const URL& url)
{
return adoptRef(*new PluginDocument(frame, url));
}
@@ -50,7 +50,7 @@
bool shouldLoadPluginManually() const { return m_shouldLoadPluginManually; }
private:
- PluginDocument(Frame*, const URL&);
+ PluginDocument(Frame&, const URL&);
Ref<DocumentParser> createParser() final;
Modified: trunk/Source/WebCore/html/TextDocument.cpp (248727 => 248728)
--- trunk/Source/WebCore/html/TextDocument.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/html/TextDocument.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -32,8 +32,8 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(TextDocument);
-TextDocument::TextDocument(Frame* frame, const URL& url)
- : HTMLDocument(frame, url, TextDocumentClass)
+TextDocument::TextDocument(PAL::SessionID sessionID, Frame* frame, const URL& url)
+ : HTMLDocument(sessionID, frame, url, TextDocumentClass)
{
setCompatibilityMode(DocumentCompatibilityMode::QuirksMode);
lockCompatibilityMode();
Modified: trunk/Source/WebCore/html/TextDocument.h (248727 => 248728)
--- trunk/Source/WebCore/html/TextDocument.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/html/TextDocument.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -31,13 +31,13 @@
class TextDocument final : public HTMLDocument {
WTF_MAKE_ISO_ALLOCATED(TextDocument);
public:
- static Ref<TextDocument> create(Frame* frame, const URL& url)
+ static Ref<TextDocument> create(PAL::SessionID sessionID, Frame* frame, const URL& url)
{
- return adoptRef(*new TextDocument(frame, url));
+ return adoptRef(*new TextDocument(sessionID, frame, url));
}
private:
- TextDocument(Frame*, const URL&);
+ TextDocument(PAL::SessionID, Frame*, const URL&);
Ref<DocumentParser> createParser() override;
};
Modified: trunk/Source/WebCore/inspector/DOMPatchSupport.cpp (248727 => 248728)
--- trunk/Source/WebCore/inspector/DOMPatchSupport.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/inspector/DOMPatchSupport.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -76,11 +76,11 @@
{
RefPtr<Document> newDocument;
if (m_document.isHTMLDocument())
- newDocument = HTMLDocument::create(nullptr, URL());
+ newDocument = HTMLDocument::create(m_document.sessionID(), nullptr, URL());
else if (m_document.isXHTMLDocument())
- newDocument = XMLDocument::createXHTML(nullptr, URL());
+ newDocument = XMLDocument::createXHTML(m_document.sessionID(), nullptr, URL());
else if (m_document.isSVGDocument())
- newDocument = XMLDocument::create(nullptr, URL());
+ newDocument = XMLDocument::create(m_document.sessionID(), nullptr, URL());
ASSERT(newDocument);
RefPtr<DocumentParser> parser;
Modified: trunk/Source/WebCore/loader/DocumentWriter.cpp (248727 => 248728)
--- trunk/Source/WebCore/loader/DocumentWriter.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/loader/DocumentWriter.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -108,14 +108,14 @@
Ref<Document> DocumentWriter::createDocument(const URL& url)
{
if (!m_frame->loader().stateMachine().isDisplayingInitialEmptyDocument() && m_frame->loader().client().shouldAlwaysUsePluginDocument(m_mimeType))
- return PluginDocument::create(m_frame, url);
+ return PluginDocument::create(*m_frame, url);
#if PLATFORM(IOS_FAMILY)
if (MIMETypeRegistry::isPDFMIMEType(m_mimeType) && (m_frame->isMainFrame() || !m_frame->settings().useImageDocumentForSubframePDF()))
- return SinkDocument::create(m_frame, url);
+ return SinkDocument::create(*m_frame, url);
#endif
if (!m_frame->loader().client().hasHTMLView())
return Document::createNonRenderedPlaceholder(*m_frame, url);
- return DOMImplementation::createDocument(m_mimeType, m_frame, url);
+ return DOMImplementation::createDocument(m_frame->sessionID(), m_mimeType, m_frame, url);
}
bool DocumentWriter::begin(const URL& urlReference, bool dispatch, Document* ownerDocument)
@@ -132,7 +132,7 @@
// If the new document is for a Plugin but we're supposed to be sandboxed from Plugins,
// then replace the document with one whose parser will ignore the incoming data (bug 39323)
if (document->isPluginDocument() && document->isSandboxed(SandboxPlugins))
- document = SinkDocument::create(m_frame, url);
+ document = SinkDocument::create(*m_frame, url);
// FIXME: Do we need to consult the content security policy here about blocked plug-ins?
Modified: trunk/Source/WebCore/loader/SinkDocument.cpp (248727 => 248728)
--- trunk/Source/WebCore/loader/SinkDocument.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/loader/SinkDocument.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -52,8 +52,8 @@
}
};
-SinkDocument::SinkDocument(Frame* frame, const URL& url)
- : HTMLDocument(frame, url)
+SinkDocument::SinkDocument(Frame& frame, const URL& url)
+ : HTMLDocument(frame.sessionID(), &frame, url)
{
setCompatibilityMode(DocumentCompatibilityMode::QuirksMode);
lockCompatibilityMode();
Modified: trunk/Source/WebCore/loader/SinkDocument.h (248727 => 248728)
--- trunk/Source/WebCore/loader/SinkDocument.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/loader/SinkDocument.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -32,13 +32,13 @@
class SinkDocument final : public HTMLDocument {
WTF_MAKE_ISO_ALLOCATED(SinkDocument);
public:
- static Ref<SinkDocument> create(Frame* frame, const URL& url)
+ static Ref<SinkDocument> create(Frame& frame, const URL& url)
{
return adoptRef(*new SinkDocument(frame, url));
}
private:
- SinkDocument(Frame*, const URL&);
+ SinkDocument(Frame&, const URL&);
Ref<DocumentParser> createParser() final;
};
Modified: trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp (248727 => 248728)
--- trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -49,7 +49,7 @@
{
if (data) {
// We don't need to create a new frame because the new document belongs to the parent UseElement.
- m_document = SVGDocument::create(nullptr, response().url());
+ m_document = SVGDocument::create(sessionID(), nullptr, response().url());
m_document->setContent(m_decoder->decodeAndFlush(data->data(), data->size()));
}
CachedResource::finishLoading(data);
Modified: trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp (248727 => 248728)
--- trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -72,7 +72,7 @@
{
// We may get here during render tree updates when events are forbidden.
// Frameless document can't run scripts or call back to the client so this is safe.
- m_externalSVGDocument = SVGDocument::create(nullptr, URL());
+ m_externalSVGDocument = SVGDocument::create(sessionID(), nullptr, URL());
auto decoder = TextResourceDecoder::create("application/xml");
ScriptDisallowedScope::DisableAssertionsInScope disabledScope;
Modified: trunk/Source/WebCore/page/Frame.cpp (248727 => 248728)
--- trunk/Source/WebCore/page/Frame.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/page/Frame.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -1013,4 +1013,9 @@
deref();
}
+PAL::SessionID Frame::sessionID() const
+{
+ return m_loader->client().sessionID();
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/page/Frame.h (248727 => 248728)
--- trunk/Source/WebCore/page/Frame.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/page/Frame.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -57,6 +57,10 @@
class RegularExpression;
} }
+namespace PAL {
+class SessionID;
+}
+
namespace WebCore {
class CSSAnimationController;
@@ -297,6 +301,8 @@
void selfOnlyRef();
void selfOnlyDeref();
+ PAL::SessionID sessionID() const;
+
private:
friend class NavigationDisabler;
Modified: trunk/Source/WebCore/svg/SVGDocument.cpp (248727 => 248728)
--- trunk/Source/WebCore/svg/SVGDocument.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/svg/SVGDocument.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -30,8 +30,8 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(SVGDocument);
-SVGDocument::SVGDocument(Frame* frame, const URL& url)
- : XMLDocument(frame, url, SVGDocumentClass)
+SVGDocument::SVGDocument(PAL::SessionID sessionID, Frame* frame, const URL& url)
+ : XMLDocument(sessionID, frame, url, SVGDocumentClass)
{
}
@@ -69,7 +69,7 @@
Ref<Document> SVGDocument::cloneDocumentWithoutChildren() const
{
- return create(nullptr, url());
+ return create(sessionID(), nullptr, url());
}
}
Modified: trunk/Source/WebCore/svg/SVGDocument.h (248727 => 248728)
--- trunk/Source/WebCore/svg/SVGDocument.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/svg/SVGDocument.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -30,7 +30,7 @@
class SVGDocument final : public XMLDocument {
WTF_MAKE_ISO_ALLOCATED(SVGDocument);
public:
- static Ref<SVGDocument> create(Frame*, const URL&);
+ static Ref<SVGDocument> create(PAL::SessionID, Frame*, const URL&);
static RefPtr<SVGSVGElement> rootElement(const Document&);
@@ -39,7 +39,7 @@
void updatePan(const FloatPoint& position) const;
private:
- SVGDocument(Frame*, const URL&);
+ SVGDocument(PAL::SessionID, Frame*, const URL&);
Ref<Document> cloneDocumentWithoutChildren() const override;
@@ -46,9 +46,9 @@
FloatSize m_panningOffset;
};
-inline Ref<SVGDocument> SVGDocument::create(Frame* frame, const URL& url)
+inline Ref<SVGDocument> SVGDocument::create(PAL::SessionID sessionID, Frame* frame, const URL& url)
{
- return adoptRef(*new SVGDocument(frame, url));
+ return adoptRef(*new SVGDocument(sessionID, frame, url));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/xml/DOMParser.cpp (248727 => 248728)
--- trunk/Source/WebCore/xml/DOMParser.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/xml/DOMParser.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -34,11 +34,11 @@
return adoptRef(*new DOMParser(contextDocument));
}
-ExceptionOr<Ref<Document>> DOMParser::parseFromString(const String& string, const String& contentType)
+ExceptionOr<Ref<Document>> DOMParser::parseFromString(ScriptExecutionContext& context, const String& string, const String& contentType)
{
if (contentType != "text/html" && contentType != "text/xml" && contentType != "application/xml" && contentType != "application/xhtml+xml" && contentType != "image/svg+xml")
return Exception { TypeError };
- auto document = DOMImplementation::createDocument(contentType, nullptr, URL { });
+ auto document = DOMImplementation::createDocument(context.sessionID(), contentType, nullptr, URL { });
if (m_contextDocument)
document->setContextDocument(*m_contextDocument.get());
document->setContent(string);
Modified: trunk/Source/WebCore/xml/DOMParser.h (248727 => 248728)
--- trunk/Source/WebCore/xml/DOMParser.h 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/xml/DOMParser.h 2019-08-15 17:44:07 UTC (rev 248728)
@@ -24,11 +24,12 @@
namespace WebCore {
class Document;
+class ScriptExecutionContext;
class DOMParser : public RefCounted<DOMParser> {
public:
static Ref<DOMParser> create(Document& contextDocument);
- ExceptionOr<Ref<Document>> parseFromString(const String&, const String& contentType);
+ ExceptionOr<Ref<Document>> parseFromString(ScriptExecutionContext&, const String&, const String& contentType);
private:
explicit DOMParser(Document& contextDocument);
Modified: trunk/Source/WebCore/xml/DOMParser.idl (248727 => 248728)
--- trunk/Source/WebCore/xml/DOMParser.idl 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/xml/DOMParser.idl 2019-08-15 17:44:07 UTC (rev 248728)
@@ -22,5 +22,5 @@
ConstructorCallWith=Document,
ImplementationLacksVTable,
] interface DOMParser {
- [MayThrowException, NewObject] Document parseFromString(DOMString string, DOMString contentType);
+ [MayThrowException, NewObject, CallWith=ScriptExecutionContext] Document parseFromString(DOMString string, DOMString contentType);
};
Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (248727 => 248728)
--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -173,6 +173,8 @@
return nullptr;
if (!m_createdDocument) {
+ auto& context = *scriptExecutionContext();
+
String mimeType = responseMIMEType();
bool isHTML = equalLettersIgnoringASCIICase(mimeType, "text/html");
@@ -183,13 +185,13 @@
m_responseDocument = nullptr;
} else {
if (isHTML)
- m_responseDocument = HTMLDocument::create(nullptr, m_url);
+ m_responseDocument = HTMLDocument::create(context.sessionID(), nullptr, m_url);
else
- m_responseDocument = XMLDocument::create(nullptr, m_url);
+ m_responseDocument = XMLDocument::create(context.sessionID(), nullptr, m_url);
m_responseDocument->overrideLastModified(m_response.lastModified());
m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity());
- m_responseDocument->setContextDocument(downcast<Document>(*scriptExecutionContext()));
- m_responseDocument->setSecurityOriginPolicy(scriptExecutionContext()->securityOriginPolicy());
+ m_responseDocument->setContextDocument(downcast<Document>(context));
+ m_responseDocument->setSecurityOriginPolicy(context.securityOriginPolicy());
m_responseDocument->overrideMIMEType(mimeType);
if (!m_responseDocument->wellFormed())
Modified: trunk/Source/WebCore/xml/XSLTProcessor.cpp (248727 => 248728)
--- trunk/Source/WebCore/xml/XSLTProcessor.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebCore/xml/XSLTProcessor.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -72,10 +72,10 @@
RefPtr<Document> result;
if (sourceMIMEType == "text/plain") {
- result = XMLDocument::createXHTML(frame, sourceIsDocument ? ownerDocument->url() : URL());
+ result = XMLDocument::createXHTML(ownerDocument->sessionID(), frame, sourceIsDocument ? ownerDocument->url() : URL());
transformTextStringToXHTMLDocumentString(documentSource);
} else
- result = DOMImplementation::createDocument(sourceMIMEType, frame, sourceIsDocument ? ownerDocument->url() : URL());
+ result = DOMImplementation::createDocument(ownerDocument->sessionID(), sourceMIMEType, frame, sourceIsDocument ? ownerDocument->url() : URL());
// Before parsing, we need to save & detach the old document and get the new document
// in place. We have to do this only if we're rendering the result document.
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (248727 => 248728)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2019-08-15 17:44:07 UTC (rev 248728)
@@ -1,3 +1,18 @@
+2019-08-15 Youenn Fablet <[email protected]>
+
+ Always create a Document with a valid SessionID
+ https://bugs.webkit.org/show_bug.cgi?id=200727
+
+ Reviewed by Alex Christensen.
+
+ Implement WebKit1 sessionID getter like done for WebKit2.
+ Either the loader client has a page in which case the page session ID is used
+ or the client has no page, in which case the default session ID is used.
+ This is the same behavior as CachedResourceLoader.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::sessionID const):
+
2019-08-15 Simon Fraser <[email protected]>
Use ObjectIdentifier<FrameIdentifierType> for frameIDs
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (248727 => 248728)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2019-08-15 17:44:07 UTC (rev 248728)
@@ -221,8 +221,8 @@
PAL::SessionID WebFrameLoaderClient::sessionID() const
{
- RELEASE_ASSERT_NOT_REACHED();
- return PAL::SessionID::defaultSessionID();
+ auto* coreFrame = core(m_webFrame.get());
+ return coreFrame && coreFrame->page() ? coreFrame->page()->sessionID() : PAL::SessionID::defaultSessionID();
}
void WebFrameLoaderClient::frameLoaderDestroyed()
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (248727 => 248728)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2019-08-15 17:44:07 UTC (rev 248728)
@@ -1,3 +1,18 @@
+2019-08-15 Youenn Fablet <[email protected]>
+
+ Always create a Document with a valid SessionID
+ https://bugs.webkit.org/show_bug.cgi?id=200727
+
+ Reviewed by Alex Christensen.
+
+ Implement WebKit1 sessionID getter like done for WebKit2.
+ Either the loader client has a page in which case the page session ID is used
+ or the client has no page, in which case the default session ID is used.
+ This is the same behavior as CachedResourceLoader.
+
+ * WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebFrameLoaderClient::sessionID const):
+
2019-08-14 Ryan Haddad <[email protected]>
Unreviewed, rolling out r248526.
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp (248727 => 248728)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2019-08-15 17:35:02 UTC (rev 248727)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2019-08-15 17:44:07 UTC (rev 248728)
@@ -134,8 +134,8 @@
PAL::SessionID WebFrameLoaderClient::sessionID() const
{
- RELEASE_ASSERT_NOT_REACHED();
- return PAL::SessionID::defaultSessionID();
+ auto* coreFrame = core(m_webFrame);
+ return coreFrame && coreFrame->page() ? coreFrame->page()->sessionID() : PAL::SessionID::defaultSessionID();
}
bool WebFrameLoaderClient::hasWebView() const