← Back to team overview

launchpad-dev team mailing list archive

Help with bug #471195 (browser caching problem?)

 

In Bug #471195 (Private bugs don't set the body class to "private"), in
comment #3, I've attached a reproduction transcript that shows a problem
whereby javascript changes to classes (in the body element and one other
div element) appear not to take effect, even though they *do* take
effect in Firebug's console.

I'll include the recipe below.  Please see the bug for details.  If
anyone has any ideas, I'd be grateful to hear them.

-Karl

This is with lp:~kfogel/launchpad/471195-private-bug-body-class-private:

With Firebug turned off, do 'make run' in the above branch and visit

  https://bugs.launchpad.dev/firefox/+bug/1

The page should say "This report is public" on the top right portlet.
(If it doesn't, toggle the privacy and hard reload the page, to make
sure you're at the right starting point for this recipe.)

Now view the HTML source for the page.  You should see:

  <body id="document"
        class="tab-bugs
      main_side
      public
      yui-skin-sam">
        
and

      <div id="privacy" class="first portlet public">

...in the source, where you'd expect them to be.  Note the value
"public" in both of those class attributes.

Turn on Firebug (Tools --> Firebug --> Open Firebug) and select the
"Script" tab on the Firebug window, then use the page menu to open
this Javascript file:

  launchpad.dev/+icing/rev10420/build/bugs/bugtask-index.js

Set a breakpoint on line 527, the top line of this conditional:

  if (private) {
      Y.one('body').replaceClass('public', 'private');
      privacy_div.replaceClass('public', 'private');
      privacy_text.set(
          'innerHTML',
          'This report is <strong>private</strong> ');
  } else {
      Y.one('body').replaceClass('private', 'public');
      privacy_div.replaceClass('private', 'public');
      privacy_text.set(
          'innerHTML', 'This report is public ');
  }

Now toggle the bug from public to private, using the portlet.  You
should hit the breakpoint, and "if (private)" should be true.  Step
forward so you're on this line:

  Y.one('body').replaceClass('public', 'private');

Switch to the "Console" tab and do some evaluations, just to make sure:

  >>> Y.one('body')
  BODY#document.tab-bugs
  .    main_side
       public
       yui-skin-sam
       yui_3_0_0-4-1267575280816285
       { _yuid="yui_3_0_0-4-1267575280816285",  more...}

  >>> Y.one('body').getAttribute('class')
  "tab-bugs main_side public yui-skin-sam"

  >>> Y.one('#privacy').getAttribute('class')
  "first portlet public"

Okay, now switch back to the "Script" tab and step across the current
line, so you execute the replacement of the body class's "public"
value with "private".  The console should show that it happened:

  >>> Y.one('body').getAttribute('class')
  "tab-bugs main_side yui-skin-sam private"

And because we haven't yet executed the replacement on the
id="privacy" div, it still has the "public" class:
  
  >>> Y.one('#privacy').getAttribute('class')
  "first portlet public"

Now step forward again.  See that the body class keeps its "private"
value, as expected...

  >>> Y.one('body').getAttribute('class')
  "tab-bugs main_side yui-skin-sam private"

...and the id="privacy" div now has the "private" class too:

  >>> Y.one('#privacy').getAttribute('class')
  "first portlet private"
  
Everything looks good.  Hit the "Continue" button in Firebug so the
page can finish loading.

So, everything's working as expected.  What's the problem?

The problem is that in my browser (Firefox), if I now do View Source
on the page, I still see "public" (not "private") in the body class
and the privacy div class!  This is with Firefox 3.5.8 on Ubuntu 9.10
(Karmic Koala) + updates.

Manually refreshing the page updates the classes so they're correct.
But shouldn't they update without a hard reload?  Is this a browser
caching issue, and if so, is it a problem?



Follow ups