Bug 13239 - REGRESSION (r20343): Drosera hits exception trying to call "count" cross-process
Summary: REGRESSION (r20343): Drosera hits exception trying to call "count" cross-process
Status: CLOSED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.4
: P1 Normal
Assignee: Nobody
URL:
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2007-03-30 21:45 PDT by Darin Adler
Modified: 2008-05-17 09:56 PDT (History)
2 users (show)

See Also:


Attachments
Patch (1.49 KB, patch)
2007-03-31 03:34 PDT, Mark Rowe (bdash)
no flags Details | Formatted Diff | Diff
Updated patch (1.88 KB, patch)
2007-03-31 04:58 PDT, Mark Rowe (bdash)
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2007-03-30 21:45:53 PDT
This is actually a bug in changes made to the Objective-C binding. I have a patch.
Comment 1 Darin Adler 2007-03-30 21:51:07 PDT
Broken by r20343, which fixed bug 13129.
Comment 2 Darin Adler 2007-03-30 22:38:06 PDT
My fix breaks the Democracy application. So I don't really have a fix!
Comment 3 Darin Adler 2007-03-30 22:42:44 PDT
Correcting the selector names in -[WebScriptObject methodForSelector:] and -[WebScriptObject respondsToSelector:] does no good. PyObjC, normal method dispatch, and Distributed Objects, are all far too low level to use either of those methods.

I think we'll have to add the count method back if we want to call it. What's less clear is exactly what PyObjC code is doing something bad when it sees a count method. I downloaded the PyObjC source code and could not find it.
Comment 4 Mark Rowe (bdash) 2007-03-30 23:28:17 PDT
You're right.  I'm not sure what made me think respondsToSelector: and friends would work for this.  I couldn't find where in PyObjC's code things went wrong either, but the stack trace when "count" is invoked is underneath PyObject_IsTrue which determines which Python objects are considered true in a boolean context.  For number-like objects this is those with non-zero value, for sequence-like objects it is those with non-zero length.  The fact this results in "count" being invoked suggests that Python or PyObjC believes the WebScriptObject is sequence-like in some way.  I'm not sure how or why exactly this is happening, nor who arranges for PyObject_IsTrue to call through to "count".

It seems like rolling out the obviously incorrect fix r20343 and reopening bug 13129 so it can be addressed correctly would be the right thing to do here.  Do you agree Darin?
Comment 5 Mark Rowe (bdash) 2007-03-31 03:34:10 PDT
Created attachment 13904 [details]
Patch

This uses valueForKey: rather than count.  Arguably this addressing the symptom rather than the cause, but the presence of -[WebScriptObject count] breaks at least one third-party app which is bad news.
Comment 6 Mark Rowe (bdash) 2007-03-31 04:58:28 PDT
Created attachment 13907 [details]
Updated patch

Mitz pointed out that I had missed removing the interface declaration in DebuggerDocument that had been preventing the use of -count from generating a warning.
Comment 7 mitz 2007-03-31 05:02:37 PDT
Comment on attachment 13907 [details]
Updated patch

r=me
Comment 8 Mark Rowe (bdash) 2007-03-31 22:06:56 PDT
Landed in r20643.
Comment 9 Mark Rowe (bdash) 2007-03-31 22:14:05 PDT
<rdar://problem/5103227>
Comment 10 Timothy Hatcher 2008-05-17 09:56:04 PDT
Closing since Drosera has been replaced by the new Web Inspector debugger. Moving to the New Bugs component so the Drosera component can be closed and removed.