Reviewed by Maciej.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Oct 2006 05:44:32 +0000 (05:44 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Oct 2006 05:44:32 +0000 (05:44 +0000)
        - removed some of the WebKit dependencies in WebFrameLoader

        * Loader/WebFrameLoader.m:
        (-[WebFrameLoader loadURL:referrer:loadType:target:triggeringEvent:form:formValues:]):
        (-[WebFrameLoader _downloadWithLoadingConnection:request:response:proxy:]):
        (-[WebFrameLoader reload]):
        (-[WebFrameLoader didChangeTitleForDocument:]):
        * Loader/WebFrameLoaderClient.h:
        * WebView/WebFrame.m:
        (-[WebFrame _loadItem:withLoadType:]):
        (-[WebFrame _loadURL:referrer:intoChild:]):
        (-[WebFrame _setTitle:forURL:]):
        (-[WebFrame _downloadWithLoadingConnection:request:response:proxy:]):
        * WebView/WebFrameInternal.h:

        - some other tweaks

        * Misc/WebNSURLRequestExtras.m:
        (-[NSMutableURLRequest _web_setHTTPReferrer:]):
        (-[NSMutableURLRequest _web_setHTTPUserAgent:]):

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

WebKit/ChangeLog
WebKit/Loader/WebFrameLoader.m
WebKit/Loader/WebFrameLoaderClient.h
WebKit/Misc/WebNSURLRequestExtras.m
WebKit/WebView/WebFrame.m
WebKit/WebView/WebFrameInternal.h

index cfc7cf615fb0a9775e5365f27db1979c2d4feeee..432b3109d9e54e578af00f9a090b2fcb2ef90efd 100644 (file)
@@ -1,3 +1,28 @@
+2006-10-08  Darin Adler  <darin@apple.com>
+
+        Reviewed by Maciej.
+
+        - removed some of the WebKit dependencies in WebFrameLoader
+
+        * Loader/WebFrameLoader.m:
+        (-[WebFrameLoader loadURL:referrer:loadType:target:triggeringEvent:form:formValues:]):
+        (-[WebFrameLoader _downloadWithLoadingConnection:request:response:proxy:]):
+        (-[WebFrameLoader reload]):
+        (-[WebFrameLoader didChangeTitleForDocument:]):
+        * Loader/WebFrameLoaderClient.h:
+        * WebView/WebFrame.m:
+        (-[WebFrame _loadItem:withLoadType:]):
+        (-[WebFrame _loadURL:referrer:intoChild:]):
+        (-[WebFrame _setTitle:forURL:]):
+        (-[WebFrame _downloadWithLoadingConnection:request:response:proxy:]):
+        * WebView/WebFrameInternal.h:
+
+        - some other tweaks
+
+        * Misc/WebNSURLRequestExtras.m:
+        (-[NSMutableURLRequest _web_setHTTPReferrer:]):
+        (-[NSMutableURLRequest _web_setHTTPUserAgent:]):
+
 2006-10-08  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Darin.
index 77a8aa3c9d0f36c0f16906aec1e93ebb0beab0d0..61d213dad17ce2f9694cd9b714cab5cd479a3b44 100644 (file)
@@ -30,6 +30,7 @@
 
 #import "WebDataProtocol.h"
 #import "WebDocumentLoader.h"
+#import "WebFormDataStream.h"
 #import "WebFrameBridge.h"
 #import "WebFrameLoaderClient.h"
 #import "WebMainResourceLoader.h"
 #import "WebDataSourceInternal.h"
 #import "WebDefaultUIDelegate.h"
 #import "WebDocumentLoaderMac.h"
-#import "WebDownloadInternal.h"
-#import "WebFormDataStream.h"
 #import "WebFrameInternal.h"
 #import "WebFrameLoadDelegate.h"
 #import "WebFrameViewInternal.h"
 #import "WebHTMLView.h"
-#import "WebHistory.h"
 #import "WebIconDatabasePrivate.h"
 #import "WebKitErrorsPrivate.h"
 #import "WebKitLogging.h"
-#import "WebKitNSStringExtras.h"
 #import "WebNSURLExtras.h"
 #import "WebNSURLRequestExtras.h"
 #import "WebResourcePrivate.h"
@@ -629,7 +626,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
                                        frameName:target
                                        formState:formState
                                          andCall:self
-                                    withSelector:@selector(_continueLoadRequestAfterNewWindowPolicy:frameName:formState:)];
+                                    withSelector:@selector(continueLoadRequestAfterNewWindowPolicy:frameName:formState:)];
         }
         [request release];
         [formState release];
@@ -835,13 +832,10 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     [[self activeDocumentLoader] setRequest:request];
 }
 
-- (void)_downloadWithLoadingConnection:(NSURLConnection *)connection request:(NSURLRequest *)request response:(NSURLResponse *)r proxy:(id)proxy
+- (void)_downloadWithLoadingConnection:(NSURLConnection *)connection
+    request:(NSURLRequest *)request response:(NSURLResponse *)response proxy:(id)proxy
 {
-    [WebDownload _downloadWithLoadingConnection:connection
-                                        request:request
-                                       response:r
-                                       delegate:[[client webView] downloadDelegate]
-                                          proxy:proxy];
+    [client _downloadWithLoadingConnection:connection request:request response:response proxy:proxy];
 }
 
 - (WebFrameBridge *)bridge
@@ -1240,7 +1234,7 @@ BOOL isBackForwardLoadType(FrameLoadType type)
     [request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
 
     // If we're about to rePOST, set up action so the app can warn the user
-    if ([[request HTTPMethod] _webkit_isCaseInsensitiveEqualToString:@"POST"]) {
+    if ([[request HTTPMethod] compare:@"POST" options:(NSCaseInsensitiveSearch | NSLiteralSearch)] == NSOrderedSame) {
         NSDictionary *action = [self actionInformationForNavigationType:WebNavigationTypeFormResubmitted
             event:nil originalURL:[request URL]];
         [policyDocumentLoader setTriggeringAction:action];
@@ -1331,17 +1325,12 @@ BOOL isBackForwardLoadType(FrameLoadType type)
     if ([loader isCommitted]) {
         NSURL *URLForHistory = [[client _dataSourceForDocumentLoader:loader] _URLForHistory];
         if (URLForHistory != nil) {
-            WebHistoryItem *entry = [[WebHistory optionalSharedHistory] itemForURL:URLForHistory];
-            [entry setTitle:[loader title]];
-        
-            // Must update the entries in the back-forward list too.  This must go through the WebFrame because
-            // it has the right notion of the current b/f item.
-            [client _setTitle:[loader title]];
-        
-            [[client webView] setMainFrameDocumentReady:YES];    // update observers with new DOMDocument
+            // Must update the entries in the back-forward list too.
+            // This must go through the WebFrame because it has the right notion of the current b/f item.
+            [client _setTitle:[loader title] forURL:URLForHistory];
+            [[client webView] setMainFrameDocumentReady:YES]; // update observers with new DOMDocument
             [[[client webView] _frameLoadDelegateForwarder] webView:[client webView]
-                                                      didReceiveTitle:[loader title]
-                                                             forFrame:client];
+                didReceiveTitle:[loader title] forFrame:client];
         }
     }
 }
index 84894622e59717c22eedabb1a924bcb278de35f9..c41f7cc4f1d06835ff1e6bae8b9ed566073a9d33 100644 (file)
@@ -63,6 +63,8 @@ typedef struct LoadErrorResetToken LoadErrorResetToken;
 
 - (void)_loadedFromPageCache;
 
+- (void)_downloadWithLoadingConnection:(NSURLConnection *)connection request:(NSURLRequest *)request response:(NSURLResponse *)response proxy:(id)proxy;
+
 - (void)_dispatchDidHandleOnloadEventsForFrame;
 - (void)_dispatchDidReceiveServerRedirectForProvisionalLoadForFrame;
 - (id)_dispatchIdentifierForInitialRequest:(NSURLRequest *)request fromDocumentLoader:(WebDocumentLoader *)loader;
index f2b76543c390e6faf0f69dc01d7b124ec02aeb4e..770ff8f9b46c4865a04d28cf26af58fff20bf3bb 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import <WebKit/WebNSURLRequestExtras.h>
+#import "WebNSURLRequestExtras.h"
 
-#import <JavaScriptCore/Assertions.h>
-#import <WebKit/WebNSURLExtras.h>
+#import "WebNSURLExtras.h"
 
 #define WebContentType  (@"Content-Type")
 #define WebUserAgent    (@"User-Agent")
@@ -60,7 +59,6 @@
 
 @end
 
-
 @implementation NSMutableURLRequest (WebNSURLRequestExtras)
 
 - (void)_web_setHTTPContentType:(NSString *)contentType
     [self setValue:contentType forHTTPHeaderField:WebContentType];
 }
 
-- (void)_web_setHTTPReferrer:(NSString *)theReferrer
+- (void)_web_setHTTPReferrer:(NSString *)referrer
 {
     // Do not set the referrer to a string that refers to a file URL.
     // That is a potential security hole.
-    if ([theReferrer _webkit_isFileURL]) {
+    if ([referrer _webkit_isFileURL])
         return;
-    }
 
     // Don't allow empty Referer: headers; some servers refuse them
-    if( [theReferrer length] == 0 )
-        theReferrer = nil;
+    if ([referrer length] == 0)
+        return;
 
-    [self setValue:theReferrer forHTTPHeaderField:WebReferrer];
+    [self setValue:referrer forHTTPHeaderField:WebReferrer];
 }
 
-- (void)_web_setHTTPUserAgent:(NSString *)theUserAgent
+- (void)_web_setHTTPUserAgent:(NSString *)userAgent
 {
-    [self setValue:theUserAgent forHTTPHeaderField:WebUserAgent];
+    [self setValue:userAgent forHTTPHeaderField:WebUserAgent];
 }
 
 @end
-
index 15e17fe9e34905ff8dd7134925138f0d8dc58a34..62afc83d868e772f66790a47a25c0d2c8287b775 100644 (file)
@@ -36,6 +36,7 @@
 #import "WebDefaultUIDelegate.h"
 #import "WebDocumentInternal.h"
 #import "WebDocumentLoaderMac.h"
+#import "WebDownloadInternal.h"
 #import "WebFormDataStream.h"
 #import "WebFrameBridge.h"
 #import "WebFrameLoadDelegate.h"
@@ -546,13 +547,11 @@ static inline WebFrame *Frame(WebCoreFrameBridge *bridge)
             NSDictionary *pageCache = [item pageCache];
             NSDate *cacheDate = [pageCache objectForKey: WebPageCacheEntryDateKey];
             NSTimeInterval delta = [[NSDate date] timeIntervalSinceDate: cacheDate];
-
-            if (delta <= [[[self webView] preferences] _backForwardCacheExpirationInterval]){
+            if (delta <= [[[self webView] preferences] _backForwardCacheExpirationInterval]) {
                 newDataSource = [pageCache objectForKey: WebPageCacheDataSourceKey];
                 [[self _frameLoader] loadDataSource:newDataSource withLoadType:loadType formState:nil];   
                 inPageCache = YES;
-            }
-            else {
+            } else {
                 LOG (PageCache, "Not restoring page from back/forward cache because cache entry has expired, %@ (%3.5f > %3.5f seconds)\n", [_private->provisionalItem URL], delta, [[[self webView] preferences] _backForwardCacheExpirationInterval]);
                 [item setHasPageCache: NO];
             }
@@ -726,15 +725,15 @@ static inline WebFrame *Frame(WebCoreFrameBridge *bridge)
     }
 
     WebArchive *archive = [[self dataSource] _popSubframeArchiveWithName:[childFrame name]];
-    if (archive) {
+    if (archive)
         [childFrame loadArchive:archive];
-    } else {
+    else
         [[childFrame _frameLoader] loadURL:URL referrer:referrer loadType:childLoadType target:nil triggeringEvent:nil form:nil formValues:nil];
-    }
 }
 
-- (void)_setTitle:(NSString *)title
+- (void)_setTitle:(NSString *)title forURL:(NSURL *)URL
 {
+    [[[WebHistory optionalSharedHistory] itemForURL:URL] setTitle:title];
     [_private->currentItem setTitle:title];
 }
 
@@ -1728,4 +1727,13 @@ static inline WebDataSource *dataSource(WebDocumentLoader *loader)
     [_private->currentItem setHasPageCache:NO];
 }
 
+- (void)_downloadWithLoadingConnection:(NSURLConnection *)connection request:(NSURLRequest *)request response:(NSURLResponse *)response proxy:(id)proxy
+{
+    [WebDownload _downloadWithLoadingConnection:connection
+                                        request:request
+                                       response:response
+                                       delegate:[[self webView] downloadDelegate]
+                                          proxy:proxy];
+}
+
 @end
index 8126e391f070f6d282386875d488fdaeba48f69e..2c8f87b826fccc401efe55199afefd31bc01aa5f 100644 (file)
 
 - (void)_saveDocumentAndScrollState;
 
-- (void)_setTitle:(NSString *)title;
+- (void)_setTitle:(NSString *)title forURL:(NSURL *)URL;
 
 + (CFAbsoluteTime)_timeOfLastCompletedLoad;
 - (BOOL)_canCachePage;