James Rose created CB-877:
-----------------------------

             Summary: Opening a .doc file under iOS causes the file system API 
to break (and any other plugins that may use NSMutableArray pop)
                 Key: CB-877
                 URL: https://issues.apache.org/jira/browse/CB-877
             Project: Apache Cordova
          Issue Type: Bug
          Components: iOS
    Affects Versions: 1.4.0
         Environment: Simple project that opens a word document in iOS 5.0+
            Reporter: James Rose
            Assignee: Shazron Abdullah


After getting the UIWebView to navigate to a .doc the FileSystem API breaks.
in javascript:
FileSystem.root.getFile(<path to word document>, { create: false }, function 
(fs_file){
    window.location = fs_file.toURI();
}
Then in the shouldStartLoadWithRequest method open the word doc, and after x 
seconds redirect it the home page again (faster than creating a new view 
controller etc).
Once back on the home page try call any of the FileSystem API's and they won't 
run the success or failure callbacks.
It seems that the control that opens the word documents overrides the 
NSMutableArray pop implementation added in NSMutableArray+QueueAdditions, it no 
longer returns the first element in the array, instead it returns the last 
element (checking the function pointer for pop before/after opening the word 
document returns different results).

CDVFile seems to be the only code where the pop method is used, and seems to be 
the only part that is broken.

Suggested fix: rather than calling [arguments pop] use [arguments 
objectAtIndex:0]

Side note:
Calling [arguments objectAtIndex:0] followed by VERIFY_ARGUMENTS won't call the 
callbacks if they exist either, in the verifyArgument method in CDVPlugin, if 
you pass a callbackId to the method it then does:
NSString* callbackId = [arguments objectAtIndex:0];
and returns the failure to that callbackId rather than the one you specified, 
since the callbackId has been removed from the array it will try callback on 
the first parameter.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to