Results 1 to 2 of 2

Thread: Adding a function to Object.prototype breaks Ajax.request

  1. #1

    Default Adding a function to Object.prototype breaks Ajax.request

    Code:
    >>> Ext.Ajax.request({url:'/'})
    GET http://frontend.local/?_dc=1259784357367
    200 OK
    23ms    ext-base-debug.js (line 2628)
    Object conn=XMLHttpRequest tId=0
    >>> Object.prototype.doSomething = function() {};
    function()
    >>> Ext.Ajax.request({url:'/'})
    [Exception... "Cannot modify properties of a WrappedNative" nsresult: "0x80570034 (NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN)" location: "JS frame :: http://frontend.local/ :: anonymous :: line 78" data: no]
    [Break on this error] (78 out of range 45)
    Why would that be? Adding a non-function object to the prototype doesn't seem to cause this problem.

    The above session was produced in Firefox 3.0.14 through the Firebug console and with ExtJS 3.03.

  2. #2

    Default

    In the script in which I first observed this problem, the error is coming from ext-base-debug.js, specifically line 27 of ext-base-ajax.js:

    Code:
    conn.setRequestHeader(prop, headers[prop]);
    In my first console example, the error points to this line of Ext.urlDecode:

    Code:
    return url + (url.indexOf('?') === -1 ? '?' : '&') + s;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •