Could not query nsIDOMChromeWindow interface from root nsIDOMWindow.




Extension Compatibility
9 years ago
9 years ago


(Reporter: Vital, Unassigned)


Firefox Tracking Flags

(Not tracked)



(1 attachment)



9 years ago
User-Agent:       Opera/9.64 (Windows NT 5.1; U; en) Presto/2.1.1
Build Identifier: 20090715084055

To use nsIBrowserDOMWindow->OpenURI() method in our C++ XPCOM (to navigate to some URL) we need to get nsIBrowserDOMWindow interface (this is a widespread technique described in the internet). It works fine for Firefox 3.0.11 but does not for Firefox 3.5.1.

Reproducible: Always

Steps to Reproduce:
In your C++ code do the following:
1. Get nsIDOMWindowInternal (through nsIWindowMediator->GetMostRecentWindow()).
2. Get nsIWebNavigation (through nsIInterfaceRequestor->GetInterface()).
3. Get nsIDocShellTreeItem (through nsIDocShellTreeItem->GetRootTreeItem()).
4. Get nsIDOMWindow (through nsIInterfaceRequestor->GetInterface()).
5. Try to get nsIDOMChromeWindow using do_QueryInterface() from nsIDOMWindow.

Please see the attached source code.
Actual Results:  
do_QueryInterface() returns NULL.

Expected Results:  
do_QueryInterface() shoult return valid nsIDOMChromeWindow.

Please see the attached source code. It fails at the following line (returns NULL):
nsCOMPtr<nsIDOMChromeWindow> spRootDOMChromeWindow = do_QueryInterface(spRootDOMWindow);

Comment 1

9 years ago
Created attachment 389449 [details]
C++ code from our XPCOM that fails to query nsIDOMChromeWindow interface.

Comment 2

9 years ago
What SDK are you compiling against? I'm pretty sure nsIDOMChromeWindow changed between 1.9 and 1.9.1, which means you either need to recompile your code against the new IID/interface, or use dynamic interface techniques to be compatible with both versions (nsIDOMChromeWindow is not a frozen interface).

Comment 3

9 years ago
We use the latest SDK available for Windows at (""). It's version is Is there any new version of the SDK? Please describe more detailed what you mean under "dynamic interface techniques".


Comment 4

9 years ago
You could copy nsIDOMChromeWindow from the 1.9.1 tree and rename it to

nsIDOMChromeWindow_191 and then do something like:

nsCOMPtr<nsIDOMChromeWindow> spRootDOMChromeWindow =
if (spRootDOMChromeWindow) {
 // 1.9.0 code here
else {
  nsCOMPtr<nsIDOMChromeWindow_191> spRootDOMChromeWindow191 = do_QueryInterface(spRootDOMWindow);
  if (spRootDOMChromeWindow191) {
    // 1.9.1 code here
else {
  // unknown future version code here

The 1.9.1 SDK is still in RC; you can get it from here:

Please direct future questions to the newsgroup.
Last Resolved: 9 years ago
Resolution: --- → INVALID

Comment 5

9 years ago
Thanks a lot.
You need to log in before you can comment on or make changes to this bug.