mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-15 04:00:34 +08:00
Workaround Firefox bug showing beforeunload twice
This commit is contained in:
parent
03b4e32ecb
commit
23b9e0ec81
@ -67,6 +67,8 @@ define(function (require) {
|
|||||||
this.last_modified = null;
|
this.last_modified = null;
|
||||||
// debug 484
|
// debug 484
|
||||||
this._last_modified = 'init';
|
this._last_modified = 'init';
|
||||||
|
// Firefox workaround
|
||||||
|
this._ff_beforeunload_fired = false;
|
||||||
|
|
||||||
// Create default scroll manager.
|
// Create default scroll manager.
|
||||||
this.scroll_manager = new scrollmanager.ScrollManager(this);
|
this.scroll_manager = new scrollmanager.ScrollManager(this);
|
||||||
@ -314,6 +316,17 @@ define(function (require) {
|
|||||||
if (kill_kernel) {
|
if (kill_kernel) {
|
||||||
that.session.delete();
|
that.session.delete();
|
||||||
}
|
}
|
||||||
|
if ( utils.browser[0] === "Firefox") {
|
||||||
|
// Workaround ancient Firefox bug showing beforeunload twice: https://bugzilla.mozilla.org/show_bug.cgi?id=531199
|
||||||
|
if (that._ff_beforeunload_fired) {
|
||||||
|
return; // don't show twice on FF
|
||||||
|
}
|
||||||
|
that._ff_beforeunload_fired = true;
|
||||||
|
// unset flag immediately after dialog is dismissed
|
||||||
|
setTimeout(function () {
|
||||||
|
that._ff_beforeunload_fired = false;
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
// if we are autosaving, trigger an autosave on nav-away.
|
// if we are autosaving, trigger an autosave on nav-away.
|
||||||
// still warn, because if we don't the autosave may fail.
|
// still warn, because if we don't the autosave may fail.
|
||||||
if (that.dirty) {
|
if (that.dirty) {
|
||||||
|
Loading…
Reference in New Issue
Block a user