]> git.saurik.com Git - cydia.git/commitdiff
DRY refactorization with silly abstraction for {request,URL}WithURL.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 28 Feb 2011 18:27:33 +0000 (10:27 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 7 Mar 2011 10:41:28 +0000 (02:41 -0800)
UICaboodle/BrowserView.mm

index 9a067f7c5a7cd3ee0313fb134ab2ef7299b29040..201e85415c385f7e4db48ea67eb0dc291fbd2d8f 100644 (file)
@@ -498,22 +498,25 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
     [super dealloc];
 }
 
-- (void) setURL:(NSURL *)url {
-    _assert(request_ == nil);
+- (NSURL *) URLWithURL:(NSURL *)url {
+    return url;
+}
 
-    request_ = [NSURLRequest
-        requestWithURL:url
-        cachePolicy:NSURLRequestUseProtocolCachePolicy
+- (NSURLRequest *) requestWithURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy {
+    return [NSURLRequest
+        requestWithURL:[self URLWithURL:url]
+        cachePolicy:policy
         timeoutInterval:DefaultTimeout_
     ];
 }
 
+- (void) setURL:(NSURL *)url {
+    _assert(request_ == nil);
+    request_ = [self requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy];
+}
+
 - (void) loadURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy {
-    [self loadRequest:[NSURLRequest
-        requestWithURL:url
-        cachePolicy:policy
-        timeoutInterval:DefaultTimeout_
-    ]];
+    [self loadRequest:[self requestWithURL:url cachePolicy:policy]];
 }
 
 - (void) loadURL:(NSURL *)url {