Bug 144546

Summary: Web Inspector: Exception under ContentViewContainer _disassociateFromContentView
Product: WebKit Reporter: Timothy Hatcher <timothy>
Component: Web InspectorAssignee: Timothy Hatcher <timothy>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, graouts, joepeck, jonowells, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Description Timothy Hatcher 2015-05-03 07:43:25 PDT
_disassociateFromContentView is being passed a BackForwardEntry instead of a ContentView in one case. There is also an associated logic error.

I think this was masked by the fact that _disassociateFromContentView wouldn't call closed() if the representedObject was null on the passed object. Since BackForwardEntry doesn't have a representedObject, it would always abort early. This would lead to memory leaks too.
Comment 1 Radar WebKit Bug Importer 2015-05-03 07:43:41 PDT
<rdar://problem/20793755>
Comment 2 Timothy Hatcher 2015-05-03 07:46:00 PDT
Created attachment 252268 [details]
Patch
Comment 3 Brian Burg 2015-05-03 15:10:13 PDT
Comment on attachment 252268 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=252268&action=review

r=me

> Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js:182
> +                this._disassociateFromContentView(removedEntries[i].contentView);

Would be prudent to add a type test for the method's parameter. (The method name is really clear, but this still slipped up.)
Comment 4 WebKit Commit Bot 2015-05-03 15:56:27 PDT
Comment on attachment 252268 [details]
Patch

Clearing flags on attachment: 252268

Committed r183733: <http://trac.webkit.org/changeset/183733>
Comment 5 WebKit Commit Bot 2015-05-03 15:56:31 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Timothy Hatcher 2015-05-03 18:07:47 PDT
Comment on attachment 252268 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=252268&action=review

>> Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js:182
>> +                this._disassociateFromContentView(removedEntries[i].contentView);
> 
> Would be prudent to add a type test for the method's parameter. (The method name is really clear, but this still slipped up.)

I think this happened during refactoring when you added BackForwardEntry into the mix instead of dealing with ContentViews directly. It was just masked by an early return that I recently removed.

But yes, an assert for the type would normally be good.