forked from mirrors/gecko-dev
		
	Bug 1355126 - regression test for absolute sourceRoot; r=bgrins
MozReview-Commit-ID: EOsAWOr5XWn --HG-- extra : rebase_source : 0abbd5d0bc85eba729cc2e4f0ccb65efca12cbfc
This commit is contained in:
		
							parent
							
								
									2ab90b6956
								
							
						
					
					
						commit
						16063b583c
					
				
					 5 changed files with 72 additions and 0 deletions
				
			
		|  | @ -165,6 +165,7 @@ devtools/server/actors/utils/automation-timeline.js | |||
| 
 | ||||
| # Ignore devtools files testing sourcemaps / code style | ||||
| devtools/client/debugger/test/mochitest/code_binary_search.js | ||||
| devtools/client/debugger/test/mochitest/code_binary_search_absolute.js | ||||
| devtools/client/debugger/test/mochitest/code_math.min.js | ||||
| devtools/client/debugger/test/mochitest/code_math_bogus_map.js | ||||
| devtools/client/debugger/test/mochitest/code_ugly* | ||||
|  |  | |||
|  | @ -11,6 +11,8 @@ support-files = | |||
|   code_binary_search.coffee | ||||
|   code_binary_search.js | ||||
|   code_binary_search.map | ||||
|   code_binary_search_absolute.js | ||||
|   code_binary_search_absolute.map | ||||
|   code_bundle_reload_1.js | ||||
|   code_bundle_reload_1.js.map | ||||
|   code_bundle_reload_2.js | ||||
|  | @ -48,6 +50,7 @@ support-files = | |||
| [browser_menu_api.js] | ||||
| [browser_new_activation_workflow.js] | ||||
| [browser_source_map-01.js] | ||||
| [browser_source_map-absolute.js] | ||||
| [browser_source_map-inline.js] | ||||
| [browser_source_map-reload.js] | ||||
| [browser_target_from_url.js] | ||||
|  |  | |||
|  | @ -0,0 +1,29 @@ | |||
| /* Any copyright is dedicated to the Public Domain. | ||||
|  http://creativecommons.org/publicdomain/zero/1.0/ */
 | ||||
| 
 | ||||
| // Test that an absolute sourceRoot works.
 | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| // Empty page
 | ||||
| const PAGE_URL = `${URL_ROOT}doc_empty-tab-01.html`; | ||||
| const JS_URL = `${URL_ROOT}code_binary_search_absolute.js`; | ||||
| const ORIGINAL_URL = `${URL_ROOT}code_binary_search.coffee`; | ||||
| 
 | ||||
| add_task(function* () { | ||||
|   yield pushPref("devtools.debugger.new-debugger-frontend", true); | ||||
| 
 | ||||
|   const toolbox = yield openNewTabAndToolbox(PAGE_URL, "jsdebugger"); | ||||
|   const service = toolbox.sourceMapURLService; | ||||
| 
 | ||||
|   // Inject JS script
 | ||||
|   let sourceSeen = waitForSourceLoad(toolbox, JS_URL); | ||||
|   yield createScript(JS_URL); | ||||
|   yield sourceSeen; | ||||
| 
 | ||||
|   info(`checking original location for ${JS_URL}:6`); | ||||
|   let newLoc = yield service.originalPositionFor(JS_URL, 6); | ||||
| 
 | ||||
|   is(newLoc.sourceUrl, ORIGINAL_URL, "check mapped URL"); | ||||
|   is(newLoc.line, 4, "check mapped line number"); | ||||
| }); | ||||
|  | @ -0,0 +1,29 @@ | |||
| // Generated by CoffeeScript 1.6.1
 | ||||
| (function() { | ||||
| 
 | ||||
|   window.binary_search = function(items, value) { | ||||
|     var pivot, start, stop; | ||||
|     start = 0; | ||||
|     stop = items.length - 1; | ||||
|     pivot = Math.floor((start + stop) / 2); | ||||
|     while (items[pivot] !== value && start < stop) { | ||||
|       if (value < items[pivot]) { | ||||
|         stop = pivot - 1; | ||||
|       } | ||||
|       if (value > items[pivot]) { | ||||
|         start = pivot + 1; | ||||
|       } | ||||
|       pivot = Math.floor((stop + start) / 2); | ||||
|     } | ||||
|     if (items[pivot] === value) { | ||||
|       return pivot; | ||||
|     } else { | ||||
|       return -1; | ||||
|     } | ||||
|   }; | ||||
| 
 | ||||
| }).call(this); | ||||
| 
 | ||||
| /* | ||||
| //# sourceMappingURL=code_binary_search_absolute.map
 | ||||
| */ | ||||
|  | @ -0,0 +1,10 @@ | |||
| { | ||||
|   "version": 3, | ||||
|   "file": "code_binary_search.js", | ||||
|   "sourceRoot": "http://example.com/browser/devtools/client/framework/test/", | ||||
|   "sources": [ | ||||
|     "code_binary_search.coffee" | ||||
|   ], | ||||
|   "names": [], | ||||
|   "mappings": ";AACA;CAAA;CAAA,CAAA,CAAuB,EAAA,CAAjB,GAAkB,IAAxB;CAEE,OAAA,UAAA;CAAA,EAAQ,CAAR,CAAA;CAAA,EACQ,CAAR,CAAa,CAAL;CADR,EAEQ,CAAR,CAAA;CAEA,EAA0C,CAAR,CAAtB,MAAN;CAGJ,EAA6B,CAAR,CAAA,CAArB;CAAA,EAAQ,CAAR,CAAQ,GAAR;QAAA;CACA,EAA6B,CAAR,CAAA,CAArB;CAAA,EAAQ,EAAR,GAAA;QADA;CAAA,EAIQ,CAAI,CAAZ,CAAA;CAXF,IAIA;CAUA,GAAA,CAAS;CAAT,YAA8B;MAA9B;AAA0C,CAAD,YAAA;MAhBpB;CAAvB,EAAuB;CAAvB" | ||||
| } | ||||
		Loading…
	
		Reference in a new issue
	
	 Tom Tromey
						Tom Tromey