[Webkit-unassigned] [Bug 6152] New: When a windowScriptObject is released, it doesn't release the values it retained

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Mon Dec 19 17:43:16 PST 2005


           Summary: When a windowScriptObject is released, it doesn't
                    release the values it retained
           Product: WebKit
           Version: 412+
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: JavaScript
        AssignedTo: webkit-unassigned at opendarwin.org
        ReportedBy: dwood at karelia.com

After you set some values (using setValue:forKey) on a "window script object" (Abbrev: WSO), the retain 
count of those values properly increments by one. But when that WSO is deallocated, it does not release 
the values it retained.

This is tricky to test, because the WSO does not seem to be dealloced at any specific time from what I 
can tell.  This may be a separate bug; I'll keep testing.

Anyhow, if you intercept webView: windowScriptObjectAvailable:  and, as a test, deallocate that WSO, 
you can see that the values are not released.

Here is the snippet of code from my modified MiniBrowser:

- (void)webView:(WebView *)sender windowScriptObjectAvailable:(WebScriptObject *)
	NSLog(@"BEFORE SETTING OF KEY: MyDocument retainCount = %d  WebScriptObject retainCount = 
%d", [self retainCount], [aWindowScriptObject retainCount]);
	[aWindowScriptObject setValue:self forKey:@"controller"];
	NSLog(@"AFTER SETTING OF KEY: MyDocument retainCount = %d ", [self retainCount]);

// ^^ Above, we see the retain count of 'self' increment.  Also, we see that the WSO's retain count is 1, 
so we can force deallocating it below.

	/* see what happens to the retain count of self */
	[aWindowScriptObject release];
	NSLog(@"AFTER RELEASE: MyDocument retainCount = %d .... should be back to 'before' value", 
[self retainCount]);

// ^^^^ Above, the retain count of self has *not* been decremented.  This is a nasty leak!


Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the webkit-unassigned mailing list