Bug Tracker

Opened 7 years ago

Closed 6 years ago

Last modified 5 years ago

#7531 closed bug (fixed)

$.post(document.location) doesn't work anymore since 1.4.3 on Firefox and Chrome

Reported by: xaviermd@… Owned by: snover
Priority: low Milestone: 1.5
Component: ajax Version: 1.4.4
Keywords: regression Cc:
Blocked by: Blocking:


I created a veryu complex javascript onto jquery 1.4 and it was (nearly) perfectly working with 1.4.2 (I mean : it consumes a lot of RAM to make browser crashes very frequently).

Since 1.4.3 and 1.4.4 , $.post() command goes to javascript halts :

Firefox 3.6.12: uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame :: https://myservice/interface/stage1.js :: anonymous :: line 5767" data: no]

the calling offender : $.post(document.location,{action:'fresh' , ordre:"{\"0\":[\"fonctions\",\"perso_message\",\"commandes\"],\"1\":[\"raccourcis\",\"suggestions\"]}"},function(datas){ return something; },'json');

the lines 5762→ 5767 are :

ajax: function( origSettings ) {

var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),

jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);

console.log(s.url); console.log(rhash);

s.url = s.url.replace( rhash, "" );

s.url : Object { constructor={...}, href="https://myservice.../", more...} rhash : /#.*$/

Chrome 6:

s.url : Object Location { assign: function () { [native code] } hash: "#.*$/" host: "myservice..." hostname: "myservice..." href: "https://myservice.../#.*$/" pathname: "/" port: "" protocol: "https:" reload: function () { [native code] } replace: function () { [native code] } search: "" toString: function toString() { [native code] } valueOf: function valueOf() { [native code] } proto: Location

} rhash : /#.*$/

Failed to load resource: the server responded with a status of 404 (Not Found) /undefined

Personnal note :

I believe the problem came from document.location which was not seen as an string anymore Firefox doesn't like regex on objects, Chrome respond to the .replace by "undefined"

Change History (9)

comment:1 Changed 7 years ago by addyosmani

Owner: set to xaviermd@…
Status: newpending

Please include a valid complete test case on jsFiddle.net that reproduces the issue you are experiencing so that we can investigate further.

comment:2 Changed 7 years ago by xaviermd@…

Status: pendingnew

I don't understand jsFiddle. Perhaps http://jsfiddle.net/KLrer/4/ ?


comment:3 Changed 7 years ago by anonymous

GRAH. Askimet is eating my message.

http://jsfiddle.net/KLrer/4/ ?

$.post( document.location, {} ,function(data) {alert(data);},'html');

jQuery 1.4.3+ : no responses, silently fails (in fact, «uncaught exception»)

$.post( document.location.href, {} ,function(data) {alert(data);},'html');

jQuery 1.4.3+ : alert responds. works

comment:4 Changed 7 years ago by snover

Component: unfiledajax
Keywords: regression added
Priority: undecidedlow
Status: newopen

comment:6 Changed 7 years ago by snover

Owner: changed from xaviermd@… to snover
Status: openassigned

comment:7 Changed 6 years ago by john

Resolution: fixed
Status: assignedclosed


comment:8 Changed 6 years ago by jitter


Move fixed tickets to appropriate milestone

comment:9 Changed 6 years ago by jaubourg

Enhances ajaxSetup so that it can take an optional target option, in which case target will be updated instead of ajaxSettings. That way, fields that shouldn't be deep extended can be listed and dealt with in one place. jQuery.ajax now makes use of ajaxSetup with target to create its internal settings object. Fixes #7531 in IE9RC.

Changeset: d4790116b8ff83786e82767cba23a4bff0236e58

Note: See TracTickets for help on using tickets.