Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js

Issue 2889013002: DevTools: introduce uiSourceCode.mimeType() method (Closed)
Patch Set: nit Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 SDK.SourceMapManager.Events.SourceMapAttached, this._sourceMapAttached , this), 66 SDK.SourceMapManager.Events.SourceMapAttached, this._sourceMapAttached , this),
67 this._sourceMapManager.addEventListener( 67 this._sourceMapManager.addEventListener(
68 SDK.SourceMapManager.Events.SourceMapDetached, this._sourceMapDetached , this), 68 SDK.SourceMapManager.Events.SourceMapDetached, this._sourceMapDetached , this),
69 ]; 69 ];
70 } 70 }
71 71
72 /** 72 /**
73 * @param {!SDK.Script} script 73 * @param {!SDK.Script} script
74 */ 74 */
75 _addStubUISourceCode(script) { 75 _addStubUISourceCode(script) {
76 var stubUISourceCode = this._stubProject.addContentProvider( 76 var url = script.sourceURL + ':sourcemap';
77 script.sourceURL + ':sourcemap', 77 var contentProvider = Common.StaticContentProvider.fromString(
78 Common.StaticContentProvider.fromString( 78 url, Common.resourceTypes.Script,
dgozman 2017/05/19 18:55:52 script.sourceURL?
lushnikov 2017/05/19 19:00:51 reverted the change
79 script.sourceURL, Common.resourceTypes.Script, 79 '\n\n\n\n\n// Please wait a bit.\n// Compiled script is not shown while source map is being loaded!');
80 '\n\n\n\n\n// Please wait a bit.\n// Compiled script is not shown wh ile source map is being loaded!')); 80 var stubUISourceCode = this._stubProject.addContentProvider(url, contentProv ider, 'text/javascript');
81 this._stubUISourceCodes.set(script, stubUISourceCode); 81 this._stubUISourceCodes.set(script, stubUISourceCode);
82 } 82 }
83 83
84 /** 84 /**
85 * @param {!SDK.Script} script 85 * @param {!SDK.Script} script
86 */ 86 */
87 _removeStubUISourceCode(script) { 87 _removeStubUISourceCode(script) {
88 var uiSourceCode = this._stubUISourceCodes.get(script); 88 var uiSourceCode = this._stubUISourceCodes.get(script);
89 this._stubUISourceCodes.delete(script); 89 this._stubUISourceCodes.delete(script);
90 this._stubProject.removeFile(uiSourceCode.url()); 90 this._stubProject.removeFile(uiSourceCode.url());
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 script[Bindings.CompilerScriptMapping._frameIdSymbol] = frameId; 262 script[Bindings.CompilerScriptMapping._frameIdSymbol] = frameId;
263 var project = script.isContentScript() ? this._contentScriptsProject : this. _regularProject; 263 var project = script.isContentScript() ? this._contentScriptsProject : this. _regularProject;
264 for (var sourceURL of sourceMap.sourceURLs()) { 264 for (var sourceURL of sourceMap.sourceURLs()) {
265 var uiSourceCode = project.uiSourceCodeForURL(sourceURL); 265 var uiSourceCode = project.uiSourceCodeForURL(sourceURL);
266 if (uiSourceCode) { 266 if (uiSourceCode) {
267 Bindings.NetworkProject.addFrameAttribution(uiSourceCode, frameId); 267 Bindings.NetworkProject.addFrameAttribution(uiSourceCode, frameId);
268 continue; 268 continue;
269 } 269 }
270 270
271 var contentProvider = sourceMap.sourceContentProvider(sourceURL, Common.re sourceTypes.SourceMapScript); 271 var contentProvider = sourceMap.sourceContentProvider(sourceURL, Common.re sourceTypes.SourceMapScript);
272 var mimeType = Common.ResourceType.mimeFromURL(sourceURL) || contentProvid er.contentType().canonicalMimeType();
272 var embeddedContent = sourceMap.embeddedContentByURL(sourceURL); 273 var embeddedContent = sourceMap.embeddedContentByURL(sourceURL);
273 var metadata = 274 var metadata =
274 typeof embeddedContent === 'string' ? new Workspace.UISourceCodeMetada ta(null, embeddedContent.length) : null; 275 typeof embeddedContent === 'string' ? new Workspace.UISourceCodeMetada ta(null, embeddedContent.length) : null;
275 uiSourceCode = project.createUISourceCode(sourceURL, contentProvider.conte ntType()); 276 uiSourceCode = project.createUISourceCode(sourceURL, contentProvider.conte ntType());
276 uiSourceCode[Bindings.CompilerScriptMapping._sourceMapSymbol] = sourceMap; 277 uiSourceCode[Bindings.CompilerScriptMapping._sourceMapSymbol] = sourceMap;
277 Bindings.NetworkProject.setInitialFrameAttribution(uiSourceCode, frameId); 278 Bindings.NetworkProject.setInitialFrameAttribution(uiSourceCode, frameId);
278 project.addUISourceCodeWithProvider(uiSourceCode, contentProvider, metadat a); 279 project.addUISourceCodeWithProvider(uiSourceCode, contentProvider, metadat a, mimeType);
279 this._debuggerWorkspaceBinding.setSourceMapping(this._debuggerModel, uiSou rceCode, this); 280 this._debuggerWorkspaceBinding.setSourceMapping(this._debuggerModel, uiSou rceCode, this);
280 } 281 }
281 this._debuggerWorkspaceBinding.updateLocations(script); 282 this._debuggerWorkspaceBinding.updateLocations(script);
282 } 283 }
283 284
284 /** 285 /**
285 * @override 286 * @override
286 * @return {boolean} 287 * @return {boolean}
287 */ 288 */
288 isIdentity() { 289 isIdentity() {
(...skipping 16 matching lines...) Expand all
305 dispose() { 306 dispose() {
306 Common.EventTarget.removeEventListeners(this._eventListeners); 307 Common.EventTarget.removeEventListeners(this._eventListeners);
307 this._regularProject.dispose(); 308 this._regularProject.dispose();
308 this._contentScriptsProject.dispose(); 309 this._contentScriptsProject.dispose();
309 this._stubProject.dispose(); 310 this._stubProject.dispose();
310 } 311 }
311 }; 312 };
312 313
313 Bindings.CompilerScriptMapping._frameIdSymbol = Symbol('Bindings.CompilerScriptM apping._frameIdSymbol'); 314 Bindings.CompilerScriptMapping._frameIdSymbol = Symbol('Bindings.CompilerScriptM apping._frameIdSymbol');
314 Bindings.CompilerScriptMapping._sourceMapSymbol = Symbol('Bindings.CompilerScrip tMapping._sourceMapSymbol'); 315 Bindings.CompilerScriptMapping._sourceMapSymbol = Symbol('Bindings.CompilerScrip tMapping._sourceMapSymbol');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698