Index: third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
index 21ee1c4e428476da7854038d60fb4c298a4f892d..e43f951020befc6e56afef9e54c20d9062f0fbf0 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
+++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
@@ -57,11 +57,19 @@ WebInspector.SourcesView = function() |
workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this); |
workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved, this._projectRemoved.bind(this), this); |
+ /** |
+ * @param {!Event} event |
+ */ |
function handleBeforeUnload(event) |
{ |
if (event.returnValue) |
return; |
- var unsavedSourceCodes = WebInspector.workspace.unsavedSourceCodes(); |
+ |
+ var unsavedSourceCodes = []; |
+ var projects = WebInspector.workspace.projectsForType(WebInspector.projectTypes.FileSystem); |
+ for (var i = 0; i < projects.length; ++i) |
+ unsavedSourceCodes = unsavedSourceCodes.concat(projects[i].uiSourceCodes().filter(isUnsaved)); |
+ |
if (!unsavedSourceCodes.length) |
return; |
@@ -69,7 +77,20 @@ WebInspector.SourcesView = function() |
WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.instance()); |
for (var i = 0; i < unsavedSourceCodes.length; ++i) |
WebInspector.Revealer.reveal(unsavedSourceCodes[i]); |
+ |
+ /** |
+ * @param {!WebInspector.UISourceCode} sourceCode |
+ * @return {boolean} |
+ */ |
+ function isUnsaved(sourceCode) |
+ { |
+ var binding = WebInspector.persistence.binding(sourceCode); |
+ if (binding) |
+ return binding.network.isDirty(); |
+ return sourceCode.isDirty(); |
+ } |
} |
+ |
if (!window.opener) |
window.addEventListener("beforeunload", handleBeforeUnload, true); |