@@ -77,8 +77,8 @@ function shouldDebug(details) {
77
77
/******************************************************************************/
78
78
79
79
builtinScriptlets . push ( {
80
- name : 'abort-current-script-core .fn' ,
81
- fn : abortCurrentScriptCore ,
80
+ name : 'abort-current-script.fn' ,
81
+ fn : abortCurrentScriptFn ,
82
82
dependencies : [
83
83
'get-exception-token.fn' ,
84
84
'safe-self.fn' ,
@@ -87,7 +87,7 @@ builtinScriptlets.push({
87
87
} ) ;
88
88
// Issues to mind before changing anything:
89
89
// https://github.com/uBlockOrigin/uBlock-issues/issues/2154
90
- function abortCurrentScriptCore (
90
+ function abortCurrentScriptFn (
91
91
target = '' ,
92
92
needle = '' ,
93
93
context = ''
@@ -122,8 +122,9 @@ function abortCurrentScriptCore(
122
122
const debug = shouldDebug ( extraArgs ) ;
123
123
const exceptionToken = getExceptionTokenFn ( ) ;
124
124
const scriptTexts = new WeakMap ( ) ;
125
+ const textContentGetter = Object . getOwnPropertyDescriptor ( Node . prototype , 'textContent' ) . get ;
125
126
const getScriptText = elem => {
126
- let text = elem . textContent ;
127
+ let text = textContentGetter . call ( elem ) ;
127
128
if ( text . trim ( ) !== '' ) { return text ; }
128
129
if ( scriptTexts . has ( elem ) ) { return scriptTexts . get ( elem ) ; }
129
130
const [ , mime , content ] =
@@ -596,15 +597,15 @@ builtinScriptlets.push({
596
597
] ,
597
598
fn : abortCurrentScript ,
598
599
dependencies : [
599
- 'abort-current-script-core .fn' ,
600
+ 'abort-current-script.fn' ,
600
601
'run-at-html-element.fn' ,
601
602
] ,
602
603
} ) ;
603
604
// Issues to mind before changing anything:
604
605
// https://github.com/uBlockOrigin/uBlock-issues/issues/2154
605
606
function abortCurrentScript ( ...args ) {
606
607
runAtHtmlElementFn ( ( ) => {
607
- abortCurrentScriptCore ( ...args ) ;
608
+ abortCurrentScriptFn ( ...args ) ;
608
609
} ) ;
609
610
}
610
611
0 commit comments