Could not query nsIDOMChromeWindow interface from root nsIDOMWindow.

RESOLVED INVALID

Status

()

Firefox
Extension Compatibility
--
major
RESOLVED INVALID
9 years ago
9 years ago

People

(Reporter: Vital, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

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);
(Reporter)

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).
(Reporter)

Comment 3

9 years ago
We use the latest SDK available for Windows at https://developer.mozilla.org/en/Gecko_SDK ("xulrunner-1.9.0.11.en-US.win32.sdk.zip"). It's version is 1.9.0.11. Is there any new version of the SDK? Please describe more detailed what you mean under "dynamic interface techniques".

Thanks.

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 =
do_QueryInterface(spRootDOMWindow);
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:
http://ftp.mozilla.org/pub/mozilla.org/xulrunner/nightly/1.9.1-candidates/build1/

Please direct future questions to the mozilla.dev.extensions newsgroup.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → INVALID
(Reporter)

Comment 5

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