Closed Bug 155334 Opened 22 years ago Closed 22 years ago

Unable to save page as plain text format

Categories

(Camino Graveyard :: General, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: chrispetersen, Assigned: sfraser_bugs)

Details

(Keywords: regression)

Build: 2002-07-01-05
Platform: OS X 10.1.5
Expected Results: A new text file containing the page's content should be
created on my local drive
What I got: Save File dialog opens and progress indicator will endlessly cycle.
Basically, no file is actually created on drive.

Steps to reproduce:

1) Go to any site
2) Choose Save As from File menu
3) Specify name of file and locate to save it.Click Save.
4) Saving File dialog opens and progress indicator to cycle. Status area in
dialog remains: 0.0 bytes of ??? total (at 0.0 bytes/sec)
5) No text file is ever saved to drive.
07-02 build.

The key here is saving the file as plain text format.  The other two options,
HTML complete and HTML source only, work.
Confirmed using Chimera/20020701.
Though this bug still remains in the latest build, I can no longer cancel or
close the Save as dialog when attempting to save as plain text. I was able
complete this task on the July 2nd build but can't now on the 3rd build. Wonder
if this is somewhat related to the check in for
http://bugzilla.mozilla.org/show_bug.cgi?id=154913.
Blocks: 147975
->sdagley
Assignee: saari → sdagley
For me the page does get saved, but the progress dialog problems remain.
Regression from the fix for bug 154277, I think.
So when saving in plain text format, the onStateChange just gets two notifications:

STATE_START
STATE_STOP

When saving a single HTML page, we get:

STATE_IS_NETWORK + STATE_IS_REQUEST + STATE_START
STATE_IS_NETWORK + STATE_IS_REQUEST + STATE_STOP

When saving HTML complete, we get:

STATE_IS_NETWORK + STATE_IS_REQUEST + STATE_START
STATE_IS_REQUEST + STATE_STOP
STATE_IS_REQUEST + STATE_START
STATE_IS_NETWORK + STATE_IS_REQUEST + STATE_STOP
(assuming 1 image).

So how are we supposed to know when the download is really finished?
For now I'm fixing it so that we look for the STATE_NETWORK bit on the first
notification, then match that up with the last one, so:

 nsDownloadListener::OnStateChange(nsIWebProgress *aWebProgress,  nsIRequest
*aRequest,  PRUint32 aStateFlags, 
                                     PRUint32 aStatus)
 {
+  if (!mGotFirstStateChange)
+  {
+    mNetworkTransfer = ((aStateFlags & STATE_IS_NETWORK) != 0);
+    mGotFirstStateChange = PR_TRUE;
+  }
+  
   // when the entire download finishes, stop the progress timer and clean up
   // the window and controller. We will get this even in the event of a cancel,
   // so this is the only place in the listener where we should kill the download.
-  if ((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_NETWORK)) {
+  if ((aStateFlags & STATE_STOP) && (!mNetworkTransfer || (aStateFlags &
STATE_IS_NETWORK))) {
     [mController killDownloadTimer];
     [mController setDownloadProgress:nil];
   }

Taking bug.
Assignee: sdagley → sfraser
Checked in the above patch (and detabbed the file).
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Thanks, Simon.. Verified on the 2002-07-22-05 NB.
Status: RESOLVED → VERIFIED
Regressed in the 7/24 NB (2002-07-24-05)
Status: VERIFIED → REOPENED
Keywords: regression
Resolution: FIXED → ---
chris, could you be seeing bug 159170? for me the progress meter just keeps
animating when the d/l window remains open. the file, however, is still saved.
This is actually a slightly different issue, which is covered by bug 159170, so
re-resolving this one.
Status: REOPENED → RESOLVED
Closed: 22 years ago22 years ago
Resolution: --- → FIXED
Yes, the document is getting saved but progress indicator continues to animate.
This bug is actually fixed. Marking verified.
Status: RESOLVED → VERIFIED
No longer blocks: 147975
You need to log in before you can comment on or make changes to this bug.