Bug 1515021 - Interrupt steps if shutdown. r=smaug
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 19 Dec 2018 20:25:55 +0000
changeset 451399 b77b6244ebc95356c4bb552ba4524531967f9838
parent 451398 bfd9d5e58fe0180617996ebe00c623ea2bccdcb6
child 451400 eab2b1be4f3fc1eca0120080975365e1f72056eb
push id75035
push userjyavenard@mozilla.com
push dateWed, 19 Dec 2018 20:54:15 +0000
treeherderautoland@b77b6244ebc9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1515021
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1515021 - Interrupt steps if shutdown. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D15008
dom/html/HTMLTrackElement.cpp
--- a/dom/html/HTMLTrackElement.cpp
+++ b/dom/html/HTMLTrackElement.cpp
@@ -301,16 +301,20 @@ void HTMLTrackElement::LoadResource(RefP
   if (!doc) {
     return;
   }
 
   // 9. End the synchronous section, continuing the remaining steps in parallel.
   nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction(
       "dom::HTMLTrackElement::LoadResource",
       [ self = RefPtr<HTMLTrackElement>(this), uri, secFlags ]() {
+        if (!self->mListener) {
+          // Shutdown got called, abort.
+          return;
+        }
         nsCOMPtr<nsIChannel> channel;
         nsCOMPtr<nsILoadGroup> loadGroup =
             self->OwnerDoc()->GetDocumentLoadGroup();
         nsresult rv = NS_NewChannel(
             getter_AddRefs(channel), uri, static_cast<Element*>(self), secFlags,
             nsIContentPolicy::TYPE_INTERNAL_TRACK,
             nullptr,  // PerformanceStorage
             loadGroup,