Closed Bug 1621450 Opened 9 months ago Closed 9 months ago

RDM's TargetList will startListening after a target switch


(DevTools :: Responsive Design Mode, task, P3)



(firefox76 fixed)

Firefox 76
Tracking Status
firefox76 --- fixed


(Reporter: jdescottes, Assigned: jdescottes)



(1 file)

Target Switching for RDM was initially implemented in

The current implementation is not explicitly calling startListening, and because of that, the onTargetAvailable callback is not checking for isTopLevel (see phab thread at

It's a bit confusing as it relies on knowing the internal implementation of target-list. But this is technically correct for the initial target. However, after the first target-switch, startListening() will be automatically called [1]. And at that point RDM's onTargetAvailable might be triggered for non top-level target.


It might be safer to just check isTopLevel (and add the call to startListening for consistency).

Assignee: nobody → jdescottes
Pushed by
Check isTopLevel in RDM onTargetAvailable r=daisuke
Backout by
Backed out changeset 6a2c533bcdb0 for many devtools failures CLOSED TREE

Backed out changeset 6a2c533bcdb0 (Bug 1621450) for many devtools failures

Push with failures:

Backout link:

Failure log:

[task 2020-03-16T16:06:31.785Z] 16:06:31     INFO - TEST-START | devtools/client/responsive/test/browser/browser_device_change.js
[task 2020-03-16T16:06:31.805Z] 16:06:31     INFO - Adding Test Device "Fake Phone RDM Test" to the list.
[task 2020-03-16T16:06:31.805Z] 16:06:31     INFO - Entering test bound 
[task 2020-03-16T16:06:31.842Z] 16:06:31     INFO - Adding a new tab with URL:
[task 2020-03-16T16:06:32.100Z] 16:06:32     INFO - Tab added and finished loading
[task 2020-03-16T16:06:32.100Z] 16:06:32     INFO - Opening responsive design mode
[task 2020-03-16T16:06:32.108Z] 16:06:32     INFO - Not taking screenshot here: see the one that was previously logged
[task 2020-03-16T16:06:32.109Z] 16:06:32     INFO - TEST-UNEXPECTED-FAIL | devtools/client/responsive/test/browser/browser_device_change.js | Uncaught exception - at resource://devtools/client/responsive/ui.js:347 - TypeError: can't access property "stopListening", this.targetList is undefined
[task 2020-03-16T16:06:32.109Z] 16:06:32     INFO - Stack trace:
[task 2020-03-16T16:06:32.109Z] 16:06:32     INFO - initRDMFrame@resource://devtools/client/responsive/ui.js:347:5
[task 2020-03-16T16:06:32.109Z] 16:06:32     INFO - init@resource://devtools/client/responsive/ui.js:163:12
[task 2020-03-16T16:06:32.109Z] 16:06:32     INFO - ResponsiveUI@resource://devtools/client/responsive/ui.js:115:24
[task 2020-03-16T16:06:32.109Z] 16:06:32     INFO - openIfNeeded@resource://devtools/client/responsive/manager.js:129:18
[task 2020-03-16T16:06:32.109Z] 16:06:32     INFO - async*openRDM@chrome://mochitests/content/browser/devtools/client/responsive/test/browser/head.js:120:28
[task 2020-03-16T16:06:32.110Z] 16:06:32     INFO - addRDMTaskWithPreAndPost/<@chrome://mochitests/content/browser/devtools/client/responsive/test/browser/head.js:201:31
[task 2020-03-16T16:06:32.110Z] 16:06:32     INFO - Async*Tester_execTest/<@chrome://mochikit/content/browser-test.js:1062:34
[task 2020-03-16T16:06:32.110Z] 16:06:32     INFO - Tester_execTest@chrome://mochikit/content/browser-test.js:1097:11
[task 2020-03-16T16:06:32.110Z] 16:06:32     INFO - nextTest/<@chrome://mochikit/content/browser-test.js:925:14
[task 2020-03-16T16:06:32.110Z] 16:06:32     INFO - SimpleTest.waitForFocus/waitForFocusInner/focusedOrLoaded/<@chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:918:23
[task 2020-03-16T16:06:32.110Z] 16:06:32     INFO - Leaving test bound 
[task 2020-03-16T16:06:32.110Z] 16:06:32     INFO - Entering test bound 
[task 2020-03-16T16:06:32.166Z] 16:06:32     INFO - Console message: [JavaScript Error: "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol." {file: "" line: 0}]
[task 2020-03-16T16:06:32.263Z] 16:06:32     INFO - Adding a new tab with URL:
[task 2020-03-16T16:06:32.896Z] 16:06:32     INFO - GECKO(3626) | console.log: "[DISPATCH] action type:" "CHANGE_DISPLAY_PIXEL_RATIO"
[task 2020-03-16T16:06:32.903Z] 16:06:32     INFO - GECKO(3626) | console.log: "[DISPATCH] action type:" "ADD_VIEWPORT"
[task 2020-03-16T16:06:33.126Z] 16:06:33     INFO - Tab added and finished loading
[task 2020-03-16T16:06:33.126Z] 16:06:33     INFO - Opening responsive design mode
[task 2020-03-16T16:06:33.141Z] 16:06:33     INFO - Not taking screenshot here: see the one that was previously logged
[task 2020-03-16T16:06:33.142Z] 16:06:33     INFO - TEST-UNEXPECTED-FAIL | devtools/client/responsive/test/browser/browser_device_change.js | Got an error with usingBrowserUI true: TypeError: can't access property "stopListening", this.targetList is undefined
[task 2020-03-16T16:06:33.142Z] 16:06:33     INFO - Stack: initRDMFrame@resource://devtools/client/responsive/ui.js:347:5
[task 2020-03-16T16:06:33.142Z] 16:06:33     INFO - init@resource://devtools/client/responsive/ui.js:163:12
Flags: needinfo?(jdescottes)

Weird that lando managed to land this, it should have had a merge conflict!
At least locally I had to merge manually.

Thanks for the heads up, will rebase and update.

Flags: needinfo?(jdescottes)
Pushed by
Check isTopLevel in RDM onTargetAvailable r=daisuke
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 76
You need to log in before you can comment on or make changes to this bug.