Support from Acquia helps fund testing for Drupal Acquia logo

Comments

angel.angelio created an issue. See original summary.

angel.angelio’s picture

angel.angelio’s picture

Version: 7.x-2.0-beta7 » 7.x-2.x-dev
ChristianSanders’s picture

This patch works perfectly. We were having some issues with anon users in IE9 and this fixed those fantastically. Thank you very much! :)

znerol’s picture

+++ b/modules/authcache_ajax/authcache_ajax.js
@@ -44,7 +44,8 @@
-            var param = this;
+            // In IE8 this is an object -object window-.
+            var param = this.toString();

If this is really the window object in IE8, then simply converting that window object to a string is very likely wrong. Is that comment really correct?

angel.angelio’s picture

Znerol,

I fixed the comment. It is not the object window, it is a string object. I guess browsers different than IE<=9 happen to do the casting or this is a string constant for them

znerol’s picture

Oh, so I'm starting to understand the problem. There are two kinds of strings in JavaScript (not only in MSIE): String Objects and String Literals.

Consider the following experiment (IE9 console, also works in other browsers):

>> obj = new String('test'); 
test {
	0 : "t",
	1 : "e",
	2 : "s",
	3 : "t",
	format : function(){return t(this,0,arguments)}
} 
Add to watch
>> lit = 'test'; 
"test" 
>> obj == lit; 
true 
>> obj === lit; 
false 
>> obj.toString() == lit; 
true 
>> obj.toString() === lit; 
true 

This matters because authcache_ajax.js uses the identity operator (===) which also takes into account the data type. Note that the identity operator is preferable according to Douglas Crockford. I quickly checked Drupal 8 code base and I can confirm that it is used exclusively there.

Citing from the jQuery.each docs:

In the case of an array, the callback is passed an array index and a corresponding array value each time. (The value can also be accessed through the this keyword, but Javascript will always wrap the this value as an Object even if it is a simple string or number value.) The method returns its first argument, the object that was iterated.

This suggests that maybe the each callback should be changed instead (patch attached).

Status: Needs review » Needs work

The last submitted patch, 7: fragments_missing_since-2628596-7.patch, failed testing.

angel.angelio’s picture

Alright, that makes sense I should have used the second argument of the each callback.

znerol’s picture

Do you have the chance to test the patch against some affected version of IE?

angel.angelio’s picture

Yes, I did test your patch. It works!

  • znerol committed 40947a7 on 7.x-2.x
    Issue #2628596 by angel.angelio, znerol: Fragments missing since 7.x-2.x...
znerol’s picture

Status: Needs work » Fixed

Thank you very much for reporting this issue and for providing a fix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kevster’s picture

Many thanks - I just had this issue reported for customers when loading category pages and using authcache beta7. Weve just upgraded the server to latest ubuntu server LTS so has newer PHP and MySQL.

Issue occured only on IE 9 and 8 - the ajax content was just spinning and wouldnt load.

Great job - thanks!!

John Pitcairn’s picture

Yup, current dev fixes my IE9 issues as well. How about a new beta release?