Crash when accessing script from another domain

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

Bug Description

When trying to use the plugin hosted on another domain, different from the current one, typeface.js fails to determine the stylesheets from the current page.

Around line 793, I check more thoroughly if I can use match to check the domain. If I don't find a proper domain, I use the last good index, which will always be at least 0:

var re = new RegExp(document.domain, 'g');
for (var index=0; index < document.styleSheets.length; index++) {
    if (document.styleSheets[index] && document.styleSheets[index].href && document.styleSheets[index].href.match && document.styleSheets[index].href.match(re)) {
        break;
    }
}

//Fix when no href matches - 20130802
if (index === document.styleSheets.length) {
 index = document.styleSheets.length -1;
}

Revision history for this message
Gerard Rubio (gerard-rubio) 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.