MozillaZine

Title of Tab - Debugging Extensions is Tough

Talk about add-ons and extension development.
zacware
 
Posts: 10
Joined: August 30th, 2007, 11:02 pm
November 8th, 2009, 11:16 am

Post Posted November 8th, 2009, 11:16 am

I am using something like

win.gBrowser.mTabContainer.childNodes[i]

in my extension, what I would like to do is to display the names of the tabs I am finding

I can't figure out how to do this.

When working with regular HTML, I can do a console.info("",myElement) and then peek inside and see all the properties of the element to find what I want.

I can't do this with chrome stuff. All I get in the console is a reference that the object is a XUL object.

Can someone tell me what property would tell me the name of the page that's in a particular tab, or better yet, how can I examine details about a variable that is in chrome code?

Components.utils.reportError(myElement) shows no extra info. Dump is not working at all for me. And ChromeBug doesn't seem to work on OS X

Thanks.

Philip Chee

User avatar
 
Posts: 4297
Joined: March 1st, 2005, 3:03 pm
November 8th, 2009, 12:57 pm

Post Posted November 8th, 2009, 12:57 pm

zacware wrote:I am using something like

win.gBrowser.mTabContainer.childNodes[i]

in my extension, what I would like to do is to display the names of the tabs I am finding

I can't figure out how to do this.

When working with regular HTML, I can do a console.info("",myElement) and then peek inside and see all the properties of the element to find what I want.

I can't do this with chrome stuff. All I get in the console is a reference that the object is a XUL object.

Can someone tell me what property would tell me the name of the page that's in a particular tab, or better yet, how can I examine details about a variable that is in chrome code?

Components.utils.reportError(myElement) shows no extra info. Dump is not working at all for me. And ChromeBug doesn't seem to work on OS X

Thanks.

Well I use the ExecuteJS extension and when I inspect the properties of:
Code: Select all
win.gBrowser.mTabContainer.childNodes[1]

I get:
Code: Select all
Properties for object:
[object XULElement] [tab]
linkedBrowser: [object XULElement]
arrowKeysShouldWrap: false
accessibleType: 4119
control: [object XULElement]
selected: true
_selected: undefined
linkedPanel: panel1
value:
label: mozdev.org - free project hosting for the Mozilla community
crop: end
image: http://www.mozdev.org/sharedimages/mozdev-icon.png
command:
accessKey:
disabled: false
tabIndex: 0
style: [object CSSStyleDeclaration]
scrollWidth: 250
clientLeft: 3
clientHeight: 16
clientWidth: 244
clientTop: 3
getClientRects: function getClientRects() {
    [native code]
}
getBoundingClientRect: function getBoundingClientRect() {
    [native code]
}
getElementsByClassName: function getElementsByClassName() {
    [native code]
}
baseURI: chrome://navigator/content/navigator.xul
textContent:
compareDocumentPosition: function compareDocumentPosition() {
    [native code]
}
getUserData: function getUserData() {
    [native code]
}
isSameNode: function isSameNode() {
    [native code]
}
lookupNamespaceURI: function lookupNamespaceURI() {
    [native code]
}
setUserData: function setUserData() {
    [native code]
}
lookupPrefix: function lookupPrefix() {
    [native code]
}
isDefaultNamespace: function isDefaultNamespace() {
    [native code]
}
isEqualNode: function isEqualNode() {
    [native code]
}
dispatchEvent: function dispatchEvent() {
    [native code]
}
removeEventListener: function removeEventListener() {
    [native code]
}
tagName: tab
removeAttributeNS: function removeAttributeNS() {
    [native code]
}
removeAttribute: function removeAttribute() {
    [native code]
}
getAttribute: function getAttribute() {
    [native code]
}
getElementsByTagName: function getElementsByTagName() {
    [native code]
}
setAttribute: function setAttribute() {
    [native code]
}
getElementsByTagNameNS: function getElementsByTagNameNS() {
    [native code]
}
hasAttributeNS: function hasAttributeNS() {
    [native code]
}
setAttributeNS: function setAttributeNS() {
    [native code]
}
hasAttribute: function hasAttribute() {
    [native code]
}
getAttributeNS: function getAttributeNS() {
    [native code]
}
nextSibling: null
firstChild: null
prefix: null
nodeValue: null
childNodes: [object NodeList]
nodeName: tab
namespaceURI: http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul
previousSibling: [object XULElement]
nodeType: 1
localName: tab
lastChild: null
ownerDocument: [object XULDocument]
parentNode: [object XULElement]
attributes: [object NamedNodeMap]
appendChild: function appendChild() {
    [native code]
}
cloneNode: function cloneNode() {
    [native code]
}
normalize: function normalize() {
    [native code]
}
hasChildNodes: function hasChildNodes() {
    [native code]
}
insertBefore: function insertBefore() {
    [native code]
}
replaceChild: function replaceChild() {
    [native code]
}
removeChild: function removeChild() {
    [native code]
}
hasAttributes: function hasAttributes() {
    [native code]
}
ordinal:
controllers: [object XULControllers]
collapsed: false
id:
boxObject: [object BoxObject]
className: tabbrowser-tab
getElementsByAttribute: function getElementsByAttribute() {
    [native code]
}
hidden: false
focus: function focus() {
    [native code]
}
database: null
statusText:
isSupported: function isSupported() {
    [native code]
}
ELEMENT_NODE: 1
ATTRIBUTE_NODE: 2
TEXT_NODE: 3
CDATA_SECTION_NODE: 4
ENTITY_REFERENCE_NODE: 5
ENTITY_NODE: 6
PROCESSING_INSTRUCTION_NODE: 7
COMMENT_NODE: 8
DOCUMENT_NODE: 9
DOCUMENT_TYPE_NODE: 10
DOCUMENT_FRAGMENT_NODE: 11
NOTATION_NODE: 12
getAttributeNode: function getAttributeNode() {
    [native code]
}
setAttributeNode: function setAttributeNode() {
    [native code]
}
removeAttributeNode: function removeAttributeNode() {
    [native code]
}
getAttributeNodeNS: function getAttributeNodeNS() {
    [native code]
}
setAttributeNodeNS: function setAttributeNodeNS() {
    [native code]
}
align:
dir:
flex: 100
flexGroup:
orient:
pack:
observes:
menu:
contextMenu:
tooltip:
width: 0
height:
minWidth: 30
minHeight:
maxWidth: 250
maxHeight:
persist:
left:
top:
datasources:
ref:
tooltipText:
allowEvents: false
builder: null
resource: null
blur: function blur() {
    [native code]
}
click: function click() {
    [native code]
}
doCommand: function doCommand() {
    [native code]
}
getElementsByAttributeNS: function getElementsByAttributeNS() {
    [native code]
}
getFeature: function getFeature() {
    [native code]
}
DOCUMENT_POSITION_DISCONNECTED: 1
DOCUMENT_POSITION_PRECEDING: 2
DOCUMENT_POSITION_FOLLOWING: 4
DOCUMENT_POSITION_CONTAINS: 8
DOCUMENT_POSITION_CONTAINED_BY: 16
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32
scrollTop: 0
scrollLeft: 0
scrollHeight: 22
firstElementChild: null
lastElementChild: null
previousElementSibling: [object XULElement]
nextElementSibling: null
childElementCount: 0
children: [object HTMLCollection]
querySelector: function querySelector() {
    [native code]
}
querySelectorAll: function querySelectorAll() {
    [native code]
}

Phil

zacware
 
Posts: 10
Joined: August 30th, 2007, 11:02 pm
November 8th, 2009, 2:51 pm

Post Posted November 8th, 2009, 2:51 pm

Thanks. I didn't know about that extension. It is most helpful!

nospampleasemam
 
Posts: 21
Joined: November 8th, 2009, 2:18 pm
November 9th, 2009, 1:01 am

Post Posted November 9th, 2009, 1:01 am

I also would like to get the title of a tab from my extension, but win.gBrowser.mTabContainer.childNodes[0].label gives nothing. Can anyone clarify this issue for me?

Greatly appreciated.

max1million
 
Posts: 2361
Joined: November 15th, 2004, 5:03 am
November 9th, 2009, 1:40 am

Post Posted November 9th, 2009, 1:40 am

Well find in this page can't find label in that unsorted list of properties, but with DOMInpescter it does show that the tab has an attribute label. Not all attribute have corresponding property, and visa versa.

.getAttribute('label')

Return to Extension Development


Who is online

Users browsing this forum: fcp and 5 guests