Closed Bug 791367 Opened 7 years ago Closed 7 years ago

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

Categories

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

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: Ehsan, Assigned: Ehsan)

References

Details

Attachments

(1 file, 1 obsolete file)

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?
Getting loadgroup from GetOwner()->GetExtandDoc() would be more correct.
GetExtantDoc
What Olli said: the FileReader is associated with a window, so we should use that window's loadgroup.
Attached patch Patch (v1) (obsolete) — Splinter Review
Like this?
Assignee: nobody → ehsan
Status: NEW → ASSIGNED
Attachment #661384 - Flags: review?(bugs)
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.
Attached patch Patch (v2)Splinter Review
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
Closed: 7 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.