New issue
Advanced search Search tips

Issue 650805 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug

Blocking:
issue 622481



Sign in to add a comment

Prepare third_party/mozilla/NSURL+Utils.m for 10.8 deployment target.

Project Member Reported by erikc...@chromium.org, Sep 27 2016

Issue description

.webloc files, resource forks....this looks like a simple replacement:

-[NSPropertyListSerialization propertyListWithData:...]
http://mikeabdullah.net/read-webloc-files-cocoa.html
 
[10784/38611] OBJC obj/third_party/mozilla/mozilla/NSURL+Utils.o
../../third_party/mozilla/NSURL+Utils.m:70:17: warning: 'FSPathMakeRef' is deprecated: first deprecated in macOS 10.8 [-Wdeprecated-declarations]
  if (inFile && FSPathMakeRef((UInt8 *)[inFile fileSystemRepresentation], &ref, NULL) == noErr) {
                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Files.h:4115:18: note: 'FSPathMakeRef' has been explicitly marked deprecated here
extern OSStatus  FSPathMakeRef(const UInt8 *path, FSRef *ref, Boolean *isDirectory)        __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA);
                 ^
../../third_party/mozilla/NSURL+Utils.m:73:14: warning: 'FSOpenResFile' is deprecated: first deprecated in macOS 10.8 [-Wdeprecated-declarations]
    resRef = FSOpenResFile(&ref, fsRdPerm);
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Resources.h:917:1: note: 'FSOpenResFile' has been explicitly marked deprecated here
FSOpenResFile(
^
../../third_party/mozilla/NSURL+Utils.m:78:27: warning: 'Get1Resource' is deprecated: first deprecated in macOS 10.8 [-Wdeprecated-declarations]
      if ((urlResHandle = Get1Resource('url ', 256))) { // Has 'url ' resource with ID 256.
                          ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Resources.h:383:1: note: 'Get1Resource' has been explicitly marked deprecated here
Get1Resource(
^
../../third_party/mozilla/NSURL+Utils.m:81:16: warning: 'GetMaxResourceSize' is deprecated: first deprecated in macOS 10.8 [-Wdeprecated-declarations]
        size = GetMaxResourceSize(urlResHandle);
               ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Resources.h:598:1: note: 'GetMaxResourceSize' has been explicitly marked deprecated here
GetMaxResourceSize(Handle theResource)                        __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA);
^
../../third_party/mozilla/NSURL+Utils.m:92:7: warning: 'CloseResFile' is deprecated: first deprecated in macOS 10.8 [-Wdeprecated-declarations]
      CloseResFile(resRef);
      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Resources.h:148:1: note: 'CloseResFile' has been explicitly marked deprecated here
CloseResFile(ResFileRefNum refNum)                            __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA);
^
5 warnings generated.

Status: Available (was: Untriaged)

Comment 3 by rsesek@chromium.org, Sep 29 2016

We also deal with webloc files using in the location bar ( issue 650798 ).
Labels: OS-Mac
Owner: eugene...@chromium.org
Status: Assigned (was: Available)
Will take a look at this one.
Cc: rsesek@chromium.org
I did not find any modern API to open resource forks on Mac. So I think we have 2 options here:

1.) Suppress the warning and use weak symbols checks to make sure we won't call this API when it's removed from runtime
2.) Add a UMA metric to check how frequently .webloc/.ftploc contain resource forks. I would say that if resource fork is used by less than 0.1% percent of the users we should drop it's support.

I would go with option #2 because why keep support for archaic technology if no one uses it. WDYT?
I think (2) is fine, but is it even necessary? Based on the link I used quoted in the opening comment, it seems like all the logic might just be replaceable with a call to [NSPropertyListSerialization propertyListWithData:...]? 

Oh, right, I missed that. Will try the suggestion from that quote.
[NSPropertyListSerialization propertyListWithData:...] is not different from already existing code ([[NSDictionary alloc] initWithContentsOfFile:inFile]) and it opens webloc files just fine. I guess I'm just removing resource fork reading which can not be done via modern API.
Status: Started (was: Assigned)
CL: https://codereview.chromium.org/2391653003
Project Member

Comment 10 by bugdroid1@chromium.org, Oct 6 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a1b9e0379d00e4d1711aaf97581c0dd0ac9c21c6

commit a1b9e0379d00e4d1711aaf97581c0dd0ac9c21c6
Author: eugenebut <eugenebut@chromium.org>
Date: Thu Oct 06 04:10:32 2016

[Mac Fix-It] Removed usage of deprecated resource fork API.

There is no modern API to open resource forks on macOS. Currently used
API is deprecated and its usage should be removed as a part of
"Chrome Mac Deployment Target Fix-It". |URLFromInetloc| allows opening
of webloc files created by Safari, which works fine just by reading data
from webloc plist. New implementation will not open resource forks, but
it's very unlikely that they would exist on modern macOS.

BUG= 650805 

Review-Url: https://codereview.chromium.org/2391653003
Cr-Commit-Position: refs/heads/master@{#423427}

[modify] https://crrev.com/a1b9e0379d00e4d1711aaf97581c0dd0ac9c21c6/third_party/mozilla/NSURL+Utils.m

eugenebut: Is this fixed?
Status: Fixed (was: Started)
Project Member

Comment 13 by bugdroid1@chromium.org, Oct 27 2016

Labels: merge-merged-2840
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a1b9e0379d00e4d1711aaf97581c0dd0ac9c21c6

commit a1b9e0379d00e4d1711aaf97581c0dd0ac9c21c6
Author: eugenebut <eugenebut@chromium.org>
Date: Thu Oct 06 04:10:32 2016

[Mac Fix-It] Removed usage of deprecated resource fork API.

There is no modern API to open resource forks on macOS. Currently used
API is deprecated and its usage should be removed as a part of
"Chrome Mac Deployment Target Fix-It". |URLFromInetloc| allows opening
of webloc files created by Safari, which works fine just by reading data
from webloc plist. New implementation will not open resource forks, but
it's very unlikely that they would exist on modern macOS.

BUG= 650805 

Review-Url: https://codereview.chromium.org/2391653003
Cr-Commit-Position: refs/heads/master@{#423427}

[modify] https://crrev.com/a1b9e0379d00e4d1711aaf97581c0dd0ac9c21c6/third_party/mozilla/NSURL+Utils.m

Comment 14 by dimu@google.com, Nov 4 2016

Labels: -merge-merged-2840
[Automated comment] removing mislabelled merge-merged-2840

Sign in to add a comment