Browser Plugins Cause javaScript Exception in Async Callback Handler...

Rate It (1)

Last post 09-20-2006 1:05 AM by mattgi. 8 replies.

Sort Posts:

  • Browser Plugins Cause javaScript Exception in Async Callback Handler...

    08-01-2006, 10:32 PM
    I posted about this issue before, but didn't root-cause it as I *thought* a fix was on the way in the July CTP. I was wrong.

    If you read the post I linked to above, you will see a snippet of the following method (from the Atlas.js file):

    this._updateStyleSheet = function(cssText)
    {
      var head = document.getElementsByTagName('HEAD')[0];
      var styles = document.styleSheets;
      var styleSheet = styles[styles.length - 1];
     
      if (Sys.Runtime.get_hostType() == Sys.HostType.InternetExplorer)
      {
        styleSheet.cssText = cssText;
      }
      else
      {              
        for (var i = styleSheet.cssRules.length - 1; i >= 0; i--)
        {
          styleSheet.deleteRule(i);
        }
        var ruleLines =cssText.split('}');
        for (var j =0;j <ruleLines.length;j++)
        {
          var rule =ruleLines[j];
          var index =rule.indexOf('{');
          var style =rule.substr(index +1).trim();
          if (style.length !=0)
          {
            var selector =rule.substring(0,index).trim();
            styleSheet.insertRule(selector +'{'+style +'}', styleSheet.cssRules.length);
          }
        }
      }
    }

    The line in red is the root cause of the issue, and the symptom (a NS_ERROR_DOM_BAD_URI exception) is caused by the line in blue.

    Now, here's the issue... some Firefox plugins (i.e. - the CoComment Extension) will load an external stylesheet after the page has been downloaded, putting the plugin's stylesheet at the end of the document.styleSheets array.

    This is a problem as the _updateStyleSheet method expects the last item of the array to be some stylesheet specific to the Atlas framework. But due to the plugin, it isn't at the end (at index styles.length-1), but rather it is two from the end (at index styles.length-2).

    With the CoComment plugin this causes an issue because we don't seem to have access to the URI, and styleSheet.cssRules will throw the mentioned exception. I would suggest that instead of blindly assuming the Atlas specific styleSheet is at the end of the array, the _updateStyleSheet method should go thru the array (from end to start) looking for a specific attribute of the <script> tag ... or better yet, the ID!

    This should be considered a big issue as I'm sure there are plenty of other plugins/extensions for Firefox (and likely other browsers) that will cause the same issue.

    Also... is this the right place to report such bugs, or is there a bug-tracker that the Atlas team uses and /or I can contact them directly?

    Thanks in advance!
  • Re: Browser Plugins Cause javaScript Exception in Async Callback Handler...

    08-02-2006, 8:41 AM
    Looks like the link to my old post about the exception didn't work... so try this one.
  • Re: Browser Plugins Cause javaScript Exception in Async Callback Handler...

    08-06-2006, 10:50 PM
    • Loading...
    • jeffreymcmanus
    • Joined on 02-01-2006, 11:17 PM
    • San Francisco, CA
    • Posts 2
    Atlas team, it would be terrific to get a workaround or a fix for this...I'm launching a site that uses Atlas soon and I might have to scale back my use of Atlas because of this problem.
  • Re: Browser Plugins Cause javaScript Exception in Async Callback Handler...

    08-06-2006, 11:02 PM
    FYI - This thread didn't seem to be getting any attention, so I wrote up a post about the issue on my blog. If you are reading this tread and looking for more info, you might want to take a look at my post... and feel free to leave any feedback that you may have.
  • Re: Browser Plugins Cause javaScript Exception in Async Callback Handler...

    08-11-2006, 7:18 AM
    • Loading...
    • StuWhite
    • Joined on 08-11-2006, 10:46 AM
    • London, UK
    • Posts 1

    I would have thought that quite a large number of Firefox users install extensions. I use the SearchStatus extension which causes the same problem.

    I see this as a very serious bug and hope that the Atlas Development team can get it fixed quickly. I can't help but think that if the bug affected all IE users who had add-ons installed, then perhaps Microsoft would give it a higher priority...

  • Re: Browser Plugins Cause javaScript Exception in Async Callback Handler...

    08-24-2006, 10:03 AM
    • Loading...
    • psyvision
    • Joined on 08-17-2006, 3:41 PM
    • Posts 5
    I too am having this issue, except on an ajax heavy page.

    I have a grid view on the right, an accordion on the left along with a popup control extender, update panels and an update progress.

    The only thing that isn't working is the popup control extender which was diagnosed as having the same issue as Steve by using the Firebug extension for Firefox.

    I am also using the July CTP with Firefox 1.5.0.6
  • Re: Browser Plugins Cause javaScript Exception in Async Callback Handler...

    08-28-2006, 11:32 AM
    • Loading...
    • MTri
    • Joined on 08-28-2002, 2:00 PM
    • Posts 14

    This is an issue for me as well.

     -MT

  • Re: Browser Plugins Cause javaScript Exception in Async Callback Handler...

    08-31-2006, 4:18 PM
    • Loading...
    • TorgerJW
    • Joined on 08-30-2006, 2:35 PM
    • Washington, DC
    • Posts 9
    Bump. Me too.
  • Re: Browser Plugins Cause javaScript Exception in Async Callback Handler...

    09-20-2006, 1:05 AM
    • Loading...
    • mattgi
    • Joined on 06-11-2002, 12:31 PM
    • Redmond
    • Posts 107

    Thanks Steve.  I expect this fix to be in our next release.

     

     



    This posting is provided "AS IS" with no warranties, and confers no rights.
Page 1 of 1 (9 items)
Microsoft Communities
Page view counter