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

DOM appendChild error in FF 4.0b7

18 views
Skip to first unread message

marco

unread,
Nov 30, 2010, 3:42:40 AM11/30/10
to
ciao all,

in FF 3.6.xx, extension code that modifies the DOM of an HTML page by
adding some elements (e.g. preview thumbnails) via method
"appendChild" within DOMContentLoaded callback, works fine.

in FF 4.0b7, exactly same code causes this exception to be thrown:

Error: uncaught exception: [Exception... "Operation is not supported"
code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)"
location: "chrome://myext/content/myext.js Line: ..."]

Any hint on how to resolve the above? Any restrictions added by Gecko
2.0 on extensions fiddling with unprivileged content?

Thanks a million in advance

m

Jonathan Protzenko

unread,
Nov 30, 2010, 3:54:21 AM11/30/10
to marco, dev-ext...@lists.mozilla.org
If you're modifying some content DOM from chrome code, you need to make
sure the child you're appending was created using the unprivileged
document, not the global document.

// This is chrome code, this is wrong because the span is now chrome and
you're trying to insert it into content
myContentNode.appendChild(document.createElement("span"))

// This is right, appending a content node to another content node
myContentNode.appendChild(myContentNode.ownerDocument.createElement("span"))

I've hit this issue at least three times when upgrading stuff for Gecko
2.0. Might be what you're looking for :).

jonathan

Marco Donizelli

unread,
Nov 30, 2010, 4:25:53 AM11/30/10
to Jonathan Protzenko, dev-ext...@lists.mozilla.org
indeed!!!! Thanks a million

m

On 30 November 2010 09:54, Jonathan Protzenko
<jonathan....@gmail.com>wrote:

0 new messages