CPURLConnection and CPWebView seem to collide
Reported by Eric Böhnisch-Volkmann | April 24th, 2009 @ 01:17 AM
In my app I use CPURLConnection to load XML data from the server. When I then display a CPWebView for some file, the next time I use CPURLConnection fails and send the following to the console: "TypeError: Result of expression 'aReceiver.isa' [undefined] is not an object."
Comments and changes to this ticket
-
ronin-756 (at lighthouseapp) April 24th, 2009 @ 10:05 PM
- Tag set to @to-acknowledge, appkit, foundation
Thanks for the bug report. Could you please provide some test code so it's easier to reproduce and fix? Thanks in advance.
-
ronin-756 (at lighthouseapp) April 24th, 2009 @ 10:06 PM
- Tag changed from @to-acknowledge, appkit, foundation to @needtest, appkit, foundation
-
Eric Böhnisch-Volkmann May 7th, 2009 @ 04:07 AM
This is the function that implements my web view:
@@@ objective-c // Implementation of a web document
@implementation DocumentWebView : CPWebView {
CPWebView theWebView;
}
-
(id)initWithFrame:(CGRect)aFrame { self = [super initWithFrame:aFrame]; [self setAutoresizingMask: CPViewWidthSizable | CPViewHeightSizable];
return self; }
-
(void)setContent:(JSObject)anObject { var loadhelperURL = "loadhelper.html?load="+encodeURIComponent(anObject); [self setMainFrameURL:loadhelperURL]; }
-
(void)startedLoading { [super startedLoading];
// _iframe.style.display = "none"; }
// Catch error when the loaded document contains an element with id "errormessage" - (void)_finishedLoading {
var errormessageObject; [super _finishedLoading]; try { errormessageObject = _iframe.contentDocument.getElementById("errormessage"); } catch(err) { errormessageObject = nil; } if(errormessageObject != nil) { var errormessage = errormessageObject.innerHTML; var errornumber = errormessage.substr(7, 3); if (errornumber == "404") { [[CPNotificationCenter defaultCenter] postNotificationName:"loadError" object:[[DTLocalizedString localizer] stringForKey:"File not accessible or not available"]]; } else if (errornumber == "403") { [[CPNotificationCenter defaultCenter] postNotificationName:"loadDatabaseHome" object:nil]; } else { [[CPNotificationCenter defaultCenter] postNotificationName:"loadError" object:[[DTLocalizedString localizer] stringForKey:"Server says"]+errormessage]; } } else { // _iframe.style.display = "inline"; }
}
- (void)removeFromSuperview { [super removeFromSuperview]; }
@end
And this is the code I use for accessing our database: @@@ objective-j // Load item data for group in a database - (void)loadDatabaseContent:(CPString)theID withName:(CPString)theName startingAtPage:(CPNumber)thePage { // Only do this when the given ID is not empty if (theID != nil) { // Clear up the path box and set the new group's name [self hidePathClosebox]; [self setPathText:[groupNavigationStore objectForKey:"databaseName"]]; // Clear selection [itemsCollectionView setSelectionIndexes: [CPIndexSet indexSet]]; if (theID != EmptyDatabaseID) { // Show progress indicator [progressIndicator show:[[DTLocalizedString localizer] stringForKey:"Loading"]+" '"+theName+"'" onlyText:NO withTextColor:DIMMEDTEXTCOLOR]; if (thePage != 0) { [self loadDatabasePage:thePage]; } else { // Request the items contained in the group referenced by the ID from the server var theRequest = [CPURLRequest requestWithURL: @"/?action=children&id="+theID+"&format=JSON"]; itemsConnection = [CPURLConnection connectionWithRequest:theRequest delegate:self]; } if ([groupNavigationStore objectForKey:"databaseID"] != theID) { [self setPathText:[self getPathText]+" : "+theName]; } [self setPathType:GROUP]; } else { // Empty items area, reset document view [databaseCache removeAllObjects]; var databaseitem = [CPDictionary dictionary]; [databaseitem setObject: "" forKey: "relevance"]; [databaseitem setObject: "" forKey: "location"]; [databaseitem setObject: "" forKey: "icon"]; [databaseitem setObject: "" forKey: "view"]; [databaseitem setObject: "" forKey: "download"]; [databaseitem setObject: "" forKey: "url"]; [databaseitem setObject: "" forKey: "see"]; [databaseitem setObject: "" forKey: "id"]; [databaseitem setObject: "" forKey: "title"]; [databaseitem setObject: "" forKey: "type"]; [databaseitem setObject: nil forKey: "size"]; [databaseitem setObject: "" forKey: "timestamp"]; [databaseCache addObject:databaseitem]; [itemsCollectionView setContent:databaseCache]; [self loadDocument:nil withName:nil withType:nil withExtenion:nil withSize:nil isDownload:NO]; [[CPNotificationCenter defaultCenter] postNotificationName:"windowDidResize" object:nil]; } // Store the loaded group's data for navigation purposes [groupNavigationStore setObject:theID forKey:"currentID"] [groupNavigationStore setObject:theName forKey:"currentName"] } }
As long as I only access the database (the second method above), I can run as many access attempts as I want. I can also load and display images in an image view, similar to the web view example above. But as soon as the above web view (1st method) is called once, the next database access attempt (2nd method) fails with the following error message:
TypeError: Result of expression 'aReceiver.isa' [undefined] is not an object. Objective-J.js (line 583)
The very same code works flawlessly in Cappuccino 0.6.
-
-
ronin-756 (at lighthouseapp) May 7th, 2009 @ 05:09 AM
Hello Eric,
Thanks a lot for your follow up. All the tickets have been migrated from Lighthouse to Github. I'v re-posted your comment here .
Thanks, Thomas.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
The Cappuccino Web Framework, including AppKit, Foundation, and Objective-J.