| OLD | NEW |
| 1 var initialize_BindingsTest = function() { | 1 var initialize_BindingsTest = function() { |
| 2 | 2 |
| 3 InspectorTest.preloadModule("sources"); | 3 InspectorTest.preloadModule("sources"); |
| 4 | 4 |
| 5 InspectorTest.dumpWorkspace = function(previousSnapshot) { | 5 InspectorTest.dumpWorkspace = function(previousSnapshot) { |
| 6 var uiSourceCodes = Workspace.workspace.uiSourceCodes().slice(); | 6 var uiSourceCodes = Workspace.workspace.uiSourceCodes().slice(); |
| 7 var urls = uiSourceCodes.map(code => code.url()); | 7 var urls = uiSourceCodes.map(code => code.url()); |
| 8 urls = urls.map(url => { | 8 urls = urls.map(url => { |
| 9 if (!url.startsWith('debugger://')) | 9 if (!url.startsWith('debugger://')) |
| 10 return url; | 10 return url; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| 144 InspectorTest.waitForSourceMap = function(sourceMapURLSuffix) { | 144 InspectorTest.waitForSourceMap = function(sourceMapURLSuffix) { |
| 145 var fulfill; | 145 var fulfill; |
| 146 var promise = new Promise(x => fulfill = x); | 146 var promise = new Promise(x => fulfill = x); |
| 147 sourceMapCallbacks.set(sourceMapURLSuffix, fulfill); | 147 sourceMapCallbacks.set(sourceMapURLSuffix, fulfill); |
| 148 return promise; | 148 return promise; |
| 149 } | 149 } |
| 150 | 150 |
| 151 var locationPool = new Bindings.LiveLocationPool(); |
| 152 var nameSymbol = Symbol('LiveLocationNameForTest'); |
| 153 var createdSymbol = Symbol('LiveLocationCreated'); |
| 154 |
| 155 InspectorTest.createDebuggerLiveLocation = function(name, urlSuffix, lineNumber,
columnNumber) { |
| 156 var script = InspectorTest.debuggerModel.scripts().find(script => script.sou
rceURL.endsWith(urlSuffix)); |
| 157 var rawLocation = InspectorTest.debuggerModel.createRawLocation(script, line
Number || 0, columnNumber || 0); |
| 158 return Bindings.debuggerWorkspaceBinding.createLiveLocation(rawLocation, upd
ateDelegate.bind(null, name), locationPool); |
| 159 } |
| 160 |
| 161 InspectorTest.createCSSLiveLocation = function(name, urlSuffix, lineNumber, colu
mnNumber) { |
| 162 var header = InspectorTest.cssModel.styleSheetHeaders().find(header => heade
r.resourceURL().endsWith(urlSuffix)); |
| 163 var rawLocation = new SDK.CSSLocation(header, lineNumber || 0, columnNumber
|| 0); |
| 164 return Bindings.cssWorkspaceBinding.createLiveLocation(rawLocation, updateDe
legate.bind(null, name), locationPool); |
| 165 } |
| 166 |
| 167 function updateDelegate(name, liveLocation) { |
| 168 liveLocation[nameSymbol] = name; |
| 169 var hint = liveLocation[createdSymbol] ? '[ UPDATE ]' : '[ CREATE ]'; |
| 170 liveLocation[createdSymbol] = true; |
| 171 InspectorTest.dumpLocation(liveLocation, hint); |
| 172 } |
| 173 |
| 174 InspectorTest.dumpLocation = function(liveLocation, hint) { |
| 175 hint = hint || '[ GET ]'; |
| 176 var prefix = `${hint} LiveLocation-${liveLocation[nameSymbol]}: `; |
| 177 var uiLocation = liveLocation.uiLocation(); |
| 178 if (!uiLocation) { |
| 179 InspectorTest.addResult(prefix + 'null'); |
| 180 return; |
| 181 } |
| 182 InspectorTest.addResult(prefix + uiLocation.uiSourceCode.url() + ':' + uiLoc
ation.lineNumber + ':' + uiLocation.columnNumber); |
| 183 } |
| 151 | 184 |
| 152 } | 185 } |
| 153 | 186 |
| OLD | NEW |