Bug 1528036 - Full page screenshot tool is not functional after page refresh r=yulia,jdescottes
authorBryan Kok <bryan.wyern1@gmail.com>
Mon, 22 Jul 2019 12:04:04 +0000
changeset 484758 e5db406983a6c2214ad0916e0a9e4ca6b547228f
parent 484757 af667e4c7419a4cd397ea7e7cd46c6b6fa201cbe
child 484759 60953bbf4c521f2f8c041a80b824814f5c3a8506
push id90924
push userpastithas@mozilla.com
push dateThu, 25 Jul 2019 19:39:10 +0000
treeherderautoland@e5db406983a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyulia, jdescottes
bugs1528036
milestone70.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 1528036 - Full page screenshot tool is not functional after page refresh r=yulia,jdescottes Differential Revision: https://phabricator.services.mozilla.com/D33832
devtools/server/actors/screenshot.js
--- a/devtools/server/actors/screenshot.js
+++ b/devtools/server/actors/screenshot.js
@@ -6,17 +6,30 @@
 
 const protocol = require("devtools/shared/protocol");
 const { captureScreenshot } = require("devtools/shared/screenshot/capture");
 const { screenshotSpec } = require("devtools/shared/specs/screenshot");
 
 exports.ScreenshotActor = protocol.ActorClassWithSpec(screenshotSpec, {
   initialize: function(conn, targetActor) {
     protocol.Actor.prototype.initialize.call(this, conn);
+    this.targetActor = targetActor;
     this.document = targetActor.window.document;
+    this._onNavigate = this._onNavigate.bind(this);
+
+    this.targetActor.on("navigate", this._onNavigate);
+  },
+
+  destroy() {
+    this.targetActor.off("navigate", this._onNavigate);
+    protocol.Actor.prototype.destroy.call(this);
+  },
+
+  _onNavigate() {
+    this.document = this.targetActor.window.document;
   },
 
   capture: function(args) {
     if (args.nodeActorID) {
       const nodeActor = this.conn.getActor(args.nodeActorID);
       if (!nodeActor) {
         throw new Error(
           `Screenshot actor failed to find Node actor for '${args.nodeActorID}'`