Bug 1364364 - Part 6: Re-connect nsDocViewerFocusListener in nsDocumentViewer::Open. r=smaug
☠☠ backed out by f9c03c26c876 ☠ ☠
authorSamael Wang <freesamael@gmail.com>
Tue, 05 Sep 2017 18:16:10 +0800
changeset 660374 6298563c1a81bad4cfc1c61fecde9af55294f2f1
parent 660373 285633e277cb43d5d32f190acb21eea9d60614cc
child 660375 73c7371abb7f25f819ec26438265d625fe6e5a7a
push id78390
push userbmo:emilio@crisal.io
push dateWed, 06 Sep 2017 23:04:15 +0000
reviewerssmaug
bugs1364364
milestone57.0a1
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