Closed Bug 1287661 Opened 9 years ago Closed 9 years ago

Investigate the mimeType.rdf usage of helperApp.js

Categories

(Firefox :: File Handling, defect, P2)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: alchen, Assigned: edenchuang)

References

Details

(Whiteboard: [CHE-MVP])

helperApps.js is a consumer of mimeType.rdf. We need to make the function work when we use mimeType.json to replace mimeType.rdf.
Blocks: 474043
Summary: Rewrite helperApps.js to have the ability to use both JSON and RDF file → Re​vise​ helperApps.js to to ​be compatible with both JSON and RDF file​s
Assignee: nobody → alchen
Whiteboard: [CHE-MVP]
Set priority to P2 because we're going to implement this feature on Firefox 52. @ Development Schedule: https://docs.google.com/spreadsheets/d/1WznJUt7lLvcZwwry0yvJ_-hw0ZAXTxOOvmYCw74uGKY/edit#gid=0
Priority: -- → P2
Summary: Re​vise​ helperApps.js to to ​be compatible with both JSON and RDF file​s → Investigate the mimeType.rdf usage of helperApp.js
Assignee: alchen → echuang
Currently we found that HelperApps.js and its related testcases directly access mimeTypes.rdf through nsIRDFService. These actions are not expected, they should be done through the nsIHandlerSerivce. However, nsIHandlerService::store() is useless. HelperApps.js accesses mimeTypes.rdf to save the file extension attribute. The file extension is not the member of nsIHandlerInfo, but is a member of nsIMIMEInfo which is an extension of nsIHandlerInfo. Because nsIHandlderService only deals the nsIHandlerInfo, this is the root cause why nsIHandlerSerivce::store is useless for saving file extension. The next step, I will analyze the necessity of saving file extension first. If the answer is yes, I will integrate the file extension saving into nsIHandlerService. Otherwise, the corresponding code in HelperApps.js and its related testcases will be removed.
After investigation, I think we can use nsIHandlerService::Store() to replace the HelperApps.js in nsHelperAppDlg.js. HelperApps.js is used to store the selected handler information into mimeTypes.rdf, and it is almost the same with what nsIHandlerService does. After testing by manually, there is no difference in mimeTypes.rdf results between using HelperApps.js and nsIHandlerService::Store(). So I suggest we can replace HelperApps.js by nsIHandlerService.
Flags: needinfo?(paolo.mozmail)
(In reply to Eden Chuang[:edenchuang] from comment #3) > After testing by manually, there > is no difference in mimeTypes.rdf results between using HelperApps.js and > nsIHandlerService::Store(). So I suggest we can replace HelperApps.js by > nsIHandlerService. Sounds good, we should just ensure that we have automated tests that cover the code path that currently uses HelperApps.js. If there isn't one, we can write one in this bug.
Flags: needinfo?(paolo.mozmail)
The patch implementation will be traced on bug 1287664. HelperApps.js has its own test cases, I will make sure these test cases are passed. Of course, if new test cases are needed, I will also write corresponding one for testing.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.