Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

xbl thinks method is not a funtion

8 views
Skip to first unread message

Marja Koivunen

unread,
Oct 20, 2006, 9:40:55 AM10/20/06
to dev-ext...@lists.mozilla.org
I'm trying to create xbl widgets from my existing and working xul code
but having problems.
What can be wrong when I get:

************************************************************
* Call to xpconnect wrapped JSObject produced this error: *
[Exception... "'[JavaScript Error: "this.growTopicTrees is not a function"
{file: "chrome://ubimarks/content/topicSelectionTree.xml" line: 120}]'
when calling method: [nsIDOMEventListener::handleEvent]"
nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"
location: "<unknown>" data: yes]
************************************************************

This is the binding. It doesn't matter is I use the constructor or the
handler or
loadBindingDocument() function.
I used to call viewCommonTopics() with load event handler connected to a
window and it still does call this function.
However the growTopicTrees function is not a function anymore...

<binding id = "ubiSelectTopicsTree">
<content>
<xul:tree flex = "1">
<xul:treecols>
<xul:treecol id = "topicName"
label = "Topic Name:"
primary = "true"
flex = "1"
seltype="single"/>

<xul:splitter/>

<xul:treecol id = "selectedCol"
label = "Selected:"
cycler = "true"/>
</xul:treecols>

<xul:treechildren id = "ubiSelectTopicsRoot" />

</xul:tree>
</content>

<handlers>
<handler event = "bindingattached" ><![CDATA[

loadBindingDocument('chrome://ubimarks/content/topicSelectionTree.xml');
this.viewCommonTopics();
]]></handler>
<handler event = "select"
action = "event.stopPropagation();" />
<handler event = "click"
action = "this.checkTopic(event);event.stopPropagation();" />
</handlers>

<implementation>

<constructor><![CDATA[
dump("ubiSelectTopicsTree/constructor\n");
<!--
window.addEventListener("load", this.viewCommonTopics, false);
-->
]]></constructor>

<method name = "viewCommonTopics">
<!--
/**
* List topics in a tree hierarchy
*/
-->
<body><![CDATA[
dump("ubiSelectTopicsTree/viewCommonTopics\n");

var
datasrc = getReadUbiDS(),
topicroots = getRootTopics(datasrc);

<!-- is not a function ?? -->
this.growTopicTrees(datasrc, topicroots);

window.sizeToContent();
]]></body>
</method>

<method name = "growTopicTrees">
<!--
/**
* Build a topic tree from each root in the list of root topics.
*/
-->
<parameter name = "aDatasrc" />
<parameter name = "aRoots" />
<body><![CDATA[

if (!aRoots) {
return;
}

/* get empty treechildren element */
var
treechildrenroot =
document.getElementById("ubiSelectTopicsRoot");

/* go through the topic hierarchies */
for (var i = 0; i < aRoots.length; i++) {
var
topictreeitem = this.initTopicItemHierarchy(aDatasrc,
aRoots[i].topic);
treechildrenroot.appendChild(topictreeitem);

if (i < (aRoots.length - 1)) {
var
treeseparator = document.createElement("treeseparator");
treechildrenroot.appendChild(treeseparator);
}
}
]]></body>
</method>

...
</binding>

0 new messages