Debugging dynamically added JavaScript | Community
Skip to main content
December 16, 2019
Solved

Debugging dynamically added JavaScript

  • December 16, 2019
  • 1 reply
  • 9351 views

Hi.

 

Is there any way to add breakpoints so that I can step through the code in the dynamically loaded scripts coming from Adobe Launch? I have tried adding //# sourceURL=name_of_file.js, but it does not seem to be working.

 

Any help would be appreciated, thank you!

 

Kind regards,

Even A. Nilsen

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by thomas_amsler

Not sure if I understand you correctly, but most browsers have some developer tools (F12), where you can select the loaded resources and add breakpoints to them. The ones from Chrome beeing the best and the ones from IE/Edge the worst. It is easier if you include the non minified launch script in your code for debugging purposes, which then also loads additional scripts in the non minified version if needed. But also the minified ones can be reformatted in most developer tools with some button like "{ }" to be able to set proper breakpoints. Just the variable names are "obfuscated".

1 reply

thomas_amslerAccepted solution
Level 6
December 17, 2019

Not sure if I understand you correctly, but most browsers have some developer tools (F12), where you can select the loaded resources and add breakpoints to them. The ones from Chrome beeing the best and the ones from IE/Edge the worst. It is easier if you include the non minified launch script in your code for debugging purposes, which then also loads additional scripts in the non minified version if needed. But also the minified ones can be reformatted in most developer tools with some button like "{ }" to be able to set proper breakpoints. Just the variable names are "obfuscated".

Level 6
January 6, 2020

If you still can't find the source of your script, try another browser if possible. I sometimes also had a problem with a custom Firefox, whereas Chrome was fine. Then within the code, you should be able to find the rule by its name.

Each Rule is a JavaScript object starting with it's id and name, followed by events, conditions and actions arrays.

{
"id": "GENERATED_ID",
"name": "RULE_NAME",
"events": [],

"conditions": [],

"actions": []

}

Within the actions array, you can see the actions you added, but you can only really debug the ones having custom code sections. But to test if a rule get's actually called you can add some dummy code to set a breakpoint. But only to check if it gets called there are better tools, like OmniBug