3.2.0

New Bug with Firefox 1.0.3 and Active.XML.Table??

I just "upgraded" to Firefox 1.0.3 and none of the grid generated by an Active.XML.Table dataset work.

I checked to see if anything major was affected, and found nothing.
http://www.mozilla.org/projects/security/known-vulnerabilities.html

The sample page that worked fine in Firefox 1.0.2 no longer works.
http://www.activewidgets.com/grid.howto.load.xml/


Is anyone else having this bug?

Exception:
Exception ``[Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame :: http://localhost/source/lib/browsers/gecko.js :: anonymous :: line 290" data: no]'' thrown from function anonymous() in <http://localhost/source/lib/browsers/gecko.js> line 290.


Line 290 from /source/lib/browsers/gecko.js
element.__defineGetter__("text", function(){return this.firstChild.nodeValue});


Anyone with an idea of what's happening, please let me know.
Stephane
April 17,
I have confirmed that the issue is only with drawing Active.XML.Table based Grids.

I converted a small portion of my code to use a JavaScript Array and it displays properly.

I've also used a packet sniffer and the XML does get queried and loaded fine and the Active.XML.Table object has all the data in it.
Stephane
April 17,
I have un-installed Firefox 1.0.3 and re-installed Firefox 1.0.2 and everything worked. I then re-installed 1.0.3 and it stoped again.

I'm now sure that the issue is with 1.0.3.
Stephane
April 17,
Yes, I can confirm the problem with Firefox 1.0.3. Please give me a couple of days to see what is the best way of fixing this.
Alex (ActiveWidgets)
April 18,
Same problem with my Firefox 1.0.3

I think that this is related to http://www.mozilla.org/security/announce/mfsa2005-33.html

who is related to memory allocation and JavaScript...
Patrick Allaert
April 18,
Anyone using XMLHTTP in their apps will see them break with Firefox 1.0.3. Lots of complaints about it but still no real solution it seems.
Alex
April 18,
Obviously some other applications and extensions are having problems with the firefox 1.0.3 behaviour. This is the issue filed to bugzilla.mozilla.org:

https://bugzilla.mozilla.org/show_bug.cgi?id=290200#c4

I found this in http://weblogs.mozillazine.org/asa/ where you can get more information.

Hope this helps to find a solution
Dietrich
April 18,
I was relieved to find out it had nothing to do with what I was doing. I hate it when they brake compatibility like that. It's what makes developing on cross-platform and cross-browser difficult. As difficult as cross-mobile device development.
Stephane, www.omni-ts.com
April 18,
If somebody needs urgent fix, please try this code:

if (window.XPathEvaluator) {

        var xpath = new XPathEvaluator();

        var element = Element.prototype;
        var attr = Attr.prototype;

        delete element.text;
        delete attr.text;

        element.selectNodes = function (path) {
            var result = xpath.evaluate(path, this, this.ownerDocument._ns, 7, null);
            var i, nodes = [];
            for (i=0; i<result.snapshotLength; i++) {
                nodes[i] = result.snapshotItem(i);
                nodes[i].text = nodes[i].firstChild ? nodes[i].firstChild.nodeValue : "";
            }
            return nodes;
        };

        element.selectSingleNode = function (path) {
           var node = xpath.evaluate(path, this, this.ownerDocument._ns, 9, null).singleNodeValue;
           node.text = node.firstChild ? node.firstChild.nodeValue : "";
           return node;
        };
    }


I did not really tested this much, so use with care.
Alex (ActiveWidgets)
April 18,
ok, this appears to be Mozilla bug:

https://bugzilla.mozilla.org/show_bug.cgi?id=290777

Alex (ActiveWidgets)
April 18,
Hi Alex!

Thank you for the fix.

The urgent fix does not seem to work for the selectSingleNode Method. The resulting node of the xpath.evaluate() allways seems to be null.

The SelectNodes method works fine for me.

Any hints?
Dietrich
April 19,
Ahhh!!! My fault!

I used the Document object with selectSingleNode method. So because we can not overwrite the text-getter-method we have also to fix this for the doc.selectSingleNode and doc.SelectNodes method. This is my fixed fix:

if (window.XPathEvaluator) {

    var xpath = new XPathEvaluator();

    var element = Element.prototype;
    var attr = Attr.prototype;
    var doc = Document.prototype;

    delete element.text;
    delete attr.text;

    element.selectNodes = function (path) {
        var result = xpath.evaluate(path, this, this.ownerDocument._ns, 7, null);
        var i, nodes = [];
        for (i=0; i<result.snapshotLength; i++) {
            nodes[i] = result.snapshotItem(i);
            nodes[i].text = nodes[i].firstChild ? nodes[i].firstChild.nodeValue : "";
        }
        return nodes;
    };

    element.selectSingleNode = function (path) {
       var node = xpath.evaluate(path, this, this.ownerDocument._ns, 9, null).singleNodeValue;
       dump('element.selectSingleNode(path): ' + path + '\n');
       if ( node != null ) node.text = node.firstChild ? node.firstChild.nodeValue : "";
       return node;
    };

    doc.selectSingleNode = function (path) {
        dump('doc.selectSingleNode(path): ' + path + '\n');
        var node = xpath.evaluate(path, this, this._ns, 9, null).singleNodeValue;
        if ( node != null ) node.text = node.firstChild ? node.firstChild.nodeValue : "";
        return node;
    };

    doc.selectNodes = function (path) {
        var result = xpath.evaluate(path, this, this._ns, 7, null);
        var i, nodes = [];
        for (i=0; i<result.snapshotLength; i++) {
            nodes[i] = result.snapshotItem(i);
            nodes[i].text = nodes[i].firstChild ? nodes[i].firstChild.nodeValue : "";
        }
        return nodes;
    };

}


Hope this helps.
Dietrich
April 19,
Sorry again. I just forgot to delete the dump() calls in the code. Please remove them.
Dietrich
April 19,
Here is a better workaround (thanks to Mozilla developers):

(function(){
        if (window.__defineGetter__) {

            var stylesheet = CSSStyleSheet.prototype;
            delete stylesheet.rules;
            stylesheet.__proto__ = {__proto__: stylesheet.__proto__};
            stylesheet.__proto__.__defineGetter__("rules", function(){
                return this.cssRules;
            });

            var text = Text.prototype;
            text.__proto__ = {__proto__: text.__proto__};
            text.__proto__.__defineGetter__("text", function(){
                return this.nodeValue;
            });

            var attr = Attr.prototype;
            delete attr.text;
            attr.__proto__ = {__proto__: attr.__proto__};
            attr.__proto__.__defineGetter__("text", function(){
                return this.nodeValue;
            });

            var element = Element.prototype;
            delete element.text;
            element.__proto__ = {__proto__: element.__proto__};
            element.__proto__.__defineGetter__("text", function(){
                var i, a=[], nodes = this.childNodes, length = nodes.length;
                for (i=0; i<length; i++){
                    a[i] = nodes[i].text;
                }
                return a.join("");
            });
        }
    })();

Alex (ActiveWidgets)
April 19,
where do you place this patch? :)
Equinoxe
April 25,
At the end of gecko.js works for me.
AndrewO
April 25,
Thanks Andrew, it worked as you say...
April 26,
Guys, what file includes gecko.js? I made this patch but am not seeing any difference in Firefox. I'm also getting an error that I haven't seen anyone mention which is that using ".active-image-imagename" is not working. The image is not showing up, and the onclick action does not show up.
jeremy
April 26,
Hi jeremy!

My solution to this patch is to have an additional javascript file which is included aufter grid.js:

<script src="/admin/grid/runtime/lib/grid.js" type="text/javascript" language="JavaScript"></script>
<script src="/admin/js/gridpatches.js" type="text/javascript" language="JavaScript"></script>


The content of the File for this patch (there are some more) would be:

if (window.XPathEvaluator) {
    (function(){
        if (window.__defineGetter__) {

            var stylesheet = CSSStyleSheet.prototype;
            delete stylesheet.rules;
            stylesheet.__proto__ = {__proto__: stylesheet.__proto__};
            stylesheet.__proto__.__defineGetter__("rules", function(){
                return this.cssRules;
            });

            var text = Text.prototype;
            text.__proto__ = {__proto__: text.__proto__};
            text.__proto__.__defineGetter__("text", function(){
                return this.nodeValue;
            });

            var attr = Attr.prototype;
            delete attr.text;
            attr.__proto__ = {__proto__: attr.__proto__};
            attr.__proto__.__defineGetter__("text", function(){
                return this.nodeValue;
            });

            var element = Element.prototype;
            delete element.text;
            element.__proto__ = {__proto__: element.__proto__};
            element.__proto__.__defineGetter__("text", function(){
                var i, a=[], nodes = this.childNodes, length = nodes.length;
                for (i=0; i<length; i++){
                    a[i] = nodes[i].text;
                }
                return a.join("");
            });
        }
    })(); 
}


Dietrich
April 26,
Great Dietrich, that worked! Thanks alot!
May 1,
This fix is now included as part of 1.0.1 release
Alex (ActiveWidgets)
May 11,

This topic is archived.

See also:


Back to support forum