[Project_owners] Re: calling window.sidebar.addPanel() from chrome

Philip Chee philip at aleytys.pc.my
Tue Feb 21 00:52:14 EST 2006

On Mon, 20 Feb 2006 12:03:13 +0000, Neil wrote:
> Philip Chee wrote:

>>Error: window.sidebar.addPanel is not a function
> What does window.sidebar evaluate as in the JS console?

[xpconnect wrapped (nsISupports, nsISidebar, nsIClassInfo)]

function addPanel() {
    [native code]

This works from the JS console:

This works from the URL bar:

Interesting stuff. If I put a dump statement in the js just before the call
I get: [object chromeWindow]. This is probably because the xSidebar sidebar
has an element: <browser id="sidebar">.

If I put the following dump statements in the js:
dump("\ntop.window.sidebar: "+top.window.sidebar);
dump("\nwindow.sidebar: "+window.sidebar);

Then I get:
[xpconnect wrapped (nsISupports, nsISidebar, nsIClassInfo)]
for both dump statements and then I get a different js error:

Error: [Exception... "Component returned failure code: 0x80004003
(NS_ERROR_INVALID_POINTER) [nsIRDFContainer.Init]"  nsresult: "0x80004003
(NS_ERROR_INVALID_POINTER)"  location: "JS frame ::
:: anonymous :: line 148"  data: no]
Source File:
Line: 148

*BUT* the second time I click on the opera sidebar link I get the expected
addPanel dialog.

The nsSidebar constructor uses:
  this.datasource = this.rdf.GetDataSource(this.datasource_uri);

But GetDataSource returns asynchronously so this line should be:
  this.datasource = this.rdf.GetDataSourceBlocking(this.datasource_uri);

By the way the customise.js from the customize panel dialog box also has the
same error. Should I file a bug or two?

Philip Chee <philip at aleytys.pc.my>, <philip.chee at gmail.com>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]When all else fails, read the docs.
* TagZilla 0.059

More information about the Project_owners mailing list