From 67600e095bc78818d4682d56a14543918063e05a Mon Sep 17 00:00:00 2001 From: "vsevik@chromium.org" Date: Tue, 3 Jul 2012 17:51:27 +0000 Subject: [PATCH] Web Inspector: [Extensions API] Resource manipulations should be based on UISourceCode thus extending Sources Panel. https://bugs.webkit.org/show_bug.cgi?id=89868 Reviewed by Pavel Feldman. Source/WebCore: Extensions API is now based on both ScriptsPanel acting as a UISourceCodeProvider and ResourceTreeModel. Extensions API resource could be for any content provider now. Extensions API resource.setContent implementation is now based on UISourceCode editing methods. Drive-by StyleSource insremental editing timeout fix. * inspector/front-end/ExtensionServer.js: (WebInspector.ExtensionServer.prototype._handleOpenURL): (WebInspector.ExtensionServer.prototype._makeResource): (WebInspector.ExtensionServer.prototype._onGetPageResources): (WebInspector.ExtensionServer.prototype._getResourceContent): (WebInspector.ExtensionServer.prototype._onGetResourceContent): (WebInspector.ExtensionServer.prototype._onSetResourceContent): (WebInspector.ExtensionServer.prototype._notifyResourceAdded): (WebInspector.ExtensionServer.prototype._notifyResourceContentCommitted): * inspector/front-end/JavaScriptSource.js: * inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype.uiSourceCodes): (WebInspector.ScriptsPanel.prototype.uiSourceCodeForURL): (WebInspector.ScriptsPanel.prototype._addUISourceCode): (WebInspector.ScriptsPanel.prototype._reset): (WebInspector.ScriptsPanel.prototype.canShowAnchorLocation): * inspector/front-end/StylesPanel.js: (WebInspector.StyleSource.prototype.workingCopyCommitted): (WebInspector.StyleSource.prototype.workingCopyChanged): (WebInspector.StyleSource.prototype._callOrSetTimeout): (WebInspector.StyleSource.prototype._commitIncrementalEdit): (WebInspector.StyleSource.prototype._clearIncrementalUpdateTimer): * inspector/front-end/UISourceCode.js: (WebInspector.UISourceCode.prototype.requestContent): (WebInspector.UISourceCode.prototype.workingCopy): (WebInspector.UISourceCode.prototype.setWorkingCopy): (WebInspector.UISourceCode.prototype.isDirty): LayoutTests: * http/tests/inspector/extensions-test.js: (initialize_ExtensionsTest): (initialize_ExtensionsTest.completeTest): (initialize_ExtensionsTest.InspectorTest.runExtensionTests): * http/tests/inspector/resources/extension-main.js: * inspector/extensions/extensions-resources.html: * inspector/styles/styles-history.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121792 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 15 ++++ .../extensions/extensions-resources-expected.txt | 2 +- .../inspector/extensions/extensions-resources.html | 83 +++++++++++++++++----- LayoutTests/inspector/styles/styles-history.html | 26 +++---- Source/WebCore/ChangeLog | 40 +++++++++++ .../WebCore/inspector/front-end/ExtensionServer.js | 74 ++++++++++++------- .../inspector/front-end/JavaScriptSource.js | 1 + Source/WebCore/inspector/front-end/StylesPanel.js | 49 +++++++++---- Source/WebCore/inspector/front-end/UISourceCode.js | 6 +- Source/WebCore/inspector/front-end/Workspace.js | 15 ++++ 10 files changed, 234 insertions(+), 77 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index b8fdd12..4dc7f69 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,18 @@ +2012-06-27 Vsevolod Vlasov + + Web Inspector: [Extensions API] Resource manipulations should be based on UISourceCode thus extending Sources Panel. + https://bugs.webkit.org/show_bug.cgi?id=89868 + + Reviewed by Pavel Feldman. + + * http/tests/inspector/extensions-test.js: + (initialize_ExtensionsTest): + (initialize_ExtensionsTest.completeTest): + (initialize_ExtensionsTest.InspectorTest.runExtensionTests): + * http/tests/inspector/resources/extension-main.js: + * inspector/extensions/extensions-resources.html: + * inspector/styles/styles-history.html: + 2012-07-03 Robert Hogan CSS 2.1 failure: floats-wrap-top-below-inline-* fail diff --git a/LayoutTests/inspector/extensions/extensions-resources-expected.txt b/LayoutTests/inspector/extensions/extensions-resources-expected.txt index df3d5c2..2e35ab9 100644 --- a/LayoutTests/inspector/extensions/extensions-resources-expected.txt +++ b/LayoutTests/inspector/extensions/extensions-resources-expected.txt @@ -56,7 +56,7 @@ RUNNING TEST: extension_testGetResourceContent 1 : "" } RUNNING TEST: extension_testOnContentCommitted -log: Extension server error: Operation failed: Resource is not editable +log: Extension server error: Object does not support requested operation: Resource is not editable content committed for resource .../audits-style1.css (type: stylesheet), new content: div.test { width: 220px; height: 42px; } Revision content: div.test { width: 220px; height: 42px; } RUNNING TEST: extension_testOnResourceAdded diff --git a/LayoutTests/inspector/extensions/extensions-resources.html b/LayoutTests/inspector/extensions/extensions-resources.html index b89294c..e34f937 100644 --- a/LayoutTests/inspector/extensions/extensions-resources.html +++ b/LayoutTests/inspector/extensions/extensions-resources.html @@ -30,10 +30,22 @@ function extension_testGetAllResources(nextTest) { function callback(resources) { + function filter(resource) + { + // For some reason scripts from tests previously run in the same test shell sometimes appear, so we need to filter them out. + const resourceURLsWhiteList = ["abe.png", "audits-style1.css", "extensions-resources.html", "extensions-test.js", "inspector-test.js", "test-script.js"]; + for (var i = 0; i < resourceURLsWhiteList.length; ++i) { + if (resource.url.indexOf(resourceURLsWhiteList[i]) !== -1) + return true; + } + return false; + } + function compareResources(a, b) { return trimURL(a.url).localeCompare(trimURL(b.url)); } + resources = resources.filter(filter); resources.sort(compareResources); output("page resources:"); dumpObject(Array.prototype.slice.call(arguments), { url: "url" }); @@ -67,23 +79,64 @@ function extension_testGetResourceContent(nextTest) }); } +// Extensions tests override WebInspector.StyleSource.updateTimeout because otherwise extensions don't have any control over applying changes to domain specific bindings. +function extension_setFakeStyleSheetUpdateTimeout(callback) +{ + evaluateOnFrontend("WebInspector.oldStyleSheetUpdateTimeout = WebInspector.StyleSource.updateTimeout; WebInspector.StyleSource.updateTimeout = -1; reply();", callback); +} + +function extension_resetStyleSheetUpdateTimeout(callback) +{ + evaluateOnFrontend("WebInspector.StyleSource.updateTimeout = WebInspector.oldStyleSheetUpdateTimeout; delete WebInspector.oldStyleSheetUpdateTimeout; reply();", callback); +} + function extension_testSetResourceContent(nextTest) { - function callback() + extension_setFakeStyleSheetUpdateTimeout(step2); + + function step2() + { + extension_runWithResource(/audits-style1\.css$/, function(resource) { + resource.setContent("div.test { width: 126px; height: 42px; }", false, step3); + }); + } + + function step3() { webInspector.inspectedWindow.eval("document.getElementById('test-div').clientWidth", function(result) { output("div.test width after stylesheet edited (should be 126): " + result); - nextTest(); + step4(); }); } - extension_runWithResource(/audits-style1\.css$/, function(resource) { - resource.setContent("div.test { width: 126px; height: 42px; }", false, callback); - }); + + function step4() + { + extension_resetStyleSheetUpdateTimeout(nextTest); + } } function extension_testOnContentCommitted(nextTest) { var expected_content = "div.test { width: 220px; height: 42px; }"; + extension_setFakeStyleSheetUpdateTimeout(step2); + + function step2() + { + + webInspector.inspectedWindow.onResourceContentCommitted.addListener(onContentCommitted); + extension_runWithResource(/audits-style1\.css$/, function(resource) { + resource.setContent("div.test { width: 140px; height: 42px; }", false); + }); + // The next step is going to produce a console message that will be logged, so synchronize the output now. + evaluateOnFrontend("InspectorTest.runAfterPendingDispatches(reply)", function() { + extension_runWithResource(/abe\.png$/, function(resource) { + resource.setContent("", true); + }); + extension_runWithResource(/audits-style1\.css$/, function(resource) { + resource.setContent(expected_content, true); + }); + }); + } function onContentCommitted(resource, content) { @@ -93,22 +146,14 @@ function extension_testOnContentCommitted(nextTest) webInspector.inspectedWindow.onResourceContentCommitted.removeListener(onContentCommitted); resource.getContent(function(content) { output("Revision content: " + content); - nextTest(); + step3(); }); } - webInspector.inspectedWindow.onResourceContentCommitted.addListener(onContentCommitted); - extension_runWithResource(/audits-style1\.css$/, function(resource) { - resource.setContent("div.test { width: 140px; height: 42px; }", false); - }); - // The next step is going to produce a console message that will be logged, so synchronize the output now. - evaluateOnFrontend("InspectorTest.runAfterPendingDispatches(reply)", function() { - extension_runWithResource(/abe\.png$/, function(resource) { - resource.setContent("", true); - }); - extension_runWithResource(/audits-style1\.css$/, function(resource) { - resource.setContent(expected_content, true); - }); - }); + + function step3() + { + extension_resetStyleSheetUpdateTimeout(nextTest); + } } function extension_testOnResourceAdded(nextTest) diff --git a/LayoutTests/inspector/styles/styles-history.html b/LayoutTests/inspector/styles/styles-history.html index 59dc5e3..9f939bc 100644 --- a/LayoutTests/inspector/styles/styles-history.html +++ b/LayoutTests/inspector/styles/styles-history.html @@ -10,35 +10,35 @@ function test() { - var pendingCallbacks = []; InspectorTest.runAfterCachedResourcesProcessed(runTestSuite); - var styleResource; - var styleSheetId; + var styleSource; function runTestSuite() { InspectorTest.runTestSuite([ function testSetUp(next) { - function visitResource(resource) + function visitUISourceCodes(uiSourceCode) { - if (resource.url.indexOf("styles-history.css") === -1) + if (uiSourceCode.url.indexOf("styles-history.css") === -1) return; - styleResource = resource; + styleSource = uiSourceCode; next(); } - WebInspector.resourceTreeModel.forAllResources(visitResource); + WebInspector.workspace.uiSourceCodes().forEach(visitUISourceCodes); }, function testSetResourceContentMinor(next) { - styleResource.setContent("body {\n margin: 15px;\n padding: 10px;\n}", false, dumpHistory(next)); + styleSource.setWorkingCopy("body {\n margin: 15px;\n padding: 10px;\n}"); + dumpHistory(next)(); }, function testSetResourceContentMajor(next) { - styleResource.setContent("body {\n margin: 20px;\n padding: 10px;\n}", true, dumpHistory(next)); + styleSource.setWorkingCopy("body {\n margin: 20px;\n padding: 10px;\n}"); + styleSource.commitWorkingCopy(dumpHistory(next)); }, function testSetContentViaModelMinor(next) @@ -71,7 +71,7 @@ function test() function styleSheetForResource(callback) { CSSAgent.getAllStyleSheets(didGetAllStyleSheets.bind(this)); - + function didGetAllStyleSheets(error, infos) { if (error) { @@ -95,10 +95,10 @@ function test() { function result() { - InspectorTest.addResult("History length: " + styleResource.history.length); - for (var i = 0; i < styleResource.history.length; ++i) { + InspectorTest.addResult("History length: " + styleSource.resource().history.length); + for (var i = 0; i < styleSource.resource().history.length; ++i) { InspectorTest.addResult("Item " + i + ":"); - InspectorTest.addResult(styleResource.history[i].content); + InspectorTest.addResult(styleSource.resource().history[i].content); } next(); } diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index bafe3ce..6fa72a5 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,43 @@ +2012-06-27 Vsevolod Vlasov + + Web Inspector: [Extensions API] Resource manipulations should be based on UISourceCode thus extending Sources Panel. + https://bugs.webkit.org/show_bug.cgi?id=89868 + + Reviewed by Pavel Feldman. + + Extensions API is now based on both ScriptsPanel acting as a UISourceCodeProvider and ResourceTreeModel. + Extensions API resource could be for any content provider now. + Extensions API resource.setContent implementation is now based on UISourceCode editing methods. + Drive-by StyleSource insremental editing timeout fix. + + * inspector/front-end/ExtensionServer.js: + (WebInspector.ExtensionServer.prototype._handleOpenURL): + (WebInspector.ExtensionServer.prototype._makeResource): + (WebInspector.ExtensionServer.prototype._onGetPageResources): + (WebInspector.ExtensionServer.prototype._getResourceContent): + (WebInspector.ExtensionServer.prototype._onGetResourceContent): + (WebInspector.ExtensionServer.prototype._onSetResourceContent): + (WebInspector.ExtensionServer.prototype._notifyResourceAdded): + (WebInspector.ExtensionServer.prototype._notifyResourceContentCommitted): + * inspector/front-end/JavaScriptSource.js: + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.uiSourceCodes): + (WebInspector.ScriptsPanel.prototype.uiSourceCodeForURL): + (WebInspector.ScriptsPanel.prototype._addUISourceCode): + (WebInspector.ScriptsPanel.prototype._reset): + (WebInspector.ScriptsPanel.prototype.canShowAnchorLocation): + * inspector/front-end/StylesPanel.js: + (WebInspector.StyleSource.prototype.workingCopyCommitted): + (WebInspector.StyleSource.prototype.workingCopyChanged): + (WebInspector.StyleSource.prototype._callOrSetTimeout): + (WebInspector.StyleSource.prototype._commitIncrementalEdit): + (WebInspector.StyleSource.prototype._clearIncrementalUpdateTimer): + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode.prototype.requestContent): + (WebInspector.UISourceCode.prototype.workingCopy): + (WebInspector.UISourceCode.prototype.setWorkingCopy): + (WebInspector.UISourceCode.prototype.isDirty): + 2012-07-03 Vsevolod Vlasov Web Inspector: Anonymous scripts (evals) should not be added to Workspace. diff --git a/Source/WebCore/inspector/front-end/ExtensionServer.js b/Source/WebCore/inspector/front-end/ExtensionServer.js index d55c26f..c16ae48 100644 --- a/Source/WebCore/inspector/front-end/ExtensionServer.js +++ b/Source/WebCore/inspector/front-end/ExtensionServer.js @@ -290,15 +290,17 @@ WebInspector.ExtensionServer.prototype = { _handleOpenURL: function(port, details) { - var resource = WebInspector.resourceForURL(details.url); - if (!resource) + var url = /** @type {String} */ details.url; + var contentProvider = WebInspector.workspace.uiSourceCodeForURL(url) || WebInspector.resourceForURL(url); + if (!contentProvider) return false; + var lineNumber = details.lineNumber; if (typeof lineNumber === "number") lineNumber += 1; port.postMessage({ command: "open-resource", - resource: this._makeResource(resource), + resource: this._makeResource(contentProvider), lineNumber: lineNumber }); return true; @@ -424,26 +426,35 @@ WebInspector.ExtensionServer.prototype = { return harLog; }, - _makeResource: function(resource) + /** + * @param {WebInspector.ContentProvider} contentProvider + */ + _makeResource: function(contentProvider) { return { - url: resource.url, - type: resource.type.name() + url: contentProvider.contentURL(), + type: contentProvider.contentType().name() }; }, _onGetPageResources: function() { - var resources = []; - function pushResourceData(resource) + var resources = {}; + + function pushResourceData(contentProvider) { - resources.push(this._makeResource(resource)); + if (!resources[contentProvider.contentURL()]) + resources[contentProvider.contentURL()] = this._makeResource(contentProvider); } + WebInspector.workspace.uiSourceCodes().forEach(pushResourceData.bind(this)); WebInspector.resourceTreeModel.forAllResources(pushResourceData.bind(this)); - return resources; + return Object.values(resources); }, - _getResourceContent: function(resource, message, port) + /** + * @param {WebInspector.ContentProvider} contentProvider + */ + _getResourceContent: function(contentProvider, message, port) { /** * @param {?string} content @@ -458,7 +469,7 @@ WebInspector.ExtensionServer.prototype = { }; this._dispatchCallback(message.requestId, port, response); } - resource.requestContent(onContentAvailable.bind(this)); + contentProvider.requestContent(onContentAvailable.bind(this)); }, _onGetRequestContent: function(message, port) @@ -471,10 +482,11 @@ WebInspector.ExtensionServer.prototype = { _onGetResourceContent: function(message, port) { - var resource = WebInspector.resourceTreeModel.resourceForURL(message.url); - if (!resource) - return this._status.E_NOTFOUND(message.url); - this._getResourceContent(resource.uiSourceCode() || resource, message, port); + var url = /** @type {String} */ message.url; + var contentProvider = WebInspector.workspace.uiSourceCodeForURL(url) || WebInspector.resourceForURL(url); + if (!contentProvider) + return this._status.E_NOTFOUND(url); + this._getResourceContent(contentProvider, message, port); }, _onSetResourceContent: function(message, port) @@ -487,10 +499,20 @@ WebInspector.ExtensionServer.prototype = { var response = error ? this._status.E_FAILED(error) : this._status.OK(); this._dispatchCallback(message.requestId, port, response); } - var resource = WebInspector.resourceTreeModel.resourceForURL(message.url); - if (!resource) - return this._status.E_NOTFOUND(message.url); - resource.setContent(message.content, message.commit, callbackWrapper.bind(this)); + + var url = /** @type {String} */ message.url; + var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url); + if (!uiSourceCode) { + var resource = WebInspector.resourceTreeModel.resourceForURL(url); + if (!resource) + return this._status.E_NOTFOUND(url); + return this._status.E_NOTSUPPORTED("Resource is not editable") + } + uiSourceCode.setWorkingCopy(message.content); + if (message.commit) + uiSourceCode.commitWorkingCopy(callbackWrapper.bind(this)); + else + callbackWrapper.call(this); }, _requestId: function(request) @@ -550,8 +572,8 @@ WebInspector.ExtensionServer.prototype = { this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.NetworkRequestFinished, WebInspector.networkManager, WebInspector.NetworkManager.EventTypes.RequestFinished, this._notifyRequestFinished); this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.ResourceAdded, - WebInspector.resourceTreeModel, - WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, + WebInspector.workspace, + WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._notifyResourceAdded); if (WebInspector.panels.elements) { this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.ElementsPanelObjectSelected, @@ -592,13 +614,15 @@ WebInspector.ExtensionServer.prototype = { _notifyResourceAdded: function(event) { - var resource = event.data; - this._postNotification(WebInspector.extensionAPI.Events.ResourceAdded, this._makeResource(resource)); + var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data; + this._postNotification(WebInspector.extensionAPI.Events.ResourceAdded, this._makeResource(uiSourceCode)); }, _notifyResourceContentCommitted: function(event) { - this._postNotification(WebInspector.extensionAPI.Events.ResourceContentCommitted, this._makeResource(event.data.resource), event.data.content); + var resource = /** @type {WebInspector.Resource} */ event.data.resource; + var contentProvider = resource.uiSourceCode() || resource; + this._postNotification(WebInspector.extensionAPI.Events.ResourceContentCommitted, this._makeResource(contentProvider), event.data.content); }, _notifyRequestFinished: function(event) diff --git a/Source/WebCore/inspector/front-end/JavaScriptSource.js b/Source/WebCore/inspector/front-end/JavaScriptSource.js index 6e6c65b..e66b41a 100644 --- a/Source/WebCore/inspector/front-end/JavaScriptSource.js +++ b/Source/WebCore/inspector/front-end/JavaScriptSource.js @@ -86,6 +86,7 @@ WebInspector.JavaScriptSource.prototype = { // Re-request content this._contentLoaded = false; + this._content = false; WebInspector.UISourceCode.prototype.requestContent.call(this, didGetContent.bind(this)); /** diff --git a/Source/WebCore/inspector/front-end/StylesPanel.js b/Source/WebCore/inspector/front-end/StylesPanel.js index 5a7ad4a..52c4692 100644 --- a/Source/WebCore/inspector/front-end/StylesPanel.js +++ b/Source/WebCore/inspector/front-end/StylesPanel.js @@ -97,23 +97,49 @@ WebInspector.StyleSource = function(resource) WebInspector.UISourceCode.call(this, resource.url, resource, resource); } +WebInspector.StyleSource.updateTimeout = 200; + WebInspector.StyleSource.prototype = { /** * @param {function(?string)} callback */ workingCopyCommitted: function(callback) { - WebInspector.cssModel.resourceBinding().setStyleContent(this, this.workingCopy(), true, callback); + this._commitIncrementalEdit(true, callback); }, workingCopyChanged: function() - { - function commitIncrementalEdit() - { - WebInspector.cssModel.resourceBinding().setStyleContent(this, this.workingCopy(), false, function() {}); - } - const updateTimeout = 200; - this._incrementalUpdateTimer = setTimeout(commitIncrementalEdit.bind(this), updateTimeout); + { + this._callOrSetTimeout(this._commitIncrementalEdit.bind(this, false, function() {})); + }, + + /** + * @param {function(?string)} callback + */ + _callOrSetTimeout: function(callback) + { + // FIXME: Extensions tests override updateTimeout because extensions don't have any control over applying changes to domain specific bindings. + if (WebInspector.StyleSource.updateTimeout >= 0) + this._incrementalUpdateTimer = setTimeout(callback, WebInspector.StyleSource.updateTimeout); + else + callback(); + }, + + /** + * @param {boolean} majorChange + * @param {function(?string)} callback + */ + _commitIncrementalEdit: function(majorChange, callback) + { + this._clearIncrementalUpdateTimer(); + WebInspector.cssModel.resourceBinding().setStyleContent(this, this.workingCopy(), majorChange, callback); + }, + + _clearIncrementalUpdateTimer: function() + { + if (this._incrementalUpdateTimer) + clearTimeout(this._incrementalUpdateTimer); + delete this._incrementalUpdateTimer; } } @@ -183,13 +209,6 @@ WebInspector.StyleSourceFrame.prototype = { delete this._isCommittingEditing; }, - _clearIncrementalUpdateTimer: function() - { - if (this._incrementalUpdateTimer) - clearTimeout(this._incrementalUpdateTimer); - delete this._incrementalUpdateTimer; - }, - /** * @param {WebInspector.Event} event */ diff --git a/Source/WebCore/inspector/front-end/UISourceCode.js b/Source/WebCore/inspector/front-end/UISourceCode.js index 4c2b3da..ce2d315 100644 --- a/Source/WebCore/inspector/front-end/UISourceCode.js +++ b/Source/WebCore/inspector/front-end/UISourceCode.js @@ -127,7 +127,7 @@ WebInspector.UISourceCode.prototype = { */ requestContent: function(callback) { - if (this._contentLoaded) { + if (this._content || this._contentLoaded) { callback(this._content, false, this._mimeType); return; } @@ -171,7 +171,6 @@ WebInspector.UISourceCode.prototype = { */ workingCopy: function() { - console.assert(this._contentLoaded); if (this.isDirty()) return this._workingCopy; return this._content; @@ -182,7 +181,6 @@ WebInspector.UISourceCode.prototype = { */ setWorkingCopy: function(newWorkingCopy) { - console.assert(this._contentLoaded); var oldWorkingCopy = this._workingCopy; if (this._content === newWorkingCopy) delete this._workingCopy; @@ -230,7 +228,7 @@ WebInspector.UISourceCode.prototype = { */ isDirty: function() { - return this._contentLoaded && typeof this._workingCopy !== "undefined" && this._workingCopy !== this._content; + return typeof this._workingCopy !== "undefined" && this._workingCopy !== this._content; }, /** diff --git a/Source/WebCore/inspector/front-end/Workspace.js b/Source/WebCore/inspector/front-end/Workspace.js index e3891cf..101805f 100644 --- a/Source/WebCore/inspector/front-end/Workspace.js +++ b/Source/WebCore/inspector/front-end/Workspace.js @@ -76,6 +76,21 @@ WebInspector.CompositeUISourceCodeProvider.prototype = { }, /** + * @param {String} url + * @return {WebInspector.UISourceCode} + */ + uiSourceCodeForURL: function(url) + { + for (var i = 0; i < this._uiSourceCodeProviders.length; ++i) { + var uiSourceCodes = this._uiSourceCodeProviders[i].uiSourceCodes(); + for (var j = 0; j < uiSourceCodes.length; ++j) { + if (uiSourceCodes[j].url === url) + return uiSourceCodes[j]; + } + } + }, + + /** * @return {Array.} */ uiSourceCodes: function() -- 2.7.4