If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

nsDOMFileReader::ReadFileContent opens a channel without associating it with a load group

RESOLVED FIXED in mozilla18

Status

()

Core
DOM
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Ehsan, Assigned: Ehsan)

Tracking

Trunk
mozilla18
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

http://mxr.mozilla.org/mozilla-central/source/content/base/src/nsDOMFileReader.cpp#413

Boris, should we grab the global object for the JSContext, get the window out of it and go through the ugliness to get to a load group?
Blocks: 787743

Comment 1

5 years ago
Getting loadgroup from GetOwner()->GetExtandDoc() would be more correct.

Comment 2

5 years ago
GetExtantDoc
What Olli said: the FileReader is associated with a window, so we should use that window's loadgroup.
Created attachment 661384 [details] [diff] [review]
Patch (v1)

Like this?
Assignee: nobody → ehsan
Status: NEW → ASSIGNED
Attachment #661384 - Flags: review?(bugs)

Comment 5

5 years ago
Comment on attachment 661384 [details] [diff] [review]
Patch (v1)

Could you make this.

nsCOMPtr<nsILoadGroup> loadGroup;
if (HasOrHasHadOwner()) {
  NS_ENSURE_STATE(GetOwner());
  nsIDocument* doc = GetOwner()->GetExtantDoc();
  if (doc) {
    loadGroup = doc->GetDocumentLoadGroup();
  }
}
rv = NS_NewChannel(getter_AddRefs(mChannel), uri, nullptr, loadGroup);


(if we need similar thing more often, we could add a helper
method to nsDOMEventTargetHelper)
Attachment #661384 - Flags: review?(bugs) → review+
Will this make FileReader spin the network activity spinner on the tab?
Yes, if you're not setting the LOAD_BACKGROUND flag.  Which you probably should be.
Unless you want progress notifications for it...
We don't need nsIProgressEventSink notifications, but we do need OnDataAvailable.
Comment on attachment 661384 [details] [diff] [review]
Patch (v1)

r- until you sort out the throbber stuff
Attachment #661384 - Flags: review-
LOAD_BACKGROUND gets OnDataAvailable; just not nsIProgressEventSink stuff.
Created attachment 661994 [details] [diff] [review]
Patch (v2)

This should address both Olli's and Kyle's concerns.
Attachment #661384 - Attachment is obsolete: true
Attachment #661994 - Flags: review?
Attachment #661994 - Flags: review? → review?(khuey)
Comment on attachment 661994 [details] [diff] [review]
Patch (v2)

Review of attachment 661994 [details] [diff] [review]:
-----------------------------------------------------------------

r=me provided you've tested that this makes the spinner not spin.

Thanks for doing this.
Attachment #661994 - Flags: review?(khuey) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/4b9ae51cb797
Target Milestone: --- → mozilla18
https://hg.mozilla.org/mozilla-central/rev/4b9ae51cb797
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.