Chromium Code Reviews| 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 660ef8337440a1872046011e3ed7ef307a75da60..542fad929c7fbf4516a3d24b6fbcf59ed6cd97fc 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() || binding.persistent.isDirty(); |
|
dgozman
2016/09/22 19:55:54
Only check network.
lushnikov
2016/09/23 21:56:13
Done.
|
| + return sourceCode.isDirty(); |
| + } |
| } |
| + |
| if (!window.opener) |
| window.addEventListener("beforeunload", handleBeforeUnload, true); |