Title: [88813] branches/chromium/742/Source/WebCore

Diff

Modified: branches/chromium/742/Source/WebCore/WebCore.exp.in (88812 => 88813)


--- branches/chromium/742/Source/WebCore/WebCore.exp.in	2011-06-14 16:46:49 UTC (rev 88812)
+++ branches/chromium/742/Source/WebCore/WebCore.exp.in	2011-06-14 16:48:13 UTC (rev 88813)
@@ -1274,6 +1274,7 @@
 __ZNK7WebCore8Document31displayStringModifiedByEncodingERKN3WTF6StringE
 __ZNK7WebCore8Document4bodyEv
 __ZNK7WebCore8Document6domainEv
+__ZNK7WebCore8Document6loaderEv
 __ZNK7WebCore8IntPointcv7CGPointEv
 __ZNK7WebCore8IntPointcv8_NSPointEv
 __ZNK7WebCore8Position10downstreamENS_27EditingBoundaryCrossingRuleE

Modified: branches/chromium/742/Source/WebCore/bindings/ScriptControllerBase.cpp (88812 => 88813)


--- branches/chromium/742/Source/WebCore/bindings/ScriptControllerBase.cpp	2011-06-14 16:46:49 UTC (rev 88812)
+++ branches/chromium/742/Source/WebCore/bindings/ScriptControllerBase.cpp	2011-06-14 16:48:13 UTC (rev 88813)
@@ -107,9 +107,12 @@
     // FIXME: We should always replace the document, but doing so
     //        synchronously can cause crashes:
     //        http://bugs.webkit.org/show_bug.cgi?id=16782
-    if (shouldReplaceDocumentIfJavaScriptURL == ReplaceDocumentIfJavaScriptURL)
-        m_frame->document()->loader()->writer()->replaceDocument(scriptResult);
-
+    if (shouldReplaceDocumentIfJavaScriptURL == ReplaceDocumentIfJavaScriptURL) {
+        // We're still in a frame, so there should be a DocumentLoader.
+        ASSERT(m_frame->document()->loader());
+        if (DocumentLoader* loader = m_frame->document()->loader())
+            loader->writer()->replaceDocument(scriptResult);
+    }
     return true;
 }
 

Modified: branches/chromium/742/Source/WebCore/dom/Document.cpp (88812 => 88813)


--- branches/chromium/742/Source/WebCore/dom/Document.cpp	2011-06-14 16:46:49 UTC (rev 88812)
+++ branches/chromium/742/Source/WebCore/dom/Document.cpp	2011-06-14 16:48:13 UTC (rev 88813)
@@ -443,7 +443,6 @@
     m_ignoreAutofocus = false;
 
     m_frame = frame;
-    m_documentLoader = frame ? frame->loader()->activeDocumentLoader() : 0;
 
     // We depend on the url getting immediately set in subframes, but we
     // also depend on the url NOT getting immediately set in opened windows.
@@ -3733,7 +3732,9 @@
     DateComponents date;
     bool foundDate = false;
     if (m_frame) {
-        String httpLastModified = m_documentLoader->response().httpHeaderField("Last-Modified");
+        String httpLastModified;
+        if (DocumentLoader* documentLoader = loader()) 
+            httpLastModified = documentLoader->response().httpHeaderField("Last-Modified");
         if (!httpLastModified.isEmpty()) {
             date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModified));
             foundDate = true;
@@ -4441,7 +4442,9 @@
         // load local resources.  See https://bugs.webkit.org/show_bug.cgi?id=16756
         // and https://bugs.webkit.org/show_bug.cgi?id=19760 for further
         // discussion.
-        if (m_documentLoader->substituteData().isValid())
+        
+        DocumentLoader* documentLoader = loader();
+        if (documentLoader && documentLoader->substituteData().isValid())
             securityOrigin()->grantLoadLocalResources();
     }
 
@@ -4522,7 +4525,9 @@
 
     setURL(url);
     f->loader()->setOutgoingReferrer(url);
-    m_documentLoader->replaceRequestURLForSameDocumentNavigation(url);
+
+    if (DocumentLoader* documentLoader = loader())
+        documentLoader->replaceRequestURLForSameDocumentNavigation(url);
 }
 
 void Document::statePopped(SerializedScriptValue* stateObject)
@@ -4988,4 +4993,19 @@
 }
 #endif
 
+DocumentLoader* Document::loader() const
+{
+    if (!m_frame)
+        return 0;
+    
+    DocumentLoader* loader = m_frame->loader()->activeDocumentLoader();
+    if (!loader)
+        return 0;
+    
+    if (m_frame->document() != this)
+        return 0;
+    
+    return loader;
+}
+
 } // namespace WebCore

Modified: branches/chromium/742/Source/WebCore/dom/Document.h (88812 => 88813)


--- branches/chromium/742/Source/WebCore/dom/Document.h	2011-06-14 16:46:49 UTC (rev 88812)
+++ branches/chromium/742/Source/WebCore/dom/Document.h	2011-06-14 16:48:13 UTC (rev 88813)
@@ -553,8 +553,7 @@
     void setVisuallyOrdered();
     bool visuallyOrdered() const { return m_visuallyOrdered; }
     
-    void setDocumentLoader(DocumentLoader* documentLoader) { m_documentLoader = documentLoader; }
-    DocumentLoader* loader() const { return m_documentLoader; }
+    DocumentLoader* loader() const;
 
     void open(Document* ownerDocument = 0);
     void implicitOpen();
@@ -1143,7 +1142,6 @@
     mutable RefPtr<CSSPrimitiveValueCache> m_cssPrimitiveValueCache;
 
     Frame* m_frame;
-    DocumentLoader* m_documentLoader;
     OwnPtr<CachedResourceLoader> m_cachedResourceLoader;
     RefPtr<DocumentParser> m_parser;
     bool m_wellFormed;

Modified: branches/chromium/742/Source/WebCore/html/MediaDocument.cpp (88812 => 88813)


--- branches/chromium/742/Source/WebCore/html/MediaDocument.cpp	2011-06-14 16:46:49 UTC (rev 88812)
+++ branches/chromium/742/Source/WebCore/html/MediaDocument.cpp	2011-06-14 16:48:13 UTC (rev 88813)
@@ -209,8 +209,12 @@
         embedElement->setAttribute(heightAttr, "100%");
         embedElement->setAttribute(nameAttr, "plugin");
         embedElement->setAttribute(srcAttr, url().string());
-        embedElement->setAttribute(typeAttr, loader()->writer()->mimeType());
 
+        DocumentLoader* documentLoader = loader();
+        ASSERT(documentLoader);
+        if (documentLoader)
+            embedElement->setAttribute(typeAttr, documentLoader->writer()->mimeType());
+
         ExceptionCode ec;
         videoElement->parentNode()->replaceChild(embedElement, videoElement, ec);
     }

Modified: branches/chromium/742/Source/WebCore/html/PluginDocument.cpp (88812 => 88813)


--- branches/chromium/742/Source/WebCore/html/PluginDocument.cpp	2011-06-14 16:46:49 UTC (rev 88812)
+++ branches/chromium/742/Source/WebCore/html/PluginDocument.cpp	2011-06-14 16:48:13 UTC (rev 88813)
@@ -92,7 +92,11 @@
     
     m_embedElement->setAttribute(nameAttr, "plugin");
     m_embedElement->setAttribute(srcAttr, document()->url().string());
-    m_embedElement->setAttribute(typeAttr, document()->loader()->writer()->mimeType());
+    
+    DocumentLoader* loader = document()->loader();
+    ASSERT(loader);
+    if (loader)
+        m_embedElement->setAttribute(typeAttr, loader->writer()->mimeType());
 
     static_cast<PluginDocument*>(document())->setPluginNode(m_embedElement);
 

Modified: branches/chromium/742/Source/WebCore/platform/mac/HTMLConverter.mm (88812 => 88813)


--- branches/chromium/742/Source/WebCore/platform/mac/HTMLConverter.mm	2011-06-14 16:46:49 UTC (rev 88812)
+++ branches/chromium/742/Source/WebCore/platform/mac/HTMLConverter.mm	2011-06-14 16:48:13 UTC (rev 88813)
@@ -1753,7 +1753,8 @@
     const AtomicString& attr = element->getAttribute(srcAttr);
     if (!attr.isEmpty()) {
         NSURL *URL = ""
-        wrapper = fileWrapperForURL(element->document()->loader(), URL);
+        if (DocumentLoader* loader = element->document()->loader())
+            wrapper = fileWrapperForURL(loader, URL);
     }
     if (!wrapper) {
         RenderImage* renderer = toRenderImage(element->renderer());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to