File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919 // The challenge page must render at the top level so the full admin
2020 // chrome is visible and the redirect/replay targets the correct frame.
2121 if ( window . top !== window . self ) {
22- window . top . location . href = window . location . href ;
23- return ;
22+ var canNavigateTop = true ;
23+ try {
24+ var frame = window . frameElement ;
25+ if ( frame && frame . hasAttribute ( 'sandbox' ) ) {
26+ var sandboxTokens = ( frame . getAttribute ( 'sandbox' ) || '' ) . split ( / \s + / ) ;
27+ canNavigateTop = sandboxTokens . indexOf ( 'allow-top-navigation' ) !== - 1 ;
28+ }
29+ } catch ( e ) {
30+ canNavigateTop = false ;
31+ }
32+
33+ if ( canNavigateTop ) {
34+ try {
35+ window . top . location . href = window . location . href ;
36+ return ;
37+ } catch ( e ) {
38+ // Cross-origin/sandboxed hosts such as WordPress Playground must
39+ // keep the challenge functional inside the embedded frame.
40+ }
41+ }
2442 }
2543
2644 var config = window . wpSudoChallenge || { } ;
Original file line number Diff line number Diff line change 1818 {
1919 "step" : " installPlugin" ,
2020 "pluginData" : {
21- "resource" : " url" ,
22- "url" : " https://github.com/dknauss/Sudo/archive/refs/tags/v3.1.1.zip"
21+ "resource" : " git:directory" ,
22+ "url" : " https://github.com/dknauss/Sudo" ,
23+ "ref" : " main" ,
24+ "refType" : " branch"
2325 },
2426 "options" : { "activate" : true }
2527 },
You can’t perform that action at this time.
0 commit comments