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 382681 5f3fdf98aadc4602accf48b28fda924fe100360b
parent 382680 3ccea0da4b209f346af739fd1536011c2a09be8e
child 382682 3ab791c986488f2cf5bc263a9cc943ca34406d24
push id95394
push userarchaeopteryx@coole-files.de
push dateMon, 25 Sep 2017 10:03:57 +0000
treeherdermozilla-inbound@ff48fab67d3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1364364
milestone58.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