Closed Bug 612205 Opened 15 years ago Closed 14 years ago

Camino does not handle .fileloc files consistently

Categories

(Camino Graveyard :: Drag & Drop, defect)

x86
macOS
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: lthompson.22, Assigned: alqahira)

Details

Attachments

(3 files)

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en; rv:1.9.2.13pre) Gecko/20101114 Camino/2.1a1pre (like Firefox/3.6.13pre) Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en; rv:1.9.2.13pre) Gecko/20101114 Camino/2.1a1pre (like Firefox/3.6.13pre) This is a discrepancy I noticed while writing an applescript. AR: Dragging a .fileloc file into the browser window content area or onto Camino's dock icon will open the referenced file. But dragging a .fileloc onto the tab bar (existing tab or blank area) opens the .fileloc itself (as XML). ER: I would expect to get the same results whether the file (any file, for that matter) is dropped on the content area or the tab bar. The above is also true of .inetloc files (except drops of those aren't accepted by the Dock icon), but I don't know enough about .inetloc files to even guess or what the real-world cases are outside of applescript-generated ones (whereas .fileloc's can come from drags out of Safari). Same AR 1.6.11 to today's 2.1a1pre, tested only in 10.6. Reproducible: Always
On 10.5, the fileloc is downloaded instead. I'm not sure why it works some places and not others, given that we don't ever look for fileloc files ourselves, but conceivably drags to the tab bar somehow avoid hitting either NSPasteboard+Utils or NSURL+Utils code where we handle the other *loc types.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Upon further testing (10.6), it seems that .fileloc's that come from (drags out of) Safari are indeed downloaded when dropped on the tab bar. I was testing mostly .fileloc's generated via applescript, and those get loaded as XML as I described. Moreover, .fileloc's that come from Safari also get downloaded when dropped on Camino's Dock icon, whereas those generated by applescript open the referenced file when dropped on the Dock icon, same as when dropped on the content area. (Sorry for the confusion, it never occurred to me there'd be a difference.) Could this be because the applescript-generated .fileloc's are assigned a file type of 'ilfi' and creator code 'MACS', whereas Safari-generated .fileloc's are not assigned any type or creator codes?
(In reply to comment #2) > Could this be because the applescript-generated .fileloc's are assigned a file > type of 'ilfi' and creator code 'MACS', whereas Safari-generated .fileloc's are > not assigned any type or creator codes? It could be because the ones from Safari are binary plists, and we'd have to have something decode them to even parse them (vs. XML plists, which Gecko will treat as text and parse as XML). So far all I've found here is that we register for the drag types we accept on the tabs and the bar: http://mxr.mozilla.org/camino/source/camino/src/browser/TabButtonView.mm#129 http://mxr.mozilla.org/camino/source/camino/src/browser/BrowserTabBarView.mm#126 I really don't know how that works, and if we can make them go through our file-decoding code or not.
(In reply to comment #3) > So far all I've found here is that we register for the drag types we accept on > the tabs and the bar: > http://mxr.mozilla.org/camino/source/camino/src/browser/TabButtonView.mm#129 > http://mxr.mozilla.org/camino/source/camino/src/browser/BrowserTabBarView.mm#126 > > I really don't know how that works, and if we can make them go through our > file-decoding code or not. What I'd really like to know is where we register for the drag types we accept on the content view. However, I noticed that when I drag a .fileloc (of completely unknown provenance) to the location bar, I get the URL from the .fileloc inserted into the bar. AutoCompleteTextField also registers for kCorePasteboardFlavorType_url here: http://mxr.mozilla.org/camino/source/camino/src/browser/AutoCompleteTextField.mm#328 and those two do not controls do not. The fix may be as simple as that. Someone implement !clone and I'll have my !clone get right on it :P
Attached patch FixSplinter Review
(In reply to comment #4) > The fix may be as simple as that. Nope, that doesn't fix it. The problem turned out to be that NSPasteboard+Utils's |getURLs:andTitles:| didn't consider filelocs as things that needed to be decoded when it called |URLFromInetloc:| on other *loc files, so I fixed that. I then added complete support for filelocs in NSURL+Utils's |decodeLocalFileURL:| (for parity's sake), and, finally, just to tidy things up everywhere, I enabled filelocs in the Open panel. I'm still not sure how the content-area drops work/worked before. The Dock icon/app icon drags, though, work/worked because the Dock/Finder apparently gave us a file:// URL to begin with (and we called |decodeLocalFileURL:| in MainController's |application:openFile:| on it, but that's mostly irrelevant since we had a URL to begin with): > Camino[5828]: Decoding local file “file://localhost/Users/smokey/WWW%20Page/index.html”, pathString “/Users/smokey/WWW Page/index.html” Lisa, just for the sake of completeness, can you zip one of your AppleScript-created filelocs (make it point to somewhere that would work independent of user, e.g. /Library/Preferences/com.apple.headerdoc.exampletocteplate.html). This patch should fix everything, but I'd like to be able to test against one of those just to be sure. Wevah, can you give this a look-over?
Assignee: nobody → alqahira
Status: NEW → ASSIGNED
Attachment #511925 - Flags: review?(moz)
10.6 Applescript-created .fileloc pointing to the prefs file Smokey suggested.
Thanks, Lisa! My fix does indeed handle that one correctly, too. Just for reference, so we'll have the full set archived in this bug, here are filelocs for that same file generated by Camino and Safari.
Comment on attachment 511925 [details] [diff] [review] Fix Looks good to me; r+
Attachment #511925 - Flags: review?(moz) → review+
Attachment #511925 - Flags: superreview?(stuart.morgan+bugzilla)
Comment on attachment 511925 [details] [diff] [review] Fix sr=smorgan
Attachment #511925 - Flags: superreview?(stuart.morgan+bugzilla) → superreview+
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: