Javascript Error on Chrome - Solution

Bug #824387 reported by zempa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
typeface.js
New
Undecided
Unassigned

Bug Description

The error appears on the last release of Google Chrome (13) :
Line 791 : Uncaught TypeError: Cannot read property 'length' of null

So i try to redefine this length property.
Here is my solution :

- line 455 : add "+2" in the height of the canvas element.
  replace
  canvas.height = Math.round(this.pixelsFromPoints(face, style, face.lineHeight));
  by
  canvas.height = Math.round(this.pixelsFromPoints(face, style, face.lineHeight))+2;

- line 790 : add the following line between line 790 and line 791
  var lengthStyleSheet = (styleSheet.cssRules)? styleSheet.cssRules.length : 0;

- line 791 : change the last parameter in the insertRule function
  replace
  document.styleSheets[0].insertRule(typefaceSelectors.join(',') + ' { visibility: hidden; }', styleSheet.cssRules.length);
  by
  document.styleSheets[0].insertRule(typefaceSelectors.join(',') + ' { visibility: hidden; }',lengthStyleSheet );

- lines 801 and 826 : change the same parameter
  replace
  styleSheet.cssRules.length
  by
  lengthStyleSheet

The patched script in the attachment

Revision history for this message
zempa (hikari79) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.