Open
Bug 1113676
Opened 10 years ago
Updated 7 months ago
img resources missing from resource-timing entries when loaded from cache
Categories
(Core :: DOM: Core & HTML, defect, P2)
Tracking
()
NEW
People
(Reporter: valentin, Unassigned)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [webpagetest][necko-triaged][necko-priority-new])
Attachments
(2 files)
5.37 KB,
patch
|
seth
:
review+
|
Details | Diff | Splinter Review |
6.81 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
In imgLoader::LoadImage, when loading an image from cache, the imgRequestProxy is missing an mChannel/mTimedChannel and it does not go through call to nsHttpChannel::OnStopRequest so it could get added to the entry list.
Related to bug 1021221.
Reporter | ||
Comment 1•10 years ago
|
||
Attachment #8542558 -
Flags: review?(seth)
Reporter | ||
Comment 2•10 years ago
|
||
Attachment #8542561 -
Flags: review?(bzbarsky)
Comment 3•10 years ago
|
||
Comment on attachment 8542558 [details] [diff] [review]
img resources missing from resource-timing entries when loaded from cache
Review of attachment 8542558 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good. r+ with the issues below fixed.
Fundamentally the design of imgLoader is pretty bad, and this feels like yet another hack to me, but I don't see a way around it without a major rework of imgLoader. (Which will happen eventually.)
::: image/src/imgLoader.cpp
@@ +2159,5 @@
> + // performance object. We need to add the entry here.
> + if (doc && !request->mChannel) {
> + nsPerformance* perf = doc->GetInnerWindow() ?
> + doc->GetInnerWindow()->GetPerformance() : nullptr;
> + nsCOMPtr<nsIHttpChannel> httpChan(do_QueryInterface(request->mTimedChannel));
Since you don't need this unless |perf| is non-null, move this variable inside the |if| below.
::: image/src/imgRequest.cpp
@@ +36,5 @@
> #include "nsIProtocolHandler.h"
> #include "imgIRequest.h"
>
> +#include "mozilla/net/NullHttpChannel.h"
> +using mozilla::net::NullHttpChannel;
Please group this |using| directive with the other |using| directives.
@@ +119,5 @@
> mRequest = aRequest;
> mChannel = aChannel;
> + if (mChannel) {
> + mTimedChannel = do_QueryInterface(mChannel);
> + }
This is a more verbose way of saying the same thing as the original code. Please change it back. (I assume you want to preserve the dummy |mTimedChannel| created in OnStopRequest, but OnStopRequest should never be called before Init.)
@@ +1098,5 @@
>
> mChannel = mNewRedirectChannel;
> + if (mChannel) {
> + mTimedChannel = do_QueryInterface(mChannel);
> + }
This needs a comment explaining that you're trying to preserve the mTimedChannel you may have created in OnStopRequest. (That is what you're doing, right?) Otherwise someone in the future, doing some refactoring, is going to see this and assume that it does exactly the same thing as |mTimedChannel = do_QueryInterface(mChannel)| and change it back.
Attachment #8542558 -
Flags: review?(seth) → review+
Comment 4•10 years ago
|
||
Comment on attachment 8542558 [details] [diff] [review]
img resources missing from resource-timing entries when loaded from cache
>+ if (mChannel) {
>+ mTimedChannel = do_QueryInterface(mChannel);
do_QI is null-safe. Why is the null-check needed? If you actually want to preserve the old mTimedChannel value here, please document that clearly so someone doesn't helpfully remove the "useless" null-check. On the other hand, if the null-check is in fact useless, please remove it.
This pattern occurs in two places in this patch.
Flags: needinfo?(valentin.gosu)
Comment 5•10 years ago
|
||
Comment on attachment 8542561 [details] [diff] [review]
Add test for cached resource timing entries
>+ dump("LOADED");
Let's not add a dependency on the non-standard dump() function.
>+ dynamicAddImage(startSecondTest);
Shouldn't the argument there be firstCheckAsync?
>+ gIframe = document.createElement("iframe");
Please add:
gIframe.setAttribute("type", "content");
after that line.
>+// an nsIWebProgressListener that checks all requests made by the docShell
Why couldn't you just use a load event on the <iframe> element? Please document.
Does this test fail without the imgLoader changes?
r=me if so with the above issues fixed.
Attachment #8542561 -
Flags: review?(bzbarsky) → review+
Reporter | ||
Comment 6•9 years ago
|
||
Reporter | ||
Comment 7•9 years ago
|
||
Reporter | ||
Comment 8•9 years ago
|
||
Reporter | ||
Comment 9•9 years ago
|
||
Reporter | ||
Comment 10•9 years ago
|
||
Comment 11•7 years ago
|
||
What is the status of this bug and its patch?
Comment 12•7 years ago
|
||
What is the status of this bug?
Reporter | ||
Comment 13•7 years ago
|
||
Reporter | ||
Comment 14•7 years ago
|
||
There might still be an issue with the patch which prevented me from landing it before.
I pushed to try to see if changes in imgLoader might have changed that situation.
Flags: needinfo?(valentin.gosu)
Priority: -- → P3
Comment 15•6 years ago
|
||
Any change we can get this prioritized? This helps when we collect RUM data and want to know the full page size and comparing with transfered and cached assets.
Whiteboard: [webpagetest]
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
Comment 17•6 years ago
|
||
If it' okay with everyone, I can take a whack at testing this patch. Unless I hear otherwise, I will add it to my TODO list.
Mass-removing myself from cc; search for 12b9dfe4-ece3-40dc-8d23-60e179f64ac1 or any reasonable part thereof, to mass-delete these notifications (and sorry!)
Reporter | ||
Comment 19•4 years ago
|
||
Not currently working on this.
Assignee: valentin.gosu → nobody
Severity: normal → S3
Comment 20•2 years ago
|
||
Bumping this bug in the hope of getting it prioritized.
Any updates?
Comment 21•7 months ago
|
||
Blocks a p2 -> p2. We have patches, and this may fix bug 1852782
Priority: P3 → P2
Whiteboard: [webpagetest] → [webpagetest][necko-triaged][necko-priority-new]
You need to log in
before you can comment on or make changes to this bug.
Description
•