Bug 1942618 - Remove inline event handler and use restrictive CSP for selectBookmarkDialog. r=settings-reviewers,mossop

Differential Revision: https://phabricator.services.mozilla.com/D235456
This commit is contained in:
Tom Schuster
2025-01-28 15:04:10 +00:00
parent 8d61f15c5c
commit edc685ee91
2 changed files with 7 additions and 4 deletions

View File

@@ -40,8 +40,11 @@ XPCOMUtils.defineLazyScriptGetter(
*/
var SelectBookmarkDialog = {
init: function SBD_init() {
document.getElementById("bookmarks").place =
let bookmarks = document.getElementById("bookmarks");
bookmarks.place =
"place:type=" + Ci.nsINavHistoryQueryOptions.RESULTS_AS_ROOTS_QUERY;
bookmarks.addEventListener("dblclick", () => this.onItemDblClick());
bookmarks.addEventListener("select", () => this.selectionChanged());
// Initial update of the OK button.
this.selectionChanged();
@@ -117,3 +120,5 @@ var SelectBookmarkDialog = {
window.arguments[0].names = names;
},
};
window.addEventListener("load", () => SelectBookmarkDialog.init());

View File

@@ -9,7 +9,7 @@
data-l10n-id="select-bookmark-window2"
data-l10n-attrs="title, style"
persist="width height"
onload="SelectBookmarkDialog.init();"
csp="default-src chrome:; style-src chrome: 'unsafe-inline';"
>
<dialog id="selectBookmarkDialog">
<linkset>
@@ -46,8 +46,6 @@
style="height: 15em"
hidecolumnpicker="true"
seltype="single"
ondblclick="SelectBookmarkDialog.onItemDblClick();"
onselect="SelectBookmarkDialog.selectionChanged();"
disableUserActions="true"
>
<treecols>