WebCore:
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Jan 2007 12:50:49 +0000 (12:50 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Jan 2007 12:50:49 +0000 (12:50 +0000)
        Reviewed by Mark.

        - made data loading cross-platform
        - fixed <rdar://problem/4910106>

        * WebCore.exp:
        * WebCore.xcodeproj/project.pbxproj:
        * loader/CachedResource.cpp:
        * loader/CachedResource.h:
        * loader/DocLoader.cpp:
        (WebCore::DocLoader::requestResource):
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::DocumentLoader):
        (WebCore::DocumentLoader::setRequest):
        (WebCore::DocumentLoader::urlForHistory):
        (WebCore::DocumentLoader::unreachableURL):
        * loader/DocumentLoader.h:
        (WebCore::DocumentLoader::substituteData):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::load):
        (WebCore::FrameLoader::shouldReloadToHandleUnreachableURL):
        (WebCore::FrameLoader::reloadAllowingStaleData):
        (WebCore::FrameLoader::reload):
        (WebCore::FrameLoader::commitProvisionalLoad):
        (WebCore::FrameLoader::startLoadingMainResource):
        (WebCore::FrameLoader::startLoading):
        (WebCore::FrameLoader::checkNavigationPolicy):
        * loader/FrameLoader.h:
        * loader/FrameLoaderClient.h:
        * loader/MainResourceLoader.cpp:
        (WebCore::MainResourceLoader::willSendRequest):
        (WebCore::MainResourceLoader::continueAfterContentPolicy):
        (WebCore::MainResourceLoader::handleEmptyLoad):
        (WebCore::MainResourceLoader::handleDataLoad):
        (WebCore::MainResourceLoader::loadNow):
        (WebCore::MainResourceLoader::load):
        * loader/MainResourceLoader.h:
        * loader/mac/DocumentLoaderMac.mm:
        * loader/mac/WebDataProtocol.h: Removed.
        * loader/mac/WebDataProtocol.mm: Removed.
        * loader/qt/DocumentLoaderQt.cpp:
        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyFrameLoaderClient::createDocumentLoader):

WebKit:

        Reviewed by Mark.

        - updated for cross-platform data loading support

        * WebCoreSupport/WebFrameLoaderClient.h:
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::createDocumentLoader):
        * WebView/WebDataSource.mm:
        (-[WebDataSource initWithRequest:]):
        * WebView/WebDocumentLoaderMac.h:
        * WebView/WebDocumentLoaderMac.mm:
        (WebDocumentLoaderMac::WebDocumentLoaderMac):
        * WebView/WebFrame.mm:
        (-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]):
        (-[WebFrame loadData:MIMEType:textEncodingName:baseURL:]):
        (-[WebFrame _loadHTMLString:baseURL:unreachableURL:]):
        (-[WebFrame loadArchive:]):
        * WebView/WebFrameInternal.h:
        * WebView/WebHTMLView.mm:
        (uniqueURLWithRelativePart):
        (-[WebHTMLView _documentFragmentFromPasteboard:inContext:allowPlainText:chosePlainText:]):

WebKitQt:

        Reviewed by Mark.

        - updated for cross-platform data loading support

        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (WebCore::FrameLoaderClientQt::createDocumentLoader):
        * WebCoreSupport/FrameLoaderClientQt.h:

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

30 files changed:
WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/loader/CachedResource.cpp
WebCore/loader/CachedResource.h
WebCore/loader/DocLoader.cpp
WebCore/loader/DocumentLoader.cpp
WebCore/loader/DocumentLoader.h
WebCore/loader/FrameLoader.cpp
WebCore/loader/FrameLoader.h
WebCore/loader/FrameLoaderClient.h
WebCore/loader/MainResourceLoader.cpp
WebCore/loader/MainResourceLoader.h
WebCore/loader/mac/DocumentLoaderMac.mm
WebCore/loader/mac/WebDataProtocol.h [deleted file]
WebCore/loader/mac/WebDataProtocol.mm [deleted file]
WebCore/loader/qt/DocumentLoaderQt.cpp
WebCore/platform/graphics/svg/SVGImageEmptyClients.h
WebKit/ChangeLog
WebKit/WebCoreSupport/WebFrameLoaderClient.h
WebKit/WebCoreSupport/WebFrameLoaderClient.mm
WebKit/WebView/WebDataSource.mm
WebKit/WebView/WebDocumentLoaderMac.h
WebKit/WebView/WebDocumentLoaderMac.mm
WebKit/WebView/WebFrame.mm
WebKit/WebView/WebFrameInternal.h
WebKit/WebView/WebHTMLView.mm
WebKitQt/ChangeLog
WebKitQt/WebCoreSupport/FrameLoaderClientQt.cpp
WebKitQt/WebCoreSupport/FrameLoaderClientQt.h

index 1a9a8a6079ecdd0c02090d3975b8f0d62123aa75..5468142ce3c82c6096bff62eb4839095da8f62e1 100644 (file)
@@ -1,3 +1,49 @@
+2007-01-29  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Mark.
+
+        - made data loading cross-platform
+        - fixed <rdar://problem/4910106>
+
+        * WebCore.exp:
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/CachedResource.cpp:
+        * loader/CachedResource.h:
+        * loader/DocLoader.cpp:
+        (WebCore::DocLoader::requestResource):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::DocumentLoader):
+        (WebCore::DocumentLoader::setRequest):
+        (WebCore::DocumentLoader::urlForHistory):
+        (WebCore::DocumentLoader::unreachableURL):
+        * loader/DocumentLoader.h:
+        (WebCore::DocumentLoader::substituteData):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::load):
+        (WebCore::FrameLoader::shouldReloadToHandleUnreachableURL):
+        (WebCore::FrameLoader::reloadAllowingStaleData):
+        (WebCore::FrameLoader::reload):
+        (WebCore::FrameLoader::commitProvisionalLoad):
+        (WebCore::FrameLoader::startLoadingMainResource):
+        (WebCore::FrameLoader::startLoading):
+        (WebCore::FrameLoader::checkNavigationPolicy):
+        * loader/FrameLoader.h:
+        * loader/FrameLoaderClient.h:
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::willSendRequest):
+        (WebCore::MainResourceLoader::continueAfterContentPolicy):
+        (WebCore::MainResourceLoader::handleEmptyLoad):
+        (WebCore::MainResourceLoader::handleDataLoad):
+        (WebCore::MainResourceLoader::loadNow):
+        (WebCore::MainResourceLoader::load):
+        * loader/MainResourceLoader.h:
+        * loader/mac/DocumentLoaderMac.mm:
+        * loader/mac/WebDataProtocol.h: Removed.
+        * loader/mac/WebDataProtocol.mm: Removed.
+        * loader/qt/DocumentLoaderQt.cpp:
+        * platform/graphics/svg/SVGImageEmptyClients.h:
+        (WebCore::SVGEmptyFrameLoaderClient::createDocumentLoader):
+
 2007-01-29  Zack Rusin  <zrusin@trolltech.com>
 
         Order the build files alphabetically instead of
index c190131b462306e3a1e730fa35057fbb8ae5e690..dfbad361f1e84df0b84183c71b8e8427ebc16b9d 100644 (file)
@@ -152,6 +152,7 @@ __ZN7WebCore11FrameLoader36saveScrollPositionAndViewStateToItemEPNS_11HistoryIte
 __ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE
 __ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
 __ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestE
+__ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestERKNS_14SubstituteDataE
 __ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestERKNS_16NavigationActionENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
 __ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestERKNS_6StringE
 __ZN7WebCore11FrameLoader4loadERKNS_4KURLEPNS_5EventE
@@ -159,7 +160,6 @@ __ZN7WebCore11FrameLoader4loadERKNS_4KURLERKNS_6StringENS_13FrameLoadTypeES6_PNS
 __ZN7WebCore11FrameLoader5clearEb
 __ZN7WebCore11FrameLoader6reloadEv
 __ZN7WebCore11FrameLoader7canLoadERKNS_4KURLERKNS_6StringERb
-__ZN7WebCore11globalPointERK8_NSPointP8NSWindow
 __ZN7WebCore11HistoryItem12addChildItemEN3WTF10PassRefPtrIS0_EE
 __ZN7WebCore11HistoryItem12setURLStringERKNS_6StringE
 __ZN7WebCore11HistoryItem12setViewStateEP11objc_object
@@ -187,6 +187,7 @@ __ZN7WebCore11HistoryItemC1ERKNS_6StringES3_d
 __ZN7WebCore11HistoryItemC1Ev
 __ZN7WebCore11HistoryItemD1Ev
 __ZN7WebCore11RenderLayer18gAlignCenterAlwaysE
+__ZN7WebCore11globalPointERK8_NSPointP8NSWindow
 __ZN7WebCore11selectRangeEPNS_19SelectionControllerEPNS_5RangeENS_9EAffinityEb
 __ZN7WebCore11toUserSpaceERK7_NSRectP8NSWindow
 __ZN7WebCore12AtomicString3addEPNS_10StringImplE
@@ -216,6 +217,7 @@ __ZN7WebCore12IconDatabase25setPrivateBrowsingEnabledEb
 __ZN7WebCore12IconDatabase4openERKNS_6StringE
 __ZN7WebCore12IconDatabase5closeEv
 __ZN7WebCore12IconDatabase7isEmptyEv
+__ZN7WebCore12SharedBuffer10wrapNSDataEP6NSData
 __ZN7WebCore12SharedBuffer12createNSDataEv
 __ZN7WebCore13HitTestResultC1ERKS0_
 __ZN7WebCore13HitTestResultD1Ev
@@ -229,7 +231,7 @@ __ZN7WebCore14DocumentLoader19prepareForLoadStartEv
 __ZN7WebCore14DocumentLoader19setOverrideEncodingERKNS_6StringE
 __ZN7WebCore14DocumentLoader32replaceRequestURLForAnchorScrollERKNS_4KURLE
 __ZN7WebCore14DocumentLoader7requestEv
-__ZN7WebCore14DocumentLoaderC2ERKNS_15ResourceRequestE
+__ZN7WebCore14DocumentLoaderC2ERKNS_15ResourceRequestERKNS_14SubstituteDataE
 __ZN7WebCore14DocumentLoaderD2Ev
 __ZN7WebCore14DragController10dragExitedEPNS_8DragDataE
 __ZN7WebCore14DragController11dragEnteredEPNS_8DragDataE
@@ -436,7 +438,6 @@ __ZN7WebCore9TimerBase5startEdd
 __ZN7WebCore9TimerBaseC2Ev
 __ZN7WebCore9TimerBaseD2Ev
 __ZN7WebCoreeqERKNS_4KURLES2_
-__ZNK7WebCore6Widget7getViewEv
 __ZNK7WebCore10StringImplcvP8NSStringEv
 __ZNK7WebCore11CachedImage5imageEv
 __ZNK7WebCore11ContextMenu19platformDescriptionEv
@@ -550,6 +551,7 @@ __ZNK7WebCore6Editor9canDeleteEv
 __ZNK7WebCore6String16deprecatedStringEv
 __ZNK7WebCore6String6lengthEv
 __ZNK7WebCore6String7isEmptyEv
+__ZNK7WebCore6Widget7getViewEv
 __ZNK7WebCore7Element12getAttributeERKNS_13QualifiedNameE
 __ZNK7WebCore7IntRectcv7_NSRectEv
 __ZNK7WebCore8Document11defaultViewEv
index e761e66f759cf0480afb469969653ad4d3942d75..d695516e2a764afea73a6936b30a85ceb4f5394a 100644 (file)
                656B85380AEA1F9A00A095B4 /* ResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 656B85370AEA1F9A00A095B4 /* ResourceHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
                656D37320ADBA5DE00A4554D /* LoaderNSURLExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D371A0ADBA5DE00A4554D /* LoaderNSURLExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
                656D37330ADBA5DE00A4554D /* LoaderNSURLExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 656D371B0ADBA5DE00A4554D /* LoaderNSURLExtras.m */; };
-               656D37340ADBA5DE00A4554D /* WebDataProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D371C0ADBA5DE00A4554D /* WebDataProtocol.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               656D37350ADBA5DE00A4554D /* WebDataProtocol.mm in Sources */ = {isa = PBXBuildFile; fileRef = 656D371D0ADBA5DE00A4554D /* WebDataProtocol.mm */; };
                656D37360ADBA5DE00A4554D /* DocumentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D371E0ADBA5DE00A4554D /* DocumentLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
                656D37370ADBA5DE00A4554D /* DocumentLoaderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 656D371F0ADBA5DE00A4554D /* DocumentLoaderMac.mm */; };
                656D373A0ADBA5DE00A4554D /* FormState.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D37220ADBA5DE00A4554D /* FormState.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6593923709AE4346002C531F /* KURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6593923509AE4346002C531F /* KURL.cpp */; };
                6593923809AE4346002C531F /* KURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 6593923609AE4346002C531F /* KURL.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6593923A09AE435C002C531F /* KURLMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6593923909AE435C002C531F /* KURLMac.mm */; };
+               659A7D130B6DB4D9001155B3 /* SubstituteData.h in Headers */ = {isa = PBXBuildFile; fileRef = 659A7D120B6DB4D9001155B3 /* SubstituteData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                659DDC8209E198BA001BF3C6 /* JSDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 659DDC8009E198BA001BF3C6 /* JSDocument.cpp */; };
                659DDC8309E198BA001BF3C6 /* JSDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 659DDC8109E198BA001BF3C6 /* JSDocument.h */; };
                65A21468097A329100B9050A /* Page.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A21467097A329100B9050A /* Page.h */; settings = {ATTRIBUTES = (Private, ); }; };
                656B85370AEA1F9A00A095B4 /* ResourceHandle.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceHandle.h; sourceTree = "<group>"; };
                656D371A0ADBA5DE00A4554D /* LoaderNSURLExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LoaderNSURLExtras.h; sourceTree = "<group>"; };
                656D371B0ADBA5DE00A4554D /* LoaderNSURLExtras.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = LoaderNSURLExtras.m; sourceTree = "<group>"; };
-               656D371C0ADBA5DE00A4554D /* WebDataProtocol.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDataProtocol.h; sourceTree = "<group>"; };
-               656D371D0ADBA5DE00A4554D /* WebDataProtocol.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = WebDataProtocol.mm; sourceTree = "<group>"; };
                656D371E0ADBA5DE00A4554D /* DocumentLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DocumentLoader.h; sourceTree = "<group>"; };
                656D371F0ADBA5DE00A4554D /* DocumentLoaderMac.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = DocumentLoaderMac.mm; sourceTree = "<group>"; };
                656D37220ADBA5DE00A4554D /* FormState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FormState.h; sourceTree = "<group>"; };
                6593923509AE4346002C531F /* KURL.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = KURL.cpp; sourceTree = "<group>"; };
                6593923609AE4346002C531F /* KURL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KURL.h; sourceTree = "<group>"; };
                6593923909AE435C002C531F /* KURLMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KURLMac.mm; sourceTree = "<group>"; };
+               659A7D120B6DB4D9001155B3 /* SubstituteData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SubstituteData.h; sourceTree = "<group>"; };
                659DDC8009E198BA001BF3C6 /* JSDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocument.cpp; sourceTree = "<group>"; };
                659DDC8109E198BA001BF3C6 /* JSDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSDocument.h; sourceTree = "<group>"; };
                65A21467097A329100B9050A /* Page.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Page.h; sourceTree = "<group>"; };
                                656D371A0ADBA5DE00A4554D /* LoaderNSURLExtras.h */,
                                656D371B0ADBA5DE00A4554D /* LoaderNSURLExtras.m */,
                                656D372C0ADBA5DE00A4554D /* NetscapePlugInStreamLoaderMac.mm */,
-                               656D371C0ADBA5DE00A4554D /* WebDataProtocol.h */,
-                               656D371D0ADBA5DE00A4554D /* WebDataProtocol.mm */,
                                656D372D0ADBA5DE00A4554D /* WebPlugInStreamLoaderDelegate.h */,
                        );
                        path = mac;
                BCB16BFB0979C38700467741 /* loader */ = {
                        isa = PBXGroup;
                        children = (
+                               659A7D120B6DB4D9001155B3 /* SubstituteData.h */,
                                5126E6B60A2E3AEF005C29FA /* icon */,
                                93A1EAA20A5634D8006960A0 /* mac */,
                                BCB16BFE0979C3BD00467741 /* Cache.cpp */,
                                85B4996B0ADB3FF500925CBB /* DOMSVGPathElement.h in Headers */,
                                85B499780ADB425E00925CBB /* DOMSVGPathElementInternal.h in Headers */,
                                656D37320ADBA5DE00A4554D /* LoaderNSURLExtras.h in Headers */,
-                               656D37340ADBA5DE00A4554D /* WebDataProtocol.h in Headers */,
                                656D37360ADBA5DE00A4554D /* DocumentLoader.h in Headers */,
                                656D373A0ADBA5DE00A4554D /* FormState.h in Headers */,
                                656D373C0ADBA5DE00A4554D /* FrameLoader.h in Headers */,
                                E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */,
                                A84947AD0B67F4A10069F00F /* SVGTransformDistance.h in Headers */,
                                AA0972CD0B6947A800A705E9 /* SVGInlineTextBox.h in Headers */,
+                               659A7D130B6DB4D9001155B3 /* SubstituteData.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
                        projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
                                85CE1B020ADADA96003BBDEA /* DOMSVGPathSegInternal.mm in Sources */,
                                85B4996C0ADB3FF500925CBB /* DOMSVGPathElement.mm in Sources */,
                                656D37330ADBA5DE00A4554D /* LoaderNSURLExtras.m in Sources */,
-                               656D37350ADBA5DE00A4554D /* WebDataProtocol.mm in Sources */,
                                656D37370ADBA5DE00A4554D /* DocumentLoaderMac.mm in Sources */,
                                656D373B0ADBA5DE00A4554D /* FormState.cpp in Sources */,
                                656D37440ADBA5DE00A4554D /* NetscapePlugInStreamLoaderMac.mm in Sources */,
index 1bb93c7c4fd8ef49f22df9a7769fb3a59c255853..5b33a1532c3634b169bd6a43fac7b00a1ed96ea0 100644 (file)
 #include <KURL.h>
 #include <wtf/Vector.h>
 
-#if PLATFORM(MAC)
-#include <CoreFoundation/CoreFoundation.h>
-#endif
-
 namespace WebCore {
 
 CachedResource::CachedResource(const String& URL, Type type, CachePolicy cachePolicy, unsigned size)
index 7fbe92625274b9d9cb872b4f9515834a90ee7ba7..e6ebadaa989d1c5068bb2ea1d09dbd1a8089eaf4 100644 (file)
 #include <wtf/Vector.h>
 #include <time.h>
 
-#if PLATFORM(MAC)
-#include "RetainPtr.h"
-
-#ifdef __OBJC__
-@class NSURLRequest;
-#else
-class NSURLRequest;
-#endif
-
-#endif // PLATFORM(MAC)
-
 namespace WebCore {
 
 class Cache;
index 27d9b30443417e24f7d61dad42045f0675b67f7b..183b362723fb40239ff8210941314e8733e43a43 100644 (file)
@@ -121,10 +121,8 @@ CachedResource* DocLoader::requestResource(CachedResource::Type type, const Stri
 {
     KURL fullURL = m_doc->completeURL(url.deprecatedString());
 
-#if PLATFORM(MAC) || PLATFORM(QT)
     if (m_frame && m_frame->loader()->isReloading())
         setCachePolicy(CachePolicyReload);
-#endif
 
     checkForReload(fullURL);
 
index a76efb0bdccaa96c797bd43ca58ad936bf35f802..c72df6daec92ac1ce5d60fc044ea56f653804eae 100644 (file)
 #include "XMLTokenizer.h"
 #include <wtf/Assertions.h>
 
-#if PLATFORM(MAC)
-#import "WebCoreSystemInterface.h"
-#import "WebDataProtocol.h"
-#endif
-
 namespace WebCore {
 
 /*
@@ -104,9 +99,10 @@ static inline String canonicalizedTitle(const String& title, Frame* frame)
     return String::adopt(stringBuilder);
 }
 
-DocumentLoader::DocumentLoader(const ResourceRequest& req)
+DocumentLoader::DocumentLoader(const ResourceRequest& req, const SubstituteData& substituteData)
     : m_frame(0)
     , m_originalRequest(req)
+    , m_substituteData(substituteData)
     , m_originalRequestCopy(req)
     , m_request(req)
     , m_committed(false)
@@ -192,10 +188,7 @@ void DocumentLoader::setRequest(const ResourceRequest& req)
     // redirect at this point, but we can replace a committed dataSource.
     bool handlingUnreachableURL = false;
 
-#if PLATFORM(MAC)
-    // FIXME: need a better way to handle data loads
-    handlingUnreachableURL = [req.nsURLRequest() _webDataRequestUnreachableURL];
-#endif
+    handlingUnreachableURL = substituteData().isValid();
 
     if (handlingUnreachableURL)
         m_committed = false;
@@ -516,10 +509,8 @@ KURL DocumentLoader::urlForHistory() const
     // Return the URL to be used for history and B/F list.
     // Returns nil for WebDataProtocol URLs that aren't alternates 
     // for unreachable URLs, because these can't be stored in history.
-#if PLATFORM(MAC)        
-    if (!m_originalRequestCopy.url().isEmpty() && [WebDataProtocol _webIsDataProtocolURL:m_originalRequestCopy.url().getNSURL()])
-        return [m_originalRequestCopy.nsURLRequest() _webDataRequestUnreachableURL];
-#endif
+    if (m_substituteData.isValid())
+        return unreachableURL();
 
     return m_originalRequestCopy.url();
 }
@@ -582,4 +573,9 @@ String DocumentLoader::responseMIMEType() const
     return m_response.mimeType();
 }
 
+const KURL& DocumentLoader::unreachableURL() const
+{
+    return m_substituteData.failingURL();
+}
+
 }
index 276e6f95e761b199514b5c65cb655a3b70d3a1dd..97ea4107462b78d270c3855abe6faf101f9256d2 100644 (file)
 #include "ResourceError.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
+#include "SubstituteData.h"
 #include <wtf/Vector.h>
 
-#if PLATFORM(MAC)
-
-#include "RetainPtr.h"
-
-#ifndef __OBJC__
-
-class NSData;
-
-#endif
-
-#endif
-
 namespace WebCore {
 
     class Frame;
@@ -56,12 +45,13 @@ namespace WebCore {
     class KURL;
     class PageCache;
     class SharedBuffer;
+    class SubstituteData;
 
     typedef Vector<ResourceResponse> ResponseVector;
 
     class DocumentLoader : public Shared<DocumentLoader> {
     public:
-        DocumentLoader(const ResourceRequest&);
+        DocumentLoader(const ResourceRequest&, const SubstituteData&);
         virtual ~DocumentLoader();
 
         void setFrame(Frame*);
@@ -81,8 +71,10 @@ namespace WebCore {
         ResourceRequest& actualRequest();
         const ResourceRequest& initialRequest() const;
 
+        const SubstituteData& substituteData() const { return m_substituteData; }
+
         const KURL& URL() const;
-        const KURL unreachableURL() const;
+        const KURL& unreachableURL() const;
 
         KURL originalURL() const;
         KURL requestURL() const;
@@ -149,7 +141,9 @@ namespace WebCore {
         // This should only be used by the resourceLoadDelegate's
         // identifierForInitialRequest:fromDatasource: method. It is
         // not guaranteed to remain unchanged, as requests are mutable.
-        ResourceRequest m_originalRequest;    
+        ResourceRequest m_originalRequest;   
+
+        SubstituteData m_substituteData;
 
         // A copy of the original request used to create the data source.
         // We have to copy the request because requests are mutable.
index 66b0a9fb2159a9dd3b9eba5177b08bb2ddc5dcfd..0bcff0949e29ddfebcd06e3f445ade51d26328e0 100644 (file)
@@ -83,7 +83,6 @@
 
 #if PLATFORM(MAC)
 #include "FrameMac.h"
-#import "WebDataProtocol.h"
 #endif
 
 using namespace KJS;
@@ -1803,10 +1802,15 @@ void FrameLoader::load(const KURL& URL, const String& referrer, FrameLoadType ne
 }
 
 void FrameLoader::load(const ResourceRequest& request)
+{
+    load(request, SubstituteData());
+}
+
+void FrameLoader::load(const ResourceRequest& request, const SubstituteData& substituteData)
 {
     // FIXME: is this the right place to reset loadType? Perhaps this should be done after loading is finished or aborted.
     m_loadType = FrameLoadTypeStandard;
-    load(m_client->createDocumentLoader(request).get());
+    load(m_client->createDocumentLoader(request, substituteData).get());
 }
 
 void FrameLoader::load(const ResourceRequest& request, const String& frameName)
@@ -1827,7 +1831,7 @@ void FrameLoader::load(const ResourceRequest& request, const String& frameName)
 
 void FrameLoader::load(const ResourceRequest& request, const NavigationAction& action, FrameLoadType type, PassRefPtr<FormState> formState)
 {
-    RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request);
+    RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, SubstituteData());
     setPolicyDocumentLoader(loader.get());
 
     loader->setTriggeringAction(action);
@@ -1858,7 +1862,7 @@ void FrameLoader::load(DocumentLoader* newDocumentLoader)
     // When we loading alternate content for an unreachable URL that we're
     // visiting in the b/f list, we treat it as a reload so the b/f list 
     // is appropriately maintained.
-    if (shouldReloadToHandleUnreachableURL(newDocumentLoader->originalRequest())) {
+    if (shouldReloadToHandleUnreachableURL(newDocumentLoader)) {
         ASSERT(type == FrameLoadTypeStandard);
         type = FrameLoadTypeReload;
     }
@@ -1953,12 +1957,9 @@ void FrameLoader::checkContentPolicy(const String& MIMEType, ContentPolicyDecisi
         MIMEType, activeDocumentLoader()->request());
 }
 
-bool FrameLoader::shouldReloadToHandleUnreachableURL(const ResourceRequest& request)
+bool FrameLoader::shouldReloadToHandleUnreachableURL(DocumentLoader* docLoader)
 {
-    KURL unreachableURL;
-#if PLATFORM(MAC)
-    unreachableURL = [request.nsURLRequest() _webDataRequestUnreachableURL];
-#endif
+    KURL unreachableURL = docLoader->unreachableURL();
 
     if (unreachableURL.isEmpty())
         return false;
@@ -1992,7 +1993,7 @@ void FrameLoader::reloadAllowingStaleData(const String& encoding)
 
     request.setCachePolicy(ReturnCacheDataElseLoad);
 
-    RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request);
+    RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, SubstituteData());
     setPolicyDocumentLoader(loader.get());
 
     loader->setOverrideEncoding(encoding);
@@ -2013,14 +2014,11 @@ void FrameLoader::reload()
         return;
 
     // Replace error-page URL with the URL we were trying to reach.
-    KURL unreachableURL;
-#if PLATFORM(MAC)
-    unreachableURL = [initialRequest.nsURLRequest() _webDataRequestUnreachableURL];
-#endif
+    KURL unreachableURL = m_documentLoader->unreachableURL();
     if (!unreachableURL.isEmpty())
         initialRequest = ResourceRequest(unreachableURL);
     
-    RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(initialRequest);
+    RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(initialRequest, SubstituteData());
     setPolicyDocumentLoader(loader.get());
 
     ResourceRequest& request = loader->request();
@@ -2300,10 +2298,6 @@ void FrameLoader::commitProvisionalLoad(PassRefPtr<PageCache> prpPageCache)
         pageState->clear();
     } else {        
         KURL url = pdl->URL();
-        KURL dataURLBase = dataURLBaseFromRequest(pdl->request());
-        if (!dataURLBase.isEmpty())
-            url = dataURLBase;
-            
         if (url.isEmpty())
             url = pdl->responseURL();
         if (url.isEmpty())
@@ -3025,20 +3019,20 @@ void FrameLoader::loadResourceSynchronously(const ResourceRequest& request, Reso
     sendRemainingDelegateMessages(identifier, response, data.size(), error);
 }
 
-bool FrameLoader::startLoadingMainResource(ResourceRequest& request, unsigned long identifier)
+bool FrameLoader::startLoadingMainResource(DocumentLoader* docLoader, unsigned long identifier)
 {
     ASSERT(!m_mainResourceLoader);
     m_mainResourceLoader = MainResourceLoader::create(m_frame);
     m_mainResourceLoader->setIdentifier(identifier);
+
+    ResourceRequest& request = docLoader->actualRequest();
     
     // FIXME: is there any way the extra fields could have not been added by now?
     addExtraFieldsToRequest(request, true, false);
-    if (!m_mainResourceLoader->load(request)) {
+    if (!m_mainResourceLoader->load(request, docLoader->substituteData())) {
         // FIXME: If this should really be caught, we should just ASSERT this doesn't happen;
         // should it be caught by other parts of WebKit or other parts of the app?
-#if PLATFORM(MAC)
-        LOG_ERROR("could not create WebResourceHandle for URL %@ -- should be caught by policy handler level", request.url().getNSURL());
-#endif
+        LOG_ERROR("could not create WebResourceHandle for URL %s -- should be caught by policy handler level", request.url().url().ascii());
         m_mainResourceLoader = 0;
         return false;
     }
@@ -3061,7 +3055,7 @@ void FrameLoader::startLoading()
     unsigned long identifier = m_frame->page()->progress()->createUniqueIdentifier();
     m_client->assignIdentifierToInitialRequest(identifier, m_provisionalDocumentLoader.get(), m_provisionalDocumentLoader->originalRequest());
 
-    if (!startLoadingMainResource(m_provisionalDocumentLoader->actualRequest(), identifier))
+    if (!startLoadingMainResource(m_provisionalDocumentLoader.get(), identifier))
         m_provisionalDocumentLoader->updateLoading();
 }
 
@@ -3226,15 +3220,6 @@ void FrameLoader::opened()
     }
 }
 
-KURL FrameLoader::dataURLBaseFromRequest(const ResourceRequest& request) const
-{
-#if PLATFORM(MAC)
-    if (WebDataRequestParameters* params = [request.nsURLRequest() _webDataRequestParametersForReading])
-        return params->baseURL;
-#endif
-    return KURL();
-}
-
 void FrameLoader::checkNewWindowPolicy(const NavigationAction& action, const ResourceRequest& request,
     PassRefPtr<FormState> formState, const String& frameName)
 {
@@ -3282,14 +3267,12 @@ void FrameLoader::checkNavigationPolicy(const ResourceRequest& request, Document
     
     // We are always willing to show alternate content for unreachable URLs;
     // treat it like a reload so it maintains the right state for b/f list.
-#if PLATFORM(MAC)
-    if ([request.nsURLRequest() _webDataRequestUnreachableURL]) {
+    if (loader->substituteData().isValid()) {
         if (isBackForwardLoadType(m_policyLoadType))
             m_policyLoadType = FrameLoadTypeReload;
         function(argument, request, 0, true);
         return;
     }
-#endif
     
     loader->setLastCheckedRequest(request);
 
index 109a47d33dbdb1869f7c2cbb0e87b057f31eead4..5f6da6af04a287f18a60cadcad7f232f1f3f23f1 100644 (file)
@@ -72,6 +72,7 @@ namespace WebCore {
     class ResourceResponse;
     class SharedBuffer;
     class SubresourceLoader;
+    class SubstituteData;
     class TextResourceDecoder;
     class Widget;
 
@@ -142,6 +143,7 @@ namespace WebCore {
             Event*, HTMLFormElement*, const HashMap<String, String>& formValues);
 
         void load(const ResourceRequest&);
+        void load(const ResourceRequest&, const SubstituteData&);
         void load(const ResourceRequest&, const String& frameName);
         void load(const ResourceRequest&, const NavigationAction&, FrameLoadType, PassRefPtr<FormState>);
         
@@ -468,7 +470,7 @@ namespace WebCore {
 
         // Also not cool.
         void startLoading();
-        bool startLoadingMainResource(ResourceRequest&, unsigned long identifier);
+        bool startLoadingMainResource(DocumentLoader*, unsigned long identifier);
         void stopLoadingSubframes();
 
         void clearProvisionalLoad();
@@ -518,7 +520,7 @@ namespace WebCore {
         void opened();
         void updateHistoryAfterClientRedirect();
 
-        bool shouldReloadToHandleUnreachableURL(const ResourceRequest&);
+        bool shouldReloadToHandleUnreachableURL(DocumentLoader* docLoader);
         void handleUnimplementablePolicy(const ResourceError&);
 
         void applyUserAgent(ResourceRequest& request);
index 97c090de427f2c58496f687092623d6892745db9..50ae7c65ca71db85518fd69d2ee6abd93701a85f 100644 (file)
@@ -52,6 +52,8 @@ namespace WebCore {
     class ResourceLoader;
     class ResourceRequest;
     class ResourceResponse;
+    class SharedBuffer;
+    class SubstituteData;
     class String;
     class Widget;
 
@@ -175,7 +177,7 @@ namespace WebCore {
         virtual void didFinishLoad() = 0;
         virtual void prepareForDataSourceReplacement() = 0;
 
-        virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&) = 0;
+        virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest&, const SubstituteData&) = 0;
         virtual void setTitle(const String& title, const KURL&) = 0;
 
         virtual String userAgent() = 0;
index d971a618ee85dd3b44d3613981ec1e5061b58b94..4b677446d2f9a1298312416befe719abc28d2b8b 100644 (file)
 #include "ResourceError.h"
 #include "ResourceHandle.h"
 
-#if PLATFORM(MAC)
-#import "WebDataProtocol.h"
-#endif
-
 // FIXME: More that is in common with SubresourceLoader should move up into ResourceLoader.
 
 namespace WebCore {
@@ -158,15 +154,10 @@ void MainResourceLoader::willSendRequest(ResourceRequest& newRequest, const Reso
     if (newRequest.cachePolicy() == UseProtocolCachePolicy && isPostOrRedirectAfterPost(newRequest, redirectResponse))
         newRequest.setCachePolicy(ReloadIgnoringCacheData);
 
-#if PLATFORM(MAC)
-    ResourceRequest r([newRequest.nsURLRequest() _webDataRequestExternalRequest]);
-    if (!r.isNull()) {
-        ResourceLoader::willSendRequest(r, redirectResponse);
-        if (request() == r)
-            setRequest(newRequest);
-    } else
-#endif
-    ResourceLoader::willSendRequest(newRequest, redirectResponse);
+    if (!newRequest.isNull()) {
+        ResourceLoader::willSendRequest(newRequest, redirectResponse);
+        setRequest(newRequest);
+    }
     
     // Don't set this on the first request. It is set when the main load was started.
     frameLoader()->setRequest(newRequest);
@@ -189,9 +180,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy,
     case PolicyUse: {
         // Prevent remote web archives from loading because they can claim to be from any domain and thus avoid cross-domain security checks (4120255).
         bool isRemote = !url.isLocalFile();
-#if PLATFORM(MAC)
-        isRemote = isRemote && ![WebDataProtocol _webIsDataProtocolURL:url.getNSURL()];
-#endif
+        isRemote = isRemote && !m_substituteData.isValid();
         bool isRemoteWebArchive = isRemote && equalIgnoringCase("application/x-webarchive", mimeType);
         if (!frameLoader()->canShowMIMEType(mimeType) || isRemoteWebArchive) {
             frameLoader()->cannotShowMIMEType(r);
@@ -233,22 +222,16 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy,
     }
 
     // we may have cancelled this load as part of switching to fallback content
-    if (!reachedTerminalState()) {
-#if PLATFORM(MAC) 
-        // If the URL is one of our whacky applewebdata URLs then
-        // fake up a substitute URL to present to the delegate.
-        if ([WebDataProtocol _webIsDataProtocolURL:[r.nsURLResponse() URL]]) 
-            ResourceLoader::didReceiveResponse([[[NSURLResponse alloc] initWithURL:[request().nsURLRequest() _webDataRequestExternalURL] MIMEType:r.mimeType()
-                                                 expectedContentLength:r.expectedContentLength() textEncodingName:r.textEncodingName()] autorelease]);
-        else
-#endif
+    if (!reachedTerminalState())
         ResourceLoader::didReceiveResponse(r);
-    }
 
-    if (frameLoader() && !frameLoader()->isStopping()
-            && (shouldLoadAsEmptyDocument(url)
-                || frameLoader()->representationExistsForURLScheme(url.protocol())))
-        didFinishLoading();
+    if (frameLoader() && !frameLoader()->isStopping())
+        if (m_substituteData.isValid()) {
+            didReceiveData(m_substituteData.content()->data(), m_substituteData.content()->size(), m_substituteData.content()->size(), true);
+            if (frameLoader() && !frameLoader()->isStopping()) 
+                didFinishLoading();
+        } else if (shouldLoadAsEmptyDocument(url) || frameLoader()->representationExistsForURLScheme(url.protocol()))
+            didFinishLoading();
 }
 
 void MainResourceLoader::callContinueAfterContentPolicy(void* argument, PolicyAction policy)
@@ -323,6 +306,26 @@ void MainResourceLoader::didFail(const ResourceError& error)
     receivedError(error);
 }
 
+void MainResourceLoader::handleEmptyLoad(const KURL& url, bool forURLScheme)
+{
+    String mimeType;
+    if (forURLScheme)
+        mimeType = frameLoader()->generatedMIMETypeForURLScheme(url.protocol());
+    else
+        mimeType = "text/html";
+    
+    ResourceResponse response(url, mimeType, 0, String(), String());
+    didReceiveResponse(response);
+}
+
+void MainResourceLoader::handleDataLoad(ResourceRequest& r)
+{
+    RefPtr<MainResourceLoader> protect(this);
+
+    ResourceResponse response(r.url(), m_substituteData.mimeType(), m_substituteData.content()->size(), m_substituteData.textEncoding(), "");
+    didReceiveResponse(response);
+}
+
 bool MainResourceLoader::loadNow(ResourceRequest& r)
 {
     bool shouldLoadEmptyBeforeRedirect = shouldLoadAsEmptyDocument(r.url());
@@ -346,26 +349,22 @@ bool MainResourceLoader::loadNow(ResourceRequest& r)
     if (shouldLoadEmptyBeforeRedirect && !shouldLoadEmpty && defersLoading())
         return true;
 
-    if (shouldLoadEmpty || frameLoader()->representationExistsForURLScheme(url.protocol())) {
-        String mimeType;
-        if (shouldLoadEmpty)
-            mimeType = "text/html";
-        else
-            mimeType = frameLoader()->generatedMIMETypeForURLScheme(url.protocol());
-
-        ResourceResponse response(url, mimeType, 0, String(), String());
-        didReceiveResponse(response);
-    } else {
+    if (m_substituteData.isValid())
+        handleDataLoad(r);
+    else if (shouldLoadEmpty || frameLoader()->representationExistsForURLScheme(url.protocol()))
+        handleEmptyLoad(url, !shouldLoadEmpty);
+    else
         m_handle = ResourceHandle::create(r, this, m_frame.get(), false, true);
-    }
 
     return false;
 }
 
-bool MainResourceLoader::load(const ResourceRequest& r)
+bool MainResourceLoader::load(const ResourceRequest& r, const SubstituteData&  substituteData)
 {
     ASSERT(!m_handle);
 
+    m_substituteData = substituteData;
+
     ResourceRequest request(r);
     bool defer = defersLoading();
     if (defer) {
@@ -380,7 +379,7 @@ bool MainResourceLoader::load(const ResourceRequest& r)
             defer = true;
         }
     }
-    if (defer) 
+    if (defer)
         m_initialRequest = request;
 
     return true;
index 60497cbddaf227b6e16ad9e758817d942fa9d9ec..a76f39f4ee8a7ac1a279471798a5a7cd90096929 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "FrameLoaderTypes.h"
 #include "ResourceLoader.h"
+#include "SubstituteData.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -40,7 +41,7 @@ namespace WebCore {
         static PassRefPtr<MainResourceLoader> create(Frame*);
         virtual ~MainResourceLoader();
 
-        virtual bool load(const ResourceRequest&);
+        virtual bool load(const ResourceRequest&, const SubstituteData&);
         virtual void addData(const char*, int, bool allAtOnce);
 
         virtual void setDefersLoading(bool);
@@ -58,6 +59,9 @@ namespace WebCore {
 
         bool loadNow(ResourceRequest&);
 
+        void handleEmptyLoad(const KURL&, bool forURLScheme);
+        void handleDataLoad(ResourceRequest&);
+
         void receivedError(const ResourceError&);
         ResourceError interruptionForPolicyChangeError() const;
         void stopLoadingForPolicyChange();
@@ -71,6 +75,7 @@ namespace WebCore {
         void continueAfterContentPolicy(PolicyAction, const ResourceResponse&);
 
         ResourceRequest m_initialRequest;
+        SubstituteData m_substituteData;
 
         bool m_loadingMultipartContent;
         bool m_waitingForContentPolicy;
index 6e4ab6a93ffa3eeb45f6fca61f48cf358a458e1e..ef4c4457ea51d412839a7eb468730049b91c7910 100644 (file)
 #import "config.h"
 #import "DocumentLoader.h"
 
-#import "WebDataProtocol.h"
 #import "WebCoreSystemInterface.h"
 
 namespace WebCore {
 
-const KURL DocumentLoader::unreachableURL() const
-{
-    return [m_originalRequest.nsURLRequest() _webDataRequestUnreachableURL];
-}
-
 bool DocumentLoader::getResponseModifiedHeader(String& modified) const
 {
     NSURLResponse *response = m_response.nsURLResponse();
diff --git a/WebCore/loader/mac/WebDataProtocol.h b/WebCore/loader/mac/WebDataProtocol.h
deleted file mode 100644 (file)
index 45373c4..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Foundation/Foundation.h>
-
-#import <Foundation/NSURLRequest.h>
-#import <Foundation/NSURLProtocol.h>
-
-
-extern NSString *WebDataRequestPropertyKey;
-
-@interface WebDataRequestParameters : NSObject <NSCopying>
-{
-@public
-    NSData *data;
-    NSString *MIMEType;
-    NSString *encoding;
-    NSURL *baseURL;
-    NSURL *unreachableURL;
-}
-@end
-
-@interface WebDataProtocol : NSURLProtocol
-{
-}
-+ (BOOL)_webIsDataProtocolURL:(NSURL *)URL;
-@end
-
-@interface NSURL (WebDataURL)
-+ (NSURL *)_web_uniqueWebDataURL;
-+ (NSURL *)_web_uniqueWebDataURLWithRelativeString:(NSString *)string;
-@end
-
-@interface NSURLRequest (WebDataRequest)
-- (WebDataRequestParameters *)_webDataRequestParametersForReading;
-+ (NSString *)_webDataRequestPropertyKey;
-- (NSURL *)_webDataRequestBaseURL;
-- (NSURL *)_webDataRequestUnreachableURL;
-- (NSURL *)_webDataRequestExternalURL;
-- (NSData *)_webDataRequestData;
-- (NSString *)_webDataRequestEncoding;
-- (NSString *)_webDataRequestMIMEType;
-- (NSMutableURLRequest *)_webDataRequestExternalRequest;
-@end
-
-@interface NSMutableURLRequest (WebDataRequest)
-- (void)_webDataRequestSetData:(NSData *)data;
-- (void)_webDataRequestSetEncoding:(NSString *)encoding;
-- (void)_webDataRequestSetMIMEType:(NSString *)MIMEType;
-- (void)_webDataRequestSetBaseURL:(NSURL *)baseURL;
-- (void)_webDataRequestSetUnreachableURL:(NSURL *)unreachableURL;
-@end
-
diff --git a/WebCore/loader/mac/WebDataProtocol.mm b/WebCore/loader/mac/WebDataProtocol.mm
deleted file mode 100644 (file)
index afc27d3..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "WebDataProtocol.h"
-
-#import <Foundation/NSURLResponse.h>
-#import <wtf/Assertions.h>
-
-NSString *WebDataProtocolScheme = @"applewebdata";
-NSString *WebDataRequestPropertyKey = @"WebDataRequest";
-
-@implementation WebDataRequestParameters
-
--(id)copyWithZone:(NSZone *)zone
-{
-    WebDataRequestParameters *newInstance = [[WebDataRequestParameters allocWithZone:zone] init];
-    newInstance->data = [data copyWithZone:zone];
-    newInstance->encoding = [encoding copyWithZone:zone];
-    newInstance->baseURL = [baseURL copyWithZone:zone];
-    newInstance->unreachableURL = [unreachableURL copyWithZone:zone];
-    newInstance->MIMEType = [MIMEType copyWithZone:zone];
-    return newInstance;
-}
-
-- (void)dealloc
-{
-    [data release];
-    [MIMEType release];
-    [encoding release];
-    [baseURL release];
-    [unreachableURL release];
-    [super dealloc];
-}
-
-@end
-
-@implementation NSURL (WebDataURL)
-
-+ (NSURL *)_web_uniqueWebDataURL
-{
-    static BOOL registered;
-    
-    if (!registered) {
-        [NSURLProtocol registerClass:[WebDataProtocol class]];
-        registered = YES;
-    }
-    
-    CFUUIDRef UUIDRef = CFUUIDCreate(kCFAllocatorDefault);
-    NSString *UUIDString = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, UUIDRef);
-    CFRelease(UUIDRef);
-    NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@", WebDataProtocolScheme, UUIDString]];
-    CFRelease(UUIDString);
-    return URL;
-}
-
-+ (NSURL *)_web_uniqueWebDataURLWithRelativeString:(NSString *)string
-{
-    return [NSURL URLWithString:string relativeToURL:[self _web_uniqueWebDataURL]];
-}
-
-@end
-
-
-@implementation NSURLRequest (WebDataRequest)
-
-+ (NSString *)_webDataRequestPropertyKey
-{
-    return WebDataRequestPropertyKey;
-}
-
-- (WebDataRequestParameters *)_webDataRequestParametersForReading
-{
-    return [NSURLProtocol propertyForKey:WebDataRequestPropertyKey inRequest:self];
-}
-
-- (NSData *)_webDataRequestData
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForReading];
-    return parameters ? parameters->data : nil;
-}
-
-- (NSString *)_webDataRequestEncoding
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForReading];
-    return parameters ? parameters->encoding : nil;
-}
-
-- (NSString *)_webDataRequestMIMEType
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForReading];
-    return parameters ? parameters->MIMEType : nil;
-}
-
-- (NSURL *)_webDataRequestBaseURL
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForReading];
-    return parameters ? parameters->baseURL : nil;
-}
-
-- (NSURL *)_webDataRequestUnreachableURL
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForReading];
-    return parameters ? parameters->unreachableURL : nil;
-}
-
-- (NSURL *)_webDataRequestExternalURL
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForReading];
-    if (!parameters) {
-        return nil;
-    }
-    
-    if (parameters->baseURL) {
-        return parameters->baseURL;
-    }
-    
-    return [NSURL URLWithString:@"about:blank"];
-}
-
-- (NSMutableURLRequest *)_webDataRequestExternalRequest
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForReading];
-    NSMutableURLRequest *newRequest = nil;
-    
-    if (parameters){
-        newRequest = [[self mutableCopyWithZone:[self zone]] autorelease];
-        [newRequest setURL:[self _webDataRequestExternalURL]];
-    } 
-    return newRequest;
-}
-
-@end
-
-@implementation NSMutableURLRequest (WebDataRequest)
-
-- (WebDataRequestParameters *)_webDataRequestParametersForWriting
-{
-    WebDataRequestParameters *result = [NSURLProtocol propertyForKey:WebDataRequestPropertyKey inRequest:self];
-    if (!result) {
-        result = [[WebDataRequestParameters alloc] init];
-        [NSURLProtocol setProperty:result forKey:WebDataRequestPropertyKey inRequest:self];
-        [result release];
-    }
-    return result;
-}
-
-- (void)_webDataRequestSetData:(NSData *)data
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForWriting];
-    [parameters->data release];
-    parameters->data = [data retain];
-}
-
-- (void)_webDataRequestSetEncoding:(NSString *)encoding
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForWriting];
-    [parameters->encoding release];
-    parameters->encoding = [encoding retain];
-}
-
-- (void)_webDataRequestSetMIMEType:(NSString *)type
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForWriting];
-    [parameters->MIMEType release];
-    parameters->MIMEType = [type retain];
-}
-
-- (void)_webDataRequestSetBaseURL:(NSURL *)baseURL
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForWriting];
-    [parameters->baseURL release];
-    parameters->baseURL = [baseURL retain];
-}
-
-- (void)_webDataRequestSetUnreachableURL:(NSURL *)unreachableURL
-{
-    WebDataRequestParameters *parameters = [self _webDataRequestParametersForWriting];
-    [parameters->unreachableURL release];
-    parameters->unreachableURL = [unreachableURL retain];
-}
-
-@end
-
-
-
-// Implement the required methods for the concrete subclass of WebProtocolHandler
-// that will handle our custom protocol.
-@implementation WebDataProtocol
-
-static BOOL isCaseInsensitiveEqual(NSString *a, NSString *b)
-{
-    return [a caseInsensitiveCompare:b] == NSOrderedSame;
-}
-
-+(BOOL)_webIsDataProtocolURL:(NSURL *)URL
-{
-    ASSERT(URL);
-    NSString *scheme = [URL scheme];
-    return scheme && isCaseInsensitiveEqual(scheme, WebDataProtocolScheme);
-}
-
-+(BOOL)canInitWithRequest:(NSURLRequest *)request
-{
-    NSURL *URL = [request URL];
-    ASSERT(request);
-    ASSERT(URL);
-    return [self _webIsDataProtocolURL:URL];
-}
-
-+(NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request
-{
-    return request;
-}
-
-- (void)startLoading
-{
-    id<NSURLProtocolClient> client = [self client];
-    NSURLRequest *request = [self request];
-    NSData *data = [request _webDataRequestData];
-
-    if (data) {
-        NSURLResponse *response = [[NSURLResponse alloc] initWithURL:[request URL] MIMEType:[request _webDataRequestMIMEType] expectedContentLength:[data length] textEncodingName:[request _webDataRequestEncoding]];
-        [client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
-        [client URLProtocol:self didLoadData:data];
-        [client URLProtocolDidFinishLoading:self];
-        [response release];
-    } else {
-        NSError *error = [[[NSError alloc] initWithDomain:NSURLErrorDomain code:NSURLErrorResourceUnavailable userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
-            [request URL], @"NSErrorFailingURLKey",
-            [[request URL] absoluteString], @"NSErrorFailingURLStringKey",
-            nil, NSLocalizedDescriptionKey,
-            nil]] autorelease];
-        
-        [client URLProtocol:self didFailWithError:error];
-    }
-}
-
-- (void)stopLoading
-{
-}
-
-@end
-
index 5bf8fb8db750383b929ebe972206f5ec328c245a..618da5c94eafd3b6520620d9bda33eb2bcc2f014 100644 (file)
 
 namespace WebCore {
 
-const KURL DocumentLoader::unreachableURL() const
-{
-    KURL url;
-    notImplemented();
-    return url;
-}
-
 bool DocumentLoader::getResponseModifiedHeader(WebCore::String&) const
 {
     notImplemented();
index a464581ebbe3a5b06adecb28a38f2034cd64a4eb..b441016ceefa4042c3f951329d4131c9b9265d63 100644 (file)
@@ -34,6 +34,7 @@
 #include "EditorClient.h"
 #include "FocusDirection.h"
 #include "FrameLoaderClient.h"
+#include "SharedBuffer.h"
 
 /*
  This file holds empty Client stubs for use by SVGImage.
@@ -233,7 +234,7 @@ public:
     virtual void didFinishLoad() { }
     virtual void prepareForDataSourceReplacement() { }
     
-    virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest& request) { return new DocumentLoader(request); }
+    virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) { return new DocumentLoader(request, substituteData); }
     virtual void setTitle(const String& title, const KURL&) { }
     
     virtual String userAgent() { return ""; }
index 2fc1d8d1ad786d847ecdb68f40b14c5744eee852..24dbdf7393b1eee8b79c5f7cad99ee62565a3163 100644 (file)
@@ -1,3 +1,27 @@
+2007-01-29  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Mark.
+
+        - updated for cross-platform data loading support
+        
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::createDocumentLoader):
+        * WebView/WebDataSource.mm:
+        (-[WebDataSource initWithRequest:]):
+        * WebView/WebDocumentLoaderMac.h:
+        * WebView/WebDocumentLoaderMac.mm:
+        (WebDocumentLoaderMac::WebDocumentLoaderMac):
+        * WebView/WebFrame.mm:
+        (-[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:]):
+        (-[WebFrame loadData:MIMEType:textEncodingName:baseURL:]):
+        (-[WebFrame _loadHTMLString:baseURL:unreachableURL:]):
+        (-[WebFrame loadArchive:]):
+        * WebView/WebFrameInternal.h:
+        * WebView/WebHTMLView.mm:
+        (uniqueURLWithRelativePart):
+        (-[WebHTMLView _documentFragmentFromPasteboard:inContext:allowPlainText:chosePlainText:]):
+
 2007-01-27  David Kilzer  <ddkilzer@webkit.org>
 
         Reviewed by Adam.
index 10ad56748dcd94178f58c89506e6af61fc767ae0..baed716f523cf2bc36332c9d701a0c563535fe34 100644 (file)
@@ -176,7 +176,8 @@ private:
     virtual void provisionalLoadStarted();
     virtual void didFinishLoad();
     virtual void prepareForDataSourceReplacement();
-    virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&);
+    virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
+
     virtual void setTitle(const WebCore::String& title, const WebCore::KURL&);
 
     virtual WebCore::Frame* createFrame(const WebCore::KURL& url, const WebCore::String& name, WebCore::HTMLFrameOwnerElement*,
index 32a42a9437dc42b1471d1dda4e84ed0b6d55fc00..dc971c7314d76925474a948934d7ac27a03276e7 100644 (file)
@@ -91,7 +91,7 @@
 #import <WebCore/ResourceLoader.h>
 #import <WebCore/ResourceRequest.h>
 #import <WebCore/WebCoreFrameBridge.h>
-#import <WebCore/WebDataProtocol.h>
+#import <WebCore/SharedBuffer.h>
 #import <WebCore/Widget.h>
 #import <WebKit/DOMElement.h>
 #import <WebKit/DOMHTMLFormElement.h>
@@ -894,9 +894,9 @@ void WebFrameLoaderClient::prepareForDataSourceReplacement()
     core(m_webFrame.get())->loader()->detachChildren();
 }
 
-PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request)
+PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
 {
-    RefPtr<WebDocumentLoaderMac> loader = new WebDocumentLoaderMac(request);
+    RefPtr<WebDocumentLoaderMac> loader = new WebDocumentLoaderMac(request, substituteData);
 
     WebDataSource *dataSource = [[WebDataSource alloc] _initWithDocumentLoader:loader.get()];
     loader->setDataSource(dataSource);
index 3b9dcd8995756c28534ebf52ebe20b082a12841f..b8add176e8e3f8ae7f8332a3c72af0acbcdb63cb 100644 (file)
@@ -358,7 +358,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
 
 - (id)initWithRequest:(NSURLRequest *)request
 {
-    return [self _initWithDocumentLoader:new WebDocumentLoaderMac(request)];
+    return [self _initWithDocumentLoader:new WebDocumentLoaderMac(request, SubstituteData())];
 }
 
 - (void)dealloc
index bf914684db6e20d038c8412b3a01a14bd89e32c2..484663aa11655ee8ae071135dcbaa29b56dce151 100644 (file)
@@ -33,7 +33,7 @@
 class WebDocumentLoaderMac : public WebCore::DocumentLoader
 {
 public:
-    WebDocumentLoaderMac(const WebCore::ResourceRequest&);
+    WebDocumentLoaderMac(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
 
     void setDataSource(WebDataSource *);
     WebDataSource *dataSource() const;
index 43a797ca5452393c8c77707e6e737c9aa4c125f0..2f989e0b8424a92de8143d8da7860f3df8eb24fe 100644 (file)
 #import "WebDocumentLoaderMac.h"
 
 #import <JavaScriptCore/Assertions.h>
+#import <WebCore/SubstituteData.h>
 
 using namespace WebCore;
 
-WebDocumentLoaderMac::WebDocumentLoaderMac(const ResourceRequest& request)
-    : DocumentLoader(request)
+WebDocumentLoaderMac::WebDocumentLoaderMac(const ResourceRequest& request, const SubstituteData& substituteData)
+    : DocumentLoader(request, substituteData)
     , m_detachedDataSource(nil)
 {
 }
index 64c534166cd091d623e88ddcac1ed127a32f1de9..de3329205deb1d8d3f25db0ed593c9b4262d0c5e 100644 (file)
@@ -69,7 +69,7 @@
 #import <WebCore/HTMLFrameOwnerElement.h>
 #import <WebCore/Page.h>
 #import <WebCore/SelectionController.h>
-#import <WebCore/WebDataProtocol.h>
+#import <WebCore/SharedBuffer.h>
 #import <WebCore/FormState.h>
 #import <WebCore/ResourceRequest.h>
 #import <WebKit/DOMDocument.h>
@@ -263,19 +263,6 @@ WebView *getWebView(WebFrame *webFrame)
     return kit(coreFrame->page());
 }
 
-- (NSURLRequest *)_webDataRequestForData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL unreachableURL:(NSURL *)unreachableURL
-{
-    NSURL *fakeURL = [NSURL _web_uniqueWebDataURL];
-    NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL:fakeURL] autorelease];
-    [request _webDataRequestSetData:data];
-    [request _webDataRequestSetEncoding:encodingName];
-    [request _webDataRequestSetBaseURL:URL];
-    [request _webDataRequestSetUnreachableURL:unreachableURL];
-    [request _webDataRequestSetMIMEType: MIMEType ? MIMEType : (NSString *)@"text/html"];
-    return request;
-}
-
-
 /*
     In the case of saving state about a page with frames, we store a tree of items that mirrors the frame tree.  
     The item that was the target of the user's navigation is designated as the "targetItem".  
@@ -748,24 +735,26 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 
 - (void)_loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL unreachableURL:(NSURL *)unreachableURL
 {
-    NSURLRequest *request = [self _webDataRequestForData:data 
-                                                MIMEType:MIMEType 
-                                        textEncodingName:encodingName 
-                                                 baseURL:URL
-                                          unreachableURL:unreachableURL];
-    [self loadRequest:request];
+    if (!URL)
+        URL = [NSURL URLWithString:@""];
+    ResourceRequest request(URL);
+    SubstituteData substituteData(WebCore::SharedBuffer::wrapNSData(data), MIMEType, encodingName, unreachableURL);
+
+    [self _frameLoader]->load(request, substituteData);
 }
 
 
 - (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL
 {
+    if (!MIMEType)
+        MIMEType = @"text/html";
     [self _loadData:data MIMEType:MIMEType textEncodingName:encodingName baseURL:URL unreachableURL:nil];
 }
 
 - (void)_loadHTMLString:(NSString *)string baseURL:(NSURL *)URL unreachableURL:(NSURL *)unreachableURL
 {
     NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
-    [self _loadData:data MIMEType:nil textEncodingName:@"UTF-8" baseURL:URL unreachableURL:unreachableURL];
+    [self _loadData:data MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:URL unreachableURL:unreachableURL];
 }
 
 - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)URL
@@ -782,13 +771,12 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 {
     WebResource *mainResource = [archive mainResource];
     if (mainResource) {
-        NSURLRequest *request = [self _webDataRequestForData:[mainResource data] 
-                                                    MIMEType:[mainResource MIMEType]
-                                            textEncodingName:[mainResource textEncodingName]
-                                                     baseURL:[mainResource URL]
-                                              unreachableURL:nil];
-        RefPtr<DocumentLoader> documentLoader = core(self)->loader()->client()->createDocumentLoader(request);
+        SubstituteData substituteData(WebCore::SharedBuffer::wrapNSData([mainResource data]), [mainResource MIMEType], [mainResource textEncodingName], KURL());
+        ResourceRequest request([mainResource URL]);
+        RefPtr<DocumentLoader> documentLoader = core(self)->loader()->client()->createDocumentLoader(request, substituteData);
+
         [dataSource(documentLoader.get()) _addToUnarchiveState:archive];
+
         [self _frameLoader]->load(documentLoader.get());
     }
 }
index 2b161a979df928a60e5f065481f18c0af10b1986..d5eb4b94ced50d42075c77450dc6a1e9ef37fcf0 100644 (file)
@@ -146,8 +146,6 @@ struct WebCoreHistoryItem;
 
 #endif
 
-- (NSURLRequest *)_webDataRequestForData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL unreachableURL:(NSURL *)unreachableURL;
-
 - (WebFrameBridge *)_bridge;
 
 - (void)_loadURL:(NSURL *)URL referrer:(NSString *)referrer intoChild:(WebFrame *)childFrame;
index 5e71631b8c3faa7801ed2fda0a4aef83c4720aa7..16167b96a9e5480a8b3d8f4f2a84d9f2e806de14 100644 (file)
@@ -87,7 +87,6 @@
 #import <WebCore/Range.h>
 #import <WebCore/SelectionController.h>
 #import <WebCore/WebCoreTextRenderer.h>
-#import <WebCore/WebDataProtocol.h>
 #import <WebKit/DOM.h>
 #import <WebKit/DOMExtensions.h>
 #import <WebKit/DOMPrivate.h>
@@ -402,6 +401,17 @@ static WebHTMLView *lastHitView;
     return elements;
 }
 
+static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
+{
+    CFUUIDRef UUIDRef = CFUUIDCreate(kCFAllocatorDefault);
+    NSString *UUIDString = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, UUIDRef);
+    CFRelease(UUIDRef);
+    NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"-webkit-fake-url://%@/%@", UUIDString, relativePart]];
+    CFRelease(UUIDString);
+
+    return URL;
+}
+
 - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard
                                                inContext:(DOMRange *)context
                                           allowPlainText:(BOOL)allowPlainText
@@ -467,7 +477,7 @@ static WebHTMLView *lastHitView;
     
     if ([types containsObject:NSTIFFPboardType]) {
         WebResource *resource = [[WebResource alloc] initWithData:[pasteboard dataForType:NSTIFFPboardType]
-                                                              URL:[NSURL _web_uniqueWebDataURLWithRelativeString:@"/image.tiff"]
+                                                              URL:uniqueURLWithRelativePart(@"image.tiff")
                                                          MIMEType:@"image/tiff" 
                                                  textEncodingName:nil
                                                         frameName:nil];
@@ -478,7 +488,7 @@ static WebHTMLView *lastHitView;
     
     if ([types containsObject:NSPICTPboardType]) {
         WebResource *resource = [[WebResource alloc] initWithData:[pasteboard dataForType:NSPICTPboardType]
-                                                              URL:[NSURL _web_uniqueWebDataURLWithRelativeString:@"/image.pict"]
+                                                              URL:uniqueURLWithRelativePart(@"image.pict")
                                                          MIMEType:@"image/pict" 
                                                  textEncodingName:nil
                                                         frameName:nil];
index 8349423cd1f56705a35ad19a9a3d653607a968eb..ea2ecaa30f73e900ef11f4f234f9b39d42b2a937 100644 (file)
@@ -1,3 +1,13 @@
+2007-01-29  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Mark.
+
+        - updated for cross-platform data loading support
+
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::createDocumentLoader):
+        * WebCoreSupport/FrameLoaderClientQt.h:
+
 2007-01-29  George Staikos  <staikos@kde.org>
 
         Make window resizing work.
index f75e76f2ec842ec4dd89dcf60626ec174e3e969e..d3c9d04fdf977676dcc1f1708c6c3fafc953bb92 100644 (file)
@@ -685,9 +685,9 @@ bool FrameLoaderClientQt::shouldFallBack(const WebCore::ResourceError&)
     return false;
 }
 
-WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClientQt::createDocumentLoader(const WebCore::ResourceRequest& request)
+WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClientQt::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData)
 {
-    RefPtr<DocumentLoader> loader = new DocumentLoader(request);
+    RefPtr<DocumentLoader> loader = new DocumentLoader(request, substituteData);
     return loader.release();
 }
 
index 08744f1f78d07099ef56a7f26eeb48dfdff8a60b..4f082100466aa51872d449c9e8bd34ba10bfa873 100644 (file)
@@ -181,7 +181,7 @@ namespace WebCore {
         virtual WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&);
         virtual WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&);
         virtual bool shouldFallBack(const WebCore::ResourceError&);
-        virtual WTF::PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&);
+        virtual WTF::PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
         virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
 
         virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&);