Diff
Modified: trunk/LayoutTests/ChangeLog (132345 => 132346)
--- trunk/LayoutTests/ChangeLog 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/LayoutTests/ChangeLog 2012-10-24 13:44:56 UTC (rev 132346)
@@ -1,3 +1,20 @@
+2012-10-24 Vsevolod Vlasov <vse...@chromium.org>
+
+ Web Inspector: UiSourceCode should rely on the workspace as a content provider.
+ https://bugs.webkit.org/show_bug.cgi?id=100216
+
+ Reviewed by Pavel Feldman.
+
+ * http/tests/inspector/compiler-script-mapping.html:
+ * inspector/debugger/breakpoint-manager.html:
+ * inspector/debugger/script-formatter-search.html:
+ * inspector/debugger/scripts-file-selector.html:
+ * inspector/debugger/scripts-panel.html:
+ * inspector/debugger/scripts-sorting.html:
+ * inspector/debugger/ui-source-code-display-name.html:
+ * inspector/debugger/ui-source-code.html:
+ * inspector/uisourcecode-revisions.html:
+
2012-10-24 Raphael Kubo da Costa <raphael.kubo.da.co...@intel.com>
[EFL] Hopefully finish rebaselining after r131941 and r131991.
Modified: trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html (132345 => 132346)
--- trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html 2012-10-24 13:44:56 UTC (rev 132346)
@@ -202,8 +202,7 @@
function testInlinedSourceMap(next)
{
WebInspector.debuggerModel._reset();
- var workspace = new WebInspector.Workspace();
- var mapping = new WebInspector.CompilerScriptMapping(workspace);
+ var mapping = createCompilerScriptMapping();
var script = InspectorTest.createScriptMock("http://example.com/compiled.js", 0, 0, true, "");
var sourceMap = {
"file":"compiled.js",
@@ -212,9 +211,18 @@
"sourcesContent":["<source content>"]
};
script.sourceMapURL = "data:application/json;base64," + btoa(JSON.stringify(sourceMap));
+ InspectorTest.waitForWorkspaceTemporaryUISourceCodeAddedEvent(originalUISourceCodeAdded);
+
+ function originalUISourceCodeAdded(uiSourceCode)
+ {
+ InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(compiledUISourceCodeAdded);
+ }
+
+ function compiledUISourceCodeAdded(uiSourceCode) { }
+
mapping.addScript(script);
- var uiSourceCode = workspace.uiSourceCodeForURL("source.js");
+ var uiSourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL("source.js");
InspectorTest.checkUILocation(uiSourceCode, 2, 4, mapping.rawLocationToUILocation(WebInspector.debuggerModel.createRawLocation(script, 0, 18)));
InspectorTest.checkRawLocation(script, 0, 18, mapping.uiLocationToRawLocation(uiSourceCode, 2, 4));
Modified: trunk/LayoutTests/inspector/debugger/breakpoint-manager.html (132345 => 132346)
--- trunk/LayoutTests/inspector/debugger/breakpoint-manager.html 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/LayoutTests/inspector/debugger/breakpoint-manager.html 2012-10-24 13:44:56 UTC (rev 132346)
@@ -112,8 +112,7 @@
WorkspaceMock.prototype = {
_addUISourceCode: function(url)
{
- var mockContentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, "");
- var uiSourceCode = new WebInspector.UISourceCode(url, mockContentProvider, false);
+ var uiSourceCode = new WebInspector.UISourceCode(this, url, WebInspector.resourceTypes.Script, false);
uiSourceCode.setSourceMapping(defaultMapping);
uiSourceCodes[url] = uiSourceCode;
this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode);
@@ -122,9 +121,8 @@
_addTemporaryUISourceCode: function(url)
{
- var mockContentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, "");
- var uiSourceCode = new WebInspector.UISourceCode(url, mockContentProvider, false);
- uiSourceCode.qq = 345;
+ var uiSourceCode = new WebInspector.UISourceCode(this, url, WebInspector.resourceTypes.Script, false);
+ uiSourceCode.isTemporary = true;
uiSourceCode.setSourceMapping(defaultMapping);
uiSourceCodes[url] = uiSourceCode;
temporaryUISourceCodes[url] = uiSourceCode;
Modified: trunk/LayoutTests/inspector/debugger/script-formatter-search.html (132345 => 132346)
--- trunk/LayoutTests/inspector/debugger/script-formatter-search.html 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/LayoutTests/inspector/debugger/script-formatter-search.html 2012-10-24 13:44:56 UTC (rev 132346)
@@ -21,7 +21,7 @@
function didShowScriptSource(frame)
{
scriptSource = frame._uiSourceCode;
- InspectorTest.addSniffer(scriptSource._contentProvider, "requestContent", requestContentSniffer);
+ InspectorTest.addSniffer(scriptSource._workspace, "requestFileContent", requestContentSniffer);
scriptSource.searchInContent("margic-string", true, false, dump1);
}
Modified: trunk/LayoutTests/inspector/debugger/scripts-file-selector.html (132345 => 132346)
--- trunk/LayoutTests/inspector/debugger/scripts-file-selector.html 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/LayoutTests/inspector/debugger/scripts-file-selector.html 2012-10-24 13:44:56 UTC (rev 132346)
@@ -12,16 +12,9 @@
WebInspector.showPanel("scripts");
var navigatorFileSelector = new WebInspector.ScriptsNavigator();
- var contentProvider = {
- contentType: function()
- {
- return WebInspector.resourceTypes.Script;
- }
- }
-
function addUISourceCode(url, isContentScript)
{
- var uiSourceCode = new WebInspector.UISourceCode(url, contentProvider, null);
+ var uiSourceCode = new WebInspector.UISourceCode(WebInspector.workspace, url, WebInspector.resourceTypes.Script, null);
uiSourceCode.isContentScript = isContentScript;
navigatorFileSelector.addUISourceCode(uiSourceCode);
}
Modified: trunk/LayoutTests/inspector/debugger/scripts-panel.html (132345 => 132346)
--- trunk/LayoutTests/inspector/debugger/scripts-panel.html 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel.html 2012-10-24 13:44:56 UTC (rev 132346)
@@ -16,17 +16,15 @@
};
var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, "", "text/_javascript_");
- InspectorTest.addSniffer(WebInspector.UISourceCode.prototype, "requestContent", requestContentSniffer, true)
-
- function requestContentSniffer(callback)
- {
- InspectorTest.addResult("Source requested for " + this.url);
- callback("");
- }
function createMockWorkspace()
{
var workspace = new WebInspector.Workspace();
+ workspace.requestFileContent = function(uiSourceCode, callback)
+ {
+ InspectorTest.addResult("Source requested for " + uiSourceCode.url);
+ callback("");
+ };
return workspace;
}
@@ -34,7 +32,7 @@
function testInitialLoad(next)
{
var workspace = createMockWorkspace();
-
+
workspace.project().addUISourceCode("foobar.js", contentProvider, false);
var panel = new WebInspector.ScriptsPanel(workspace);
@@ -43,7 +41,6 @@
workspace.project().addUISourceCode("foo.js", contentProvider, false);
workspace.project().addUISourceCode("bar.js", contentProvider, false);
workspace.project().addUISourceCode("baz.js", contentProvider, false);
-
InspectorTest.dumpScriptsNavigator(panel._navigator);
Modified: trunk/LayoutTests/inspector/debugger/scripts-sorting.html (132345 => 132346)
--- trunk/LayoutTests/inspector/debugger/scripts-sorting.html 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/LayoutTests/inspector/debugger/scripts-sorting.html 2012-10-24 13:44:56 UTC (rev 132346)
@@ -12,16 +12,9 @@
var navigatorFileSelector = new WebInspector.ScriptsNavigator();
- var contentProvider = {
- contentType: function()
- {
- return WebInspector.resourceTypes.Script;
- }
- }
-
function addUISourceCode(url, isContentScript)
{
- var uiSourceCode = new WebInspector.UISourceCode(url, contentProvider, null);
+ var uiSourceCode = new WebInspector.UISourceCode(WebInspector.workspace, url, WebInspector.resourceTypes.Script, null);
uiSourceCode.isContentScript = isContentScript;
navigatorFileSelector.addUISourceCode(uiSourceCode);
}
Modified: trunk/LayoutTests/inspector/debugger/ui-source-code-display-name.html (132345 => 132346)
--- trunk/LayoutTests/inspector/debugger/ui-source-code-display-name.html 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/LayoutTests/inspector/debugger/ui-source-code-display-name.html 2012-10-24 13:44:56 UTC (rev 132346)
@@ -7,7 +7,7 @@
WebInspector.showPanel("scripts");
function dumpUISourceCodeDisplayName(url)
{
- var uiSourceCode = new WebInspector.UISourceCode(url, null);
+ var uiSourceCode = new WebInspector.UISourceCode(WebInspector.workspace, url, null);
InspectorTest.addResult("UISourceCode display name for url \"" + url + "\" is \"" + WebInspector.TabbedEditorContainer.prototype._titleForFile(uiSourceCode) + "\".");
}
Modified: trunk/LayoutTests/inspector/debugger/ui-source-code.html (132345 => 132346)
--- trunk/LayoutTests/inspector/debugger/ui-source-code.html 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/LayoutTests/inspector/debugger/ui-source-code.html 2012-10-24 13:44:56 UTC (rev 132346)
@@ -6,18 +6,15 @@
function test()
{
- var contentProvider = {
- requestContent: function(callback)
- {
- InspectorTest.addResult("Content is requested from SourceCodeProvider.");
- setTimeout(callback.bind(null, "var x = 0;", false, "text/_javascript_"), 0);
- }
- };
-
InspectorTest.runTestSuite([
function testUISourceCode(next)
{
- var uiSourceCode = new WebInspector.UISourceCode("url", contentProvider);
+ var uiSourceCode = new WebInspector.UISourceCode(WebInspector.workspace, "url", WebInspector.resourceTypes.Script, true);
+ WebInspector.workspace.requestFileContent = function(path, callback)
+ {
+ InspectorTest.addResult("Content is requested from SourceCodeProvider.");
+ setTimeout(callback.bind(null, "var x = 0;", false, "text/_javascript_"), 0);
+ }
function didRequestContent(callNumber, content, contentEncoded, mimeType)
{
InspectorTest.addResult("Callback " + callNumber + " is invoked.");
Modified: trunk/LayoutTests/inspector/uisourcecode-revisions.html (132345 => 132346)
--- trunk/LayoutTests/inspector/uisourcecode-revisions.html 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/LayoutTests/inspector/uisourcecode-revisions.html 2012-10-24 13:44:56 UTC (rev 132346)
@@ -4,15 +4,18 @@
<script>
function test()
{
- setTimeout(InspectorTest.completeTest.bind(InspectorTest), 3000);
WebInspector.showPanel("scripts");
- function createMockContentProvider()
+ function createMockWorkspace()
{
- var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, "<script content>", "text/_javascript_");
- return contentProvider;
+ var workspace = new WebInspector.Workspace();
+ workspace.requestFileContent = function(path, callback)
+ {
+ callback("<script content>", false, "text/_javascript_");
+ }
+ return workspace;
}
-
+
function dumpUISourceCodeWithRevisions(uiSourceCode)
{
var content = uiSourceCode._content;
@@ -30,7 +33,7 @@
InspectorTest.runTestSuite([
function testAddRevisionsRevertToOriginal(next)
{
- var uiSourceCode = new WebInspector.UISourceCode("url", createMockContentProvider());
+ var uiSourceCode = new WebInspector.UISourceCode(createMockWorkspace(), "url", WebInspector.resourceTypes.Script);
uiSourceCode.setWorkingCopy("content1");
uiSourceCode.setWorkingCopy("content2");
uiSourceCode.commitWorkingCopy(function() { });
@@ -51,7 +54,7 @@
function testAddRevisionsRevertAndClearHistory(next)
{
- var uiSourceCode = new WebInspector.UISourceCode("url2", createMockContentProvider());
+ var uiSourceCode = new WebInspector.UISourceCode(createMockWorkspace(), "url2", WebInspector.resourceTypes.Script);
uiSourceCode.setWorkingCopy("content1");
uiSourceCode.setWorkingCopy("content2");
@@ -77,7 +80,7 @@
function testAddRevisionsRevertToPrevious(next)
{
- var uiSourceCode = new WebInspector.UISourceCode("url3", createMockContentProvider());
+ var uiSourceCode = new WebInspector.UISourceCode(createMockWorkspace(), "url3", WebInspector.resourceTypes.Script);
uiSourceCode.setWorkingCopy("content1");
uiSourceCode.setWorkingCopy("content2");
@@ -99,7 +102,7 @@
function testRequestContentAddRevisionsRevertToOriginal(next)
{
- var uiSourceCode = new WebInspector.UISourceCode("url4", createMockContentProvider());
+ var uiSourceCode = new WebInspector.UISourceCode(createMockWorkspace(), "url4", WebInspector.resourceTypes.Script);
uiSourceCode.requestContent(contentReceived);
function contentReceived()
@@ -127,7 +130,7 @@
function testRequestContentAddRevisionsRevertAndClearHistory(next)
{
- var uiSourceCode = new WebInspector.UISourceCode("url5", createMockContentProvider());
+ var uiSourceCode = new WebInspector.UISourceCode(createMockWorkspace(), "url5", WebInspector.resourceTypes.Script);
uiSourceCode.requestContent(contentReceived);
function contentReceived()
@@ -159,7 +162,7 @@
function testRequestContentAddRevisionsRevertToPrevious(next)
{
- var uiSourceCode = new WebInspector.UISourceCode("url6", createMockContentProvider());
+ var uiSourceCode = new WebInspector.UISourceCode(createMockWorkspace(), "url6", WebInspector.resourceTypes.Script);
uiSourceCode.requestContent(contentReceived);
function contentReceived()
Modified: trunk/Source/WebCore/ChangeLog (132345 => 132346)
--- trunk/Source/WebCore/ChangeLog 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/Source/WebCore/ChangeLog 2012-10-24 13:44:56 UTC (rev 132346)
@@ -1,3 +1,36 @@
+2012-10-24 Vsevolod Vlasov <vse...@chromium.org>
+
+ Web Inspector: UiSourceCode should rely on the workspace as a content provider.
+ https://bugs.webkit.org/show_bug.cgi?id=100216
+
+ Reviewed by Pavel Feldman.
+
+ Workspace is now passed to UISourceCode to be used as a content provider.
+ Content providers are now stored in the workspace/project.
+ Next step would be to move content providers to workspace providers.
+
+ * inspector/front-end/BreakpointManager.js:
+ (WebInspector.BreakpointManager.breakpointStorageId):
+ * inspector/front-end/UISourceCode.js:
+ (WebInspector.UISourceCode):
+ (WebInspector.UISourceCode.prototype.contentType):
+ (WebInspector.UISourceCode.prototype.requestContent):
+ (WebInspector.UISourceCode.prototype.requestOriginalContent):
+ (WebInspector.UISourceCode.prototype._commitContent):
+ (WebInspector.UISourceCode.prototype.searchInContent):
+ * inspector/front-end/Workspace.js:
+ (WebInspector.WorkspaceController.prototype._mainFrameNavigated):
+ (WebInspector.Project):
+ (WebInspector.Project.prototype.addUISourceCode):
+ (WebInspector.Project.prototype.removeUISourceCode):
+ (WebInspector.Project.prototype.uiSourceCodes):
+ (WebInspector.Project.prototype.requestFileContent):
+ (WebInspector.Project.prototype.searchInFileContent):
+ (WebInspector.Workspace):
+ (WebInspector.Workspace.prototype.addTemporaryUISourceCode):
+ (WebInspector.Workspace.prototype.removeTemporaryUISourceCode):
+ (WebInspector.Workspace.prototype.reset):
+
2012-10-24 Zeno Albisser <z...@webkit.org>
Implement GraphicsSurface for Windows.
Modified: trunk/Source/WebCore/inspector/front-end/BreakpointManager.js (132345 => 132346)
--- trunk/Source/WebCore/inspector/front-end/BreakpointManager.js 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/Source/WebCore/inspector/front-end/BreakpointManager.js 2012-10-24 13:44:56 UTC (rev 132346)
@@ -60,8 +60,6 @@
WebInspector.BreakpointManager.breakpointStorageId = function(uiSourceCode)
{
- if (uiSourceCode.isTemporary)
- return "";
return uiSourceCode.formatted() ? "deobfuscated:" + uiSourceCode.url : uiSourceCode.url;
}
Modified: trunk/Source/WebCore/inspector/front-end/UISourceCode.js (132345 => 132346)
--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js 2012-10-24 13:44:56 UTC (rev 132346)
@@ -33,17 +33,18 @@
* @constructor
* @extends {WebInspector.Object}
* @implements {WebInspector.ContentProvider}
+ * @param {WebInspector.Workspace} workspace
* @param {string} url
- * @param {WebInspector.ContentProvider} contentProvider
+ * @param {WebInspector.ResourceType} contentType
* @param {boolean} isEditable
*/
-WebInspector.UISourceCode = function(url, contentProvider, isEditable)
+WebInspector.UISourceCode = function(workspace, url, contentType, isEditable)
{
+ this._workspace = workspace;
this._url = url;
this._parsedURL = new WebInspector.ParsedURL(url);
- this._contentProvider = contentProvider;
+ this._contentType = contentType;
this._isEditable = isEditable;
- this.isContentScript = false;
/**
* @type Array.<function(?string,boolean,string)>
*/
@@ -116,7 +117,7 @@
*/
contentType: function()
{
- return this._contentProvider.contentType();
+ return this._contentType;
},
/**
@@ -162,7 +163,7 @@
}
this._requestContentCallbacks.push(callback);
if (this._requestContentCallbacks.length === 1)
- this._contentProvider.requestContent(this._fireContentAvailable.bind(this));
+ this._workspace.requestFileContent(this, this._fireContentAvailable.bind(this));
},
/**
@@ -170,7 +171,7 @@
*/
requestOriginalContent: function(callback)
{
- this._contentProvider.requestContent(callback);
+ this._workspace.requestFileContent(this, callback);
},
/**
@@ -191,7 +192,7 @@
var oldWorkingCopy = this._workingCopy;
delete this._workingCopy;
this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted, {oldWorkingCopy: oldWorkingCopy, workingCopy: this.workingCopy()});
- WebInspector.workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted, { uiSourceCode: this, content: this._content });
+ this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted, { uiSourceCode: this, content: this._content });
if (this._url && WebInspector.fileManager.isURLSaved(this._url)) {
WebInspector.fileManager.save(this._url, this._content, false);
WebInspector.fileManager.close(this._url);
@@ -371,8 +372,13 @@
searchInContent: function(query, caseSensitive, isRegex, callback)
{
var content = this.content();
- var provider = content ? new WebInspector.StaticContentProvider(this._contentProvider.contentType(), content) : this._contentProvider;
- provider.searchInContent(query, caseSensitive, isRegex, callback);
+ if (content) {
+ var provider = new WebInspector.StaticContentProvider(this.contentType(), content);
+ provider.searchInContent(query, caseSensitive, isRegex, callback);
+ return;
+ }
+
+ this._workspace.searchInFileContent(this, query, caseSensitive, isRegex, callback);
},
/**
Modified: trunk/Source/WebCore/inspector/front-end/Workspace.js (132345 => 132346)
--- trunk/Source/WebCore/inspector/front-end/Workspace.js 2012-10-24 13:41:28 UTC (rev 132345)
+++ trunk/Source/WebCore/inspector/front-end/Workspace.js 2012-10-24 13:44:56 UTC (rev 132346)
@@ -44,6 +44,7 @@
WebInspector.Revision.filterOutStaleRevisions();
this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectWillReset, this._workspace.project());
this._workspace.project().reset();
+ this._workspace.reset();
this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectDidReset, this._workspace.project());
},
@@ -68,6 +69,8 @@
{
this._uiSourceCodes = [];
this._workspace = workspace;
+ /** @type {Object.<string, WebInspector.ContentProvider>} */
+ this._contentProviders = {};
}
WebInspector.Project.prototype = {
@@ -90,10 +93,11 @@
// FIXME: Implement
return;
}
- uiSourceCode = new WebInspector.UISourceCode(url, contentProvider, isEditable);
+ uiSourceCode = new WebInspector.UISourceCode(this._workspace, url, contentProvider.contentType(), isEditable);
uiSourceCode.isContentScript = isContentScript;
uiSourceCode.isSnippet = isSnippet;
this._uiSourceCodes.push(uiSourceCode);
+ this._contentProviders[url] = contentProvider;
this._workspace.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode);
},
@@ -105,6 +109,7 @@
var uiSourceCode = this.uiSourceCodeForURL(url);
if (!uiSourceCode)
return;
+ delete this._contentProviders[url];
this._uiSourceCodes.splice(this._uiSourceCodes.indexOf(uiSourceCode), 1);
this._workspace.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, uiSourceCode);
},
@@ -128,6 +133,26 @@
uiSourceCodes: function()
{
return this._uiSourceCodes;
+ },
+
+ /**
+ * @param {string} path
+ * @param {function(?string,boolean,string)} callback
+ */
+ requestFileContent: function(path, callback)
+ {
+ this._contentProviders[path].requestContent(callback);
+ },
+
+ /**
+ * @param {string} query
+ * @param {boolean} caseSensitive
+ * @param {boolean} isRegex
+ * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback
+ */
+ searchInFileContent: function(path, query, caseSensitive, isRegex, callback)
+ {
+ this._contentProviders[path].searchInContent(query, caseSensitive, isRegex, callback);
}
}
@@ -139,6 +164,8 @@
WebInspector.Workspace = function()
{
this._project = new WebInspector.Project(this);
+ /** @type {Object.<string, WebInspector.ContentProvider>} */
+ this._temporaryContentProviders = new Map();
}
WebInspector.Workspace.Events = {
@@ -175,20 +202,21 @@
},
/**
- * @param {string} url
+ * @param {string} path
* @param {WebInspector.ContentProvider} contentProvider
* @param {boolean} isEditable
* @param {boolean=} isContentScript
* @param {boolean=} isSnippet
*/
- addTemporaryUISourceCode: function(url, contentProvider, isEditable, isContentScript, isSnippet)
+ addTemporaryUISourceCode: function(path, contentProvider, isEditable, isContentScript, isSnippet)
{
- var uiSourceCode = new WebInspector.UISourceCode(url, contentProvider, isEditable);
+ var uiSourceCode = new WebInspector.UISourceCode(this, path, contentProvider.contentType(), isEditable);
+ this._temporaryContentProviders.put(uiSourceCode, contentProvider);
uiSourceCode.isContentScript = isContentScript;
uiSourceCode.isSnippet = isSnippet;
uiSourceCode.isTemporary = true;
this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeAdded, uiSourceCode);
- return uiSourceCode;
+ return uiSourceCode;
},
/**
@@ -196,9 +224,44 @@
*/
removeTemporaryUISourceCode: function(uiSourceCode)
{
+ this._temporaryContentProviders.remove(uiSourceCode.url);
this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeRemoved, uiSourceCode);
},
+ /**
+ * @param {WebInspector.UISourceCode} uiSourceCode
+ * @param {function(?string,boolean,string)} callback
+ */
+ requestFileContent: function(uiSourceCode, callback)
+ {
+ if (this._temporaryContentProviders.get(uiSourceCode)) {
+ this._temporaryContentProviders.get(uiSourceCode).requestContent(callback);
+ return;
+ }
+ this._project.requestFileContent(uiSourceCode.url, callback);
+ },
+
+ /**
+ * @param {WebInspector.UISourceCode} uiSourceCode
+ * @param {string} query
+ * @param {boolean} caseSensitive
+ * @param {boolean} isRegex
+ * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback
+ */
+ searchInFileContent: function(uiSourceCode, query, caseSensitive, isRegex, callback)
+ {
+ if (this._temporaryContentProviders.get(uiSourceCode)) {
+ this._temporaryContentProviders.get(uiSourceCode).searchInContent(query, caseSensitive, isRegex, callback);
+ return;
+ }
+ this._project.searchInFileContent(uiSourceCode.url, query, caseSensitive, isRegex, callback);
+ },
+
+ reset: function()
+ {
+ this._temporaryContentProviders = new Map();
+ },
+
__proto__: WebInspector.Object.prototype
}