Mercurial > hg > CommitWatcher
annotate tests/41701d2c0341.diff @ 28:f82331d875f0
wip
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sat, 05 Oct 2013 15:38:32 -0700 |
parents | 7ae60d2ff1c2 |
children |
rev | line source |
---|---|
10
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
1 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
2 # HG changeset patch |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
3 # User Raymond Lee <raymond@raysquare.com> |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
4 # Date 1380236746 -28800 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
5 # Node ID 41701d2c03414fb308a4233f5f69a0416008bf9c |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
6 # Parent a00aba84b699ea26bc3e90428938124d8dae6d26 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
7 Bug 875731 - Replace callers of nsIDownloadManager.usersDownloadsDirectory with Downloads.getUserDownloadsDirectory mobile/andriod/. r=mfinkle |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
8 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
9 diff --git a/mobile/android/components/HelperAppDialog.js b/mobile/android/components/HelperAppDialog.js |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
10 --- a/mobile/android/components/HelperAppDialog.js |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
11 +++ b/mobile/android/components/HelperAppDialog.js |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
12 @@ -8,16 +8,21 @@ const Cu = Components.utils; |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
13 const Cr = Components.results; |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
15 const PREF_BD_USEDOWNLOADDIR = "browser.download.useDownloadDir"; |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
16 const URI_GENERIC_ICON_DOWNLOAD = "drawable://alert_download"; |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
17 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
18 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
19 Cu.import("resource://gre/modules/Services.jsm"); |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
20 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
21 +XPCOMUtils.defineLazyModuleGetter(this, "Downloads", |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
22 + "resource://gre/modules/Downloads.jsm"); |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
23 +XPCOMUtils.defineLazyModuleGetter(this, "Task", |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
24 + "resource://gre/modules/Task.jsm"); |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
25 + |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
26 // ----------------------------------------------------------------------- |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
27 // HelperApp Launcher Dialog |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
28 // ----------------------------------------------------------------------- |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
29 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
30 function HelperAppLauncherDialog() { } |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
31 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
32 HelperAppLauncherDialog.prototype = { |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
33 classID: Components.ID("{e9d277a0-268a-4ec2-bb8c-10fdf3e44611}"), |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
34 @@ -25,25 +30,26 @@ HelperAppLauncherDialog.prototype = { |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
35 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
36 show: function hald_show(aLauncher, aContext, aReason) { |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
37 // Save everything by default |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
38 aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.useSystemDefault; |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
39 aLauncher.saveToDisk(null, false); |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
40 }, |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
41 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
42 promptForSaveToFile: function hald_promptForSaveToFile(aLauncher, aContext, aDefaultFile, aSuggestedFileExt, aForcePrompt) { |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
43 - // Retrieve the user's default download directory |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
44 - let dnldMgr = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager); |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
45 - let defaultFolder = dnldMgr.userDownloadsDirectory; |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
46 + return Task.spawn(function() { |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
47 + // Retrieve the user's default download directory |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
48 + let defaultFolder = yield Downloads.getPreferredDownloadsDirectory(); |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
49 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
50 - try { |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
51 - file = this.validateLeafName(defaultFolder, aDefaultFile, aSuggestedFileExt); |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
52 - } catch (e) { } |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
53 + try { |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
54 + file = this.validateLeafName(defaultFolder, aDefaultFile, aSuggestedFileExt); |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
55 + } catch (e) { } |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
56 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
57 - return file; |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
58 + throw new Task.Result(file); |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
59 + }.bind(this)); |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
60 }, |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
61 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
62 validateLeafName: function hald_validateLeafName(aLocalFile, aLeafName, aFileExt) { |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
63 if (!(aLocalFile && this.isUsableDirectory(aLocalFile))) |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
64 return null; |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
65 |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
66 // Remove any leading periods, since we don't want to save hidden files |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
67 // automatically. |
7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
68 |