Closed Bug 415510 Opened 16 years ago Closed 16 years ago

Dragging multiple items to the app/Dock icon fails to open any of them after certain AppleEvents

Categories

(Camino Graveyard :: OS Integration, defect)

All
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Camino2.0

People

(Reporter: alqahira, Assigned: alqahira)

References

Details

(Keywords: regression)

Attachments

(1 file)

On the trunk, if you drag multiple weblocs to the Dock or app icon at the same time, Camino fails to open any of the weblocs.  Works fine on branch.

I have no idea when this might have regressed :-(
Whiteboard: [needs regression range]
Not recent :-(.
2007080201 (2.0a1pre)  works
2007080701 (2.0a1pre)  fails

Atm, I don't have builds at hand between those 2 dates.
Mhm. I have this sneaky feeling that this might be the guilty code:

http://mxr.mozilla.org/mozilla/source/camino/src/appleevents/ScriptingSupport.mm#120

I don't have time at the moment to investigate further how that might be causing the problem, but if no one else has gotten to this by tonight, I can look into determining a cause. (If that is indeed the cause, I have no idea what the right solution is, though.)

cl
Component: OS Integration → Drag & Drop
QA Contact: os.integration → drag.drop
Whiteboard: [needs regression range]
Odd...  WFM on my builds as well as 2007080600.
OK, I did some more digging on this with AppleEvent logging turned on.

With a fresh profile, I couldn't get this script to work:

tell application "Camino"
  set the URL of the current tab of the front window to "http://google.com"
end tell

...but dragging two weblocs to the Dock icon worked great.

I figured maybe the script didn't work because tabbed browsing wasn't enabled, so I checked all the boxes in the Tabs pref pane and tried it again.

The script worked fine, but now I got this error when I tried to drag the same two weblocs to the Dock icon:

2008-09-09 14:39:23.052 Camino[42678:10b] Error converting apple event to script command: -1700
2008-09-09 14:39:23.058 Camino[42678:10b]     Original event: <NSAppleEventDescriptor: 'aevt'\'odoc'{ '----':[ 'alis'($0000000001320002000009416C204B616C696E65000000000000000000000000000000000000C2D9290F482B0000000415A11443616D696E6F2E2053746172742E7765626C6F630000000000000000000000000000000000000000000000000000000000000000000000000000000000000000709751C4EC39C5696C68744D414353FFFFFFFF00004920000000000000000000000000001000080000C2D9614F0000001100080000C4EC72050000000E002A001400430061006D0069006E006F002E002000530074006100720074002E007700650062006C006F0063000F001400090041006C0020004B0061006C0069006E00650012002A55736572732F636C6177736F6E2F4465736B746F702F43616D696E6F2E2053746172742E7765626C6F63001300012F0000150002000EFFFF0000$), 'alis'($00000000011E0002000009416C204B616C696E65000000000000000000000000000000000000C2D9290F482B0000000415A10D476F6F676C652E7765626C6F6300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070974FC4EC39B3696C68744D414353FFFFFFFF00004920000000000000000000000000001000080000C2D9614F0000001100080000C4EC71F30000000E001C000D0047006F006F0067006C0065002E007700650062006C006F0063000F001400090041006C0020004B0061006C0069006E00650012002355736572732F636C6177736F6E2F4465736B746F702F476F6F676C652E7765626C6F6300001300012F0000150002000EFFFF0000$) ] }>
2008-09-09 14:39:23.060 Camino[42678:10b]     Offending object descriptor: <NSAppleEventDescriptor: [ 'alis'($0000000001320002000009416C204B616C696E65000000000000000000000000000000000000C2D9290F482B0000000415A11443616D696E6F2E2053746172742E7765626C6F630000000000000000000000000000000000000000000000000000000000000000000000000000000000000000709751C4EC39C5696C68744D414353FFFFFFFF00004920000000000000000000000000001000080000C2D9614F0000001100080000C4EC72050000000E002A001400430061006D0069006E006F002E002000530074006100720074002E007700650062006C006F0063000F001400090041006C0020004B0061006C0069006E00650012002A55736572732F636C6177736F6E2F4465736B746F702F43616D696E6F2E2053746172742E7765626C6F63001300012F0000150002000EFFFF0000$), 'alis'($00000000011E0002000009416C204B616C696E65000000000000000000000000000000000000C2D9290F482B0000000415A10D476F6F676C652E7765626C6F6300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070974FC4EC39B3696C68744D414353FFFFFFFF00004920000000000000000000000000001000080000C2D9614F0000001100080000C4EC71F30000000E001C000D0047006F006F0067006C0065002E007700650062006C006F0063000F001400090041006C0020004B0061006C0069006E00650012002355736572732F636C6177736F6E2F4465736B746F702F476F6F676C652E7765626C6F6300001300012F0000150002000EFFFF0000$) ]>
2008-09-09 14:39:23.063 Camino[42678:10b]     Expected type descriptor: <NSAppleEventDescriptor: 'file'>

Smokey says this fails for him with a fresh profile regardless, though.
Hardware: Macintosh → All
Regular files are broken, too.  

I can't cause this to fail with logging on (fresh profile, or fresh profile+tabs enabled, or whatever), but it always fails for me when testing with a fresh profile.  OTOH, with a regular trunk profile, files always open.
Hardware: All → Macintosh
Summary: Dragging multiple weblocs to the app/Dock icon fails to open any of them → Dragging multiple items to the app/Dock icon fails to open any of them
I tried this again, and this time it didn't matter what I did in the Tabs pref
pane; dragging two weblocs was broken regardless, and I got the same error as
in comment 5.
Hardware: Macintosh → All
On a hunch thanks to Smokey and Peeja, I tried swapping the .scriptSuite, .rsrc, and .scriptTerminology files from the 1.6 release into last night's trunk. Last night's trunk now works fine, both with a fresh profile and with my normal profile.

Unfortunately, it doesn't log anything when I turn on AE logging, so I'm not sure exactly what's happening that makes it work.
Much better STR:

1) Launch Camino normally
2) Drag multiple files to the icon/Dock icon
--> Success
3) tell application "Camino" to activate
4) Drag multiple files to the icon/Dock icon
--> Failure

This failed for me "all the time" with a fresh profile because I was always using Troubleshoot Camino to launch, and it uses an "activate" command to work around Camino being launched in the background on 10.5 :P
Summary: Dragging multiple items to the app/Dock icon fails to open any of them → Dragging multiple items to the app/Dock icon fails to open any of them after certain AppleEvents
When running with AEDebugSends and AEDebugReceives, you can see we're happy to receive an alias (or pair) before getting an "activate" or "set URL" or whatever, but once we get that event, suddenly we're insisting that we'll only handle 'odoc' with type 'file'.

Commenting out our definition of 'odoc' seems to fix the problem and doesn't seem to have any ill effects, but I don't know everything to test (and it's probably best to test on a machine with no other Caminos).

Changing the type from 'file' to 'alias' also doesn't work; you get messages like this (the first event is me sending it an activate event from Script Editor; the second is dragging my two files onto the Dock icon):

AE2000 (68726): Received an event:
------oo start of event oo------
{ 1 } 'aevt':  misc/actv (i386){
          return id: 177209462 (0xa900076)
     transaction id: 0 (0x0)
  interaction level: 64 (0x40)
     reply required: 1 (0x1)
             remote: 0 (0x0)
      for recording: 0 (0x0)
         reply port: 44599 (0xae37)
  target:
    { 1 } 'psn ':  8 bytes {
      { 0x0, 0x1595594 } (Script Editor)
    }
  fEventSourcePSN: { 0x0,0x1595594 } (Script Editor)
  optional attributes:
    { 1 } 'reco':  - 2 items {
      key 'subj' - 
        { -1 } 'null':  null descriptor
      key 'csig' - 
        { 1 } 'magn':  4 bytes {
          65536l (0x10000)
        }
    }

  event data:
    { 1 } 'aevt':  - 0 items {
    }
}

------oo  end of event  oo------
2008-09-09 19:05:22.860 Camino[68726:807] .sdef warning for argument '' of command 'open' in suite 'Standard Suite': 'alias' is not a valid type name.
AE2000 (68726): Received an event:
------oo start of event oo------
{ 1 } 'aevt':  aevt/odoc (i386){
          return id: 418054883 (0x18eb02e3)
     transaction id: 0 (0x0)
  interaction level: 112 (0x70)
     reply required: 0 (0x0)
             remote: 0 (0x0)
      for recording: 0 (0x0)
         reply port: 30735 (0x780f)
  target:
    { 1 } 'psn ':  8 bytes {
      { 0x0, 0xc25c25 } (Dock)
    }
  fEventSourcePSN: { 0x0,0xc25c25 } (Dock)
  optional attributes:
    < empty record >
  event data:
    { 1 } 'aevt':  - 1 items {
      key '----' - 
        { 1 } 'list':  - 2 elements {
          { 1 } 'alis':  296 bytes {
            /Users/smokey/Desktop/KN_Sample.html
          }
          { 1 } 'alis':  296 bytes {
            /Users/smokey/Desktop/TL_Sample.html
          }
        }
    }
}

------oo  end of event  oo------
2008-09-09 19:05:56.629 Camino[68726:807] Error while creating a script command: there's no Objective-C class '(null)' corresponding to the .sdef-declared type '(null)'.

What's the blank argument in the first error, and where did the ".sdef-declared type '(null)'" come from?
Attached patch fixSplinter Review
NSCoreSuite is apparently the term to use when googling for info on "implementing" 'odoc'.  I found <http://lists.apple.com/archives/Applescript-implementors/2006/Sep/msg00012.html>, which led me to the new 'odoc' definition in Skeleton.sdef.  Adding "list" alone doesn't seem to work, but using both does.

I'd like someone to verify that this works on 10.4, too.
Assignee: nobody → alqahira
Status: NEW → ASSIGNED
Attachment #337788 - Flags: review?(peter.a.jaros)
Eiichi, can you look at this on 10.4?  It's possible that the bug does not exist on 10.4 to begin with, but the steps in comment 9 should allow you to check.

Without the patch, step 2 should open two or more files, and step 4 should open no files (if the bug exists).

With the patch, step 2 and step 4 should both open two or more files, and Console should not report any (new) errors about our scripting.
(Er, and step 3 in comment 9 is a one-line AppleScript to run in Script Editor, in case that's not clear.)
We should probably audit the rest of our implementation of Core Suite against
the latest from Apple:

http://developer.apple.com/samplecode/ScriptingDefinitions/listing2.html

just to make sure we don't have any more problems like this.

cl
(In reply to comment #12)
> Eiichi, can you look at this on 10.4?  It's possible that the bug does not
> exist on 10.4 to begin with, but the steps in comment 9 should allow you to
> check.

I can confirm Comment #9 on 10.4.
(In reply to comment #12)

Sorry, I need a further explanation.

> Without the patch, step 2 should open two or more files, and step 4 should open
> no files (if the bug exists).

The bug exists on 10.4, too.

> With the patch, step 2 and step 4 should both open two or more files, and
> Console should not report any (new) errors about our scripting.

An attachment (id=337788) works fine on 10.4 and Console shows no errors.
Comment on attachment 337788 [details] [diff] [review]
fix

Looks good to me.  Works like a charm.
Attachment #337788 - Flags: review?(peter.a.jaros) → review+
Comment on attachment 337788 [details] [diff] [review]
fix

Comment 9, the first part of comment 10, and comment 11 are the salient comments here.
Attachment #337788 - Flags: superreview?(stuart.morgan+bugzilla)
Attachment #337788 - Flags: superreview?(stuart.morgan+bugzilla) → superreview+
Comment on attachment 337788 [details] [diff] [review]
fix

sr=smorgan
Landed on cvs trunk.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Component: Drag & Drop → OS Integration
QA Contact: drag.drop → os.integration
Resolution: --- → FIXED
I didn't test to drag a single file when I tested Comment #9 last time.
So I retest Comment #9 in 2008-09-21-00-2.0-M1.9, then 
I can't open a single file via drag, I can only open multiple files.

And when it fails, Console logs:
Camino[5781] *** -[NSCFString count]: selector not recognized [self = 0x12387fc0]

Related Bug 456353.
Just for reference.

On 10.4 with official .sdef:
1) Launch Camino normally
  -Drag single file to the icon/Dock icon --> Success
  -Drag multiple files to the icon/Dock icon --> Success
2) tell application "Camino" to activate
  -Drag single file to the icon/Dock icon --> Failure
  -Drag multiple files to the icon/Dock icon --> Success

On 10.4 with .sdef removed <type type="file"/>:
1) Launch Camino normally
  -Drag single file to the icon/Dock icon --> Success
  -Drag multiple files to the icon/Dock icon --> Success
2) tell application "Camino" to activate
  -Drag single file to the icon/Dock icon --> Success
  -Drag multiple files to the icon/Dock icon --> Success
Instead of removing <type type="file"/> from the .sdef, I change .sdef as below
and test to open a single and multiple files via dragging.
---------
<!-- The old Standard Suite: run, reopen, open, print, and quit. -->
<command name="open" code="aevtodoc" description="Open an object.">
	<direct-parameter description="The file to be opened.">
		<type type="file"/>
	</direct-parameter>
	<direct-parameter description="The files to be opened.">
		<type type="file" list="yes"/>
	</direct-parameter>
</command>
---------

Results:
1) Launch Camino normally
  -Drag a single file to the icon/Dock icon --> Success
  -Drag multiple files to the icon/Dock icon --> Success
2) tell application "Camino" to activate
  -Drag a single file to the icon/Dock icon --> Success
  -Drag multiple files to the icon/Dock icon --> Success

Smokey, can you test this on 10.5?
(In reply to comment #23)
And I change .sdef as below and the results are the same as Comment #23.

---------
<!-- The old Standard Suite: run, reopen, open, print, and quit. -->
<command name="open" code="aevtodoc" description="Open an object.">
    <direct-parameter description="The file to be opened.">
        <type type="file"/>
    </direct-parameter>
    <direct-parameter description="The files to be opened.">
        <type type="file"/>
        <type type="file" list="yes"/>
    </direct-parameter>
</command>
---------
Sorry for a spam, opening file(s) via dragging succeeds but Console logs error:
-----
Camino[8419] .sdef error: every 'command' element must have no more than one 'direct-parameter' subelement.
Can someone else on 10.5 please verify that removing <type type="file"/> from the sdef still passes the single and multiple file tests, both before and after activating Camino?

Removing <type type="file"/> is definitely working for me tonight in a series of many tests, both with my build and with an official nightly, but for whatever reason it wasn't in comment 11.  Maybe I typoed the <type> paramater when I was testing then?

On 10.5 with .sdef with <type type="file"/> removed:
1) Launch Camino normally
  -Drag single file to the icon/Dock icon --> Success
  -Drag multiple files to the icon/Dock icon --> Success
2) tell application "Camino" to activate
  -Drag single file to the icon/Dock icon --> Success
  -Drag multiple files to the icon/Dock icon --> Success

(Eiichi's other two scenarios in comment 23 and 24 also work, but as comment 25 notes, they produce that Console error all the time.)

Eiichi, will you continue using Camino with <type type="file"/> removed and make sure that you don't see the error in bug 456353 any more?
(In reply to comment #26)
> Eiichi, will you continue using Camino with <type type="file"/> removed and
> make sure that you don't see the error in bug 456353 any more?

Yes, I've been using Camino with <type type="file"/> removed for a day
and I haven't seen any error in bug 456353.
I've attached a patch for comment 21-27 back over on bug 456353.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: