Get list of all script id's

1,140 views
Skip to first unread message

Andrey Sidorov

unread,
Oct 22, 2013, 1:07:13 AM10/22/13
to google-chrome-...@googlegroups.com
Hello,

Is it possible to get all scripts ID's on the page using remote protocol after page is already loaded? (e.i listening for 'Debugger.scriptParsed' is not an option). Page.getResourceTree only gives urls and no id's. I noticed also that live edit does not work if you attach after page load - looks like it needs url<->scriptId association.

Andrey.

Vsevolod Vlasov

unread,
Oct 22, 2013, 4:02:01 AM10/22/13
to Google Chrome Developer Tools
When you attach to a page that has already loaded and enable Debugger domain you receive Debugger.scriptParsed events for all the scripts in VM (unless they were collected already).
This is what DevTools does. LiveEdit should also work in this case, just make sure you pass correct scriptId to Debugger.setScriptSource command.


--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/c176c3b2-8dff-470b-9ec1-63a9dc19ffb2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Yury Semikhatsky

unread,
Oct 22, 2013, 4:03:05 AM10/22/13
to Google Chrome Developer Tools
Hi Andrey,

The only way to get ids of all loaded scripts is listen to Debugger.scriptParsed. Note that if the page is already loaded you will still receive scriptParsed event for each live script in the page. You can send Debugger.disable followed by Debugger.enable to  re-request the list of all parsed scripts.



On Tue, Oct 22, 2013 at 9:07 AM, Andrey Sidorov <andrey....@gmail.com> wrote:

--

Andrey Sidorov

unread,
Oct 22, 2013, 5:02:31 AM10/22/13
to google-chrome-...@googlegroups.com
Vsevolod, Yury - thanks, that worked.
I was using devtools behind crmux proxy to see how scripts are retrieved and that was probably the reason of liveedit issue I mentioned - just doing 'Debug.enable' was not enough as devtools re-used existing connection with debugger already enabled.

Andrey


On Tuesday, 22 October 2013 19:03:05 UTC+11, Yury Semikhatsky wrote:
Hi Andrey,

The only way to get ids of all loaded scripts is listen to Debugger.scriptParsed. Note that if the page is already loaded you will still receive scriptParsed event for each live script in the page. You can send Debugger.disable followed by Debugger.enable to  re-request the list of all parsed scripts.

On Tue, Oct 22, 2013 at 9:07 AM, Andrey Sidorov <andrey....@gmail.com> wrote:
Hello,

Is it possible to get all scripts ID's on the page using remote protocol after page is already loaded? (e.i listening for 'Debugger.scriptParsed' is not an option). Page.getResourceTree only gives urls and no id's. I noticed also that live edit does not work if you attach after page load - looks like it needs url<->scriptId association.

Andrey.

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-developer-tools+unsub...@googlegroups.com.

lza...@gmail.com

unread,
Jun 3, 2014, 6:58:18 PM6/3/14
to google-chrome-...@googlegroups.com
Hi,

Thank you!!!!!
I really wish I googled it before I spent 2 days trying to figure it out.

Laszlo


On Tuesday, October 22, 2013 1:03:05 AM UTC-7, Yury Semikhatsky wrote:
Hi Andrey,

The only way to get ids of all loaded scripts is listen to Debugger.scriptParsed. Note that if the page is already loaded you will still receive scriptParsed event for each live script in the page. You can send Debugger.disable followed by Debugger.enable to  re-request the list of all parsed scripts.

On Tue, Oct 22, 2013 at 9:07 AM, Andrey Sidorov <andrey....@gmail.com> wrote:
Hello,

Is it possible to get all scripts ID's on the page using remote protocol after page is already loaded? (e.i listening for 'Debugger.scriptParsed' is not an option). Page.getResourceTree only gives urls and no id's. I noticed also that live edit does not work if you attach after page load - looks like it needs url<->scriptId association.

Andrey.

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-developer-tools+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages