]> git.saurik.com Git - cydia.git/blobdiff - UICaboodle/BrowserView.m
Added a dependency on apt7-key to test control.
[cydia.git] / UICaboodle / BrowserView.m
index b0b04fb225aff5ad04dd7a27d76b32edd27049fc..cb3709c23f4a2837847d6a32eb7385f3b3d3b56a 100644 (file)
         _assert(dup2(fds[1], 1) != -1);
         _assert(close(fds[0]) != -1);
         _assert(close(fds[1]) != -1);
-        execlp("du", "du", "-s", [path UTF8String], NULL);
+        /* XXX: this should probably not use du */
+        execl("/usr/libexec/cydia/du", "du", "-s", [path UTF8String], NULL);
         exit(1);
         _assert(false);
     }
 - (void) webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
     if (![self _allowJavaScriptPanel])
         return;
-
-    // WTR: [self retain];
+    [self retain];
 
     UIActionSheet *sheet = [[[UIActionSheet alloc]
         initWithTitle:nil
 - (BOOL) webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
     if (![self _allowJavaScriptPanel])
         return NO;
+    [self retain];
 
     UIActionSheet *sheet = [[[UIActionSheet alloc]
         initWithTitle:nil
 
     NSNumber *confirm([confirm_ autorelease]);
     confirm_ = nil;
+
+    [self autorelease];
     return [confirm boolValue];
 }
 
 }
 
 - (void) webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
-    [loading_ addObject:frame];
+    if ([loading_ count] == 0)
+        [self retain];
+    [loading_ addObject:[NSValue valueWithNonretainedObject:frame]];
 
     if ([frame parentFrame] == nil) {
         [webview_ resignFirstResponder];
 
         if ([scroller_ respondsToSelector:@selector(setZoomScale:duration:)])
             [scroller_ setZoomScale:1 duration:0];
-        else
-            [scroller_ setZoomScale:1 animated:NO];
+        else if ([scroller_ respondsToSelector:@selector(_setZoomScale:duration:)])
+            [scroller_ _setZoomScale:1 duration:0];
+        /*else if ([scroller_ respondsToSelector:@selector(setZoomScale:animated:)])
+            [scroller_ setZoomScale:1 animated:NO];*/
 
         CGRect webrect = [scroller_ bounds];
         webrect.size.height = 0;
 }
 
 - (void) _finishLoading {
-    if (reloading_ || [loading_ count] != 0)
+    size_t count([loading_ count]);
+    if (count == 0)
+        [self autorelease];
+    if (reloading_ || count != 0)
         return;
     if (finish_ != nil)
         [self callFunction:finish_];
 }
 
 - (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
-    [loading_ removeObject:frame];
-
+    [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
     [self _finishLoading];
 
     if ([frame parentFrame] == nil) {
 }
 
 - (void) _didFailWithError:(NSError *)error forFrame:(WebFrame *)frame {
-    [loading_ removeObject:frame];
-    if (reloading_)
-        return;
+    if ([frame parentFrame] == nil)
+        [self autorelease];
 
+    [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
     [self _finishLoading];
 
+    if (reloading_)
+        return;
+
     if ([frame parentFrame] == nil) {
         [self loadURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?%@",
             [[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"error" ofType:@"html"]] absoluteString],