Closed Bug 1281415 Opened 8 years ago Closed 8 years ago

ProcessNextURI is not called when prefetching <link rel="prefetch">

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: tnguyen, Assigned: dragana)

Details

(Whiteboard: btpp-active)

Attachments

(2 files)

In attempting to write some test cases related to link rel=prefetch and see if the link resource is completely prefetched, I found that the prefetching is never finished in particular conditions.
ProcessNextURI in [1] is never called when mStopCount is not 0 (and it is not 0 in some race conditions, then prefetching gets stuck)
[1] https://dxr.mozilla.org/mozilla-central/source/uriloader/prefetch/nsPrefetchService.cpp#374
Summary: ProcessNextURI is not call when prefetching <link rel="prefetch"> → ProcessNextURI is not called when prefetching <link rel="prefetch">
Attached file mStopCount log
mStopCount log
Running : ./mach mochitest -f chrome dom/base/test

And the test case is timed out
MEMORY STAT | vsize 1171MB | residentFast 263MB | heapAllocated 87MB
[Main Thread]: D/nsPrefetch StartPrefetching [stopcount=1]
16894 INFO TEST-OK | dom/base/test/test_navigator_resolve_identity_xrays.xul | took 77ms
[Main Thread]: D/nsPrefetch StopPrefetching [stopcount=2]
16895 INFO TEST-START | dom/base/test/test_prefetch.html
[Main Thread]: D/nsPrefetch StopPrefetching [stopcount=3]
[Main Thread]: D/nsPrefetch StartPrefetching [stopcount=2]
[Main Thread]: D/nsPrefetch StopPrefetching [stopcount=3]
[Main Thread]: D/nsPrefetch PrefetchURI [http://example.com/chrome/dom/base/test/prefetch_test_server.sjs?ACTION=prefetch]
[Main Thread]: D/nsPrefetch StartPrefetching [stopcount=2]
[Main Thread]: D/nsPrefetch StartPrefetching [stopcount=1]
[Main Thread]: D/nsPrefetch CancelPrefetchURI [chrome://mochikit/content/tests/SimpleTest/test.css]
[Main Thread]: D/nsPrefetch CancelPrefetchURI [chrome://mochikit/content/tests/SimpleTest/test.css]
[Main Thread]: D/nsPrefetch CancelPrefetchURI [chrome://mochikit/content/tests/SimpleTest/test.css]
[Main Thread]: D/nsPrefetch CancelPrefetchURI [chrome://mochikit/content/tests/SimpleTest/test.css]
[Main Thread]: D/nsPrefetch CancelPrefetchURI [chrome://mochikit/content/tests/SimpleTest/test.css]
[Main Thread]: D/nsPrefetch CancelPrefetchURI [chrome://mochikit/content/tests/SimpleTest/test.css]
Failed to retrieve MOZ_UPLOAD_DIR env var
16896 INFO TEST-UNEXPECTED-FAIL | dom/base/test/test_prefetch.html | Test timed out. 
reportError@chrome://mochikit/content/tests/SimpleTest/TestRunner.js:114:7

Running the test case individually 
 ./mach mochitest -f chrome dom/base/test/test_prefetch.html
succeeds
Assignee: nobody → dd.mozilla
Whiteboard: btpp-active
So good news, there is nothing wrong with prefetch.

Prefetch will not start until all normal loads are done (i.e. until nStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, uint32_t progressStateFlags, nsresult aStatus) is called with 
progressStateFlags & STATE_IS_DOCUMENT) and progressStateFlags & STATE_STOP for all loads).
 
Our mochitest tests starts load of https://127.0.0.1:8888/selfsupport-dummy/ (I am not sure what is this actually doing, what it is used for). And this load is only finished after all test are done. so prefetch waits for this load to be finished and never triggers prefetch.

I will mark this as invalid. We can make a work around for the test to ignore doc loads, e.g. a hidden pref.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: