Changeset 248728 in webkit
- Timestamp:
- Aug 15, 2019 10:44:07 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r248722 r248728 1 2019-08-15 Youenn Fablet <youenn@apple.com> 2 3 Always create a Document with a valid SessionID 4 https://bugs.webkit.org/show_bug.cgi?id=200727 5 6 Reviewed by Alex Christensen. 7 8 Pass a valid SessionID to the Document constructor. 9 This allows getting us closer to use SessionID like ObjectIdentifier. 10 Add a SessionID getter from Frame and use it when constructing a Document. 11 Otherwise, retrieve the SessionID from the corresponding context. 12 No change of behavior. 13 14 * dom/DOMImplementation.cpp: 15 (WebCore::createXMLDocument): 16 (WebCore::DOMImplementation::createDocument): 17 (WebCore::DOMImplementation::createHTMLDocument): 18 * dom/DOMImplementation.h: 19 * dom/Document.cpp: 20 (WebCore::Document::Document): 21 (WebCore::m_undoManager): 22 (WebCore::Document::create): 23 (WebCore::Document::createNonRenderedPlaceholder): 24 (WebCore::Document::cloneDocumentWithoutChildren const): 25 (WebCore::Document::ensureTemplateDocument): 26 * dom/Document.h: 27 (WebCore::Document::create): 28 (WebCore::Document::createNonRenderedPlaceholder): Deleted. 29 * dom/XMLDocument.h: 30 (WebCore::XMLDocument::create): 31 (WebCore::XMLDocument::createXHTML): 32 (WebCore::XMLDocument::XMLDocument): 33 * html/FTPDirectoryDocument.cpp: 34 (WebCore::FTPDirectoryDocument::FTPDirectoryDocument): 35 * html/FTPDirectoryDocument.h: 36 * html/HTMLDocument.cpp: 37 (WebCore::HTMLDocument::createSynthesizedDocument): 38 (WebCore::HTMLDocument::HTMLDocument): 39 (WebCore::HTMLDocument::cloneDocumentWithoutChildren const): 40 * html/HTMLDocument.h: 41 (WebCore::HTMLDocument::create): 42 (WebCore::HTMLDocument::createSynthesizedDocument): Deleted. 43 * html/ImageDocument.cpp: 44 (WebCore::ImageDocument::ImageDocument): 45 * html/MediaDocument.cpp: 46 (WebCore::MediaDocument::MediaDocument): 47 * html/MediaDocument.h: 48 * html/PluginDocument.cpp: 49 (WebCore::PluginDocument::PluginDocument): 50 * html/PluginDocument.h: 51 * html/TextDocument.cpp: 52 (WebCore::TextDocument::TextDocument): 53 * html/TextDocument.h: 54 * inspector/DOMPatchSupport.cpp: 55 (WebCore::DOMPatchSupport::patchDocument): 56 * loader/DocumentWriter.cpp: 57 (WebCore::DocumentWriter::createDocument): 58 (WebCore::DocumentWriter::begin): 59 * loader/SinkDocument.cpp: 60 (WebCore::SinkDocument::SinkDocument): 61 * loader/SinkDocument.h: 62 * loader/cache/CachedSVGDocument.cpp: 63 (WebCore::CachedSVGDocument::finishLoading): 64 * loader/cache/CachedSVGFont.cpp: 65 (WebCore::CachedSVGFont::ensureCustomFontData): 66 * page/Frame.cpp: 67 (WebCore::Frame::sessionID const): 68 * page/Frame.h: 69 * svg/SVGDocument.cpp: 70 (WebCore::SVGDocument::SVGDocument): 71 (WebCore::SVGDocument::cloneDocumentWithoutChildren const): 72 * svg/SVGDocument.h: 73 (WebCore::SVGDocument::create): 74 * xml/DOMParser.cpp: 75 (WebCore::DOMParser::parseFromString): 76 * xml/DOMParser.h: 77 * xml/DOMParser.idl: 78 * xml/XMLHttpRequest.cpp: 79 * xml/XSLTProcessor.cpp: 80 (WebCore::XSLTProcessor::createDocumentFromSource): 81 1 82 2019-08-15 Antti Koivisto <antti@apple.com> 2 83 -
trunk/Source/WebCore/dom/DOMImplementation.cpp
r243887 r248728 78 78 } 79 79 80 static inline Ref<XMLDocument> createXMLDocument( const String& namespaceURI)80 static inline Ref<XMLDocument> createXMLDocument(PAL::SessionID sessionID, const String& namespaceURI) 81 81 { 82 82 if (namespaceURI == SVGNames::svgNamespaceURI) 83 return SVGDocument::create( nullptr, URL());83 return SVGDocument::create(sessionID, nullptr, URL()); 84 84 if (namespaceURI == HTMLNames::xhtmlNamespaceURI) 85 return XMLDocument::createXHTML( nullptr, URL());86 return XMLDocument::create( nullptr, URL());85 return XMLDocument::createXHTML(sessionID, nullptr, URL()); 86 return XMLDocument::create(sessionID, nullptr, URL()); 87 87 } 88 88 89 89 ExceptionOr<Ref<XMLDocument>> DOMImplementation::createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType* documentType) 90 90 { 91 auto document = createXMLDocument( namespaceURI);91 auto document = createXMLDocument(m_document.sessionID(), namespaceURI); 92 92 document->setContextDocument(m_document.contextDocument()); 93 93 document->setSecurityOriginPolicy(m_document.securityOriginPolicy()); … … 121 121 Ref<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title) 122 122 { 123 auto document = HTMLDocument::create( nullptr, URL());123 auto document = HTMLDocument::create(m_document.sessionID(), nullptr, URL()); 124 124 document->open(); 125 125 document->write(nullptr, { "<!doctype html><html><head></head><body></body></html>"_s }); … … 135 135 } 136 136 137 Ref<Document> DOMImplementation::createDocument( const String& type, Frame* frame, const URL& url)137 Ref<Document> DOMImplementation::createDocument(PAL::SessionID sessionID, const String& type, Frame* frame, const URL& url) 138 138 { 139 139 // FIXME: Inelegant to have this here just because this is the home of DOM APIs for creating documents. … … 143 143 // Plug-ins cannot take over for HTML, XHTML, plain text, or non-PDF images. 144 144 if (equalLettersIgnoringASCIICase(type, "text/html")) 145 return HTMLDocument::create( frame, url);145 return HTMLDocument::create(sessionID, frame, url); 146 146 if (equalLettersIgnoringASCIICase(type, "application/xhtml+xml")) 147 return XMLDocument::createXHTML( frame, url);147 return XMLDocument::createXHTML(sessionID, frame, url); 148 148 if (equalLettersIgnoringASCIICase(type, "text/plain")) 149 return TextDocument::create( frame, url);149 return TextDocument::create(sessionID, frame, url); 150 150 bool isImage = MIMETypeRegistry::isSupportedImageMIMEType(type); 151 151 if (frame && isImage && !MIMETypeRegistry::isPDFOrPostScriptMIMEType(type)) … … 161 161 parameters.url = url; 162 162 if (MediaPlayer::supportsType(parameters)) 163 return MediaDocument::create( frame, url);163 return MediaDocument::create(sessionID, frame, url); 164 164 #endif 165 165 166 166 #if ENABLE(FTPDIR) 167 167 if (equalLettersIgnoringASCIICase(type, "application/x-ftp-directory")) 168 return FTPDirectoryDocument::create( frame, url);168 return FTPDirectoryDocument::create(sessionID, frame, url); 169 169 #endif 170 170 171 171 if (frame && frame->loader().client().shouldAlwaysUsePluginDocument(type)) 172 return PluginDocument::create( frame, url);172 return PluginDocument::create(*frame, url); 173 173 174 174 // The following is the relatively costly lookup that requires initializing the plug-in database. … … 177 177 ? PluginData::AllPlugins : PluginData::OnlyApplicationPlugins; 178 178 if (frame->page()->pluginData().supportsWebVisibleMimeType(type, allowedPluginTypes)) 179 return PluginDocument::create( frame, url);179 return PluginDocument::create(*frame, url); 180 180 } 181 181 … … 185 185 return ImageDocument::create(*frame, url); 186 186 if (MIMETypeRegistry::isTextMIMEType(type)) 187 return TextDocument::create( frame, url);187 return TextDocument::create(sessionID, frame, url); 188 188 if (equalLettersIgnoringASCIICase(type, "image/svg+xml")) 189 return SVGDocument::create( frame, url);189 return SVGDocument::create(sessionID, frame, url); 190 190 if (MIMETypeRegistry::isXMLMIMEType(type)) 191 return XMLDocument::create( frame, url);192 return HTMLDocument::create( frame, url);191 return XMLDocument::create(sessionID, frame, url); 192 return HTMLDocument::create(sessionID, frame, url); 193 193 } 194 194 -
trunk/Source/WebCore/dom/DOMImplementation.h
r243887 r248728 44 44 WEBCORE_EXPORT static Ref<CSSStyleSheet> createCSSStyleSheet(const String& title, const String& media); 45 45 46 static Ref<Document> createDocument( const String& MIMEType, Frame*, const URL&);46 static Ref<Document> createDocument(PAL::SessionID, const String& MIMEType, Frame*, const URL&); 47 47 48 48 private: -
trunk/Source/WebCore/dom/Document.cpp
r248668 r248728 511 511 } 512 512 513 Document::Document( Frame* frame, const URL& url, unsigned documentClasses, unsigned constructionFlags)513 Document::Document(PAL::SessionID sessionID, Frame* frame, const URL& url, unsigned documentClasses, unsigned constructionFlags) 514 514 : ContainerNode(*this, CreateDocument) 515 515 , TreeScope(*this) … … 561 561 , m_isNonRenderedPlaceholder(constructionFlags & NonRenderedPlaceholder) 562 562 , m_orientationNotifier(currentOrientation(frame)) 563 , m_sessionID( PAL::SessionID::emptySessionID())563 , m_sessionID(sessionID) 564 564 , m_identifier(DocumentIdentifier::generate()) 565 565 , m_undoManager(UndoManager::create(*this)) 566 566 { 567 ASSERT(!frame || frame->sessionID() == m_sessionID); 568 567 569 auto addResult = allDocumentsMap().add(m_identifier, this); 568 570 ASSERT_UNUSED(addResult, addResult.isNewEntry); … … 595 597 Ref<Document> Document::create(Document& contextDocument) 596 598 { 597 auto document = adoptRef(*new Document( nullptr, URL()));599 auto document = adoptRef(*new Document(contextDocument.sessionID(), nullptr, URL())); 598 600 document->setContextDocument(contextDocument); 599 601 document->setSecurityOriginPolicy(contextDocument.securityOriginPolicy()); 600 602 return document; 603 } 604 605 Ref<Document> Document::createNonRenderedPlaceholder(Frame& frame, const URL& url) 606 { 607 return adoptRef(*new Document(frame.sessionID(), &frame, url, DefaultDocumentClass, NonRenderedPlaceholder)); 601 608 } 602 609 … … 3871 3878 if (isXMLDocument()) { 3872 3879 if (isXHTMLDocument()) 3873 return XMLDocument::createXHTML( nullptr, url());3874 return XMLDocument::create( nullptr, url());3875 } 3876 return create( url());3880 return XMLDocument::createXHTML(sessionID(), nullptr, url()); 3881 return XMLDocument::create(sessionID(), nullptr, url()); 3882 } 3883 return create(sessionID(), url()); 3877 3884 } 3878 3885 … … 6885 6892 6886 6893 if (isHTMLDocument()) 6887 m_templateDocument = HTMLDocument::create( nullptr, WTF::blankURL());6894 m_templateDocument = HTMLDocument::create(sessionID(), nullptr, WTF::blankURL()); 6888 6895 else 6889 m_templateDocument = create( WTF::blankURL());6896 m_templateDocument = create(sessionID(), WTF::blankURL()); 6890 6897 6891 6898 m_templateDocument->setContextDocument(contextDocument()); -
trunk/Source/WebCore/dom/Document.h
r248667 r248728 351 351 WTF_MAKE_ISO_ALLOCATED(Document); 352 352 public: 353 static Ref<Document> create( const URL&);353 static Ref<Document> create(PAL::SessionID, const URL&); 354 354 static Ref<Document> createNonRenderedPlaceholder(Frame&, const URL&); 355 355 static Ref<Document> create(Document&); … … 1532 1532 protected: 1533 1533 enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 }; 1534 Document( Frame*, const URL&, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0);1534 Document(PAL::SessionID, Frame*, const URL&, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0); 1535 1535 1536 1536 void clearXMLVersion() { m_xmlVersion = String(); } … … 2076 2076 } 2077 2077 2078 inline Ref<Document> Document::create( const URL& url)2078 inline Ref<Document> Document::create(PAL::SessionID sessionID, const URL& url) 2079 2079 { 2080 return adoptRef(*new Document(nullptr, url)); 2081 } 2082 2083 inline Ref<Document> Document::createNonRenderedPlaceholder(Frame& frame, const URL& url) 2084 { 2085 return adoptRef(*new Document(&frame, url, DefaultDocumentClass, NonRenderedPlaceholder)); 2080 return adoptRef(*new Document(sessionID, nullptr, url)); 2086 2081 } 2087 2082 -
trunk/Source/WebCore/dom/XMLDocument.h
r229694 r248728 33 33 WTF_MAKE_ISO_ALLOCATED(XMLDocument); 34 34 public: 35 static Ref<XMLDocument> create( Frame* frame, const URL& url)35 static Ref<XMLDocument> create(PAL::SessionID sessionID, Frame* frame, const URL& url) 36 36 { 37 return adoptRef(*new XMLDocument( frame, url));37 return adoptRef(*new XMLDocument(sessionID, frame, url)); 38 38 } 39 39 40 static Ref<XMLDocument> createXHTML( Frame* frame, const URL& url)40 static Ref<XMLDocument> createXHTML(PAL::SessionID sessionID, Frame* frame, const URL& url) 41 41 { 42 return adoptRef(*new XMLDocument( frame, url, XHTMLDocumentClass));42 return adoptRef(*new XMLDocument(sessionID, frame, url, XHTMLDocumentClass)); 43 43 } 44 44 45 45 protected: 46 XMLDocument( Frame* frame, const URL& url, unsigned documentClasses = DefaultDocumentClass)47 : Document( frame, url, XMLDocumentClass | documentClasses)46 XMLDocument(PAL::SessionID sessionID, Frame* frame, const URL& url, unsigned documentClasses = DefaultDocumentClass) 47 : Document(sessionID, frame, url, XMLDocumentClass | documentClasses) 48 48 { } 49 49 }; -
trunk/Source/WebCore/html/FTPDirectoryDocument.cpp
r246490 r248728 422 422 } 423 423 424 FTPDirectoryDocument::FTPDirectoryDocument( Frame* frame, const URL& url)425 : HTMLDocument( frame, url)424 FTPDirectoryDocument::FTPDirectoryDocument(PAL::SessionID sessionID, Frame* frame, const URL& url) 425 : HTMLDocument(sessionID, frame, url) 426 426 { 427 427 #if !LOG_DISABLED -
trunk/Source/WebCore/html/FTPDirectoryDocument.h
r229694 r248728 32 32 WTF_MAKE_ISO_ALLOCATED(FTPDirectoryDocument); 33 33 public: 34 static Ref<FTPDirectoryDocument> create( Frame* frame, const URL& url)34 static Ref<FTPDirectoryDocument> create(PAL::SessionID sessionID, Frame* frame, const URL& url) 35 35 { 36 return adoptRef(*new FTPDirectoryDocument( frame, url));36 return adoptRef(*new FTPDirectoryDocument(sessionID, frame, url)); 37 37 } 38 38 39 39 private: 40 FTPDirectoryDocument( Frame*, const URL&);40 FTPDirectoryDocument(PAL::SessionID, Frame*, const URL&); 41 41 Ref<DocumentParser> createParser() override; 42 42 }; -
trunk/Source/WebCore/html/HTMLDocument.cpp
r246490 r248728 88 88 using namespace HTMLNames; 89 89 90 HTMLDocument::HTMLDocument(Frame* frame, const URL& url, DocumentClassFlags documentClasses, unsigned constructionFlags) 91 : Document(frame, url, documentClasses | HTMLDocumentClass, constructionFlags) 90 Ref<HTMLDocument> HTMLDocument::createSynthesizedDocument(Frame& frame, const URL& url) 91 { 92 return adoptRef(*new HTMLDocument(frame.sessionID(), &frame, url, HTMLDocumentClass, Synthesized)); 93 } 94 95 HTMLDocument::HTMLDocument(PAL::SessionID sessionID, Frame* frame, const URL& url, DocumentClassFlags documentClasses, unsigned constructionFlags) 96 : Document(sessionID, frame, url, documentClasses | HTMLDocumentClass, constructionFlags) 92 97 { 93 98 clearXMLVersion(); … … 248 253 Ref<Document> HTMLDocument::cloneDocumentWithoutChildren() const 249 254 { 250 return create( nullptr, url());251 } 252 253 } 255 return create(sessionID(), nullptr, url()); 256 } 257 258 } -
trunk/Source/WebCore/html/HTMLDocument.h
r246490 r248728 30 30 WTF_MAKE_ISO_ALLOCATED(HTMLDocument); 31 31 public: 32 static Ref<HTMLDocument> create( Frame*, const URL&);32 static Ref<HTMLDocument> create(PAL::SessionID, Frame*, const URL&); 33 33 static Ref<HTMLDocument> createSynthesizedDocument(Frame&, const URL&); 34 34 virtual ~HTMLDocument(); … … 55 55 56 56 protected: 57 HTMLDocument( Frame*, const URL&, DocumentClassFlags = 0, unsigned constructionFlags = 0);57 HTMLDocument(PAL::SessionID, Frame*, const URL&, DocumentClassFlags = 0, unsigned constructionFlags = 0); 58 58 59 59 private: … … 66 66 }; 67 67 68 inline Ref<HTMLDocument> HTMLDocument::create( Frame* frame, const URL& url)68 inline Ref<HTMLDocument> HTMLDocument::create(PAL::SessionID sessionID, Frame* frame, const URL& url) 69 69 { 70 return adoptRef(*new HTMLDocument(frame, url, HTMLDocumentClass)); 71 } 72 73 inline Ref<HTMLDocument> HTMLDocument::createSynthesizedDocument(Frame& frame, const URL& url) 74 { 75 return adoptRef(*new HTMLDocument(&frame, url, HTMLDocumentClass, Synthesized)); 70 return adoptRef(*new HTMLDocument(sessionID, frame, url, HTMLDocumentClass)); 76 71 } 77 72 -
trunk/Source/WebCore/html/ImageDocument.cpp
r245823 r248728 199 199 200 200 ImageDocument::ImageDocument(Frame& frame, const URL& url) 201 : HTMLDocument( &frame, url, ImageDocumentClass)201 : HTMLDocument(frame.sessionID(), &frame, url, ImageDocumentClass) 202 202 , m_imageElement(nullptr) 203 203 , m_imageSizeIsKnown(false) -
trunk/Source/WebCore/html/MediaDocument.cpp
r246490 r248728 145 145 } 146 146 147 MediaDocument::MediaDocument( Frame* frame, const URL& url)148 : HTMLDocument( frame, url, MediaDocumentClass)147 MediaDocument::MediaDocument(PAL::SessionID sessionID, Frame* frame, const URL& url) 148 : HTMLDocument(sessionID, frame, url, MediaDocumentClass) 149 149 , m_replaceMediaElementTimer(*this, &MediaDocument::replaceMediaElementTimerFired) 150 150 { -
trunk/Source/WebCore/html/MediaDocument.h
r229694 r248728 35 35 WTF_MAKE_ISO_ALLOCATED(MediaDocument); 36 36 public: 37 static Ref<MediaDocument> create( Frame* frame, const URL& url)37 static Ref<MediaDocument> create(PAL::SessionID sessionID, Frame* frame, const URL& url) 38 38 { 39 return adoptRef(*new MediaDocument( frame, url));39 return adoptRef(*new MediaDocument(sessionID, frame, url)); 40 40 } 41 41 virtual ~MediaDocument(); … … 46 46 47 47 private: 48 MediaDocument( Frame*, const URL&);48 MediaDocument(PAL::SessionID, Frame*, const URL&); 49 49 50 50 Ref<DocumentParser> createParser() override; -
trunk/Source/WebCore/html/PluginDocument.cpp
r246490 r248728 142 142 } 143 143 144 PluginDocument::PluginDocument(Frame *frame, const URL& url)145 : HTMLDocument(frame , url, PluginDocumentClass)144 PluginDocument::PluginDocument(Frame& frame, const URL& url) 145 : HTMLDocument(frame.sessionID(), &frame, url, PluginDocumentClass) 146 146 { 147 147 setCompatibilityMode(DocumentCompatibilityMode::QuirksMode); -
trunk/Source/WebCore/html/PluginDocument.h
r229694 r248728 35 35 WTF_MAKE_ISO_ALLOCATED(PluginDocument); 36 36 public: 37 static Ref<PluginDocument> create(Frame *frame, const URL& url)37 static Ref<PluginDocument> create(Frame& frame, const URL& url) 38 38 { 39 39 return adoptRef(*new PluginDocument(frame, url)); … … 51 51 52 52 private: 53 PluginDocument(Frame *, const URL&);53 PluginDocument(Frame&, const URL&); 54 54 55 55 Ref<DocumentParser> createParser() final; -
trunk/Source/WebCore/html/TextDocument.cpp
r229694 r248728 33 33 WTF_MAKE_ISO_ALLOCATED_IMPL(TextDocument); 34 34 35 TextDocument::TextDocument( Frame* frame, const URL& url)36 : HTMLDocument( frame, url, TextDocumentClass)35 TextDocument::TextDocument(PAL::SessionID sessionID, Frame* frame, const URL& url) 36 : HTMLDocument(sessionID, frame, url, TextDocumentClass) 37 37 { 38 38 setCompatibilityMode(DocumentCompatibilityMode::QuirksMode); -
trunk/Source/WebCore/html/TextDocument.h
r229694 r248728 32 32 WTF_MAKE_ISO_ALLOCATED(TextDocument); 33 33 public: 34 static Ref<TextDocument> create( Frame* frame, const URL& url)34 static Ref<TextDocument> create(PAL::SessionID sessionID, Frame* frame, const URL& url) 35 35 { 36 return adoptRef(*new TextDocument( frame, url));36 return adoptRef(*new TextDocument(sessionID, frame, url)); 37 37 } 38 38 39 39 private: 40 TextDocument( Frame*, const URL&);40 TextDocument(PAL::SessionID, Frame*, const URL&); 41 41 42 42 Ref<DocumentParser> createParser() override; -
trunk/Source/WebCore/inspector/DOMPatchSupport.cpp
r241183 r248728 77 77 RefPtr<Document> newDocument; 78 78 if (m_document.isHTMLDocument()) 79 newDocument = HTMLDocument::create( nullptr, URL());79 newDocument = HTMLDocument::create(m_document.sessionID(), nullptr, URL()); 80 80 else if (m_document.isXHTMLDocument()) 81 newDocument = XMLDocument::createXHTML( nullptr, URL());81 newDocument = XMLDocument::createXHTML(m_document.sessionID(), nullptr, URL()); 82 82 else if (m_document.isSVGDocument()) 83 newDocument = XMLDocument::create( nullptr, URL());83 newDocument = XMLDocument::create(m_document.sessionID(), nullptr, URL()); 84 84 85 85 ASSERT(newDocument); -
trunk/Source/WebCore/loader/DocumentWriter.cpp
r247399 r248728 109 109 { 110 110 if (!m_frame->loader().stateMachine().isDisplayingInitialEmptyDocument() && m_frame->loader().client().shouldAlwaysUsePluginDocument(m_mimeType)) 111 return PluginDocument::create( m_frame, url);111 return PluginDocument::create(*m_frame, url); 112 112 #if PLATFORM(IOS_FAMILY) 113 113 if (MIMETypeRegistry::isPDFMIMEType(m_mimeType) && (m_frame->isMainFrame() || !m_frame->settings().useImageDocumentForSubframePDF())) 114 return SinkDocument::create( m_frame, url);114 return SinkDocument::create(*m_frame, url); 115 115 #endif 116 116 if (!m_frame->loader().client().hasHTMLView()) 117 117 return Document::createNonRenderedPlaceholder(*m_frame, url); 118 return DOMImplementation::createDocument(m_ mimeType, m_frame, url);118 return DOMImplementation::createDocument(m_frame->sessionID(), m_mimeType, m_frame, url); 119 119 } 120 120 … … 133 133 // then replace the document with one whose parser will ignore the incoming data (bug 39323) 134 134 if (document->isPluginDocument() && document->isSandboxed(SandboxPlugins)) 135 document = SinkDocument::create( m_frame, url);135 document = SinkDocument::create(*m_frame, url); 136 136 137 137 // FIXME: Do we need to consult the content security policy here about blocked plug-ins? -
trunk/Source/WebCore/loader/SinkDocument.cpp
r229694 r248728 53 53 }; 54 54 55 SinkDocument::SinkDocument(Frame *frame, const URL& url)56 : HTMLDocument(frame , url)55 SinkDocument::SinkDocument(Frame& frame, const URL& url) 56 : HTMLDocument(frame.sessionID(), &frame, url) 57 57 { 58 58 setCompatibilityMode(DocumentCompatibilityMode::QuirksMode); -
trunk/Source/WebCore/loader/SinkDocument.h
r229694 r248728 33 33 WTF_MAKE_ISO_ALLOCATED(SinkDocument); 34 34 public: 35 static Ref<SinkDocument> create(Frame *frame, const URL& url)35 static Ref<SinkDocument> create(Frame& frame, const URL& url) 36 36 { 37 37 return adoptRef(*new SinkDocument(frame, url)); … … 39 39 40 40 private: 41 SinkDocument(Frame *, const URL&);41 SinkDocument(Frame&, const URL&); 42 42 43 43 Ref<DocumentParser> createParser() final; -
trunk/Source/WebCore/loader/cache/CachedSVGDocument.cpp
r240014 r248728 50 50 if (data) { 51 51 // We don't need to create a new frame because the new document belongs to the parent UseElement. 52 m_document = SVGDocument::create( nullptr, response().url());52 m_document = SVGDocument::create(sessionID(), nullptr, response().url()); 53 53 m_document->setContent(m_decoder->decodeAndFlush(data->data(), data->size())); 54 54 } -
trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp
r246490 r248728 73 73 // We may get here during render tree updates when events are forbidden. 74 74 // Frameless document can't run scripts or call back to the client so this is safe. 75 m_externalSVGDocument = SVGDocument::create( nullptr, URL());75 m_externalSVGDocument = SVGDocument::create(sessionID(), nullptr, URL()); 76 76 auto decoder = TextResourceDecoder::create("application/xml"); 77 77 -
trunk/Source/WebCore/page/Frame.cpp
r247555 r248728 1014 1014 } 1015 1015 1016 PAL::SessionID Frame::sessionID() const 1017 { 1018 return m_loader->client().sessionID(); 1019 } 1020 1016 1021 } // namespace WebCore -
trunk/Source/WebCore/page/Frame.h
r247555 r248728 57 57 class RegularExpression; 58 58 } } 59 60 namespace PAL { 61 class SessionID; 62 } 59 63 60 64 namespace WebCore { … … 298 302 void selfOnlyDeref(); 299 303 304 PAL::SessionID sessionID() const; 305 300 306 private: 301 307 friend class NavigationDisabler; -
trunk/Source/WebCore/svg/SVGDocument.cpp
r229694 r248728 31 31 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGDocument); 32 32 33 SVGDocument::SVGDocument( Frame* frame, const URL& url)34 : XMLDocument( frame, url, SVGDocumentClass)33 SVGDocument::SVGDocument(PAL::SessionID sessionID, Frame* frame, const URL& url) 34 : XMLDocument(sessionID, frame, url, SVGDocumentClass) 35 35 { 36 36 } … … 70 70 Ref<Document> SVGDocument::cloneDocumentWithoutChildren() const 71 71 { 72 return create( nullptr, url());72 return create(sessionID(), nullptr, url()); 73 73 } 74 74 -
trunk/Source/WebCore/svg/SVGDocument.h
r229694 r248728 31 31 WTF_MAKE_ISO_ALLOCATED(SVGDocument); 32 32 public: 33 static Ref<SVGDocument> create( Frame*, const URL&);33 static Ref<SVGDocument> create(PAL::SessionID, Frame*, const URL&); 34 34 35 35 static RefPtr<SVGSVGElement> rootElement(const Document&); … … 40 40 41 41 private: 42 SVGDocument( Frame*, const URL&);42 SVGDocument(PAL::SessionID, Frame*, const URL&); 43 43 44 44 Ref<Document> cloneDocumentWithoutChildren() const override; … … 47 47 }; 48 48 49 inline Ref<SVGDocument> SVGDocument::create( Frame* frame, const URL& url)49 inline Ref<SVGDocument> SVGDocument::create(PAL::SessionID sessionID, Frame* frame, const URL& url) 50 50 { 51 return adoptRef(*new SVGDocument( frame, url));51 return adoptRef(*new SVGDocument(sessionID, frame, url)); 52 52 } 53 53 -
trunk/Source/WebCore/xml/DOMParser.cpp
r243163 r248728 35 35 } 36 36 37 ExceptionOr<Ref<Document>> DOMParser::parseFromString( const String& string, const String& contentType)37 ExceptionOr<Ref<Document>> DOMParser::parseFromString(ScriptExecutionContext& context, const String& string, const String& contentType) 38 38 { 39 39 if (contentType != "text/html" && contentType != "text/xml" && contentType != "application/xml" && contentType != "application/xhtml+xml" && contentType != "image/svg+xml") 40 40 return Exception { TypeError }; 41 auto document = DOMImplementation::createDocument(conte ntType, nullptr, URL { });41 auto document = DOMImplementation::createDocument(context.sessionID(), contentType, nullptr, URL { }); 42 42 if (m_contextDocument) 43 43 document->setContextDocument(*m_contextDocument.get()); -
trunk/Source/WebCore/xml/DOMParser.h
r207541 r248728 25 25 26 26 class Document; 27 class ScriptExecutionContext; 27 28 28 29 class DOMParser : public RefCounted<DOMParser> { 29 30 public: 30 31 static Ref<DOMParser> create(Document& contextDocument); 31 ExceptionOr<Ref<Document>> parseFromString( const String&, const String& contentType);32 ExceptionOr<Ref<Document>> parseFromString(ScriptExecutionContext&, const String&, const String& contentType); 32 33 33 34 private: -
trunk/Source/WebCore/xml/DOMParser.idl
r207541 r248728 23 23 ImplementationLacksVTable, 24 24 ] interface DOMParser { 25 [MayThrowException, NewObject ] Document parseFromString(DOMString string, DOMString contentType);25 [MayThrowException, NewObject, CallWith=ScriptExecutionContext] Document parseFromString(DOMString string, DOMString contentType); 26 26 }; -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r248670 r248728 174 174 175 175 if (!m_createdDocument) { 176 auto& context = *scriptExecutionContext(); 177 176 178 String mimeType = responseMIMEType(); 177 179 bool isHTML = equalLettersIgnoringASCIICase(mimeType, "text/html"); … … 184 186 } else { 185 187 if (isHTML) 186 m_responseDocument = HTMLDocument::create( nullptr, m_url);188 m_responseDocument = HTMLDocument::create(context.sessionID(), nullptr, m_url); 187 189 else 188 m_responseDocument = XMLDocument::create( nullptr, m_url);190 m_responseDocument = XMLDocument::create(context.sessionID(), nullptr, m_url); 189 191 m_responseDocument->overrideLastModified(m_response.lastModified()); 190 192 m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity()); 191 m_responseDocument->setContextDocument(downcast<Document>( *scriptExecutionContext()));192 m_responseDocument->setSecurityOriginPolicy( scriptExecutionContext()->securityOriginPolicy());193 m_responseDocument->setContextDocument(downcast<Document>(context)); 194 m_responseDocument->setSecurityOriginPolicy(context.securityOriginPolicy()); 193 195 m_responseDocument->overrideMIMEType(mimeType); 194 196 -
trunk/Source/WebCore/xml/XSLTProcessor.cpp
r240237 r248728 73 73 RefPtr<Document> result; 74 74 if (sourceMIMEType == "text/plain") { 75 result = XMLDocument::createXHTML( frame, sourceIsDocument ? ownerDocument->url() : URL());75 result = XMLDocument::createXHTML(ownerDocument->sessionID(), frame, sourceIsDocument ? ownerDocument->url() : URL()); 76 76 transformTextStringToXHTMLDocumentString(documentSource); 77 77 } else 78 result = DOMImplementation::createDocument( sourceMIMEType, frame, sourceIsDocument ? ownerDocument->url() : URL());78 result = DOMImplementation::createDocument(ownerDocument->sessionID(), sourceMIMEType, frame, sourceIsDocument ? ownerDocument->url() : URL()); 79 79 80 80 // Before parsing, we need to save & detach the old document and get the new document -
trunk/Source/WebKitLegacy/mac/ChangeLog
r248713 r248728 1 2019-08-15 Youenn Fablet <youenn@apple.com> 2 3 Always create a Document with a valid SessionID 4 https://bugs.webkit.org/show_bug.cgi?id=200727 5 6 Reviewed by Alex Christensen. 7 8 Implement WebKit1 sessionID getter like done for WebKit2. 9 Either the loader client has a page in which case the page session ID is used 10 or the client has no page, in which case the default session ID is used. 11 This is the same behavior as CachedResourceLoader. 12 13 * WebCoreSupport/WebFrameLoaderClient.mm: 14 (WebFrameLoaderClient::sessionID const): 15 1 16 2019-08-15 Simon Fraser <simon.fraser@apple.com> 2 17 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm
r248713 r248728 222 222 PAL::SessionID WebFrameLoaderClient::sessionID() const 223 223 { 224 RELEASE_ASSERT_NOT_REACHED();225 return PAL::SessionID::defaultSessionID();224 auto* coreFrame = core(m_webFrame.get()); 225 return coreFrame && coreFrame->page() ? coreFrame->page()->sessionID() : PAL::SessionID::defaultSessionID(); 226 226 } 227 227 -
trunk/Source/WebKitLegacy/win/ChangeLog
r248699 r248728 1 2019-08-15 Youenn Fablet <youenn@apple.com> 2 3 Always create a Document with a valid SessionID 4 https://bugs.webkit.org/show_bug.cgi?id=200727 5 6 Reviewed by Alex Christensen. 7 8 Implement WebKit1 sessionID getter like done for WebKit2. 9 Either the loader client has a page in which case the page session ID is used 10 or the client has no page, in which case the default session ID is used. 11 This is the same behavior as CachedResourceLoader. 12 13 * WebCoreSupport/WebFrameLoaderClient.cpp: 14 (WebFrameLoaderClient::sessionID const): 15 1 16 2019-08-14 Ryan Haddad <ryanhaddad@apple.com> 2 17 -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp
r248713 r248728 135 135 PAL::SessionID WebFrameLoaderClient::sessionID() const 136 136 { 137 RELEASE_ASSERT_NOT_REACHED();138 return PAL::SessionID::defaultSessionID();137 auto* coreFrame = core(m_webFrame); 138 return coreFrame && coreFrame->page() ? coreFrame->page()->sessionID() : PAL::SessionID::defaultSessionID(); 139 139 } 140 140
Note: See TracChangeset
for help on using the changeset viewer.