Closed Bug 406857 Opened 17 years ago Closed 16 years ago

Don't clear referrer when restarting downloads

Categories

(Toolkit :: Downloads API, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9beta4

People

(Reporter: Mardak, Assigned: Mardak)

References

Details

Attachments

(2 files, 3 obsolete files)

If you cancel a download, you'll see the referrer's TLD in the display, but when you restart it then finish/cancel, it becomes the download location.

Seems like we kill the referrer info when restarting.
Litmus would probably be start a download with a referrer like mozilla.com download firefox (make sure it's a mirror not from mozilla.com..), cancel the download, see it says mozilla.com; restart download and let download a bit; cancel; make sure it stil says mozilla.com; repeat once again for good justice.

Shawn: Any ideas for a testcase somehow setting up the channel to not report a referrer a second time through.. or however NS_GetReferrerFromChannel does its business..
Flags: in-testsuite?
Flags: in-litmus?
Whiteboard: [has patch][needs review sdwilsh]
Attached patch v1 (obsolete) — Splinter Review
Save the old referrer and reuse it if the new one is null.
Assignee: nobody → edilee
Status: NEW → ASSIGNED
Attachment #291521 - Flags: review?(comrade693+bmo)
Comment on attachment 291521 [details] [diff] [review]
v1

r=sdwilsh

I would like a unit test on this before it lands.
Attachment #291521 - Flags: review?(comrade693+bmo) → review+
Whiteboard: [has patch][needs review sdwilsh] → [needs new patch Mardak][has review]
Any status change on this?
Any suggestions or you want to write the test? :) I suppose because we need to actually have a server response, we'll need to use the javascript http server. We could start a download in a canceled state with a referrer set and restart it.
Attached patch v1.1 (obsolete) — Splinter Review
Now with more testcase!
Attachment #291521 - Attachment is obsolete: true
Attachment #304837 - Flags: review+
Attachment #304837 - Flags: approval1.9?
Comment on attachment 304837 [details] [diff] [review]
v1.1

a=beltzner for 1.9
Attachment #304837 - Flags: approval1.9? → approval1.9+
Checking in toolkit/components/downloads/src/nsDownloadManager.cpp;
/cvsroot/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp,v  <--  nsDownloadManager.cpp
new revision: 1.164; previous revision: 1.163
done
Checking in toolkit/mozapps/downloads/tests/browser/Makefile.in;
/cvsroot/mozilla/toolkit/mozapps/downloads/tests/browser/Makefile.in,v  <--  Makefile.in
new revision: 1.11; previous revision: 1.10
done
RCS file: /cvsroot/mozilla/toolkit/mozapps/downloads/tests/browser/browser_bug_406857.js,v
done
Checking in toolkit/mozapps/downloads/tests/browser/browser_bug_406857.js;
/cvsroot/mozilla/toolkit/mozapps/downloads/tests/browser/browser_bug_406857.js,v  <--  browser_bug_406857.js
initial revision: 1.1
done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Flags: in-testsuite? → in-testsuite+
Resolution: --- → FIXED
Whiteboard: [needs new patch Mardak][has review]
Target Milestone: --- → Firefox 3 beta4
I backed this out because the test failed on win2k3 and no-one was around.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Thanks roc.

Shawn: Is it okay if I just use settimeout 100? It's probably timing out because I send the enter key too early before the list populates. I thought it was going to be a problem, but I tried it without a timeout on my machine and it worked okay.

	FAIL - Timed out - chrome://mochikit/content/browser/toolkit/mozapps/downloads/tests/browser/browser_bug_406857.js
talk to sayrer?
Attached patch v1.2Splinter Review
Thought of something during my waltz class ;)
Attachment #304837 - Attachment is obsolete: true
Checking in toolkit/components/downloads/src/nsDownloadManager.cpp;
/cvsroot/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp,v  <--  nsDownloadManager.cpp
new revision: 1.167; previous revision: 1.166
done
Checking in toolkit/mozapps/downloads/tests/browser/Makefile.in;
/cvsroot/mozilla/toolkit/mozapps/downloads/tests/browser/Makefile.in,v  <--  Makefile.in
new revision: 1.13; previous revision: 1.12
done
Checking in toolkit/mozapps/downloads/tests/browser/browser_bug_406857.js;
/cvsroot/mozilla/toolkit/mozapps/downloads/tests/browser/browser_bug_406857.js,v  <--  browser_bug_406857.js
new revision: 1.3; previous revision: 1.2
done
Status: REOPENED → RESOLVED
Closed: 16 years ago16 years ago
Resolution: --- → FIXED
Relanding x3..

Checking in toolkit/components/downloads/src/nsDownloadManager.cpp;
/cvsroot/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp,v  <--  nsDownloadManager.cpp
new revision: 1.169; previous revision: 1.168
done
Checking in toolkit/mozapps/downloads/tests/browser/Makefile.in;
/cvsroot/mozilla/toolkit/mozapps/downloads/tests/browser/Makefile.in,v  <--  Makefile.in
new revision: 1.15; previous revision: 1.14
done
Checking in toolkit/mozapps/downloads/tests/browser/browser_bug_406857.js;
/cvsroot/mozilla/toolkit/mozapps/downloads/tests/browser/browser_bug_406857.js,v  <--  browser_bug_406857.js
new revision: 1.5; previous revision: 1.4
done
Verified FIXED using:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9b4pre) Gecko/2008022304 Minefield/3.0b4pre

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b4pre) Gecko/2008022308 Minefield/3.0b4pre

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b4pre) Gecko/2008022308 Minefield/3.0b4pre
Status: RESOLVED → VERIFIED
Cotton-pickin' VM :-)

Last build ID should be:

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b4pre) Gecko/2008022304 Minefield/3.0b4pre
Any idea why the unit tests for this would be passing, but then timing out? 

I'm seeing this on two win2k3 boxes I'm trying to get setup right now to improve our unit test coverage.

Brief log at:
http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTest/1207755300.1207755461.8150.gz

I've watched it run, and the Downloads window just sits there and doesn't close with referrer.goes as the only entry after the test completes.
Uh.. very strange. Right after the "ok()" for PASS - Got referrer on finish, it calls finish(), so I don't see why it would time out..
If I comment out the "file.remove(false);" immediately before the finish() in the unit test, the test finishes without timing out.

Thoughts on this? I'm not sure what file.remove(false) is doing, and I'll also note that this test works without change on other win2k3 boxes without the change.
Attached patch testcase update v1 (obsolete) — Splinter Review
Chris: Try this patch?
Oh duh. Windows has strange stuff with removing files, yeah try/catch it.
Checking in toolkit/mozapps/downloads/tests/browser/browser_bug_406857.js;
/cvsroot/mozilla/toolkit/mozapps/downloads/tests/browser/browser_bug_406857.js,v  <--  browser_bug_406857.js
new revision: 1.7; previous revision: 1.6
done
Attachment #314633 - Attachment is obsolete: true
That did the trick. Thanks!
This unit test should have been an xpcshell unit test instead of a browser test.  Any reason why we went with a browser test instead?
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: