Skip to content

Commit 09800e0

Browse files
author
Chris K
committed
Fix for DFL-2892, JS Error on opening Dragonfly.
1 parent 2db52b2 commit 09800e0

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

src/ui-scripts/actions/actionbroker.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,17 @@ var ActionBroker = function()
277277
var shortcuts_hash = window.settings.general.get("shortcuts-hash");
278278
if (this._hash_shortcuts(default_shortcuts) != shortcuts_hash)
279279
{
280-
stored_shortcuts = this._sync_shortcuts(default_shortcuts, stored_shortcuts);
281-
this._store_shortcuts(stored_shortcuts);
280+
try
281+
{
282+
stored_shortcuts = this._sync_shortcuts(default_shortcuts, stored_shortcuts);
283+
this._store_shortcuts(stored_shortcuts);
284+
}
285+
catch(e)
286+
{
287+
stored_shortcuts = null;
288+
window.settings.general.set("shortcuts", null);
289+
window.settings.general.set("shortcuts-hash", "");
290+
}
282291
}
283292
}
284293
return stored_shortcuts || default_shortcuts;

src/ui-scripts/dialog.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,27 @@ function ConfirmDialogPrototype()
126126
ConfirmDialogPrototype.prototype = new BaseDialog();
127127
ConfirmDialog.prototype = new ConfirmDialogPrototype();
128128

129+
/**
130+
* @constructor
131+
*/
132+
function AlertDialog(template, ok_callback) {
133+
this._init(template, ok_callback || function() {});
134+
};
135+
136+
function AlertDialogPrototype()
137+
{
138+
this._init = function(template, ok_callback)
139+
{
140+
var buttons = [
141+
{
142+
label: ui_strings.S_BUTTON_OK,
143+
handler: ok_callback,
144+
}
145+
];
146+
BaseDialog.prototype._init.call(this, template, buttons);
147+
};
148+
};
149+
150+
AlertDialogPrototype.prototype = new BaseDialog();
151+
AlertDialog.prototype = new AlertDialogPrototype();
152+

src/ui-strings/ui_strings-en.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,3 +1694,6 @@ ui_strings.S_SCRIPT_TYPE_EXTENSIONJS = "Extension";
16941694

16951695
/* DESC: Script type for events in the profiler */
16961696
ui_strings.S_SCRIPT_TYPE_DEBUGGER = "Debugger";
1697+
1698+
/* DESC: Alert dialog that updating of the custom shortcuts with new ones has failed. */
1699+
ui_strings.D_SHORTCUTS_UPDATE_FAILED = "We could not update your custom keyboard shortcuts with the new ones.";

0 commit comments

Comments
 (0)