Open Bug 1004382 Opened 10 years ago Updated 2 years ago

File > Save Page As... cannot replace loaded document source files

Categories

(Firefox :: File Handling, defect)

28 Branch
x86_64
Windows 7
defect

Tracking

()

UNCONFIRMED

People

(Reporter: bugzilla, Unassigned)

Details

Attachments

(1 file)

938 bytes, application/x-zip-compressed
Details
Attached file sample.zip
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0 (Beta/Release)
Build ID: 20140314220517

Steps to reproduce:

Created an HTML file with an external script reference
Open the document in the current file system (C:\sample.html)
Go to File > Save Page As...
Choose the source file name and path in the current file system as the save as destination (C:\sample.html)
When the confirm overwrite popup window appears, choose Yes, i.e. replace the source files.


Actual results:

The file is not only not saved, but the original source file disappears.

In my little testing, this only happens when a javascript has was registered.


Expected results:

The file should have been saved and replaced (new time stamp).

Apparently this has something to do with how Firefox "locks" the file destination file name in the system by creating an empty temp file with the destination file name. While doing this the source file is emptied because in this case, both the remote file (in this case local) and the destination file are the same. Firefox should have not replaced the existing file with the empty temp file because it already exists. Firefox should have downloaded to OTHER temp file, and once the download is complete, delete the destination file and rename the OTHER temp file to the destination file. 

Sample attached.
Component: Untriaged → File Handling
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: