Catch Security Errors in styleSheet rules (#437)
This commit is contained in:
committed by
GitHub
parent
4b589b34c1
commit
714a4fbb73
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
.vscode
|
||||
.idea
|
||||
node_modules
|
||||
package-lock.json
|
||||
# yarn.lock
|
||||
|
||||
@@ -849,16 +849,23 @@ export class Replayer {
|
||||
|
||||
if (d.adds) {
|
||||
d.adds.forEach(({ rule, index }) => {
|
||||
const _index =
|
||||
index === undefined
|
||||
? undefined
|
||||
: Math.min(index, styleSheet.rules.length);
|
||||
try {
|
||||
styleSheet.insertRule(rule, _index);
|
||||
const _index =
|
||||
index === undefined
|
||||
? undefined
|
||||
: Math.min(index, styleSheet.rules.length);
|
||||
try {
|
||||
styleSheet.insertRule(rule, _index);
|
||||
} catch (e) {
|
||||
/**
|
||||
* sometimes we may capture rules with browser prefix
|
||||
* insert rule with prefixs in other browsers may cause Error
|
||||
*/
|
||||
}
|
||||
} catch (e) {
|
||||
/**
|
||||
* sometimes we may capture rules with browser prefix
|
||||
* insert rule with prefixs in other browsers may cause Error
|
||||
* accessing styleSheet rules may cause SecurityError
|
||||
* for specific access control settings
|
||||
*/
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user