File tree Expand file tree Collapse file tree 4 files changed +47
-17
lines changed
Expand file tree Collapse file tree 4 files changed +47
-17
lines changed Original file line number Diff line number Diff line change 1111 node . textContent = document . querySelector ( ".testcase" ) . textContent ;
1212 document . querySelector ( ".main" ) . appendChild ( node ) ;
1313 }
14+ function dupBlocked ( ) {
15+ const html = `
16+ <p class="brush:">
17+ http://example.com
18+ <span class="bbcode_code">http://example.com</span>
19+ </p>
20+ `
21+ document . querySelector ( ".main" ) . insertAdjacentHTML ( "beforeend" , html ) ;
22+ }
1423 function interval ( ) {
1524 var p = document . createElement ( "p" ) ;
1625 p . className = "leaker" ;
@@ -909,6 +918,7 @@ <h3>Bad TLDs</h3>
909918 < p >
910919 < button class ="btn-default " onclick ="dup() "> Dynamic inserted content</ button >
911920 < button class ="btn-default " onclick ="interval() "> Leak test</ button >
921+ < button class ="btn-default " onclick ="dupBlocked() "> Insert blocked text</ button >
912922 </ p >
913923 </ div >
914924</ body >
Original file line number Diff line number Diff line change @@ -3832,15 +3832,25 @@ async function enable(options) {
38323832 if ( processes >= MAX_PROCESSES ) {
38333833 throw new Error ( "Too many processes" ) ;
38343834 }
3835- if ( ! validRoot ( node , options . validator ) ) {
3836- continue ;
3835+ const linkifyIncludedElements = ( ) => {
3836+ if ( options . includeElement ) {
3837+ for ( const el of node . querySelectorAll ( options . includeElement ) ) {
3838+ processedNodes . add ( el ) ;
3839+ return linkify ( { ...options , root : el , recursive : true } ) ;
3840+ }
3841+ }
3842+ } ;
3843+ if ( validRoot ( node , options . validator ) ) {
3844+ processedNodes . add ( node ) ;
3845+ processes ++ ;
3846+ linkify ( { ...options , root : node , recursive : true } )
3847+ . then ( linkifyIncludedElements )
3848+ . finally ( ( ) => {
3849+ processes -- ;
3850+ } ) ;
3851+ } else {
3852+ linkifyIncludedElements ( ) ;
38373853 }
3838- processedNodes . add ( node ) ;
3839- processes ++ ;
3840- linkify ( { ...options , root : node , recursive : true } )
3841- . finally ( ( ) => {
3842- processes -- ;
3843- } ) ;
38443854 }
38453855 }
38463856 }
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export default async () => [
4646 {
4747 test : / ( o p t i o n s | d i a l o g ) \. j s $ / ,
4848 target : "dist-extension/$1.html" ,
49- handle : ( content , { htmlScripts} ) => content . replace ( "< /body>" , `${ htmlScripts } </body>` )
49+ handle : ( content , { htmlScripts} ) => content . replace ( / . * < \ /b o d y > / , `${ htmlScripts } </body>` )
5050 } ,
5151 {
5252 test : / b a c k g r o u n d \. j s $ / ,
Original file line number Diff line number Diff line change @@ -28,15 +28,25 @@ async function enable(options) {
2828 if ( processes >= MAX_PROCESSES ) {
2929 throw new Error ( "Too many processes" ) ;
3030 }
31- if ( ! validRoot ( node , options . validator ) ) {
32- continue ;
31+ const linkifyIncludedElements = ( ) => {
32+ if ( options . includeElement ) {
33+ for ( const el of node . querySelectorAll ( options . includeElement ) ) {
34+ processedNodes . add ( el ) ;
35+ return linkify ( { ...options , root : el , recursive : true } ) ;
36+ }
37+ }
38+ }
39+ if ( validRoot ( node , options . validator ) ) {
40+ processedNodes . add ( node ) ;
41+ processes ++ ;
42+ linkify ( { ...options , root : node , recursive : true } )
43+ . then ( linkifyIncludedElements )
44+ . finally ( ( ) => {
45+ processes -- ;
46+ } ) ;
47+ } else {
48+ linkifyIncludedElements ( ) ;
3349 }
34- processedNodes . add ( node ) ;
35- processes ++ ;
36- linkify ( { ...options , root : node , recursive : true } )
37- . finally ( ( ) => {
38- processes -- ;
39- } ) ;
4050 }
4151 }
4252 }
You can’t perform that action at this time.
0 commit comments