Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 18dd431

Browse files
authored
Merge pull request #13964 from adobe/petetnt/fix-onbeforeunload
Don't prompt before unload while in SpecRunner
2 parents b96625a + c97a5ea commit 18dd431

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/document/DocumentCommandHandlers.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,19 +1718,23 @@ define(function (require, exports, module) {
17181718

17191719
/** Reload Without Extensions commnad handler **/
17201720
var handleReloadWithoutExts = _.partial(handleReload, true);
1721-
1722-
/**
1723-
* Attach a beforeunload handler to notify user about unsaved changes and URL redirection in CEF.
1721+
1722+
/**
1723+
* Attach a beforeunload handler to notify user about unsaved changes and URL redirection in CEF.
17241724
* Prevents data loss in scenario reported under #13708
17251725
**/
17261726
window.onbeforeunload = function(e) {
1727+
if (window.location.pathname.indexOf('SpecRunner') > -1) {
1728+
return;
1729+
}
1730+
17271731
var openDocs = DocumentManager.getAllOpenDocuments();
1728-
1732+
17291733
// Detect any unsaved changes
17301734
openDocs = openDocs.filter(function(doc) {
17311735
return doc && doc.isDirty;
17321736
});
1733-
1737+
17341738
// Ensure we are not in normal app-quit or reload workflow
17351739
if (!_isReloading && !_windowGoingAway) {
17361740
if (openDocs.length > 0) {
@@ -1740,7 +1744,7 @@ define(function (require, exports, module) {
17401744
}
17411745
}
17421746
};
1743-
1747+
17441748
/** Do some initialization when the DOM is ready **/
17451749
AppInit.htmlReady(function () {
17461750
// If in Reload Without User Extensions mode, update UI and log console message

0 commit comments

Comments
 (0)