Changeset 87566 in webkit
- Timestamp:
- May 27, 2011 2:15:46 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87557 r87566 1 2011-05-27 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Darin Adler. 4 5 First swipe at resolving <rdar://problem/9125145> and https://bugs.webkit.org/show_bug.cgi?id=61494 6 7 Make the Document be intelligent about returning its DocumentLoader, including the possibility that 8 the DocumentLoader will be null. 9 10 No new tests. No change in behavior. 11 12 Instead of storing the DocumentLoader at construction and never changing it, 13 always calculate it based on the FrameLoader's current DocumentLoader: 14 * dom/Document.cpp: 15 (WebCore::Document::Document): 16 (WebCore::Document::suggestedMIMEType): 17 (WebCore::Document::lastModified): 18 (WebCore::Document::initSecurityContext): 19 (WebCore::Document::updateURLForPushOrReplaceState): 20 (WebCore::Document::loader): 21 * dom/Document.h: 22 23 Null-check or ASSERT that the DocumentLoader exists (or both) depending on the scenario: 24 * bindings/ScriptControllerBase.cpp: 25 (WebCore::ScriptController::executeIfJavaScriptURL): 26 * html/MediaDocument.cpp: 27 (WebCore::MediaDocument::replaceMediaElementTimerFired): 28 * html/PluginDocument.cpp: 29 (WebCore::PluginDocumentParser::createDocumentStructure): 30 * platform/mac/HTMLConverter.mm: 31 (fileWrapperForElement): 32 33 * WebCore.exp.in: 34 1 35 2011-05-27 Jer Noble <jer.noble@apple.com> 2 36 -
trunk/Source/WebCore/WebCore.exp.in
r87483 r87566 1284 1284 __ZNK7WebCore8Document4bodyEv 1285 1285 __ZNK7WebCore8Document6domainEv 1286 __ZNK7WebCore8Document6loaderEv 1286 1287 __ZNK7WebCore8IntPointcv7CGPointEv 1287 1288 __ZNK7WebCore8IntPointcv8_NSPointEv -
trunk/Source/WebCore/bindings/ScriptControllerBase.cpp
r87309 r87566 115 115 // synchronously can cause crashes: 116 116 // http://bugs.webkit.org/show_bug.cgi?id=16782 117 if (shouldReplaceDocumentIfJavaScriptURL == ReplaceDocumentIfJavaScriptURL) 118 m_frame->document()->loader()->writer()->replaceDocument(scriptResult); 119 117 if (shouldReplaceDocumentIfJavaScriptURL == ReplaceDocumentIfJavaScriptURL) { 118 // We're still in a frame, so there should be a DocumentLoader. 119 ASSERT(m_frame->document()->loader()); 120 if (DocumentLoader* loader = m_frame->document()->loader()) 121 loader->writer()->replaceDocument(scriptResult); 122 } 120 123 return true; 121 124 } -
trunk/Source/WebCore/dom/Document.cpp
r87414 r87566 436 436 437 437 m_frame = frame; 438 m_documentLoader = frame ? frame->loader()->activeDocumentLoader() : 0;439 438 440 439 // We depend on the url getting immediately set in subframes, but we … … 1107 1106 return "text/html"; 1108 1107 1109 return m_documentLoader->responseMIMEType(); 1108 if (DocumentLoader* documentLoader = loader()) 1109 return documentLoader->responseMIMEType(); 1110 return String(); 1110 1111 } 1111 1112 … … 3782 3783 bool foundDate = false; 3783 3784 if (m_frame) { 3784 String httpLastModified = m_documentLoader->response().httpHeaderField("Last-Modified"); 3785 // Since we're still in a Frame, we should have a DocumentLoader. 3786 ASSERT(loader()); 3787 String httpLastModified; 3788 if (loader()) 3789 httpLastModified = loader()->response().httpHeaderField("Last-Modified"); 3785 3790 if (!httpLastModified.isEmpty()) { 3786 3791 date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModified)); … … 4511 4516 // and https://bugs.webkit.org/show_bug.cgi?id=19760 for further 4512 4517 // discussion. 4513 if (m_documentLoader->substituteData().isValid()) 4518 4519 DocumentLoader* documentLoader = loader(); 4520 // Since we're still in a Frame, we should have a DocumentLoader. 4521 ASSERT(documentLoader); 4522 if (documentLoader && documentLoader->substituteData().isValid()) 4514 4523 securityOrigin()->grantLoadLocalResources(); 4515 4524 } … … 4592 4601 setURL(url); 4593 4602 f->loader()->setOutgoingReferrer(url); 4594 m_documentLoader->replaceRequestURLForSameDocumentNavigation(url); 4603 // Since we're still in a frame, we should have a DocumentLoader. 4604 ASSERT(loader()); 4605 if (DocumentLoader* documentLoader = loader()) 4606 documentLoader->replaceRequestURLForSameDocumentNavigation(url); 4595 4607 } 4596 4608 … … 5143 5155 } 5144 5156 5157 DocumentLoader* Document::loader() const 5158 { 5159 if (!m_frame) 5160 return 0; 5161 5162 DocumentLoader* loader = m_frame->loader()->activeDocumentLoader(); 5163 if (!loader) 5164 return 0; 5165 5166 if (m_frame->document() != this) 5167 return 0; 5168 5169 return loader; 5170 } 5171 5145 5172 } // namespace WebCore -
trunk/Source/WebCore/dom/Document.h
r87414 r87566 570 570 bool visuallyOrdered() const { return m_visuallyOrdered; } 571 571 572 void setDocumentLoader(DocumentLoader* documentLoader) { m_documentLoader = documentLoader; } 573 DocumentLoader* loader() const { return m_documentLoader; } 572 DocumentLoader* loader() const; 574 573 575 574 void open(Document* ownerDocument = 0); … … 1175 1174 1176 1175 Frame* m_frame; 1177 DocumentLoader* m_documentLoader;1178 1176 OwnPtr<CachedResourceLoader> m_cachedResourceLoader; 1179 1177 RefPtr<DocumentParser> m_parser; -
trunk/Source/WebCore/html/MediaDocument.cpp
r85510 r87566 222 222 embedElement->setAttribute(nameAttr, "plugin"); 223 223 embedElement->setAttribute(srcAttr, url().string()); 224 embedElement->setAttribute(typeAttr, loader()->writer()->mimeType()); 224 225 DocumentLoader* documentLoader = loader(); 226 ASSERT(documentLoader); 227 if (documentLoader) 228 embedElement->setAttribute(typeAttr, documentLoader->writer()->mimeType()); 225 229 226 230 ExceptionCode ec; -
trunk/Source/WebCore/html/PluginDocument.cpp
r78342 r87566 93 93 m_embedElement->setAttribute(nameAttr, "plugin"); 94 94 m_embedElement->setAttribute(srcAttr, document()->url().string()); 95 m_embedElement->setAttribute(typeAttr, document()->loader()->writer()->mimeType()); 95 96 DocumentLoader* loader = document()->loader(); 97 ASSERT(loader); 98 if (loader) 99 m_embedElement->setAttribute(typeAttr, loader->writer()->mimeType()); 96 100 97 101 static_cast<PluginDocument*>(document())->setPluginNode(m_embedElement); -
trunk/Source/WebCore/platform/mac/HTMLConverter.mm
r85036 r87566 1754 1754 if (!attr.isEmpty()) { 1755 1755 NSURL *URL = element->document()->completeURL(attr); 1756 wrapper = fileWrapperForURL(element->document()->loader(), URL); 1756 if (DocumentLoader* loader = element->document()->loader()) 1757 wrapper = fileWrapperForURL(loader, URL); 1757 1758 } 1758 1759 if (!wrapper) {
Note: See TracChangeset
for help on using the changeset viewer.