Bug 1364364 - Part 6: Re-connect nsDocViewerFocusListener in nsDocumentViewer::Open. r=smaug
authorSamael Wang <freesamael@gmail.com>
Tue, 05 Sep 2017 18:16:10 +0800
changeset 429537 c517d8071dfbfa47d2f8da8699a59d314cb14b23
parent 429536 809036cfd7d9caa8f384efc5cfffd236c337c8a8
child 429538 100136657a8b3ddd959360a924ac1fafcfb43cec
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1364364
milestone57.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 1364364 - Part 6: Re-connect nsDocViewerFocusListener in nsDocumentViewer::Open. r=smaug I noticed this error message on fixing dom/workers/test/test_suspend.html: WARNING: NS_ENSURE_TRUE(mDocViewer) failed: file layout/base/nsDocumentViewer.cpp, line 3863 It happens when a nsDocumentViewer::Close() is followed by a nsDocumentViewer::Open(), the viewer would have been disconnected. Since it takes only one-line change to fix I just include it in this bug. MozReview-Commit-ID: LMT2PJkUqi1
layout/base/nsDocumentViewer.cpp
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -1502,16 +1502,18 @@ nsDocumentViewer::Open(nsISupports *aSta
       nsCOMPtr<nsIDocShell> shell = do_QueryInterface(item);
       AttachContainerRecurse(shell);
     }
   }
 
   SyncParentSubDocMap();
 
   if (mFocusListener && mDocument) {
+    // The focus listener may have been disconnected.
+    mFocusListener->Init(this);
     mDocument->AddEventListener(NS_LITERAL_STRING("focus"), mFocusListener,
                                 false, false);
     mDocument->AddEventListener(NS_LITERAL_STRING("blur"), mFocusListener,
                                 false, false);
   }
 
   // XXX re-enable image animations once that works correctly