This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push: new 4acc5ccd Look for nested JS references 4acc5ccd is described below commit 4acc5ccd514c0efad141da3d65979a4b38d86f4e Author: Sebb <s...@apache.org> AuthorDate: Tue Apr 23 17:08:22 2024 +0100 Look for nested JS references --- tools/scan-page.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/scan-page.js b/tools/scan-page.js index 6aa31787..c5ea2910 100755 --- a/tools/scan-page.js +++ b/tools/scan-page.js @@ -18,6 +18,10 @@ if (!isASFhost(inithost)) { throw new Error("Only ASF hosts are supported - saw " + inithost); } +function getHost(url) { + return new URL(url).host; +} + (async () => { // new fails with: // Error: Failed to launch the browser process! @@ -41,8 +45,12 @@ if (!isASFhost(inithost)) { console.log(url); interceptedRequest.continue(); } else if (option == 'allref') { - let iniurl = interceptedRequest.initiator().url; - if (iniurl && !iniurl.startsWith(target)) { // second level + ini = interceptedRequest.initiator(); + let iniurl = ini.url; + if (!iniurl && ini.stack) { + iniurl = ini.stack.callFrames[0].url; + } + if (iniurl && inithost != getHost(iniurl)) { // second level console.log(url + ' <= ' + iniurl); } else { console.log(url);