File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ const DEFAULT_SAVE_INTERVAL = 30 * 1000
34
34
const HAS_SHEET = `
35
35
[...document.styleSheets].filter((sheet) => {
36
36
try {sheet.cssRules; return true} catch {return false}
37
- }).length || !!document.querySelector ('[style]')
37
+ }).length || !!( document.querySelectorAll ('[style]').length > 1 )
38
38
`
39
39
40
40
const WINDOW_METHODS = [
@@ -335,11 +335,14 @@ export class Window extends EventEmitter {
335
335
if ( this . web . getURL ( ) === 'agregore://settings' ) {
336
336
this . web . executeJavaScript ( `window.onSettings(${ JSON . stringify ( Config ) } )` )
337
337
}
338
- const hasStyles = await this . web . executeJavaScript ( HAS_SHEET )
338
+ const hasStyles = await this . web . executeJavaScript ( HAS_SHEET , true )
339
+ . catch ( ( ) => false ) // If we error out checking styles, try it anyway
339
340
console . log ( { hasStyles } )
340
341
if ( ! hasStyles ) {
341
342
const style = await getDefaultStylesheet ( this . web )
342
- await this . web . insertCSS ( style )
343
+ await this . web . insertCSS ( style , {
344
+ cssOrigin : 'user'
345
+ } )
343
346
}
344
347
} )
345
348
You can’t perform that action at this time.
0 commit comments