Bug Tracker

Ticket #7531 (closed bug: fixed)

Opened 4 years ago

Last modified 2 years ago

$.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:
Blocking: Blocked by:

Description

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

comment:1 Changed 4 years ago by addyosmani

  • Owner set to xaviermd@…
  • Status changed from new to pending

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 4 years ago by xaviermd@…

  • Status changed from pending to new

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

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

comment:3 Changed 4 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 4 years ago by snover

  • Keywords regression added
  • Priority changed from undecided to low
  • Status changed from new to open
  • Component changed from unfiled to ajax
  • Milestone changed from 1.5 to 1.4.5

comment:5 Changed 4 years ago by snover

comment:6 Changed 4 years ago by snover

  • Owner changed from xaviermd@… to snover
  • Status changed from open to assigned

comment:7 Changed 4 years ago by john

  • Status changed from assigned to closed
  • Resolution set to fixed

Landed.

comment:8 Changed 4 years ago by jitter

  • Milestone changed from 1.4.5 to 1.5

Move fixed tickets to appropriate milestone

comment:9 Changed 4 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.