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