Closed Bug 1597651 Opened 6 years ago Closed 6 years ago

[remote-dbg-next] Find Window Handle - QueryInterface is not a function

Categories

(DevTools :: about:debugging, task)

70 Branch
task
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: roy450, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36

Steps to reproduce:

I started firefox version 70 with the "-start-debugger-server" parameter. I am then inspecting the main process via "about:debugging". In the "console" tab I am executing this code to get the handle of the window :

var winwatcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService(Components.interfaces.nsIWindowWatcher);
var chromeWin = winwatcher.getWindowEnumerator().getNext();
var baseWindow = chromeWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIBaseWindow);
baseWindow.nativeHandle;

Actual results:

I am getting this error : "TypeError: chromeWin.QueryInterface is not a function"

Expected results:

In the version 69 of FireFox this is working fine. I can get the handle of the window. It's only failing since the update 70 of firefox.

Am I doing something wrong ? What should I now do to get the handle of the window ? What changed in the version 70 ?

Hi!

I think the root cause of your problem is not related to about:debugging. It seems something you were relying on is no longer available on the platform side (that can be expected, it's not a public API).

Before I move the bug to Core, can you explain what you are trying to achieve, it will help to provide alternative solutions.
Thanks

Type: defect → task
Flags: needinfo?(roy450)

Hello Julian,

I was trying to get the window handle of each tabs.

The code with the call to the QueryInterfaces was found on this page https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Code_snippets/Finding_Window_Handles
I know that it's an archive of "Obsolete content" but it was working until version 70 and this example can still be found on a lot of articles online. Like you said, maybe it's because it's no longer available on platform side.

I have found a workaround on my project so I don't need to use the window handle anymore. If you feel that this not really a bug please feel free to close this thread.

Thanks

Flags: needinfo?(roy450)

Thanks for the update!
If you found a workaround, I think we can close the bug for now.

Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.