Closed Bug 402458 Opened 18 years ago Closed 18 years ago

saveDocument func calls internalSave with aSkipPrompt param in the wrong position @ contentAreaUtils.js:168

Categories

(Firefox :: File Handling, defect, P2)

defect

Tracking

()

RESOLVED FIXED
Firefox 3 beta2

People

(Reporter: camille.blardone, Assigned: sgautherie)

References

Details

Attachments

(1 file, 5 obsolete files)

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419.3 (KHTML, like Gecko) Safari/419.3 Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9 saveDocument(aDocument, aSkipPrompt) calls internalSave(aDocument.location.href, aDocument, null, contentDisposition, aDocument.contentType, false, null, null, aSkipPrompt); with 9 parameters instead of 10. As a result, aSkipPrompt which should be the 10th parameters is always interpreted as "undefined" by "internalSave(...)". A a consequence, the file prompt is always asked for every code that is using saveDocument(aDocument, aSkipPrompt) to save a document. Which is the answer to some bugs. Reproducible: Always Steps to Reproduce: 1. 2. 3.
(In reply to comment #0) > saveDocument(aDocument, aSkipPrompt) > > calls > > internalSave(aDocument.location.href, aDocument, null, contentDisposition, > aDocument.contentType, false, null, null, aSkipPrompt); In the future, please provide a filename / line no for the file you're talking about or just link to it at bonsai/mxr (mxr.mozilla.org and bonsai.mozilla.org) > with 9 parameters instead of 10. As a result, aSkipPrompt which should be the > 10th parameters is always interpreted as "undefined" by "internalSave(...)". > > A a consequence, the file prompt is always asked for every code that is using > saveDocument(aDocument, aSkipPrompt) to save a document. The aSkipPrompt in saveDocument's call to internalSave was added while porting code from xpfe to toolkit in bug 294759. blocking that bug. > Which is the answer to some bugs. I'm personally wondering as I've just looked at this code for the first time today and it might be helpful: which ones? Also of course please mention any related bugs which have been filed. I don't have time to look much more at this now but I'll provide links if necessary tonight. I wanted to move this to toolkit as that's where the code is but can't find a relevant component and the bug blocking this was done in the current component.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Mac OS X → All
Version: unspecified → Trunk
Depends on: 294759
Summary: saveDocument(aDocument, aSkipPrompt) incorrectly calls "internalSave(...)" which causes "aSkipPrompt" to be always false → saveDocument func calls internalSave with aSkipPrompt param in the wrong position @ contentAreaUtils.js:168
Camille, can you attach a patch?
Promise to be more precise about file/line. (chrome/toolkit.jar) (toolkit/content/global/contentAreaUtils.js - line 201) I'll post a patch soon and try to fix this.
The only thing it chances, is that its adds "null," just before ", aSkipPrompt);" in internalSave(aDocument.location.href, aDocument, null, contentDisposition, aDocument.contentType, false, null, null, null, aSkipPrompt); line 202 The consequence is that if aSkipPrompt happens to be "true" then the save as file dialog won't appear if a default path is defined for download in firefox preferences.
Thanks Camille! That appears to be the full file; it would be better if you could attach a patch. You can read http://developer.mozilla.org/en/docs/Creating_a_patch for details on doing that from CVS (preferred way), or you could also just use diff -u (not optimal, but easier).
We totally want this for Firefox3, I assert.
Flags: blocking-firefox3?
Priority: -- → P3
Is there a "referrer URI object" to get/use instead of |null| ? FTR: Av1-TK was a modified MacOSX v1.8 branch packaged file.
Assignee: nobody → sgautherie.bz
Attachment #287720 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #288201 - Flags: review?(mano)
Attachment #287720 - Attachment description: a Path that correct the error in saveDocument in contentAreaUtils.js → (Av1-TK) a Path that correct the error in saveDocument in contentAreaUtils.js
Comment on attachment 288201 [details] [diff] [review] (Av1a-TK) Add |null| value as |aReferrer| parameter We should pass aDocument.referrer as a uri object, I think. Something like |aDocument.referrer ? IO.newURI(aDocument.referrer) : null|.
Attachment #288201 - Flags: review?(mano) → review-
Av1a-TK, with comment 8 update. (untested)
Attachment #288201 - Attachment is obsolete: true
Attachment #288390 - Flags: review?
Attachment #288390 - Flags: review? → review?(mano)
Yeah, we want this ASAP.
Flags: blocking-firefox3? → blocking-firefox3+
Priority: P3 → P2
Whiteboard: [has patch][need review mano]
Target Milestone: --- → Firefox 3 M10
Comment on attachment 288390 [details] [diff] [review] (Av2-TK) Adds |aDocument.referrer| value as |aReferrer| parameter r=mano
Attachment #288390 - Flags: review?(mano) → review+
Keywords: checkin-needed
Whiteboard: [has patch][need review mano]
Same fix as Av2-TK.
Attachment #289851 - Flags: superreview?(neil)
Attachment #289851 - Flags: review?(neil)
Comment on attachment 289851 [details] [diff] [review] (Bv1-SM) Adds |aDocument.referrer| value as |aReferrer| parameter >+ aDocument.referrer >+ ? makeURI(aDocument.referrer, getCharsetforSave(aDocument)) >+ : null Nit: I think aDocument.referrer is always ASCII, so you don't need a charset Nit: use && instead of ? : null
Attachment #289851 - Flags: review?(neil) → review+
It would be nice to keep these in sync, so if Neil has problems with the patch, address his comments for both SeaMonkey and Toolkit. :)
Keywords: checkin-needed
Merges Av2-TK and Bv1-SM, with comment 13 update.
Attachment #288390 - Attachment is obsolete: true
Attachment #289851 - Attachment is obsolete: true
Attachment #289948 - Flags: superreview?(neil)
Attachment #289948 - Flags: review?(mano)
Attachment #289851 - Flags: superreview?(neil)
Attachment #289948 - Flags: review?(mano) → review+
Comment on attachment 289948 [details] [diff] [review] (Cv1) Adds |aDocument.referrer| value as |aReferrer| parameter So, I was 50% right - document.referrer seems to be escaped UTF8 but you can't use &&, it has to be ? : null or whatever you had before, I forget.
Attachment #289948 - Flags: superreview?(neil) → superreview-
Comment on attachment 289948 [details] [diff] [review] (Cv1) Adds |aDocument.referrer| value as |aReferrer| parameter gah
Attachment #289948 - Flags: review+
(In reply to comment #16) > (From update of attachment 289948 [details] [diff] [review]) [Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9b2pre) Gecko/2007112602 SeaMonkey/2.0a1pre] (nightly) (W2Ksp4) > So, I was 50% right - document.referrer seems to be escaped UTF8 but you can't I had a look at <http://mxr.mozilla.org/seamonkey/source/netwerk/base/public/nsIProtocolHandler.idl#67> but I don't know how to check this. With |aDocument.referrer = "http://www.yahoo.co.jp/"|, |getCharsetforSave(aDocument)| returns |"EUC-JP"| :-| > use &&, it has to be ? : null or whatever you had before, I forget. Right ... because when there is no actual referrer |aDocument.referrer| is an empty sting and not the |null| value (which we want to use) :-|
Cv1, with comment 16 update.
Attachment #289948 - Attachment is obsolete: true
Attachment #290238 - Flags: superreview?(neil)
Attachment #290238 - Flags: review?(mano)
Attachment #290238 - Flags: superreview?(neil) → superreview+
Attachment #290238 - Flags: review?(mano) → review+
Checking in toolkit/content/contentAreaUtils.js; /cvsroot/mozilla/toolkit/content/contentAreaUtils.js,v <-- contentAreaUtils.js new revision: 1.99; previous revision: 1.98 done Checking in suite/common/contentAreaUtils.js; /cvsroot/mozilla/suite/common/contentAreaUtils.js,v <-- contentAreaUtils.js new revision: 1.149; previous revision: 1.148 done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Attachment #290238 - Attachment description: (Cv2) Adds |aDocument.referrer| value as |aReferrer| parameter → (Cv2) Adds |aDocument.referrer| value as |aReferrer| parameter [Checkin: Comment 20]
Camille, thanks for your detailed report !
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: