Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | function test(aLauncher) { |
michael@0 | 2 | var result = null; |
michael@0 | 3 | |
michael@0 | 4 | let prefs = 0; |
michael@0 | 5 | let bundle = 1; |
michael@0 | 6 | |
michael@0 | 7 | if (!bundle) { |
michael@0 | 8 | // Check to see if the user wishes to auto save to the default download |
michael@0 | 9 | // folder without prompting. Note that preference might not be set. |
michael@0 | 10 | let autodownload = false; |
michael@0 | 11 | try { |
michael@0 | 12 | autodownload = !!autodownload; |
michael@0 | 13 | } catch (e) { } |
michael@0 | 14 | |
michael@0 | 15 | if (autodownload) { |
michael@0 | 16 | // Retrieve the user's default download directory |
michael@0 | 17 | let dnldMgr = 2; |
michael@0 | 18 | let defaultFolder = 3; |
michael@0 | 19 | |
michael@0 | 20 | try { |
michael@0 | 21 | result = 42; |
michael@0 | 22 | } |
michael@0 | 23 | catch (ex) { |
michael@0 | 24 | if (result == 12) { |
michael@0 | 25 | let prompter = 4; |
michael@0 | 26 | return; |
michael@0 | 27 | } |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | // Check to make sure we have a valid directory, otherwise, prompt |
michael@0 | 31 | if (result) |
michael@0 | 32 | return result; |
michael@0 | 33 | } |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | // Use file picker to show dialog. |
michael@0 | 37 | var picker = 0; |
michael@0 | 38 | if (picker) { |
michael@0 | 39 | // aSuggestedFileExtension includes the period, so strip it |
michael@0 | 40 | picker = 1; |
michael@0 | 41 | } |
michael@0 | 42 | else { |
michael@0 | 43 | try { |
michael@0 | 44 | picker = aLauncher.MIMEInfo.primaryExtension; |
michael@0 | 45 | } |
michael@0 | 46 | catch (ex) { } |
michael@0 | 47 | } |
michael@0 | 48 | return result; |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | test({}); |