mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
Merge pull request #92 from joefiorini/breakpoint-fix
Fix for debugger breakpoints with sourcemaps
This commit is contained in:
commit
c5bfe218bd
@ -56,7 +56,10 @@ import 'tower/shared/InventoryTree';
|
||||
import 'tower/shared/Timer';
|
||||
import 'tower/shared/Socket';
|
||||
|
||||
|
||||
/*#if DEBUG#*/
|
||||
import {__deferLoadIfEnabled} from 'tower/debug';
|
||||
__deferLoadIfEnabled();
|
||||
/*#endif#*/
|
||||
|
||||
var tower = angular.module('Tower', [
|
||||
'ngRoute',
|
||||
|
||||
37
awx/ui/static/js/debug.js
Normal file
37
awx/ui/static/js/debug.js
Normal file
@ -0,0 +1,37 @@
|
||||
/*********************************************
|
||||
* @ngdoc function
|
||||
* @name __deferLoadIfEnabled
|
||||
* @description
|
||||
*
|
||||
* This function only included in debug releases.
|
||||
*
|
||||
* This function exists to make it easier to debug when using sourcemaps.
|
||||
* There is currently an issue in Chrome (and possibly other browsers) where
|
||||
* breakpoints that hit before sourcemaps are downloaded do not work.
|
||||
*
|
||||
* Calling this function uses a feature in Angular that looks for a prefix on
|
||||
* the `window.name` property to tell it to disable automatic loading of the app.
|
||||
*
|
||||
* If you need to debug code that runs at load time, first add:
|
||||
*
|
||||
* ?aw.suspend=true
|
||||
*
|
||||
* to the end of the URL. When you see the Tower logo loaded on an otherwise blank page,
|
||||
* open the Dev Tools console and execute the code:
|
||||
*
|
||||
* angular.resumeBootstrap()
|
||||
*
|
||||
* This should continue loading the app and hit your breakpoint.
|
||||
*
|
||||
* For more information on how this works see https://docs.angularjs.org/guide/bootstrap
|
||||
*/
|
||||
export function __deferLoadIfEnabled() {
|
||||
|
||||
var deferPattern = /aw\.suspend=true/;
|
||||
|
||||
if (deferPattern.test(window.location.search) || deferPattern.test(window.location.hash)) {
|
||||
console.log('Deferred load due to "aw.suspend=true" in URL. Please execute `angular.resumeBootstrap()` to continue.');
|
||||
window.name = 'NG_DEFER_BOOTSTRAP!' + (window.name || '');
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user