author | Gavin Sharp <gavin@gavinsharp.com> |
Mon, 11 Jun 2012 17:44:13 -0700 (2012-06-12) | |
changeset 118188 | b265662ba653b7241b01c50bf9a9decb193d2c1c |
parent 118187 | a38e24746312b09a8d3d08303f9f8b751d795fe9 |
child 118189 | 32f052fe66156edd503946d8be5df652fc7bb130 |
push id | 24153 |
push user | emorley@mozilla.com |
push date | Wed, 09 Jan 2013 13:34:18 +0000 (2013-01-09) |
treeherder | mozilla-central@be151be0cf60 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | adw |
bugs | 762705 |
milestone | 21.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/toolkit/mozapps/downloads/nsHelperAppDlg.js +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js @@ -104,17 +104,16 @@ Components.utils.import("resource://gre/ Components.utils.import("resource://gre/modules/DownloadUtils.jsm"); /* ctor */ function nsUnknownContentTypeDialog() { // Initialize data properties. this.mLauncher = null; this.mContext = null; - this.mSourcePath = null; this.chosenApp = null; this.givenDefaultApp = false; this.updateSelf = true; this.mTitle = ""; } nsUnknownContentTypeDialog.prototype = { classID: Components.ID("{F68578EB-6EC2-4169-AE19-8C6243F0ABE1}"), @@ -365,17 +364,20 @@ nsUnknownContentTypeDialog.prototype = { // ---------- implementation methods ---------- // initDialog: Fill various dialog fields with initial content. initDialog : function() { // Put file name in window title. var suggestedFileName = this.mLauncher.suggestedFileName; // Some URIs do not implement nsIURL, so we can't just QI. - var url = this.mLauncher.source; + var url = this.mLauncher.source; + if (url instanceof Components.interfaces.nsINestedURI) + url = url.innermostURI; + var fname = ""; var iconPath = "goat"; this.mSourcePath = url.prePath; if (url instanceof Components.interfaces.nsIURL) { // A url, use file name from it. fname = iconPath = url.fileName; this.mSourcePath += url.directory; } else { @@ -509,38 +511,27 @@ nsUnknownContentTypeDialog.prototype = { }, // initIntro: initIntro: function(url, filename, displayname) { this.dialogElement( "location" ).value = displayname; this.dialogElement( "location" ).setAttribute("realname", filename); this.dialogElement( "location" ).setAttribute("tooltiptext", displayname); - // if mSourcePath is a local file, then let's use the pretty path name instead of an ugly - // url... - var pathString = this.mSourcePath; - try - { - var fileURL = url.QueryInterface(Components.interfaces.nsIFileURL); - if (fileURL) - { - var fileObject = fileURL.file; - if (fileObject) - { - var parentObject = fileObject.parent; - if (parentObject) - { - pathString = parentObject.path; - } - } - } - } catch(ex) {} + // if mSourcePath is a local file, then let's use the pretty path name + // instead of an ugly url... + var pathString; + if (url instanceof Components.interfaces.nsIFileURL) { + try { + // Getting .file might throw, or .parent could be null + pathString = url.file.parent.path; + } catch (ex) {} + } - if (pathString == this.mSourcePath) - { + if (!pathString) { // wasn't a fileURL var tmpurl = url.clone(); // don't want to change the real url try { tmpurl.userPass = ""; } catch (ex) {} pathString = tmpurl.prePath; }