Page 1 of 1

surrogate problem due to possible bfcache bug

Posted: Sun Oct 30, 2011 11:54 am
by al_9x
NS 2.1.8, Fx 8.0b5, new profile

test surrogate:

Code: Select all

user_pref("noscript.surrogate.google_preview.sources", "@^https?://www\.google\.com/search\?(?!(?:.*&)?tbm=[^&]+)");
user_pref("noscript.surrogate.google_preview.replacement", "console.log('@ surrogate: ' + document.URL); addEventListener('DOMContentLoaded', function(e) {console.log(e.type + ' : ' + e.target.location);}, true); addEventListener('load', function(e) {console.log(e.type + ' : ' + e.target.location); document.body.insertBefore(document.createElement('IMG'), document.body.firstChild).src = 'http://www.google.com/images/nav_logo91.png';}, false); addEventListener('pageshow', function(e) console.log(e.type + (e.persisted ? ' : cached : ' : ' : uncached : ') + e.target.location), false);");
  1. open web console, turn off net and css logging
  2. load http://www.google.com/search?q=whatever
  3. click on maps
  4. go back, the first time only "pageshow : cached" is logged, everything is fine

    Code: Select all

    pageshow : cached : http://www.google.com/search?q=whatever
    
  5. go forward
  6. back again (quickly, as soon as the maps page appears loaded, before the secondary load restarts the spinner)
    when the maps page loads, the progress spinner stops, then briefly restarts again as the map iframe (or whatever) seems to refresh. If you let the maps page do it's full load/paint the problem does not manifest.
    1. now the following is logged:

      Code: Select all

      load : http://www.google.com/search?q=whatever
      pageshow : uncached : http://www.google.com/search?q=whatever
      
    2. another "load" inserted image is added
    Since another image is inserted, it's clear that the DOM is bfcached (also neither the surrogate nor DOMContentLoaded fire, as one would expect for bfcached pages), but then another load should not fire either, and "persisted" should be true in "pageshow"
Is this purely a gecko bug? Or is NS contributing?

Re: surrogate problem due to possible bfcache bug

Posted: Sun Oct 30, 2011 12:08 pm
by al_9x
on further testing, it seems that what causes the problem is hitting back before the maps page does its secondary load/update.

when the maps page loads, the progress spinner stops, then briefly restarts again as the map iframe (or whatever) seems to refresh.

To repro this issue, hit back quickly, as soon as the maps page appears loaded, before the secondary load restarts the spinner

Re: surrogate problem due to possible bfcache bug

Posted: Mon Oct 31, 2011 9:09 am
by al_9x
I've taken NS out of the equation with this error console snippet:

Code: Select all

var tb = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow('navigator:browser').gBrowser; tb.addEventListener('DOMContentLoaded', function(e) {var url = e.target.location.href; if (url !== 'http://www.google.com/search?q=whatever') return; Components.utils.reportError(e.type);}, true); tb.addEventListener('load', function(e) {var url = e.target.location.href; if (url !== 'http://www.google.com/search?q=whatever') return; Components.utils.reportError(e.type); var doc = e.target; doc.body.insertBefore(doc.createElement('IMG'), doc.body.firstChild).src = 'http://www.google.com/images/nav_logo91.png';}, true); tb.addEventListener('pageshow', function(e) {var url = e.target.location.href; if (url !== 'http://www.google.com/search?q=whatever') return; Components.utils.reportError(e.type + (e.persisted ? ' : cached' : ' : uncached'));}, true);
Giorgio, before I file a bug, what are your thoughts on this?

Re: surrogate problem due to possible bfcache bug

Posted: Mon Oct 31, 2011 9:22 am
by al_9x
The image I'm inserting in onload does not show in Fx10 but does in Fx8

corrected

Re: surrogate problem due to possible bfcache bug

Posted: Mon Oct 31, 2011 10:49 am
by Giorgio Maone
I'm looking into it.

Re: surrogate problem due to possible bfcache bug

Posted: Mon Oct 31, 2011 10:59 am
by al_9x
Giorgio Maone wrote:I'm looking into it.
Thanks, I filed a bug

Re: surrogate problem due to possible bfcache bug

Posted: Tue Nov 01, 2011 3:40 am
by al_9x
There was a problem in my load handler
https://bugzilla.mozilla.org/show_bug.cgi?id=698360#c1

I updated it here as well.