Reviewed by Eric.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Oct 2006 11:50:09 +0000 (11:50 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Oct 2006 11:50:09 +0000 (11:50 +0000)
        - move m_responseMIMEType out of ResourceRequest, where it doesn't belong

        * page/FramePrivate.h: Add m_responseMIMEType
        * page/ResourceRequest.h: Remove m_responseMIMEType
        * page/Frame.cpp:
        (WebCore::Frame::setResponseMIMEType): added
        (WebCore::Frame::responseMIMEType): added
        (WebCore::Frame::begin): get MIME type from the right place
        (WebCore::Frame::write): ditto
        * page/Frame.h:
        * bindings/js/kjs_window.cpp:
        (KJS::createNewWindow): updated to use new Frame methods
        (KJS::WindowFunc::callAsFunction): ditto
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge openURL:reload:contentType:refresh:lastModified:pageCache:]): ditto
        (-[WebCoreFrameBridge canProvideDocumentSource]): ditto
        * loader/PluginDocument.cpp:
        (WebCore::PluginTokenizer::createDocumentStructure): ditto

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17006 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/kjs_window.cpp
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/loader/PluginDocument.cpp
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FramePrivate.h
WebCore/page/ResourceRequest.h

index 68eeb46997ba28f11499781f3c7fa11c0c9448d7..cbfe6a5e477ce469051ac62d1c777ccc3d52ceea 100644 (file)
@@ -1,3 +1,26 @@
+2006-10-12  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Eric.
+
+        - move m_responseMIMEType out of ResourceRequest, where it doesn't belong
+
+        * page/FramePrivate.h: Add m_responseMIMEType
+        * page/ResourceRequest.h: Remove m_responseMIMEType
+        * page/Frame.cpp:
+        (WebCore::Frame::setResponseMIMEType): added
+        (WebCore::Frame::responseMIMEType): added
+        (WebCore::Frame::begin): get MIME type from the right place
+        (WebCore::Frame::write): ditto
+        * page/Frame.h:
+        * bindings/js/kjs_window.cpp:
+        (KJS::createNewWindow): updated to use new Frame methods
+        (KJS::WindowFunc::callAsFunction): ditto
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge openURL:reload:contentType:refresh:lastModified:pageCache:]): ditto
+        (-[WebCoreFrameBridge canProvideDocumentSource]): ditto
+        * loader/PluginDocument.cpp:
+        (WebCore::PluginTokenizer::createDocumentStructure): ditto
+
 2006-10-12  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Eric.
index b9f4ef58d9ad3fa5f4916504a850c9617185d06b..f69207fd1b0b27f8a124fa1df97790b3d2d3a288 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
-                       projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
index c1ea23585fb079746faccd6bbec6fd2b94699f11..38e59a4d0891ed9abb284b19b7a741e9f0436f32 100644 (file)
@@ -547,8 +547,6 @@ static Frame *createNewWindow(ExecState *exec, Window *openerWindow, const Depre
     request.frameName = frameName;
     if (activePart)
         request.setReferrer(activePart->referrer());
-    // FIXME: is this needed?
-    request.m_responseMIMEType = "text/html";
 
     // FIXME: It's much better for client API if a new window starts with a URL, here where we
     // know what URL we are going to open. Unfortunately, this code passes the empty string
@@ -1586,8 +1584,6 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
           }
           return Window::retrieve(frame);
       }
-      // FIXME: is this needed?
-      request.m_responseMIMEType = "text/html";
       
       // request window (new or existing if framename is set)
       Frame* newFrame = 0;
index 0bac9bf3fe421f98c1e944a1062d4655986724d6..362b0dcccf92ed5b4486b4c8dad772526c34c1c1 100644 (file)
@@ -562,10 +562,9 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
     // arguments
     ResourceRequest request(m_frame->resourceRequest());
     request.reload = reload;
-    if (contentType)
-        request.m_responseMIMEType = contentType;
     m_frame->setResourceRequest(request);
-
+    m_frame->setResponseMIMEType(contentType);
+    
     // opening the URL
     if (m_frame->didOpenURL(URL)) {
         // things we have to set up after calling didOpenURL
@@ -2558,7 +2557,7 @@ static NSCharacterSet *_getPostSmartSet(void)
 
 - (BOOL)canProvideDocumentSource
 {
-    String mimeType = m_frame->resourceRequest().m_responseMIMEType;
+    String mimeType = m_frame->responseMIMEType();
     
     if (WebCore::DOMImplementation::isTextMIMEType(mimeType) ||
         Image::supportsType(mimeType) ||
index 8157e84b915264f588c789dd1571053d929dfd0d..889c329ea06af8a8725383671aa7520737e83cb4 100644 (file)
@@ -83,7 +83,7 @@ void PluginTokenizer::createDocumentStructure()
     
     m_embedElement->setAttribute(nameAttr, "plugin");
     m_embedElement->setSrc(m_doc->URL());
-    m_embedElement->setType(m_doc->frame()->resourceRequest().m_responseMIMEType);
+    m_embedElement->setType(m_doc->frame()->responseMIMEType());
     
     body->appendChild(embedElement, ec);    
 }
index 2a7b9d071d146f5b86609bf0b06a0463aa7104ef..28973637445d7f63a3d42084010f4b3c88475668 100644 (file)
@@ -604,6 +604,16 @@ const ResourceRequest& Frame::resourceRequest() const
     return d->m_request;
 }
 
+void Frame::setResponseMIMEType(const String& contentType)
+{
+    d->m_responseMIMEType = contentType;
+}
+
+const String& Frame::responseMIMEType() const
+{
+    return d->m_responseMIMEType;
+}
+
 void Frame::begin(const KURL& url)
 {
   if (d->m_workingURL.isEmpty())
@@ -630,19 +640,19 @@ void Frame::begin(const KURL& url)
     baseurl = d->m_url;
 
 #ifdef SVG_SUPPORT
-  if (d->m_request.m_responseMIMEType == "image/svg+xml")
+  if (d->m_responseMIMEType == "image/svg+xml")
     d->m_doc = DOMImplementation::instance()->createSVGDocument(d->m_view.get());
   else
 #endif
-  if (DOMImplementation::isXMLMIMEType(d->m_request.m_responseMIMEType))
+  if (DOMImplementation::isXMLMIMEType(d->m_responseMIMEType))
     d->m_doc = DOMImplementation::instance()->createDocument(d->m_view.get());
-  else if (DOMImplementation::isTextMIMEType(d->m_request.m_responseMIMEType))
+  else if (DOMImplementation::isTextMIMEType(d->m_responseMIMEType))
     d->m_doc = new TextDocument(DOMImplementation::instance(), d->m_view.get());
-  else if ((d->m_request.m_responseMIMEType == "application/pdf" || d->m_request.m_responseMIMEType == "text/pdf") && PlugInInfoStore::supportsMIMEType(d->m_request.m_responseMIMEType))
+  else if ((d->m_responseMIMEType == "application/pdf" || d->m_responseMIMEType == "text/pdf") && PlugInInfoStore::supportsMIMEType(d->m_responseMIMEType))
     d->m_doc = new PluginDocument(DOMImplementation::instance(), d->m_view.get());
-  else if (Image::supportsType(d->m_request.m_responseMIMEType))
+  else if (Image::supportsType(d->m_responseMIMEType))
     d->m_doc = new ImageDocument(DOMImplementation::instance(), d->m_view.get());
-  else if (PlugInInfoStore::supportsMIMEType(d->m_request.m_responseMIMEType))
+  else if (PlugInInfoStore::supportsMIMEType(d->m_responseMIMEType))
     d->m_doc = new PluginDocument(DOMImplementation::instance(), d->m_view.get());
   else if (inViewSourceMode())
     d->m_doc = new HTMLViewSourceDocument(DOMImplementation::instance(), d->m_view.get());
@@ -690,7 +700,7 @@ void Frame::write(const char* str, int len)
     }
     
     if (!d->m_decoder) {
-        d->m_decoder = new Decoder(d->m_request.m_responseMIMEType, settings()->encoding());
+        d->m_decoder = new Decoder(d->m_responseMIMEType, settings()->encoding());
         if (!d->m_encoding.isNull())
             d->m_decoder->setEncoding(d->m_encoding,
                 d->m_haveEncoding ? Decoder::UserChosenEncoding : Decoder::EncodingFromHTTPHeader);
index 258a620afa0f300b4d4b20fbd243494dd2b95b0d..415ebe5d224d56e5d131fb0533859acad9463c20 100644 (file)
@@ -814,9 +814,12 @@ public:
 
   KURL url() const;
   
-  void setResourceRequest(const ResourceRequest& request);
+  void setResourceRequest(const ResourceRequest&);
   const ResourceRequest& resourceRequest() const;
 
+  void setResponseMIMEType(const String&);
+  const String& responseMIMEType() const;
+  
   bool containsPlugins() const;
   
   bool prohibitsScrolling() const;
index dc8d0d3b7f56100906f294b3a954342f061e534a..e684474bf15fbd00a6f795811c1130fc14778160 100644 (file)
@@ -163,6 +163,8 @@ namespace WebCore {
         KURL m_workingURL;
         ResourceRequest m_request;
 
+        String m_responseMIMEType;
+
         CachePolicy m_cachePolicy;
         Timer<Frame> m_redirectionTimer;
 
index cab7d433dafc8c7ebf4c8c764ee54d08858e0fc5..b29a501454bcd863bde5b53f4a6de4a64e8b14f4 100644 (file)
@@ -60,10 +60,6 @@ namespace WebCore {
         bool m_lockHistory;
 
     public:
-        // FIXME: the response MIME type shouldn't be in here, it
-        // should be in some kind of response object
-        String m_responseMIMEType;
-        
         FormData postData;
         bool reload;
     private: