mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-30876 filter_mediaplugin Wrapping the style sheets access with try & catch
Conflicts: lib/javascript-static.js
This commit is contained in:
parent
6039dc55fb
commit
8f80180de6
@ -1771,15 +1771,27 @@ M.util.load_flowplayer = function() {
|
||||
|
||||
var rule;
|
||||
for (var j=0; j < document.styleSheets.length; j++) {
|
||||
if (typeof (document.styleSheets[j].rules) != 'undefined') {
|
||||
var allrules = document.styleSheets[j].rules;
|
||||
} else if (typeof (document.styleSheets[j].cssRules) != 'undefined') {
|
||||
var allrules = document.styleSheets[j].cssRules;
|
||||
} else {
|
||||
// why??
|
||||
|
||||
// To avoid javascript security violation accessing cross domain stylesheets
|
||||
var allrules = false;
|
||||
try {
|
||||
if (typeof (document.styleSheets[j].rules) != 'undefined') {
|
||||
allrules = document.styleSheets[j].rules;
|
||||
} else if (typeof (document.styleSheets[j].cssRules) != 'undefined') {
|
||||
allrules = document.styleSheets[j].cssRules;
|
||||
} else {
|
||||
// why??
|
||||
continue;
|
||||
}
|
||||
} catch (e) {
|
||||
continue;
|
||||
}
|
||||
if (!allrules) continue;
|
||||
|
||||
// On cross domain style sheets Chrome V8 allows access to rules but returns null
|
||||
if (!allrules) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for(var i=0; i<allrules.length; i++) {
|
||||
rule = '';
|
||||
if (/^\.mp3flowplayer_.*Color$/.test(allrules[i].selectorText)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user